function _initialize() { parent::_initialize(); $site_options = get_site_options(); $this->assign($site_options); $ucenter_syn = C("UCENTER_ENABLED"); if ($ucenter_syn) { if (!isset($_SESSION["user"])) { if (!empty($_COOKIE['WCTF_auth']) && $_COOKIE['WCTF_auth'] != "logout") { $WCTF_auth = sp_authcode($_COOKIE['WCTF_auth'], "DECODE"); $WCTF_auth = explode("\t", $WCTF_auth); $auth_username = $WCTF_auth[1]; $users_model = M('Users'); $where['user_login'] = $auth_username; $user = $users_model->where($where)->find(); if (!empty($user)) { $is_login = true; $_SESSION["user"] = $user; } } } else { } } if (sp_is_user_login()) { $this->assign("user", sp_get_current_user()); } }
function _initialize() { parent::_initialize(); if (isset($_SESSION['ADMIN_ID'])) { $users_obj = D("Users"); $id = $_SESSION['ADMIN_ID']; $user = $users_obj->where("id={$id}")->find(); if (!$this->check_access($user['role_id'])) { $this->error("您没有访问权限!"); exit; } $this->assign("admin", $user); } else { //$this->error("您还没有登录!",U("admin/public/login")); if (IS_AJAX) { $this->error("您还没有登录!", U("admin/public/login")); } else { header("Location:" . U("admin/public/login")); exit; } } }
function _initialize() { parent::_initialize(); $this->guestbook_model = D("Guestbook"); }