本文整理汇总了PHP中fetch_online_status函数的典型用法代码示例。如果您正苦于以下问题:PHP fetch_online_status函数的具体用法?PHP fetch_online_status怎么用?PHP fetch_online_status使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fetch_online_status函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: process_showgroups_userinfo
function process_showgroups_userinfo($user)
{
global $vbulletin, $permissions, $stylevar, $show;
$post =& $user;
$datecut = TIMENOW - $vbulletin->options['cookietimeout'];
require_once DIR . '/includes/functions_bigthree.php';
fetch_online_status($user, true);
if (!$user['invisible'] or $permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canseehidden']) {
$user['lastonline'] = vbdate($vbulletin->options['dateformat'], $user['lastactivity'], 1);
} else {
$user['lastonline'] = ' ';
}
fetch_musername($user);
return $user;
}
开发者ID:holandacz,项目名称:nb4,代码行数:15,代码来源:showgroups.php
示例2: process_showgroups_userinfo
function process_showgroups_userinfo($user)
{
global $vbulletin, $permissions, $stylevar, $show;
$user = array_merge($user, convert_bits_to_array($user['options'], $vbulletin->bf_misc_useroptions));
$user = array_merge($user, convert_bits_to_array($user['adminoptions'], $vbulletin->bf_misc_adminoptions));
cache_permissions($user, false);
fetch_online_status($user, true);
if (!$user['invisible'] or $permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canseehidden']) {
$user['lastonline'] = vbdate($vbulletin->options['dateformat'], $user['lastactivity'], 1);
} else {
$user['lastonline'] = ' ';
}
fetch_musername($user);
return $user;
}
开发者ID:benyamin20,项目名称:vbregistration,代码行数:15,代码来源:showgroups.php
示例3: prepare_onlinestatus
/**
* Prepares the user's online status
*
*/
function prepare_onlinestatus()
{
if (!isset($this->prepared['onlinestatus'])) {
require_once DIR . '/includes/functions_bigthree.php';
fetch_online_status($this->userinfo, true);
$this->prepared['onlinestatus'] = $this->userinfo['onlinestatus'];
}
}
开发者ID:holandacz,项目名称:nb4,代码行数:12,代码来源:class_userprofile.php
示例4: process_registered_user
/**
* Processes this post's user info assuming the user is registered.
*/
function process_registered_user()
{
global $show, $vbphrase;
$post =& $this->post; // this is a stopgap required for rank's eval code
fetch_musername($this->post);
// get online status -- function call also sets values in $this->post
$this->post['online_status_code'] = fetch_online_status($this->post, true);
if (empty($this->cache['perms'][$this->post['userid']]))
{
$this->cache['perms'][$this->post['userid']] = cache_permissions($this->post, false);
}
// get avatar
if ($this->post['avatarid'])
{
$this->post['avatarurl'] = $this->post['avatarpath'];
}
else
{
if ($this->post['hascustomavatar'] AND $this->registry->options['avatarenabled'])
{
if ($this->registry->options['usefileavatar'])
{
$this->post['avatarurl'] = $this->registry->options['avatarurl'] . '/avatar' . $this->post['userid'] . '_' . $this->post['avatarrevision'] . '.gif';
}
else
{
$this->post['avatarurl'] = 'image.php?' . $this->registry->session->vars['sessionurl'] . 'u=' . $this->post['userid'] . '&dateline=' . $this->post['avatardateline'];
}
if ($this->post['avwidth'] AND $this->post['avheight'])
{
$this->post['avwidth'] = 'width="' . $this->post['avwidth'] . '"';
$this->post['avheight'] = 'height="' . $this->post['avheight'] . '"';
}
else
{
$this->post['avwidth'] = '';
$this->post['avheight'] = '';
}
}
else
{
$this->post['avatarurl'] = '';
}
}
if ( // no avatar defined for this user
empty($this->post['avatarurl'])
OR // visitor doesn't want to see avatars
($this->registry->userinfo['userid'] > 0 AND !$this->registry->userinfo['showavatars'])
OR // user has a custom avatar but no permission to display it
(!$this->post['avatarid'] AND !($this->cache['perms'][$this->post['userid']]['genericpermissions'] & $this->registry->bf_ugp_genericpermissions['canuseavatar']) AND !$this->post['adminavatar']) //
)
{
$show['avatar'] = false;
}
else
{
$show['avatar'] = true;
}
// Generate Reputation Power
if ($this->registry->options['postelements'] & POST_SHOW_REPPOWER AND $this->registry->options['reputationenable'])
{
if (!empty($this->cache['reppower'][$this->post['userid']]))
{
$this->post['reppower'] = $this->cache['reppower'][$this->post['userid']];
}
else
{
$this->post['reppower'] = fetch_reppower($this->post, $this->cache['perms'][$this->post['userid']]);
$this->cache['reppower'][$this->post['userid']] = $this->post['reppower'];
}
$show['reppower'] = true;
}
else
{
$show['reppower'] = false;
}
// get reputation
if ($this->registry->options['reputationenable'])
{
fetch_reputation_image($this->post, $this->cache['perms'][$this->post['userid']]);
$show['reputation'] = true;
}
else
{
$show['reputation'] = false;
}
// get join date & posts per day
$jointime = (TIMENOW - $this->post['joindate']) / 86400; // Days Joined
if ($jointime < 1)
//.........这里部分代码省略.........
开发者ID:hungnv0789,项目名称:vhtm,代码行数:101,代码来源:class_postbit.php
示例5: fetchProfileInfo
//.........这里部分代码省略.........
*/
$userInfo['canusefriends'] = vB::getUserContext($userid)->hasPermission('genericpermissions2', 'canusefriends');
$userInfo['canviewmembers'] = vB::getUserContext($userid)->hasPermission('genericpermissions', 'canviewmembers');
/**
* * User counts
*/
$followApi = vB_Api::instanceInternal('follow');
if ($currentUserid == $userid or $userInfo['canusefriends']) {
$follows = $followApi->getFollowing($userid);
$userInfo['followsCount'] = $follows['paginationInfo']['totalcount'];
}
$followers = $followApi->getFollowers($userid);
$userInfo['followersCount'] = $followers['paginationInfo']['totalcount'];
$userInfo['socialGroupsCount'] = 10;
if (isset($this->referrals[$userid])) {
$referrals = $this->referrals[$userid];
} else {
$referrals = $assertor->getRow('vBForum:getReferralsCount', array('userid' => $userid));
$this->referrals[$userid] = $referrals;
}
$userInfo['birthdayTimestamp'] = 0;
$userInfo['referralsCount'] = $referrals['referrals'];
if ($userInfo['birthday_search']) {
list($year, $month, $day) = explode("-", $userInfo['birthday_search']);
$userInfo['birthdayTimestamp'] = mktime(0, 0, 0, $month, $day, $year);
$userInfo['age'] = date("md") < $month . $day ? date("Y") - $year - 1 : date("Y") - $year;
}
/**
* Get vms info
*/
$vms = $assertor->getRows('vBForum:node', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, 'setfor' => $userid), array('field' => 'publishdate', 'direction' => vB_dB_Query::SORT_DESC));
vB_Library_Content::writeToCache($vms, vB_Library_Content::CACHELEVEL_NODE);
$userInfo['vmCount'] = count($vms);
$userInfo['vmMostRecent'] = $userInfo['vmCount'] ? $vms[0]['publishdate'] : 0;
/**
* Let's get posts per day
*/
$timeIn = (vB::getRequest()->getTimeNow() - $userInfo['joindate']) / (24 * 60 * 60);
if ($timeIn >= 1 and $userInfo['posts'] > 0) {
$userInfo['postPerDay'] = vb_number_format($userInfo['posts'] / $timeIn, 2);
} else {
$userInfo['postPerDay'] = $userInfo['posts'];
}
$fastCache->write($hashKey, $userInfo, 1440, 'userChg_' . $userid);
}
// add current user flags
// if user is the profile owner..
$userInfo['showAvatar'] = 1;
if ($currentUserid == $userid) {
if (vB::getUserContext()->hasPermission('genericpermissions', 'canuseavatar')) {
$userInfo['canuseavatar'] = 1;
$userInfo['avatarmaxwidth'] = vB::getUserContext()->getLimit('avatarmaxwidth');
$userInfo['avatarmaxheight'] = vB::getUserContext()->getLimit('avatarmaxheight');
$userInfo['avatarmaxsize'] = vB::getUserContext()->getLimit('avatarmaxsize') / 1024;
} else {
$userInfo['canuseavatar'] = 0;
}
//Are there any default avatars this user could assign?
$avatars = vB_Api::instanceInternal('profile')->getDefaultAvatars();
$userInfo['defaultAvatarCount'] = count($avatars);
if ($userInfo['defaultAvatarCount'] or $userInfo['canuseavatar'] > 0) {
$userInfo['showAvatarOptions'] = 1;
} else {
$userInfo['showAvatarOptions'] = 0;
}
if ($userInfo['profilepic']) {
if ($options['usefileavatar']) {
$userInfo['profilepicturepath'] = $options['bburl'] . '/' . $options['profilepicurl'] . "/profilepic{$currentUserid}" . '_' . $userInfo['profilepicrevision'] . '.gif';
} else {
$userInfo['profilepicturepath'] = $options['bburl'] . "/image.php?u={$currentUserid}&type=profile&dateline=" . $userInfo['profilepicdateline'];
}
}
} else {
$userInfo['canuseavatar'] = $userInfo['showAvatarOptions'] = 0;
//Check the privacy settings and see if this user has hidden his
if ($userInfo['privacy_options'] and vB::getUserContext($userid)->hasPermission('usercsspermissions', 'caneditprivacy')) {
switch ($userInfo['privacy_options']['profile_picture']) {
case 1:
//visible only if the current user is a subscriber.
if ($currentUserid == 0 or vB_Api::instanceInternal('follow')->isFollowingUser($userid) != vB_Api_Follow::FOLLOWING_YES) {
$userInfo['showAvatar'] = 0;
}
break;
case 2:
//visible only if the current user is a registered user.
if ($currentUserid == 0) {
$userInfo['showAvatar'] = 0;
}
break;
}
// switch
}
$userInfo['profilepicturepath'] = '';
}
$this->setCurrentUserFlags($userInfo);
// Add online status
require_once DIR . '/includes/functions_bigthree.php';
fetch_online_status($userInfo);
return $userInfo;
}
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:101,代码来源:user.php
示例6: do_get_thread
//.........这里部分代码省略.........
$docattach = array();
// Attachments (images).
if (is_array($post['attachments']) && count($post['attachments']) > 0) {
foreach ($post['attachments'] as $attachment) {
$lfilename = strtolower($attachment['filename']);
if (strpos($lfilename, '.jpe') !== false || strpos($lfilename, '.png') !== false || strpos($lfilename, '.gif') !== false || strpos($lfilename, '.jpg') !== false || strpos($lfilename, '.jpeg') !== false) {
$tmp = array('img' => $vbulletin->options['bburl'] . '/attachment.php?attachmentid=' . $attachment['attachmentid']);
if ($vbulletin->options['attachthumbs']) {
$tmp['tmb'] = $vbulletin->options['bburl'] . '/attachment.php?attachmentid=' . $attachment['attachmentid'] . '&stc=1&thumb=1';
}
$fr_images[] = $tmp;
}
if (strpos($lfilename, '.pdf') !== false) {
$docattach[] = $vbulletin->options['bburl'] . '/attachment.php?attachmentid=' . $attachment['attachmentid'];
}
}
}
// Parse the post for quotes and inline images
list($text, $nuked_quotes, $images) = parse_post($post['pagetext'], $post['allowsmilie'] && $usesmilies);
if (count($fr_images) > 0) {
$text .= "<br/>";
foreach ($fr_images as $attachment) {
$text .= "<img src=\"{$attachment['img']}\"/>";
}
}
foreach ($images as $image) {
$fr_images[] = array('img' => $image);
}
$avatarurl = '';
// Avatar work
if ($post['avatarurl']) {
$avatarurl = process_avatarurl($post['avatarurl']);
}
$tmp = array('post_id' => $post['postid'], 'thread_id' => $post['threadid'], 'forum_id' => $foruminfo['forumid'], 'forum_title' => prepare_utf8_string($foruminfo['title_clean']), 'username' => prepare_utf8_string(strip_tags($post['username'])), 'joindate' => prepare_utf8_string($post['joindate']), 'usertitle' => prepare_utf8_string(strip_tags($post['usertitle'])), 'numposts' => $post['posts'] ? (string) $post['posts'] : '0', 'userid' => $post['userid'], 'title' => prepare_utf8_string($post['title']), 'online' => fetch_online_status(fetch_userinfo($post['userid']), false), 'post_timestamp' => prepare_utf8_string(date_trunc($postdate) . ' ' . $posttime), 'fr_images' => $fr_images);
if ($candelete) {
$tmp['candelete'] = true;
}
// Soft Deleted
if ($post['visible'] == 2) {
$tmp['deleted'] = true;
$tmp['del_username'] = prepare_utf8_string($post['del_username']);
if ($post['del_reason']) {
$tmp['del_reason'] = prepare_utf8_string($post['del_reason']);
}
} else {
$tmp['text'] = $text;
$tmp['quotable'] = $nuked_quotes;
if ($post['editlink']) {
$tmp['canedit'] = true;
$tmp['edittext'] = prepare_utf8_string($post['pagetext']);
}
}
if ($avatarurl != '') {
$tmp['avatarurl'] = $avatarurl;
}
if (count($docattach) > 0) {
$tmp['docattach'] = $docattach;
}
if ($vbulletin->GPC['signature']) {
$sig = trim(remove_bbcode(strip_tags($post['signatureparsed']), true, true), '<a>');
$sig = str_replace(array("\t", "\r"), array('', ''), $sig);
$sig = str_replace("\n\n", "\n", $sig);
$tmp['sig'] = prepare_utf8_string($sig);
}
// Begin Support for Post Thanks Hack - http://www.vbulletin.org/forum/showthread.php?t=122944
if ($vbulletin->userinfo['userid'] && function_exists('post_thanks_off') && function_exists('can_thank_this_post') && function_exists('thanked_already') && function_exists('fetch_thanks')) {
开发者ID:0hyeah,项目名称:yurivn,代码行数:67,代码来源:get_thread.php
示例7: array
if ($_REQUEST['do'] == 'viewmembers') {
$vbulletin->input->clean_array_gpc('r', array('perpage' => TYPE_UINT, 'pagenumber' => TYPE_UINT));
$perpage = $vbulletin->GPC['perpage'];
$pagenumber = $vbulletin->GPC['pagenumber'];
$totalmembers = $group['members'];
sanitize_pageresults($totalmembers, $pagenumber, $perpage);
$groupmembers = $vbulletin->db->query_read("\n\t\tSELECT userfield.*, usertextfield.*, user.*, UNIX_TIMESTAMP(passworddate) AS passworddate,\n\t\t\tIF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid, (user.options & " . $vbulletin->bf_misc_useroptions['invisible'] . ") AS invisible,\n\t\t\t" . ($vbulletin->options['avatarenabled'] ? 'avatar.avatarpath, NOT ISNULL(customavatar.userid) AS hascustomavatar, customavatar.dateline AS avatardateline, customavatar.width AS avwidth, customavatar.height AS avheight,' : '') . "\n\t\t\tcustomprofilepic.userid AS profilepic, customprofilepic.dateline AS profilepicdateline, customprofilepic.width AS ppwidth, customprofilepic.height AS ppheight,\n\t\t\tuser.icq AS icq, user.aim AS aim, user.yahoo AS yahoo, user.msn AS msn, user.skype AS skype\n\t\tFROM " . TABLE_PREFIX . "socialgroupmember AS socialgroupmember\n\t\tINNER JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = socialgroupmember.userid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON (user.userid = userfield.userid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON (usertextfield.userid = user.userid)\n\t\t" . ($vbulletin->options['avatarenabled'] ? "LEFT JOIN " . TABLE_PREFIX . "avatar AS avatar ON (avatar.avatarid = user.avatarid) LEFT JOIN " . TABLE_PREFIX . "customavatar AS customavatar ON (customavatar.userid = user.userid) " : '') . "\n\t\tLEFT JOIN " . TABLE_PREFIX . "customprofilepic AS customprofilepic ON (user.userid = customprofilepic.userid)\n\t\tWHERE socialgroupmember.groupid = " . $vbulletin->GPC['groupid'] . " AND socialgroupmember.type = 'member'\n\t\tORDER BY user.username\n\t\tLIMIT " . ($pagenumber - 1) * $perpage . ", {$perpage}\n\t");
require_once DIR . '/includes/functions_bigthree.php';
while ($groupmember = $vbulletin->db->fetch_array($groupmembers)) {
$width = 0;
$height = 0;
$alt = exec_switch_bg();
fetch_avatar_from_userinfo($groupmember, true);
fetch_musername($groupmember);
$user =& $groupmember;
fetch_online_status($user, true);
construct_im_icons($user, true);
($hook = vBulletinHook::fetch_hook('group_memberbit')) ? eval($hook) : false;
eval('$member_list .= "' . fetch_template('memberinfo_small') . '";');
}
$navbits = array('group.php' . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['social_groups'], 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'groupid=' . $group['groupid'] => $group['name'], '' => $vbphrase['member_list']);
$custompagetitle = $group['name'] . ' - ' . $vbphrase['member_list'];
$pagenav = construct_page_nav($pagenumber, $perpage, $totalmembers, 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'do=viewmembers&groupid=' . $group['groupid'] . ($perpage ? "&pp={$perpage}" : ''));
eval('$memberinfo_css = "' . fetch_template('memberinfo_css') . '";');
$templatename = 'socialgroups_memberlist';
}
// #######################################################################
if ($_REQUEST['do'] == 'search') {
$navbits = array('group.php' . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['social_groups'], '' => $vbphrase['advanced_search']);
$templatename = 'socialgroups_search';
}
开发者ID:holandacz,项目名称:nb4,代码行数:31,代码来源:group.php
示例8: construct_memberaction_dropdown
/**
* Returns the HTML for the member dwop-down pop-up menu
*
* @param array user information for the drop-down context
* @param array template hook, if we dont want to use the global one (like in postbit)
* @param string class name to apply to the div for context specific stylings
*
* @return string Member Drop-Down HTML
*/
function construct_memberaction_dropdown($memberinfo, $template_hook = array(), $page_class = null)
{
global $show, $vbulletin;
$memberperm = cache_permissions($memberinfo, false);
// display the private messgage link?
$show['pmlink']=
(
$vbulletin->options['enablepms']
AND
$vbulletin->userinfo['permissions']['pmquota']
AND
(
$vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel']
OR
($memberinfo['receivepm'] AND $memberperm['pmquota'])
)
);
// display the user's homepage link?
$show['homepage'] = ($memberinfo['homepage'] != '' AND $memberinfo['homepage'] != 'http://');
// display the add as friend link?
$show['addfriend']=
(
$vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_friends']
AND $vbulletin->userinfo['userid']
AND $memberinfo['userid'] != $vbulletin->userinfo['userid']
AND $vbulletin->userinfo['permissions']['genericpermissions2'] & $vbulletin->bf_ugp_genericpermissions2['canusefriends']
AND $memberperm['genericpermissions2'] & $vbulletin->bf_ugp_genericpermissions2['canusefriends']
AND !$memberinfo['isfriend']
);
// Check if blog is installed, and show link if so
$show['viewblog'] = $vbulletin->products['vbblog'];
// Check if CMS is installed, and show link if so
$show['viewarticles'] = $vbulletin->products['vbcms'];
// display the email link?
$show['emaillink'] = (
$memberinfo['showemail'] AND $vbulletin->options['displayemails'] AND
(
!$vbulletin->options['secureemail']
OR
($vbulletin->options['secureemail'] AND $vbulletin->options['enableemail'])
)
AND $vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canemailmember']
AND $vbulletin->userinfo['userid']
);
if (!$memberinfo['onlinestatusphrase'])
{
require_once(DIR . '/includes/functions_bigthree.php');
fetch_online_status($memberinfo);
}
// execute memberaction hook
($hook = vBulletinHook::fetch_hook('memberaction_dropdown')) ? eval($hook) : false;
$templater = vB_Template::create('memberaction_dropdown');
$templater->register('memberinfo', $memberinfo);
$templater->register('template_hook', $template_hook);
if (!empty($page_class))
{
$templater->register('page_class', $page_class);
}
return $templater->render();
}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:80,代码来源:functions.php
示例9: assembleContent
//.........这里部分代码省略.........
* Note 2014-02-19: We should remove 'canremove'. It doesn't really do anything outside of unit tests
* currently. Not to confuse this with the 'canremove' checked in editor_contenttype_Text_comment template.
* That's set in the createcontent controller.
* I haven't removed it yet because it would cause a bunch of unit test failures, since they still check for
* this even though it's not used anymore.
*/
$record['permissions'] = array('canedit' => $record['canedit'], 'canmoderate' => $record['canmoderate'], 'canvote' => $thisChannelPerms['canvote'] ? 1 : 0, 'canuserep' => $canUseRep ? 1 : 0, 'canremove' => $record['canremove'], 'can_flag' => $record['can_flag'], 'canviewthreads' => $thisChannelPerms['canviewthreads'], 'canviewothers' => $thisChannelPerms['canviewothers'], 'caninfract' => $record['caninfract'], 'canviewnodeinfraction' => $record['canviewnodeinfraction'], 'canseewholiked' => $record['canseewholiked'], 'can_comment' => $record['can_comment']);
// can't like an infraction
if ($record['permissions']['canuserep'] and $this->contenttype == 'vBForum_Infraction') {
$record['permissions']['canuserep'] = 0;
}
$record['moderatorperms']['canharddeleteposts'] = (int) $record['canharddeleteposts'];
$record['moderatorperms']['candeleteposts'] = (int) $record['candeleteposts'];
$record['moderatorperms']['canundeleteposts'] = (int) $record['canundeleteposts'];
$record['moderatorperms']['candeletethread'] = empty($record['candeletethread']) ? 0 : 1;
$record['moderatorperms']['canmoderateposts'] = empty($record['canmoderateposts']) ? 0 : 1;
$results[$record['nodeid']] = $record;
}
if (!empty($contentUserids)) {
vB_Library::instance('user')->preloadUserInfo($contentUserids);
// Add online status
require_once DIR . '/includes/functions_bigthree.php';
// we just preloaded this info, so there must be a cache hit
$cached = $fastCache->read($needOnlineStatus);
$loadedSigPerm = array();
foreach ($results as $key => $record) {
if ($record['userid'] == 0) {
continue;
}
$cache_key = "vb_UserInfo_{$record['userid']}_{$languageid}";
$authorInfo = $cached[$cache_key];
$results[$key]['signature'] = $authorInfo['signature'];
if (!empty($authorInfo['signature'])) {
if (empty($loadedSigPerm[$record['userid']])) {
$loadedSigPerm[$record['userid']] = vB::getUserContext($record['userid'])->hasPermission('genericpermissions', 'canusesignature');
}
$results[$key]['canSign'] = $loadedSigPerm[$record['userid']] ? 1 : 0;
}
$results[$key]['musername'] = vB_Api::instanceInternal("user")->fetchMusername($authorInfo);
if (!isset($authorInfo['online'])) {
fetch_online_status($authorInfo);
}
$results[$key]['online'] = $authorInfo['online'];
$options = vB::getDatastore()->getValue('options');
if (!empty($options['postelements']) and $options['postelements'] == 4 and ($authorInfo['ipoints'] or $authorInfo['warnings'] or $authorInfo['infractions']) and ($userContext->hasPermission('genericpermissions', 'canreverseinfraction') or $userContext->hasPermission('genericpermissions', 'canseeinfraction') or $userContext->hasPermission('genericpermissions', 'cangiveinfraction') or vB::getCurrentSession()->get('userid') == $authorInfo['userid'])) {
$results[$key]['postelements'] = $options['postelements'];
$results[$key]['ipoints'] = $authorInfo['ipoints'];
$results[$key]['warnings'] = $authorInfo['warnings'];
$results[$key]['infractions'] = $authorInfo['infractions'];
}
}
}
if (!empty($needReputation)) {
$cached = $cache->read($needReputation);
foreach ($content as $record) {
// Add userinfo for reputation - is there a cached version?
if ($record['userid'] > 0 and $record['contenttypeid'] != $this->channelTypeId) {
if ($cached['vBUserRep_' . $record['userid']] !== false) {
$cacheitem = $cached['vBUserRep_' . $record['userid']];
$results[$record['nodeid']]['reputation'] = $cacheitem['reputation'];
$results[$record['nodeid']]['showreputation'] = $cacheitem['showreputation'];
$results[$record['nodeid']]['reputationlevelid'] = $cacheitem['reputationlevelid'];
$results[$record['nodeid']]['reputationpower'] = $cacheitem['reputationpower'];
$results[$record['nodeid']]['reputationimg'] = $cacheitem['reputationimg'];
} else {
$needUserRep[$record['nodeid']] = $record['userid'];
}
}
}
}
//Now add reputation for any users for which we didn't have a cached value.
if (!empty($needUserRep)) {
$reputationLib = vB_Library::instance('reputation');
$userInfo = $this->assertor->assertQuery('user', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, 'userid' => $needUserRep));
$bf_misc_useroptions = vB::getDatastore()->getValue('bf_misc_useroptions');
$userReps = array();
//build the reputation information
foreach ($userInfo as $authorInfo) {
$userid = $authorInfo['userid'];
$userReps[$userid] = array();
$userReps[$userid]['reputation'] = $authorInfo['reputation'];
$userReps[$userid]['showreputation'] = $authorInfo['options'] & $bf_misc_useroptions['showreputation'];
$userReps[$userid]['reputationlevelid'] = $authorInfo['reputationlevelid'];
$userReps[$userid]['reputationpower'] = $reputationLib->fetchReppower($authorInfo);
$userReps[$userid]['reputationimg'] = $reputationLib->fetchReputationImageInfo($authorInfo);
//cache this for a day
$cache->write('vBUserRep_' . $userid, $userReps[$userid], 1440, array("fUserContentChg_{$userid}", "userChg_{$userid}"));
}
foreach ($needUserRep as $nodeid => $userid) {
if (!empty($userReps[$userid])) {
foreach ($userReps[$userid] as $field => $val) {
$results[$nodeid][$field] = $val;
}
}
}
}
// censor textual node items
vB_Library_Node::censorNodes($results);
return $results;
}
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:101,代码来源:content.php
示例10: do_get_forum
//.........这里部分代码省略.........
$listexploded = explode(',', $foruminfo['parentlist']);
$showmods = array();
$show['moderators'] = false;
$totalmods = 0;
foreach ($listexploded as $parentforumid) {
if (!$imodcache["{$parentforumid}"] or $parentforumid == -1) {
continue;
}
foreach ($imodcache["{$parentforumid}"] as $moderator) {
if ($showmods["{$moderator['userid']}"] === true) {
continue;
}
$showmods["{$moderator['userid']}"] = true;
$show['comma_leader'] = $moderatorslist != '';
$show['moderators'] = true;
$totalmods++;
}
}
// ### BUILD FORUMS LIST #################################################
// get an array of child forum ids for this forum
$foruminfo['childlist'] = explode(',', $foruminfo['childlist']);
// define max depth for forums display based on $vbulletin->options[forumhomedepth]
define('MAXFORUMDEPTH', $vbulletin->options['forumdisplaydepth']);
if (($vbulletin->options['showforumusers'] == 1 or $vbulletin->options['showforumusers'] == 2 or $vbulletin->options['showforumusers'] > 2 and $vbulletin->userinfo['userid']) and !$show['search_engine']) {
$datecut = TIMENOW - $vbulletin->options['cookietimeout'];
$forumusers = $db->query_read_slave("\n \t\tSELECT user.username, (user.options & " . $vbulletin->bf_misc_useroptions['invisible'] . ") AS invisible, user.usergroupid,\n \t\t\tsession.userid, session.inforum, session.lastactivity, session.badlocation,\n \t\t\tIF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid, infractiongroupid\n \t\tFROM " . TABLE_PREFIX . "session AS session\n \t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = session.userid)\n \t\tWHERE session.lastactivity > {$datecut}\n \t\tORDER BY" . iif($vbulletin->options['showforumusers'] == 1 or $vbulletin->options['showforumusers'] == 3, " username ASC,") . " lastactivity DESC\n \t");
$numberregistered = 0;
$numberguest = 0;
$doneuser = array();
if ($vbulletin->userinfo['userid']) {
// fakes the user being in this forum
$loggedin = array('userid' => $vbulletin->userinfo['userid'], 'username' => $vbulletin->userinfo['username'], 'invisible' => $vbulletin->userinfo['invisible'], 'invisiblemark' => $vbulletin->userinfo['invisiblemark'], 'inforum' => $foruminfo['forumid'], 'lastactivity' => TIMENOW, 'musername' => $vbulletin->userinfo['musername']);
$numberregistered = 1;
fetch_online_status($loggedin);
$show['comma_leader'] = false;
$doneuser["{$vbulletin->userinfo['userid']}"] = 1;
}
$inforum = array();
// this require the query to have lastactivity ordered by DESC so that the latest location will be the first encountered.
while ($loggedin = $db->fetch_array($forumusers)) {
if ($loggedin['badlocation']) {
continue;
}
if (empty($doneuser["{$loggedin['userid']}"])) {
if (in_array($loggedin['inforum'], $foruminfo['childlist']) and $loggedin['inforum'] != -1) {
if (!$loggedin['userid']) {
// this is a guest
$numberguest++;
$inforum["{$loggedin['inforum']}"]++;
} else {
$numberregistered++;
$inforum["{$loggedin['inforum']}"]++;
if (fetch_online_status($loggedin)) {
fetch_musername($loggedin);
$show['comma_leader'] = $activeusers != '';
}
}
}
if ($loggedin['userid']) {
$doneuser["{$loggedin['userid']}"] = 1;
}
}
}
if (!$vbulletin->userinfo['userid']) {
$numberguest = $numberguest == 0 ? 1 : $numberguest;
}
开发者ID:0hyeah,项目名称:yurivn,代码行数:67,代码来源:get_forum.php
示例11: do_stats
function do_stats()
{
global $vbulletin, $db;
$activeusers = '';
if (($vbulletin->options['displayloggedin'] == 1 or $vbulletin->options['displayloggedin'] == 2 or $vbulletin->options['displayloggedin'] > 2 and $vbulletin->userinfo['userid']) and !$show['search_engine']) {
$datecut = TIMENOW - $vbulletin->options['cookietimeout'];
$numbervisible = 0;
$numberregistered = 0;
$numberguest = 0;
$hook_query_fields = $hook_query_joins = $hook_query_where = '';
($hook = vBulletinHook::fetch_hook('forumhome_loggedinuser_query')) ? eval($hook) : false;
$forumusers = $db->query_read_slave("\n\t SELECT\n\t user.username, (user.options & " . $vbulletin->bf_misc_useroptions['invisible'] . ") AS invisible, user.usergroupid, user.lastvisit,\n\t session.userid, session.inforum, session.lastactivity, session.badlocation,\n\t IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid, infractiongroupid\n\t {$hook_query_fields}\n\t FROM " . TABLE_PREFIX . "session AS session\n\t LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = session.userid)\n\t {$hook_query_joins}\n\t WHERE session.lastactivity > {$datecut}\n\t {$hook_query_where}\n\t " . iif($vbulletin->options['displayloggedin'] == 1 or $vbulletin->options['displayloggedin'] == 3, "ORDER BY username ASC") . "\n\t ");
if ($vbulletin->userinfo['userid']) {
// fakes the user being online for an initial page view of index.php
$vbulletin->userinfo['joingroupid'] = iif($vbulletin->userinfo['displaygroupid'], $vbulletin->userinfo['displaygroupid'], $vbulletin->userinfo['usergroupid']);
$userinfos = array($vbulletin->userinfo['userid'] => array('userid' => &$vbulletin->userinfo['userid'], 'username' => &$vbulletin->userinfo['username'], 'invisible' => &$vbulletin->userinfo['invisible'], 'inforum' => 0, 'lastactivity' => TIMENOW, 'lastvisit' => &$vbulletin->userinfo['lastvisit'], 'usergroupid' => &$vbulletin->userinfo['usergroupid'], 'displaygroupid' => &$vbulletin->userinfo['displaygroupid'], 'infractiongroupid' => &$vbulletin->userinfo['infractiongroupid']));
} else {
$userinfos = array();
}
$inforum = array();
while ($loggedin = $db->fetch_array($forumusers)) {
$userid = $loggedin['userid'];
if (!$userid) {
// Guest
$numberguest++;
if (!isset($inforum["{$loggedin['inforum']}"])) {
$inforum["{$loggedin['inforum']}"] = 0;
}
if (!$loggedin['badlocation']) {
$inforum["{$loggedin['inforum']}"]++;
}
} else {
if (empty($userinfos["{$userid}"]) or $userinfos["{$userid}"]['lastactivity'] < $loggedin['lastactivity']) {
$userinfos["{$userid}"] = $loggedin;
}
}
}
if (!$vbulletin->userinfo['userid'] and $numberguest == 0) {
$numberguest++;
}
foreach ($userinfos as $userid => $loggedin) {
$numberregistered++;
if ($userid != $vbulletin->userinfo['userid'] and !$loggedin['badlocation']) {
if (!isset($inforum["{$loggedin['inforum']}"])) {
$inforum["{$loggedin['inforum']}"] = 0;
}
$inforum["{$loggedin['inforum']}"]++;
}
fetch_musername($loggedin);
($hook = vBulletinHook::fetch_hook('forumhome_loggedinuser')) ? eval($hook) : false;
if (fetch_online_status($loggedin)) {
$numbervisible++;
}
}
// memory saving
unset($userinfos, $loggedin);
$db->free_result($forumusers);
$totalonline = $numberregistered + $numberguest;
$numberinvisible = $numberregistered - $numbervisible;
// ### MAX LOGGEDIN USERS ################################
if (intval($vbulletin->maxloggedin['maxonline']) <= $totalonline) {
$vbulletin->maxloggedin['maxonline'] = $totalonline;
$vbulletin->maxloggedin['maxonlinedate'] = TIMENOW;
build_datastore('maxloggedin', serialize($vbulletin->maxloggedin), 1);
}
$recordusers = vb_number_format($vbulletin->maxloggedin['maxonline']);
$recorddate = vbdate($vbulletin->options['dateformat'], $vbulletin->maxloggedin['maxonlinedate'], true);
$recordtime = vbdate($vbulletin->options['timeformat'], $vbulletin->maxloggedin['maxonlinedate']);
$showloggedinusers = true;
} else {
$showloggedinusers = false;
}
cache_ordered_forums(1, 1);
// get total threads & posts from the forumcache
$totalthreads = 0;
$totalposts = 0;
if (is_array($vbulletin->forumcache)) {
foreach ($vbulletin->forumcache as $forum) {
$totalthreads += $forum['threadcount'];
$totalposts += $forum['replycount'];
}
}
$totalthreads = vb_number_format($totalthreads);
$totalposts = vb_number_format($totalposts);
// get total members and newest member from template
$numbermembers = vb_number_format($vbulletin->userstats['numbermembers']);
$newuserinfo = array('userid' => $vbulletin->userstats['newuserid'], 'username' => $vbulletin->userstats['newusername']);
$activemembers = vb_number_format($vbulletin->userstats['activemembers']);
$showactivemembers = ($vbulletin->options['activememberdays'] > 0 and $vbulletin->options['activememberoptions'] & 2) ? true : false;
$out = array('threads' => $totalthreads, 'posts' => $totalposts, 'members' => $numbermembers, 'newuser' => $newuserinfo['username']);
$out = array_merge($out, array('record_users' => $recordusers, 'record_date' => $recorddate . ' ' . $recordtime, 'online_members' => $numberregistered, 'online_guests' => $numberguest));
$top = $db->query_first_slave("SELECT username FROM " . TABLE_PREFIX . "user ORDER BY posts DESC LIMIT 1");
if ($top['username']) {
$out['top_poster'] = $top['username'];
} else {
$out['top_poster'] = 'N/A';
}
if ($showactivemembers) {
$out['active_members'] = $activemembers;
} else {
//.........这里部分代码省略.........
开发者ID:0hyeah,项目名称:yurivn,代码行数:101,代码来源:misc.php
示例12: preloadUserInfo
/** This preloads information for a list of userids, so it will be available for userContext and other data loading
@param mixed array of integers
*/
public function preloadUserInfo($userids)
{
if (empty($userids) or !is_array($userids)) {
//no harm here. Just nothing to do.
return;
}
$userids = array_unique($userids);
//first we can remove anything that already has been loaded.
$fastCache = vB_Cache::instance(vB_Cache::CACHE_FAST);
$languageid = vB::getCurrentSession()->get('languageid');
$cacheKeys = array();
foreach ($userids as $key => $userid) {
//If we already have userinfo in cache we'll have the others
$infoKey = "vb_UserInfo_{$userid}" . '_' . $languageid;
if ($fastCache->read($infoKey)) {
unset($userids[$key]);
continue;
}
//See if we have a cached version we can use.
$cacheKeys[$userid] = "vb_UserWPerms_{$userid}" . '_' . $languageid;
}
//Now let's see what we can get from large cache
if (!empty($cacheKeys)) {
$cached = vB_Cache::instance(vB_Cache::CACHE_LARGE)->read($cacheKeys);
$needLast = array();
foreach ($cacheKeys as $userid => $cacheKey) {
if (!empty($cached[$cacheKey])) {
$needLast[] = $userid;
}
}
if (!empty($needLast)) {
$lastData = array();
$lastActivityQuery = vB::getDbAssertor()->assertQuery('user', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, vB_dB_Query::COLUMNS_KEY => array('userid', 'lastactivity'), vB_dB_Query::CONDITIONS_KEY => array('userid' => $needLast)));
foreach ($lastActivityQuery as $lastRecord) {
$lastData[$lastRecord['userid']] = $lastRecord['lastactivity'];
}
foreach ($cacheKeys as $userid => $cacheKey) {
if (!empty($cached[$cacheKey])) {
/* VBV-10856: fetchUserWithPerms() expects true/false as its third parameter.
$lastData[$userid] was being passed to it below, which triggered a PHP notice
(Undefined offset) if it wasnt set. I have altered it to send true/false instead. */
$this->fetchUserWithPerms($userid, $languageid, isset($lastData[$userid]));
unset($cacheKeys[$userid]);
}
}
}
}
//Now let's see what's left
if (!empty($cacheKeys)) {
$assertor = vB::getDbAssertor();
//First get userinfo. We cannot use a table query since we also need signature
$userQry = $assertor->assertQuery('fetchUserinfo', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_METHOD, 'userid' => array_keys($cacheKeys)));
if (!$userQry->valid()) {
return;
}
foreach ($userQry as $userInfo) {
$userid = $userInfo['userid'];
fetch_online_status($userInfo);
$primary_group_id = $userInfo['usergroupid'];
$secondary_group_ids = !empty($userInfo['membergroupids']) ? explode(',', str_replace(' ', '', $userInfo['membergroupids'])) : array();
$infraction_group_ids = !empty($userInfo['infractiongroupids']) ? explode(',', str_replace(' ', '', $userInfo['infractiongroupids'])) : array();
$usergroups = array('groupid' => $primary_group_id, 'secondary' => $secondary_group_ids, 'infraction' => $infraction_group_ids);
$fastCache->write("vb_UserInfo_{$userid}" . '_' . $languageid, $userInfo, 5, "userChg_{$userid}");
}
}
}
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:71,代码来源:user.php
示例13: do_get_profile
function do_get_profile()
{
global $vbulletin, $db, $show, $vbphrase, $permissions, $imodcache;
$vbulletin->input->clean_array_gpc('r', array('userid' => TYPE_UINT));
if (!$vbulletin->userinfo['userid'] && !$vbulletin->GPC['userid']) {
json_error(ERR_INVALID_LOGGEDIN, RV_NOT_LOGGED_IN);
}
if (!($permissions['forumpermissions'] & $vbulletin->bf_ugp_forumpermissions['canview']) or !($permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canviewmembers'])) {
json_error(ERR_NO_PERMISSION);
}
if (!$vbulletin->GPC['userid']) {
$vbulletin->GPC['userid'] = $vbulletin->userinfo['userid'];
}
$fetch_userinfo_options = FETCH_USERINFO_AVATAR | FETCH_USERINFO_LOCATION | FETCH_USERINFO_PROFILEPIC | FETCH_USERINFO_SIGPIC | FETCH_USERINFO_USERCSS | FETCH_USERINFO_ISFRIEND;
$userinfo = verify_id('user', $vbulletin->GPC['userid'], 1, $fetch_userinfo_options);
if ($userinfo['usergroupid'] == 4 and !($permissions['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel'])) {
json_error(ERR_NO_PERMISSION);
}
$posts = $userinfo['posts'];
$joindate = vbdate($vbulletin->options['dateformat'], $userinfo['joindate']);
$out = array('username' => html_entity_decode($userinfo['username']), 'online' => fetch_online_status($userinfo, false), 'avatar_upload' => $vbulletin->options['avatarenabled'] && $permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canuseavatar'], 'posts' => $posts, 'joindate' => $joindate);
$avatarurl_info = fetch_avatar_url($userinfo['userid']);
if ($avatarurl_info) {
$out['avatarurl'] = process_avatarurl($avatarurl_info[0]);
}
cache_moderators();
$canbanuser = ($vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel'] or can_moderate(0, 'canbanusers'));
if ($canbanuser) {
$out['ban'] = true;
}
$groups = array();
// About
$out_group = array('name' => 'about', 'values' => array(array('name' => prepare_utf8_string($vbphrase['posts']), 'value' => strval(vb_number_format($userinfo['posts']))), array('name' => prepare_utf8_string($vbphrase['join_date']), 'value' => vbdate($vbulletin->options['dateformat'], $userinfo['joindate']))));
if (function_exists('itrader_user')) {
itrader_user($userinfo);
$out_group['values'][] = array('name' =
|
请发表评论