本文整理汇总了PHP中fetch_musername函数的典型用法代码示例。如果您正苦于以下问题:PHP fetch_musername函数的具体用法?PHP fetch_musername怎么用?PHP fetch_musername使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fetch_musername函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_array
public static function create_array($ids)
{
global $vbulletin;
$set = $vbulletin->db->query_read_slave("
SELECT announcementid, startdate, title, announcement.views, forumid,
user.username, user.userid, user.usertitle, user.customtitle, user.usergroupid,
IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid, infractiongroupid
FROM " . TABLE_PREFIX . "announcement AS announcement
LEFT JOIN " . TABLE_PREFIX . "user AS user USING (userid)
WHERE announcementid IN (" . implode(',', array_map('intval', $ids)) . ")
");
$items = array();
while ($record = $vbulletin->db->fetch_array($set))
{
fetch_musername($record);
$record['title'] = fetch_censored_text($record['title']);
$record['postdate'] = vbdate($vbulletin->options['dateformat'], $record['startdate']);
$record['statusicon'] = 'new';
$record['views'] = vb_number_format($record['views']);
$record['forumtitle'] = $vbulletin->forumcache["$record[forumid]"]['title'];
$show['forumtitle'] = ($record['forumid'] == -1) ? false : true;
$announcement = new vBForum_Search_Result_Announcement();
$announcement->record = $record;
$items[$record['announcementid']] = $announcement;
}
return $items;
}
示例2: cache_moderators
function cache_moderators($userid = null)
{
global $vbulletin, $imodcache, $mod;
$imodcache = array();
$mod = array();
$forummoderators = $vbulletin->db->query_read_slave("\n\t\tSELECT moderator.*, user.username,\n\t\tIF(user.displaygroupid = 0, user.usergroupid, user.displaygroupid) AS displaygroupid, infractiongroupid\n\t\tFROM " . TABLE_PREFIX . "moderator AS moderator\n\t\tINNER JOIN " . TABLE_PREFIX . "user AS user USING(userid)\n\t\t" . ($userid != null ? "WHERE moderator.userid = " . intval($userid) : "") . "\n\t");
while ($moderator = $vbulletin->db->fetch_array($forummoderators)) {
fetch_musername($moderator);
$imodcache["{$moderator['forumid']}"]["{$moderator['userid']}"] = $moderator;
$mod["{$moderator['userid']}"] = 1;
}
$vbulletin->db->free_result($forummoderators);
}
示例3: 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;
}
示例4: 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;
}
示例5: prepare_output
/**
* Prepare any data needed for the output
*
* @param string The id of the block
* @param array Options specific to the block
*/
function prepare_output($id = '', $options = array())
{
global $show, $vbphrase;
// don't include yourself in the visit count
if ($this->profile->userinfo['userid'] != $this->registry->userinfo['userid'])
{
// profile visits
$this->registry->db->query_write("
UPDATE " . TABLE_PREFIX . "user SET
profilevisits = profilevisits + 1
WHERE userid = " . $this->profile->userinfo['userid']
);
$this->profile->userinfo['profilevisits']++; // reflect this view
}
$this->profile->prepare('profilevisits');
// We shouldn't show as a profile visitor
if ($this->registry->userinfo['userid'] AND $this->profile->userinfo['userid'] != $this->registry->userinfo['userid'])
{
$this->registry->db->query_write("
REPLACE INTO " . TABLE_PREFIX . "profilevisitor
(userid, visitorid, dateline, visible)
VALUES
(
" . $this->profile->userinfo['userid'] . ",
". $this->registry->userinfo['userid'] . ",
" . TIMENOW . ",
" . ($this->registry->userinfo['options'] & $this->registry->bf_misc_useroptions['invisible'] ? 0 : 1) . "
)
");
}
// ensure this setting makes sense
if ($options['profilemaxvisitors'] < 2)
{
$options['profilemaxvisitors'] = 2;
}
$hook_query_fields = $hook_query_joins = $hook_query_where = '';
($hook = vBulletinHook::fetch_hook('member_profileblock_recentvisitors_query')) ? eval($hook) : false;
$visitors_db = $this->registry->db->query_read_slave("
SELECT user.userid, user.username, user.usergroupid, user.displaygroupid, profilevisitor.visible, user.infractiongroupid
$hook_query_fields
FROM " . TABLE_PREFIX . "profilevisitor AS profilevisitor
INNER JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = profilevisitor.visitorid)
$hook_query_joins
WHERE profilevisitor.userid = " . $this->profile->userinfo['userid'] . "
" . (!($this->registry->userinfo['permissions']['genericpermissions'] & $this->registry->bf_ugp_genericpermissions['canseehidden']) ? " AND (visible = 1 OR profilevisitor.visitorid = " . $this->registry->userinfo['userid'] . ")" : "") . "
$hook_query_where
ORDER BY profilevisitor.dateline DESC
LIMIT $options[profilemaxvisitors]
");
$visitors = array();
while ($user = $this->registry->db->fetch_array($visitors_db))
{
$visitors["$user[username]"] = $user;
}
uksort($visitors, 'strnatcasecmp');
if (!is_array($buddylist))
{
if ($this->registry->userinfo['buddylist'] = trim($this->registry->userinfo['buddylist']))
{
$buddylist = preg_split('/\s+/', $this->registry->userinfo['buddylist'], -1, PREG_SPLIT_NO_EMPTY);
}
else
{
$buddylist = array();
}
}
$visitorbits = '';
foreach ($visitors AS $user)
{
fetch_musername($user);
$user['invisiblemark'] = !$user['visible'] ? '*' : '';
$user['buddymark'] = in_array($user['userid'], $buddylist) ? '+' : '';
$templater = vB_Template::create('memberinfo_visitorbit');
$templater->register('user', $user);
$visitorbits .= $templater->render();
}
$this->block_data['visitorbits'] = $visitorbits;
$this->block_data['visitorcount'] = vb_number_format($this->registry->db->num_rows($visitors_db));
}
示例6: cache_events
function cache_events($range)
{
global $vbulletin, $calendarinfo, $vbphrase, $serveroffset;
$numdays = date('j', mktime(0, 0, 0, $range['nextmonth'] + 1, 1, $range['nextyear']) - 1);
$beginday = gmmktime(0, 0, 0, $range['frommonth'], 1, $range['fromyear']) + -12 * 3600;
$endday = gmmktime(24, 0, 0, $range['nextmonth'], $numdays, $range['nextyear']) + 12 * 3600;
$event = array();
$eventids = array();
if ($calendarinfo['showholidays']) {
// Holidays show across all calendars that a user has access to.
$holidays = $vbulletin->db->query_read_slave("\n\t\t\tSELECT *\n\t\t\tFROM " . TABLE_PREFIX . "holiday\n\t\t");
if ($vbulletin->db->num_rows($holidays)) {
while ($ev = $vbulletin->db->fetch_array($holidays)) {
$ev['visible'] = 1;
$ev['title'] =& $vbphrase['holiday' . $ev['holidayid'] . '_title'];
$ev['event'] =& $vbphrase['holiday' . $ev['holidayid'] . '_desc'];
$ev['preview'] = strip_quotes($ev['event']);
$ev['preview'] = htmlspecialchars_uni(strip_bbcode(fetch_trimmed_title($ev['preview'], 300), false, true));
if ($ev['recurring'] == 6) {
$event['holiday1']["{$ev['recuroption']}"][] = $ev;
} else {
$ev['dateline_from'] = $beginday;
$ev['dateline_to'] = $endday;
$offset = $vbulletin->userinfo['timezoneoffset'] ? $vbulletin->userinfo['tzoffset'] : $vbulletin->userinfo['timezoneoffset'];
$ev['dateline_from_user'] = $ev['dateline_from'] + $offset * 3600;
$ev['dateline_to_user'] = $ev['dateline_to'] + $offset * 3600;
$recuroption = substr($ev['recuroption'], 2);
$event['holiday2']["{$recuroption}"][] = $ev;
}
}
}
}
$events = $vbulletin->db->query_read_slave("\n\t\tSELECT event.*,\n\t\tuser.username, IF(user.displaygroupid = 0, user.usergroupid, user.displaygroupid) AS displaygroupid,\n\t\tIF(dateline_to = 0, 1, 0) AS singleday\n\t\t" . iif($vbulletin->userinfo['userid'], ", subscribeevent.eventid AS subscribed") . "\n\t\tFROM " . TABLE_PREFIX . "event AS event\n\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = event.userid)\n\t\t" . iif($vbulletin->userinfo['userid'], "LEFT JOIN " . TABLE_PREFIX . "subscribeevent AS subscribeevent ON (subscribeevent.eventid = event.eventid AND subscribeevent.userid = " . $vbulletin->userinfo['userid'] . ")") . "\n\t\tWHERE calendarid = {$calendarinfo['calendarid']} AND\n\t\t\t((dateline_to >= {$beginday} AND dateline_from < {$endday}) OR (dateline_to = 0 AND dateline_from >= {$beginday} AND dateline_from <= {$endday} ))\tAND\n\t\t\tvisible = 1\n\t\tORDER BY dateline_from\n\t");
// Cache Events
if ($vbulletin->db->num_rows($events)) {
while ($ev = $vbulletin->db->fetch_array($events)) {
if ($ev['userid'] != $vbulletin->userinfo['userid'] and !($vbulletin->userinfo['calendarpermissions']["{$calendarinfo['calendarid']}"] & $vbulletin->bf_ugp_calendarpermissions['canviewothersevent'])) {
continue;
}
$ev['preview'] = strip_quotes($ev['event']);
$ev['preview'] = htmlspecialchars_uni(strip_bbcode(fetch_trimmed_title($ev['preview'], 300), false, true));
$offset = $ev['dst'] ? $vbulletin->userinfo['timezoneoffset'] : $vbulletin->userinfo['tzoffset'];
$ev['dateline_from_user'] = $ev['dateline_from'] + $offset * 3600;
$ev['dateline_to_user'] = $ev['dateline_to'] + $offset * 3600;
fetch_musername($ev);
if (!$ev['recurring']) {
if ($ev['singleday']) {
$event['singleday']["{$ev['dateline_from']}"][] = $ev;
} else {
$found = false;
$date = explode('-', gmdate('n-j-Y', $ev['dateline_from_user']));
$beginday = gmmktime(0, 0, 0, $date[0], $date[1], $date[2]);
while ($beginday <= $ev['dateline_to_user']) {
if (!$found) {
$event['ranged']["{$beginday}"][] = $ev;
$count = count($event['ranged']["{$beginday}"]) - 1;
$tempevent =& $event['ranged']["{$beginday}"]["{$count}"];
$found = true;
} else {
// if event ends at the start of the day, don't display it for that day
if ($ev['dateline_to_user'] != $beginday) {
$event['ranged']["{$beginday}"][] =& $tempevent;
}
}
$beginday += 86400;
}
}
} else {
$event['recurring'][] = $ev;
}
}
}
return $event;
}
示例7: while
$wrt['trtotal'] = 0;
while ($threadreader = $vbulletin->db->fetch_array($readlist)) {
if (intval($threadreader['userid'])) {
$wrt['trtotal'] += 1;
$threadreader['markinv'] = '';
$threadreader[visible] = true;
if ($threadreader['options'] & $vbulletin->bf_misc_useroptions['invisible']) {
$threadreader['visible'] = false;
if ($vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canseehidden'] or $threadreader['userid'] == $vbulletin->userinfo['userid']) {
$threadreader['markinv'] = '*';
$threadreader['visible'] = true;
}
}
if ($threadreader['visible']) {
$count += 1;
fetch_musername($threadreader);
$threadreader['wrdate'] = $vbphrase['wrt_readtime'] . ' ';
$threadreader['comma'] = $vbphrase['comma_space'];
$threadreader['wrdate'] .= vbdate($vbulletin->options['dateformat'], $threadreader['dateline']) . ', ';
$threadreader['wrdate'] .= vbdate($vbulletin->options['timeformat'], $threadreader['dateline']);
$wrtlist[$count] = $threadreader;
}
}
}
if ($count) {
$wrtlist[$count]['comma'] = '';
}
($hook = vBulletinHook::fetch_hook('showthread_whoread_list')) ? eval($hook) : false;
} else {
$readers = $vbulletin->db->query_first_slave("\n\t\tSELECT COUNT(userid) AS whoread\n\t\t\tFROM " . TABLE_PREFIX . "contentread as whoread\n\t\t\tWHERE whoread.readtype = 'view'\n\t\t\tAND whoread.contentid = {$threadid}\n\t\t\tAND whoread.contenttypeid = {$contenttypeid}\n\t\t\tAND whoread.dateline > {$cutoff}\n\t\t");
($hook = vBulletinHook::fetch_hook('showthread_whoread_nonames')) ? eval($hook) : false;
示例8: array
$customfieldssql = array();
while ($custom = $db->fetch_array($customcalfields)) {
$customfieldssql[] = $custom;
}
}
$show['canmoveevent'] = can_moderate_calendar($calendarinfo['calendarid'], 'canmoveevents');
$show['candeleteevent'] = can_moderate_calendar($calendarinfo['calendarid'], 'candeleteevents');
require_once DIR . '/includes/functions_misc.php';
// mainly for fetch_timezone
require_once DIR . '/includes/functions_user.php';
// to fetch user avatar
foreach ($eventarray as $index => $eventinfo) {
$eventinfo = fetch_event_date_time($eventinfo);
$holidayid = $eventinfo['holidayid'];
$customfields = '';
fetch_musername($eventinfo);
if (!$holidayid) {
unset($holidayid);
$eventfields = unserialize($eventinfo['customfields']);
$bgclass = 'alt2';
$show['customfields'] = false;
foreach ($customfieldssql as $index => $value) {
$description = $value['description'];
$value['options'] = unserialize($value['options']);
exec_switch_bg();
$selectbits = '';
$customoption = '';
$customtitle = $value['title'];
if (is_array($value['options'])) {
foreach ($value['options'] as $key => $val) {
if ($val == $eventfields["{$value['calendarcustomfieldid']}"]) {
示例9: array_merge
$first = $itemcount + 1;
while ($userinfo = $db->fetch_array($users) AND $counter++ < $perpage)
{
$userinfo = array_merge($userinfo , convert_bits_to_array($userinfo['options'] , $vbulletin->bf_misc_useroptions));
$userinfo = array_merge($userinfo , convert_bits_to_array($userinfo['adminoptions'] , $vbulletin->bf_misc_adminoptions));
cache_permissions($userinfo, false);
// format posts number
$userinfo['posts'] = vb_number_format($userinfo['posts']);
if ($userinfo['usertitle'] == '')
{
$userinfo['usertitle'] = ' ';
}
fetch_musername($userinfo);
$userinfo['datejoined'] = vbdate($vbulletin->options['dateformat'], $userinfo['joindate'], true);
if (!$userinfo['lastvisittime'])
{
$userinfo['lastvisit'] = $vbphrase['n_a'];
}
else
{
$userinfo['lastvisit'] = vbdate($vbulletin->options['dateformat'], $userinfo['lastvisittime'], true);
}
if ($userinfo['lastpost'])
{
$show['searchlink'] = true;
}
示例10: USING
$url = '';
}
$threadcolspan = 7;
$announcecolspan = 6;
if ($show['inlinemod']) {
$threadcolspan++;
$announcecolspan++;
}
if (!$show['threadicons']) {
$threadcolspan--;
$announcecolspan--;
}
if (!empty($search['announceids']) and $vbulletin->GPC['pagenumber'] == 1) {
$announcements = $db->query_read_slave("\n\t\t\tSELECT announcementid, startdate, title, announcement.views, forumid,\n\t\t\t\tuser.username, user.userid, user.usertitle, user.customtitle, user.usergroupid,\n\t\t\t\tIF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid, infractiongroupid\n\t\t\tFROM " . TABLE_PREFIX . "announcement AS announcement\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user USING (userid)\n\t\t\tWHERE announcementid IN ({$search['announceids']})\n\t\t\tORDER BY startdate DESC\n\t\t");
while ($announcement = $db->fetch_array($announcements)) {
fetch_musername($announcement);
$announcement['title'] = fetch_censored_text($announcement['title']);
$announcement['postdate'] = vbdate($vbulletin->options['dateformat'], $announcement['startdate']);
$announcement['statusicon'] = 'new';
$announcement['views'] = vb_number_format($announcement['views']);
$announcementidlink = "&a={$announcement['announcementid']}";
$announcement['forumtitle'] = $vbulletin->forumcache["{$announcement['forumid']}"]['title'];
$show['forumtitle'] = $announcement['forumid'] == -1 ? false : true;
eval('$announcebits .= "' . fetch_template('threadbit_announcement') . '";');
}
}
// get highlight words
if (!empty($display['highlight'])) {
$highlightwords = '&highlight=' . urlencode(implode(' ', $display['highlight']));
} else {
$highlightwords = '';
示例11: strip_tags
$get_new_posts[fullthreadtitle] = strip_tags($get_new_posts[title]);
if ($trimthreadtitle > 0) {
$get_new_posts[titletrimmed] = fetch_trimmed_title($get_new_posts[fullthreadtitle], $trimthreadtitle);
} else {
$get_new_posts[titletrimmed] = $get_new_posts[fullthreadtitle];
}
if ($get_new_posts[lastpost] > $vbulletin->userinfo['lastvisit']) {
$get_new_posts[newpost] = true;
}
$get_new_posts[fullusername] = strip_tags($get_new_posts[username]);
if ($trimusername > 0) {
$get_new_posts[username] = fetch_trimmed_title($get_new_posts[fullusername], $trimusername);
} else {
$get_new_posts[username] = $get_new_posts[fullusername];
}
$get_new_posts[musername] = fetch_musername($get_new_posts);
$get_new_posts_forumtitle = strip_tags($vbulletin->forumcache["{$get_new_posts['forumid']}"]['title_clean']);
$get_new_posts[fullforumtitle] = strip_tags($get_new_posts_forumtitle);
if ($vbulletin->options['vietvbbtopstats_bold_remove']) {
$get_new_posts[musername] = str_replace($vietvbb_afs_bpar, "", $get_new_posts[musername]);
}
$get_new_postdate = vbdate($vbulletin->options['vietvbbtopstats_date_format'], $get_new_posts[lastpost]);
$get_new_posttime = vbdate($vbulletin->options['vietvbbtopstats_time_format'], $get_new_posts[lastpost]);
$get_new_startdate = vbdate($vbulletin->options['vietvbbtopstats_date_format'], $get_new_posts[dateline]);
$get_new_starttime = vbdate($vbulletin->options['vietvbbtopstats_time_format'], $get_new_posts[dateline]);
eval('$vietvbbtopstats_top .= "' . $vbulletin->templatecache['vietvbb_topstats_latest_posts'] . '";');
}
if (!$vietvbbtopstats_top) {
$vietvbbtopstats_top = 'No Result';
}
print_output($vietvbbtopstats_top);
示例12: vbdate
$blog['lastentrytime'] = vbdate($vbulletin->options['timeformat'], $blog['lastblog']);
$lastentrycats = explode(',', $blog['categories']);
$lastcommentcats = explode(',', $blog['categories_lastcomment']);
$show['lastentry'] = array_intersect($vbulletin->userinfo['blogcategorypermissions']['cantview'], $lastentrycats) ? false : true;
$show['lastcomment'] = array_intersect($vbulletin->userinfo['blogcategorypermissions']['cantview'], $lastcommentcats) ? false : true;
if ($blogtype == 'all') {
$blog['entrytitle'] = fetch_trimmed_title($blog['lastblogtitle'], 20);
if ($blog['title']) {
$blog['title'] = fetch_trimmed_title($blog['title'], 50);
}
$templater = vB_Template::create('blog_blog_row');
$templater->register('blog', $blog);
$templater->register('thread', $thread);
$blogbits .= $templater->render();
} else {
fetch_musername($blog);
fetch_avatar_html($blog);
$blog['onlinestatus'] = 0;
$blog['commentexcerpt'] = htmlspecialchars_uni(fetch_trimmed_title($blog['pagetext'], 50));
// now decide if we can see the user or not
if ($blog['lastactivity'] > TIMENOW - $vbulletin->options['cookietimeout'] and $blog['lastvisit'] != $blog['lastactivity']) {
if ($blog['invisible']) {
if ($vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canseehidden'] or $blog['userid'] == $vbulletin->userinfo['userid']) {
// user is online and invisible BUT bbuser can see them
$blog['onlinestatus'] = 2;
}
} else {
// user is online and visible
$blog['onlinestatus'] = 1;
}
}
示例13: build_notices
/**
* Builds the applicable notice HTML
*
* @return string Applicable notice HTML
*/
protected function build_notices()
{
global $vbulletin, $vbphrase, $show;
$notices = '';
if (!defined('NONOTICES') and !empty($vbulletin->noticecache) and is_array($vbulletin->noticecache)) {
$return_link = $vbulletin->scriptpath;
require_once DIR . '/includes/functions_notice.php';
if ($vbulletin->userinfo['userid'] == 0) {
$vbulletin->userinfo['musername'] = fetch_musername($vbulletin->userinfo);
}
foreach (fetch_relevant_notice_ids() as $_noticeid) {
$show['notices'] = true;
if ($vbulletin->noticecache["{$_noticeid}"]["dismissible"] == 1 and $vbulletin->userinfo['userid']) {
// only show the dismiss link for registered users; guest who wants to dismiss? Register please.
$show['dismiss_link'] = true;
} else {
$show['dismiss_link'] = false;
}
$notice_html = str_replace(array('{musername}', '{username}', '{userid}', '{sessionurl}', '{sessionurl_q}'), array($vbulletin->userinfo['musername'], $vbulletin->userinfo['username'], $vbulletin->userinfo['userid'], vB::getCurrentSession()->get('sessionurl'), vB::getCurrentSession()->get('sessionurl_q')), $vbphrase["notice_{$_noticeid}_html"]);
// Legacy Hook 'notices_noticebit' Removed //
$templater = vB_Template::create('navbar_noticebit');
$templater->register('notice_html', $notice_html);
$templater->register('_noticeid', $_noticeid);
$notices .= $templater->render();
}
}
return $notices;
}
示例14: blog_online_ids_titles
/**
* Converts are blog ids to titles for Who's Online
*
* @return void
*/
function blog_online_ids_titles()
{
global $blogids, $blogtextids, $blogtrackbackids, $bloguserids, $vbulletin;
global $wol_blog, $wol_blogtext, $wol_blogtrackback, $wol_bloguser, $wol_user;
if ($blogtrackbackids)
{
$blograckbackidquery = $vbulletin->db->query_read_slave("
SELECT blogid, blogtrackbackid
FROM " . TABLE_PREFIX . "blog_trackback
WHERE blogtrackbackid IN (0$blogtrackbackids)
");
while ($blogtrackbackidqueryr = $vbulletin->db->fetch_array($blogtrackbackidquery))
{
$blogids .= ',' . $blogtrackbackidqueryr['blogid'];
$wol_blogtrackback["$blogtrackbackidqueryr[blogtrackbackid]"] = $blogtrackbackidqueryr['blogid'];
}
}
if ($blogtextids)
{
$blogtextidquery = $vbulletin->db->query_read_slave("
SELECT blogid, blogtextid, title
FROM " . TABLE_PREFIX . "blog_text
WHERE blogtextid IN (0$blogtextids)
");
while ($blogtextidqueryr = $vbulletin->db->fetch_array($blogtextidquery))
{
$blogids .= ',' . $blogtextidqueryr['blogid'];
$wol_blogtext["$blogtextidqueryr[blogtextid]"]['blogid'] = $blogtextidqueryr['blogid'];
$wol_blogtext["$blogtextidqueryr[blogtextid]"]['title'] = $blogtextidqueryr['title'];
}
}
if ($blogids)
{
$blogresults = $vbulletin->db->query_read_slave("
SELECT blog.title, blogid, blog.userid, state, blog.options
FROM " . TABLE_PREFIX . "blog AS blog
LEFT JOIN " . TABLE_PREFIX . "blog_user AS blog_user ON (blog_user.bloguserid = blog.userid)
WHERE blogid IN (0$blogids)
");
while ($blogresult = $vbulletin->db->fetch_array($blogresults))
{
$wol_blog["$blogresult[blogid]"]['title'] = $blogresult['title'];
$wol_blog["$blogresult[blogid]"]['userid'] = $blogresult['userid'];
$wol_blog["$blogresult[blogid]"]['state'] = $blogresult['state'];
$wol_blog["$blogresult[blogid]"]['private'] = ($blogresult['options'] & $vbulletin->bf_misc_vbblogoptions['private']);
$bloguserids .= ",$blogresult[userid]";
}
}
if ($bloguserids)
{
$fields = $joins = '';
if ($vbulletin->userinfo['userid'])
{
$fields = ", ignored.relationid AS ignoreid, buddy.relationid AS buddyid";
$joins = "
LEFT JOIN " . TABLE_PREFIX . "userlist AS ignored ON (ignored.userid = bu.bloguserid AND ignored.relationid = " . $vbulletin->userinfo['userid'] . " AND ignored.type = 'ignore')
LEFT JOIN " . TABLE_PREFIX . "userlist AS buddy ON (buddy.userid = bu.bloguserid AND buddy.relationid = " . $vbulletin->userinfo['userid'] . " AND buddy.type = 'buddy')
";
}
$userresults = $vbulletin->db->query_read_slave("
SELECT bu.title, bu.bloguserid, bu.options_member, bu.options_guest, bu.options_buddy, bu.options_ignore, bu.memberids, bu.memberblogids,
user.userid, user.username, IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid, user.infractiongroupid, user.usergroupid, user.membergroupids
$fields
FROM " . TABLE_PREFIX . "blog_user AS bu
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (bu.bloguserid = user.userid)
$joins
WHERE bu.bloguserid IN (0$bloguserids)
");
while ($userresult = $vbulletin->db->fetch_array($userresults))
{
cache_permissions($userresult, false);
fetch_musername($userresult);
$wol_user["$userresult[userid]"] = $userresult['musername'];
$member = ($userresult['options_member'] & $vbulletin->bf_misc_vbblogsocnetoptions['canviewmyblog'] ? 1 : 0);
$guest = ($userresult['options_guest'] & $vbulletin->bf_misc_vbblogsocnetoptions['canviewmyblog'] ? 1 : 0);
$buddy = ($userresult['options_buddy'] & $vbulletin->bf_misc_vbblogsocnetoptions['canviewmyblog'] ? 1 : 0);
$ignore = ($userresult['options_ignore'] & $vbulletin->bf_misc_vbblogsocnetoptions['canviewmyblog'] ? 1 : 0);
$wol_bloguser["$userresult[bloguserid]"]['title'] = $userresult['title'];
$wol_bloguser["$userresult[bloguserid]"]['canviewmyblog'] =
(
(
!$userresult['buddyid']
OR
$buddy
)
AND
(
!$userresult['ignoreid']
//.........这里部分代码省略.........
示例15: 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 {
//.........这里部分代码省略.........