예제 #1
0
파일: Cookie.php 프로젝트: kevinwan/xf
 /**
  * 读取内容
  * @return mixed
  */
 public function read()
 {
     if (isset($_COOKIE[$this->_namespace])) {
         return XF_Functions::authCode($_COOKIE[$this->_namespace], 'DECODE');
     }
     return null;
 }
예제 #2
0
파일: Bootstrap.php 프로젝트: kevinwan/xf
 /**
  * 运行启动器
  * @access public
  * @return void
  */
 public function run()
 {
     $st = microtime(true);
     $this->checkDomain();
     $this->runStartup();
     XF_DataPool::getInstance()->addList('Bootstrap_Inits', 'runStartup ' . sprintf('%.5fs', microtime(true) - $st));
     if (!empty($_GET['xsessid'])) {
         $session_id = XF_Functions::authCode(urlencode($_GET['xsessid']), 'DECODE');
         if ($session_id != '') {
             session_id($session_id);
         }
     }
     $stt = microtime(true);
     session_start();
     XF_DataPool::getInstance()->addList('Bootstrap_Inits', 'session_start ' . sprintf('%.5fs', microtime(true) - $stt));
     header("Content-type:text/html;charset=utf-8");
     $this->_loadInit();
     XF_DataPool::getInstance()->add('RunBootstrap', sprintf("%.6f", microtime(true) - $st));
     XF_Controller_Front::getInstance()->init()->dispatch();
 }
예제 #3
0
 public function sendByFindPassword($user_id)
 {
     //获取用户
     $mod = new User_Model_User();
     $user = $mod->get($user_id);
     if ($user == false) {
         throw new XF_Exception('用户不存在,无法发送邮件');
     }
     if ($user->email == '') {
         throw new XF_Exception('用户邮件为空,无法发送邮件');
     }
     //获取模板
     $event = $this->get(4);
     //是否已关闭发送
     if ($event->status == '0') {
         return;
     }
     $authCodeUrl = 'http://www.' . XF_Config::getInstance()->getDomain() . '/findPassword/?fromMailCode=' . urlencode(XF_Functions::authCode($user->user_id . ',' . $user->password . ',' . time()));
     $content = str_replace('{email}', $user->email, $event->mail_tpl);
     $content = str_replace('{authCodeUrl}', $authCodeUrl, $content);
     $this->sendEmail($user->email, $event->mail_title, $content);
 }