private function getRequestLink(GWF_User $user) { $userid = $user->getID(); require_once GWF_CORE_PATH . 'module/Account/GWF_AccountChange.php'; if (false === ($token = GWF_AccountChange::createToken($userid, 'pass'))) { return 'ERR'; } $url = Common::getAbsoluteURL(sprintf('change_password/%d/%s', $userid, $token)); return sprintf('<a href="%s">%s</a>', $url, $url); }
private function templateChange(GWF_AccountChange $ac) { $form = $this->getForm(); $tVars = array('form' => $form->templateY($this->module->lang('title_change')), 'username' => $ac->getUser()->displayUsername()); return $this->module->templatePHP('change.php', $tVars); }
private function onChange($token) { $userid = (int) Common::getGet('userid'); if (false === ($ac = GWF_AccountChange::checkToken($userid, $token, 'demo'))) { return $this->module->error('err_token'); } if (false === ($user = GWF_User::getByID($userid))) { return GWF_HTML::err('ERR_UNKNOWN_USER'); } if (false === ($data = @unserialize($ac->getVar('data')))) { return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__)); } if (false === $user->saveVars($data)) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } if (false === $ac->delete()) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } GWF_AccountChange::createToken($userid, 'demo_lock'); return $this->module->message('msg_demo_changed'); }
private function onChangeB($token) { $userid = (int) Common::getGet('userid'); if (false === ($ac = GWF_AccountChange::checkToken($userid, $token, 'email2'))) { return $this->module->error('err_token'); } if (false === ($user = $ac->getUser())) { return GWF_HTML::err('ERR_UNKNOWN_USER'); } if (false === $ac->delete()) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } $oldmail = $user->getValidMail(); $newmail = $ac->getVar('data'); if (false === GWF_Hook::call(GWF_Hook::CHANGE_MAIL, $user, array($oldmail, $newmail))) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } if (false === $user->saveVar('user_email', $newmail)) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } if (false === $user->saveOption(GWF_User::MAIL_APPROVED, true)) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } return $this->module->message('msg_mail_changed', array(htmlspecialchars($newmail))); }