示例#1
0
 /**
  * 执行函数
  *
  * @access public
  * @return void
  */
 public function execute()
 {
     if ($this->hasLogin()) {
         $rows = $this->db->fetchAll($this->db->select()->from('table.options')->where('user = ?', $this->_user['uid']));
         $this->push($this->_user);
         foreach ($rows as $row) {
             $this->options->__set($row['name'], $row['value']);
         }
         //更新最后活动时间
         $this->db->query($this->db->update('table.users')->rows(array('activated' => $this->options->gmtTime))->where('uid = ?', $this->_user['uid']));
     }
 }
示例#2
0
文件: Front.php 项目: dccecc/typecho
 public function __construct($request, $response, $params = NULL)
 {
     parent::__construct($request, $response, $params);
     $this->parameter->setDefault(array('type' => NULL));
     /** 初始化常用组件 */
     $this->options = $this->widget('Widget_Options');
     $this->user = $this->widget('Widget_User');
     /** 初始化皮肤路径 */
     $this->_themeDir = rtrim($this->options->themeFile($this->options->theme), '/') . '/';
     if (NULL == $this->parameter->type) {
         $this->parameter->type = Typecho_Router::$current;
     }
 }
示例#3
0
 /**
  * 构造函数,初始化组件
  *
  * @access public
  * @param mixed $request request对象
  * @param mixed $response response对象
  * @param mixed $params 参数列表
  */
 public function __construct($request, $response, $params = NULL)
 {
     parent::__construct($request, $response, $params);
     /** 初始化数据库 */
     $this->db = Typecho_Db::get();
     /** 初始化常用组件 */
     $this->options = $this->widget('Widget_Options');
     $this->user = $this->widget('Widget_User');
     $this->security = $this->widget('Widget_Security');
     $this->_themeDir = rtrim($this->options->themeFile($this->options->theme), '/') . '/';
     /** 加载皮肤函数 */
     $functionsFile = $this->_themeDir . 'functions.php';
     if (!$this->_invokeFromOutside && file_exists($functionsFile)) {
         require_once $functionsFile;
     }
 }