Example #1
0
 public function _initialize()
 {
     parent::_initialize();
     //检查管理员登录
     $this->check_admin();
     $this->assign('admin_user', $this->admin_user);
 }
 protected function _initialize()
 {
     parent::_initialize();
     //TODO:只获取全局通用的配置
     $this->getConfig();
     $seo = array('title' => C('WEBSITE_TITLE'), 'keywords' => C('WEBSITE_KEYWORDS'), 'description' => C('WEBSITE_DESCRIPTION'));
     $cfg = array('owner' => C('WEBSITE_OWNER'), 'statisticalcode' => C('WEBSITE_STATISTICAL_CODE'), 'theme' => getSkin(C('DEFAULT_SKIN')));
     //若是晚上 则固定为darkly样式
     if (isNight()) {
         $cfg['theme'] = "darkly";
     }
     //
     $this->assignVars($seo, $cfg);
 }
 protected function _initialize()
 {
     parent::_initialize();
     /*加入用户模块时打开*/
     define('UID', is_login());
     D('Content')->publishDueContents();
     //定时发布
     $wap = check_wap();
     //访问首页的时候如果是手机用户访问跳转到mobile显示
     if ($wap && C('OPEN_WAP_TPL')) {
         $this->iswap = true;
         layout('layout_wap');
     } else {
         $this->iswap = false;
     }
     $this->login_user = session('user_auth');
     // set visit
     $visit = array('ip' => get_remote_ip(), 'http_user_agent' => htmlspecialchars($_SERVER['HTTP_USER_AGENT']), 'http_referer' => htmlspecialchars($_SERVER['HTTP_REFERER']), 'uri' => htmlspecialchars($_SERVER['REQUEST_URI']), 'module' => strtolower(CONTROLLER_NAME), 'module_id' => I('id'), 'request' => serialize($_REQUEST), 'first_get' => array_shift(I('get.')));
     D("Visit")->add($visit);
 }