本文整理汇总了PHP中Forum::getOnlineNum方法的典型用法代码示例。如果您正苦于以下问题:PHP Forum::getOnlineNum方法的具体用法?PHP Forum::getOnlineNum怎么用?PHP Forum::getOnlineNum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Forum
的用法示例。
在下文中一共展示了Forum::getOnlineNum方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ajax_session
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);
}
示例2: beforeRender
/**
* @override method
*/
public function beforeRender()
{
if (!$this->html) {
//there is three ajax_st status
//1:success
//0:fail
$data = $this->get('no_html_data');
if (null === $data) {
$data = array();
}
//use no_ajax_info param to ignore ajax info,
//sometimes data may be a array
if (!isset($data['ajax_st']) && null === $this->get('no_ajax_info')) {
$data['ajax_st'] = 1;
$data['ajax_code'] = isset($data['ajax_code']) ? $data['ajax_code'] : ECode::$SYS_AJAXOK;
$data['ajax_msg'] = ECode::msg($data['ajax_code']);
//code may be a string,check msg == code to set default code
if ($data['ajax_msg'] == strval($data['ajax_code'])) {
$data['ajax_code'] = ECode::$SYS_AJAXOK;
}
$this->set('no_html_data', $data);
}
return;
}
$site = Configure::read("site");
try {
$u = User::getInstance();
$uid = $u->userid;
$admin = $u->isAdmin();
$reg = $u->isReg();
} catch (UserNullException $e) {
$uid = 'guest';
$admin = false;
$reg = false;
}
//handle js & css
$this->_initAsset();
//add pack js&css
$asset_pack = nforum_cache_read('asset_pack');
if (is_array($asset_pack) && ($this->front || $this->spider)) {
$this->set('js', array_merge(array('js/' . $asset_pack['js']), $this->get('js')));
$this->set('css', array_merge(array('css/' . $asset_pack['css']), $this->get('css')));
}
//handle title
$title = $site['name'];
if (!empty($this->title)) {
$title = $this->title;
} else {
if (isset($this->notice[0]) && $this->path != $site['home']) {
$title .= "-" . $this->notice[0]["text"];
} else {
$title .= "-" . $site['desc'];
}
}
//handle notice
if ($this->path != $site['home']) {
$this->notice = array_merge(array(array("url" => $site['home'], "text" => $site['name'])), $this->notice);
}
/* handle jsr start*/
if (!$this->spider) {
if ($this->front) {
$site = Configure::read("site");
$cookie = Configure::read("cookie");
$jsr = Configure::read("jsr");
$jsr['iframe'] = $jsr['iframe'] ? 'true' : 'false';
$jsr['domain'] = preg_replace('/^https?:\\/\\//', '', $site['domain']);
$jsr['cookie_domain'] = $cookie['domain'];
$jsr['base'] = $this->base;
$jsr['prefix'] = $cookie['prefix'];
$jsr['home'] = $site['home'];
$jsr['static'] = $site['static'];
$jsr['protocol'] = $site['ssl'] ? 'https://' : 'http://';
App::import("vendor", "inc/json");
$jsr = 'var sys_merge=' . BYRJSON::encode($jsr);
$this->jsr = array_merge(array($jsr), $this->jsr);
$syn = Configure::read('ubb.syntax');
if (Configure::read('ubb.parse') && !empty($syn)) {
$this->set('js', array_merge($this->get('js'), array($syn . '/scripts/shCore.js', $syn . '/scripts/shAutoloader.js')));
}
} else {
$tmp = array();
foreach ($this->notice as $v) {
$tmp[] = '<a href="' . (empty($v['url']) ? 'javascript:void(0)' : $this->base . $v['url']) . '">' . $v['text'] . '</a>';
}
$tmp = join(' >> ', $tmp);
$this->jsr[] = <<<EOT
\$('#notice_nav').html('{$tmp}');\$.setTitle('{$title}');
EOT;
$syn = Configure::read('ubb.syntax');
if (Configure::read('ubb.parse') && !empty($syn) && $this->get('hasSyn') !== false) {
$this->set('syntax', $syn);
}
}
}
/* handle jsr end*/
//basic variables
$arr = array('base' => $this->base, 'islogin' => $this->ByrSession->isLogin, 'id' => $uid, 'isAdmin' => $admin, 'isReg' => $reg, 'notice' => $this->notice, 'webTitle' => $title, 'webTotal' => Forum::getOnlineNum(), 'webUser' => Forum::getOnlineUserNum(), 'webGuest' => Forum::getOnlineGuestNum(), 'encoding' => $this->encoding, 'domain' => $site['domain'], 'static' => $site['static'], 'siteName' => $site['name'], 'keywords' => $site['keywords'], 'description' => $site['description'], 'home' => $site['home'], 'preindex' => $site['preIndex'], 'front' => $this->front, 'spider' => $this->spider, 'jsr' => $this->jsr);
//.........这里部分代码省略.........