Index: branches/unlabeled/unlabeled-1.78.2/kernel/frontaction.php =================================================================== diff -u -r7696 -r7944 --- branches/unlabeled/unlabeled-1.78.2/kernel/frontaction.php (.../frontaction.php) (revision 7696) +++ branches/unlabeled/unlabeled-1.78.2/kernel/frontaction.php (.../frontaction.php) (revision 7944) @@ -377,186 +377,189 @@ break; case "m_register": - $_POST=inp_escape($_POST); - $MissingCount = SetMissingDataErrors("m_register"); + $_POST=inp_escape($_POST); + $MissingCount = SetMissingDataErrors("m_register"); - if(!$objConfig->Get("User_Password_Auto")) - { - if(($_POST["password"] != $_POST["passwordverify"]) || !strlen($_POST["passwordverify"])) - { - $MissingCount++; - $FormError["m_register"]["passwordverify"] = language("lu_ferror_pswd_mismatch"); - } + if(!$objConfig->Get("User_Password_Auto")) + { + if(($_POST["password"] != $_POST["passwordverify"]) || !strlen($_POST["passwordverify"])) + { + $MissingCount++; + $FormError["m_register"]["passwordverify"] = language("lu_ferror_pswd_mismatch"); + } - if(strlen($_POST["password"])>30) - { - // echo "VAR: ".$_POST["password"]; die(); - $MissingCount++; - $FormError["m_register"]["password"] = language("lu_ferror_pswd_toolong"); - } + if(strlen($_POST["password"])>30) + { + // echo "VAR: ".$_POST["password"]; die(); + $MissingCount++; + $FormError["m_register"]["password"] = language("lu_ferror_pswd_toolong"); + } - if (strlen($_POST['password']) < $objConfig->Get("Min_Password")) - { - $MissingCount++; - $FormError["m_register"]["password"] = language("lu_ferror_pswd_tooshort"); - } - } + if (strlen($_POST['password']) < $objConfig->Get("Min_Password")) + { + $MissingCount++; + $FormError["m_register"]["password"] = language("lu_ferror_pswd_tooshort"); + } + } - if(($_POST["username"]=="root")) - { - $MissingCount++; - $FormError["m_register"]["username"] = language("lu_user_exists"); - } - else - { + if(($_POST["username"]=="root")) + { + $MissingCount++; + $FormError["m_register"]["username"] = language("lu_user_exists"); + } + else + { - $u = $objUsers->GetItemByField("Login",$_POST["username"]); - if(is_object($u)) - { - if($u->Get("Login")==$_POST["username"]) - { - $MissingCount++; - $FormError["m_register"]["username"] = language("lu_user_exists"); - } - } - } + $u = $objUsers->GetItemByField("Login",$_POST["username"]); + if(is_object($u)) + { + if($u->Get("Login")==$_POST["username"]) + { + $MissingCount++; + $FormError["m_register"]["username"] = language("lu_user_exists"); + } + } + } - if (strlen($_POST['username']) < $objConfig->Get("Min_UserName")) - { - $MissingCount++; - $FormError["m_register"]["username"] = language("lu_ferror_username_tooshort"); - } + if (strlen($_POST['username']) < $objConfig->Get("Min_UserName")) + { + $MissingCount++; + $FormError["m_register"]["username"] = language("lu_ferror_username_tooshort"); + } - if(!$MissingCount) - { - $CreatedOn = adodb_date("U"); - $GroupId = $objConfig->Get("User_NewGroup"); - $Status=0; + if(!$MissingCount) + { + $CreatedOn = adodb_date("U"); + $GroupId = $objConfig->Get("User_NewGroup"); + $Status=0; - /* determine the status of new users */ - switch ($objConfig->Get("User_Allow_New")) - { - case "1": - $Status=1; - break; - case "3": - $Status=2; - break; - } + /* determine the status of new users */ + switch ($objConfig->Get("User_Allow_New")) + { + case "1": + $Status=1; + break; + case "3": + $Status=2; + break; + } - /* set Destination template */ - $var_list["t"] = strlen($_GET["dest"])? $_GET["dest"] : "index"; + /* set Destination template */ + $var_list["t"] = strlen($_GET["dest"])? $_GET["dest"] : "index"; - if($Status>0) - { - if ($objConfig->Get("User_Password_Auto")) { - $password = makepassword(); -// $objSession->Set("password", $password); - SetVar('user_password', $password); - } - else { - $password = $_POST["password"]; - } + if($Status>0) + { + if ($objConfig->Get("User_Password_Auto")) { + $password = makepassword(); + // $objSession->Set("password", $password); + SetVar('user_password', $password); + } + else { + $password = $_POST["password"]; + } - $dob = adodb_mktime(0, 0, 0, $_POST['dob_month'], $_POST['dob_day'], $_POST['dob_year']); - $ip = $_SERVER['REMOTE_ADDR']; + $dob = adodb_mktime(0, 0, 0, $_POST['dob_month'], $_POST['dob_day'], $_POST['dob_year']); + $ip = $_SERVER['REMOTE_ADDR']; - $application =& kApplication::Instance(); - $application->SetVar('user_password', $password); - SetVar('user_password', $password); - $fields_hash = Array('Login' => $_POST['username'], - 'Password' => md5($password), - 'FirstName' => $_POST['firstname'], - 'LastName' => $_POST['lastname'], - 'Company' => $_POST['company'], - 'Email' => $_POST['email'], - 'Status' => $Status, - 'Phone' => $_POST['phone'], - 'Fax' => $_POST['fax'], - 'Street' => $_POST['street'], - 'Street2' => $_POST['street2'], - 'City' => $_POST['city'], - 'State' => $_POST['state'], - 'Zip' => $_POST['zip'], - 'Country' => $_POST['country'], - 'CreatedOn' => $CreatedOn, - 'dob' => $dob, - 'ip' => $ip); - $u =& $objUsers->Add_User_NEW($fields_hash, true); + $application =& kApplication::Instance(); + $application->SetVar('user_password', $password); + SetVar('user_password', $password); + $fields_hash = Array('Login' => $_POST['username'], + 'Password' => md5($password), + 'FirstName' => $_POST['firstname'], + 'LastName' => $_POST['lastname'], + 'Company' => $_POST['company'], + 'Email' => $_POST['email'], + 'Status' => $Status, + 'Phone' => $_POST['phone'], + 'Fax' => $_POST['fax'], + 'Street' => $_POST['street'], + 'Street2' => $_POST['street2'], + 'City' => $_POST['city'], + 'State' => $_POST['state'], + 'Zip' => $_POST['zip'], + 'Country' => $_POST['country'], + 'CreatedOn' => $CreatedOn, + 'dob' => $dob, + 'ip' => $ip); + $u =& $objUsers->Add_User_NEW($fields_hash, true); - if(!is_object($u)) - { - $RuleId=$u; - $r = $objBanList->GetItem($RuleId); - $err = $r->Get("ErrorTag"); + if(!is_object($u)) + { + $RuleId=$u; + $r = $objBanList->GetItem($RuleId); + $err = $r->Get("ErrorTag"); - if(strlen($err)) - { - $FormError["m_register"][$r->Get("ItemField")] = language($err); - $MissingCount++; - } - } - else - { - $u->Set("Password",$password); - $u->Clean(); - if($GroupId>0) - { - $g = $objGroups->GetItem($GroupId); - $g->AddUser($u->Get("PortalUserId"),1,false); - } + if(strlen($err)) + { + $FormError["m_register"][$r->Get("ItemField")] = language($err); + $MissingCount++; + } + } + else + { + $u->Set("Password",$password); + $u->Clean(); + if($GroupId>0) + { + $g = $objGroups->GetItem($GroupId); + $g->AddUser($u->Get("PortalUserId"),1,false); + } - $custom = $_POST["custom"]; - if (is_array($custom)) { - for($x = 0; $x < count($custom); $x++) { - $u->SetCustomField($custom[$x],$_POST[$custom[$x]]); - } - $u->SaveCustomFields(); - } + $custom = $_POST["custom"]; + if (is_array($custom)) { + for($x = 0; $x < count($custom); $x++) { + $u->SetCustomField($custom[$x],$_POST[$custom[$x]]); + } + $u->SaveCustomFields(); + } - if($Status==1) - { - if($objConfig->Get("User_Password_Auto")) - { - $u->SendUserEventMail("USER.VALIDATE",$u->Get("PortalUserId")); - $u->SendAdminEventMail("USER.VALIDATE"); - } - else - { - $doLoginNow = true; - $u->SendUserEventMail("USER.ADD",$u->Get("PortalUserId")); - $u->SendAdminEventMail("USER.ADD"); - } - } - else - { - $u->SendUserEventMail("USER.ADD.PENDING",$u->Get("PortalUserId")); - $u->SendAdminEventMail("USER.ADD.PENDING"); - } + if($Status==1) + { + if($objConfig->Get("User_Password_Auto")) + { + $u->SendUserEventMail("USER.VALIDATE",$u->Get("PortalUserId")); + $u->SendAdminEventMail("USER.VALIDATE"); + } + else + { + $doLoginNow = true; + $u->SendUserEventMail("USER.ADD",$u->Get("PortalUserId")); + $u->SendAdminEventMail("USER.ADD"); + } + } + else + { + $u->SendUserEventMail("USER.ADD.PENDING",$u->Get("PortalUserId")); + $u->SendAdminEventMail("USER.ADD.PENDING"); + } - if ($doLoginNow) - { - $login_ok = $objSession->Login($_POST["username"], md5($password)); - if($login_ok) - { - $next_template = $objSession->GetVariable('next_template'); - if($next_template) - { - $objSession->SetVariable('next_template',''); - $var_list_update["t"] = $next_template; - header('Location: ' . HREF_Wrapper() ); - exit; - $var_list['t'] = $next_template.'.tpl'; - } + if ($doLoginNow) + { + $login_ok = $objSession->Login($_POST["username"], md5($password)); + if($login_ok) + { + $next_template = $objSession->GetVariable('next_template'); + if (!$next_template) { +// $next_template = strlen($_GET["dest"])? $_GET["dest"] : "index"; + } + if($next_template) + { + $objSession->SetVariable('next_template',''); + $var_list_update["t"] = $next_template; + header('Location: ' . HREF_Wrapper() ); + exit; + $var_list['t'] = $next_template.'.tpl'; + } - } - } - } - } - } - break; + } + } + } + } + } + break; case "m_add_friend": $id = $_GET["UserId"]; $userid = $objSession->Get("PortalUserId");