public function ajax_session() { $this->cache(false); $static = Configure::read('site.static'); $base = Configure::read('site.prefix'); $user = User::getInstance(); App::import('vendor', 'inc/wrapper'); $wrapper = Wrapper::getInstance(); $ret = $wrapper->user($user); $ret['is_login'] = $user->userid != 'guest'; $ret['forum_totol_count'] = Forum::getOnlineNum(); $ret['forum_user_count'] = Forum::getOnlineUserNum(); $ret['forum_guest_count'] = Forum::getOnlineGuestNum(); App::import("vendor", "model/mail"); $info = MailBox::getInfo($user); $ret['new_mail'] = $info['newmail']; $ret['full_mail'] = $info['full']; if (Configure::read('refer.enable')) { App::import('vendor', 'model/refer'); $ret['new_at'] = $ret['new_reply'] = false; try { if ($user->getCustom('userdefine1', 2)) { $refer = new Refer($user, Refer::$AT); $ret['new_at'] = $refer->getNewNum(); } if ($user->getCustom('userdefine1', 3)) { $refer = new Refer($user, Refer::$REPLY); $ret['new_reply'] = $refer->getNewNum(); } } catch (ReferNullException $e) { } } $this->set('no_html_data', $ret); }
public function beforeRender() { if ($this->ByrSession->isLogin) { $u = User::getInstance(); $login = true; $id = $u->userid; $isAdmin = $u->isAdmin(); App::import("vendor", "model/mail"); $info = MailBox::getInfo($u); $info['new_mail'] = $info['newmail']; $info['full_mail'] = $info['full']; $info['newAt'] = $info['newReply'] = false; if (Configure::read('refer.enable')) { App::import('vendor', 'model/refer'); try { if ($u->getCustom('userdefine1', 2)) { $refer = new Refer($u, Refer::$AT); $info['newAt'] = $refer->getNewNum(); } if ($u->getCustom('userdefine1', 3)) { $refer = new Refer($u, Refer::$REPLY); $info['newReply'] = $refer->getNewNum(); } } catch (ReferNullException $e) { } } $this->set($info); } else { $login = false; $id = "guest"; $isAdmin = false; } $this->_initAsset(); $site = Configure::read("site"); $this->set("domain", $site['domain']); $this->set("static", $site['static']); $this->set("siteName", $site['name'] . "手机版"); $this->set("webTitle", empty($this->title) ? $site['name'] . "手机版" : $this->title); $this->set("encoding", $this->encoding); $this->set("home", $site['home']); $this->set("base", $this->base); $this->set("mbase", $this->base . $this->_mbase); $this->set("msg", ECode::msg($this->_msg)); $this->set("pos", $this->notice); $this->set("css", $this->css); $this->set("islogin", $login); $this->set("id", $id); $this->set("isAdmin", $isAdmin); }
public function info() { if (!isset($this->params['type'])) { $this->error(ECode::$REFER_NONE); } $type = $this->params['type']; $u = User::getInstance(); try { $refer = new Refer($u, $type); } catch (ReferNullException $e) { $this->error(ECode::$REFER_NONE); } $data['enable'] = $u->getCustom('userdefine1', $type == Refer::$AT ? 2 : 3) == 1; $data['new_count'] = $refer->getNewNum(); $wrapper = Wrapper::getInstance(); $this->set('data', $data); }