Ejemplo n.º 1
0
 private static function sendMail(Module_Account $module, GWF_User $user, array $data)
 {
     $token = GWF_AccountChange::createToken($user->getID(), 'demo', serialize($data));
     $mail = new GWF_Mail();
     $mail->setSender($module->cfgMailSender());
     $mail->setReceiver($user->getVar('user_email'));
     $mail->setSubject($module->lang('chdemo_subj'));
     $username = $user->display('user_name');
     $timeout = GWF_Time::humanDuration($module->cfgChangeTime());
     $gender = GWF_HTML::display($user->getVar('user_gender'));
     $country = GWF_Country::getByIDOrUnknown($data['user_countryid'])->display('country_name');
     $lang1 = GWF_Language::getByIDOrUnknown($data['user_langid'])->display('lang_nativename');
     $lang2 = GWF_Language::getByIDOrUnknown($data['user_langid2'])->display('lang_nativename');
     $gender = GWF_HTML::lang('gender_' . $data['user_gender']);
     $birthdate = $data['user_birthdate'] > 0 ? GWF_Time::displayDate($data['user_birthdate'], true, 1) : GWF_HTML::lang('unknown');
     $link = self::getChangeLink($user->getID(), $token);
     $mail->setBody($module->lang('chdemo_body', array($username, $timeout, $gender, $country, $lang1, $lang2, $birthdate, $link)));
     return $mail->sendToUser($user) ? $module->message('msg_mail_sent') : GWF_HTML::err('ERR_MAIL_SENT');
 }
Ejemplo n.º 2
0
 private static function sendEmailB(Module_Account $module, $userid, $email)
 {
     $token = GWF_AccountChange::createToken($userid, 'email2', $email);
     $mail = new GWF_Mail();
     $mail->setSender($module->cfgMailSender());
     $mail->setReceiver($email);
     $mail->setSubject($module->lang('chmailb_subj'));
     if (false === ($user = GWF_User::getByID($userid))) {
         return GWF_HTML::err('ERR_UNKNOWN_USER');
     }
     $link = self::getLinkB($token, $userid);
     $body = $module->lang('chmailb_body', array($user->display('user_name'), $link));
     $mail->setBody($body);
     if (!$mail->sendToUser($user)) {
         return GWF_HTML::err('ERR_MAIL_SENT');
     }
     return $module->message('msg_mail_sent', array(htmlspecialchars($email)));
 }