本文整理汇总了PHP中process_thread_array函数的典型用法代码示例。如果您正苦于以下问题:PHP process_thread_array函数的具体用法?PHP process_thread_array怎么用?PHP process_thread_array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了process_thread_array函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_get_subscriptions
//.........这里部分代码省略.........
}
$hasthreads = true;
$threadbits = '';
$pagenav = '';
$counter = 0;
$toread = 0;
$vbulletin->options['showvotes'] = intval($vbulletin->options['showvotes']);
if ($vbulletin->userinfo['userid'] and in_coventry($vbulletin->userinfo['userid'], true)) {
$lastpost_info = "IF(tachythreadpost.userid IS NULL, thread.lastpost, tachythreadpost.lastpost) AS lastpost, " . "IF(tachythreadpost.userid IS NULL, thread.lastposter, tachythreadpost.lastposter) AS lastposter, " . "IF(tachythreadpost.userid IS NULL, thread.lastposterid, tachythreadpost.lastposterid) AS lastposterid, " . "IF(tachythreadpost.userid IS NULL, thread.lastpostid, tachythreadpost.lastpostid) AS lastpostid";
$tachyjoin = "LEFT JOIN " . TABLE_PREFIX . "tachythreadpost AS tachythreadpost ON " . "(tachythreadpost.threadid = thread.threadid AND tachythreadpost.userid = " . $vbulletin->userinfo['userid'] . ')';
} else {
$lastpost_info = 'thread.lastpost, thread.lastposter, thread.lastposterid, thread.lastpostid';
$tachyjoin = '';
}
$hook_query_fields = $hook_query_joins = $hook_query_where = '';
$threads = $db->query_read_slave("\n\t\t\tSELECT\n\t\t\t\tIF(thread.votenum >= " . $vbulletin->options['showvotes'] . ", thread.votenum, 0) AS votenum,\n\t\t\t\tIF(thread.votenum >= " . $vbulletin->options['showvotes'] . " AND thread.votenum > 0, thread.votetotal / thread.votenum, 0) AS voteavg,\n\t\t\t\tthread.votetotal,\n\t\t\t\t{$previewfield} thread.threadid, thread.title AS threadtitle, thread.forumid, thread.pollid,\n\t\t\t\tthread.open, thread.replycount, thread.postusername, thread.prefixid,\n\t\t\t\t{$lastpost_info}, thread.postuserid, thread.dateline, thread.views, thread.iconid AS threadiconid,\n\t\t\t\tthread.notes, thread.visible, thread.attach, thread.taglist\n\t\t\t\t" . ($vbulletin->options['threadmarking'] ? ", threadread.readtime AS threadread" : '') . "\n\t\t\t\t{$hook_query_fields}\n\t\t\tFROM " . TABLE_PREFIX . "thread AS thread\n\t\t\t{$previewjoin}\n\t\t\t" . ($vbulletin->options['threadmarking'] ? " LEFT JOIN " . TABLE_PREFIX . "threadread AS threadread ON (threadread.threadid = thread.threadid AND threadread.userid = " . $vbulletin->userinfo['userid'] . ")" : '') . "\n\t\t\t{$tachyjoin}\n\t\t\t{$hook_query_joins}\n\t\t\tWHERE thread.threadid IN ({$threadids})\n\t\t\tORDER BY {$sqlsortfield} {$sqlsortorder}\n\t\t");
unset($sqlsortfield, $sqlsortorder);
require_once DIR . '/includes/functions_forumdisplay.php';
// Get Dot Threads
$dotthreads = fetch_dot_threads_array($threadids);
if ($vbulletin->options['showdots'] and $vbulletin->userinfo['userid']) {
$show['dotthreads'] = true;
} else {
$show['dotthreads'] = false;
}
if ($vbulletin->options['threadpreview'] and $vbulletin->userinfo['ignorelist']) {
// Get Buddy List
$buddy = array();
if (trim($vbulletin->userinfo['buddylist'])) {
$buddylist = preg_split('/( )+/', trim($vbulletin->userinfo['buddylist']), -1, PREG_SPLIT_NO_EMPTY);
foreach ($buddylist as $buddyuserid) {
$buddy["{$buddyuserid}"] = 1;
}
}
DEVDEBUG('buddies: ' . implode(', ', array_keys($buddy)));
// Get Ignore Users
$ignore = array();
if (trim($vbulletin->userinfo['ignorelist'])) {
$ignorelist = preg_split('/( )+/', trim($vbulletin->userinfo['ignorelist']), -1, PREG_SPLIT_NO_EMPTY);
foreach ($ignorelist as $ignoreuserid) {
if (!$buddy["{$ignoreuserid}"]) {
$ignore["{$ignoreuserid}"] = 1;
}
}
}
DEVDEBUG('ignored users: ' . implode(', ', array_keys($ignore)));
}
$foruminfo['allowratings'] = true;
$show['notificationtype'] = true;
$show['threadratings'] = true;
$show['threadrating'] = true;
while ($thread = $db->fetch_array($threads)) {
$threadid = $thread['threadid'];
// build thread data
$thread = process_thread_array($thread, $lastread["{$thread['forumid']}"]);
switch ($emailupdate["{$thread['threadid']}"]) {
case 0:
$thread['notification'] = $vbphrase['none'];
break;
case 1:
$thread['notification'] = $vbphrase['instant'];
break;
case 2:
$thread['notification'] = $vbphrase['daily'];
break;
case 3:
$thread['notification'] = $vbphrase['weekly'];
break;
default:
$thread['notification'] = $vbphrase['n_a'];
}
$avatarurl = '';
if ($thread['lastpost_userid'] > 0) {
$userinfoavatar = fetch_userinfo($thread['lastpost_userid'], FETCH_USERINFO_AVATAR);
fetch_avatar_from_userinfo($userinfoavatar, true, false);
if ($userinfoavatar['avatarurl'] != '') {
$avatarurl = process_avatarurl($userinfoavatar['avatarurl']);
}
unset($userinfoavatar);
}
$tmp = array('thread_id' => $thread['threadid'], 'new_posts' => $show['gotonewpost'] ? true : false, 'forum_id' => $thread['forumid'], 'total_posts' => $thread['totalposts'] ? $thread['totalposts'] : 0, 'forum_title' => prepare_utf8_string($thread['forumtitle']), 'thread_title' => prepare_utf8_string($thread['threadtitle']), 'thread_preview' => prepare_utf8_string(preview_chop(html_entity_decode($thread['preview']), FR_PREVIEW_LEN)), 'post_userid' => $thread['lastpost_userid'], 'post_lastposttime' => prepare_utf8_string(date_trunc($thread['lastpostdate']) . ' ' . $thread['lastposttime']), 'post_username' => prepare_utf8_string(strip_tags($thread['lastpost_username'])));
if ($avatarurl != '') {
$tmp['avatarurl'] = $avatarurl;
}
if ($thread['attach']) {
$tmp['attach'] = true;
}
if ($thread['pollid']) {
$tmp['poll'] = true;
}
$thread_data[] = $tmp;
}
$db->free_result($threads);
unset($threadids);
} else {
$totalallthreads = 0;
}
$out = array('threads' => $thread_data, 'total_threads' => $totalallthreads);
return $out;
}
示例2: eval
eval('$searchbits .= "' . fetch_template('search_results_postbit') . '";');
}
if ($show['popups'] and $show['inlinemod']) {
eval('$threadadmin_imod_menu = "' . fetch_template('threadadmin_imod_menu_post') . '";');
}
} else {
$show['forumlink'] = true;
// threadbit_deleted conditionals
$show['threadtitle'] = true;
$show['viewthread'] = true;
$show['managethread'] = true;
foreach ($itemids as $thread) {
// add highlight words
$thread['highlight'] =& $highlightwords;
// get info from thread
$thread = process_thread_array($thread, $lastread["{$thread['forumid']}"]);
// Inline Moderation
$show['disabled'] = ($movethread["{$thread['threadid']}"] or $deletethread["{$thread['threadid']}"] or $approvethread["{$thread['threadid']}"] or $openthread["{$thread['threadid']}"]) ? false : true;
$itemcount++;
exec_switch_bg();
($hook = vBulletinHook::fetch_hook('search_results_threadbit')) ? eval($hook) : false;
if (($display['options']['action'] == 'getdaily' or $display['options']['action'] == 'getnew') and $search['sortby'] == 'lastpost' and !$oldposts and $thread['lastpost'] <= $vbulletin->userinfo['lastvisit'] and $vbulletin->userinfo['lastvisit'] != 0) {
$oldposts = true;
if ($display['options']['action'] == 'getnew') {
$show['unread_posts'] = true;
}
eval('$searchbits .= "' . fetch_template('threadbit_lastvisit') . '";');
}
$forumperms = fetch_permissions($thread['forumid']);
if ($thread['visible'] == 2) {
$thread['deletedcount']++;
示例3: preg_replace
$post['posticonpath'] = '';
$post['posticontitle'] = '';
}
$post['pagetext'] = preg_replace('#\\[quote(=("|"|\'|)??.*\\2)?\\](((?>[^\\[]*?|(?R)|.))*)\\[/quote\\]#siU', '', $post['pagetext']);
// get first 200 chars of page text
$post['pagetext'] = htmlspecialchars_uni(fetch_censored_text(trim(fetch_trimmed_title(strip_bbcode($post['pagetext'], 1), 200))));
// get post title
if ($post['posttitle'] == '') {
$post['posttitle'] = fetch_trimmed_title($post['pagetext'], 50);
} else {
$post['posttitle'] = fetch_censored_text($post['posttitle']);
}
// format post text
$post['pagetext'] = nl2br($post['pagetext']);
// get info from post
$post = process_thread_array($post, $lastread["{$post['forumid']}"], $post['allowicons']);
$show['managepost'] = (can_moderate($post['forumid'], 'candeleteposts') or can_moderate($post['forumid'], 'canremoveposts')) ? true : false;
$show['approvepost'] = can_moderate($post['forumid'], 'canmoderateposts') ? true : false;
$show['managethread'] = can_moderate($post['forumid'], 'canmanagethreads') ? true : false;
$show['disabled'] = ($show['managethread'] or $show['managepost'] or $show['approvepost']) ? false : true;
$show['moderated'] = (!$post['visible'] or !$post['thread_visible'] and $post['postid'] == $post['firstpostid']) ? true : false;
if ($post['pdel_userid']) {
$post['del_username'] =& $post['pdel_username'];
$post['del_userid'] =& $post['pdel_userid'];
$post['del_reason'] = fetch_censored_text($post['pdel_reason']);
$show['deleted'] = true;
} else {
if ($post['tdel_userid']) {
$post['del_username'] =& $post['tdel_username'];
$post['del_userid'] =& $post['tdel_userid'];
$post['del_reason'] = fetch_censored_text($post['tdel_reason']);
示例4: implode
}
DEVDEBUG('ignored users: ' . implode(', ', array_keys($ignore)));
}
$show['threads'] = true;
$threadbits = '';
$threadbits_sticky = '';
$counter = 0;
$toread = 0;
while ($thread = $db->fetch_array($threads))
{ // AND $counter++ < $perpage)
// build thread data
$thread = process_thread_array($thread, $lastread, $foruminfo['allowicons']);
$realthreadid = $thread['realthreadid'];
if ($thread['sticky'])
{
$threadbit =& $threadbits_sticky;
}
else
{
$threadbit =& $threadbits;
}
($hook = vBulletinHook::fetch_hook('threadbit_display')) ? eval($hook) : false;
// Soft Deleted Thread
if ($thread['visible'] == 2)
示例5: get_post_template_array
public function get_post_template_array($current_user, $summary_length, $highlight = "")
{
global $vbphrase, $show;
require_once DIR . '/includes/functions_forumdisplay.php';
/*
Post is not a good name for this array, however its what it used to be called
(when it wasn't such a bad name) and changing it makes it certain that a lot of
hooks are going to break.
*/
$post = array();
$thread = $this->get_thread();
$forum = $thread->get_forum();
if ($this->is_post_new($current_user)) {
$post['post_statusicon'] = 'new';
$post['post_statustitle'] = $vbphrase['unread'];
} else {
$post['post_statusicon'] = 'old';
$post['post_statustitle'] = $vbphrase['old'];
}
$post['postid'] = $this->get_field('postid');
$post['userid'] = $this->get_field('userid');
$post['postdateline'] = $this->get_field('dateline');
$post['posttitle'] = $this->get_display_title();
$post['pagetext'] = nl2br($this->get_summary($summary_length));
$post['visible'] = $this->get_field('visible');
$post['attach'] = $this->get_field('attach');
$post['highlight'] = $highlight;
$post['username'] = $this->get_field('userid') == 0 ? $this->get_field('username') : $this->get_user()->get_field('username');
$post['threadid'] = $thread->get_field('threadid');
$post['threadtitle'] = $thread->get_field('title');
$post['threadiconid'] = $thread->get_field('iconid');
$post['replycount'] = $thread->get_field('replycount');
$post['views'] = $thread->get_field('views') > 0 ? $thread->get_field('views') : $thread->get_field('replycount') + 1;
$post['firstpostid'] = $thread->get_field('firstpostid');
$post['prefixid'] = $thread->get_field('prefixid');
$post['taglist'] = $thread->get_field('taglist');
$post['pollid'] = $thread->get_field('pollid');
$post['sticky'] = $thread->get_field('sticky');
$post['open'] = $thread->get_field('open');
$post['lastpost'] = $thread->get_field('lastpost');
$post['forumid'] = $thread->get_field('forumid');
$post['thread_visible'] = $thread->get_field('visible');
$post['forumtitle'] = $forum->get_field('title');
$post['posticonid'] = $this->get_field('iconid');
$post['allowicons'] = $forum->allow_icons();
$post['posticonpath'] = $this->get_icon_path();
$post['posticontitle'] = $this->get_icon_title();
$post['posticon'] = $post['allowicons'] and $post['posticonpath'];
$lastread = $forum->get_last_read_by_current_user($current_user);
$show['deleted'] = false;
if ($current_user->isModerator()) {
$log = $this->get_deletion_log_array();
if ($log['userid']) {
$post['del_phrase'] = $vbphrase['message_deleted_by_x'];
} else {
$log = $thread->get_deletion_log_array();
if (!$log['userid']) {
$post['del_phrase'] = $vbphrase['thread_deleted_by_x'];
$log = false;
}
}
if ($log) {
$post['del_username'] = $log['username'];
$post['del_userid'] = $log['userid'];
$post['del_reason'] = $log['reason'];
$show['deleted'] = true;
}
}
$post['prefixid'] = $thread->get_field('prefixid');
if ($post['prefixid']) {
$post['prefix_plain_html'] = htmlspecialchars_uni($vbphrase["prefix_{$post['prefixid']}_title_plain"]);
$post['prefix_rich'] = $vbphrase["prefix_{$post['prefixid']}_title_rich"];
} else {
$post['prefix_plain_html'] = '';
$post['prefix_rich'] = '';
}
$show['disabled'] = !$this->can_inline_mod($current_user);
$post = process_thread_array($post, $lastread, $post['allowicons']);
return $post;
}
示例6: do_showresults
function do_showresults($searchid, $pagenumber = 1, $perpage = 25)
{
global $vbulletin, $db, $show, $vbphrase, $current_user, $show;
$vbulletin->options['threadpreview'] = FR_PREVIEW_LEN;
$vbulletin->input->clean_array_gpc('r', array('previewtype' => TYPE_INT));
$previewtype = $vbulletin->GPC['previewtype'];
if (!$previewtype) {
$previewtype = 1;
}
$bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
// Get exclude IDs
$exclude_ids = @explode(',', $vbulletin->options['forumrunner_exclude']);
if (in_array('-1', $exclude_ids)) {
$exclude_ids = array();
}
if ($results = vB_Search_Results::create_from_searchid($current_user, $searchid)) {
$pages = $results->get_page($pagenumber, $perpage, 10000);
} else {
$pages = array();
}
if (count($pages) == 0) {
$threads[]['error'] = strip_tags(fetch_error('searchnoresults', ''));
return array('threads' => $threads, 'total_threads' => count($threads));
}
$thread_data = array();
$skipped = 0;
foreach ($pages as $item) {
switch (get_class($item)) {
case 'vBForum_Search_Result_Thread':
$thread = $item->get_thread();
$foruminfo = fetch_foruminfo($thread->get_field('forumid'));
$parentlist = explode(',', substr($foruminfo['parentlist'], 0, -3));
$skip = false;
foreach ($parentlist as $parent_id) {
if (in_array($parent_id, $exclude_ids)) {
$skip = true;
}
}
if ($thread->get_field('visible') == 2) {
$skip = true;
}
if ($skip) {
$skipped++;
continue;
}
$lastread = $thread->get_forum()->get_last_read_by_current_user($current_user);
$legacy_thread = process_thread_array($thread->get_record(), $lastread);
$date = vbdate($vbulletin->options['dateformat'], $thread->get_field('lastpost'));
$time = vbdate($vbulletin->options['timeformat'], $thread->get_field('lastpost'));
$previewinfo = $db->query_first_slave("\n\t\tSELECT *\n\t\tFROM " . TABLE_PREFIX . "post\n\t\tWHERE postid = " . $thread->get_field($previewtype == 1 ? 'firstpostid' : 'lastpostid') . "\n\t ");
$preview = '';
if (method_exists($bbcode_parser, 'get_preview')) {
$preview = $bbcode_parser->get_preview(fetch_censored_text($previewinfo['pagetext']), 200);
} else {
// vB4 prior to vB4.0.4 did not have get_preview()
list($text, $nuked_quotes, $images) = parse_post($previewinfo['pagetext'], true, array());
$preview = preview_chop(fetch_censored_text($nuked_quotes), 200);
}
$avatarurl = '';
if ($previewinfo['userid'] > 0) {
$userinfoavatar = fetch_userinfo($previewinfo['userid'], FETCH_USERINFO_AVATAR);
fetch_avatar_from_userinfo($userinfoavatar, true, false);
if ($userinfoavatar['avatarurl'] != '') {
$avatarurl = process_avatarurl($userinfoavatar['avatarurl']);
}
unset($userinfoavatar);
}
$tmp = array('thread_id' => $thread->get_field('threadid'), 'new_posts' => $show['gotonewpost'], 'forum_id' => $thread->get_field('forumid'), 'total_posts' => $thread->get_field('replycount'), 'forum_title' => prepare_utf8_string(strip_tags($foruminfo['title'])), 'thread_title' => prepare_utf8_string(strip_tags($thread->get_field('title'))), 'thread_preview' => prepare_utf8_string(preview_chop(strip_tags(strip_bbcode(html_entity_decode($preview))), FR_PREVIEW_LEN)), 'post_userid' => $previewinfo['userid'], 'post_lastposttime' => prepare_utf8_string(date_trunc($date) . ' ' . $time), 'post_username' => prepare_utf8_string(strip_tags($previewinfo['username'])));
if ($avatarurl != '') {
$tmp['avatarurl'] = $avatarurl;
}
if ($thread->get_field('prefixid')) {
$prefixid = $thread->get_field('prefixid');
$tmp['prefix'] = prepare_utf8_string(strip_tags($vbphrase["prefix_{$prefixid}_title_plain"]));
}
if ($thread->get_field('attach')) {
$tmp['attach'] = true;
}
if ($thread->get_field('pollid')) {
$tmp['poll'] = true;
}
$thread_data[] = $tmp;
break;
case 'vBForum_Search_Result_Post':
$post = $item->get_post();
$thread = $post->get_thread();
$foruminfo = fetch_foruminfo($thread->get_field('forumid'));
$parentlist = explode(',', substr($foruminfo['parentlist'], 0, -3));
$skip = false;
foreach ($parentlist as $parent_id) {
if (in_array($parent_id, $exclude_ids)) {
$skip = true;
}
}
if ($post->get_field('visible') == 2) {
$skip = true;
}
if ($skip) {
$skipped++;
continue;
//.........这里部分代码省略.........
示例7: populateViewContent
/**
* Populates a view with the expected info from a content item.
*
* @param vB_View $view
* @param int $viewtype
*/
protected function populateViewContent(vB_View $view, $viewtype = self::VIEW_PAGE)
{
parent::populateViewContent($view, $viewtype);
$view->node = $this->content->getNodeId();
$view->type = new vB_Phrase('global', 'content');
if (vB::$vbulletin->userinfo['userid'])
{
$view->published = $this->content->isPublished();
}
else
{
$view->published = true;
}
$view->page_url = $this->getPageUrl();
//Let's pass an url for editing.
$view->edit_url = $this->getEditUrl();
if ($date = $this->content->getPublishDate())
{
$view->publishdate = $date;
}
$view->publish_phrase = new vB_Phrase('vbcms', 'page_not_published');
// Get comments
if ((self::VIEW_PAGE == $viewtype) AND (vB::$vbulletin->options['vbcmsforumid'] > 0) AND $this->content->isPublished() AND !$this->isSection())
{
try
{
$thread = $this->getAssociatedThread();
$view->show_comments = ($thread AND $thread->can_view(new vB_Legacy_CurrentUser()));
if ($view->show_comments)
{
$postids = $this->getCommentPosts($thread);
require_once DIR . '/includes/functions_forumdisplay.php' ;
$view->thread = process_thread_array($thread->get_record());
}
}
catch (Exception $e)
{
if (vB::$vbulletin->config['debug'])
{
throw ($e);
}
}
}
// Check if the user has voted
$check = true;
if (vB::$vbulletin->userinfo['userid'])
{
$row = vB::$db->query_first("SELECT vote FROM " . TABLE_PREFIX . "cms_rate WHERE userid = " . vB::$vbulletin->userinfo['userid'] . " AND nodeid = " . $view->node);
if ($row[0])
{
$check = false;
}
}
$rated = intval(fetch_bbarray_cookie('cms_rate', $view->node));
// voted already
if ($row[0] OR $rated)
{
$rate_index = $rated;
if ($row[0])
{
$rate_index = $row[0];
}
$view->voteselected["$rate_index"] = 'selected="selected"';
$view->votechecked["$rate_index"] = 'checked="checked"';
}
else
{
$view->voteselected[0] = 'selected="selected"';
$view->votechecked[0] = 'checked="checked"';
}
$view->showratenode =
(
(
$check
OR
(!$rated AND !vB::$vbulletin->userinfo['userid'])
)
OR
vB::$vbulletin->options['votechange']
);
// Get ratings
if ($this->content->getRatingNum() >= vB::$vbulletin->options['showvotes'])
//.........这里部分代码省略.........
示例8: DEVDEBUG
if (!$buddy["{$ignoreuserid}"]) {
$ignore["{$ignoreuserid}"] = 1;
}
}
}
DEVDEBUG('ignored users: ' . implode(', ', array_keys($ignore)));
}
$show['threads'] = true;
$threadbits = '';
$threadbits_sticky = '';
$counter = 0;
$toread = 0;
while ($thread = $db->fetch_array($threads)) {
// AND $counter++ < $perpage)
// build thread data
$thread = process_thread_array($thread, $lastread, $foruminfo['allowicons'], $fetchavatar);
$realthreadid = $thread['realthreadid'];
if ($thread['sticky']) {
$threadbit =& $threadbits_sticky;
} else {
$threadbit =& $threadbits;
}
($hook = vBulletinHook::fetch_hook('threadbit_display')) ? eval($hook) : false;
// Soft Deleted Thread
if ($thread['visible'] == 2) {
$thread['deletedcount']++;
$show['threadtitle'] = (can_moderate($forumid) or $vbulletin->userinfo['userid'] != 0 and $vbulletin->userinfo['userid'] == $thread['postuserid']) ? true : false;
$show['deletereason'] = !empty($thread['del_reason']) ? true : false;
$show['viewthread'] = can_moderate($forumid) ? true : false;
$show['managethread'] = (can_moderate($forumid, 'candeleteposts') or can_moderate($forumid, 'canremoveposts')) ? true : false;
$show['moderated'] = ($thread['hiddencount'] > 0 and can_moderate($forumid, 'canmoderateposts')) ? true : false;
示例9: render
public function render($current_user, $criteria, $template_name = '')
{
require_once(DIR . '/includes/functions_forumdisplay.php');
require_once(DIR . '/includes/functions_user.php');
global $vbulletin;
global $show;
if (!strlen($template_name)) {
$template_name = 'search_threadbit';
}
$show['forumlink'] = true;
// threadbit_deleted conditionals
$show['threadtitle'] = true;
$show['viewthread'] = true;
$show['managethread'] = true;
//thread isn't a great name for this, but it stays consistant with
//previous use and what will be expected in the hook.
$thread = $this->thread->get_record();
$this->set_replydata($thread['threadid'], $current_user);
// get info from thread
$thread['postid'] = $thread['threadid'];
$thread['threadtitle'] = $thread['title'];
$thread['threadiconid'] = $thread['iconid'];
$thread['postdateline'] = $thread['lastpost'];
$thread['threadtitle'] = $thread['title'];
$thread['issubscribed'] = $this->thread->is_subscribed($current_user);
$thread['threadread'] = $this->thread->get_lastread($current_user);
/*
This used to be precalculated by forum, but it doesn't look expensive enough to want to
bother with that. If that turns out to be wrong we'll need to do some kind of
caching.
*/
$forum = $this->thread->get_forum();
if (!$current_user->hasForumPermission($forum->get_field('forumid'), 'canviewthreads'))
{
unset($thread['preview']);
}
//set the correct status
if ($this->replydata['mylastpost'] > 0)
{
$post_statusicon[] = 'dot';
}
if (!$thread['open'])
{
$post_statusicon[] = 'lock';
}
if ($this->replydata['lastread'] < $thread['lastpost'])
{
$post_statusicon[] = 'new';
}
if (! count($post_statusicon))
{
$post_statusicon[] = 'old';
}
$post_statusicon = implode('_', $post_statusicon);
$show['deletereason'] = false;
if ($thread['visible'] == 2)
{
$log = $this->thread->get_deletion_log_array();
$thread['del_username'] = $log['username'];
$thread['del_userid'] = $log['userid'];
$thread['del_reason'] = $log['reason'];
$thread['deletedcount']++;
$show['deletereason'] = !empty($thread['del_reason']);
}
else if ($thread['visible'] == 0)
{
$thread['hiddencount']++;
}
$thread['highlight'] = $criteria->get_highlights();
$show['moderated'] = ($thread['hiddencount'] > 0 AND
$current_user->canModerateForum($thread['forumid'], 'canmoderateposts'));
$show['deletedthread'] = ($thread['deletedcount'] > 0 AND
($current_user->canModerateForum($thread['forumid']) OR
$current_user->hasForumPermission($thread['forumid'], 'canseedelnotice')));
$show['disabled'] = !$this->can_inline_mod($current_user);
$lastread = $forum->get_last_read_by_current_user($current_user);
$thread = process_thread_array($thread, $lastread);
($hook = vBulletinHook::fetch_hook('search_results_threadbit')) ? eval($hook) : false;
//.........这里部分代码省略.........
示例10: do_get_forum
//.........这里部分代码省略.........
$limitlower++;
}
// check to see if there are any threads to display. If there are, do so, otherwise, show message
if ($vbulletin->options['threadpreview'] > 0) {
// Get Buddy List
$buddy = array();
if (trim($vbulletin->userinfo['buddylist'])) {
$buddylist = preg_split('/( )+/', trim($vbulletin->userinfo['buddylist']), -1, PREG_SPLIT_NO_EMPTY);
foreach ($buddylist as $buddyuserid) {
$buddy["{$buddyuserid}"] = 1;
}
}
DEVDEBUG('buddies: ' . implode(', ', array_keys($buddy)));
// Get Ignore Users
$ignore = array();
if (trim($vbulletin->userinfo['ignorelist'])) {
$ignorelist = preg_split('/( )+/', trim($vbulletin->userinfo['ignorelist']), -1, PREG_SPLIT_NO_EMPTY);
foreach ($ignorelist as $ignoreuserid) {
if (!$buddy["{$ignoreuserid}"]) {
$ignore["{$ignoreuserid}"] = 1;
}
}
}
DEVDEBUG('ignored users: ' . implode(', ', array_keys($ignore)));
}
$show['threads'] = true;
$threadbits = '';
$threadbits_sticky = '';
$counter = 0;
$toread = 0;
while ($thread = $db->fetch_array($threads)) {
// AND $counter++ < $perpage)
// build thread data
$thread = process_thread_array($thread, $lastread, $foruminfo['allowicons']);
$realthreadid = $thread['realthreadid'];
if ($thread['sticky']) {
$threadbit =& $threadbits_sticky;
} else {
$threadbit =& $threadbits;
}
// Soft Deleted Thread
if ($thread['visible'] == 2) {
$thread['deletedcount']++;
$show['threadtitle'] = (can_moderate($forumid) or $vbulletin->userinfo['userid'] != 0 and $vbulletin->userinfo['userid'] == $thread['postuserid']) ? true : false;
$show['deletereason'] = !empty($thread['del_reason']) ? true : false;
$show['viewthread'] = can_moderate($forumid) ? true : false;
$show['managethread'] = (can_moderate($forumid, 'candeleteposts') or can_moderate($forumid, 'canremoveposts')) ? true : false;
$show['moderated'] = ($thread['hiddencount'] > 0 and can_moderate($forumid, 'canmoderateposts')) ? true : false;
$show['deletedthread'] = $canseedelnotice;
} else {
if (!$thread['visible']) {
$thread['hiddencount']++;
}
$show['moderated'] = ($thread['hiddencount'] > 0 and can_moderate($forumid, 'canmoderateposts')) ? true : false;
$show['deletedthread'] = ($thread['deletedcount'] > 0 and $canseedelnotice) ? true : false;
$pageinfo_lastpage = array();
if ($show['pagenavmore']) {
$pageinfo_lastpage['page'] = $thread['totalpages'];
}
$pageinfo_newpost = array('goto' => 'newpost');
$pageinfo_lastpost = array('p' => $thread['lastpostid']);
// prepare the member action drop-down menu
$memberaction_dropdown = construct_memberaction_dropdown(fetch_lastposter_userinfo($thread));
}
// FRNR Start
$avatarurl = '';
示例11: fetch_permissions
$show['notificationtype'] = true;
$show['threadratings'] = true;
$show['threadrating'] = true;
while ($thread = $db->fetch_array($threads))
{
// unset the thread preview if it can't be seen
$forumperms = fetch_permissions($thread['forumid']);
if ($vbulletin->options['threadpreview'] > 0 AND !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']))
{
$thread['preview'] = '';
}
$threadid = $thread['threadid'];
// build thread data
$thread = process_thread_array($thread, $lastread["$thread[forumid]"]);
switch ($emailupdate["$thread[threadid]"])
{
case 0:
$thread['notification'] = $vbphrase['none'];
break;
case 1:
$thread['notification'] = $vbphrase['instant'];
break;
case 2:
$thread['notification'] = $vbphrase['daily'];
break;
case 3:
$thread['notification'] = $vbphrase['weekly'];
break;
示例12: render
//.........这里部分代码省略.........
if (!$thread->get_field('open')) {
$post_statusicon[] = 'lock';
}
if ($this->replydata['lastread'] < $thread->get_field('lastpost')) {
$post_statusicon[] = 'new';
}
if (!count($post_statusicon)) {
$post_statusicon[] = 'old';
}
$post_statusicon = implode('_', $post_statusicon);
$post['postid'] = $this->post->get_field('postid');
$post['postdateline'] = $this->post->get_field('dateline');
$post['posttitle'] = vB_Search_Searchtools::stripHtmlTags(htmlspecialchars_decode($this->post->get_display_title()));
if (empty($post['posttitle'])) {
$post['posttitle'] = $vbphrase['view_post'];
}
$post['visible'] = $this->post->get_field('visible');
$post['attach'] = $this->post->get_field('attach');
$post['highlight'] = $criteria->get_highlights();
$post['userid'] = $this->post->get_field('userid');
$post['username'] = $this->post->get_field('username');
$post['threadid'] = $thread->get_field('threadid');
$post['threadtitle'] = $thread->get_field('title');
$post['threadiconid'] = $thread->get_field('iconid');
$post['replycount'] = $thread->get_field('replycount');
$post['views'] = $thread->get_field('views') > 0 ? $thread->get_field('views') : $thread->get_field('replycount') + 1;
$post['firstpostid'] = $thread->get_field('firstpostid');
$post['prefixid'] = $thread->get_field('prefixid');
$post['taglist'] = $thread->get_field('taglist');
$post['pollid'] = $thread->get_field('pollid');
$post['sticky'] = $thread->get_field('sticky');
$post['open'] = $thread->get_field('open');
$post['lastpost'] = $thread->get_field('lastpost');
$post['forumid'] = $thread->get_field('forumid');
$post['thread_visible'] = $thread->get_field('visible');
$post['forumtitle'] = $forum->get_field('title');
$post['posticonid'] = $this->post->get_field('iconid');
$post['allowicons'] = $forum->allow_icons();
$post['posticonpath'] = $this->post->get_icon_path();
$post['posticontitle'] = $this->post->get_icon_title();
$post['posticon'] = $post['allowicons'] and $post['posticonpath'];
$lastread = $forum->get_last_read_by_current_user($current_user);
if ($current_user->hasForumPermission($forum->get_field('forumid'), 'canviewthreads')) {
if (defined('VB_API') and VB_API === true) {
$post['pagetext'] = $this->post->get_field('pagetext');
$post['message_plain'] = build_message_plain($post['pagetext']);
} else {
$post['pagetext'] = nl2br($this->post->get_summary(200));
}
}
$show['deleted'] = false;
if ($current_user->isModerator()) {
$log = $this->post->get_deletion_log_array();
if ($log['userid']) {
$post['del_phrase'] = $vbphrase['message_deleted_by_x'];
} else {
$log = $thread->get_deletion_log_array();
if (!$log['userid']) {
$post['del_phrase'] = $vbphrase['thread_deleted_by_x'];
$log = false;
}
}
if ($log) {
$post['del_username'] = $log['username'];
$post['del_userid'] = $log['userid'];
$post['del_reason'] = $log['reason'];
$show['deleted'] = true;
}
}
$post['prefixid'] = $thread->get_field('prefixid');
if ($post['prefixid']) {
$post['prefix_plain_html'] = htmlspecialchars_uni($vbphrase["prefix_{$post['prefixid']}_title_plain"]);
$post['prefix_rich'] = $vbphrase["prefix_{$post['prefixid']}_title_rich"];
} else {
$post['prefix_plain_html'] = '';
$post['prefix_rich'] = '';
}
$show['disabled'] = !$this->can_inline_mod($current_user);
$postuser = $this->post->get_record();
$post = process_thread_array($post, $lastread, $post['allowicons']);
($hook = vBulletinHook::fetch_hook('search_results_postbit')) ? eval($hook) : false;
$template = vB_Template::create($template_name);
$template->register('post', $post);
$template->register('userinfo', $postuser);
$template->register('threadinfo', $thread->get_record());
$template->register('dateline', $this->post->get_field('dateline'));
if ($vbulletin->options['avatarenabled']) {
$template->register('avatar', fetch_avatar_from_record($this->post->get_record(), true));
}
$pageinfo_thread = array();
$pageinfo_post = array('p' => $post['postid']);
if (!empty($post['highlight'])) {
$pageinfo_post['highlight'] = urlencode(implode(' ', $post['highlight']));
$pageinfo_thread['highlight'] = urlencode(implode(' ', $post['highlight']));
}
$template->register('pageinfo_post', $pageinfo_post);
$template->register('pageinfo_thread', $pageinfo_thread);
$template->register('post_statusicon', $post_statusicon);
return $template->render();
}
示例13: fetch_trimmed_title
// get post title
if ($post['posttitle'] == '')
{
$post['posttitle'] = fetch_trimmed_title($post['pagetext'], 50);
}
else
{
$post['posttitle'] = fetch_censored_text($post['posttitle']);
}
// format post text
$post['pagetext'] = nl2br($post['pagetext']);
// get info from post
$post = process_thread_array($post, $lastread["$post[forumid]"], $post['allowicons']);
$show['managepost'] = (can_moderate($post['forumid'], 'candeleteposts') OR can_moderate($post['forumid'], 'canremoveposts')) ? true : false;
$show['approvepost'] = (can_moderate($post['forumid'], 'canmoderateposts')) ? true : false;
$show['managethread'] = (can_moderate($post['forumid'], 'canmanagethreads')) ? true : false;
$show['disabled'] = ($show['managethread'] OR $show['managepost'] OR $show['approvepost']) ? false : true;
$show['moderated'] = (!$post['visible'] OR (!$post['thread_visible'] AND $post['postid'] == $post['firstpostid'])) ? true : false;
$show['spam'] = ($show['moderated'] AND $post['spamlog_postid']) ? true : false;
if ($post['pdel_userid'])
{
$post['del_username'] =& $post['pdel_username'];
$post['del_userid'] =& $post['pdel_userid'];
$post['del_reason'] = fetch_censored_text($post['pdel_reason']);
$post['del_phrase'] = 'message_deleted_by_x';
示例14: render
public function render($current_user, $criteria, $template_name = '')
{
require_once DIR . '/includes/functions_forumdisplay.php';
require_once DIR . '/includes/functions_user.php';
global $vbulletin, $show;
if (!strlen($template_name)) {
$template_name = 'search_threadbit';
}
$show['forumlink'] = true;
// threadbit_deleted conditionals
$show['threadtitle'] = true;
$show['viewthread'] = true;
$show['managethread'] = true;
($hook = vBulletinHook::fetch_hook('search_results_thread_start')) ? eval($hook) : false;
//thread isn't a great name for this, but it stays consistant with
//previous use and what will be expected in the hook.
$thread = $this->thread->get_record();
$this->set_replydata($thread['threadid'], $current_user);
// get info from thread
$thread['postid'] = $thread['threadid'];
$thread['threadtitle'] = $thread['title'];
$thread['threadiconid'] = $thread['iconid'];
$thread['postdateline'] = $thread['lastpost'];
$thread['issubscribed'] = $this->thread->is_subscribed($current_user);
$thread['threadread'] = $this->thread->get_lastread($current_user);
/*
This used to be precalculated by forum, but it doesn't look expensive enough to want to
bother with that. If that turns out to be wrong we'll need to do some kind of
caching.
*/
$forum = $this->thread->get_forum();
if (!$current_user->hasForumPermission($forum->get_field('forumid'), 'canviewthreads')) {
unset($thread['preview']);
}
//set the correct status
if ($this->replydata['mylastpost'] > 0) {
$post_statusicon[] = 'dot';
}
if (!$thread['open']) {
$post_statusicon[] = 'lock';
}
if ($this->replydata['lastread'] < $thread['lastpost']) {
$post_statusicon[] = 'new';
}
if (!count($post_statusicon)) {
$post_statusicon[] = 'old';
}
$post_statusicon = implode('_', $post_statusicon);
$show['deletereason'] = false;
if ($thread['visible'] == 2) {
$log = $this->thread->get_deletion_log_array();
$thread['del_username'] = $log['username'];
$thread['del_userid'] = $log['userid'];
$thread['del_reason'] = $log['reason'];
$thread['deletedcount']++;
$show['deletereason'] = !empty($thread['del_reason']);
} else {
if ($thread['visible'] == 0) {
$thread['hiddencount']++;
}
}
$thread['highlight'] = $criteria->get_highlights();
$show['moderated'] = ($thread['hiddencount'] > 0 and $current_user->canModerateForum($thread['forumid'], 'canmoderateposts'));
$show['deletedthread'] = ($thread['deletedcount'] > 0 and ($current_user->canModerateForum($thread['forumid']) or $current_user->hasForumPermission($thread['forumid'], 'canseedelnotice')));
$show['disabled'] = !$this->can_inline_mod($current_user);
$lastread = $forum->get_last_read_by_current_user($current_user);
/* This uses $dotthreads which is built by calling fetch_dot_threads_array() in search/type/thread.php
The data is very similar to data we now have, and at some point this call could probably be eliminated. */
$thread = process_thread_array($thread, $lastread);
($hook = vBulletinHook::fetch_hook('search_results_threadbit')) ? eval($hook) : false;
$pageinfo = $pageinfo_lastpost = $pageinfo_firstpost = $pageinfo_lastpage = array();
if ($show['pagenavmore']) {
$pageinfo_lastpage['page'] = $thread['totalpages'];
}
$pageinfo_lastpost['p'] = $thread['lastpostid'];
$pageinfo_newpost['goto'] = 'newpost';
$pageinfo_thread = array();
if (!empty($thread['highlight'])) {
$pageinfo_thread['highlight'] = urlencode(implode(' ', $thread['highlight']));
$pageinfo_newpost['highlight'] = urlencode(implode(' ', $thread['highlight']));
$pageinfo_lastpost['highlight'] = urlencode(implode(' ', $thread['highlight']));
$pageinfo_firstpost['highlight'] = urlencode(implode(' ', $thread['highlight']));
}
// Work out if unread below notification needed
if ($criteria->get_searchtype() == vB_Search_Core::SEARCH_NEW and $criteria->get_sort() == 'groupdateline' and $show['below_unread'] == 0 and $thread['lastpost'] < $vbulletin->userinfo['lastvisit']) {
$show['below_unread'] = $criteria->get_search_term('searchdate') == 'lastvisit' ? 1 : 2;
}
if ($vbulletin->options['avatarenabled']) {
$thread['lastpost_avatar'] = fetch_avatar_from_record($thread, true);
$thread['firstpost_avatar'] = fetch_avatar_from_record($thread, true, 'postuserid', 'first_');
}
($hook = vBulletinHook::fetch_hook('search_results_thread_process')) ? eval($hook) : false;
$template = vB_Template::create($template_name);
$template->register('post_statusicon', $post_statusicon);
$template->register('pageinfo_firstpost', $pageinfo_firstpost);
$template->register('pageinfo_lastpost', $pageinfo_lastpost);
$template->register('pageinfo_lastpage', $pageinfo_lastpage);
$template->register('pageinfo_newpost', $pageinfo_newpost);
$template->register('pageinfo', $pageinfo_thread);
$template->register('dateformat', $vbulletin->options['dateformat']);
//.........这里部分代码省略.........