Index: trunk/core/units/users/users_tag_processor.php =================================================================== diff -u -N --- trunk/core/units/users/users_tag_processor.php (revision 8842) +++ trunk/core/units/users/users_tag_processor.php (revision 0) @@ -1,222 +0,0 @@ - 'all,m,u', 'u_event' => 'OnLogout', 'm_cat_id'=>0); - $logout_template = $this->SelectParam($params, 'template,t'); - return $this->Application->HREF($logout_template, '', $pass); - } - - function UseUsernames($params) - { - return $this->Application->ConfigValue('Email_As_Login') != 1; - } - - function RegistrationEnabled($params) - { - return $this->Application->ConfigValue('User_Allow_New') != 2; - } - - function SuggestRegister($params) - { - return !$this->Application->LoggedIn() && !$this->Application->ConfigValue('Comm_RequireLoginBeforeCheckout') && $this->RegistrationEnabled($params); - } - - function ConfirmPasswordLink($params) - { - //global $m_var_list_update, $var_list_update, $objSession, $objConfig; - - $template = "forgotpw_reset_result"; - - $tmp_user_id = $this->Application->RecallVar("tmp_user_id"); - - $saved_denerated_code = $this->Application->GetVar('saved_denerated_code'); - if ($saved_denerated_code){ - $code = $saved_denerated_code; - } - else { - $code = md5($this->GenerateCode()); - $this->Application->SetVar('saved_denerated_code', $code); - } - - - - $sql = 'UPDATE '.TABLE_PREFIX.'PortalUser SET PwResetConfirm="'.$code.'", PwRequestTime='.adodb_mktime().' WHERE PortalUserId='.$tmp_user_id; - - $this->Conn->Query($sql); - - $params = array_merge($params, array('pass'=>'m', 'user_key'=>$code)); - - $main_processor =& $this->Application->recallObject('m_TagProcessor'); - - return $main_processor->T($params); - - } - - function GenerateCode() - { - list($usec, $sec) = explode(" ",microtime()); - - $id_part_1 = substr($usec, 4, 4); - $id_part_2 = mt_rand(1,9); - $id_part_3 = substr($sec, 6, 4); - $digit_one = substr($id_part_1, 0, 1); - if ($digit_one == 0) { - $digit_one = mt_rand(1,9); - $id_part_1 = ereg_replace("^0","",$id_part_1); - $id_part_1=$digit_one.$id_part_1; - } - return $id_part_1.$id_part_2.$id_part_3; - } - - function ForgottenPassword($params) - { - return $this->Application->GetVar('ForgottenPassword'); - } - - function TestCodeIsValid($params) - { - $passed_key = $this->Application->GetVar('user_key'); - - $user_object = &$this->Application->recallObject('u.forgot'); - - // used for error reporting only -> rewrite code + theme (by Alex) - $user_current_object = &$this->Application->recallObject('u', null, Array('skip_autoload' => true)); // TODO: change theme too - /* @var $user_current_object UsersItem */ - - if (strlen(trim($passed_key)) == 0) { - $user_current_object->SetError('PwResetConfirm', 'code_is_not_valid', 'lu_code_is_not_valid'); - return false; - } - - - if ($user_object->Load(array('PwResetConfirm'=>$passed_key))) { - $exp_time = $user_object->GetDBField('PwRequestTime') + 3600; - if ($exp_time > adodb_mktime()) - { - - - } else { - $user_current_object->SetError('PwResetConfirm', 'code_expired', 'lu_code_expired'); - return false; - - } - } - else { - $user_current_object->SetError('PwResetConfirm', 'code_is_not_valid', 'lu_code_is_not_valid'); - return false; - } - - return true; - } - - /** - * Returns sitem administrator email - * - * @param Array $params - * @return string - */ - function SiteAdminEmail($params) - { - return $this->Application->ConfigValue('Smtp_AdminMailFrom'); - } - - function AffiliatePaymentTypeChecked($params) - { - static $checked = false; - - if( $this->Application->GetVar('PaymentTypeId') ) - { - $apt_object =& $this->Application->recallObject('apt.active'); - if( $this->Application->GetVar('PaymentTypeId') == $apt_object->GetDBField('PaymentTypeId') ) - { - return 1; - } - else - { - return 0; - } - } - - if(!$checked) - { - $checked = true; - return 1; - } - else - { - return 0; - } - } - - function HasError($params) - { - $res = parent::HasError($params); - if($this->SelectParam($params,'field,fields') == 'any') - { - $res = $res || $this->Application->GetVar('MustAgreeToTerms'); // need to do it not put module fields into kernel ! (noticed by Alex) - $res = $res || $this->Application->GetVar('SSNRequiredError'); - } - return $res; - } - - /** - * Returns login name of user - * - * @param Array $params - */ - function LoginName($params) - { - $object =& $this->getObject($params); - return $object->GetID() != -1 ? $object->GetDBField('Login') : 'root'; - } - - function CookieUsername($params) - { - $submit_value = $this->Application->GetVar($params['submit_field']); - if ($submit_value !== false) { - return $submit_value; - } - - $username = $this->Application->GetVar('save_username'); // from cookie - - if ($username == 'super-root') { - $username = 'root'; - } - return $username === false ? '' : $username; - } - - /** - * Checks if user have one of required permissions - * - * @param Array $params - * @return bool - */ - function HasPermission($params) - { - $perm_helper =& $this->Application->recallObject('PermissionsHelper'); - /* @var $perm_helper kPermissionsHelper */ - - return $perm_helper->TagPermissionCheck($params); - } - - /** - * Returns link to post author public profile - * - * @param Array $params - * @return string - */ - function ProfileLink($params) - { - $object =& $this->getObject($params); - $params['user_id'] = $object->GetID(); - - return $this->Application->ProcessParsedTag('m', 'Link', $params); - } - - } - -?> \ No newline at end of file