/** * Returns the HTML for multi-page navigation without a fully know result set * * This handles multipage navigation when we don't have a count for the * resultset. The follow things must be true for this logic to work correctly * * 1) $confirmedcount is less than or equal to the total number of results * 2) if $confirmedcount is not the total number of results, it must be at * least equal to the "count" of the last result displayed in the window. * * These assumptions allow us to display the window links knowing that they will * be valid without knowing the full extent of the result set. * * @see fetch_seo_url * @param integer Page number being displayed * @param integer Number of pages to show before and after current page * @param integer Number of items to be displayed per page * @param integer Number of items confirmed in the results * @param string Base address for links eg: showthread.php?t=99{&page=4} * @param string Ending portion of address for links * @param string The base link for seo urls (if this is used address will not be) * @param array Additonal object info for generating the seo urls * @param array Additonal page info for generating the seo urls * * @todo is it correct to include the pagenav hooks here? Do we need other hooks * to replace them? * @return string Page navigation HTML */ function construct_window_page_nav ( $pagenumber, $window, $perpage, $confirmedcount, $address, $address2 = '', $anchor = '', $seolink = '', $objectinfo = '', $pageinfo = '' ) { global $vbulletin, $vbphrase, $show; $curpage = 0; $pagenavarr = array(); $firstlink = ''; $prevlink = ''; $lastlink = ''; $nextlink = ''; if ($confirmedcount <= $perpage) { $show['pagenav'] = false; return ''; } $show['pagenav'] = true; $confirmedpages = ceil($confirmedcount / $perpage); //window style page navs don't permit "jump to end" logic $show['jumppage'] = false; $show['last'] = false; $show['prev'] = false; $show['next'] = false; $show['first'] = false; $bits = parse_url($address); $jumpaddress = $bits['path']; $querybits = explode('&', $bits['query'] . $address2); $hiddenfields = ''; if (!empty($querybits)) { foreach ($querybits AS $bit) { if ($bit) { $bitinfo = explode('=', $bit); $hiddenfields .= "<input type=\"hidden\" name=\"$bitinfo[0]\" value=\"$bitinfo[1]\" />"; } } } $hiddenfields .= "<input type=\"hidden\" name=\"s\" value=\"" . vB::$vbulletin->session->fetch_sessionhash() . "\" /> <input type=\"hidden\" name=\"securitytoken\" value=\"" . vB::$vbulletin->userinfo['securitytoken'] . "\" />"; if ($seolink) { $show['pagelinks'] = false; $use_qmark = 0; } else { $firstaddress = $prevaddress = $nextaddress = $lastaddress = $address; $show['pagelinks'] = true; $use_qmark = strpos($address, '?') ? 0 : 1; } if ($pagenumber > 1) { $prevpage = $pagenumber - 1; $prevnumbers = fetch_start_end_total_array($prevpage, $perpage, $confirmedcount); if ($seolink) { $pageinfo['page'] = $prevpage; $prevaddress = fetch_seo_url($seolink, $objectinfo, $pageinfo); } $show['prev'] = true; } if ($pagenumber < $confirmedpages) { $nextpage = $pagenumber + 1; if ($seolink) { $pageinfo['page'] = $nextpage; $nextaddress = fetch_seo_url($seolink, $objectinfo, $pageinfo); } $nextnumbers = fetch_start_end_total_array($nextpage, $perpage, $confirmedcount); $show['next'] = true; } if (($pagenumber - $window) > 1) { $firstnumbers = fetch_start_end_total_array(1, $perpage, $confirmedcount); if ($seolink) { unset($pageinfo['page']); $firstaddress = fetch_seo_url($seolink, $objectinfo, $pageinfo); } $show['first'] = true; } for ($curpage = ($pagenumber - $window); $curpage <= $pagenumber+$window AND $curpage <= $confirmedpages; $curpage++) { if ($curpage < 1) { continue; } else if ($curpage == $pagenumber) { $numbers = fetch_start_end_total_array($curpage, $perpage, $confirmedcount); $templater = vB_Template::create('pagenav_curpage_window'); $templater->register('curpage', $curpage); $templater->register('numbers', $numbers); $templater->register('use_qmark', $use_qmark); $templater->register('total', $total); $pagenavarr[] = $templater->render(); } else { if ($seolink) { $pageinfo['page'] = $curpage; $address = fetch_seo_url($seolink, $objectinfo, $pageinfo); $show['curpage'] = false; } else { $show['curpage'] = ($curpage != 1); } $pagenumbers = fetch_start_end_total_array($curpage, $perpage, $confirmedcount); $templater = vB_Template::create('pagenav_pagelink_window'); $templater->register('address', $address); $templater->register('address2', $address2); $templater->register('anchor', $anchor); $templater->register('curpage', $curpage); $templater->register('pagenumbers', $pagenumbers); $templater->register('total', $total); $templater->register('use_qmark', $use_qmark); $pagenavarr[] = $templater->render(); } } if (LANGUAGE_DIRECTION == 'rtl' AND (is_browser('ie') AND is_browser('ie') < 8)) { $pagenavarr = array_reverse($pagenavarr); } $pagenav = implode('', $pagenavarr); $templater = vB_Template::create('pagenav_window'); $templater->register('address2', $address2); $templater->register('anchor', $anchor); $templater->register('firstaddress', $firstaddress); $templater->register('firstnumbers', $firstnumbers); $templater->register('jumpaddress', $address); $templater->register('lastaddress', $lastaddress); $templater->register('lastnumbers', $lastnumbers); $templater->register('nextaddress', $nextaddress); $templater->register('nextnumbers', $nextnumbers); $templater->register('nextpage', $nextpage); $templater->register('pagenav', $pagenav); $templater->register('pagenumber', $pagenumber); $templater->register('prevaddress', $prevaddress); $templater->register('prevnumbers', $prevnumbers); $templater->register('prevpage', $prevpage); $templater->register('total', $total); $templater->register('totalpages', $confirmedpages); $templater->register('use_qmark', $use_qmark); $templater->register('hiddenfields', $hiddenfields); $pagenav = $templater->render(); return $pagenav; }
$fbpublishcheckbox = construct_fbpublishcheckbox(); } // display the like button for this thread? $fblikebutton = construct_fblikebutton(); } // Record thread as viewed. if ($vbulletin->options['who_read']) { mark_content_read('vBForum_Thread', $thread['threadid'], 'view'); } ($hook = vBulletinHook::fetch_hook('showthread_complete')) ? eval($hook) : false; $thread_url = vB_Friendly_Url::fetchLibrary($vbulletin, 'thread|js', $threadinfo, array('pagenumber' => $vbulletin->GPC['pagenumber']))->get_url(); // ############################################################################# // output page $templater = vB_Template::create('SHOWTHREAD'); $templater->register_page_templates(); $templater->register('pagenumbers', fetch_start_end_total_array($vbulletin->GPC['pagenumber'], $perpage, $totalposts)); $templater->register('totalposts', $totalposts); $templater->register('activeusers', $activeusers); $templater->register('ad_location', $ad_location); $templater->register('bookmarksites', $bookmarksites); $templater->register('editorid', $editorid); $templater->register('FIRSTPOSTID', $FIRSTPOSTID); $templater->register('firstunread', $firstunread); $templater->register('forumjump', $forumjump); $templater->register('forumrules', $forumrules); $templater->register('gobutton', $gobutton); $templater->register('LASTPOSTID', $LASTPOSTID); $templater->register('messagearea', $messagearea); $templater->register('navbar', $navbar); $templater->register('nextthreadinfo', $nextthreadinfo); $templater->register('nodhtmlcolspan', $nodhtmlcolspan);
/** * Returns the HTML for multi-page navigation without a fully know result set * * This handles multipage navigation when we don't have a count for the * resultset. The follow things must be true for this logic to work correctly * * 1) $confirmedcount is less than or equal to the total number of results * 2) if $confirmedcount is not the total number of results, it must be at * least equal to the "count" of the last result displayed in the window. * * These assumptions allow us to display the window links knowing that they will * be valid without knowing the full extent of the result set. * * @see fetch_seo_url * @param integer Page number being displayed * @param integer Number of pages to show before and after current page * @param integer Number of items to be displayed per page * @param integer Number of items confirmed in the results * @param string Base address for links eg: showthread.php?t=99{&page=4} * @param string Ending portion of address for links * @param string The base link for seo urls (if this is used address will not be) * @param array Additonal object info for generating the seo urls * @param array Additonal page info for generating the seo urls * * @todo is it correct to include the pagenav hooks here? Do we need other hooks * to replace them? * @return string Page navigation HTML */ function construct_window_page_nav($pagenumber, $window, $perpage, $confirmedcount, $address, $address2 = '', $anchor = '', $seolink = '', $objectinfo = '', $pageinfo = '') { global $vbulletin, $vbphrase, $show; $curpage = 0; $pagenav = ''; $firstlink = ''; $prevlink = ''; $lastlink = ''; $nextlink = ''; if ($confirmedcount <= $perpage) { $show['pagenav'] = false; return ''; } $show['pagenav'] = true; $confirmedpages = ceil($confirmedcount / $perpage); //window style page navs don't permit "jump to end" logic $show['jumppage'] = false; $show['last'] = false; $show['prev'] = false; $show['next'] = false; $show['first'] = false; if ($seolink) { $show['pagelinks'] = false; $use_qmark = 0; } else { $firstaddress = $prevaddress = $nextaddress = $lastaddress = $address; $show['pagelinks'] = true; $use_qmark = strpos($address, '?') ? 0 : 1; } if ($pagenumber > 1) { $prevpage = $pagenumber - 1; $prevnumbers = fetch_start_end_total_array($prevpage, $perpage, $confirmedcount); if ($seolink) { $pageinfo['page'] = $prevpage; $prevaddress = fetch_seo_url($seolink, $objectinfo, $pageinfo); } $show['prev'] = true; } if ($pagenumber < $confirmedpages) { $nextpage = $pagenumber + 1; if ($seolink) { $pageinfo['page'] = $nextpage; $nextaddress = fetch_seo_url($seolink, $objectinfo, $pageinfo); } $nextnumbers = fetch_start_end_total_array($nextpage, $perpage, $confirmedcount); $show['next'] = true; } if ($pagenumber - $window > 1) { $firstnumbers = fetch_start_end_total_array(1, $perpage, $confirmedcount); if ($seolink) { unset($pageinfo['page']); $firstaddress = fetch_seo_url($seolink, $objectinfo, $pageinfo); } $show['first'] = true; } for ($curpage = $pagenumber - $window; $curpage <= $pagenumber + $window and $curpage <= $confirmedpages; $curpage++) { if ($curpage < 1) { continue; } else { if ($curpage == $pagenumber) { $numbers = fetch_start_end_total_array($curpage, $perpage, $confirmedcount); $templater = vB_Template::create('pagenav_curpage'); $templater->register('curpage', $curpage); $templater->register('numbers', $numbers); $templater->register('use_qmark', $use_qmark); $templater->register('total', $total); $pagenav .= $templater->render(); } else { if ($seolink) { $pageinfo['page'] = $curpage; $address = fetch_seo_url($seolink, $objectinfo, $pageinfo); $show['curpage'] = false; } else { $show['curpage'] = $curpage != 1; } $pagenumbers = fetch_start_end_total_array($curpage, $perpage, $confirmedcount); $templater = vB_Template::create('pagenav_pagelink'); $templater->register('address', $address); $templater->register('address2', $address2); $templater->register('anchor', $anchor); $templater->register('curpage', $curpage); $templater->register('pagenumbers', $pagenumbers); $templater->register('total', $total); $templater->register('use_qmark', $use_qmark); $pagenav .= $templater->render(); } } } $templater = vB_Template::create('pagenav'); $templater->register('address2', $address2); $templater->register('anchor', $anchor); $templater->register('firstaddress', $firstaddress); $templater->register('firstnumbers', $firstnumbers); $templater->register('jumpaddress', $jumpaddress); $templater->register('lastaddress', $lastaddress); $templater->register('lastnumbers', $lastnumbers); $templater->register('nextaddress', $nextaddress); $templater->register('nextnumbers', $nextnumbers); $templater->register('nextpage', $nextpage); $templater->register('pagenav', $pagenav); $templater->register('pagenumber', $pagenumber); $templater->register('prevaddress', $prevaddress); $templater->register('prevnumbers', $prevnumbers); $templater->register('prevpage', $prevpage); $templater->register('total', $total); $templater->register('totalpages', $confirmedpages); $templater->register('use_qmark', $use_qmark); $pagenav = $templater->render(); return $pagenav; }
function process_thread_array($thread, $lastread = -1, $allowicons = -1) { global $vbphrase, $stylevar, $foruminfo, $vbulletin; global $newthreads, $dotthreads, $perpage, $ignore, $show; static $pperpage; if ($pperpage == 0) { // lets calculate posts per page // the following code should be left just in case we plan to use this function in showthread at some point if (THIS_SCRIPT != 'showthread') { $pperpage = sanitize_maxposts(); } else { $pperpage = sanitize_maxposts($perpage); } } // init value for the inline moderation checkbox $thread['checkbox_value'] = 0; if (can_moderate($thread['forumid'], 'caneditthreads') or $thread['open'] and $thread['postuserid'] == $vbulletin->userinfo['userid'] and $forumperms = fetch_permissions($thread['forumid']) and $forumperms & $vbulletin->bf_ugp_forumpermissions['caneditpost'] and $thread['dateline'] + $vbulletin->options['editthreadtitlelimit'] * 60 > TIMENOW) { $thread['title_editable'] = '<a rel="vB::AJAX"></a>'; $show['ajax_js'] = true; } else { $thread['title_editable'] = ''; } if ($thread['open'] != 10 and (can_moderate($thread['forumid'], 'canopenclose') or $thread['postuserid'] == $vbulletin->userinfo['userid'] and $forumperms = fetch_permissions($thread['forumid']) and $forumperms & $vbulletin->bf_ugp_forumpermissions['canopenclose'])) { $thread['openclose_editable'] = '<a rel="vB::AJAX"></a>'; $show['ajax_js'] = true; } else { $thread['openclose_editable'] = ''; } /*if ($thread['postuserid'] == $vbulletin->userinfo['userid']) { $forumperms = fetch_permissions($thread['forumid']); if ($forumperms & $vbulletin->bf_ugp_forumpermissions['canopenclose']) { $thread['openclose_editable'] .= "<div><strong>Own thread</strong></div>"; } }*/ if ($allowicons == -1) { $allowicons = $vbulletin->forumcache["{$thread['forumid']}"]['options'] & $vbulletin->bf_misc_forumoptions['allowicons']; } if ($lastread == -1) { $lastread = $vbulletin->userinfo['lastvisit']; } $show['rexpires'] = $show['rmanage'] = $show['threadmoved'] = $show['paperclip'] = $show['unsubscribe'] = false; // thread forumtitle if (empty($thread['forumtitle'])) { $thread['forumtitle'] = $vbulletin->forumcache["{$thread['forumid']}"]['title']; } // word wrap title if ($vbulletin->options['wordwrap'] != 0) { $thread['threadtitle'] = fetch_word_wrapped_string($thread['threadtitle']); } $thread['threadtitle'] = fetch_censored_text($thread['threadtitle']); if ($thread['prefixid']) { $thread['prefix_plain_html'] = htmlspecialchars_uni($vbphrase["prefix_{$thread['prefixid']}_title_plain"]); $thread['prefix_rich'] = $vbphrase["prefix_{$thread['prefixid']}_title_rich"]; } else { $thread['prefix_plain_html'] = ''; $thread['prefix_rich'] = ''; } // format thread preview if there is one if ($ignore["{$thread['postuserid']}"]) { $thread['preview'] = ''; } else { if (isset($thread['preview']) and $vbulletin->options['threadpreview'] > 0) { $thread['preview'] = strip_quotes($thread['preview']); $thread['preview'] = htmlspecialchars_uni(fetch_censored_text(fetch_trimmed_title(strip_bbcode($thread['preview'], false, true), $vbulletin->options['threadpreview']))); } } // thread last reply date/time $thread['lastpostdate'] = vbdate($vbulletin->options['dateformat'], $thread['lastpost'], true); $thread['lastposttime'] = vbdate($vbulletin->options['timeformat'], $thread['lastpost']); // post reply date/time (for search results as posts mainly) if ($thread['postdateline']) { $thread['postdate'] = vbdate($vbulletin->options['dateformat'], $thread['postdateline'], true); $thread['posttime'] = vbdate($vbulletin->options['timeformat'], $thread['postdateline']); } else { $thread['postdate'] = ''; $thread['posttime'] = ''; } // thread not moved if ($thread['open'] != 10) { // allow ratings? if ($foruminfo['allowratings']) { // show votes? if ($thread['votenum'] and $thread['votenum'] >= $vbulletin->options['showvotes']) { $thread['voteavg'] = vb_number_format($thread['votetotal'] / $thread['votenum'], 2); $thread['rating'] = intval(round($thread['votetotal'] / $thread['votenum'])); } else { $thread['rating'] = 0; } } else { $thread['rating'] = 0; $thread['votenum'] = 0; } // moderated thread? if (!$thread['visible']) { $thread['moderatedprefix'] = $vbphrase['moderated_thread_prefix']; $thread['checkbox_value'] += THREAD_FLAG_INVISIBLE; } else { $thread['moderatedprefix'] = ''; } // deleted thread? if ($thread['visible'] == 2) { $thread['checkbox_value'] += THREAD_FLAG_DELETED; $thread['del_reason'] = fetch_censored_text($thread['del_reason']); } // sticky thread? if ($thread['sticky']) { $show['sticky'] = true; $thread['typeprefix'] = $vbphrase['sticky_thread_prefix']; $thread['checkbox_value'] += THREAD_FLAG_STICKY; } else { $show['sticky'] = false; $thread['typeprefix'] = ''; } // thread contains poll? if ($thread['pollid'] != 0) { $thread['typeprefix'] .= $vbphrase['poll_thread_prefix']; $thread['checkbox_value'] += THREAD_FLAG_POLL; } // multipage nav $thread['totalposts'] = $thread['replycount'] + 1; $total =& $thread['totalposts']; if (($vbulletin->options['allowthreadedmode'] == 0 or $vbulletin->userinfo['threadedmode'] == 0 and empty($vbulletin->GPC[COOKIE_PREFIX . 'threadedmode']) or $vbulletin->GPC[COOKIE_PREFIX . 'threadedmode'] == 'linear') and $thread['totalposts'] > $pperpage and $vbulletin->options['linktopages']) { $thread['totalpages'] = ceil($thread['totalposts'] / $pperpage); $address = 'showthread.php?' . $vbulletin->session->vars['sessionurl'] . "t={$thread['threadid']}"; $address2 = "{$thread['highlight']}"; $curpage = 0; $thread['pagenav'] = ''; $show['pagenavmore'] = false; while ($curpage++ < $thread['totalpages']) { if ($vbulletin->options['maxmultipage'] and $curpage > $vbulletin->options['maxmultipage']) { $show['pagenavmore'] = true; break; } $pagenumbers = fetch_start_end_total_array($curpage, $pperpage, $thread['totalposts']); eval('$thread[pagenav] .= " ' . fetch_template('threadbit_pagelink') . '";'); } } else { $thread['pagenav'] = ''; } // allow thread icons? if ($allowicons) { // get icon from icon cache if ($thread['threadiconid']) { $thread['threadiconpath'] = $vbulletin->iconcache["{$thread['threadiconid']}"]['iconpath']; $thread['threadicontitle'] = $vbulletin->iconcache["{$thread['threadiconid']}"]['title']; } // show poll icon if ($thread['pollid'] != 0) { $show['threadicon'] = true; $thread['threadiconpath'] = "{$stylevar['imgdir_misc']}/poll_posticon.gif"; $thread['threadicontitle'] = $vbphrase['poll']; } else { if ($thread['threadiconpath']) { $show['threadicon'] = true; } else { if (!empty($vbulletin->options['showdeficon'])) { $show['threadicon'] = true; $thread['threadiconpath'] = $vbulletin->options['showdeficon']; $thread['threadicontitle'] = ''; } else { $show['threadicon'] = false; $thread['threadiconpath'] = ''; $thread['threadicontitle'] = ''; } } } } else { $show['threadicon'] = false; $thread['threadiconpath'] = ''; $thread['threadicontitle'] = ''; } // thread has attachment? if ($thread['attach'] > 0) { $show['paperclip'] = true; $thread['checkbox_value'] += THREAD_FLAG_ATTACH; } // folder icon generation $thread['statusicon'] = ''; // show dot folder? if ($vbulletin->userinfo['userid'] and $vbulletin->options['showdots'] and $dotthreads["{$thread['threadid']}"]) { $thread['statusicon'] .= '_dot'; $thread['dot_count'] = $dotthreads["{$thread['threadid']}"]['count']; $thread['dot_lastpost'] = $dotthreads["{$thread['threadid']}"]['lastpost']; } // show hot folder? if ($vbulletin->options['usehotthreads'] and ($thread['replycount'] >= $vbulletin->options['hotnumberposts'] and $vbulletin->options['hotnumberposts'] > 0 or $thread['views'] >= $vbulletin->options['hotnumberviews'] and $vbulletin->options['hotnumberviews'] > 0)) { $thread['statusicon'] .= '_hot'; } // show locked folder? if (!$thread['open']) { $thread['statusicon'] .= '_lock'; $thread['checkbox_value'] += THREAD_FLAG_CLOSED; } // show new folder? if ($thread['lastpost'] > $lastread) { if ($vbulletin->options['threadmarking'] and $thread['threadread']) { $threadview = $thread['threadread']; } else { $threadview = intval(fetch_bbarray_cookie('thread_lastview', $thread['threadid'])); } if ($thread['lastpost'] > $threadview) { $thread['statusicon'] .= '_new'; $show['gotonewpost'] = true; } else { $newthreads--; $show['gotonewpost'] = false; } } else { $show['gotonewpost'] = false; } // format numbers nicely $thread['replycount'] = vb_number_format($thread['replycount']); $thread['views'] = vb_number_format($thread['views']); $thread['realthreadid'] = $thread['threadid']; } else { // thread has been moved, lets delete if required! if (can_moderate($thread['forumid'])) { if ($thread['expires']) { if ($thread['expires'] <= TIMENOW) { $threadman =& datamanager_init('Thread', $vbulletin, ERRTYPE_STANDARD, 'threadpost'); $threadman->set_existing($thread); $threadman->delete(false, true, NULL, false); unset($threadman); } $show['rexpires'] = true; $thread['expiredate'] = vbdate($vbulletin->options['dateformat'], $thread['expires']); $thread['expiretime'] = vbdate($vbulletin->options['timeformat'], $thread['expires']); } $show['rmanage'] = can_moderate($thread['forumid'], 'canmanagethreads'); } $thread['realthreadid'] = $thread['threadid']; $thread['redirectthreadid'] = $thread['threadid']; $thread['threadid'] = $thread['pollid']; $thread['replycount'] = '-'; $thread['views'] = '-'; $show['threadicon'] = false; $thread['statusicon'] = '_moved' . iif($thread['lastpost'] > $lastread, '_new'); $thread['pagenav'] = ''; $thread['movedprefix'] = $vbphrase['moved_thread_prefix']; $thread['rating'] = 0; $thread['votenum'] = 0; $thread['pagenav'] = ''; $show['gotonewpost'] = false; $thread['showpagenav'] = false; $show['sticky'] = false; $show['threadmoved'] = true; } $show['subscribed'] = iif($thread['issubscribed'], true, false); $show['pagenav'] = iif($thread['pagenav'] != '', true, false); $show['guestuser'] = iif(!$thread['postuserid'], true, false); $show['threadrating'] = iif($thread['rating'] > 0, true, false); $show['threadcount'] = iif($thread['dot_count'], true, false); $show['taglist'] = ($vbulletin->options['threadtagging'] and !empty($thread['taglist'])); ($hook = vBulletinHook::fetch_hook('threadbit_process')) ? eval($hook) : false; return $thread; }
/** * Returns the HTML for multi-page navigation * * @param integer Page number being displayed * @param integer Number of items to be displayed per page * @param integer Total number of items found * @param string Base address for links eg: showthread.php?t=99{&page=4} * @param string Ending portion of address for links * * @return string Page navigation HTML */ function construct_page_nav($pagenumber, $perpage, $results, $address, $address2 = '', $anchor = '') { global $vbulletin, $vbphrase, $stylevar, $show; $curpage = 0; $pagenav = ''; $firstlink = ''; $prevlink = ''; $lastlink = ''; $nextlink = ''; if ($results <= $perpage) { $show['pagenav'] = false; return ''; } $show['pagenav'] = true; $total = vb_number_format($results); $totalpages = ceil($results / $perpage); $show['prev'] = false; $show['next'] = false; $show['first'] = false; $show['last'] = false; if ($pagenumber > 1) { $prevpage = $pagenumber - 1; $prevnumbers = fetch_start_end_total_array($prevpage, $perpage, $results); $show['prev'] = true; } if ($pagenumber < $totalpages) { $nextpage = $pagenumber + 1; $nextnumbers = fetch_start_end_total_array($nextpage, $perpage, $results); $show['next'] = true; } // create array of possible relative links that we might have (eg. +10, +20, +50, etc.) if (!is_array($vbulletin->options['pagenavsarr'])) { $vbulletin->options['pagenavsarr'] = preg_split('#\\s+#s', $vbulletin->options['pagenavs'], -1, PREG_SPLIT_NO_EMPTY); } while ($curpage++ < $totalpages) { ($hook = vBulletinHook::fetch_hook('pagenav_page')) ? eval($hook) : false; if (abs($curpage - $pagenumber) >= $vbulletin->options['pagenavpages'] and $vbulletin->options['pagenavpages'] != 0) { if ($curpage == 1) { $firstnumbers = fetch_start_end_total_array(1, $perpage, $results); $show['first'] = true; } if ($curpage == $totalpages) { $lastnumbers = fetch_start_end_total_array($totalpages, $perpage, $results); $show['last'] = true; } // generate relative links (eg. +10,etc). if (in_array(abs($curpage - $pagenumber), $vbulletin->options['pagenavsarr']) and $curpage != 1 and $curpage != $totalpages) { $pagenumbers = fetch_start_end_total_array($curpage, $perpage, $results); $relpage = $curpage - $pagenumber; if ($relpage > 0) { $relpage = '+' . $relpage; } eval('$pagenav .= "' . fetch_template('pagenav_pagelinkrel') . '";'); } } else { if ($curpage == $pagenumber) { $numbers = fetch_start_end_total_array($curpage, $perpage, $results); eval('$pagenav .= "' . fetch_template('pagenav_curpage') . '";'); } else { $pagenumbers = fetch_start_end_total_array($curpage, $perpage, $results); eval('$pagenav .= "' . fetch_template('pagenav_pagelink') . '";'); } } } ($hook = vBulletinHook::fetch_hook('pagenav_complete')) ? eval($hook) : false; eval('$pagenav = "' . fetch_template('pagenav') . '";'); return $pagenav; }
function process_thread_array($thread, $lastread = -1, $allowicons = -1, $fetchavatar = false) { global $vbphrase, $foruminfo, $vbulletin; global $newthreads, $dotthreads, $perpage, $ignore, $show; static $pperpage, $perm_cache; if ($pperpage == 0) { // lets calculate posts per page // the following code should be left just in case we plan to use this function in showthread at some point if (THIS_SCRIPT != 'showthread') { $pperpage = sanitize_maxposts(); } else { $pperpage = sanitize_maxposts($perpage); } } // init value for the inline moderation checkbox $thread['checkbox_value'] = 0; if (can_moderate($thread['forumid'], 'caneditthreads') or $thread['open'] and $thread['postuserid'] == $vbulletin->userinfo['userid'] and $forumperms = fetch_permissions($thread['forumid']) and $forumperms & $vbulletin->bf_ugp_forumpermissions['caneditpost'] and (!$vbulletin->options['editthreadtitlelimit'] or $thread['dateline'] + $vbulletin->options['editthreadtitlelimit'] * 60 > TIMENOW)) { $thread['title_editable'] = true; $show['ajax_js'] = true; } if ($thread['open'] != 10 and (can_moderate($thread['forumid'], 'canopenclose') or $thread['postuserid'] == $vbulletin->userinfo['userid'] and $forumperms = fetch_permissions($thread['forumid']) and $forumperms & $vbulletin->bf_ugp_forumpermissions['canopenclose'])) { $thread['openclose_editable'] = true; $show['ajax_js'] = true; } /*if ($thread['postuserid'] == $vbulletin->userinfo['userid']) { $forumperms = fetch_permissions($thread['forumid']); if ($forumperms & $vbulletin->bf_ugp_forumpermissions['canopenclose']) { $thread['openclose_editable'] .= "<div><strong>Own thread</strong></div>"; } }*/ if ($fetchavatar) { require_once DIR . '/includes/functions_user.php'; $avatar = fetch_avatar_from_record($thread, true, 'userid', 'api_'); $thread['avatarurl'] = $avatar[0]; $avatarinfo = parse_subsstring_array($thread, 'api_'); $avatarinfo['adminavatar'] = $avatarinfo['adminoptions'] & $vbulletin->bf_misc_adminoptions['adminavatar']; if (!isset($perm_cache["{$avatarinfo['userid']}"])) { $perm_cache["{$avatarinfo['userid']}"] = cache_permissions($avatarinfo, false); } else { $avatarinfo['permissions'] =& $perm_cache["{$avatarinfo['userid']}"]; } if (empty($thread['avatarurl']) or $vbulletin->userinfo['userid'] > 0 and !$vbulletin->userinfo['showavatars'] or !$avatarinfo['avatarid'] and !($perm_cache["{$avatarinfo['userid']}"]['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canuseavatar']) and !$avatarinfo['adminavatar']) { $show['avatar'] = false; } else { $show['avatar'] = true; } } if ($allowicons == -1) { $allowicons = $vbulletin->forumcache["{$thread['forumid']}"]['options'] & $vbulletin->bf_misc_forumoptions['allowicons']; } if ($lastread == -1) { $lastread = $vbulletin->userinfo['lastvisit']; } $show['rexpires'] = $show['rmanage'] = $show['threadmoved'] = $show['paperclip'] = $show['unsubscribe'] = false; // thread forumtitle if (empty($thread['forumtitle'])) { $thread['forumtitle'] = $vbulletin->forumcache["{$thread['forumid']}"]['title']; } $thread['forumtitleclean'] = $vbulletin->forumcache["{$thread['forumid']}"]['title_clean']; // word wrap title if ($vbulletin->options['wordwrap'] != 0) { $thread['threadtitle'] = fetch_word_wrapped_string($thread['threadtitle']); } $thread['threadtitle'] = fetch_censored_text($thread['threadtitle']); if ($thread['prefixid']) { $thread['prefix_plain_html'] = htmlspecialchars_uni($vbphrase["prefix_{$thread['prefixid']}_title_plain"]); $thread['prefix_rich'] = $vbphrase["prefix_{$thread['prefixid']}_title_rich"]; } else { $thread['prefix_plain_html'] = ''; $thread['prefix_rich'] = ''; } // format thread preview if there is one if ($ignore["{$thread['postuserid']}"]) { $thread['preview'] = ''; } else { if (isset($thread['preview'])) { if ($vbulletin->options['threadpreview'] > 0) { $thread['preview'] = strip_quotes($thread['preview']); $thread['preview'] = htmlspecialchars_uni(fetch_censored_text(fetch_trimmed_title(strip_bbcode($thread['preview'], false, true, true, true), $vbulletin->options['threadpreview']))); } else { unset($thread['preview']); } } } // thread last reply date/time $thread['lastpostdate'] = vbdate($vbulletin->options['dateformat'], $thread['lastpost'], true); $thread['lastposttime'] = vbdate($vbulletin->options['timeformat'], $thread['lastpost']); // post reply date/time (for search results as posts mainly) if ($thread['postdateline']) { $thread['postdate'] = vbdate($vbulletin->options['dateformat'], $thread['postdateline'], true); $thread['posttime'] = vbdate($vbulletin->options['timeformat'], $thread['postdateline']); } else { $thread['postdate'] = ''; $thread['posttime'] = ''; } // get the thread starting date and time if applicable if ($thread['dateline']) { $thread['startdate'] = vbdate($vbulletin->options['dateformat'], $thread['dateline'], true); $thread['starttime'] = vbdate($vbulletin->options['timeformat'], $thread['dateline']); } else { $thread['startdate'] = ''; $thread['starttime'] = ''; } // non magical thread status if (2 == $thread['visible']) { $thread['status']['deleted'] = 'deleted'; } else { if (!$thread['visible']) { $thread['status']['moderated'] = 'moderated'; } } // thread not moved if ($thread['open'] != 10) { // allow ratings? if ($foruminfo['allowratings']) { // show votes? if ($thread['votenum'] and $thread['votenum'] >= $vbulletin->options['showvotes']) { $thread['voteavg'] = vb_number_format($thread['votetotal'] / $thread['votenum'], 2); $thread['rating'] = intval(round($thread['votetotal'] / $thread['votenum'])); } else { $thread['rating'] = 0; } } else { $thread['rating'] = 0; $thread['votenum'] = 0; } // moderated thread? if (!$thread['visible']) { $thread['moderatedprefix'] = $vbphrase['moderated_thread_prefix']; $thread['checkbox_value'] += THREAD_FLAG_INVISIBLE; } else { $thread['moderatedprefix'] = ''; } // deleted thread? if ($thread['visible'] == 2) { $thread['checkbox_value'] += THREAD_FLAG_DELETED; $thread['del_reason'] = fetch_censored_text($thread['del_reason']); } // sticky thread? if ($thread['sticky']) { $show['sticky'] = true; $thread['typeprefix'] = $vbphrase['sticky_thread_prefix']; $thread['checkbox_value'] += THREAD_FLAG_STICKY; } else { $show['sticky'] = false; $thread['typeprefix'] = ''; } // thread contains poll? if ($thread['pollid'] != 0) { $thread['typeprefix'] .= $vbphrase['poll_thread_prefix']; $thread['checkbox_value'] += THREAD_FLAG_POLL; } // multipage nav $thread['totalposts'] = $thread['replycount'] + 1; $total =& $thread['totalposts']; if (($vbulletin->options['allowthreadedmode'] == 0 or $vbulletin->userinfo['threadedmode'] == 0 and empty($vbulletin->GPC[COOKIE_PREFIX . 'threadedmode']) or $vbulletin->GPC[COOKIE_PREFIX . 'threadedmode'] == 'linear') and $thread['totalposts'] > $pperpage and $vbulletin->options['linktopages']) { $thread['totalpages'] = ceil($thread['totalposts'] / $pperpage); #$address2 = "$thread[highlight]"; $curpage = 0; $thread['pagenav'] = ''; $show['pagenavmore'] = false; while ($curpage++ < $thread['totalpages']) { if ($vbulletin->options['maxmultipage'] and $curpage > $vbulletin->options['maxmultipage']) { $lastpageinfo = array('page' => $thread['totalpages']); if ($thread['highlight']) { $lastpageinfo['highlight'] = urlencode(implode(' ', $thread['highlight'])); } $thread['lastpagelink'] = fetch_seo_url('thread', $thread, $lastpageinfo, 'threadid', 'threadtitle'); $show['pagenavmore'] = true; break; } $pageinfo = array('page' => $curpage); if ($thread['highlight']) { $pageinfo['highlight'] = urlencode(implode(' ', $thread['highlight'])); } $pagenumbers = fetch_start_end_total_array($curpage, $pperpage, $thread['totalposts']); $templater = vB_Template::create('threadbit_pagelink'); $templater->register('curpage', $curpage); $templater->register('pageinfo', $pageinfo); $templater->register('thread', $thread); $thread['pagenav'] .= ' ' . $templater->render(); } } else { $thread['pagenav'] = ''; } // allow thread icons? if ($allowicons) { // get icon from icon cache if ($thread['threadiconid']) { $thread['threadiconpath'] = $vbulletin->iconcache["{$thread['threadiconid']}"]['iconpath']; $thread['threadicontitle'] = $vbulletin->iconcache["{$thread['threadiconid']}"]['title']; } // show poll icon if ($thread['pollid'] != 0) { $show['threadicon'] = true; $thread['threadiconpath'] = vB_Template_Runtime::fetchStyleVar('imgdir_misc') . "/poll_posticon.gif"; $thread['threadicontitle'] = $vbphrase['poll']; } else { if ($thread['threadiconpath']) { $show['threadicon'] = true; } else { if (!empty($vbulletin->options['showdeficon'])) { $show['threadicon'] = true; $thread['threadiconpath'] = $vbulletin->options['showdeficon']; $thread['threadicontitle'] = ''; } else { $show['threadicon'] = false; $thread['threadiconpath'] = ''; $thread['threadicontitle'] = ''; } } } } else { $show['threadicon'] = false; $thread['threadiconpath'] = ''; $thread['threadicontitle'] = ''; } // thread has attachment? if ($thread['attach'] > 0) { $show['paperclip'] = true; $thread['checkbox_value'] += THREAD_FLAG_ATTACH; } // folder icon generation $thread['status'] = array(); // show dot folder? if ($vbulletin->userinfo['userid'] and $vbulletin->options['showdots'] and $dotthreads["{$thread['threadid']}"]) { $thread['status']['dot'] = 'dot'; $thread['dot_count'] = $dotthreads["{$thread['threadid']}"]['count']; $thread['dot_lastpost'] = $dotthreads["{$thread['threadid']}"]['lastpost']; } // show hot folder? if ($vbulletin->options['usehotthreads'] and ($thread['replycount'] >= $vbulletin->options['hotnumberposts'] and $vbulletin->options['hotnumberposts'] > 0 or $thread['views'] >= $vbulletin->options['hotnumberviews'] and $vbulletin->options['hotnumberviews'] > 0)) { $thread['status']['hot'] = 'hot'; } // show locked folder? if (!$thread['open']) { $thread['status']['lock'] = 'lock'; $thread['checkbox_value'] += THREAD_FLAG_CLOSED; } // show new folder? if ($thread['lastpost'] > $lastread) { if ($vbulletin->options['threadmarking'] and $thread['threadread']) { $threadview = $thread['threadread']; } else { $threadview = intval(fetch_bbarray_cookie('thread_lastview', $thread['threadid'])); } if ($thread['lastpost'] > $threadview) { $thread['status']['new'] = 'new'; $show['gotonewpost'] = true; } else { $newthreads--; $show['gotonewpost'] = false; } } else { $show['gotonewpost'] = false; } // format numbers nicely $thread['replycount'] = vb_number_format($thread['replycount']); $thread['views'] = vb_number_format($thread['views']); $thread['realthreadid'] = $thread['threadid']; } else { // thread has been moved, lets delete if required! if (can_moderate($thread['forumid'])) { if ($thread['expires']) { if ($thread['expires'] <= TIMENOW) { $threadman =& datamanager_init('Thread', $vbulletin, ERRTYPE_STANDARD, 'threadpost'); $threadman->set_existing($thread); $threadman->delete(false, true, NULL, false); unset($threadman); } $show['rexpires'] = true; $thread['expiredate'] = vbdate($vbulletin->options['dateformat'], $thread['expires']); $thread['expiretime'] = vbdate($vbulletin->options['timeformat'], $thread['expires']); } $show['rmanage'] = can_moderate($thread['forumid'], 'canmanagethreads'); } $thread['realthreadid'] = $thread['threadid']; $thread['redirectthreadid'] = $thread['threadid']; $thread['threadid'] = $thread['pollid']; $thread['replycount'] = '-'; $thread['views'] = '-'; $show['threadicon'] = false; $thread['status'] = array(); // VB_API relies on thread redirects to fully reflect the read status of the redirected thread if ($vbulletin->options['threadmarking'] and $vbulletin->userinfo['userid'] and defined('VB_API') and VB_API === true) { if ($lastpost = $vbulletin->db->query_first("\n\t\t\t\tSELECT thread.forumid, thread.lastpost, threadread.readtime AS threadread\n\t\t\t\tFROM " . TABLE_PREFIX . "thread AS thread\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "threadread AS threadread ON (threadread.threadid = thread.threadid AND threadread.userid = {$vbulletin->userinfo['userid']})\n\t\t\t\tWHERE thread.threadid = {$thread['pollid']}\n\t\t\t")) { $forumread = $vbulletin->forumcache["{$lastpost['forumid']}"]['forumread']; $lastread = max($forumread, TIMENOW - $vbulletin->options['markinglimit'] * 86400); if ($lastpost['lastpost'] > $lastread) { if ($lastpost['threadread']) { $threadview = $lastpost['threadread']; } if ($lastpost['lastpost'] > $threadview) { $thread['status']['new'] = 'new'; } } } else { $thread['status']['new'] = $thread['lastpost'] > $lastread ? 'new' : false; } } else { $thread['status']['new'] = $thread['lastpost'] > $lastread ? 'new' : false; } $thread['status']['moved'] = 'moved'; $thread['pagenav'] = ''; $thread['movedprefix'] = $vbphrase['moved_thread_prefix']; $thread['rating'] = 0; $thread['votenum'] = 0; $show['gotonewpost'] = false; $thread['showpagenav'] = false; $show['sticky'] = false; $show['threadmoved'] = true; } $show['subscribed'] = iif($thread['issubscribed'], true, false); $show['pagenav'] = iif($thread['pagenav'] != '', true, false); $show['guestuser'] = iif(!$thread['postuserid'], true, false); $show['threadrating'] = iif($thread['rating'] > 0, true, false); $show['threadcount'] = iif($thread['dot_count'], true, false); $show['taglist'] = ($vbulletin->options['threadtagging'] and !empty($thread['taglist'])); ($hook = vBulletinHook::fetch_hook('threadbit_process')) ? eval($hook) : false; $thread['statusstring'] = implode(' ', $thread['status']); return $thread; }
function process_thread_array($thread, $lastread = -1, $allowicons = -1) { global $vbphrase, $foruminfo, $vbulletin; global $newthreads, $dotthreads, $perpage, $ignore, $show; static $pperpage; if ($pperpage == 0) { // lets calculate posts per page // the following code should be left just in case we plan to use this function in showthread at some point if (THIS_SCRIPT != 'showthread') { $pperpage = sanitize_maxposts(); } else { $pperpage = sanitize_maxposts($perpage); } } // init value for the inline moderation checkbox $thread['checkbox_value'] = 0; if ( can_moderate($thread['forumid'], 'caneditthreads') OR ( $thread['open'] AND $thread['postuserid'] == $vbulletin->userinfo['userid'] AND ($forumperms = fetch_permissions($thread['forumid'])) AND ($forumperms & $vbulletin->bf_ugp_forumpermissions['caneditpost']) AND ($thread['dateline'] + $vbulletin->options['editthreadtitlelimit'] * 60) > TIMENOW ) ) { $thread['title_editable'] = true; $show['ajax_js'] = true; } if ( $thread['open'] != 10 AND ( can_moderate($thread['forumid'], 'canopenclose') OR ( $thread['postuserid'] == $vbulletin->userinfo['userid'] AND ($forumperms = fetch_permissions($thread['forumid'])) AND ($forumperms & $vbulletin->bf_ugp_forumpermissions['canopenclose']) ) ) ) { $thread['openclose_editable'] = true; $show['ajax_js'] = true; } /*if ($thread['postuserid'] == $vbulletin->userinfo['userid']) { $forumperms = fetch_permissions($thread['forumid']); if ($forumperms & $vbulletin->bf_ugp_forumpermissions['canopenclose']) { $thread['openclose_editable'] .= "<div><strong>Own thread</strong></div>"; } }*/ if ($allowicons == -1) { $allowicons = $vbulletin->forumcache["$thread[forumid]"]['options'] & $vbulletin->bf_misc_forumoptions['allowicons']; } if ($lastread == -1) { $lastread = $vbulletin->userinfo['lastvisit']; } $show['rexpires'] = $show['rmanage'] = $show['threadmoved'] = $show['paperclip'] = $show['unsubscribe'] = false; // thread forumtitle if (empty($thread['forumtitle'])) { $thread['forumtitle'] = $vbulletin->forumcache["$thread[forumid]"]['title']; } $thread['forumtitleclean'] = $vbulletin->forumcache["$thread[forumid]"]['title_clean']; // word wrap title if ($vbulletin->options['wordwrap'] != 0) { $thread['threadtitle'] = fetch_word_wrapped_string($thread['threadtitle']); } $thread['threadtitle'] = fetch_censored_text($thread['threadtitle']); if ($thread['prefixid']) { $thread['prefix_plain_html'] = htmlspecialchars_uni($vbphrase["prefix_$thread[prefixid]_title_plain"]); $thread['prefix_rich'] = $vbphrase["prefix_$thread[prefixid]_title_rich"]; } else { $thread['prefix_plain_html'] = ''; $thread['prefix_rich'] = ''; } // format thread preview if there is one if ($ignore["$thread[postuserid]"]) { $thread['preview'] = ''; } else if (isset($thread['preview'])) { if($vbulletin->options['threadpreview'] > 0) { $thread['preview'] = strip_quotes($thread['preview']); $thread['preview'] = htmlspecialchars_uni(fetch_censored_text( fetch_trimmed_title(strip_bbcode($thread['preview'], false, true, true, true), $vbulletin->options['threadpreview']) )); } //if the preview text is disabled, then make sure that we don't leave this function //with it set. else { unset($thread['preview']); } } // thread last reply date/time $thread['lastpostdate'] = vbdate($vbulletin->options['dateformat'], $thread['lastpost'], true); $thread['lastposttime'] = vbdate($vbulletin->options['timeformat'], $thread['lastpost']); // post reply date/time (for search results as posts mainly) if ($thread['postdateline']) { $thread['postdate'] = vbdate($vbulletin->options['dateformat'], $thread['postdateline'], true); $thread['posttime'] = vbdate($vbulletin->options['timeformat'], $thread['postdateline']); } else { $thread['postdate'] = ''; $thread['posttime'] = ''; } // get the thread starting date and time if applicable if ($thread['dateline']) { $thread['startdate'] = vbdate($vbulletin->options['dateformat'], $thread['dateline'], true); $thread['starttime'] = vbdate($vbulletin->options['timeformat'], $thread['dateline']); } else { $thread['startdate'] = ''; $thread['starttime'] = ''; } // non magical thread status if (2 == $thread['visible']) { $thread['status']['deleted'] = 'deleted'; } else if (!$thread['visible']) { $thread['status']['moderated'] = 'moderated'; } // thread not moved if ($thread['open'] != 10) { // allow ratings? if ($foruminfo['allowratings']) { // show votes? if ($thread['votenum'] AND $thread['votenum'] >= $vbulletin->options['showvotes']) { $thread['voteavg'] = vb_number_format($thread['votetotal'] / $thread['votenum'], 2); $thread['rating'] = intval(round($thread['votetotal'] / $thread['votenum'])); } // do not show votes else { $thread['rating'] = 0; } } // do not allow ratings else { $thread['rating'] = 0; $thread['votenum'] = 0; } // moderated thread? if (!$thread['visible']) { $thread['moderatedprefix'] = $vbphrase['moderated_thread_prefix']; $thread['checkbox_value'] += THREAD_FLAG_INVISIBLE; } else { $thread['moderatedprefix'] = ''; } // deleted thread? if ($thread['visible'] == 2) { $thread['checkbox_value'] += THREAD_FLAG_DELETED; $thread['del_reason'] = fetch_censored_text($thread['del_reason']); } // sticky thread? if ($thread['sticky']) { $show['sticky'] = true; $thread['typeprefix'] = $vbphrase['sticky_thread_prefix']; $thread['checkbox_value'] += THREAD_FLAG_STICKY; } else { $show['sticky'] = false; $thread['typeprefix'] = ''; } // thread contains poll? if ($thread['pollid'] != 0) { $thread['typeprefix'] .= $vbphrase['poll_thread_prefix']; $thread['checkbox_value'] += THREAD_FLAG_POLL; } // multipage nav $thread['totalposts'] = $thread['replycount'] + 1; $total =& $thread['totalposts']; if ( ($vbulletin->options['allowthreadedmode'] == 0 OR ($vbulletin->userinfo['threadedmode'] == 0 AND empty($vbulletin->GPC[COOKIE_PREFIX . 'threadedmode'])) OR $vbulletin->GPC[COOKIE_PREFIX . 'threadedmode'] == 'linear') AND $thread['totalposts'] > $pperpage AND $vbulletin->options['linktopages'] ) { $thread['totalpages'] = ceil($thread['totalposts'] / $pperpage); #$address2 = "$thread[highlight]"; $curpage = 0; $thread['pagenav'] = ''; $show['pagenavmore'] = false; while ($curpage++ < $thread['totalpages']) { if ($vbulletin->options['maxmultipage'] AND $curpage > $vbulletin->options['maxmultipage']) { $lastpageinfo = array( 'page' => $thread['totalpages'] ); $thread['lastpagelink'] = fetch_seo_url('thread', $thread, $lastpageinfo, 'threadid', 'threadtitle'); $show['pagenavmore'] = true; break; } $pageinfo = array( 'page' => $curpage ); if ($thread['highlight']) { $pageinfo['highlight'] = urlencode(implode(' ', $thread['highlight'])); } $pagenumbers = fetch_start_end_total_array($curpage, $pperpage, $thread['totalposts']); $templater = vB_Template::create('threadbit_pagelink'); $templater->register('curpage', $curpage); $templater->register('pageinfo', $pageinfo); $templater->register('thread', $thread); $thread['pagenav'] .= ' ' . $templater->render(); } } // do not show pagenav else { $thread['pagenav'] = ''; } // allow thread icons? if ($allowicons) { // get icon from icon cache if ($thread['threadiconid']) { $thread['threadiconpath'] = $vbulletin->iconcache["$thread[threadiconid]"]['iconpath']; $thread['threadicontitle'] = $vbulletin->iconcache["$thread[threadiconid]"]['title']; } // show poll icon if ($thread['pollid'] != 0) { $show['threadicon'] = true; $thread['threadiconpath'] = vB_Template_Runtime::fetchStyleVar('imgdir_misc') . "/poll_posticon.gif"; $thread['threadicontitle'] = $vbphrase['poll']; } // show specified icon // this looks obsolete -- there isn't anything that appears to set threadiconpath // anywhere outside of this file. else if ($thread['threadiconpath']) { $show['threadicon'] = true; } // show default icon else if (!empty($vbulletin->options['showdeficon'])) { $show['threadicon'] = true; $thread['threadiconpath'] = $vbulletin->options['showdeficon']; $thread['threadicontitle'] = ''; } // do not show icon else { $show['threadicon'] = false; $thread['threadiconpath'] = ''; $thread['threadicontitle'] = ''; } } // do not allow icons else { $show['threadicon'] = false; $thread['threadiconpath'] = ''; $thread['threadicontitle'] = ''; } // thread has attachment? if ($thread['attach'] > 0) { $show['paperclip'] = true; $thread['checkbox_value'] += THREAD_FLAG_ATTACH; } // folder icon generation $thread['status'] = array(); // show dot folder? if ($vbulletin->userinfo['userid'] AND $vbulletin->options['showdots'] AND $dotthreads["$thread[threadid]"]) { $thread['status']['dot'] = 'dot'; $thread['dot_count'] = $dotthreads["$thread[threadid]"]['count']; $thread['dot_lastpost'] = $dotthreads["$thread[threadid]"]['lastpost']; } // show hot folder? if ($vbulletin->options['usehotthreads'] AND (($thread['replycount'] >= $vbulletin->options['hotnumberposts'] AND $vbulletin->options['hotnumberposts'] > 0) OR ($thread['views'] >= $vbulletin->options['hotnumberviews'] AND $vbulletin->options['hotnumberviews'] > 0))) { $thread['status']['hot'] = 'hot'; } // show locked folder? if (!$thread['open']) { $thread['status']['lock'] = 'lock'; $thread['checkbox_value'] += THREAD_FLAG_CLOSED; } // show new folder? if ($thread['lastpost'] > $lastread) { if ($vbulletin->options['threadmarking'] AND $thread['threadread']) { $threadview = $thread['threadread']; } else { $threadview = intval(fetch_bbarray_cookie('thread_lastview', $thread['threadid'])); } if ($thread['lastpost'] > $threadview) { $thread['status']['new'] = 'new'; $show['gotonewpost'] = true; } else { $newthreads--; $show['gotonewpost'] = false; } } else { $show['gotonewpost'] = false; } // format numbers nicely $thread['replycount'] = vb_number_format($thread['replycount']); $thread['views'] = vb_number_format($thread['views']); $thread['realthreadid'] = $thread['threadid']; } // thread moved? else { // thread has been moved, lets delete if required! if (can_moderate($thread['forumid'])) { if ($thread['expires']) { if ($thread['expires'] <= TIMENOW) { $threadman =& datamanager_init('Thread', $vbulletin, ERRTYPE_STANDARD, 'threadpost'); $threadman->set_existing($thread); $threadman->delete(false, true, NULL, false); unset($threadman); } $show['rexpires'] = true; $thread['expiredate'] = vbdate($vbulletin->options['dateformat'], $thread['expires']); $thread['expiretime'] = vbdate($vbulletin->options['timeformat'], $thread['expires']); } $show['rmanage'] = can_moderate($thread['forumid'], 'canmanagethreads'); } $thread['realthreadid'] = $thread['threadid']; $thread['redirectthreadid'] = $thread['threadid']; $thread['threadid'] = $thread['pollid']; $thread['replycount'] = '-'; $thread['views'] = '-'; $show['threadicon'] = false; $thread['status'] = array('moved' => 'moved', 'new' => ($thread['lastpost'] > $lastread) ? 'new' : false); $thread['pagenav'] = ''; $thread['movedprefix'] = $vbphrase['moved_thread_prefix']; $thread['rating'] = 0; $thread['votenum'] = 0; $show['gotonewpost'] = false; $thread['showpagenav'] = false; $show['sticky'] = false; $show['threadmoved'] = true; } $show['subscribed'] = iif ($thread['issubscribed'], true, false); $show['pagenav'] = iif ($thread['pagenav'] != '', true, false); $show['guestuser'] = iif (!$thread['postuserid'], true, false); $show['threadrating'] = iif ($thread['rating'] > 0, true, false); $show['threadcount'] = iif ($thread['dot_count'], true, false); $show['taglist'] = ($vbulletin->options['threadtagging'] AND !empty($thread['taglist'])); ($hook = vBulletinHook::fetch_hook('threadbit_process')) ? eval($hook) : false; $thread['statusstring'] = implode(' ', $thread['status']); return $thread; }