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(); } }
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(); } }
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(); } }
/** * Prepares a picture array for thumbnail display. * * @param array Array of picture info * * @return array Array of picture info modified */ function prepare_pictureinfo_thumb($pictureinfo) { global $vbulletin; $pictureinfo['caption_preview'] = fetch_censored_text(fetch_trimmed_title($pictureinfo['caption'], $vbulletin->options['album_captionpreviewlen'])); $pictureinfo['dimensions'] = $pictureinfo['thumbnail_width'] ? "width=\"{$pictureinfo['thumbnail_width']}\" height=\"{$pictureinfo['thumbnail_height']}\"" : ''; $pictureinfo['date'] = vbdate($vbulletin->options['dateformat'], $pictureinfo['dateline'], true); $pictureinfo['time'] = vbdate($vbulletin->options['timeformat'], $pictureinfo['dateline']); return $pictureinfo; }
function mobiquo_chop($string) { global $stylevar, $vbulletin; $string = preg_replace('/<br \\/\\>/', '', $string); $string = preg_replace('/(^\\s+)|(\\s+$)/', '', $string); $string = preg_replace('/\\n/', '', $string); $string = preg_replace('/\\r/', '', $string); $string = strip_quotes($string); $string = htmlspecialchars_uni(fetch_censored_text(fetch_trimmed_title(strip_bbcode($string, false, true), 200))); return $string; }
/** * Prepares a picture array for thumbnail display. * * @param array Array of picture info * @param array Container info (either for a group or album); changes thumbnail URL * * @return array Array of picture info modified */ function prepare_pictureinfo_thumb($pictureinfo, $displaytypeinfo) { global $vbulletin; $pictureinfo['caption_preview'] = fetch_censored_text(fetch_trimmed_title($pictureinfo['caption'], $vbulletin->options['album_captionpreviewlen'])); $pictureinfo['thumburl'] = $pictureinfo['thumbnail_filesize'] ? fetch_picture_url($pictureinfo, $displaytypeinfo, true) : ''; $pictureinfo['dimensions'] = $pictureinfo['thumbnail_width'] ? "width=\"{$pictureinfo['thumbnail_width']}\" height=\"{$pictureinfo['thumbnail_height']}\"" : ''; $pictureinfo['date'] = vbdate($vbulletin->options['dateformat'], $pictureinfo['dateline'], true); $pictureinfo['time'] = vbdate($vbulletin->options['dateformat'], $pictureinfo['dateline']); ($hook = vBulletinHook::fetch_hook('album_prepare_thumb')) ? eval($hook) : false; return $pictureinfo; }
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 fetchTemplate($templatename, $activity, $skipgroup = false, $fetchphrase = false) { global $show; $postinfo =& $this->content['post'][$activity['contentid']]; $threadinfo =& $this->content['thread'][$postinfo['threadid']]; $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']); $preview = strip_quotes($postinfo['pagetext']); $postinfo['preview'] = htmlspecialchars_uni(fetch_censored_text(fetch_trimmed_title(strip_bbcode($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'], $postinfo['username']); if ($fetchphrase) { if ($threadinfo['pollid']) { if ($userinfo['userid']) { $phrase = construct_phrase($this->vbphrase['x_replied_to_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_replied_to_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_replied_to_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_replied_to_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('postinfo', $postinfo); $templater->register('pageinfo', array('p' => $postinfo['postid'])); $templater->register('foruminfo', $foruminfo); return $templater->render(); } }
function convert_ids_to_titles() { global $vbulletin; global $albumids, $attachmentids, $calendarids, $eventids, $forumids, $infractionids, $pmids, $postids, $searchids, $socialgroupids, $threadids, $userids; global $wol_album, $wol_attachment, $wol_calendar, $wol_event, $wol_inf, $wol_pm, $wol_post, $wol_search, $wol_socialgroup, $wol_thread, $wol_user; if ($attachmentids) { $postidquery = $vbulletin->db->query_read_slave("\n\t\t\tSELECT postid, attachmentid\n\t\t\tFROM " . TABLE_PREFIX . "attachment\n\t\t\tWHERE attachmentid IN (0{$attachmentids})\n\t\t"); while ($postidqueryr = $vbulletin->db->fetch_array($postidquery)) { $postids .= ',' . $postidqueryr['postid']; $wol_attachment["{$postidqueryr['attachmentid']}"] = $postidqueryr['postid']; } } if ($postids) { $postidquery = $vbulletin->db->query_read_slave("\n\t\t\tSELECT threadid, postid\n\t\t\tFROM " . TABLE_PREFIX . "post\n\t\t\tWHERE postid IN (0{$postids})\n\t\t"); while ($postidqueryr = $vbulletin->db->fetch_array($postidquery)) { $threadids .= ',' . $postidqueryr['threadid']; $wol_post["{$postidqueryr['postid']}"] = $postidqueryr['threadid']; } } if ($socialgroupids) { $socialgroups = $vbulletin->db->query_read_slave("\n\t\t\tSELECT name, groupid\n\t\t\tFROM " . TABLE_PREFIX . "socialgroup\n\t\t\tWHERE groupid IN (0{$socialgroupids})\n\t\t"); while ($socialgroup = $vbulletin->db->fetch_array($socialgroups)) { $wol_socialgroup["{$socialgroup['groupid']}"]['name'] = $socialgroup['name']; } } if ($albumids) { $albums = $vbulletin->db->query_read_slave("\n\t\t\tSELECT title, albumid, state, userid\n\t\t\tFROM " . TABLE_PREFIX . "album\n\t\t\tWHERE albumid IN (0{$albumids})\n\t\t"); while ($album = $vbulletin->db->fetch_array($albums)) { $wol_album["{$album['albumid']}"] = $album; } } if ($threadids) { $threadresults = $vbulletin->db->query_read_slave("\n\t\t\tSELECT thread.title, thread.prefixid, thread.threadid, thread.forumid, thread.postuserid, thread.visible\n\t\t\t" . iif($vbulletin->options['threadpreview'] > 0, ",post.pagetext AS preview") . "\n\t\t\t" . iif($vbulletin->options['threadsubscribed'] and $vbulletin->userinfo['userid'], ", NOT ISNULL(subscribethread.subscribethreadid) AS issubscribed") . "\n\t\t\tFROM " . TABLE_PREFIX . "thread AS thread\n\t\t\t" . iif($vbulletin->options['threadpreview'] > 0, "LEFT JOIN " . TABLE_PREFIX . "post AS post ON(post.postid = thread.firstpostid)") . "\n\t\t\t" . iif($vbulletin->options['threadsubscribed'] and $vbulletin->userinfo['userid'], " LEFT JOIN " . TABLE_PREFIX . "subscribethread AS subscribethread ON(subscribethread.threadid = thread.threadid AND subscribethread.userid = " . $vbulletin->userinfo['userid'] . " AND canview = 1)") . "\n\t\t\tWHERE thread.threadid IN (0{$threadids})\n\t\t"); while ($threadresult = $vbulletin->db->fetch_array($threadresults)) { $wol_thread["{$threadresult['threadid']}"]['title'] = $threadresult['title']; $wol_thread["{$threadresult['threadid']}"]['prefixid'] = $threadresult['prefixid']; $wol_thread["{$threadresult['threadid']}"]['forumid'] = $threadresult['forumid']; $wol_thread["{$threadresult['threadid']}"]['postuserid'] = $threadresult['postuserid']; $wol_thread["{$threadresult['threadid']}"]['isdeleted'] = $threadresult['visible'] == 2 ? true : false; $wol_thread["{$threadresult['threadid']}"]['visible'] = $threadresult['visible'] == 1 ? true : false; $wol_thread["{$threadresult['threadid']}"]['issubscribed'] = $threadresult['issubscribed']; // format thread preview if there is one $userperms = fetch_permissions($threadresult['forumid']); if (!empty($threadresult['preview']) and $vbulletin->options['threadpreview'] > 0 and $userperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) { // 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))); if (!$ignore["{$threadresult['postuserid']}"]) { $threadresult['preview'] = strip_quotes($threadresult['preview']); $threadresult['preview'] = htmlspecialchars_uni(strip_bbcode(fetch_trimmed_title($threadresult['preview'], $vbulletin->options['threadpreview']), false, true)); $wol_thread["{$threadresult['threadid']}"]['preview'] = $threadresult['preview']; } } } } if ($calendarids) { $calendarresults = $vbulletin->db->query_read_slave("\n\t\t\tSELECT calendarid, title\n\t\t\tFROM " . TABLE_PREFIX . "calendar\n\t\t\tWHERE calendarid IN (0{$calendarids})\n\t\t"); while ($calendarresult = $vbulletin->db->fetch_array($calendarresults)) { $wol_calendar["{$calendarresult['calendarid']}"] = $calendarresult['title']; } } if ($infractionids) { $infractions = $vbulletin->db->query_read_slave("\n\t\t\tSELECT infractionid, userid\n\t\t\tFROM " . TABLE_PREFIX . "infraction\n\t\t\tWHERE infractionid IN (0{$infractionids})\n\t\t"); while ($infraction = $vbulletin->db->fetch_array($infractions)) { $wol_inf["{$infraction['infractionid']}"]['userid'] = $infraction['userid']; $userids .= ',' . $infraction['userid']; } } if ($eventids) { $eventresults = $vbulletin->db->query_read_slave("\n\t\t\tSELECT eventid, title, userid, calendarid\n\t\t\tFROM " . TABLE_PREFIX . "event\n\t\t\tWHERE eventid IN (0{$eventids})\n\t\t"); while ($eventresult = $vbulletin->db->fetch_array($eventresults)) { $wol_event["{$eventresult['eventid']}"]['title'] = $eventresult['title']; $wol_event["{$eventresult['eventid']}"]['calendarid'] = $eventresult['calendarid']; $wol_event["{$eventresult['eventid']}"]['postuserid'] = $eventresult['userid']; } } if ($pmids and $vbulletin->userinfo['permissions']['wolpermissions'] & $vbulletin->bf_ugp_wolpermissions['canwhosonlinefull']) { $pmresults = $vbulletin->db->query_read_slave("\n\t\t\tSELECT pmtext.fromuserid, pm.pmid\n\t\t\tFROM " . TABLE_PREFIX . "pm AS pm\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "pmtext AS pmtext ON (pm.pmtextid = pmtext.pmtextid)\n\t\t\tWHERE pmid IN (0{$pmids})\n\t\t\t"); while ($pmresult = $vbulletin->db->fetch_array($pmresults)) { $wol_pm["{$pmresult['pmid']}"] = $pmresult['fromuserid']; $userids .= ',' . intval($pmresult['fromuserid']); } } if ($searchids and $vbulletin->userinfo['permissions']['wolpermissions'] & $vbulletin->bf_ugp_wolpermissions['canwhosonlinefull']) { $searchresults = $vbulletin->db->query_read_slave("\n\t\t\tSELECT searchid, search.userid, query, searchuser, user.userid AS targetuserid\n\t\t\tFROM " . TABLE_PREFIX . "search AS search\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.username = search.searchuser)\n\t\t\tWHERE searchid IN (0{$searchids})\n\t\t"); while ($searchresult = $vbulletin->db->fetch_array($searchresults)) { if ($searchresult['searchuser']) { if (!$searchresult['targetuserid']) { $result = $vbulletin->db->query_first_slave("\n\t\t\t\t\t\tSELECT userid AS targetuserid\n\t\t\t\t\t\tFROM " . TABLE_PREFIX . "user\n\t\t\t\t\t\tWHERE username = '******'searchuser'])) . "'\n\t\t\t\t\t"); } if ($result['targetuserid']) { $searchresult['targetuserid'] = $result['targetuserid']; } if ($searchresult['targetuserid']) { $userids .= ",{$searchresult['targetuserid']}"; } } $wol_search["{$searchresult['searchid']}"] = $searchresult; } } if ($userids and $vbulletin->userinfo['permissions']['wolpermissions'] & $vbulletin->bf_ugp_wolpermissions['canwhosonlinefull']) { $userresults = $vbulletin->db->query_read_slave("\n\t\t\tSELECT userid, username, IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid\n\t\t\tFROM " . TABLE_PREFIX . "user AS user\n\t\t\tWHERE userid IN (0{$userids})\n\t\t"); while ($userresult = $vbulletin->db->fetch_array($userresults)) { fetch_musername($userresult); $wol_user["{$userresult['userid']}"] = $userresult['musername']; } } ($hook = vBulletinHook::fetch_hook('online_ids_titles')) ? eval($hook) : false; }
$forum_active_cache["{$current_forum['forumid']}"] = true; $current_forum = $vbulletin->forumcache["{$current_forum['parentid']}"]; } } if (!$forum_active_cache["{$simthread['forumid']}"]) { continue; } $fperms = fetch_permissions($simthread['forumid']); if ($fperms & $vbulletin->bf_ugp_forumpermissions['canview'] and ($fperms & $vbulletin->bf_ugp_forumpermissions['canviewothers'] or $vbulletin->userinfo['userid'] != 0 and $simthread['postuserid'] == $vbulletin->userinfo['userid'])) { // format thread preview if there is one if (isset($ignore["{$simthread['postuserid']}"])) { $simthread['preview'] = ''; } else { if (isset($simthread['preview']) and $vbulletin->options['threadpreview'] > 0) { $simthread['preview'] = strip_quotes($simthread['preview']); $simthread['preview'] = htmlspecialchars_uni(fetch_trimmed_title(strip_bbcode($simthread['preview'], false, true), $vbulletin->options['threadpreview'])); } } $simthread['lastreplydate'] = vbdate($vbulletin->options['dateformat'], $simthread['lastpost'], true); $simthread['lastreplytime'] = vbdate($vbulletin->options['timeformat'], $simthread['lastpost']); if ($simthread['prefixid']) { $simthread['prefix_plain_html'] = htmlspecialchars_uni($vbphrase["prefix_{$simthread['prefixid']}_title_plain"]); $simthread['prefix_rich'] = $vbphrase["prefix_{$simthread['prefixid']}_title_rich"]; } else { $simthread['prefix_plain_html'] = ''; $simthread['prefix_rich'] = ''; } $simthread['title'] = fetch_censored_text($simthread['title']); ($hook = vBulletinHook::fetch_hook('showthread_similarthreadbit')) ? eval($hook) : false; $templater = vB_Template::create('showthread_similarthreadbit'); $templater->register('simthread', $simthread);
$first = $itemcount + 1; if ($db->num_rows($getevents)) { $show['haveevents'] = true; while ($event = $db->fetch_array($getevents)) { if (empty($reminders["{$event['reminder']}"])) { $event['reminder'] = 3600; } $event['reminder'] = $vbphrase[$reminders[$event['reminder']]]; $offset = $event['dst'] ? $vbulletin->userinfo['timezoneoffset'] : $vbulletin->userinfo['tzoffset']; $event = array_merge($event, convert_bits_to_array($event['options'], $vbulletin->bf_misc_useroptions)); $event = array_merge($event, convert_bits_to_array($event['adminoptions'], $vbulletin->bf_misc_adminoptions)); cache_permissions($event, false); fetch_avatar_from_userinfo($event, true); $event['dateline_from_user'] = $event['dateline_from'] + $offset * 3600; $event['dateline_to_user'] = $event['dateline_to'] + $offset * 3600; $event['preview'] = htmlspecialchars_uni(strip_bbcode(fetch_trimmed_title(strip_quotes($event['event']), 300), false, true)); $event = fetch_event_date_time($event); $event['calendar'] = $calendarcache["{$event['calendarid']}"]; $show['singleday'] = !empty($event['singleday']) ? true : false; ($hook = vBulletinHook::fetch_hook('calendar_viewreminder_event')) ? eval($hook) : false; $oppositesort = $sortorder == 'asc' ? 'desc' : 'asc'; $templater = vB_Template::create('calendar_reminder_eventbit'); $templater->register('date1', $date1); $templater->register('date2', $date2); $templater->register('daterange', $daterange); $templater->register('event', $event); $templater->register('eventdate', $eventdate); $templater->register('recurcriteria', $recurcriteria); $templater->register('time1', $time1); $templater->register('time2', $time2); $eventbits .= $templater->render();
/** * Takes information regardign a group, and prepares the information within it * for display * * @param array Group Array * @param bool Whether to fetch group members and avatars * * @return array Group Array with prepared information * */ function prepare_socialgroup($group, $fetchmembers = false) { global $vbulletin; if (!is_array($group)) { return array(); } if ($fetchmembers) { $membersinfo = cache_group_members(); $group['membersinfo'] = $membersinfo[$group['groupid']]; } $group['joindate'] = !empty($group['joindate']) ? vbdate($vbulletin->options['dateformat'], $group['joindate'], true) : ''; $group['createtime'] = !empty($group['createdate']) ? vbdate($vbulletin->options['timeformat'], $group['createdate'], true) : ''; $group['createdate'] = !empty($group['createdate']) ? vbdate($vbulletin->options['dateformat'], $group['createdate'], true) : ''; $group['lastupdatetime'] = !empty($group['lastupdate']) ? vbdate($vbulletin->options['timeformat'], $group['lastupdate'], true) : ''; $group['lastupdatedate'] = !empty($group['lastupdate']) ? vbdate($vbulletin->options['dateformat'], $group['lastupdate'], true) : ''; $group['visible'] = vb_number_format($group['visible']); $group['moderation'] = vb_number_format($group['moderation']); $group['members'] = vb_number_format($group['members']); $group['moderatedmembers'] = vb_number_format($group['moderatedmembers']); $group['categoryname'] = htmlspecialchars_uni($group['categoryname']); $group['discussions'] = vb_number_format($group['discussions']); $group['lastdiscussion'] = fetch_word_wrapped_string(fetch_censored_text($group['lastdiscussion'])); $group['trimdiscussion'] = fetch_trimmed_title($group['lastdiscussion']); if (!($group['options'] & $vbulletin->bf_misc_socialgroupoptions['enable_group_albums'])) { // albums disabled in this group - force 0 pictures $group['picturecount'] = 0; } $group['rawpicturecount'] = $group['picturecount']; $group['picturecount'] = vb_number_format($group['picturecount']); $group['rawname'] = $group['name']; $group['rawdescription'] = $group['description']; $group['name'] = fetch_word_wrapped_string(fetch_censored_text($group['name'])); if ($group['description']) { $group['shortdescription'] = fetch_word_wrapped_string(fetch_censored_text(fetch_trimmed_title($group['description'], 185))); } else { $group['shortdescription'] = $group['name']; } $group['mediumdescription'] = fetch_word_wrapped_string(fetch_censored_text(fetch_trimmed_title($group['description'], 1000))); $group['description'] = nl2br(fetch_word_wrapped_string(fetch_censored_text($group['description']))); $group['is_owner'] = $group['creatoruserid'] == $vbulletin->userinfo['userid']; $group['is_automoderated'] = ($group['options'] & $vbulletin->bf_misc_socialgroupoptions['owner_mod_queue'] and $vbulletin->options['sg_allow_owner_mod_queue'] and !$vbulletin->options['social_moderation']); $group['canviewcontent'] = (!($group['options'] & $vbulletin->bf_misc_socialgroupoptions['join_to_view']) or !$vbulletin->options['sg_allow_join_to_view'] or $group['membertype'] == 'member' or can_moderate(0, 'canmoderategroupmessages') or can_moderate(0, 'canremovegroupmessages') or can_moderate(0, 'candeletegroupmessages') or fetch_socialgroup_perm('canalwayspostmessage') or fetch_socialgroup_perm('canalwascreatediscussion')); $group['lastpostdate'] = vbdate($vbulletin->options['dateformat'], $group['lastpost'], true); $group['lastposttime'] = vbdate($vbulletin->options['timeformat'], $group['lastpost']); $group['lastposterid'] = $group['canviewcontent'] ? $group['lastposterid'] : 0; $group['lastposter'] = $group['canviewcontent'] ? $group['lastposter'] : ''; // check read marking //remove notice and make readtime determination a bit more clear if (!empty($group['readtime'])) { $readtime = $group['readtime']; } else { $readtime = fetch_bbarray_cookie('group_marking', $group['groupid']); if (!$readtime) { $readtime = $vbulletin->userinfo['lastvisit']; } } // get thumb url $group['iconurl'] = fetch_socialgroupicon_url($group, true); // check if social group is moderated to join $group['membermoderated'] = 'moderated' == $group['type']; // posts older than markinglimit days won't be highlighted as new $oldtime = TIMENOW - $vbulletin->options['markinglimit'] * 24 * 60 * 60; $readtime = max((int) $readtime, $oldtime); $group['readtime'] = $readtime; $group['is_read'] = $readtime >= $group['lastpost']; // Legacy Hook 'group_prepareinfo' Removed // return $group; }
function construct_forum_bit($parentid, $depth = 0, $subsonly = 0) { global $vbulletin, $vbphrase, $show; global $imodcache, $lastpostarray, $counters, $inforum; // this function takes the constant MAXFORUMDEPTH as its guide for how // deep to recurse down forum lists. if MAXFORUMDEPTH is not defined, // it will assume a depth of 2. // call fetch_last_post_array() first to get last post info for forums if (!is_array($lastpostarray)) { fetch_last_post_array($parentid); } if (empty($vbulletin->iforumcache["{$parentid}"])) { return; } if (!defined('MAXFORUMDEPTH')) { define('MAXFORUMDEPTH', 2); } $forumbits = ''; $depth++; if ($parentid == -1) { $parent_is_category = false; } else { $parentforum = $vbulletin->forumcache[$parentid]; $parent_is_category = !(bool) ($parentforum['options'] & $vbulletin->bf_misc_forumoptions['cancontainthreads']); } foreach ($vbulletin->iforumcache["{$parentid}"] as $forumid) { // grab the appropriate forum from the $vbulletin->forumcache $forum = $vbulletin->forumcache["{$forumid}"]; //$lastpostforum = $vbulletin->forumcache["$lastpostarray[$forumid]"]; $lastpostforum = empty($lastpostarray[$forumid]) ? array() : $vbulletin->forumcache["{$lastpostarray[$forumid]}"]; if (!$forum['displayorder'] or !($forum['options'] & $vbulletin->bf_misc_forumoptions['active'])) { continue; } $forumperms = $vbulletin->userinfo['forumpermissions']["{$forumid}"]; $lastpostforumperms = empty($lastpostarray[$forumid]) ? 0 : $vbulletin->userinfo['forumpermissions']["{$lastpostarray[$forumid]}"]; if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) and ($vbulletin->forumcache["{$forumid}"]['showprivate'] == 1 or !$vbulletin->forumcache["{$forumid}"]['showprivate'] and !$vbulletin->options['showprivateforums'])) { // no permission to view current forum continue; } if ($subsonly) { $childforumbits = construct_forum_bit($forum['forumid'], 1, $subsonly); } else { if ($depth < MAXFORUMDEPTH) { $childforumbits = construct_forum_bit($forum['forumid'], $depth, $subsonly); } else { $childforumbits = ''; } } // do stuff if we are not doing subscriptions only, or if we ARE doing subscriptions, // and the forum has a subscribedforumid if (!$subsonly or $subsonly and !empty($forum['subscribeforumid'])) { $GLOBALS['forumshown'] = true; // say that we have shown at least one forum if ($forum['options'] & $vbulletin->bf_misc_forumoptions['cancontainthreads']) { // get appropriate suffix for template name $tempext = '_post'; } else { $tempext = '_nopost'; } if (!$vbulletin->options['showforumdescription']) { // blank forum description if set to not show $forum['description'] = ''; } // dates & thread title $lastpostinfo = empty($lastpostarray["{$forumid}"]) ? array() : $vbulletin->forumcache["{$lastpostarray[$forumid]}"]; // compare last post time for this forum with the last post time specified by // the $lastpostarray, and if it's less, use the last post info from the forum // specified by $lastpostarray if (!empty($lastpostinfo) and $vbulletin->forumcache["{$lastpostarray[$forumid]}"]['lastpost'] > 0) { if (!($lastpostforumperms & $vbulletin->bf_ugp_forumpermissions['canview']) or !($lastpostforumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) and $lastpostinfo['lastposter'] != $vbulletin->userinfo['username']) { $forum['lastpostinfo'] = $vbphrase['private']; } else { $lastpostinfo['lastpostdate'] = vbdate($vbulletin->options['dateformat'], $lastpostinfo['lastpost'], 1); $lastpostinfo['lastposttime'] = vbdate($vbulletin->options['timeformat'], $lastpostinfo['lastpost']); $lastpostinfo['trimthread'] = fetch_trimmed_title(fetch_censored_text($lastpostinfo['lastthread'])); if ($lastpostinfo['lastprefixid'] and $vbulletin->options['showprefixlastpost']) { $lastpostinfo['prefix'] = $vbulletin->options['showprefixlastpost'] == 2 ? $vbphrase["prefix_{$lastpostinfo['lastprefixid']}_title_rich"] : htmlspecialchars_uni($vbphrase["prefix_{$lastpostinfo['lastprefixid']}_title_plain"]); } else { $lastpostinfo['prefix'] = ''; } if ($vbulletin->forumcache["{$lastpostforum['forumid']}"]['options'] & $vbulletin->bf_misc_forumoptions['allowicons'] and $icon = fetch_iconinfo($lastpostinfo['lasticonid'])) { $show['icon'] = true; } else { $show['icon'] = false; } $show['lastpostinfo'] = (!$lastpostforum['password'] or verify_forum_password($lastpostforum['forumid'], $lastpostforum['password'], false)); $pageinfo_lastpost = array('p' => $lastpostinfo['lastpostid']); $pageinfo_newpost = array('goto' => 'newpost'); $threadinfo = array('title' => $lastpostinfo['lastthread'], 'threadid' => $lastpostinfo['lastthreadid']); // prepare the member action drop-down menu $memberaction_dropdown = construct_memberaction_dropdown(fetch_lastposter_userinfo($lastpostinfo)); $templater = vB_Template::create('forumhome_lastpostby'); $templater->register('icon', $icon); $templater->register('memberaction_dropdown', $memberaction_dropdown); $templater->register('lastpostinfo', $lastpostinfo); $templater->register('pageinfo_lastpost', $pageinfo_lastpost); $templater->register('pageinfo_newpost', $pageinfo_newpost); $templater->register('threadinfo', $threadinfo); $forum['lastpostinfo'] = $templater->render(); } } else { if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview'])) { $forum['lastpostinfo'] = $vbphrase['private']; } else { $forum['lastpostinfo'] = $vbphrase['never']; } } // do light bulb $forum['statusicon'] = fetch_forum_lightbulb($forumid, $lastpostinfo, $forum); // add lock to lightbulb if necessary // from 3.6.9 & 3.7.0 we now show locks only if a user can not post AT ALL // previously it was just if they could not create new threads if ($vbulletin->options['showlocks'] and !$forum['link'] and (!($forum['options'] & $vbulletin->bf_misc_forumoptions['allowposting']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canpostnew']) and !($forumperms & $vbulletin->bf_ugp_forumpermissions['canreplyown']) and !($forumperms & $vbulletin->bf_ugp_forumpermissions['canreplyothers']))) { $forum['statusicon'] .= '_lock'; } // get posting permissions $forum['allowposting'] = true; if (!($forum['options'] & $vbulletin->bf_misc_forumoptions['allowposting'])) { $forum['allowposting'] = false; } // get counters from the counters cache ( prepared by fetch_last_post_array() ) $forum['threadcount'] = $counters["{$forum['forumid']}"]['threadcount']; $forum['replycount'] = $counters["{$forum['forumid']}"]['replycount']; // get moderators ( this is why we needed cache_moderators() ) if ($vbulletin->options['showmoderatorcolumn']) { $clc = 0; $showmods = array(); $forum['moderators'] = array(); $listexploded = explode(',', $forum['parentlist']); foreach ($listexploded as $parentforumid) { if (!isset($imodcache["{$parentforumid}"]) or $parentforumid == -1) { continue; } foreach ($imodcache["{$parentforumid}"] as $moderator) { if (isset($showmods["{$moderator['userid']}"])) { continue; } ($hook = vBulletinHook::fetch_hook('forumbit_moderator')) ? eval($hook) : false; $clc++; $showmods["{$moderator['userid']}"] = true; $moderator['comma'] = $vbphrase['comma_space']; $forum['moderators'][$clc] = $moderator; } } // Last element if ($clc) { $forum['moderators'][$clc]['comma'] = ''; } } if ($forum['link']) { $forum['replycount'] = '-'; $forum['threadcount'] = '-'; $forum['lastpostinfo'] = '-'; } else { $forum['replycount'] = vb_number_format($forum['replycount']); $forum['threadcount'] = vb_number_format($forum['threadcount']); } $subforums = array(); if (($subsonly or $depth == MAXFORUMDEPTH) and $vbulletin->options['subforumdepth'] > 0) { $subforums = construct_subforum_bit($forumid); $clc = sizeof($subforums); // Last element if ($clc) { $subforums[$clc - 1]['comma'] = ''; } } $forum['browsers'] = 0; $children = explode(',', $forum['childlist']); foreach ($children as $childid) { $forum['browsers'] += isset($inforum["{$childid}"]) ? $inforum["{$childid}"] : 0; } if ($depth == 1 and $tempext == '_nopost') { global $vbcollapse; $collapseobj_forumid =& $vbcollapse["collapseobj_forumbit_{$forumid}"]; $collapseimg_forumid =& $vbcollapse["collapseimg_forumbit_{$forumid}"]; $show['collapsebutton'] = true; } else { $show['collapsebutton'] = false; } $show['forumsubscription'] = !empty($forum['subscribeforumid']); $show['forumdescription'] = $forum['description'] != '' ? true : false; $show['subforums'] = !empty($subforums) ? true : false; $show['browsers'] = ($vbulletin->options['displayloggedin'] and !$forum['link'] and $forum['browsers'] ? true : false); if ($show['subforums']) { $templater = vB_Template::create("forumhome_subforums"); $templater->register('subforums', $subforums); $forum['subforums'] = $templater->render(); } $perms = fetch_permissions($forumid, 0, array('userid' => 0, 'usergroupid' => 1), false); // VBIV-14011, Always skip Calendar Permissions $show['externalrss'] = ($vbulletin->options['externalrss'] and $perms & $vbulletin->bf_ugp_forumpermissions['canviewthreads'] and $perms & $vbulletin->bf_ugp_forumpermissions['canviewothers']); // build the template for the current forum ($hook = vBulletinHook::fetch_hook('forumbit_display')) ? eval($hook) : false; $templater = vB_Template::create("forumhome_forumbit_level{$depth}{$tempext}"); $templater->register('childforumbits', $childforumbits); $templater->register('collapseimg_forumid', $collapseimg_forumid); $templater->register('collapseobj_forumid', $collapseobj_forumid); $templater->register('forum', $forum); $templater->register('forumid', $forumid); $templater->register('parent_is_category', $parent_is_category); $forumbits .= $templater->render(); } else { $forumbits .= $childforumbits; } } return $forumbits; }
function do_get_thread() { global $vbulletin, $db, $foruminfo, $threadinfo, $postid, $vault, $vbphrase; $vbulletin->input->clean_array_gpc('r', array('pagenumber' => TYPE_UINT, 'perpage' => TYPE_UINT, 'password' => TYPE_STR, 'signature' => TYPE_BOOL)); if (empty($threadinfo['threadid'])) { json_error(ERR_INVALID_THREAD); } $threadedmode = 0; $threadid = $vbulletin->GPC['threadid']; // Goto first unread post? if ($vbulletin->GPC['pagenumber'] == FR_LAST_POST) { $threadinfo = verify_id('thread', $threadid, 1, 1); if ($vbulletin->options['threadmarking'] and $vbulletin->userinfo['userid']) { $vbulletin->userinfo['lastvisit'] = max($threadinfo['threadread'], $threadinfo['forumread'], TIMENOW - $vbulletin->options['markinglimit'] * 86400); } else { if (($tview = intval(fetch_bbarray_cookie('thread_lastview', $threadid))) > $vbulletin->userinfo['lastvisit']) { $vbulletin->userinfo['lastvisit'] = $tview; } } $coventry = fetch_coventry('string'); $posts = $db->query_first("\n\t SELECT MIN(postid) AS postid\n\t FROM " . TABLE_PREFIX . "post\n\t WHERE threadid = {$threadinfo['threadid']}\n\t AND visible = 1\n\t AND dateline > " . intval($vbulletin->userinfo['lastvisit']) . "\n\t " . ($coventry ? "AND userid NOT IN ({$coventry})" : "") . "\n\t LIMIT 1\n\t"); if ($posts['postid']) { $postid = $posts['postid']; } else { $postid = $threadinfo['lastpostid']; } } // ********************************************************************************* // workaround for header redirect issue from forms with enctype in IE // (use a scrollIntoView javascript call in the <body> onload event) $onload = ''; // ********************************************************************************* // set $perpage $perpage = max(FR_MIN_PERPAGE, min($vbulletin->GPC['perpage'], FR_MAX_PERPAGE)); // FRNR //$perpage = sanitize_maxposts($vbulletin->GPC['perpage']); // ********************************************************************************* // set post order if ($vbulletin->userinfo['postorder'] == 0) { $postorder = ''; } else { $postorder = 'DESC'; } // ********************************************************************************* // get thread info $thread = verify_id('thread', $threadid, 1, 1); $threadinfo =& $thread; ($hook = vBulletinHook::fetch_hook('showthread_getinfo')) ? eval($hook) : false; // ********************************************************************************* // check for visible / deleted thread if (!$thread['visible'] and !can_moderate($thread['forumid'], 'canmoderateposts') or $thread['isdeleted'] and !can_moderate($thread['forumid'])) { json_error(ERR_INVALID_THREAD); } // ********************************************************************************* // Tachy goes to coventry if (in_coventry($thread['postuserid']) and !can_moderate($thread['forumid'])) { json_error(ERR_INVALID_THREAD); } // FRNR Start // Check the forum password (set necessary cookies) if ($vbulletin->GPC['password'] && $foruminfo['password'] == $vbulletin->GPC['password']) { // set a temp cookie for guests if (!$vbulletin->userinfo['userid']) { set_bbarray_cookie('forumpwd', $foruminfo['forumid'], md5($vbulletin->userinfo['userid'] . $vbulletin->GPC['password'])); } else { set_bbarray_cookie('forumpwd', $foruminfo['forumid'], md5($vbulletin->userinfo['userid'] . $vbulletin->GPC['password']), 1); } } // FRNR End // ********************************************************************************* // do word wrapping for the thread title if ($vbulletin->options['wordwrap'] != 0) { $thread['title'] = fetch_word_wrapped_string($thread['title']); } $thread['title'] = fetch_censored_text($thread['title']); $thread['meta_description'] = strip_bbcode(strip_quotes($thread['description']), false, true); $thread['meta_description'] = htmlspecialchars_uni(fetch_censored_text(fetch_trimmed_title($thread['meta_description'], 500, false))); // ********************************************************************************* // words to highlight from the search engine if (!empty($vbulletin->GPC['highlight'])) { $highlight = preg_replace('#\\*+#s', '*', $vbulletin->GPC['highlight']); if ($highlight != '*') { $regexfind = array('\\*', '\\<', '\\>'); $regexreplace = array('[\\w.:@*/?=]*?', '<', '>'); $highlight = preg_quote(strtolower($highlight), '#'); $highlight = explode(' ', $highlight); $highlight = str_replace($regexfind, $regexreplace, $highlight); foreach ($highlight as $val) { if ($val = trim($val)) { $replacewords[] = htmlspecialchars_uni($val); } } } } // ********************************************************************************* // make the forum jump in order to fill the forum caches $navpopup = array('id' => 'showthread_navpopup', 'title' => $foruminfo['title_clean'], 'link' => fetch_seo_url('thread', $threadinfo)); construct_quick_nav($navpopup); // ********************************************************************************* // get forum info $forum = fetch_foruminfo($thread['forumid']); $foruminfo =& $forum; // ********************************************************************************* // check forum permissions $forumperms = fetch_permissions($thread['forumid']); if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads'])) { json_error(ERR_NO_PERMISSION); } if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) and ($thread['postuserid'] != $vbulletin->userinfo['userid'] or $vbulletin->userinfo['userid'] == 0)) { json_error(ERR_NO_PERMISSION); } // ********************************************************************************* // check if there is a forum password and if so, ensure the user has it set if (!verify_forum_password($foruminfo['forumid'], $foruminfo['password'])) { // FRNR json_error(ERR_NEED_PASSWORD, RV_NEED_FORUM_PASSWORD); } // verify that we are at the canonical SEO url // and redirect to this if not //verify_seo_url('thread|js', $threadinfo, array('pagenumber' => $_REQUEST['pagenumber'])); // ********************************************************************************* // jump page if thread is actually a redirect if ($thread['open'] == 10) { $destthreadinfo = fetch_threadinfo($threadinfo['pollid']); exec_header_redirect(fetch_seo_url('thread|js', $destthreadinfo, $pageinfo)); } // ********************************************************************************* // get ignored users $ignore = array(); if (trim($vbulletin->userinfo['ignorelist'])) { $ignorelist = preg_split('/( )+/', trim($vbulletin->userinfo['ignorelist']), -1, PREG_SPLIT_NO_EMPTY); foreach ($ignorelist as $ignoreuserid) { $ignore["{$ignoreuserid}"] = 1; } } DEVDEBUG('ignored users: ' . implode(', ', array_keys($ignore))); // ********************************************************************************* // filter out deletion notices if can't be seen if ($forumperms & $vbulletin->bf_ugp_forumpermissions['canseedelnotice'] or can_moderate($threadinfo['forumid'])) { $deljoin = "LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON(post.postid = deletionlog.primaryid AND deletionlog.type = 'post')"; } else { $deljoin = ''; } $show['viewpost'] = can_moderate($threadinfo['forumid']) ? true : false; $show['managepost'] = iif(can_moderate($threadinfo['forumid'], 'candeleteposts') or can_moderate($threadinfo['forumid'], 'canremoveposts'), true, false); $show['approvepost'] = can_moderate($threadinfo['forumid'], 'canmoderateposts') ? true : false; $show['managethread'] = can_moderate($threadinfo['forumid'], 'canmanagethreads') ? true : false; $show['approveattachment'] = can_moderate($threadinfo['forumid'], 'canmoderateattachments') ? true : false; $show['inlinemod'] = (!$show['threadedmode'] and ($show['managethread'] or $show['managepost'] or $show['approvepost'])) ? true : false; $show['spamctrls'] = ($show['inlinemod'] and $show['managepost']); $url = $show['inlinemod'] ? SCRIPTPATH : ''; // build inline moderation popup if ($show['popups'] and $show['inlinemod']) { $threadadmin_imod_menu_post = vB_Template::create('threadadmin_imod_menu_post')->render(); } else { $threadadmin_imod_menu_post = ''; } // ********************************************************************************* // find the page that we should be on to display this post if (!empty($postid) and $threadedmode == 0) { $postinfo = verify_id('post', $postid, 1, 1); $threadid = $postinfo['threadid']; $getpagenum = $db->query_first("\n \t\tSELECT COUNT(*) AS posts\n \t\tFROM " . TABLE_PREFIX . "post AS post\n \t\tWHERE threadid = {$threadid} AND visible = 1\n \t\tAND dateline " . iif(!$postorder, '<=', '>=') . " {$postinfo['dateline']}\n \t"); $vbulletin->GPC['pagenumber'] = ceil($getpagenum['posts'] / $perpage); } // ********************************************************************************* // update views counter if ($vbulletin->options['threadviewslive']) { // doing it as they happen; for optimization purposes, this cannot use a DM! $db->shutdown_query("\n \t\tUPDATE " . TABLE_PREFIX . "thread\n \t\tSET views = views + 1\n \t\tWHERE threadid = " . intval($threadinfo['threadid'])); } else { // or doing it once an hour $db->shutdown_query("\n \t\tINSERT INTO " . TABLE_PREFIX . "threadviews (threadid)\n \t\tVALUES (" . intval($threadinfo['threadid']) . ')'); } // ********************************************************************************* // display ratings if enabled $show['rating'] = false; if ($forum['allowratings'] == 1) { if ($thread['votenum'] > 0) { $thread['voteavg'] = vb_number_format($thread['votetotal'] / $thread['votenum'], 2); $thread['rating'] = intval(round($thread['votetotal'] / $thread['votenum'])); if ($thread['votenum'] >= $vbulletin->options['showvotes']) { $show['rating'] = true; } } devdebug("threadinfo[vote] = {$threadinfo['vote']}"); if ($threadinfo['vote']) { $voteselected["{$threadinfo['vote']}"] = 'selected="selected"'; $votechecked["{$threadinfo['vote']}"] = 'checked="checked"'; } else { $voteselected[0] = 'selected="selected"'; $votechecked[0] = 'checked="checked"'; } } // ********************************************************************************* // set page number if ($vbulletin->GPC['pagenumber'] < 1) { $vbulletin->GPC['pagenumber'] = 1; } else { if ($vbulletin->GPC['pagenumber'] > ceil(($thread['replycount'] + 1) / $perpage)) { $vbulletin->GPC['pagenumber'] = ceil(($thread['replycount'] + 1) / $perpage); } } // ********************************************************************************* // initialise some stuff... $limitlower = ($vbulletin->GPC['pagenumber'] - 1) * $perpage; $limitupper = $vbulletin->GPC['pagenumber'] * $perpage; $counter = 0; if ($vbulletin->options['threadmarking'] and $vbulletin->userinfo['userid']) { $threadview = max($threadinfo['threadread'], $threadinfo['forumread'], TIMENOW - $vbulletin->options['markinglimit'] * 86400); } else { $threadview = intval(fetch_bbarray_cookie('thread_lastview', $thread['threadid'])); if (!$threadview) { $threadview = $vbulletin->userinfo['lastvisit']; } } $threadinfo['threadview'] = intval($threadview); $displayed_dateline = 0; ################################################################################ ############################### SHOW POLL ###################################### ################################################################################ $poll = ''; if ($thread['pollid']) { $pollbits = ''; $counter = 1; $pollid = $thread['pollid']; $show['editpoll'] = iif(can_moderate($threadinfo['forumid'], 'caneditpoll'), true, false); // get poll info $pollinfo = $db->query_first_slave("\n \t\tSELECT *\n \t\tFROM " . TABLE_PREFIX . "poll\n \t\tWHERE pollid = {$pollid}\n \t"); require_once DIR . '/includes/class_bbcode.php'; $bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list()); $pollinfo['question'] = $bbcode_parser->parse(unhtmlspecialchars($pollinfo['question']), $forum['forumid'], true); $splitoptions = explode('|||', $pollinfo['options']); $splitoptions = array_map('rtrim', $splitoptions); $splitvotes = explode('|||', $pollinfo['votes']); $showresults = 0; $uservoted = 0; if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canvote'])) { $nopermission = 1; } if (!$pollinfo['active'] or !$thread['open'] or $pollinfo['dateline'] + $pollinfo['timeout'] * 86400 < TIMENOW and $pollinfo['timeout'] != 0 or $nopermission) { //thread/poll is closed, ie show results no matter what $showresults = 1; } else { //get userid, check if user already voted $voted = intval(fetch_bbarray_cookie('poll_voted', $pollid)); if ($voted) { $uservoted = 1; } } ($hook = vBulletinHook::fetch_hook('showthread_poll_start')) ? eval($hook) : false; if ($pollinfo['timeout'] and !$showresults) { $pollendtime = vbdate($vbulletin->options['timeformat'], $pollinfo['dateline'] + $pollinfo['timeout'] * 86400); $pollenddate = vbdate($vbulletin->options['dateformat'], $pollinfo['dateline'] + $pollinfo['timeout'] * 86400); $show['pollenddate'] = true; } else { $show['pollenddate'] = false; } foreach ($splitvotes as $index => $value) { $pollinfo['numbervotes'] += $value; } if ($vbulletin->userinfo['userid'] > 0) { $pollvotes = $db->query_read_slave("\n \t\t\tSELECT voteoption\n \t\t\tFROM " . TABLE_PREFIX . "pollvote\n \t\t\tWHERE userid = " . $vbulletin->userinfo['userid'] . " AND pollid = {$pollid}\n \t\t"); if ($db->num_rows($pollvotes) > 0) { $uservoted = 1; } } if ($showresults or $uservoted) { if ($uservoted) { $uservote = array(); while ($pollvote = $db->fetch_array($pollvotes)) { $uservote["{$pollvote['voteoption']}"] = 1; } } } $left = vB_Template_Runtime::fetchStyleVar('left'); $right = vB_Template_Runtime::fetchStyleVar('right'); $option['open'] = $left[0]; $option['close'] = $right[0]; foreach ($splitvotes as $index => $value) { $arrayindex = $index + 1; $option['uservote'] = iif($uservote["{$arrayindex}"], true, false); $option['question'] = $bbcode_parser->parse($splitoptions["{$index}"], $forum['forumid'], true); // public link if ($pollinfo['public'] and $value) { $option['votes'] = '<a href="poll.php?' . $vbulletin->session->vars['sessionurl'] . 'do=showresults&pollid=' . $pollinfo['pollid'] . '">' . vb_number_format($value) . '</a>'; } else { $option['votes'] = vb_number_format($value); //get the vote count for the option } $option['number'] = $counter; //number of the option //Now we check if the user has voted or not if ($showresults or $uservoted) { // user did vote or poll is closed if ($value <= 0) { $option['percentraw'] = 0; } else { if ($pollinfo['multiple']) { $option['percentraw'] = $value < $pollinfo['voters'] ? $value / $pollinfo['voters'] * 100 : 100; } else { $option['percentraw'] = $value < $pollinfo['numbervotes'] ? $value / $pollinfo['numbervotes'] * 100 : 100; } } $option['percent'] = vb_number_format($option['percentraw'], 2); $option['graphicnumber'] = $option['number'] % 6 + 1; $option['barnumber'] = round($option['percent']) * 2; $option['remainder'] = 201 - $option['barnumber']; // Phrase parts below if ($nopermission) { $pollstatus = $vbphrase['you_may_not_vote_on_this_poll']; } else { if ($showresults) { $pollstatus = $vbphrase['this_poll_is_closed']; } else { if ($uservoted) { $pollstatus = $vbphrase['you_have_already_voted_on_this_poll']; } } } ($hook = vBulletinHook::fetch_hook('showthread_polloption')) ? eval($hook) : false; $templater = vB_Template::create('pollresult'); $templater->register('names', $names); $templater->register('option', $option); $pollbits .= $templater->render(); } else { ($hook = vBulletinHook::fetch_hook('showthread_polloption')) ? eval($hook) : false; if ($pollinfo['multiple']) { $templater = vB_Template::create('polloption_multiple'); $templater->register('option', $option); $pollbits .= $templater->render(); } else { $templater = vB_Template::create('polloption'); $templater->register('option', $option); $pollbits .= $templater->render(); } } $counter++; } if ($pollinfo['multiple']) { $pollinfo['numbervotes'] = $pollinfo['voters']; $show['multiple'] = true; } if ($pollinfo['public']) { $show['publicwarning'] = true; } else { $show['publicwarning'] = false; } $displayed_dateline = $threadinfo['lastpost']; ($hook = vBulletinHook::fetch_hook('showthread_poll_complete')) ? eval($hook) : false; if ($showresults or $uservoted) { $templater = vB_Template::create('pollresults_table'); $templater->register('pollbits', $pollbits); $templater->register('pollenddate', $pollenddate); $templater->register('pollendtime', $pollendtime); $templater->register('pollinfo', $pollinfo); $templater->register('pollstatus', $pollstatus); $poll = $templater->render(); } else { $templater = vB_Template::create('polloptions_table'); $templater->register('pollbits', $pollbits); $templater->register('pollenddate', $pollenddate); $templater->register('pollendtime', $pollendtime); $templater->register('pollinfo', $pollinfo); $poll = $templater->render(); } } // work out if quickreply should be shown or not if ($vbulletin->options['quickreply'] and !$thread['isdeleted'] and !is_browser('netscape') and $vbulletin->userinfo['userid'] and ($vbulletin->userinfo['userid'] == $threadinfo['postuserid'] and $forumperms & $vbulletin->bf_ugp_forumpermissions['canreplyown'] or $vbulletin->userinfo['userid'] != $threadinfo['postuserid'] and $forumperms & $vbulletin->bf_ugp_forumpermissions['canreplyothers']) and ($thread['open'] or can_moderate($threadinfo['forumid'], 'canopenclose')) and !fetch_require_hvcheck('post')) { $show['quickreply'] = true; } else { $show['quickreply'] = false; $show['wysiwyg'] = 0; $quickreply = ''; } $show['largereplybutton'] = (!$thread['isdeleted'] and !$show['threadedmode'] and $forum['allowposting'] and !$show['search_engine']); if (!$forum['allowposting']) { $show['quickreply'] = false; } $show['multiquote_global'] = ($vbulletin->options['multiquote'] and $vbulletin->userinfo['userid']); if ($show['multiquote_global']) { $vbulletin->input->clean_array_gpc('c', array('vbulletin_multiquote' => TYPE_STR)); $vbulletin->GPC['vbulletin_multiquote'] = explode(',', $vbulletin->GPC['vbulletin_multiquote']); } // post is cachable if option is enabled, last post is newer than max age, and this user // isn't showing a sessionhash $post_cachable = ($vbulletin->options['cachemaxage'] > 0 and TIMENOW - $vbulletin->options['cachemaxage'] * 60 * 60 * 24 <= $thread['lastpost'] and $vbulletin->session->vars['sessionurl'] == ''); $saveparsed = ''; $save_parsed_sigs = ''; ($hook = vBulletinHook::fetch_hook('showthread_post_start')) ? eval($hook) : false; ################################################################################ ####################### SHOW THREAD IN LINEAR MODE ############################# ################################################################################ if ($threadedmode == 0) { // allow deleted posts to not be counted in number of posts displayed on the page; // prevents issue with page count on forum display being incorrect $ids = array(); $lastpostid = 0; $hook_query_joins = $hook_query_where = ''; ($hook = vBulletinHook::fetch_hook('showthread_query_postids')) ? eval($hook) : false; if (empty($deljoin) and !$show['approvepost']) { $totalposts = $threadinfo['replycount'] + 1; if (can_moderate($thread['forumid'])) { $coventry = ''; } else { $coventry = fetch_coventry('string'); } $getpostids = $db->query_read("\n \t\t\tSELECT post.postid\n \t\t\tFROM " . TABLE_PREFIX . "post AS post\n \t\t\t{$hook_query_joins}\n \t\t\tWHERE post.threadid = {$threadid}\n \t\t\t\tAND post.visible = 1\n \t\t\t\t" . ($coventry ? "AND post.userid NOT IN ({$coventry})" : '') . "\n \t\t\t\t{$hook_query_where}\n \t\t\tORDER BY post.dateline {$postorder}\n \t\t\tLIMIT {$limitlower}, {$perpage}\n \t\t"); while ($post = $db->fetch_array($getpostids)) { if (!isset($qrfirstpostid)) { $qrfirstpostid = $post['postid']; } $qrlastpostid = $post['postid']; $ids[] = $post['postid']; } $db->free_result($getpostids); $lastpostid = $qrlastpostid; } else { $getpostids = $db->query_read("\n \t\t\tSELECT post.postid, post.visible, post.userid\n \t\t\tFROM " . TABLE_PREFIX . "post AS post\n \t\t\t{$hook_query_joins}\n \t\t\tWHERE post.threadid = {$threadid}\n \t\t\t\tAND post.visible IN (1\n \t\t\t\t" . (!empty($deljoin) ? ",2" : "") . "\n \t\t\t\t" . ($show['approvepost'] ? ",0" : "") . "\n \t\t\t\t)\n \t\t\t\t{$hook_query_where}\n \t\t\tORDER BY post.dateline {$postorder}\n \t\t"); $totalposts = 0; if ($limitlower != 0) { $limitlower++; } while ($post = $db->fetch_array($getpostids)) { if (!isset($qrfirstpostid)) { $qrfirstpostid = $post['postid']; } $qrlastpostid = $post['postid']; if ($post['visible'] == 1 and !in_coventry($post['userid']) and !$ignore[$post['userid']]) { $totalposts++; } if ($totalposts < $limitlower or $totalposts > $limitupper) { continue; } // remember, these are only added if they're going to be displayed $ids[] = $post['postid']; $lastpostid = $post['postid']; } $db->free_result($getpostids); } // '0' inside parenthesis in unlikely case we have no ids for this page // (this could happen if the replycount is wrong in the db) $postids = "post.postid IN (0" . implode(',', $ids) . ")"; // load attachments if ($thread['attach']) { require_once DIR . '/packages/vbattach/attach.php'; $attach = new vB_Attach_Display_Content($vbulletin, 'vBForum_Post'); $postattach = $attach->fetch_postattach(0, $ids); } $hook_query_fields = $hook_query_joins = ''; ($hook = vBulletinHook::fetch_hook('showthread_query')) ? eval($hook) : false; $posts = $db->query_read("\n \t\tSELECT\n \t\t\tpost.*, post.username AS postusername, post.ipaddress AS ip, IF(post.visible = 2, 1, 0) AS isdeleted,\n \t\t\tuser.*, userfield.*, usertextfield.*,\n \t\t\t" . iif($forum['allowicons'], 'icon.title as icontitle, icon.iconpath,') . "\n \t\t\t" . iif($vbulletin->options['avatarenabled'], 'avatar.avatarpath, NOT ISNULL(customavatar.userid) AS hascustomavatar, customavatar.dateline AS avatardateline,customavatar.width AS avwidth,customavatar.height AS avheight,') . "\n \t\t\t" . ((can_moderate($thread['forumid'], 'canmoderateposts') or can_moderate($thread['forumid'], 'candeleteposts')) ? 'spamlog.postid AS spamlog_postid,' : '') . "\n \t\t\t" . iif($deljoin, 'deletionlog.userid AS del_userid, deletionlog.username AS del_username, deletionlog.reason AS del_reason,') . "\n \t\t\teditlog.userid AS edit_userid, editlog.username AS edit_username, editlog.dateline AS edit_dateline,\n \t\t\teditlog.reason AS edit_reason, editlog.hashistory,\n \t\t\tpostparsed.pagetext_html, postparsed.hasimages,\n \t\t\tsigparsed.signatureparsed, sigparsed.hasimages AS sighasimages,\n \t\t\tsigpic.userid AS sigpic, sigpic.dateline AS sigpicdateline, sigpic.width AS sigpicwidth, sigpic.height AS sigpicheight,\n \t\t\tIF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid, infractiongroupid\n \t\t\t" . iif(!($permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canseehiddencustomfields']), $vbulletin->profilefield['hidden']) . "\n \t\t\t{$hook_query_fields}\n \t\tFROM " . TABLE_PREFIX . "post AS post\n \t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = post.userid)\n \t\tLEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON(userfield.userid = user.userid)\n \t\tLEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON(usertextfield.userid = user.userid)\n \t\t" . iif($forum['allowicons'], "LEFT JOIN " . TABLE_PREFIX . "icon AS icon ON(icon.iconid = post.iconid)") . "\n \t\t" . iif($vbulletin->options['avatarenabled'], "LEFT JOIN " . TABLE_PREFIX . "avatar AS avatar ON(avatar.avatarid = user.avatarid) LEFT JOIN " . TABLE_PREFIX . "customavatar AS customavatar ON(customavatar.userid = user.userid)") . "\n \t\t" . ((can_moderate($thread['forumid'], 'canmoderateposts') or can_moderate($thread['forumid'], 'candeleteposts')) ? "LEFT JOIN " . TABLE_PREFIX . "spamlog AS spamlog ON(spamlog.postid = post.postid)" : '') . "\n \t\t\t{$deljoin}\n \t\tLEFT JOIN " . TABLE_PREFIX . "editlog AS editlog ON(editlog.postid = post.postid)\n \t\tLEFT JOIN " . TABLE_PREFIX . "postparsed AS postparsed ON(postparsed.postid = post.postid AND postparsed.styleid = " . intval(STYLEID) . " AND postparsed.languageid = " . intval(LANGUAGEID) . ")\n \t\tLEFT JOIN " . TABLE_PREFIX . "sigparsed AS sigparsed ON(sigparsed.userid = user.userid AND sigparsed.styleid = " . intval(STYLEID) . " AND sigparsed.languageid = " . intval(LANGUAGEID) . ")\n \t\tLEFT JOIN " . TABLE_PREFIX . "sigpic AS sigpic ON(sigpic.userid = post.userid)\n \t\t\t{$hook_query_joins}\n \t\tWHERE {$postids}\n \t\tORDER BY post.dateline {$postorder}\n \t"); if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canseethumbnails']) and !($forumperms & $vbulletin->bf_ugp_forumpermissions['cangetattachment'])) { $vbulletin->options['attachthumbs'] = 0; } if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['cangetattachment'])) { $vbulletin->options['viewattachedimages'] = 0; } $postcount = ($vbulletin->GPC['pagenumber'] - 1) * $perpage; if ($postorder) { // Newest first $postcount = $totalposts - $postcount + 1; } $counter = 0; $postbits = ''; $postbit_factory = new vB_Postbit_Factory(); $postbit_factory->registry =& $vbulletin; $postbit_factory->forum =& $foruminfo; $postbit_factory->thread =& $thread; $postbit_factory->cache = array(); $postbit_factory->bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list()); while ($post = $db->fetch_array($posts)) { if ($tachyuser = in_coventry($post['userid']) and !can_moderate($thread['forumid'])) { continue; } if ($post['visible'] == 1 and !$tachyuser) { ++$counter; if ($postorder) { $post['postcount'] = --$postcount; } else { $post['postcount'] = ++$postcount; } } if ($tachyuser) { $fetchtype = 'post_global_ignore'; } else { if ($ignore["{$post['userid']}"]) { $fetchtype = 'post_ignore'; } else { if ($post['visible'] == 2) { $fetchtype = 'post_deleted'; } else { $fetchtype = 'post'; } } } if ($vbulletin->GPC['viewfull'] and $post['postid'] == $postinfo['postid'] and $fetchtype != 'post' and (can_moderate($threadinfo['forumid']) or !$post['isdeleted'])) { $fetchtype = 'post'; } if ($fetchtype != 'post' && $fetchtype != 'post_deleted') { continue; } ($hook = vBulletinHook::fetch_hook('showthread_postbit_create')) ? eval($hook) : false; $postbit_obj =& $postbit_factory->fetch_postbit($fetchtype); if ($fetchtype == 'post') { $postbit_obj->highlight =& $replacewords; } $postbit_obj->cachable = $post_cachable; $post['islastshown'] = $post['postid'] == $lastpostid; $post['isfirstshown'] = ($counter == 1 and $fetchtype == 'post' and $post['visible'] == 1); $post['islastshown'] = $post['postid'] == $lastpostid; $post['attachments'] = $postattach["{$post['postid']}"]; $parsed_postcache = array('text' => '', 'images' => 1, 'skip' => false); $postbits .= $postbit_obj->construct_postbit($post); // Only show after the first post, counter isn't incremented for deleted/moderated posts if ($post['isfirstshown']) { $postbits .= vB_Template::create('ad_showthread_firstpost')->render(); } if ($post_cachable and $post['pagetext_html'] == '') { if (!empty($saveparsed)) { $saveparsed .= ','; } $saveparsed .= "({$post['postid']}, " . intval($thread['lastpost']) . ', ' . intval($postbit_obj->post_cache['has_images']) . ", '" . $db->escape_string($postbit_obj->post_cache['text']) . "', " . intval(STYLEID) . ", " . intval(LANGUAGEID) . ")"; } if (!empty($postbit_obj->sig_cache) and $post['userid']) { if (!empty($save_parsed_sigs)) { $save_parsed_sigs .= ','; } $save_parsed_sigs .= "({$post['userid']}, " . intval(STYLEID) . ", " . intval(LANGUAGEID) . ", '" . $db->escape_string($postbit_obj->sig_cache['text']) . "', " . intval($postbit_obj->sig_cache['has_images']) . ")"; } // get first and last post ids for this page (for big reply buttons) if (!isset($FIRSTPOSTID)) { $FIRSTPOSTID = $post['postid']; } $LASTPOSTID = $post['postid']; if ($post['dateline'] > $displayed_dateline) { $displayed_dateline = $post['dateline']; if ($displayed_dateline <= $threadview) { $updatethreadcookie = true; } } // FRNR Start // find out if first post $getpost = $db->query_first("\n SELECT firstpostid\n FROM " . TABLE_PREFIX . "thread\n WHERE threadid = {$threadinfo['threadid']}\n "); $isfirstpost = $getpost['firstpostid'] == $post['postid']; $candelete = false; if ($isfirstpost and can_moderate($threadinfo['forumid'], 'canmanagethreads')) { $candelete = true; } else { if (!$isfirstpost and can_moderate($threadinfo['forumid'], 'candeleteposts')) { $candelete = true; } else { if (($forumperms & $vbulletin->bf_ugp_forumpermissions['candeletepost'] and !$isfirstpost or $forumperms & $vbulletin->bf_ugp_forumpermissions['candeletethread'] and $isfirstpost) and $vbulletin->userinfo['userid'] == $post['userid']) { $candelete = true; } } } // Get post date/time $postdate = vbdate($vbulletin->options['dateformat'], $post['dateline'], 1); $posttime = vbdate($vbulletin->options['timeformat'], $post['dateline']); $fr_images = array(); $docattach = array(); // Attachments (images). if (is_array($post['attachments']) && count($post['attachments']) > 0) { foreach ($post['attachments'] as $attachment) { $lfilename = strtolower($attachment['filename']); if (strpos($lfilename, '.jpe') !== false || strpos($lfilename, '.png') !== false || strpos($lfilename, '.gif') !== false || strpos($lfilename, '.jpg') !== false || strpos($lfilename, '.jpeg') !== false) { $tmp = array('img' => $vbulletin->options['bburl'] . '/attachment.php?attachmentid=' . $attachment['attachmentid']); if ($vbulletin->options['attachthumbs']) { $tmp['tmb'] = $vbulletin->options['bburl'] . '/attachment.php?attachmentid=' . $attachment['attachmentid'] . '&stc=1&thumb=1'; } $fr_images[] = $tmp; } if (strpos($lfilename, '.pdf') !== false) { $docattach[] = $vbulletin->options['bburl'] . '/attachment.php?attachmentid=' . $attachment['attachmentid']; } } } // Parse the post for quotes and inline images list($text, $nuked_quotes, $images) = parse_post($post['pagetext'], $post['allowsmilie'] && $usesmilies); if (count($fr_images) > 0) { $text .= "<br/>"; foreach ($fr_images as $attachment) { $text .= "<img src=\"{$attachment['img']}\"/>"; } } foreach ($images as $image) { $fr_images[] = array('img' => $image); } $avatarurl = ''; // Avatar work if ($post['avatarurl']) { $avatarurl = process_avatarurl($post['avatarurl']); } $tmp = array('post_id' => $post['postid'], 'thread_id' => $post['threadid'], 'forum_id' => $foruminfo['forumid'], 'forum_title' => prepare_utf8_string($foruminfo['title_clean']), 'username' => prepare_utf8_string(strip_tags($post['username'])), 'joindate' => prepare_utf8_string($post['joindate']), 'usertitle' => prepare_utf8_string(strip_tags($post['usertitle'])), 'numposts' => $post['posts'] ? (string) $post['posts'] : '0', 'userid' => $post['userid'], 'title' => prepare_utf8_string($post['title']), 'online' => fetch_online_status(fetch_userinfo($post['userid']), false), 'post_timestamp' => prepare_utf8_string(date_trunc($postdate) . ' ' . $posttime), 'fr_images' => $fr_images); if ($candelete) { $tmp['candelete'] = true; } // Soft Deleted if ($post['visible'] == 2) { $tmp['deleted'] = true; $tmp['del_username'] = prepare_utf8_string($post['del_username']); if ($post['del_reason']) { $tmp['del_reason'] = prepare_utf8_string($post['del_reason']); } } else { $tmp['text'] = $text; $tmp['quotable'] = $nuked_quotes; if ($post['editlink']) { $tmp['canedit'] = true; $tmp['edittext'] = prepare_utf8_string($post['pagetext']); } } if ($avatarurl != '') { $tmp['avatarurl'] = $avatarurl; } if (count($docattach) > 0) { $tmp['docattach'] = $docattach; } if ($vbulletin->GPC['signature']) { $sig = trim(remove_bbcode(strip_tags($post['signatureparsed']), true, true), '<a>'); $sig = str_replace(array("\t", "\r"), array('', ''), $sig); $sig = str_replace("\n\n", "\n", $sig); $tmp['sig'] = prepare_utf8_string($sig); } // Begin Support for Post Thanks Hack - http://www.vbulletin.org/forum/showthread.php?t=122944 if ($vbulletin->userinfo['userid'] && function_exists('post_thanks_off') && function_exists('can_thank_this_post') && function_exists('thanked_already') && function_exists('fetch_thanks')) { if (!post_thanks_off($thread['forumid'], $post, $thread['firstpostid'], THIS_SCRIPT)) { global $ids; if (can_thank_this_post($post, $thread['isdeleted'])) { $tmp['canlike'] = true; } if (thanked_already($post, 0, true)) { $tmp['likes'] = true; if (!$vbulletin->options['post_thanks_delete_own']) { $tmp['canlike'] = $tmp['likes'] = false; } } $thanks = fetch_thanks($post['postid']); $thank_users = array(); if (is_array($thanks)) { foreach ($thanks as $thank) { $thank_users[] = $thank['username']; } } if (count($thank_users)) { $tmp['likestext'] = prepare_utf8_string($vbphrase['fr_thanked_by'] . ': ' . join(', ', $thank_users)); $tmp['likesusers'] = join(', ', $thank_users); } } } // End Support for Post Thanks Hack $posts_out[] = $tmp; // FRNR End } $db->free_result($posts); unset($post); if ($postbits == '' and $vbulletin->GPC['pagenumber'] > 1) { $pageinfo = array('page' => $vbulletin->GPC['pagenumber'] - 1); if (!empty($vbulletin->GPC['perpage'])) { $pageinfo['pp'] = $perpage; } if (!empty($vbulletin->GPC['highlight'])) { $pageinfo['highlight'] = urlencode($vbulletin->GPC['highlight']); } exec_header_redirect(fetch_seo_url('thread|js', $threadinfo, $pageinfo)); } DEVDEBUG("First Post: {$FIRSTPOSTID}; Last Post: {$LASTPOSTID}"); $pageinfo = array(); if ($vbulletin->GPC['highlight']) { $pageinfo['highlight'] = urlencode($vbulletin->GPC['highlight']); } if (!empty($vbulletin->GPC['perpage'])) { $pageinfo['pp'] = $perpage; } $pagenav = construct_page_nav($vbulletin->GPC['pagenumber'], $perpage, $totalposts, 'showthread.php?' . $vbulletin->session->vars['sessionurl'] . "t={$threadinfo['threadid']}", '', '', 'thread', $threadinfo, $pageinfo); if ($thread['lastpost'] > $threadview) { if ($firstnew) { $firstunread = fetch_seo_url('thread', $threadinfo, array('page' => $vbulletin->GPC['pagenumber'])) . '#post' . $firstnew; $show['firstunreadlink'] = true; } else { $firstunread = fetch_seo_url('thread', $threadinfo, array('goto' => 'newpost')); $show['firstunreadlink'] = true; } } else { $firstunread = ''; $show['firstunreadlink'] = false; } if ($vbulletin->userinfo['postorder']) { // disable ajax qr when displaying linear newest first $show['allow_ajax_qr'] = 0; } else { // only allow ajax on the last page of a thread when viewing oldest first $show['allow_ajax_qr'] = $vbulletin->GPC['pagenumber'] == ceil($totalposts / $perpage) ? 1 : 0; } ################################################################################ ################ SHOW THREAD IN THREADED OR HYBRID MODE ######################## ################################################################################ } else { // ajax qr doesn't work with threaded controls $show['allow_ajax_qr'] = 0; require_once DIR . '/includes/functions_threadedmode.php'; // save data $ipostarray = array(); $postarray = array(); $userarray = array(); $postparent = array(); $postorder = array(); $hybridposts = array(); $deletedparents = array(); $totalposts = 0; $links = ''; $cache_postids = ''; $hook_query_fields = $hook_query_joins = $hook_query_where = ''; ($hook = vBulletinHook::fetch_hook('showthread_query_postids_threaded')) ? eval($hook) : false; // get all posts $listposts = $db->query_read("\n \t\tSELECT\n \t\t\tpost.*, post.username AS postusername, post.ipaddress AS ip, IF(post.visible = 2, 1, 0) AS isdeleted,\n \t\t\tuser.*, userfield.*\n \t\t\t" . iif(!($permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canseehiddencustomfields']), $vbulletin->profilefield['hidden']) . "\n \t\t\t{$hook_query_fields}\n \t\tFROM " . TABLE_PREFIX . "post AS post\n \t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = post.userid)\n \t\tLEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON(userfield.userid = user.userid)\n \t\t{$hook_query_joins}\n \t\tWHERE threadid = {$threadid}\n \t\t\t{$hook_query_where}\n \t\tORDER BY postid\n \t"); // $toppostid is the first post in the thread // $curpostid is the postid passed from the URL, or if not specified, the first post in the thread $ids = array(); while ($post = $db->fetch_array($listposts)) { if ($post['visible'] == 2 and !$deljoin or $post['visible'] == 0 and !$show['approvepost'] or in_coventry($post['userid']) and !can_moderate($thread['forumid'])) { $deletedparents["{$post['postid']}"] = iif(isset($deletedparents["{$post['parentid']}"]), $deletedparents["{$post['parentid']}"], $post['parentid']); continue; } if (empty($toppostid)) { $toppostid = $post['postid']; } if (empty($postid)) { if (empty($curpostid)) { $curpostid = $post['postid']; if ($threadedmode == 2 and empty($vbulletin->GPC['postid'])) { $vbulletin->GPC['postid'] = $curpostid; } $curpostparent = $post['parentid']; } } else { if ($post['postid'] == $postid) { $curpostid = $post['postid']; $curpostparent = $post['parentid']; } } $postparent["{$post['postid']}"] = $post['parentid']; $ipostarray["{$post['parentid']}"][] = $post['postid']; $postarray["{$post['postid']}"] = $post; $userarray["{$post['userid']}"] = $db->escape_string($post['username']); $totalposts++; $ids[] = $post['postid']; } $db->free_result($listposts); // hooks child posts up to new parent if actual parent has been deleted or hidden if (count($deletedparents) > 0) { foreach ($deletedparents as $dpostid => $dparentid) { if (is_array($ipostarray[$dpostid])) { foreach ($ipostarray[$dpostid] as $temppostid) { $postparent[$temppostid] = $dparentid; $ipostarray[$dparentid][] = $temppostid; $postarray[$temppostid]['parentid'] = $dparentid; } unset($ipostarray[$dpostid]); } if ($curpostparent == $dpostid) { $curpostparent = $dparentid; } } } unset($post, $listposts, $deletedparents); if ($thread['attach']) { require_once DIR . '/packages/vbattach/attach.php'; $attach = new vB_Attach_Display_Content($vbulletin, 'vBForum_Post'); $postattach = $attach->fetch_postattach(0, $ids); } // get list of usernames from post list $userjs = ''; foreach ($userarray as $userid => $username) { if ($userid) { $userjs .= "pu[{$userid}] = \"" . addslashes_js($username) . "\";\n"; } } unset($userarray, $userid, $username); $parent_postids = fetch_post_parentlist($curpostid); if (!$parent_postids) { $currentdepth = 0; } else { $currentdepth = sizeof(explode(',', $parent_postids)); } sort_threaded_posts(); if (empty($curpostid)) { eval(standard_error(fetch_error('invalidid', $vbphrase['post'], $vbulletin->options['contactuslink']))); } if ($threadedmode == 2) { $numhybrids = sizeof($hybridposts); if ($vbulletin->GPC['pagenumber'] < 1) { $vbulletin->GPC['pagenumber'] = 1; } $startat = ($vbulletin->GPC['pagenumber'] - 1) * $perpage; if ($startat > $numhybrids) { $vbulletin->GPC['pagenumber'] = 1; $startat = 0; } $endat = $startat + $perpage; for ($i = $startat; $i < $endat; $i++) { if (isset($hybridposts["{$i}"])) { if (!isset($FIRSTPOSTID)) { $FIRSTPOSTID = $hybridposts["{$i}"]; } $cache_postids .= ",{$hybridposts[$i]}"; $LASTPOSTID = $hybridposts["{$i}"]; } } $pageinfo = array('p' => $vbulletin->GPC['postid']); if ($vbulletin->GPC['highlight']) { $pageinfo['highlight'] = urlencode($vbulletin->GPC['highlight']); } if (!empty($vbulletin->GPC['perpage'])) { $pageinfo['pp'] = $perpage; } $pagenav = construct_page_nav($vbulletin->GPC['pagenumber'], $perpage, $numhybrids, 'showthread.php?' . $vbulletin->session->vars['sessionurl'] . "t={$threadinfo['threadid']}", '', '', 'thread', $threadinfo, $pageinfo); } else { $FIRSTPOSTID = $curpostid; $LASTPOSTID = $curpostid; // sort out which posts to cache: if (!$vbulletin->options['threaded_maxcache']) { $vbulletin->options['threaded_maxcache'] = 999999; } // cache $vbulletin->options['threaded_maxcache'] posts // take 0.25 from above $curpostid // and take 0.75 below if (sizeof($postorder) <= $vbulletin->options['threaded_maxcache']) { $startat = 0; } else { if ($curpostidkey + $vbulletin->options['threaded_maxcache'] * 0.75 > sizeof($postorder)) { $startat = sizeof($postorder) - $vbulletin->options['threaded_maxcache']; } else { if ($curpostidkey - $vbulletin->options['threaded_maxcache'] * 0.25 < 0) { $startat = 0; } else { $startat = intval($curpostidkey - $vbulletin->options['threaded_maxcache'] * 0.25); } } } unset($curpostidkey); foreach ($postorder as $postkey => $pid) { if ($postkey > $startat + $vbulletin->options['threaded_maxcache']) { break; } if ($postkey >= $startat and empty($morereplies["{$pid}"])) { $cache_postids .= ',' . $pid; } } // get next/previous posts for each post in the list // key: NAVJS[postid][0] = prev post, [1] = next post $NAVJS = array(); $prevpostid = 0; foreach ($postorder as $pid) { $NAVJS["{$pid}"][0] = $prevpostid; $NAVJS["{$prevpostid}"][1] = $pid; $prevpostid = $pid; } $NAVJS["{$toppostid}"][0] = $pid; //prev button for first post $NAVJS["{$pid}"][1] = $toppostid; //next button for last post $navjs = ''; foreach ($NAVJS as $pid => $info) { $navjs .= "pn[{$pid}] = \"{$info['0']},{$info['1']}\";\n"; } } unset($ipostarray, $postparent, $postorder, $NAVJS, $postid, $info, $prevpostid, $postkey); $cache_postids = substr($cache_postids, 1); if (empty($cache_postids)) { // umm... something weird happened. Just prevent an error. eval(standard_error(fetch_error('invalidid', $vbphrase['post'], $vbulletin->options['contactuslink']))); } $hook_query_fields = $hook_query_joins = $hook_query_where = ''; ($hook = vBulletinHook::fetch_hook('showthread_query')) ? eval($hook) : false; $cacheposts = $db->query_read("\n \t\tSELECT\n \t\t\tpost.*, post.username AS postusername, post.ipaddress AS ip, IF(post.visible = 2, 1, 0) AS isdeleted,\n \t\t\tuser.*, userfield.*, usertextfield.*,\n \t\t\t" . iif($forum['allowicons'], 'icon.title as icontitle, icon.iconpath,') . "\n \t\t\t" . iif($vbulletin->options['avatarenabled'], 'avatar.avatarpath, NOT ISNULL(customavatar.userid) AS hascustomavatar, customavatar.dateline AS avatardateline,') . "\n \t\t\t" . ((can_moderate($thread['forumid'], 'canmoderateposts') or can_moderate($thread['forumid'], 'candeleteposts')) ? 'spamlog.postid AS spamlog_postid,' : '') . "\n \t\t\t" . iif($deljoin, "deletionlog.userid AS del_userid, deletionlog.username AS del_username, deletionlog.reason AS del_reason,") . "\n \t\t\teditlog.userid AS edit_userid, editlog.username AS edit_username, editlog.dateline AS edit_dateline,\n \t\t\teditlog.reason AS edit_reason, editlog.hashistory,\n \t\t\tpostparsed.pagetext_html, postparsed.hasimages,\n \t\t\tsigparsed.signatureparsed, sigparsed.hasimages AS sighasimages,\n \t\t\tsigpic.userid AS sigpic, sigpic.dateline AS sigpicdateline, sigpic.width AS sigpicwidth, sigpic.height AS sigpicheight,\n \t\t\tIF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid, infractiongroupid\n \t\t\t" . iif(!($permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canseehiddencustomfields']), $vbulletin->profilefield['hidden']) . "\n \t\t\t{$hook_query_fields}\n \t\tFROM " . TABLE_PREFIX . "post AS post\n \t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = post.userid)\n \t\tLEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON(userfield.userid = user.userid)\n \t\tLEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON(usertextfield.userid = user.userid)\n \t\t" . iif($forum['allowicons'], "LEFT JOIN " . TABLE_PREFIX . "icon AS icon ON(icon.iconid = post.iconid)") . "\n \t\t" . iif($vbulletin->options['avatarenabled'], "LEFT JOIN " . TABLE_PREFIX . "avatar AS avatar ON(avatar.avatarid = user.avatarid) LEFT JOIN " . TABLE_PREFIX . "customavatar AS customavatar ON(customavatar.userid = user.userid)") . "\n \t\t" . ((can_moderate($thread['forumid'], 'canmoderateposts') or can_moderate($thread['forumid'], 'candeleteposts')) ? "LEFT JOIN " . TABLE_PREFIX . "spamlog AS spamlog ON(spamlog.postid = post.postid)" : '') . "\n \t\t\t{$deljoin}\n \t\tLEFT JOIN " . TABLE_PREFIX . "editlog AS editlog ON(editlog.postid = post.postid)\n \t\tLEFT JOIN " . TABLE_PREFIX . "postparsed AS postparsed ON(postparsed.postid = post.postid AND postparsed.styleid = " . intval(STYLEID) . " AND postparsed.languageid = " . intval(LANGUAGEID) . ")\n \t\tLEFT JOIN " . TABLE_PREFIX . "sigparsed AS sigparsed ON(sigparsed.userid = user.userid AND sigparsed.styleid = " . intval(STYLEID) . " AND sigparsed.languageid = " . intval(LANGUAGEID) . ")\n \t\tLEFT JOIN " . TABLE_PREFIX . "sigpic AS sigpic ON(sigpic.userid = post.userid)\n \t\t\t{$hook_query_joins}\n \t\tWHERE post.postid IN (" . $cache_postids . ") {$hook_query_where}\n \t"); // re-initialise the $postarray variable $postarray = array(); while ($post = $db->fetch_array($cacheposts)) { $postarray["{$post['postid']}"] = $post; } if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['cangetattachment'])) { $vbulletin->options['viewattachedimages'] = 0; $vbulletin->options['attachthumbs'] = 0; } // init $postcount = 0; $postbits = ''; $saveparsed = ''; $jspostbits = ''; $postbit_factory = new vB_Postbit_Factory(); $postbit_factory->registry =& $vbulletin; $postbit_factory->forum =& $foruminfo; $postbit_factory->thread =& $thread; $postbit_factory->cache = array(); $postbit_factory->bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list()); foreach (explode(',', $cache_postids) as $id) { // get the post from the post array if (!isset($postarray["{$id}"])) { continue; } $post = $postarray["{$id}"]; if ($tachyuser = in_coventry($post['userid']) and !can_moderate($thread['forumid'])) { continue; } if ($tachyuser) { $fetchtype = 'post_global_ignore'; } else { if ($ignore["{$post['userid']}"]) { $fetchtype = 'post_ignore'; } else { if ($post['visible'] == 2) { $fetchtype = 'post_deleted'; } else { $fetchtype = 'post'; } } } if ($vbulletin->GPC['viewfull'] and $post['postid'] == $postinfo['postid'] and $fetchtype != 'post' and (can_moderate($threadinfo['forumid']) or !$post['isdeleted'])) { $fetchtype = 'post'; } ($hook = vBulletinHook::fetch_hook('showthread_postbit_create')) ? eval($hook) : false; $postbit_obj =& $postbit_factory->fetch_postbit($fetchtype); if ($fetchtype == 'post') { $postbit_obj->highlight =& $replacewords; } $postbit_obj->cachable = $post_cachable; $post['postcount'] = ++$postcount; $post['attachments'] =& $postattach["{$post['postid']}"]; $parsed_postcache = array('text' => '', 'images' => 1); $bgclass = 'alt2'; if ($threadedmode == 2) { $postbits .= $postbit_obj->construct_postbit($post); } else { $postbit = $postbit_obj->construct_postbit($post); if ($curpostid == $post['postid']) { $curpostdateline = $post['dateline']; $curpostbit = $postbit; } $postbit = preg_replace('#</script>#i', "<\\/scr' + 'ipt>", addslashes_js($postbit)); $jspostbits .= "pd[{$post['postid']}] = '{$postbit}';\n"; } // end threaded mode if ($post_cachable and $post['pagetext_html'] == '') { if (!empty($saveparsed)) { $saveparsed .= ','; } $saveparsed .= "({$post['postid']}, " . intval($thread['lastpost']) . ', ' . intval($postbit_obj->post_cache['has_images']) . ", '" . $db->escape_string($postbit_obj->post_cache['text']) . "'," . intval(STYLEID) . ", " . intval(LANGUAGEID) . ")"; } if (!empty($postbit_obj->sig_cache) and $post['userid']) { if (!empty($save_parsed_sigs)) { $save_parsed_sigs .= ','; } $save_parsed_sigs .= "({$post['userid']}, " . intval(STYLEID) . ", " . intval(LANGUAGEID) . ", '" . $db->escape_string($postbit_obj->sig_cache['text']) . "', " . intval($postbit_obj->sig_cache['has_images']) . ")"; } if ($post['dateline'] > $displayed_dateline) { $displayed_dateline = $post['dateline']; if ($displayed_dateline <= $threadview) { $updatethreadcookie = true; } } } // end while ($post) $db->free_result($cacheposts); if ($threadedmode == 1) { $postbits = $curpostbit; } $templater = vB_Template::create('showthread_list'); $templater->register('curpostid', $curpostid); $templater->register('highlightwords', $highlightwords); $templater->register('jspostbits', $jspostbits); $templater->register('links', $links); $templater->register('navjs', $navjs); $templater->register('threadedmode', $threadedmode); $templater->register('userjs', $userjs); $threadlist = $templater->render(); unset($curpostbit, $post, $cacheposts, $parsed_postcache, $postbit); } ################################################################################ ########################## END LINEAR / THREADED ############################### ################################################################################ $effective_lastpost = max($displayed_dateline, $thread['lastpost']); // ********************************************************************************* //set thread last view if ($thread['pollid'] and $vbulletin->options['updatelastpost'] and ($displayed_dateline == $thread['lastpost'] or $threadview == $thread['lastpost']) and $pollinfo['lastvote'] > $thread['lastpost']) { $displayed_dateline = $pollinfo['lastvote']; } if ((!$vbulletin->GPC['posted'] or $updatethreadcookie) and $displayed_dateline and $displayed_dateline > $threadview) { mark_thread_read($threadinfo, $foruminfo, $vbulletin->userinfo['userid'], $displayed_dateline); } // FRNR Below fr_update_subsent($threadinfo['threadid'], $displayed_dateline); if (!is_array($posts_out)) { $posts_out = array(); } // Figure out if we can post $canpost = true; if ($threadinfo['isdeleted'] or !$threadinfo['visible'] and !can_moderate($threadinfo['forumid'], 'canmoderateposts')) { $canpost = false; } if (!$foruminfo['allowposting'] or $foruminfo['link'] or !$foruminfo['cancontainthreads']) { $canpost = false; } if (!$threadinfo['open']) { if (!can_moderate($threadinfo['forumid'], 'canopenclose')) { $canpost = false; } } if (($vbulletin->userinfo['userid'] != $threadinfo['postuserid'] or !$vbulletin->userinfo['userid']) and (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canreplyothers']))) { $canpost = false; } if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canreplyown']) and $vbulletin->userinfo['userid'] == $threadinfo['postuserid']) { $canpost = false; } $mod = 0; if (can_moderate($threadinfo['forumid'], 'candeleteposts') or can_moderate($threadinfo['forumid'], 'canremoveposts')) { $mod |= MOD_DELETEPOST; } if (can_moderate($threadinfo['forumid'], 'canmanagethreads')) { if ($threadinfo['sticky']) { $mod |= MOD_UNSTICK; } else { $mod |= MOD_STICK; } } if ($threadinfo['visible'] != 2 and can_moderate($threadinfo['forumid'], 'candeleteposts') or can_moderate($threadinfo['forumid'], 'canremoveposts') or $forumperms & $vbulletin->bf_ugp_forumpermissions['candeletepost'] and $forumperms & $vbulletin->bf_ugp_forumpermissions['candeletethread'] and $vbulletin->userinfo['userid'] == $threadinfo['postuserid'] and ($vbulletin->options['edittimelimit'] == 0 or $threadinfo['dateline'] > TIMENOW - $vbulletin->options['edittimelimit'] * 60)) { $mod |= MOD_DELETETHREAD; } if (can_moderate($threadinfo['forumid'], 'canopenclose') or $forumperms & $vbulletin->bf_ugp_forumpermissions['canopenclose'] and $threadinfo['postuserid'] == $vbulletin->userinfo['userid']) { if ($threadinfo['open']) { $mod |= MOD_CLOSE; } else { $mod |= MOD_OPEN; } } if (can_moderate($threadinfo['forumid'], 'canmanagethreads') or $forumperms & $vbulletin->bf_ugp_forumpermissions['canmove'] and $threadinfo['postuserid'] == $vbulletin->userinfo['userid']) { $mod |= MOD_MOVETHREAD; } if ($show['spamctrls']) { $mod |= MOD_SPAM_CONTROLS; } $out = array('posts' => $posts_out, 'total_posts' => $totalposts, 'page' => $vbulletin->GPC['pagenumber'], 'canpost' => $canpost ? 1 : 0, 'mod' => $mod, 'pollid' => $thread['pollid'], 'subscribed' => $threadinfo['issubscribed'] ? 1 : 0, 'title' => prepare_utf8_string($thread['title']), 'canattach' => $forumperms & $vbulletin->bf_ugp_forumpermissions['canpostattachment'] and $vbulletin->userinfo['userid']); if ($postid) { $out['gotopostid'] = $postid; } return $out; }
/** * Takes information regardign a group, and prepares the information within it * for display * * @param array Group Array * * @return array Group Array with prepared information * */ function prepare_socialgroup($group) { global $vbulletin; if (!is_array($group)) { return array(); } $group['joindate'] = $group['joindate'] ? vbdate($vbulletin->options['dateformat'], $group['joindate'], true) : ''; $group['createdate'] = $group['createdate'] ? vbdate($vbulletin->options['dateformat'], $group['createdate'], true) : ''; $group['members'] = vb_number_format($group['members']); $group['moderatedmembers'] = vb_number_format($group['moderatedmembers']); if (!($group['options'] & $vbulletin->bf_misc_socialgroupoptions['enable_group_albums'])) { // albums disabled in this group - force 0 pictures $group['picturecount'] = 0; } $group['rawpicturecount'] = $group['picturecount']; $group['picturecount'] = vb_number_format($group['picturecount']); $group['rawname'] = $group['name']; $group['rawdescription'] = $group['description']; $group['name'] = fetch_word_wrapped_string(fetch_censored_text($group['name'])); $group['shortdescription'] = fetch_word_wrapped_string(fetch_censored_text(fetch_trimmed_title($group['description'], 200))); $group['description'] = nl2br(fetch_word_wrapped_string(fetch_censored_text($group['description']))); $group['is_owner'] = $group['creatoruserid'] == $vbulletin->userinfo['userid']; $group['is_automoderated'] = ($group['options'] & $vbulletin->bf_misc_socialgroupoptions['owner_mod_queue'] and $vbulletin->options['sg_allow_owner_mod_queue'] and !$vbulletin->options['social_moderation']); $group['canviewcontent'] = (!($group['options'] & $vbulletin->bf_misc_socialgroupoptions['join_to_view']) or !$vbulletin->options['sg_allow_join_to_view'] or $group['membertype'] == 'member' or can_moderate(0, 'canmoderategroupmessages') or can_moderate(0, 'canremovegroupmessages') or can_moderate(0, 'candeletegroupmessages') or can_moderate(0, 'candeletegroupmessages')); $group['lastpostdate'] = vbdate($vbulletin->options['dateformat'], $group['lastpost'], true); $group['lastposttime'] = vbdate($vbulletin->options['timeformat'], $group['lastpost']); $group['lastposterid'] = $group['canviewcontent'] ? $group['lastposterid'] : 0; $group['lastposter'] = $group['canviewcontent'] ? $group['lastposter'] : ''; ($hook = vBulletinHook::fetch_hook('group_prepareinfo')) ? eval($hook) : false; return $group; }
function convert_ids_to_titles() { global $vbulletin; global $albumids, $attachmentids, $calendarids, $eventids, $forumids, $infractionids, $pmids, $postids, $searchids, $socialgroupids, $threadids, $userids; global $wol_album, $wol_attachment, $wol_calendar, $wol_event, $wol_inf, $wol_pm, $wol_post, $wol_search, $wol_socialgroup, $wol_thread, $wol_user; /* if ($attachmentids) { $postidquery = $vbulletin->db->query_read_slave(" SELECT postid, attachmentid FROM " . TABLE_PREFIX . "attachment WHERE attachmentid IN (0$attachmentids) "); while ($postidqueryr = $vbulletin->db->fetch_array($postidquery)) { $postids .= ',' . $postidqueryr['postid']; $wol_attachment["$postidqueryr[attachmentid]"] = $postidqueryr['postid']; } } */ if ($postids) { $postidquery = $vbulletin->db->query_read_slave(" SELECT threadid, postid FROM " . TABLE_PREFIX . "post WHERE postid IN (0$postids) "); while ($postidqueryr = $vbulletin->db->fetch_array($postidquery)) { $threadids .= ',' . $postidqueryr['threadid']; $wol_post["$postidqueryr[postid]"] = $postidqueryr['threadid']; } } if ($socialgroupids) { $socialgroups = $vbulletin->db->query_read_slave(" SELECT name, groupid FROM " . TABLE_PREFIX . "socialgroup WHERE groupid IN (0$socialgroupids) "); while ($socialgroup = $vbulletin->db->fetch_array($socialgroups)) { $wol_socialgroup["$socialgroup[groupid]"]['name'] = $socialgroup['name']; } } if ($albumids) { $albums = $vbulletin->db->query_read_slave(" SELECT album.title, album.albumid, album.state, album.userid FROM " . TABLE_PREFIX . "album AS album LEFT JOIN " . TABLE_PREFIX . "profileblockprivacy AS profileblockprivacy ON (profileblockprivacy.userid = album.userid AND profileblockprivacy.blockid = 'albums') WHERE album.albumid IN (0$albumids) AND (profileblockprivacy.requirement = 0 OR profileblockprivacy.requirement IS NULL) "); while ($album = $vbulletin->db->fetch_array($albums)) { $wol_album["$album[albumid]"] = $album; } } if ($threadids) { $threadresults = $vbulletin->db->query_read_slave(" SELECT thread.title, thread.prefixid, thread.threadid, thread.forumid, thread.postuserid, thread.visible " . iif($vbulletin->options['threadpreview'] > 0, ",post.pagetext AS preview") . " " . iif($vbulletin->options['threadsubscribed'] AND $vbulletin->userinfo['userid'], ", NOT ISNULL(subscribethread.subscribethreadid) AS issubscribed") . " FROM " . TABLE_PREFIX . "thread AS thread " . iif($vbulletin->options['threadpreview'] > 0, "LEFT JOIN " . TABLE_PREFIX . "post AS post ON(post.postid = thread.firstpostid)") . " " . iif($vbulletin->options['threadsubscribed'] AND $vbulletin->userinfo['userid'], " LEFT JOIN " . TABLE_PREFIX . "subscribethread AS subscribethread ON(subscribethread.threadid = thread.threadid AND subscribethread.userid = " . $vbulletin->userinfo['userid'] . " AND canview = 1)") . " WHERE thread.threadid IN (0$threadids) "); while ($threadresult = $vbulletin->db->fetch_array($threadresults)) { $wol_thread["$threadresult[threadid]"]['title'] = $threadresult['title']; $wol_thread["$threadresult[threadid]"]['prefixid'] = $threadresult['prefixid']; $wol_thread["$threadresult[threadid]"]['forumid'] = $threadresult['forumid']; $wol_thread["$threadresult[threadid]"]['postuserid'] = $threadresult['postuserid']; $wol_thread["$threadresult[threadid]"]['isdeleted'] = ($threadresult['visible'] == 2) ? true : false; $wol_thread["$threadresult[threadid]"]['visible'] = ($threadresult['visible'] == 1) ? true : false; $wol_thread["$threadresult[threadid]"]['issubscribed'] = $threadresult['issubscribed']; // format thread preview if there is one $userperms = fetch_permissions($threadresult['forumid']); if (!empty($threadresult['preview']) AND $vbulletin->options['threadpreview'] > 0 AND ($userperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads'])) { // 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))); if (!$ignore["$threadresult[postuserid]"]) { $threadresult['preview'] = strip_quotes($threadresult['preview']); $threadresult['preview'] = htmlspecialchars_uni(strip_bbcode(fetch_trimmed_title($threadresult['preview'], $vbulletin->options['threadpreview']), false, true)); $wol_thread["$threadresult[threadid]"]['preview'] = $threadresult['preview']; } } } } if ($calendarids) { $calendarresults = $vbulletin->db->query_read_slave(" SELECT calendarid, title FROM " . TABLE_PREFIX . "calendar WHERE calendarid IN (0$calendarids) "); while ($calendarresult = $vbulletin->db->fetch_array($calendarresults)) { $wol_calendar["$calendarresult[calendarid]"] = $calendarresult['title']; } } if ($infractionids) { $infractions = $vbulletin->db->query_read_slave(" SELECT infractionid, userid FROM " . TABLE_PREFIX . "infraction WHERE infractionid IN (0$infractionids) "); while ($infraction = $vbulletin->db->fetch_array($infractions)) { $wol_inf["$infraction[infractionid]"]['userid'] = $infraction['userid']; $userids .= ',' . $infraction['userid']; } } if ($eventids) { $eventresults = $vbulletin->db->query_read_slave(" SELECT eventid, title, userid, calendarid FROM " . TABLE_PREFIX . "event WHERE eventid IN (0$eventids) "); while ($eventresult = $vbulletin->db->fetch_array($eventresults)) { $wol_event["$eventresult[eventid]"]['title'] = $eventresult['title']; $wol_event["$eventresult[eventid]"]['calendarid'] = $eventresult['calendarid']; $wol_event["$eventresult[eventid]"]['postuserid'] = $eventresult['userid']; } } if ($pmids AND ($vbulletin->userinfo['permissions']['wolpermissions'] & $vbulletin->bf_ugp_wolpermissions['canwhosonlinefull'])) { $pmresults = $vbulletin->db->query_read_slave(" SELECT pmtext.fromuserid, pm.pmid FROM " . TABLE_PREFIX . "pm AS pm LEFT JOIN " . TABLE_PREFIX . "pmtext AS pmtext ON (pm.pmtextid = pmtext.pmtextid) WHERE pmid IN (0$pmids) "); while ($pmresult = $vbulletin->db->fetch_array($pmresults)) { $wol_pm["$pmresult[pmid]"] = $pmresult['fromuserid']; $userids .= ',' . intval($pmresult['fromuserid']); } } if ($searchids AND ($vbulletin->userinfo['permissions']['wolpermissions'] & $vbulletin->bf_ugp_wolpermissions['canwhosonlinefull'])) { //rework this to get what the code assumes the array looks like from the new search code. //in particular the searchuser value has been changed from a string to a bool based on usage //and the fact that we don't really have it. require_once(DIR . "/vb/search/core.php"); require_once(DIR . '/vb/search/criteria.php'); $searchresults = $vbulletin->db->query_read_slave(" SELECT searchlog.searchlogid AS searchid, searchlog.userid, searchlog.criteria FROM " . TABLE_PREFIX . "searchlog AS searchlog WHERE searchlog.searchlogid IN (0$searchids) "); while ($searchresult = $vbulletin->db->fetch_array($searchresults)) { if ($searchresult['criteria']) { $criteria = unserialize($searchresult['criteria']); $targetuserid = $criteria->get_target_userid(); if ($targetuserid) { $userids .= ",userid"; } $searchresult['targetuserid'] = $targetuserid; $searchresult['searchuser'] = (bool) $targetuserid; $searchresult['query'] = $criteria->get_raw_keywords(); unset($searchresult['criteria']); } $wol_search["$searchresult[searchid]"] = $searchresult; } } if ($userids AND ($vbulletin->userinfo['permissions']['wolpermissions'] & $vbulletin->bf_ugp_wolpermissions['canwhosonlinefull'])) { $userresults = $vbulletin->db->query_read_slave(" SELECT userid, username, IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid FROM " . TABLE_PREFIX . "user AS user WHERE userid IN (0$userids) "); while ($userresult = $vbulletin->db->fetch_array($userresults)) { fetch_musername($userresult); $wol_user["$userresult[userid]"]['musername'] = $userresult['musername']; $wol_user["$userresult[userid]"]['username'] = $userresult['username']; } } ($hook = vBulletinHook::fetch_hook('online_ids_titles')) ? eval($hook) : false; }
// ####################################################################### if ($_POST['do'] == 'doremovepicture') { $vbulletin->input->clean_array_gpc('p', array('deny' => TYPE_NOHTML)); // You either clicked no or you're a guest if (!empty($vbulletin->GPC['deny'])) { $vbulletin->url = 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'do=grouppictures&groupid=' . $group['groupid']; eval(print_standard_redirect('action_cancelled')); } $db->query_write("\n\t\tDELETE FROM " . TABLE_PREFIX . "socialgrouppicture\n\t\tWHERE groupid = {$group['groupid']}\n\t\t\tAND pictureid = {$pictureinfo['pictureid']}\n\t"); $groupdm = datamanager_init('SocialGroup', $vbulletin); $groupdm->set_existing($group); $groupdm->rebuild_picturecount(); $groupdm->save(); if (!$group['is_owner'] and $pictureinfo['userid'] != $vbulletin->userinfo['userid'] and can_moderate(0, 'caneditalbumpicture')) { require_once DIR . '/includes/functions_log_error.php'; log_moderator_action($pictureinfo, 'social_group_picture_x_in_y_removed', array(fetch_trimmed_title($pictureinfo['caption'], 50), $group['name'])); } ($hook = vBulletinHook::fetch_hook('group_picture_delete')) ? eval($hook) : false; if ($groupdm->fetch_field('picturecount')) { $vbulletin->url = 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'do=grouppictures&groupid=' . $group['groupid']; } else { $vbulletin->url = 'group.php?' . $vbulletin->session->vars['sessionurl'] . 'groupid=' . $group['groupid']; } eval(print_standard_redirect('picture_removed_from_group')); } // ####################################################################### if ($_REQUEST['do'] == 'removepicture') { $vbulletin->input->clean_array_gpc('r', array('pictureid' => TYPE_UINT)); $confirmdo = 'doremovepicture'; $confirmaction = 'group.php?do=' . $confirmdo; $title_phrase = $vbphrase['remove_picture_from_group'];
/** * Prepare any data needed for the output * * @param string The id of the block * @param array Options specific to the block */ function prepare_output($id = '', $options = array()) { global $show, $vbphrase; $show['infractions'] = false; ($hook = vBulletinHook::fetch_hook('member_infraction_start')) ? eval($hook) : false; $perpage = $options['perpage']; $pagenumber = $options['pagenumber']; $totalinfractions = $this->registry->db->query_first_slave("\n\t\t\tSELECT COUNT(*) AS count\n\t\t\tFROM " . TABLE_PREFIX . "infraction AS infraction\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "post AS post ON (infraction.postid = post.postid)\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "thread AS thread ON (post.threadid = thread.threadid)\n\t\t\tWHERE infraction.userid = " . $this->profile->userinfo['userid'] . "\n\t\t"); if ($totalinfractions['count']) { if (!$pagenumber or $options['tab'] != $id) { $pagenumber = 1; } // set defaults sanitize_pageresults($totalinfractions['count'], $pagenumber, $perpage, 100, 5); $limitlower = ($pagenumber - 1) * $perpage + 1; $limitupper = $pagenumber * $perpage; if ($limitupper > $totalinfractions['count']) { $limitupper = $totalinfractions['count']; if ($limitlower > $totalinfractions['count']) { $limitlower = $totalinfractions['count'] - $perpage; } } if ($limitlower <= 0) { $limitlower = 1; } if ($this->profile->userinfo['userid'] != $this->registry->userinfo['userid'] and $this->registry->userinfo['permissions']['genericpermissions'] & $this->registry->bf_ugp_genericpermissions['canreverseinfraction']) { $show['reverse'] = true; } require_once DIR . '/includes/class_bbcode.php'; $bbcode_parser = new vB_BbCodeParser($this->registry, fetch_tag_list()); $infractions = $this->registry->db->query_read_slave("\n\t\t\t\tSELECT infraction.*, thread.title, thread.threadid, user.username, thread.visible AS thread_visible, post.visible,\n\t\t\t\t\tforumid, postuserid, IF(ISNULL(post.postid) AND infraction.postid != 0, 1, 0) AS postdeleted\n\t\t\t\tFROM " . TABLE_PREFIX . "infraction AS infraction\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "post AS post ON (infraction.postid = post.postid)\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "thread AS thread ON (post.threadid = thread.threadid)\n\t\t\t\tINNER JOIN " . TABLE_PREFIX . "user AS user ON (infraction.whoadded = user.userid)\n\t\t\t\tWHERE infraction.userid = " . $this->profile->userinfo['userid'] . "\n\t\t\t\tORDER BY infraction.dateline DESC\n\t\t\t\tLIMIT " . ($limitlower - 1) . ", {$perpage}\n\t\t\t"); while ($infraction = $this->registry->db->fetch_array($infractions)) { $show['expired'] = $show['reversed'] = $show['neverexpires'] = false; $card = $infraction['points'] > 0 ? 'redcard' : 'yellowcard'; $infraction['timeline'] = vbdate($this->registry->options['timeformat'], $infraction['dateline']); $infraction['dateline'] = vbdate($this->registry->options['dateformat'], $infraction['dateline']); switch ($infraction['action']) { case 0: if ($infraction['expires'] != 0) { $infraction['expires_timeline'] = vbdate($this->registry->options['timeformat'], $infraction['expires']); $infraction['expires_dateline'] = vbdate($this->registry->options['dateformat'], $infraction['expires']); $show['neverexpires'] = false; } else { $show['neverexpires'] = true; } break; case 1: $show['expired'] = true; break; case 2: $show['reversed'] = true; break; } $infraction['threadtitle'] = vbstrlen($infraction['title']) > 25 ? fetch_trimmed_title($infraction['title'], 24) : $infraction['title']; $infraction['reason'] = !empty($vbphrase['infractionlevel' . $infraction['infractionlevelid'] . '_title']) ? $vbphrase['infractionlevel' . $infraction['infractionlevelid'] . '_title'] : ($infraction['customreason'] ? $infraction['customreason'] : $vbphrase['n_a']); $show['threadtitle'] = true; $show['postdeleted'] = false; if ($infraction['postid'] != 0) { if ($infraction['postdeleted']) { $show['postdeleted'] = true; } else { if ((!$infraction['visible'] or !$infraction['thread_visible']) and !can_moderate($infraction['forumid'], 'canmoderateposts')) { $show['threadtitle'] = false; } else { if (($infraction['visible'] == 2 or $infraction['thread_visible'] == 2) and !can_moderate($infraction['forumid'], 'candeleteposts')) { $show['threadtitle'] = false; } else { $forumperms = fetch_permissions($infraction['forumid']); if (!($forumperms & $this->registry->bf_ugp_forumpermissions['canview'])) { $show['threadtitle'] = false; } if (!($forumperms & $this->registry->bf_ugp_forumpermissions['canviewothers']) and ($infraction['postuserid'] != $this->registry->userinfo['userid'] or $this->registry->userinfo['userid'] == 0)) { $show['threadtitle'] = false; } } } } } ($hook = vBulletinHook::fetch_hook('member_infractionbit')) ? eval($hook) : false; $threadinfo = array('threadid' => $infraction['threadid'], 'title' => $infraction['title']); $pageinfo = array('p' => $infraction['postid']); $memberinfo = array('userid' => $infraction['whoadded'], 'username' => $infraction['username']); $templater = vB_Template::create('memberinfo_infractionbit'); $templater->register('card', $card); $templater->register('infraction', $infraction); $templater->register('memberinfo', $memberinfo); $templater->register('pageinfo', $pageinfo); $templater->register('threadinfo', $threadinfo); $infractionbits .= $templater->render(); } unset($bbcode_parser); $pageinfo_pagenav = array('tab' => $id); if ($options['perpage']) { $pageinfo_pagenav['pp'] = $options['perpage']; } $this->block_data['pagenav'] = construct_page_nav($pagenumber, $perpage, $totalinfractions['count'], '', '', $id, 'member', $this->profile->userinfo, $pageinfo_pagenav); $this->block_data['infractionbits'] = $infractionbits; } $show['giveinfraction'] = ($this->registry->userinfo['permissions']['genericpermissions'] & $this->registry->bf_ugp_genericpermissions['cangiveinfraction'] and $this->profile->userinfo['userid'] != $this->registry->userinfo['userid'] and !($this->profile->userinfo['permissions']['adminpermissions'] & $this->registry->bf_ugp_adminpermissions['cancontrolpanel']) and (!($this->profile->userinfo['permissions']['adminpermissions'] & $this->registry->bf_ugp_adminpermissions['ismoderator']) or $this->registry->userinfo['permissions']['adminpermissions'] & $this->registry->bf_ugp_adminpermissions['cancontrolpanel'])); ($hook = vBulletinHook::fetch_hook('member_infraction_complete')) ? eval($hook) : false; }
UPDATE " . TABLE_PREFIX . "picturecomment SET state = 'visible' WHERE commentid IN(" . implode(',', array_keys($messagearray)) . ") "); foreach(array_keys($userlist) AS $userid) { build_picture_comment_counters($userid); } if (can_moderate(0, 'candeletepicturecomments')) { foreach ($messagearray AS $message) { log_moderator_action($message, 'pc_by_x_on_y_undeleted', array($message['postusername'], fetch_trimmed_title($message['picture_caption'], 50)) ); } } // empty cookie setcookie('vbulletin_inlinepicturecomment', '', TIMENOW - 3600, '/'); ($hook = vBulletinHook::fetch_hook('picturecomment_inlinemod_undelete')) ? eval($hook) : false; eval(print_standard_redirect('redirect_inline_undeletedmessages', true, $forceredirect)); } /*======================================================================*\ || #################################################################### || #
$xml->add_group('item'); $xml->add_tag('title', $thread['prefix_plain'] . unhtmlspecialchars($thread['title'])); $xml->add_tag('link', $vbulletin->options['bburl'] . '/' . fetch_seo_url('thread|nosession|js', $thread, array('goto' => 'newpost')), array(), false, true); $xml->add_tag('pubDate', gmdate('D, d M Y H:i:s', $thread['dateline']) . ' GMT'); $plaintext_parser = new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list($vbulletin->options['bburl'] . '/')); $plainmessage = $plaintext_parser->parse($thread['message'], $thread['forumid']); unset($plaintext_parser); if ($vbulletin->GPC['fulldesc']) { $xml->add_tag('description', $plainmessage); } else { $xml->add_tag('description', fetch_trimmed_title($plainmessage, $vbulletin->options['threadpreview'])); } if (!$vbulletin->GPC['nohtml']) { $thread['attachments'] = $attachmentcache["$thread[postid]"]; $forumperms = fetch_permissions($thread['forumid']); $postbit_factory->thread =& $thread; $postbit_factory->cache = array(); if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['cangetattachment'])) { $vbulletin->options['viewattachedimages'] = 0; $vbulletin->options['attachthumbs'] = 0; } else {
/** * Return title string for display * * If there is no title given, we'll construct one from the post text */ public function get_display_title() { $title = $this->get_field('title'); if ($title == '') { $title = fetch_trimmed_title(strip_bbcode($this->get_field('pagetext'), true, false, true), 50); } else { $title = fetch_censored_text($title); } return $title; }
public function getHTML($postinfo = false) { if (!$postinfo) { $postinfo = $this->getData(); } if ($postinfo) { foreach ($postinfo as $key => $post) { $postinfo[$key]['url'] = fetch_seo_url('thread', $post, array('p' => $post['postid'])) . '#post' . $post['postid']; $postinfo[$key]['newposturl'] = fetch_seo_url('thread', $post, array('goto' => 'newpost')); // trim the title after fetching the urls $postinfo[$key]['title'] = fetch_trimmed_title($post['title'], $this->config['newposts_titlemaxchars']); } $templater = vB_Template::create('block_newposts'); $templater->register('blockinfo', $this->blockinfo); $templater->register('posts', $postinfo); return $templater->render(); } }
$blockinfo['type'] == 'block' AND !$blockinfo['userinfo']['permissions']['vbblog_customblocks'] ) OR ( $blockinfo['type'] == 'page' AND !$blockinfo['userinfo']['permissions']['vbblog_custompages'] ) ) { print_no_permission(); } $blockinfo['title_trimmed'] = fetch_trimmed_title($blockinfo['title']); $navbits['blog.php?' . $vbulletin->session->vars['sessionurl'] . "u={$blockinfo[userinfo][userid]}"] = $blockinfo['userinfo']['blog_title']; $navbits['blog.php?' . $vbulletin->session->vars['sessionurl'] . "cp=$blockinfo[customblockid]"] = $blockinfo['title']; $navbits[] = $vbphrase['report_custom_page']; $reportobj = new vB_ReportItem_Blog_Custom_Page($vbulletin); $reportobj->set_extrainfo('user', $blockinfo['userinfo']); $forminfo = $reportobj->set_forminfo($blockinfo); } ($hook = vBulletinHook::fetch_hook('blog_report_start')) ? eval($hook) : false; $perform_floodcheck = $reportobj->need_floodcheck(); if ($perform_floodcheck)
$infraction['expires_dateline'] = vbdate($vbulletin->options['dateformat'], $infraction['expires']); $show['neverexpires'] = false; } else { $show['neverexpires'] = true; } break; case 1: $show['expired'] = true; break; case 2: $show['reversed'] = true; break; } $threadinfo = array('threadid' => $infraction['threadid'], 'title' => $infraction['title']); if (vbstrlen($infraction['title']) > 25) { $infraction['title'] = fetch_trimmed_title($infraction['title'], 24); } $infraction['reason'] = !empty($vbphrase['infractionlevel' . $infraction['infractionlevelid'] . '_title']) ? $vbphrase['infractionlevel' . $infraction['infractionlevelid'] . '_title'] : ($infraction['customreason'] ? $infraction['customreason'] : $vbphrase['n_a']); ($hook = vBulletinHook::fetch_hook('usercp_infractioninfobit')) ? eval($hook) : false; $pageinfo = array('p' => $infraction['postid']); $templater = vB_Template::create('userinfraction_infobit'); $templater->register('card', $card); $templater->register('infraction', $infraction); $templater->register('pageinfo', $pageinfo); $templater->register('threadinfo', $threadinfo); $infractionbits .= $templater->render(); $show['infractions'] = true; } unset($bbcode_parser); require_once DIR . '/includes/functions_misc.php'; // check if user can be invisible and is invisible
$post['posticon'] = false; $post['posticonpath'] = ''; $post['posticontitle'] = ''; } } } else { $post['posticon'] = false; $post['posticonpath'] = ''; $post['posticontitle'] = ''; } $post['pagetext'] = preg_replace('#\\[quote(=("|"|\'|)??.*\\2)?\\](((?>[^\\[]*?|(?R)|.))*)\\[/quote\\]#siU', '', $post['pagetext']); // get first 200 chars of page text $post['pagetext'] = htmlspecialchars_uni(fetch_censored_text(trim(fetch_trimmed_title(strip_bbcode($post['pagetext'], 1), 200)))); // get post title if ($post['posttitle'] == '') { $post['posttitle'] = fetch_trimmed_title($post['pagetext'], 50); } else { $post['posttitle'] = fetch_censored_text($post['posttitle']); } // format post text $post['pagetext'] = nl2br($post['pagetext']); // get info from post $post = process_thread_array($post, $lastread["{$post['forumid']}"], $post['allowicons']); $show['managepost'] = (can_moderate($post['forumid'], 'candeleteposts') or can_moderate($post['forumid'], 'canremoveposts')) ? true : false; $show['approvepost'] = can_moderate($post['forumid'], 'canmoderateposts') ? true : false; $show['managethread'] = can_moderate($post['forumid'], 'canmanagethreads') ? true : false; $show['disabled'] = ($show['managethread'] or $show['managepost'] or $show['approvepost']) ? false : true; $show['moderated'] = (!$post['visible'] or !$post['thread_visible'] and $post['postid'] == $post['firstpostid']) ? true : false; if ($post['pdel_userid']) { $post['del_username'] =& $post['pdel_username']; $post['del_userid'] =& $post['pdel_userid'];
public function getData() { //the user can't see socialgroups, abort now. if ( !($this->registry->options['socnet'] & $this->registry->bf_misc_socnet['enable_groups']) OR !($this->registry->userinfo['permissions']['socialgrouppermissions'] & $this->registry->bf_ugp_socialgrouppermissions['canviewgroups']) ) { return ""; } if ($this->config['sgdiscussions_groupids']) { $groupids = explode(',', $this->config['sgdiscussions_groupids']); $groupidsql = ''; if (intval($groupids[0])) { $groupidsql = " AND socialgroup.groupid IN (-1"; foreach ((array)$groupids as $groupid) { $groupidsql .= "," . intval($groupid); } $groupidsql .= ")"; } } if ($this->config['sgdiscussions_catids']) { $catidsql = ''; if (!in_array(-1, $this->config['sgdiscussions_catids'])) { $catidsql = " AND socialgroup.socialgroupcategoryid IN (-1"; foreach ($this->config['sgdiscussions_catids'] AS $catid) { $catidsql .= ",$catid"; } $catidsql .= ")"; } } $datecut = TIMENOW - ($this->config['datecut'] * 86400); switch (intval($this->config['sgdiscussions_type'])) { case 0: $ordersql = " groupmessage.dateline DESC"; $datecutoffsql = " AND groupmessage.dateline > $datecut"; break; case 1: $ordersql = " discussion.lastpost DESC"; $datecutoffsql = " AND discussion.lastpost > $datecut"; break; case 2: $ordersql = " discussion.visible DESC"; $datecutoffsql = " AND groupmessage.dateline > $datecut"; break; } // remove threads from users on the global ignore list if user is not a moderator $globalignore = ''; if (trim($this->registry->options['globalignore']) != '') { require_once(DIR . '/includes/functions_bigthree.php'); if ($Coventry = fetch_coventry('string')) { $globalignore = "AND groupmessage.postuserid NOT IN ($Coventry) "; } } require_once(DIR . '/includes/functions_socialgroup.php'); $canviewprivate = ( //don't allow groups to be hidden from non members !$this->registry->options['sg_allow_join_to_view'] OR //can see hidden groups can_moderate(0, 'canmoderategroupmessages') OR can_moderate(0, 'canremovegroupmessages') OR can_moderate(0, 'candeletegroupmessages') OR fetch_socialgroup_perm('canalwayspostmessage') OR fetch_socialgroup_perm('canalwascreatediscussion') ); $membertypejoin = ""; $memberfilter = ""; if (!$canviewprivate) { $memberfilter = "AND ( !(socialgroup.options & " . $this->registry->bf_misc_socialgroupoptions["join_to_view"] . ")"; if ($this->registry->userinfo['userid']) { $membertypejoin = "LEFT JOIN " . TABLE_PREFIX . "socialgroupmember AS socialgroupmember ON (socialgroupmember.userid = " . $this->registry->userinfo['userid'] . " AND socialgroupmember.groupid = socialgroup.groupid)"; $memberfilter .= " OR socialgroupmember.type = 'member' "; } $memberfilter.= ")"; } $gms = $this->registry->db->query_read_slave(" SELECT discussion.discussionid, discussion.groupid, discussion.lastpostid, discussion.lastpost, discussion.lastposter, discussion.lastposterid, discussion.visible, groupmessage.gmid, groupmessage.postuserid, groupmessage.postusername, groupmessage.dateline, groupmessage.title, groupmessage.pagetext as message, socialgroup.name as groupname, socialgroup.description as groupdescription, user.* " . ($this->registry->options['avatarenabled'] ? ",avatar.avatarpath, NOT ISNULL(customavatar.userid) AS hascustomavatar, customavatar.dateline AS avatardateline,customavatar.width AS avwidth,customavatar.height AS avheight" : "") . " FROM " . TABLE_PREFIX . "discussion AS discussion INNER JOIN " . TABLE_PREFIX . "socialgroup AS socialgroup ON(discussion.groupid = socialgroup.groupid) INNER JOIN " . TABLE_PREFIX . "groupmessage AS groupmessage ON (discussion.firstpostid = groupmessage.gmid) LEFT JOIN " . TABLE_PREFIX . "user AS user ON (groupmessage.postuserid = user.userid) " . ($this->registry->options['avatarenabled'] ? "LEFT JOIN " . TABLE_PREFIX . "avatar AS avatar ON(avatar.avatarid = user.avatarid) LEFT JOIN " . TABLE_PREFIX . "customavatar AS customavatar ON(customavatar.userid = user.userid)" : "") . " $membertypejoin WHERE 1=1 $groupidsql $catidsql $memberfilter AND discussion.visible > 0 AND groupmessage.state = 'visible' $datecutoffsql $globalignore ORDER BY$ordersql LIMIT 0," . intval($this->config['sgdiscussions_limit']) . " "); while ($gm = $this->registry->db->fetch_array($gms)) { $gm['title'] = fetch_trimmed_title($gm['title'], $this->config['sgdiscussions_titlemaxchars']); $gm['groupname'] = htmlspecialchars_uni($gm['groupname']); $gm['groupdescription'] = htmlspecialchars_uni($gm['groupdescription']); //$gm['url'] = 'group.php?' . $this->registry->session->vars['sessionurl'] . 'do=discuss&discussionid=' . $gm['discussionid']; //$gm['groupurl'] = 'group.php?' . $this->registry->session->vars['sessionurl'] . 'groupid=' . $gm['groupid']; $gm['date'] = vbdate($this->registry->options['dateformat'], $gm['dateline'], true); $gm['time'] = vbdate($this->registry->options['timeformat'], $gm['dateline']); $gm['lastpostdate'] = vbdate($this->registry->options['dateformat'], $gm['lastpost'], true); $gm['lastposttime'] = vbdate($this->registry->options['timeformat'], $gm['lastpost']); $gm['message'] = $this->get_summary($gm['message'], $this->config['sgdiscussions_messagemaxchars']); // we need to count replies so $gm['replycount'] = $gm['visible'] - 1; // get avatar $this->fetch_avatarinfo($gm); $gmarray[$gm['discussionid']] = $gm; return($gmarray); } }
function cache_events($range) { global $vbulletin, $calendarinfo, $vbphrase, $serveroffset; $numdays = date('j', mktime(0, 0, 0, $range['nextmonth'] + 1, 1, $range['nextyear']) - 1); $beginday = gmmktime(0, 0, 0, $range['frommonth'], 1, $range['fromyear']) + -12 * 3600; $endday = gmmktime(24, 0, 0, $range['nextmonth'], $numdays, $range['nextyear']) + 12 * 3600; $event = array(); $eventids = array(); if ($calendarinfo['showholidays']) { // Holidays show across all calendars that a user has access to. $holidays = $vbulletin->db->query_read_slave("\n\t\t\tSELECT *\n\t\t\tFROM " . TABLE_PREFIX . "holiday\n\t\t"); if ($vbulletin->db->num_rows($holidays)) { while ($ev = $vbulletin->db->fetch_array($holidays)) { $ev['visible'] = 1; $ev['title'] =& $vbphrase['holiday' . $ev['holidayid'] . '_title']; $ev['event'] =& $vbphrase['holiday' . $ev['holidayid'] . '_desc']; $ev['preview'] = strip_quotes($ev['event']); $ev['preview'] = htmlspecialchars_uni(strip_bbcode(fetch_trimmed_title($ev['preview'], 300), false, true)); if ($ev['recurring'] == 6) { $event['holiday1']["{$ev['recuroption']}"][] = $ev; } else { $ev['dateline_from'] = $beginday; $ev['dateline_to'] = $endday; $offset = $vbulletin->userinfo['timezoneoffset'] ? $vbulletin->userinfo['tzoffset'] : $vbulletin->userinfo['timezoneoffset']; $ev['dateline_from_user'] = $ev['dateline_from'] + $offset * 3600; $ev['dateline_to_user'] = $ev['dateline_to'] + $offset * 3600; $recuroption = substr($ev['recuroption'], 2); $event['holiday2']["{$recuroption}"][] = $ev; } } } } $events = $vbulletin->db->query_read_slave("\n\t\tSELECT event.*,\n\t\tuser.username, IF(user.displaygroupid = 0, user.usergroupid, user.displaygroupid) AS displaygroupid,\n\t\tIF(dateline_to = 0, 1, 0) AS singleday\n\t\t" . iif($vbulletin->userinfo['userid'], ", subscribeevent.eventid AS subscribed") . "\n\t\tFROM " . TABLE_PREFIX . "event AS event\n\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = event.userid)\n\t\t" . iif($vbulletin->userinfo['userid'], "LEFT JOIN " . TABLE_PREFIX . "subscribeevent AS subscribeevent ON (subscribeevent.eventid = event.eventid AND subscribeevent.userid = " . $vbulletin->userinfo['userid'] . ")") . "\n\t\tWHERE calendarid = {$calendarinfo['calendarid']} AND\n\t\t\t((dateline_to >= {$beginday} AND dateline_from < {$endday}) OR (dateline_to = 0 AND dateline_from >= {$beginday} AND dateline_from <= {$endday} ))\tAND\n\t\t\tvisible = 1\n\t\tORDER BY dateline_from\n\t"); // Cache Events if ($vbulletin->db->num_rows($events)) { while ($ev = $vbulletin->db->fetch_array($events)) { if ($ev['userid'] != $vbulletin->userinfo['userid'] and !($vbulletin->userinfo['calendarpermissions']["{$calendarinfo['calendarid']}"] & $vbulletin->bf_ugp_calendarpermissions['canviewothersevent'])) { continue; } $ev['preview'] = strip_quotes($ev['event']); $ev['preview'] = htmlspecialchars_uni(strip_bbcode(fetch_trimmed_title($ev['preview'], 300), false, true)); $offset = $ev['dst'] ? $vbulletin->userinfo['timezoneoffset'] : $vbulletin->userinfo['tzoffset']; $ev['dateline_from_user'] = $ev['dateline_from'] + $offset * 3600; $ev['dateline_to_user'] = $ev['dateline_to'] + $offset * 3600; fetch_musername($ev); if (!$ev['recurring']) { if ($ev['singleday']) { $event['singleday']["{$ev['dateline_from']}"][] = $ev; } else { $found = false; $date = explode('-', gmdate('n-j-Y', $ev['dateline_from_user'])); $beginday = gmmktime(0, 0, 0, $date[0], $date[1], $date[2]); while ($beginday <= $ev['dateline_to_user']) { if (!$found) { $event['ranged']["{$beginday}"][] = $ev; $count = count($event['ranged']["{$beginday}"]) - 1; $tempevent =& $event['ranged']["{$beginday}"]["{$count}"]; $found = true; } else { // if event ends at the start of the day, don't display it for that day if ($ev['dateline_to_user'] != $beginday) { $event['ranged']["{$beginday}"][] =& $tempevent; } } $beginday += 86400; } } } else { $event['recurring'][] = $ev; } } } return $event; }
public function render($current_user, $criteria, $template_name = '') { global $show; global $vbulletin; require_once(DIR . '/includes/class_bbcode.php'); require_once(DIR . '/includes/class_bbcode_blog.php'); require_once (DIR . '/includes/functions.php'); require_once (DIR . '/includes/blog_functions.php'); require_once (DIR . '/includes/functions_user.php'); if (!$this->record) { return ""; } if (!strlen($template_name)) { $template_name = 'blog_search_results_result'; } if (! $this->bbcode_parser ) { $this->bbcode_parser = new vB_BbCodeParser_Blog($vbulletin, fetch_tag_list('', true)); } $blog = $this->record; $blog['previewtext'] = htmlspecialchars_uni(fetch_censored_text( fetch_trimmed_title(strip_bbcode($blog['pagetext'], true, true, true, true), $this->preview_length) )); $canmoderation = (can_moderate_blog('canmoderatecomments') OR $vbulletin->userinfo['userid'] == $blog['userid']); $blog['trackbacks_total'] = $blog['trackback_visible'] + ($canmoderation ? $blog['trackback_moderation'] : 0); $blog['comments_total'] = $blog['comments_visible'] + ($canmoderation ? $blog['comments_moderation'] : 0); $blog['lastcommenter_encoded'] = urlencode($blog['lastcommenter']); $blog['lastposttime'] = vbdate($vbulletin->options['timeformat'], $blog['lastcomment']); $blog['lastpostdate'] = vbdate($vbulletin->options['dateformat'], $blog['lastcomment'], true); $blog['lastpostdate'] = vbdate($vbulletin->options['dateformat'], $blog['lastcomment'], true); $show['blogtitle'] = $blog['blogtitle']; $templater = vB_Template::create($template_name); $templater->register('blog', $blog); $templater->register('dateline', $blog['dateline']); $templater->register('dateformat', $vbulletin->options['dateformat']); $templater->register('timeformat', $vbulletin->options['default_timeformat']); if ($vbulletin->options['avatarenabled'] AND (intval($blog['userid']))) { $avatar = fetch_avatar_url($blog['userid']); } if (!isset($avatar) OR (count($avatar) < 2)) { $avatar = false; } //to make the link to the poster $blogposter = array('userid' => $blog['postedby_userid'], 'username' => $blog['postedby_username']); $templater->register('blogposter', $blogposter); $templater->register('avatar', $avatar); return $templater->render(); }
while ($album = $db->fetch_array($profilealbums)) { $albums[$album['albumid']]['title'] = $album['title']; $albums[$album['albumid']]['pictures'][] = $album; } require_once DIR . '/includes/functions_album.php'; foreach ($albums as $albumid => $info) { $picturebits = ''; $show['backgroundpicker'] = true; $optionvalue = $albumid; // Need to shorten album titles here $optiontitle = "{$info['title']} (" . count($info['pictures']) . ")"; $optionselected = empty($albumbits) ? 'selected="selected"' : ''; eval('$albumbits .= "' . fetch_template('option') . '";'); $show['hidediv'] = empty($picturerowbits) ? false : true; foreach ($info['pictures'] as $picture) { $picture['caption_preview'] = fetch_censored_text(fetch_trimmed_title($picture['caption'], $vbulletin->options['album_captionpreviewlen'])); $picture['thumburl'] = $picture['thumbnail_filesize'] ? fetch_picture_url($picture, $picture, true) : ''; $picture['dimensions'] = $picture['thumbnail_width'] ? "width=\"{$picture['thumbnail_width']}\" height=\"{$picture['thumbnail_height']}\"" : ''; eval('$picturebits .= "' . fetch_template('modifyusercss_backgroundbit') . '";'); } eval('$picturerowbits .= "' . fetch_template('modifyusercss_backgroundrow') . '";'); } $show['albumselect'] = count($albums) == 1 ? false : true; $vbulletin->userinfo['cachedcss'] = $usercss->build_css($usercss->fetch_effective()); $vbulletin->userinfo['cachedcss'] = str_replace('/*sessionurl*/', $vbulletin->session->vars['sessionurl_js'], $vbulletin->userinfo['cachedcss']); if ($vbulletin->userinfo['cachedcss']) { $userinfo = $vbulletin->userinfo; eval('$usercss_string = "' . fetch_template('memberinfo_usercss') . '";'); } else { $usercss_string = ''; }
/** * Called when parsing an AME code. Does the actual work in converting contents of [ame] code * * @param string $param1 either the title or url of [ame] tag (only title if $param2 is empty) * @param string $param2 the optional title of [ame] tag. * @param string $title default title * @param boolean $container Flag to include container based on definition setting * @param string $code The embed code with string placeholders (i.e $p1) * @param string $p0 optional parameter for complex replacements * @param string $p1 optional parameter for complex replacements * @param string $p2 optional parameter for complex replacements * @param string $p3 optional parameter for complex replacements * @param string $p4 optional parameter for complex replacements * @param string $p5 optional parameter for complex replacements * @return string Embedded code */ function ame_match_bbcode($param1, $param2 = '', $ameid = '', $title = '', $container = false, $code = '', $p0 = '', $p1 = '', $p2 = '', $p3 = '', $p4 = '', $p5 = '') { global $vbulletin, $stylevar, $vbcollapse; static $inc; $inc++; $ameinfo = array(); $ameinfo['zone'] = ame_fetch_zone(); $ameinfo['id'] = "ame_" . TIMENOW . "_" . $inc; $ameinfo['id_tag'] = $ameinfo['zone'] . "_" . TIMENOW . "_" . $inc; $ameinfo['title'] = $title; $ameinfo['key'] = $ameid; $position = strpos($param1, "@@AMEPARAM@@"); if ($position !== false) { $params = substr($param1, $position + 12); $param1 = substr($param1, 0, $position); $params = explode("@@AMEPARAM@@", $params); if (is_array($params)) { foreach ($params as $key => $value) { eval('$p' . $key . '=\'' . $value . '\';'); } } } $dimensions = "_{$ameinfo['zone']}"; $ameinfo['width'] = $vbulletin->options['automediaembed_width' . $dimensions]; $ameinfo['height'] = $vbulletin->options['automediaembed_height' . $dimensions]; eval('$ameinfo[\'code\'] = "' . ame_slasher($code, false) . '";'); if ($container) { $ameinfo['container'] = true; $templatename = ame_fetch_templatename($ameinfo['zone']); } if (!$param2) { $ameinfo['url'] = $param1; } else { $ameinfo['title'] = $param1; $ameinfo['url'] = $param2; if ($vbulletin->options['automediaembed_limit']) { if (strlen($title) > $vbulletin->options['automediaembed_limit']) { if (function_exists('fetch_trimmed_title')) { $ameinfo['title'] = fetch_trimmed_title($ameinfo['title'], $vbulletin->options['automediaembed_limit']); } } } } ($hook = vBulletinHook::fetch_hook('automediaembed_parse_bbcode_match_start')) ? eval($hook) : false; if ($templatename) { eval('$ame_results = "' . fetch_template($templatename) . '";'); } else { eval('$ame_results = "' . addslashes($ameinfo['code']) . '";'); } eval('$return = "' . fetch_template('ame_output') . '";'); ($hook = vBulletinHook::fetch_hook('automediaembed_parse_bbcode_match_end')) ? eval($hook) : false; return $return; }