function _initialize() { parent::_initialize(); //初始化模型 $this->initModel(); //检查是否后台登陆 $ShuipFanAdmin = session("ShuipFanAdmin"); if ($ShuipFanAdmin) { define('IN_ADMIN', true); } //初始化当前登录用户信息 $this->initUser(); import('UploadFile'); //默认图片类型 $this->imgext = array('jpg', 'gif', 'png', 'bmp', 'jpeg'); //当前登陆用户名 0 表示游客 $this->upuserid = AppframeAction::$Cache['uid'] ? AppframeAction::$Cache['uid'] : 0; //附件目录强制/d/file/ 后台设置的附件目录,只对网络地址有效 $this->path = C("UPLOADFILEPATH"); //是否后台 $this->isadmin = $ShuipFanAdmin ? 1 : 0; //用户组 $this->groupid = AppframeAction::$Cache['groupid'] ? AppframeAction::$Cache['groupid'] : 8; $this->assign("show_header", true); $Module = array(); $Module_list = F("Module"); if ($Module_list) { foreach (F("Module") as $r) { $Module[$r['module']] = array("module" => $r['module'], "name" => $r['name']); } $this->module_list = $Module; } }
function _initialize() { parent::_initialize(); //模板安装目录,模板安装目录强制在Default是出于,如果用户安装了模块后,又切换了主题,会造成找不到模板报错,只好强制安装在Default主题下!---水平凡 $this->templatePath = TEMPLATE_PATH . "Default" . DIRECTORY_SEPARATOR; //添加一个菜单到后台“模块->模块列表”ID=74 define("MENUID", 74); }
function _initialize() { parent::_initialize(); //单个任务最大执行时间 $CRON_MAX_TIME = C('CRON_MAX_TIME'); if (!$CRON_MAX_TIME) { C('CRON_MAX_TIME', 3000); } }
function _initialize() { parent::_initialize(); $this->initUser(); $this->categorys = F("Category"); $this->Model = F("Model"); import('Url'); $this->url = new Url(); }
public function _initialize() { parent::_initialize(); $this->Config = F("Member_Config"); if (!$this->Config) { $setting = M("Module")->where(array("module" => "Member"))->getField("setting"); if (!$setting) { //获取不到配置,记录错误日志 $msg = "获取不到相关配置,QQ互联无法进行!"; if (APP_DEBUG) { // 模块不存在 抛出异常 throw_exception($msg); } else { if (C('LOG_EXCEPTION_RECORD')) { Log::write($msg); } send_http_status(404); exit; } } $this->Config = unserialize($setting); F("Member_Config", $this->Config); } $this->qq_akey = $this->Config['qq_akey']; $this->qq_skey = $this->Config['qq_skey']; if (!$this->qq_akey || !$this->qq_skey) { $msg = "没有进行QQ互联的相关配置,请配置后在继续使用!"; if (APP_DEBUG) { // 模块不存在 抛出异常 throw_exception($msg); } else { if (C('LOG_EXCEPTION_RECORD')) { Log::write($msg); } send_http_status(404); exit; } } //跳转时间 $this->assign("waitSecond", 2000); }
protected function _initialize() { //定义是前台 define('IN_ADMIN', false); parent::_initialize(); //前台关闭表单令牌 C("TOKEN_ON", false); $this->initUser(); $user = session("user"); $this->assign('member_user', $user); //模块静态资源目录,例如CSS JS等 $this->assign('model_extresdir', CONFIG_SITEURL_MODEL . MODEL_EXTRESDIR); import('ORG.Util.IpLocation'); // 导入IpLocation类 $Ip = new IpLocation('UTFWry.dat'); // 实例化类 参数表示IP地址库文件 $area = $Ip->getlocation(); // 获取某个IP地址所在的位置 $country = $area['country']; //获取到的城市 $where['name'] = array('like', $country . '%'); $citylist = M("City")->where($where)->find(); $chengshiid = $_COOKIE['chengshi_id']; //获取cookie 城市 if (empty($chengshiid) && empty($citylist)) { $this->assign("chengshikey", 1); } else { $this->assign("dingcountry", $citylist['name']); } if (empty($chengshiid)) { thinkcookie_cookie('chengshi_id', $citylist['id']); $this->assign("country", $citylist['name']); } else { $citylist = M("City")->where(array('id' => $chengshiid))->find(); $this->assign("country", $citylist['name']); } }
function _initialize() { parent::_initialize(); $this->guestbook_model = D("Guestbook"); }
/** * 加载模板和页面输出 可以返回输出内容 * @access public * @param string $templateFile 模板文件名 * @param string $charset 模板输出字符集 * @param string $contentType 输出类型 * @param string $content 模板输出内容 * @return mixed */ public function display($templateFile = '', $charset = '', $contentType = '', $content = '') { parent::display($this->parseTemplateFile($templateFile), $charset, $contentType); }
/** * 模板显示 * @param type $templateFile 指定要调用的模板文件 * @param type $charset 输出编码 * @param type $contentType 输出类型 * @param string $content 输出内容 * 此方法作用在于实现后台模板直接存放在各自项目目录下。例如Admin项目的后台模板,直接存放在Admin/Tpl/目录下 */ public function display($templateFile = '', $charset = '', $contentType = '', $content = '') { parent::display($templateFile, $charset, $contentType, $content); }
/** * 加载模板和页面输出 可以返回输出内容 * @access public * @param string $templateFile 模板文件名 * @param string $charset 模板输出字符集 * @param string $contentType 输出类型 * @param string $content 模板输出内容 * @return mixed */ public function display($templateFile = '', $charset = '', $contentType = '', $content = '', $prefix = '') { //echo $this->parseTemplate($templateFile); parent::display($this->parseTemplate($templateFile), $charset, $contentType); }
function _initialize() { parent::_initialize(); $this->comments_model = D("Comments"); }