本文整理匯總了PHP中ca_users::purify方法的典型用法代碼示例。如果您正苦於以下問題:PHP ca_users::purify方法的具體用法?PHP ca_users::purify怎麽用?PHP ca_users::purify使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ca_users
的用法示例。
在下文中一共展示了ca_users::purify方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: resetSave
function resetSave()
{
MetaTagManager::setWindowTitle($this->request->config->get("app_display_name") . ": " . _t("Reset Password"));
$ps_action = $this->request->getParameter('action', pString);
if (!$ps_action) {
$ps_action = "reset";
}
$ps_key = $this->request->getParameter('key', pString);
$ps_key = preg_replace("/[^A-Za-z0-9]+/", "", $ps_key);
$this->view->setVar("key", $ps_key);
$this->view->setVar("email", $this->request->config->get("ca_admin_email"));
$o_check_key = new Db();
$qr_check_key = $o_check_key->query("\n\t\t\t\tSELECT user_id \n\t\t\t\tFROM ca_users \n\t\t\t\tWHERE\n\t\t\t\t\tmd5(concat(concat(user_id, '/'), password)) = ?\n\t\t\t", $ps_key);
#
# Check reset key
#
if (!$qr_check_key->nextRow() || !($vs_user_id = $qr_check_key->get("user_id"))) {
$this->view->setVar("action", "reset_failure");
$this->view->setVar("message", _t("Your password could not be reset"));
$this->render('LoginReg/form_reset_html.php');
} else {
$ps_password = $this->request->getParameter('password', pString);
$ps_password_confirm = $this->request->getParameter('password_confirm', pString);
switch ($ps_action) {
case 'reset_save':
if (!$ps_password || !$ps_password_confirm) {
$this->view->setVar("message", _t("Please enter and re-type your password."));
$ps_action = "reset";
break;
}
if ($ps_password != $ps_password_confirm) {
$this->view->setVar("message", _t("Passwords do not match. Please try again."));
$ps_action = "reset";
break;
}
$t_user = new ca_users();
$t_user->purify(true);
$t_user->load($vs_user_id);
# verify user exists with this e-mail address
if ($t_user->getPrimaryKey()) {
# user with e-mail already exists...
$t_user->setMode(ACCESS_WRITE);
$t_user->set("password", $ps_password);
$t_user->update();
if ($t_user->numErrors()) {
$this->notification->addNotification(join("; ", $t_user->getErrors()), __NOTIFICATION_TYPE_INFO__);
$ps_action = "reset_failure";
} else {
$ps_action = "reset_success";
$o_view = new View($this->request, array($this->request->getViewsDirectoryPath()));
# -- generate email subject
$vs_subject_line = $o_view->render("mailTemplates/notification_subject.tpl");
# -- generate mail text from template - get both the html and text versions
$vs_mail_message_text = $o_view->render("mailTemplates/notification.tpl");
$vs_mail_message_html = $o_view->render("mailTemplates/notification_html.tpl");
caSendmail($t_user->get('email'), $this->request->config->get("ca_admin_email"), $vs_subject_line, $vs_mail_message_text, $vs_mail_message_html);
}
break;
} else {
$this->notification->addNotification(_t("Invalid user"), __NOTIFICATION_TYPE_INFO__);
$ps_action = "reset_failure";
}
}
$this->view->setVar("action", $ps_action);
$this->render('LoginReg/form_reset_html.php');
}
}