public function fetchTemplate($templatename, $activity, $skipgroup = false, $fetchphrase = false) { $commentinfo =& $this->content['album_picturecomment'][$activity['contentid']]; $albuminfo =& $this->content['album'][$commentinfo['albumid']]; $activity['postdate'] = vbdate(vB::$vbulletin->options['dateformat'], $activity['dateline'], true); $activity['posttime'] = vbdate(vB::$vbulletin->options['timeformat'], $activity['dateline']); $preview = strip_quotes($commentinfo['pagetext']); $commentinfo['preview'] = htmlspecialchars_uni(fetch_censored_text(fetch_trimmed_title(strip_bbcode($preview, false, true, true, true), vb::$vbulletin->options['as_snippet']))); $userinfo = $this->fetchUser($activity['userid'], $commentinfo['postusername']); $userinfo2 = $this->fetchUser($albuminfo['userid']); if ($fetchphrase) { if ($userinfo['userid']) { $phrase = construct_phrase($this->vbphrase['x_commented_on_a_photo_in_album_y'], fetch_seo_url('member', $userinfo), $userinfo['username'], fetch_seo_url('member', $userinfo2), $userinfo2['username'], vB::$vbulletin->session->vars['sessionurl'], $albuminfo['albumid'], $albuminfo['title']); } else { $phrase = construct_phrase($this->vbphrase['guest_x_commented_on_a_photo_in_album_y'], $userinfo['username'], fetch_seo_url('member', $userinfo2), $userinfo2['username'], vB::$vbulletin->session->vars['sessionurl'], $albuminfo['albumid'], $albuminfo['title']); } return array('phrase' => $phrase, 'userinfo' => $userinfo, 'activity' => $activity); } else { $templater = vB_Template::create($templatename); $templater->register('userinfo', $userinfo); $templater->register('userinfo2', $userinfo2); $templater->register('activity', $activity); $templater->register('commentinfo', $commentinfo); $templater->register('albuminfo', $albuminfo); return $templater->render(); } }
public function fetchTemplate($templatename, $activity, $skipgroup = false, $fetchphrase = false) { $postinfo =& $this->content['cms_post'][$activity['contentid']]; $nodeinfo =& $this->content['cms_node'][$postinfo['nodeid']]; $articleinfo =& $this->content['cms_article'][$nodeinfo['contentid']]; $activity['postdate'] = vbdate(vB::$vbulletin->options['dateformat'], $activity['dateline'], true); $activity['posttime'] = vbdate(vB::$vbulletin->options['timeformat'], $activity['dateline']); $preview = strip_quotes($postinfo['pagetext']); $articleinfo['preview'] = htmlspecialchars_uni(fetch_censored_text(fetch_trimmed_title(strip_bbcode($preview, false, true, true, true), vb::$vbulletin->options['as_snippet']))); $articleinfo['fullurl'] = vB_Route::create('vBCms_Route_Content', $nodeinfo['nodeid'] . ($nodeinfo['url'] == '' ? '' : '-' . $nodeinfo['url']))->getCurrentURL(); $nodeinfo['parenturl'] = $this->fetchParentUrl($nodeinfo['parentnode']); $nodeinfo['parenttitle'] = $this->fetchParentTitle($nodeinfo['parentnode']); $userinfo = $this->fetchUser($activity['userid'], $postinfo['username']); if ($fetchphrase) { if ($userinfo['userid']) { $phrase = construct_phrase($this->vbphrase['x_commented_on_an_article_y_in_z'], fetch_seo_url('member', $userinfo), $userinfo['username'], $articleinfo['fullurl'], $nodeinfo['title'], $nodeinfo['parenturl'], $nodeinfo['parenttitle']); } else { $phrase = construct_phrase($this->vbphrase['guest_x_commented_on_an_article_y_in_z'], $userinfo['username'], $articleinfo['fullurl'], $nodeinfo['title'], $nodeinfo['parenturl'], $nodeinfo['parenttitle']); } return array('phrase' => $phrase, 'userinfo' => $userinfo, 'activity' => $activity); } else { $templater = vB_Template::create($templatename); $templater->register('userinfo', $userinfo); $templater->register('postinfo', $postinfo); $templater->register('activity', $activity); $templater->register('nodeinfo', $nodeinfo); $templater->register('articleinfo', $articleinfo); return $templater->render(); } }
/** * Handles a [quote] tag. Displays a string in an area indicating it was quoted from someone/somewhere else. * * @param string The body of the quote. * @param string If tag has option, the original user to post. * * @return string HTML representation of the tag. */ function handle_bbcode_quote($message, $username = '') { global $vbulletin, $vbphrase, $show; // remove smilies from username $username = $this->strip_smilies($username); $postid = $blogtextid = 0; if (preg_match('/^(.+)(?<!&#[0-9]{3}|&#[0-9]{4}|&#[0-9]{5});\s*(bt)?(\d+)\s*$/U', $username, $match)) { $username = $match[1]; if ($match[2] == 'bt') { $blogtextid = $match[3]; } else { $postid = $match[3]; } } $username = $this->do_word_wrap($username); $show['username'] = iif($username != '', true, false); $message = $this->strip_front_back_whitespace($message, 1); $templater = vB_Template::create($this->printable ? 'bbcode_quote_printable' : 'bbcode_quote'); $templater->register('message', $message); $templater->register('postid', $postid); $templater->register('username', $username); return $templater->render(); }
function construct_faq_item($faq, $find = '') { global $vbulletin, $ifaqcache, $faqbits, $faqlinks, $show, $vbphrase; $faq['text'] = trim($faq['text']); if (is_array($find) and !empty($find)) { $faq['title'] = preg_replace('#(^|>)([^<]+)(?=<|$)#sUe', "process_highlight_faq('\\2', \$find, '\\1', '<u>\\\\1</u>')", $faq['title']); $faq['text'] = preg_replace('#(^|>)([^<]+)(?=<|$)#sUe', "process_highlight_faq('\\2', \$find, '\\1', '<span class=\"highlight\">\\\\1</span>')", $faq['text']); } $faqsublinks = ''; if (is_array($ifaqcache["{$faq['faqname']}"])) { foreach ($ifaqcache["{$faq['faqname']}"] as $subfaq) { if ($subfaq['displayorder'] > 0) { $templater = vB_Template::create('faqbit_link'); $templater->register('faq', $faq); $templater->register('subfaq', $subfaq); $faqsublinks .= $templater->render(); } } } $show['faqsublinks'] = iif($faqsublinks, true, false); $show['faqtext'] = iif($faq['text'], true, false); ($hook = vBulletinHook::fetch_hook('faq_item_display')) ? eval($hook) : false; $templater = vB_Template::create('faqbit'); $templater->register('faq', $faq); $templater->register('faqsublinks', $faqsublinks); $faqbits .= $templater->render(); }
public function fetchTemplate($templatename, $activity, $skipgroup = false, $fetchphrase = false) { $messageinfo =& $this->content['visitormessage'][$activity['contentid']]; $activity['postdate'] = vbdate(vB::$vbulletin->options['dateformat'], $activity['dateline'], true); $activity['posttime'] = vbdate(vB::$vbulletin->options['timeformat'], $activity['dateline']); $userinfo2 =& $this->content['user'][$messageinfo['userid']]; $messageinfo['preview'] = strip_quotes($messageinfo['pagetext']); $messageinfo['preview'] = htmlspecialchars_uni(fetch_censored_text(fetch_trimmed_title(strip_bbcode($messageinfo['preview'], false, true, true, true), vb::$vbulletin->options['as_snippet']))); $userinfo = $this->fetchUser($activity['userid'], $messageinfo['postusername']); if ($fetchphrase) { if ($userinfo['userid']) { $phrase = construct_phrase($this->vbphrase['x_created_a_visitormessage_y_in_z'], fetch_seo_url('member', $userinfo), $userinfo['username'], fetch_seo_url('member', $userinfo2, $linkinfo), $messageinfo['vmid'], fetch_seo_url('member', $userinfo2), $userinfo2['username']); } else { $phrase = construct_phrase($this->vbphrase['guest_x_created_a_visitormessage_y_in_z'], $userinfo['username'], fetch_seo_url('member', $userinfo2, $linkinfo), $messageinfo['vmid'], fetch_seo_url('member', $userinfo2), $userinfo2['username']); } return array('phrase' => $phrase, 'userinfo' => $userinfo, 'activity' => $activity); } else { $templater = vB_Template::create($templatename); $templater->register('userinfo', $userinfo); $templater->register('userinfo2', $userinfo2); $templater->register('linkinfo', array('vmid' => $messageinfo['vmid'])); $templater->register('linkinfo2', array('tab' => 'visitor_messaging')); $templater->register('activity', $activity); $templater->register('messageinfo', $messageinfo); return $templater->render(); } }
/** * Constructor * @param $results : a results object, normally from vb/search/results */ public function __construct($results, $template = null) { $this->results = $results; if (!$template) { $this->template = vB_Template::create('search_resultlist'); } else { $this->template = vB_Template::create($template); } }
/** * Returns the HTML to be displayed to the user for Human Verification * * @param string Passed to template * * @return string HTML to output * */ function output_token($var_prefix = 'humanverify') { global $vbphrase, $show; $vbulletin =& $this->registry; $humanverify = $this->generate_token(); $templater = vB_Template::create('humanverify_image'); $templater->register('humanverify', $humanverify); $templater->register('var_prefix', $var_prefix); $output = $templater->render(); return $output; }
public function render($current_user, $criteria, $template = '') { $template = vB_Template::create('search_results_announcement'); $template->register('announcecolspan', 6); $template->register('announcement', $this->record); $template->register('announcementidlink', '&a=' . $this->record['announcementid']); //this is actually how the legacy search code does it, since the foruminfo //value it passes isn't set properly. Its only used to set the forum id //on the link which is ignored if the announcementid is also set $template->register('foruminfo', array()); return $template->render(); }
public function getHTML($content = false) { if (!$content) { $content = $this->getData(); } if ($content) { $templater = vB_Template::create($this->config['html_template']); $templater->register('blockinfo', $this->blockinfo); $templater->register('content', $content); return $templater->render(); } }
/** * Performs the actual rendering of the view. * * @param vB_View $view - The view to render * @return string - The rendering result */ protected function render(vB_View $view) { // Set up the style info $this->bootstrap->force_styleid($this->styleid); $this->bootstrap->load_style(); // Create a template $template = vB_Template::create($view->getResult()); // Register the view data $template->quickRegister($view->getViewData()); // Return the output return $template->render(); }
public function getHTML($streamdata = false) { if (!$streamdata) { $streamdata = $this->getData(); } if ($streamdata) { $templater = vB_Template::create('block_activitystream'); $templater->register('blockinfo', $this->blockinfo); $templater->register('stream', $streamdata); return $templater->render(); } }
public function render($current_user, $criteria, $template_name = '') { global $vbulletin; if ('' == $template_name) { $template_name = 'search_results_forum'; } $template = vB_Template::create($template_name); $template->register('forum', $this->forum->get_record()); $template->register('dateformat', $vbulletin->options['dateformat']); $template->register('timeformat', $vbulletin->options['timeformat']); return $template->render(); }
/** * Returns the HTML to be displayed to the user for Human Verification * * @param string Passed to template * * @return string HTML to output * */ function output_token($var_prefix = 'humanverify') { global $vbphrase, $show; $vbulletin =& $this->registry; $humanverify = $this->generate_token(); require_once DIR . '/includes/functions_misc.php'; $humanverify['question'] = fetch_phrase('question' . $humanverify['answer'], 'hvquestion', '', false, true, $this->registry->userinfo['languageid'], false); $templater = vB_Template::create('humanverify_question'); $templater->register('humanverify', $humanverify); $templater->register('var_prefix', $var_prefix); $output = $templater->render(); return $output; }
/** * Returns the HTML to be displayed to the user for Human Verification * * @param string Passed to template * * @return string HTML to output * */ function output_token($var_prefix = 'humanverify') { global $vbphrase, $show; $vbulletin =& $this->registry; $humanverify = $this->generate_token(); $phraseAux = vB_Api::instanceInternal('phrase')->fetch(array('question' . $humanverify['answer'])); $humanverify['question'] = $phraseAux['question' . $humanverify['answer']]; $templater = vB_Template::create('humanverify_question'); $templater->register('humanverify', $humanverify); $templater->register('var_prefix', $var_prefix); $output = $templater->render(); return $output; }
public function fetchTemplate($templatename, $activity, $skipgroup = false, $fetchphrase = false) { $groupinfo =& $this->content['socialgroup'][$activity['contentid']]; $userinfo =& $this->content['user'][$activity['userid']]; $activity['postdate'] = vbdate(vB::$vbulletin->options['dateformat'], $activity['dateline'], true); $activity['posttime'] = vbdate(vB::$vbulletin->options['timeformat'], $activity['dateline']); if ($fetchphrase) { return array('phrase' => construct_phrase($this->vbphrase['x_created_a_group_y'], fetch_seo_url('member', $userinfo), $userinfo['username'], vB::$vbulletin->session->vars['sessionurl'], $groupinfo['groupid'], $groupinfo['name']), 'userinfo' => $userinfo, 'activity' => $activity); } else { $templater = vB_Template::create($templatename); $templater->register('userinfo', $userinfo); $templater->register('activity', $activity); $templater->register('groupinfo', $groupinfo); return $templater->render(); } }
public function getHTML($tag_cloud = false) { if (!$tag_cloud) { $tag_cloud = $this->getData(); } if ($tag_cloud) { foreach ($tag_cloud['tags'] as $thistag) { $templater = vB_Template::create('tag_cloud_link'); $templater->register('thistag', $thistag); $tag_cloud['links'] .= $templater->render(); } $templater = vB_Template::create('block_tagcloud'); $templater->register('blockinfo', $this->blockinfo); $templater->register('tagcloud', $tag_cloud['links']); return $templater->render(); } }
public function fetchTemplate($templatename, $activity, $skipgroup = false, $fetchphrase = false) { $userinfo =& $this->content['user'][$activity['userid']]; $bloginfo =& $this->content['blog'][$activity['contentid']]; $activity['postdate'] = vbdate(vB::$vbulletin->options['dateformat'], $activity['dateline'], true); $activity['posttime'] = vbdate(vB::$vbulletin->options['timeformat'], $activity['dateline']); $preview = strip_quotes($bloginfo['pagetext']); $bloginfo['preview'] = htmlspecialchars_uni(fetch_censored_text(fetch_trimmed_title(strip_bbcode($preview, false, true, true, true), vb::$vbulletin->options['as_snippet']))); if ($fetchphrase) { return array('phrase' => construct_phrase($this->vbphrase['x_created_a_blog_entry_y_in_z'], fetch_seo_url('member', $userinfo), $userinfo['username'], fetch_seo_url('entry', $bloginfo), $bloginfo['title'], fetch_seo_url('blog', $bloginfo), $bloginfo['blog_title']), 'userinfo' => $userinfo, 'activity' => $activity); } else { $templater = vB_Template::create($templatename); $templater->register('userinfo', $userinfo); $templater->register('activity', $activity); $templater->register('bloginfo', $bloginfo); return $templater->render(); } }
public function listUi($prefs) { $phrase = new vB_Legacy_Phrase(); $phrase->add_phrase_groups(array('vbblogglobal', 'vbblogcat')); global $vbulletin; $template = vB_Template::create('search_input_blogcomment'); $template->register('securitytoken', $vbulletin->userinfo['securitytoken']); $template->register('contenttypeid', $this->get_contenttypeid()); $prefsettings = array( 'select'=> array('searchdate', 'beforeafter', 'sortby', 'titleonly', 'sortorder', 'starteronly'), 'cb' => array('nocache', 'exactname'), 'value' => array('query', 'searchuser') ); $this->setPrefs($template, $prefs, $prefsettings); vB_Search_Searchtools::searchIntroRegisterHumanVerify($template); return $template->render(); }
/** * Template method. Calls all the appropriate methods to build a post and then evaluates the template. * * @param array Post information * * @return string HTML for the post */ function construct_postbit(&$post) { $this->post =& $post; global $show, $vbphrase, $stylevar, $template_hook; $tmp_show = $show; $tmp_stylevar = $stylevar; $tmp_vbcms = $this->registry->products['vbcms']; $this->registry->products['vbcms'] = false; $session_url = $vbulletin->session->vars['sessionurl']; $vbulletin->session->vars['sessionurl'] = ''; $this->parse_bbcode(); $this->process_attachments(); $templater = vB_Template::create($this->template_prefix . $this->templatename); $templater->register('template_hook', $template_hook); $templater->register('post', $post); $result = $templater->render(); $this->registry->products['vbcms'] = $tmp_vbcms; $show = $tmp_show; $stylevar = $tmp_stylevar; $vbulletin->session->vars['sessionurl'] = $session_url; return $result; }
/** * Fetches the tagbits for display in an entry * * @param array Blog info * * @return string Tag bits */ function fetch_entry_tagbits($bloginfo, &$userinfo) { global $vbulletin, $vbphrase, $show, $template_hook; if ($bloginfo['taglist']) { $tag_array = explode(',', $bloginfo['taglist']); $tag_list = array(); foreach ($tag_array AS $tag) { $tag = trim($tag); if ($tag === '') { continue; } $tag_url = urlencode(unhtmlspecialchars($tag)); $tag = fetch_word_wrapped_string($tag); ($hook = vBulletinHook::fetch_hook('blog_tag_fetchbit')) ? eval($hook) : false; $templater = vB_Template::create('blog_tagbit'); $templater->register('tag', $tag); $templater->register('tag_url', $tag_url); $templater->register('userinfo', $userinfo); $templater->register('pageinfo', array('tag' => $tag_url)); $tag_list[] = trim($templater->render()); } } else { $tag_list = array(); } ($hook = vBulletinHook::fetch_hook('blog_tag_fetchbit_complete')) ? eval($hook) : false; return implode(", ", $tag_list); }
public function fetchTemplate($templatename, $activity, $skipgroup = false, $fetchphrase = false) { global $show; $threadinfo =& $this->content['thread'][$activity['contentid']]; $foruminfo =& vB::$vbulletin->forumcache[$threadinfo['forumid']]; $threadinfo['prefix_plain_html'] = htmlspecialchars_uni($this->vbphrase["prefix_{$threadinfo['prefixid']}_title_plain"]); $threadinfo['prefix_rich'] = $this->vbphrase["prefix_{$threadinfo['prefixid']}_title_rich"]; $activity['postdate'] = vbdate(vB::$vbulletin->options['dateformat'], $activity['dateline'], true); $activity['posttime'] = vbdate(vB::$vbulletin->options['timeformat'], $activity['dateline']); $threadinfo['preview'] = strip_quotes($threadinfo['pagetext']); $threadinfo['preview'] = htmlspecialchars_uni(fetch_censored_text(fetch_trimmed_title(strip_bbcode($threadinfo['preview'], false, true, true, true), vb::$vbulletin->options['as_snippet']))); $forumperms = fetch_permissions($threadinfo['forumid']); $show['threadcontent'] = $forumperms & vB::$vbulletin->bf_ugp_forumpermissions['canviewthreads'] ? true : false; $userinfo = $this->fetchUser($activity['userid'], $threadinfo['postusername']); if ($fetchphrase) { if ($threadinfo['pollid']) { if ($userinfo['userid']) { $phrase = construct_phrase($this->vbphrase['x_started_a_poll_y_in_z'], fetch_seo_url('member', $userinfo), $userinfo['username'], fetch_seo_url('thread', $threadinfo), $threadinfo['prefix_rich'], $threadinfo['title'], fetch_seo_url('forum', $foruminfo), $foruminfo['title']); } else { $phrase = construct_phrase($this->vbphrase['guest_x_started_a_poll_y_in_z'], $userinfo['username'], fetch_seo_url('thread', $threadinfo), $threadinfo['prefix_rich'], $threadinfo['title'], fetch_seo_url('forum', $foruminfo), $foruminfo['title']); } } else { if ($userinfo['userid']) { $phrase = construct_phrase($this->vbphrase['x_started_a_thread_y_in_z'], fetch_seo_url('member', $userinfo), $userinfo['username'], fetch_seo_url('thread', $threadinfo), $threadinfo['prefix_rich'], $threadinfo['title'], fetch_seo_url('forum', $foruminfo), $foruminfo['title']); } else { $phrase = construct_phrase($this->vbphrase['guest_x_started_a_thread_y_in_z'], $userinfo['username'], fetch_seo_url('thread', $threadinfo), $threadinfo['prefix_rich'], $threadinfo['title'], fetch_seo_url('forum', $foruminfo), $foruminfo['title']); } } return array('phrase' => $phrase, 'userinfo' => $userinfo, 'activity' => $activity); } else { $templater = vB_Template::create($templatename); $templater->register('userinfo', $userinfo); $templater->register('activity', $activity); $templater->register('threadinfo', $threadinfo); $templater->register('foruminfo', $foruminfo); return $templater->render(); } }
function do_get_subscriptions() { global $vbulletin, $db, $show, $vbphrase, $permissions, $subscribecounters; $vbulletin->options['threadpreview'] = FR_PREVIEW_LEN; if (!$vbulletin->userinfo['userid']) { json_error(ERR_NO_PERMISSION); } if (!$vbulletin->userinfo['userid'] and $_REQUEST['do'] != 'removesubscription' or $vbulletin->userinfo['userid'] and !($permissions['forumpermissions'] & $vbulletin->bf_ugp_forumpermissions['canview']) or $vbulletin->userinfo['usergroupid'] == 4 or !($permissions['genericoptions'] & $vbulletin->bf_ugp_genericoptions['isnotbannedgroup'])) { json_error(ERR_NO_PERMISSION); } $thread_data = array(); $unread_subs = 0; // vbulletin expects folderid, but we will just get them all $vbulletin->input->clean_array_gpc('r', array('folderid' => TYPE_NOHTML, 'perpage' => TYPE_UINT, 'pagenumber' => TYPE_UINT, 'sortfield' => TYPE_NOHTML, 'sortorder' => TYPE_NOHTML, 'previewtype' => TYPE_INT)); $previewtype = $vbulletin->GPC['previewtype']; if (!$previewtype) { $previewtype = 1; } $vbulletin->GPC['folderid'] = 'all'; // Values that are reused in templates $sortfield =& $vbulletin->GPC['sortfield']; $perpage =& $vbulletin->GPC['perpage']; $pagenumber =& $vbulletin->GPC['pagenumber']; $folderid =& $vbulletin->GPC['folderid']; if ($folderid == 'all') { $getallfolders = true; $show['allfolders'] = true; } else { $folderid = intval($folderid); } $folderselect["{$folderid}"] = 'selected="selected"'; // Build folder jump require_once DIR . '/includes/functions_misc.php'; $folders = construct_folder_jump(1, $folderid, false, '', true); $templater = vB_Template::create('subscribe_folder_jump'); $templater->register('folders', $folders); $folderjump = $templater->render(); // look at sorting options: if ($vbulletin->GPC['sortorder'] != 'asc') { $vbulletin->GPC['sortorder'] = 'desc'; $sqlsortorder = 'DESC'; $order = array('desc' => 'selected="selected"'); } else { $sqlsortorder = ''; $order = array('asc' => 'selected="selected"'); } switch ($sortfield) { case 'title': case 'lastpost': case 'replycount': case 'views': case 'postusername': $sqlsortfield = 'thread.' . $sortfield; break; default: $handled = false; if (!$handled) { $sqlsortfield = 'thread.lastpost'; $sortfield = 'lastpost'; } } $sort = array($sortfield => 'selected="selected"'); if ($getallfolders) { $totalallthreads = array_sum($subscribecounters); } else { $totalallthreads = $subscribecounters["{$folderid}"]; } // set defaults sanitize_pageresults($totalallthreads, $pagenumber, $perpage, 200, $vbulletin->options['maxthreads']); // display threads $limitlower = ($pagenumber - 1) * $perpage + 1; $limitupper = $pagenumber * $perpage; if ($limitupper > $totalallthreads) { $limitupper = $totalallthreads; if ($limitlower > $totalallthreads) { $limitlower = $totalallthreads - $perpage; } } if ($limitlower <= 0) { $limitlower = 1; } $hook_query_fields = $hook_query_joins = $hook_query_where = ''; $getthreads = $db->query_read_slave("\n\t\tSELECT thread.threadid, emailupdate, subscribethreadid, thread.forumid, thread.postuserid\n\t\t\t{$hook_query_fields}\n\t\tFROM " . TABLE_PREFIX . "subscribethread AS subscribethread\n\t\tLEFT JOIN " . TABLE_PREFIX . "thread AS thread ON(thread.threadid = subscribethread.threadid)\n\t\t{$hook_query_joins}\n\t\tWHERE subscribethread.userid = " . $vbulletin->userinfo['userid'] . "\n\t\t\tAND thread.visible = 1\n\t\t\tAND canview = 1\n\t\t" . iif(!$getallfolders, "\tAND folderid = {$folderid}") . "\n\t\t\t{$hook_query_where}\n\t\tORDER BY {$sqlsortfield} {$sqlsortorder}\n\t\tLIMIT " . ($limitlower - 1) . ", {$perpage}\n\t"); if ($totalthreads = $db->num_rows($getthreads)) { $forumids = array(); $threadids = array(); $emailupdate = array(); $killthreads = array(); while ($getthread = $db->fetch_array($getthreads)) { $forumperms = fetch_permissions($getthread['forumid']); if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) or $getthread['postuserid'] != $vbulletin->userinfo['userid'] and !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers'])) { $killthreads["{$getthread['subscribethreadid']}"] = $getthread['subscribethreadid']; $totalallthreads--; continue; } $forumids["{$getthread['forumid']}"] = true; $threadids[] = $getthread['threadid']; $emailupdate["{$getthread['threadid']}"] = $getthread['emailupdate']; $subscribethread["{$getthread['threadid']}"] = $getthread['subscribethreadid']; } $threadids = implode(',', $threadids); } unset($getthread); $db->free_result($getthreads); if (!empty($killthreads)) { // Update thread subscriptions $vbulletin->db->query_write("\n\t\t\tUPDATE " . TABLE_PREFIX . "subscribethread\n\t\t\tSET canview = 0\n\t\t\tWHERE subscribethreadid IN (" . implode(', ', $killthreads) . ")\n\t\t"); } if (!empty($threadids)) { cache_ordered_forums(1); $colspan = 5; $show['threadicons'] = false; // get last read info for each thread $lastread = array(); foreach (array_keys($forumids) as $forumid) { if ($vbulletin->options['threadmarking']) { $lastread["{$forumid}"] = max($vbulletin->forumcache["{$forumid}"]['forumread'], TIMENOW - $vbulletin->options['markinglimit'] * 86400); } else { $lastread["{$forumid}"] = max(intval(fetch_bbarray_cookie('forum_view', $forumid)), $vbulletin->userinfo['lastvisit']); } if ($vbulletin->forumcache["{$forumid}"]['options'] & $vbulletin->bf_misc_forumoptions['allowicons']) { $show['threadicons'] = true; $colspan = 6; } } if ($previewtype == 1) { $previewfield = "post.pagetext AS preview, post.username AS lastpost_username, post.userid AS lastpost_userid,"; $previewjoin = "LEFT JOIN " . TABLE_PREFIX . "post AS post ON(post.postid = thread.firstpostid)"; } else { $previewfield = "post.pagetext AS preview, post.username AS lastpost_username, post.userid AS lastpost_userid,"; $previewjoin = "LEFT JOIN " . TABLE_PREFIX . "post AS post ON(post.postid = thread.lastpostid)"; } $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; }
{ // draw nav bar $navbits = array(); $navbits[fetch_seo_url('member', $userinfo)] = $userinfo['username']; $navbits[''] = $vbphrase['report_bad_visitor_message']; $navbits = construct_navbits($navbits); $usernamecode = vB_Template::create('newpost_usernamecode')->render(); $navbar = render_navbar_template($navbits); $url =& $vbulletin->url; ($hook = vBulletinHook::fetch_hook('report_form_start')) ? eval($hook) : false; $forminfo = $reportobj->set_forminfo($messageinfo); $templater = vB_Template::create('reportitem'); $templater->register_page_templates(); $templater->register('forminfo', $forminfo); $templater->register('navbar', $navbar); $templater->register('url', $url); $templater->register('usernamecode', $usernamecode); print_output($templater->render()); } if ($_POST['do'] == 'sendemail') { $vbulletin->input->clean_array_gpc('p', array( 'reason' => TYPE_STR, )); if ($vbulletin->GPC['reason'] == '')
/** * Retrieve Activity Stream * */ public function fetchStream($sort = 'recent', $fetchphrase = false) { $this->setWhereFilter('ignoredusers'); $stop = false; $records = array(); /* Fetch more records when we * A. Have not set a 'maxdateline' filter (future request - new activity since page load) * B. Received less than 50% (valid results) of our perpage value * C. Have not requested more than 3 times already */ $iteration = 0; $totalcount = 0; $count = 0; $maxdateline = $mindateline = $minscore = 0; $maxid = $minid_score = $minid_dateline = array(); while (!$stop and $iteration < 4) { $result = $this->fetchRecords($sort); $records = array_merge($records, $result['records']); $totalcount += $result['total']; $count += count($result['records']); $iteration++; if (!$maxdateline) { $maxdateline = $result['maxdateline']; } if ($maxdateline == $result['maxdateline']) { $maxid = $result['maxid']; } if ($sort == 'popular') { if ($minscore != $result['minscore']) { $minid = array(); $minscore = $result['minscore']; } } else { if ($mindateline != $result['mindateline']) { $minid = array(); $mindateline = $result['mindateline']; } } $minid = $result['minid']; if ($count / $this->perpage > 0.5 or $result['total'] < $this->perpage or $this->setFilters['maxdateline']) { $stop = true; } else { if ($sort == 'popular') { $this->setWhereFilter('minscore', $result['minscore']); } else { $this->setWhereFilter('mindateline', $result['mindateline']); } $this->setWhereFilter('excludeid', implode(',', $result['minid'])); } $moreresults = $result['total'] == $this->perpage ? 1 : 0; } $bits = array(); $groupby = array(); $count = 0; foreach ($records as $activity) { $classname = 'vB_ActivityStream_View_Perm_' . ucfirst($activity['section']) . '_' . ucfirst($activity['type']); $class = $this->classes[$classname]; $count++; // Call templater! if ($this->groupBy) { switch ($this->groupBy) { case 'date': default: $foo = vB::$vbulletin->options['yestoday']; vB::$vbulletin->options['yestoday'] = 1; $date = vbdate(vB::$vbulletin->options['dateformat'], $activity['dateline'], true); vB::$vbulletin->options['yestoday'] = $foo; $templatename = 'activitystream_' . $activity['type'] . '_' . $this->groupBy . '_bit'; $groupby[$date] .= $class->fetchTemplate($templatename, $activity, true); } } else { $templatename = 'activitystream_' . $activity['section'] . '_' . $activity['type']; if (!$fetchphrase) { $bits[] = $class->fetchTemplate($templatename, $activity, $sort == 'popular'); } else { $bits[] = $class->fetchPhrase($templatename, $activity, $sort == 'popular'); } } } if ($this->groupBy) { switch ($this->groupBy) { case 'date': default: foreach ($groupby as $date => $bit) { $templater = vB_Template::create('activitystream_' . $this->groupBy . '_group'); $templater->register('activitybits', $bit); $templater->register('date', $date); $bits[] = $templater->render(); } } } if (count($minid) == $this->perpage and vB::$vbulletin->GPC['minid'] and $ids = explode(',', vB::$vbulletin->GPC['minid'])) { $ids = array_map('intval', $ids); $minid = implode(',', array_merge($minid, $ids)); } else { $minid = implode(',', $minid); } $return = array('iteration' => $iteration, 'totalcount' => $totalcount, 'count' => $count, 'mindateline' => $mindateline, 'maxdateline' => $maxdateline, 'minid' => $minid, 'maxid' => implode(',', $maxid), 'moreresults' => $moreresults, 'perpage' => $this->perpage, 'bits' => $bits, 'minscore' => $minscore, 'refresh' => $this->refresh); return $return; }
/** * Fetches the tagbits for display in a thread. * * @param array Tags * * @return string Tag bits, including a none word and progress image */ function fetch_tagbits($tags) { global $vbulletin, $vbphrase, $show, $template_hook; if ($tags) { $tag_array = explode(',', $tags); $tag_list = ''; foreach ($tag_array AS $tag) { $tag = trim($tag); if ($tag === '') { continue; } $tag_url = urlencode(unhtmlspecialchars($tag)); $tag = fetch_word_wrapped_string($tag); ($hook = vBulletinHook::fetch_hook('tag_fetchbit')) ? eval($hook) : false; // $tag_list .= ($tag_list != '' ? ', ' : ''); $templater = vB_Template::create('tagbit'); $templater->register('tag', $tag); $templater->register('tag_url', $tag_url); $tag_list .= trim($templater->render()); } } else { $tag_list = ''; } ($hook = vBulletinHook::fetch_hook('tag_fetchbit_complete')) ? eval($hook) : false; $templater = vB_Template::create('tagbit_wrapper'); $templater->register('tag_list', $tag_list); $wrapped = $templater->render(); return $wrapped; }
/** * Parses the appropriate template for contenttype that is to be updated on the calling window during an upload * * @param array Attachment information * @param array Values array pertaining to contenttype * @param boolean Disable template comments * * @return string */ public function process_display_template($attach, $values = array(), $disablecomment = true) { $attach['extension'] = strtolower(file_extension($attach['filename'])); $attach['filename'] = fetch_censored_text(htmlspecialchars_uni($attach['filename'], false)); $attach['filesize'] = vb_number_format($attach['filesize'], 1, true); $attach['imgpath'] = $this->fetch_imgpath($attach['extension']); $templater = vB_Template::create('newpost_attachmentbit'); $templater->register('attach', $attach); return $templater->render($disablecomment); }
$total = $vbulletin->GPC['total']; require_once(DIR . '/includes/class_xml.php'); $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml'); if (in_array(strtolower($attachmentinfo['extension']), array('jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp'))) { $uniqueid = $vbulletin->GPC['uniqueid']; $imagelink = 'attachment.php?' . $vbulletin->session->vars['sessionurl'] . 'attachmentid=' . $attachmentinfo['attachmentid'] . '&d=' . $attachmentinfo['dateline']; $attachmentinfo['date_string'] = vbdate($vbulletin->options['dateformat'], $attachmentinfo['dateline']); $attachmentinfo['time_string'] = vbdate($vbulletin->options['timeformat'], $attachmentinfo['dateline']); $show['newwindow'] = ($attachmentinfo['newwindow'] ? true : false); ($hook = vBulletinHook::fetch_hook('attachment_lightbox')) ? eval($hook) : false; $templater = vB_Template::create('lightbox'); $templater->register('attachmentinfo', $attachmentinfo); $templater->register('current', $current); $templater->register('first', $first); $templater->register('height', $height); $templater->register('imagelink', $imagelink); $templater->register('last', $last); $templater->register('total', $total); $templater->register('uniqueid', $uniqueid); $templater->register('width', $width); $html = $templater->render(true); $xml->add_group('img'); $xml->add_tag('html', process_replacement_vars($html)); $xml->add_tag('link', $imagelink); $xml->add_tag('name', $attachmentinfo['filename']);
} $navbits = construct_navbits(array('blog.php' . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['blogs'], '' => $vbphrase['tags'])); $navbar = render_navbar_template($navbits); ($hook = vBulletinHook::fetch_hook('blog_tags_cloud_complete')) ? eval($hook) : false; if ($userinfo) { $sidebar =& build_user_sidebar($userinfo); } else { $sidebar =& build_overview_sidebar(); } $templater = vB_Template::create('blog_tag_cloud'); $templater->register('tag_cloud', $tag_cloud); $templater->register('tag_delimiters', $tag_delimiters); $templater->register('userinfo', $userinfo); $content = $templater->render(); $headinclude .= vB_Template::create('blog_css')->render(); $templater = vB_Template::create('BLOG'); $templater->register_page_templates(); $templater->register('abouturl', $abouturl); $templater->register('blogheader', $blogheader); $templater->register('bloginfo', $bloginfo); $templater->register('blogrssinfo', $blogrssinfo); $templater->register('bloguserid', $bloguserid); $templater->register('content', $content); $templater->register('navbar', $navbar); $templater->register('onload', $onload); $templater->register('pagetitle', $pagetitle); $templater->register('pingbackurl', $pingbackurl); $templater->register('sidebar', $sidebar); $templater->register('trackbackurl', $trackbackurl); $templater->register('usercss_profile_preview', $usercss_profile_preview); print_output($templater->render());
$templater->register('tag_list', $tag_list); $templater->register('template_hook', $template_hook); $templater->register('thread', $thread); $templater->register('threadadmin_imod_menu_post', $threadadmin_imod_menu_post); $templater->register('threadid', $threadid); $templater->register('threadinfo', $threadinfo); $templater->register('threadlist', $threadlist); $templater->register('totalonline', $totalonline); $templater->register('url', $url); $templater->register('thread_url', $thread_url); $templater->register('votechecked', $votechecked); $templater->register('voteselected', $voteselected); $templater->register('fbpublishcheckbox', $fbpublishcheckbox); $templater->register('fblikebutton', $fblikebutton); if ($show['quickedit'] and !$show['quickreply']) { $templater->register('editor_clientscript', vB_Template::create('editor_clientscript')->render()); $templater->register('editor_js', vB_Ckeditor::getJsIncludes()); } $templater->register('wrt', $wrt); $templater->register('wrtlist', $wrtlist); print_output($templater->render()); function goto_prevthread($threadid, $throwerror = true) { global $vbulletin; $thread = verify_id('thread', $threadid, $throwerror, 1); $forumperms = fetch_permissions($thread['forumid']); // remove threads from users on the global ignore list if user is not a moderator if ($coventry = fetch_coventry('string') and !can_moderate($thread['forumid'])) { $globalignore = "AND postuserid NOT IN ({$coventry})"; } else { $globalignore = '';
/** * Generates HTML for the subscription form page * * @param string Hash used to indicate the transaction within vBulletin * @param string The cost of this payment * @param string The currency of this payment * @param array Information regarding the subscription that is being purchased * @param array Information about the user who is purchasing this subscription * @param array Array containing specific data about the cost and time for the specific subscription period * * @return array Compiled form information */ function generate_form_html($hash, $cost, $currency, $subinfo, $userinfo, $timeinfo) { global $vbphrase, $vbulletin, $show; $form['action'] = 'https://bill.ccbill.com/jpost/signup.cgi'; $form['method'] = 'post'; // load settings into array so the template system can access them $settings =& $this->settings; $settings['email'] = htmlspecialchars_uni($this->registry->userinfo['email']); $subinfo['ccbillsubid'] = $timeinfo['ccbillsubid']; $templater = vB_Template::create('subscription_payment_ccbill'); $templater->register('hash', $hash); $templater->register('settings', $settings); $templater->register('subinfo', $subinfo); $form['hiddenfields'] .= $templater->render(); return $form; }