コード例 #1
0
ファイル: UserController.class.php プロジェクト: anLl/Apply2
 /**
  * 修改用户邮箱发送邮箱验证码.
  *
  * @access public
  * @return void
  * @author Liuping <*****@*****.**>
  */
 public function changeInfoEmailEmailCode()
 {
     $lang = LANG_SET;
     // 标记是否是给新邮箱发邮件
     $newtag = isset($_POST['newtag']) ? TRUE : FALSE;
     // 没有提交邮箱, 表示给当前用户的邮箱发送信息
     $email = I('post.email', '');
     $email = empty($email) ? session('email') : $email;
     $result = [];
     $pattern = '/^\\w+@\\w+(?:\\.\\w+)+$/';
     $username = session('username');
     $userModel = new UserModel();
     $userInfo = $userModel->checkExistEmail($email);
     if (empty($email)) {
         $result['status'] = 0;
         $result['msg'] = L('CONTROLLER_MSG1');
     } elseif (!preg_match($pattern, $email)) {
         $result['status'] = 0;
         $result['msg'] = L('CONTROLLER_MSG5');
     } elseif ($newtag && $userInfo && $username != $userInfo['username']) {
         // 新邮箱已存在
         $result['status'] = 0;
         $result['msg'] = L('CONTROLLER_MSG6');
     } else {
         $title = '[ApplicationUK]Change Contact Email';
         $code = $this->getRandCode();
         // 获取模板内容.
         $cont = $this->tplChangeEmailEmailCode('email', $newtag);
         $message = isset($cont[$lang]) ? $cont[$lang] : $cont['en-us'];
         $_searches = ['%USER_NAME%', '%CODE%'];
         $_replaces = [$username, $code];
         $message = str_replace($_searches, $_replaces, $message);
         $model = new UserCaptchaModel();
         // 邮件发送成功时 commit, 发送失败 rollback
         $model->startTrans();
         $model->type = 2;
         // 1:手机 2:邮箱
         $model->account = $email;
         $model->code = $code;
         $model->createtime = time();
         $res = $model->add();
         $res1 = Mail::applySendEmail($email, $title, $message);
         if ($res && $res1) {
             $model->commit();
             $result['status'] = 9;
             $result['msg'] = L('CONTROLLER_MSG23');
         } else {
             $model->rollback();
             $result['status'] = 8;
             $result['msg'] = L('CONTROLLER_MSG24');
         }
     }
     if (IS_AJAX) {
         $this->ajaxReturn($result, 'json');
     } elseif ($result['status'] == 9) {
         $this->success($result['msg']);
     } else {
         $this->error($result['msg']);
     }
 }
コード例 #2
0
ファイル: MemberStuModel.class.php プロジェクト: anLl/Apply2
 /**
  * 发送邮件.
  * 
  * @access public
  * @param string $address
  * @param string $title
  * @param string $message
  * @return boolean
  */
 public static function sendEmail($email, $title, $message)
 {
     return Mail::applySendEmail($email, $title, $message);
 }
コード例 #3
0
ファイル: OfferController.class.php プロジェクト: anLl/Apply2
 public function sendEmail()
 {
     $address = I('post.address');
     $title = I('post.title');
     $content = I('post.content');
     \Think\Mail::applySendEmail($address, $title, htmlspecialchars_decode($content));
     //        \Think\Mail::applySendEmail('*****@*****.**', 'test', 'test');
     //       \Think\Mail::applySendEmail($address, $title, htmlspecialchars_decode($content));
 }
コード例 #4
0
 public function editUO()
 {
     if ($_POST) {
         $data = self::getParam($_POST);
         if (self::getOStatus($data['a_no']) < 4) {
             echo "<script>alert('操作终止,当前还未获得UO');</script>";
             exit;
         }
         if (self::getAStatus($data['a_no']) != 7) {
             echo "<script>alert('操作终止,当前还未获得offer');</script>";
             exit;
         }
         $offerModel = M('apply_offer');
         $fileAddr = $offerModel->where("a_no='{$data['a_no']}'")->getField('offer_file');
         if (empty($fileAddr)) {
             echo "<script>alert('操作终止,当前还未上传Offer');</script>";
             exit;
         }
         $statusModel = M('apply_status');
         $originData = $statusModel->where("a_no='{$data['a_no']}'")->find();
         if ($data['o_status'] == 6) {
             $num = self::casNum($data['uid'], $data['year']);
             if ($num == 1) {
                 echo "<script>alert('操作终止,当前年该用户已获得一份CAS');</script>";
                 exit;
             }
             $data['c_status'] = 1;
         } else {
             $data['c_status'] = 0;
         }
         $statusModel->startTrans();
         //更新status表offer状态
         $flag = $statusModel->where("a_no='{$data['a_no']}'")->save($data);
         //更新offer表
         $data['is_uo'] = 1;
         $flag1 = $offerModel->where("a_no='{$data['a_no']}'")->save($data);
         if ($flag !== false && $flag1 !== false) {
             $statusModel->commit();
             $str = '';
             switch ($data['o_status']) {
                 case 4:
                     $str = "Congratulations! Your materials have meet all the conditions, you now hold an unconditional offer, please convert to CAS before the deadline shown in your offer detail.";
                     break;
                 case 6:
                     $str = 'Congratulations! You are now hold a CAS. You can apply for your bursary on the CAS detail page once you are enrolled.';
                     break;
             }
             if ($data['o_status'] == 4 || $data['o_status'] == 6) {
                 self::log_status(array('uid' => $data['uid'], 'aid' => $data['a_no'], 'type' => 2, 'txt' => $str, 'admin_id' => session('adminID') == null ? 0 : session('adminID'), 'c_time' => strtotime(date('Y-m-d H:i:s'))));
             }
             //发送邮件给
             $memberModel = M('member_stu');
             $email = $memberModel->alias('a')->field('c.email')->join("LEFT JOIN __APPLY_STATUS__ b ON a.id=b.s_no LEFT JOIN __USER__ c ON a.uid=c.id")->where("b.a_no={$data['a_no']}")->find();
             $us = M('universitylang')->where("fid={$originData['us_id']} and lang='en-us'")->getField('name');
             $mj = M('university_majorlang')->where("fid={$originData['mj_id']} and lang='en-us'")->getField('name');
             \Think\Mail::applySendEmail($email['email'], "Application for {$us} {$mj}", "Congratulations! Your application\n                for {$us} {$mj} is successful and you are now hold a CAS. Please check your CAS\n                detail on www.applicationuk.com<br/><br/>\n                Kind regards,<br/>ApplicationUK");
             //记录操作日志
             self::log(array('uid' => $data['uid'], 'aid' => $data['a_no'], 'type' => 2, 'txt' => date('Y-m-d H:i:s') . "," . session('adminUser') . ",将申请进度改为[" . $data['o_status_'] . "]", 'admin_id' => session('adminID') == null ? 0 : session('adminID'), 'c_time' => strtotime(date('Y-m-d'))));
             //记录系统操作日志
             system_log(session('adminUser') . "在" . date('Y-m-d H:i:s') . "修改了UO申请进度从{$originData['o_status']}改为" . $data['o_status'], $statusModel->getTableName(), $data['a_no'], 'e', $data, $originData, 0);
             echo "<script>window.parent.uoSuccess();alert('保存成功');</script>";
         } else {
             $statusModel->rollback();
             echo "<script>alert('保存失败');</script>";
         }
     }
 }