function _updatePassword(&$controller) { $this->mActionForm->fetch(); $userHandler =& xoops_gethandler('user'); $criteria = new CriteriaCompo(new Criteria('email', $this->mActionForm->get('email'))); $criteria->add(new Criteria('pass', $this->mActionForm->get('code'), '=', '', 'LEFT(%s, 5)')); $lostUserArr =& $userHandler->getObjects($criteria); if (is_array($lostUserArr) && count($lostUserArr) > 0) { $lostUser =& $lostUserArr[0]; } else { return USER_FRAME_VIEW_ERROR; } $newpass = xoops_makepass(); $extraVars['newpass'] = $newpass; $builder = new User_LostPass2MailBuilder(); $director = new User_LostPassMailDirector($builder, $lostUser, $controller->mRoot->mContext->getXoopsConfig(), $extraVars); $director->contruct(); $xoopsMailer =& $builder->getResult(); if (!$xoopsMailer->send()) { // $xoopsMailer->getErrors(); return USER_FRAME_VIEW_ERROR; } $lostUser->set('pass', md5($newpass), true); $userHandler->insert($lostUser, true); return USER_FRAME_VIEW_SUCCESS; }
$commande->setVar('cmd_delivery', $cmd_delivery); $commande->setVar('cmd_delivery_id', $cmd_delivery_id); $commande->setVar('cmd_payment', $cmd_payment); $commande->setVar('cmd_payment_id', $cmd_payment_id); $commande->setVar('cmd_status', 2); $commande->setVar('cmd_track', $cmd_track); $commande->setVar('cmd_gift', $cmd_gift); $res1 = $h_oledrion_commands->insert($commande, true); // Save caddy $caddy = $h_oledrion_caddy->create(true); $caddy->setVar('caddy_product_id', $product_id); $caddy->setVar('caddy_qte', $product->getVar('product_qty')); $caddy->setVar('caddy_price', oledrion_utils::formatFloatForDB($cmd_total)); $caddy->setVar('caddy_cmd_id', $commande->getVar('cmd_id')); $caddy->setVar('caddy_shipping', oledrion_utils::formatFloatForDB($cmd_shipping)); $caddy->setVar('caddy_pass', md5(xoops_makepass())); $res2 = $h_oledrion_caddy->insert($caddy, true); // Attributs /* if ($res2 && is_array($attributes) && count($attributes) > 0) { foreach ($attributes as $attributeId => $attributeInformation) { $caddyAttribute = $handlers->h_oledrion_caddy_attributes->create(true); $caddyAttribute->setVar('ca_cmd_id', $commande->getVar('cmd_id')); $caddyAttribute->setVar('ca_caddy_id', $caddy->getVar('caddy_id')); $caddyAttribute->setVar('ca_attribute_id', $attributeId); $selectedOptions = $attributeInformation['attribute_options']; $msgCommande .= '- ' . $attributeInformation['attribute_title'] . "\n"; foreach ($selectedOptions as $selectedOption) { $caddyAttribute ->addOption($selectedOption['option_name'], $selectedOption['option_value'], $selectedOption['option_price']); $msgCommande .= ' ' . $selectedOption['option_name'] . ' : ' . $selectedOption['option_ttc_formated'] . "\n"; } $handlers->h_oledrion_caddy_attributes->insert($caddyAttribute, true);
function generatePrefix() { include_once $this->root_path . "/include/functions.php"; return xoops_makepass(5); }
if ($email == '') { redirect_header("user.php", 2, _US_SORRYNOTFOUND, false); exit; } $myts =& MyTextSanitizer::getInstance(); $member_handler =& xoops_gethandler('member'); list($user) = $member_handler->getUsers(new Criteria('email', $myts->addSlashes($email))); if (empty($user)) { $msg = _US_SORRYNOTFOUND; redirect_header("user.php", 2, $msg, false); exit; } else { $code = isset($_GET['code']) ? trim($_GET['code']) : ''; $areyou = substr($user->getVar("pass"), 0, 5); if ($code != '' && $areyou == $code) { $newpass = xoops_makepass(); $xoopsMailer =& xoops_getMailer(); $xoopsMailer->useMail(); $xoopsMailer->setTemplate("lostpass2.tpl"); $xoopsMailer->assign("SITENAME", $GLOBALS['xoopsConfig']['sitename']); $xoopsMailer->assign("ADMINMAIL", $GLOBALS['xoopsConfig']['adminmail']); $xoopsMailer->assign("SITEURL", XOOPS_URL . "/"); $xoopsMailer->assign("IP", $_SERVER['REMOTE_ADDR']); $xoopsMailer->assign("NEWPWD", $newpass); $xoopsMailer->setToUsers($user); $xoopsMailer->setFromEmail($GLOBALS['xoopsConfig']['adminmail']); $xoopsMailer->setFromName($GLOBALS['xoopsConfig']['sitename']); $xoopsMailer->setSubject(sprintf(_US_NEWPWDREQ, XOOPS_URL)); if (!$xoopsMailer->send()) { echo $xoopsMailer->getErrors(); }
break; case 1: $level = 1; $mailtemplate = 'smartmail_auto_activate_user.tpl'; $aInfoMessages[] = sprintf(_NL_MA_NEW_USER_AUTO_ACT, $user_email); break; case 2: default: $level = 0; $mailtemplate = 'smartmail_admin_activate_user.tpl'; $aInfoMessages[] = sprintf(_NL_MA_NEW_USER_ADMIN_ACT, $user_email); } $password = xoops_makepass(); $name = substr($user_email, 0, strpos($user_email, "@") + 1); //Take the email adress without domain as username $actkey = xoops_makepass(); $newUser = smartmail_XoopsAccountFromEmail($user_email, $name, $password, $level, $actkey); $aNewsletters = $_POST['subscription_newsletters']; $sNewslettersForDisplay = implode(', ', $aNewsletters); $xoopsTpl->assign('subscription_newsletters', $aNewsletters); // Get list of allowed newsletters $newsletters = $smartmail_newsletter_handler->getAllowedList($newUser->getGroups()); /** * Subscribe this new user to the selected newsletters */ $subscriber_handler = xoops_getmodulehandler('subscriber'); $subscribedNewsletters = array(); foreach ($aNewsletters as $newsletterid) { if (isset($newsletters[$newsletterid])) { if (!$subscriber_handler->subscribe($newUser, $newsletterid)) { //subscription to this newsletter failed
function getConfirmView() { global $xoopsConfig, $xoopsDB; $myts =& MyTextSanitizer::getInstance(); $op = $myts->makeTboxData4Show($this->utils->getGetPost('op', '')); $email = $this->utils->getGetPost('email', ''); $code = trim($this->utils->getGet('code', '')); if ($email == '') { $this->controller->render->redirectHeader(_US_SORRYNOTFOUND, 5); exit; } $member_handler =& xoops_gethandler('member'); $user =& $member_handler->getUsers(new Criteria('email', $myts->addSlashes($email))); if (empty($user)) { $this->controller->render->redirectHeader(_US_SORRYNOTFOUND, 5); exit; } else { $areyou = substr($user[0]->getVar('pass'), 0, 5); if ($code != '' && $areyou == $code) { $newpass = xoops_makepass(); $xoopsMailer =& getMailer(); $xoopsMailer->useMail(); $xoopsMailer->setToUsers($user[0]); $xoopsMailer->setFromEmail($xoopsConfig['adminmail']); $xoopsMailer->setFromName($xoopsConfig['sitename']); $xoopsMailer->setSubject(sprintf(_US_NEWPWDREQ, XOOPS_URL)); $login_url = XMOBILE_URL . '/?act=login'; $site_url = XOOPS_URL . '/'; $mail_body = ''; $mail_body .= sprintf(_MD_XMOBILE_GREETING, $user[0]->getVar('uname')); $mail_body .= sprintf(_MD_XMOBILE_MAILBODY1, $_SERVER['REMOTE_ADDR'], $xoopsConfig['sitename']); $mail_body .= sprintf(_MD_XMOBILE_MAILBODY2, $user[0]->getVar('uname'), $newpass); $mail_body .= sprintf(_MD_XMOBILE_MAILBODY3, $login_url); $mail_body .= sprintf(_MD_XMOBILE_MAILBODY_SITENAME, $xoopsConfig['sitename'], $site_url); $mail_body .= sprintf(_MD_XMOBILE_MAILBODY_ADMINMAIL, $xoopsConfig['adminmail']); $xoopsMailer->setBody($mail_body); if (!$xoopsMailer->send()) { $this->controller->render->redirectHeader($xoopsMailer->getErrors(), 5); exit; } // Next step: add the new password to the database $sql = sprintf("UPDATE %s SET pass = '******' WHERE uid = %u", $xoopsDB->prefix('users'), md5($newpass), $user[0]->getVar('uid')); if (!$xoopsDB->queryF($sql)) { $this->controller->render->redirectHeader('sql error', 5); exit; } $this->controller->render->redirectHeader(sprintf(_US_PWDMAILED, $user[0]->getVar('uname')), 5); exit; } else { //チケットの確認 if (!($ticket_check = $this->ticket->check(true, '', false))) { $this->controller->render->redirectHeader(_MD_XMOBILE_TICKET_ERROR, 5); exit; } $xoopsMailer =& getMailer(); $xoopsMailer->useMail(); $xoopsMailer->setToUsers($user[0]); $xoopsMailer->setFromEmail($xoopsConfig['adminmail']); $xoopsMailer->setFromName($xoopsConfig['sitename']); $xoopsMailer->setSubject(sprintf(_US_NEWPWDREQ, $xoopsConfig['sitename'])); $mail_body = ''; $mail_body .= sprintf(_MD_XMOBILE_GREETING, $user[0]->getVar('uname')); $mail_body .= sprintf(_MD_XMOBILE_MAILBODY4, $_SERVER['REMOTE_ADDR'], $xoopsConfig['sitename']); $mail_body .= "\n" . XMOBILE_URL . "/?act=lostpass&view=confirm&email=" . $myts->makeTboxData4Show($email) . "&code=" . $areyou . "&op=mailpasswd\n"; $mail_body .= _MD_XMOBILE_MAILBODY5; $mail_body .= sprintf(_MD_XMOBILE_MAILBODY_SITENAME, $xoopsConfig['sitename'], XOOPS_URL); $mail_body .= sprintf(_MD_XMOBILE_MAILBODY_ADMINMAIL, $xoopsConfig['adminmail']); $xoopsMailer->setBody($mail_body); if (!$xoopsMailer->send()) { $message = $xoopsMailer->getErrors(); } else { $message = sprintf(_US_CONFMAIL, $user[0]->getVar('uname')); } $this->controller->render->template->assign('confirm_message', $message); } } }