本文整理汇总了PHP中fetch_coventry函数的典型用法代码示例。如果您正苦于以下问题:PHP fetch_coventry函数的具体用法?PHP fetch_coventry怎么用?PHP fetch_coventry使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fetch_coventry函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getData
public function getData()
{
if ($this->config['newposts_forumids']) {
if (in_array(-1, $this->config['newposts_forumids'])) {
$forumids = array_keys($this->registry->forumcache);
} else {
$forumids = $this->config['newposts_forumids'];
}
} else {
$forumids = array_keys($this->registry->forumcache);
}
foreach ($forumids as $forumid) {
$forumperms =& $this->registry->userinfo['forumpermissions']["{$forumid}"];
if ($forumperms & $this->registry->bf_ugp_forumpermissions['canview'] and $forumperms & $this->registry->bf_ugp_forumpermissions['canviewothers'] and $forumperms & $this->registry->bf_ugp_forumpermissions['canviewthreads'] and verify_forum_password($forumid, $this->registry->forumcache["{$forumid}"]['password'], false)) {
$forumchoice[] = $forumid;
}
}
if (!empty($forumchoice)) {
$forumsql = "AND thread.forumid IN(" . implode(',', $forumchoice) . ")";
// 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 post.userid NOT IN ({$Coventry}) ";
}
}
$datecut = TIMENOW - $this->config['datecut'] * 86400;
$posts = $this->registry->db->query_read_slave("\n\t\t\t\tSELECT post.dateline, post.pagetext AS message, post.allowsmilie, post.postid,\n\t\t\t\t\tthread.threadid, thread.title, thread.prefixid, post.attach,\n\t\t\t\t\tforum.forumid,\n\t\t\t\t\tuser.*\n\t\t\t\t\t" . ($this->registry->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\tFROM " . TABLE_PREFIX . "post AS post\n\t\t\t\tJOIN " . TABLE_PREFIX . "thread AS thread ON (thread.threadid = post.threadid)\n\t\t\t\tJOIN " . TABLE_PREFIX . "forum AS forum ON(forum.forumid = thread.forumid)\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (post.userid = user.userid)\n\t\t\t\t" . ($this->registry->products['vbcms'] ? " LEFT JOIN " . TABLE_PREFIX . "cms_nodeinfo AS info ON info.associatedthreadid = thread.threadid \n" : '') . ($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)" : "") . "\n\t\t\tWHERE 1=1\n\t\t\t\t{$forumsql}\n\t\t\t\tAND thread.visible = 1\n\t\t\t\tAND post.visible = 1\n\t\t\t\tAND thread.open <> 10\n\t\t\t\tAND post.dateline > {$datecut}\n\t\t\t\t{$globalignore}\n\t\t\t\t" . ($this->userinfo['ignorelist'] ? "AND post.userid NOT IN (" . implode(',', explode(' ', $this->userinfo['ignorelist'])) . ")" : '') . ($this->registry->products['vbcms'] ? " AND info.associatedthreadid IS NULL " : '') . "\n\t\t\tORDER BY post.dateline DESC\n\t\t\tLIMIT 0," . intval($this->config['newposts_limit']) . "\n\t\t\t");
while ($post = $this->registry->db->fetch_array($posts)) {
//$post['url'] = fetch_seo_url('thread', $post, array('p' => $post['postid'])) . '#post' . $post['postid'];
//$post['newposturl'] = fetch_seo_url('thread', $post, array('goto' => 'newpost'));
// trim the title after fetching the urls
//$post['title'] = fetch_trimmed_title($post['title'], $this->config['newposts_titlemaxchars']);
//still need to censor the title
$post['title'] = fetch_censored_text($post['title']);
$post['date'] = vbdate($this->registry->options['dateformat'], $post['dateline'], true);
$post['time'] = vbdate($this->registry->options['timeformat'], $post['dateline']);
$post['message'] = $this->get_summary($post['message'], $this->config['newposts_messagemaxchars']);
// get avatar
$this->fetch_avatarinfo($post);
$postarray[$post['postid']] = $post;
}
return $postarray;
}
}
示例2: output
public function output()
{
global $vbulletin, $threadid, $postid, $db, $VB_API_WHITELIST;
require_once DIR . '/includes/functions_bigthree.php';
$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);
}
$coventry = fetch_coventry('string');
$posts = $db->query_first("\n\t\t\tSELECT MIN(postid) AS postid\n\t\t\tFROM " . TABLE_PREFIX . "post\n\t\t\tWHERE threadid = {$threadinfo['threadid']}\n\t\t\t\tAND visible = 1\n\t\t\t\tAND dateline > " . intval($vbulletin->userinfo['lastvisit']) . "\n\t\t\t\t" . ($coventry ? "AND userid NOT IN ({$coventry})" : "") . "\n\t\t\tLIMIT 1\n\t\t");
if ($posts['postid']) {
$postid = $posts['postid'];
} else {
$postid = $threadinfo['lastpostid'];
}
loadAPI('showthread');
include DIR . '/showthread.php';
}
示例3: getThreads
private function getThreads($type)
{
global $vbulletin, $VB_API_REQUESTS;
if ($vbulletin->options['mobilehomethreadforumids']) {
$forumids = $this->verifycommaoption($vbulletin->options['mobilehomethreadforumids']);
}
if (!$forumids) {
$forumids = array_keys($vbulletin->forumcache);
}
if ($type != 'last') {
$datecut = TIMENOW - $vbulletin->options['mobilehomethreaddatecut'] * 86400;
} else {
$datecut = $vbulletin->userinfo['lastvisit'];
}
switch ($type) {
case 'top':
$ordersql = " thread.views DESC";
$datecutoffsql = " AND thread.dateline > {$datecut}";
break;
case 'new':
$ordersql = " thread.dateline DESC";
$datecutoffsql = " AND thread.dateline > {$datecut}";
break;
case 'last':
$ordersql = " thread.lastpost DESC";
$datecutoffsql = " AND thread.lastpost > {$datecut}";
break;
default:
return null;
}
foreach ($forumids as $forumid) {
$forumperms =& $vbulletin->userinfo['forumpermissions']["{$forumid}"];
if ($forumperms & $vbulletin->bf_ugp_forumpermissions['canview'] and $forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers'] and $forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads'] and verify_forum_password($forumid, $vbulletin->forumcache["{$forumid}"]['password'], false)) {
$forumchoice[] = $forumid;
}
}
if (!empty($forumchoice)) {
$forumsql = "AND thread.forumid IN(" . implode(',', $forumchoice) . ")";
// remove threads from users on the global ignore list if user is not a moderator
$globalignore = '';
if (trim($vbulletin->options['globalignore']) != '') {
require_once DIR . '/includes/functions_bigthree.php';
if ($Coventry = fetch_coventry('string')) {
$globalignore = "AND thread.postuserid NOT IN ({$Coventry}) ";
}
}
// query last threads from visible / chosen forums
$threads = $vbulletin->db->query_read_slave("\n\t\t\t\tSELECT thread.threadid, thread.title, thread.prefixid, post.attach,\n\t\t\t\t\tthread.postusername, thread.dateline, thread.lastpostid, thread.lastpost AS threadlastpost, thread.lastposterid, thread.lastposter, thread.replycount, thread.views,\n\t\t\t\t\tforum.forumid, forum.title_clean as forumtitle,\n\t\t\t\t\tpost.pagetext AS message, post.allowsmilie, post.postid,\n\t\t\t\t\tuser.*\n\t\t\t\t\t" . ($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\tFROM " . TABLE_PREFIX . "thread AS thread\n\t\t\t\tINNER JOIN " . TABLE_PREFIX . "forum AS forum ON(forum.forumid = thread.forumid)\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = thread.firstpostid)\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (thread.postuserid = user.userid)\n\t\t\t\t" . ($vbulletin->products['vbcms'] ? " LEFT JOIN " . TABLE_PREFIX . "cms_nodeinfo AS info ON info.associatedthreadid = thread.threadid \n" : '') . ($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\tWHERE 1=1\n\t\t\t\t{$forumsql}\n\t\t\t\tAND thread.visible = 1\n\t\t\t\tAND post.visible = 1\n\t\t\t\tAND open <> 10\n\t\t\t\t{$datecutoffsql}\n\t\t\t\t{$globalignore}\n\t\t\t\t" . ($vbulletin->userinfo['ignorelist'] ? "AND thread.postuserid NOT IN (" . implode(',', explode(' ', $vbulletin->userinfo['ignorelist'])) . ")" : '') . ($vbulletin->products['vbcms'] ? " AND info.associatedthreadid IS NULL " : '') . "\n\t\t\tORDER BY{$ordersql}\n\t\t\tLIMIT 0, " . $vbulletin->options['mobilehomemaxitems'] . "\n\t\t\t");
$i = 0;
while ($thread = $vbulletin->db->fetch_array($threads)) {
// still need to censor the title
$thread['title'] = fetch_censored_text($thread['title']);
// get avatar
$this->fetch_avatarinfo($thread);
$array[$i] = array('id' => $thread['threadid'], 'title' => $thread['title'], 'replycount' => $thread['replycount'], 'viewcount' => $thread['views'], 'userid' => $thread['userid'], 'username' => $thread['postusername'], 'avatarurl' => $thread['avatarurl'], 'type' => 'thread', 'time' => $thread['lastpost']);
if ($VB_API_REQUESTS['api_version'] > 1) {
$array[$i]['lastposttime'] = $thread['threadlastpost'];
} else {
$array[$i]['lastpostdate'] = date($vbulletin->options['dateformat'], $thread['threadlastpost']);
$array[$i]['lastposttime'] = date($vbulletin->options['timeformat'], $thread['threadlastpost']);
}
$i++;
}
}
return $array;
}
示例4: populateViewContent
/**
* Populates a view with the expected info from a content item.
*
* @param vB_View $view
* @param int $viewtype
*/
protected function populateViewContent(vB_View $view, $viewtype = self::VIEW_PAGE, $increment_count = true)
{
global $show;
if (empty($this->config))
{
$this->content->requireInfo(vBCms_Item_Content::INFO_CONFIG);
$this->config = $this->content->getConfig();
}
if ($_REQUEST['do']== 'apply' OR $_REQUEST['do'] == 'update' OR $_REQUEST['do'] == 'movenode')
{
$this->saveData($view);
$this->content->requireInfo(vBCms_Item_Content::INFO_BASIC);
$this->content->requireInfo(vBCms_Item_Content::INFO_CONFIG);
$this->content->requireInfo(vBCms_Item_Content::INFO_NODE);
$this->content->requireInfo(vBCms_Item_Content::INFO_PARENTS);
$this->content->requireInfo(vBCms_Item_Content::INFO_NAVIGATION);
$this->config = $this->content->getConfig();
}
else
{
$this->content->requireInfo(vBCms_Item_Content::INFO_BASIC);
$this->content->requireInfo(vBCms_Item_Content::INFO_NODE);
$this->content->requireInfo(vBCms_Item_Content::INFO_PARENTS);
$this->content->requireInfo(vBCms_Item_Content::INFO_NAVIGATION);
}
if ($_REQUEST['goto'] == 'newcomment')
{
require_once DIR . '/includes/functions_bigthree.php' ;
$record = vB::$vbulletin->db->query_first("SELECT associatedthreadid
FROM " . TABLE_PREFIX . "cms_nodeinfo WHERE nodeid = " . $this->getNodeId());
$threadid = $record['associatedthreadid'];
$threadinfo = verify_id('thread', $threadid, 1, 1);
if (vB::$vbulletin->options['threadmarking'] AND vB::$vbulletin->userinfo['userid'])
{
vB::$vbulletin->userinfo['lastvisit'] = max($threadinfo['threadread'], $threadinfo['forumread'], TIMENOW - (vB::$vbulletin->options['markinglimit'] * 86400));
}
else if (($tview = intval(fetch_bbarray_cookie('thread_lastview', $threadid))) > vB::$vbulletin->userinfo['lastvisit'])
{
vB::$vbulletin->userinfo['lastvisit'] = $tview;
}
$coventry = fetch_coventry('string');
$posts = vB::$vbulletin->db->query_first("
SELECT MIN(postid) AS postid
FROM " . TABLE_PREFIX . "post
WHERE threadid = $threadinfo[threadid]
AND visible = 1
AND dateline > " . intval(vB::$vbulletin->userinfo['lastvisit']) . "
". ($coventry ? "AND userid NOT IN ($coventry)" : "") . "
LIMIT 1
");
$target_url = vB_Router::getURL();
$join_char = strpos($target_url,'?') ? '&' : '?';
if ($posts['postid'])
{
exec_header_redirect($target_url . $join_char . "commentid=" . $posts['postid'] . "#post$posts[postid]");
}
else
{
exec_header_redirect($target_url . $join_char . "commentid=" . $threadinfo['lastpostid'] . "#post$threadinfo[lastpostid]");
}
}
if ($_REQUEST['commentid'])
{
vB::$vbulletin->input->clean_array_gpc('r', array(
'commentid' => vB_Input::TYPE_INT,
));
$postinfo = verify_id('post', vB::$vbulletin->GPC['commentid'], 1, 1);
$record = vB::$vbulletin->db->query_first("SELECT associatedthreadid
FROM " . TABLE_PREFIX . "cms_nodeinfo WHERE nodeid = " . $this->getNodeId());
$threadid = $record['associatedthreadid'];
// if comment id and node id do not match, we ignore commentid
if ($postinfo['threadid'] == $threadid)
{
$getpagenum = vB::$vbulletin->db->query_first("
SELECT COUNT(*) AS posts
FROM " . TABLE_PREFIX . "post AS post
WHERE threadid = $threadid AND visible = 1
AND dateline <= $postinfo[dateline]
");
$_REQUEST['commentpage'] = ceil($getpagenum['posts'] / 20);
}
}
if ($_REQUEST['do']== 'apply' OR $_REQUEST['do'] == 'update' OR $_REQUEST['do'] == 'movenode')
{
$this->saveData($view);
//.........这里部分代码省略.........
示例5: canViewThread
public static function canViewThread($nodeid, $user)
{
require_once DIR . '/vb/legacy/thread.php';
if (! $row = vB::$vbulletin->db->query_first("SELECT nodeinfo.associatedthreadid
AS threadid, thread.forumid FROM " . TABLE_PREFIX . "cms_nodeinfo
AS nodeinfo LEFT JOIN " . TABLE_PREFIX . "thread AS thread
ON thread.threadid = nodeinfo.associatedthreadid
WHERE nodeinfo.nodeid = $nodeid;" ))
{
return false;
}
//we have to worry about people deleting the thread or the forum. Annoying.
if (intval($row['associatedthreadid']) AND ! intval($row['forumid']))
{
$this->repaircomments($record['associatedthreadid']);
return false;
}
// Trust me, it's just a temp fix -- Xiaoyu
global $thread;
$thread = vB_Legacy_Thread::create_from_id($row['threadid']);
if (!$thread)
{
return false;
}
if (!$thread->can_view($user))
{
return false;
}
$can_moderate_forums = $user->canModerateForum($thread->get_field('forumid'));
$can_moderate_posts = $user->canModerateForum($thread->get_field('forumid'), 'canmoderateposts');
$is_coventry = false;
if (!$can_moderate_forums)
{
//this is cached. Should be fast.
require_once (DIR . '/includes/functions_bigthree.php');
$conventry = fetch_coventry();
$is_coventry = (in_array($user->get_field('userid'), $conventry));
}
if (! $can_moderate_forums AND $is_coventry)
{
return false;
}
// If we got here, the user can at least see the thread. We still have
// to check the individual records;
return array('can_moderate_forums' => $can_moderate_forums,
'is_coventry' => $is_coventry,
'can_moderate_posts' => $can_moderate_posts);
}
示例6: prepare_visitor_message_stats
/**
* Prepares the User's Visitor Message Statistics
*
* @param array The Latest Visitor Message
*/
function prepare_visitor_message_stats($vminfo)
{
global $vbphrase;
if ((!isset($this->prepared['vm_total']) or !isset($this->prepared['lastvm_date']) or !isset($this->prepared['lastvm_time'])) and $this->registry->options['socnet'] & $this->registry->bf_misc_socnet['enable_visitor_messaging'] and (!$this->userinfo['vm_contactonly'] or can_moderate(0, 'canmoderatevisitormessages') or $this->userinfo['userid'] == $this->registry->userinfo['userid'] or $this->userinfo['bbuser_iscontact_of_user']) and ($this->userinfo['vm_enable'] or can_moderate(0, 'canmoderatevisitormessages') and $this->registry->userinfo['userid'] != $this->userinfo['userid'])) {
require_once DIR . '/includes/functions_visitormessage.php';
$state = array('visible');
if (fetch_visitor_message_perm('canmoderatevisitormessages', $this->userinfo)) {
$state[] = 'moderation';
}
if (can_moderate(0, 'canmoderatevisitormessages') or $this->registry->userinfo['userid'] == $this->userinfo['userid'] and $this->registry->userinfo['permissions']['visitormessagepermissions'] & $this->registry->bf_ugp_visitormessagepermissions['canmanageownprofile']) {
$state[] = 'deleted';
$deljoinsql = "LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON (visitormessage.vmid = deletionlog.primaryid AND deletionlog.type = 'visitormessage')";
} else {
$deljoinsql = '';
}
$state_or = array("visitormessage.state IN ('" . implode("','", $state) . "')");
if (!fetch_visitor_message_perm('canmoderatevisitormessages', $this->userinfo)) {
$state_or[] = "(visitormessage.postuserid = " . $this->registry->userinfo['userid'] . " AND state = 'moderation')";
}
$coventry = '';
if ($this->registry->options['globalignore'] != '') {
if (!can_moderate(0, 'candeletevisitormessages') and !can_moderate(0, 'canremovevisitormessages')) {
require_once DIR . '/includes/functions_bigthree.php';
$coventry = fetch_coventry('string');
}
}
if (empty($vminfo)) {
$vminfo = $this->registry->db->query_first("\n\t\t\t\t\tSELECT COUNT(*) AS messages, MAX(visitormessage.dateline) AS dateline\n\t\t\t\t\tFROM " . TABLE_PREFIX . "visitormessage AS visitormessage\n\t\t\t\t\t{$deljoinsql}\n\t\t\t\t\tWHERE visitormessage.userid = " . $this->prepared['userid'] . "\n\t\t\t\t\t\tAND (" . implode(" OR ", $state_or) . ")\n\t\t\t\t\t" . ($coventry ? "AND visitormessage.postuserid NOT IN (" . $coventry . ")" : '') . "\n\t\t\t\t");
}
$this->prepared['vm_total'] = intval($vminfo['messages']);
if ($vminfo['dateline']) {
$this->prepared['lastvm_time'] = vbdate($this->registry->options['timeformat'], $vminfo['dateline'], true);
$this->prepared['lastvm_date'] = vbdate($this->registry->options['dateformat'], $vminfo['dateline'], true);
} else {
$this->prepared['lastvm_date'] = $vbphrase['never'];
$this->prepared['lastvm_time'] = '';
}
}
}
示例7: goto_nextthread
function goto_nextthread($threadid, $throwerror = true)
{
global $vbulletin;
$thread = verify_id('thread', $threadid, $throwerror, 1);
$forumperms = fetch_permissions($thread['forumid']);
// remove threads from users on the global ignore list if user is not a moderator
if ($coventry = fetch_coventry('string') and !can_moderate($thread['forumid'])) {
$globalignore = "AND postuserid NOT IN ({$coventry})";
} else {
$globalignore = '';
}
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers'])) {
$limitothers = "AND postuserid = " . $vbulletin->userinfo['userid'] . " AND " . $vbulletin->userinfo['userid'] . " <> 0";
} else {
$limitothers = '';
}
if ($vbulletin->userinfo['userid'] and in_coventry($vbulletin->userinfo['userid'], true)) {
$lastpost_info = ",IF(tachythreadpost.userid IS NULL, thread.lastpost, tachythreadpost.lastpost) AS lastpost";
$tachyjoin = "LEFT JOIN " . TABLE_PREFIX . "tachythreadpost AS tachythreadpost ON " . "(tachythreadpost.threadid = thread.threadid AND tachythreadpost.userid = " . $vbulletin->userinfo['userid'] . ')';
$lastpost_having = "HAVING lastpost > {$thread['lastpost']}";
} else {
$lastpost_info = "";
$tachyjoin = "";
$lastpost_having = "AND lastpost > {$thread['lastpost']}";
}
if ($getnextnewest = $vbulletin->db->query_first_slave("\n\t\tSELECT thread.threadid, thread.title\n\t\t\t{$lastpost_info}\n\t\tFROM " . TABLE_PREFIX . "thread AS thread\n\t\t{$tachyjoin}\n\t\tWHERE forumid = {$thread['forumid']}\n\t\t\tAND visible = 1\n\t\t\tAND open <> 10\n\t\t\t{$globalignore}\n\t\t\t{$limitothers}\n\t\t{$lastpost_having}\n\t\tORDER BY lastpost\n\t\tLIMIT 1\n\t")) {
$threadid = $getnextnewest['threadid'];
unset($thread);
} else {
if ($throwerror) {
eval(standard_error(fetch_error('nonextnewest')));
}
}
return $getnextnewest;
}
示例8: eval
}
if ($pda and $vbulletin->userinfo['userid'] > 0 and $vbulletin->GPC['message'] and false) {
$do = 'message';
}
$output .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" dir=\"{$stylevar['textdirection']}\" lang=\"{$stylevar['languagecode']}\">\n<head>\n\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset={$stylevar['charset']}\" />\n\t{$metatags}\n\t<title>{$title}</title>\n\t<link rel=\"stylesheet\" type=\"text/css\" href=\"" . $vbulletin->options['bburl'] . "/archive/archive.css\" />\n</head>\n<body>\n<div class=\"pagebody\">\n";
($hook = vBulletinHook::fetch_hook('archive_postheader')) ? eval($hook) : false;
// ********************************************************************************************
// display board
if ($do == 'index') {
$output .= print_archive_navigation(array());
$output .= "<p class=\"largefont\">{$vbphrase['view_full_version']}: <a href=\"" . $vbulletin->options['bburl'] . '/' . $vbulletin->options['forumhome'] . '.php">' . $vbulletin->options['bbtitle'] . "</a></p>\n";
$output .= "<div id=\"content\">\n";
$output .= print_archive_forum_list();
$output .= "</div>\n";
}
if ($Coventry = fetch_coventry('string')) {
$globalignore = "AND " . iif($do == 'forum', 'thread.post', 'post.') . "userid NOT IN ({$Coventry}) ";
} else {
$globalignore = '';
}
// ********************************************************************************************
// display forum
if ($do == 'forum') {
// list threads
$output .= print_archive_navigation($foruminfo);
$output .= "<p class=\"largefont\">{$vbphrase['view_full_version']} : <a href=\"" . $vbulletin->options['bburl'] . "/forumdisplay.php?f={$foruminfo['forumid']}\">{$foruminfo['title_clean']}</a></p>\n<hr />\n";
if ($foruminfo['cancontainthreads']) {
if (!$p) {
$p = 1;
}
$output .= print_archive_page_navigation($foruminfo['threadcount'], $vbulletin->options['archive_threadsperpage'], "f-{$foruminfo['forumid']}");
示例9: can_view
/**
* Can the user view this post
*
* @param vB_Legacy_CurrentUser $user
* @return boolean
*/
public function can_view($user)
{
$thread = $this->get_thread();
if (!$thread) {
return false;
}
if (!$thread->can_view($user)) {
return false;
}
if (!$user->canModerateForum($thread->get_field('forumid'))) {
//this is cached. Should be fast.
require_once DIR . "/includes/functions_bigthree.php";
$conventry = fetch_coventry();
if (in_array($this->get_field('userid'), $conventry)) {
return false;
}
// post/thread is deleted and we don't have permission to see it
if ($this->get_field('visible') == 2) {
return false;
}
}
// post/thread is deleted by moderator and we don't have permission to see it
if (!$this->get_field('visible') and !$user->canModerateForum($thread->get_field('forumid'), 'canmoderateposts')) {
return false;
}
return true;
}
示例10: prepare_output
/**
* Prepare any data needed for the output
*
* @param string The id of the block
* @param array Options specific to the block
*/
function prepare_output($id = '', $options = array())
{
global $show, $vbphrase, $messagearea, $vBeditTemplate;
require_once DIR . '/includes/functions_visitormessage.php';
require_once DIR . '/includes/class_bbcode.php';
require_once DIR . '/includes/class_visitormessage.php';
if (is_array($options)) {
$options = array_merge($this->option_defaults, $options);
} else {
$options = $this->option_defaults;
}
if ($options['vmid']) {
$messageinfo = verify_visitormessage($options['vmid'], false);
}
$state = array('visible');
if (fetch_visitor_message_perm('canmoderatevisitormessages', $this->profile->userinfo)) {
$state[] = 'moderation';
}
if (can_moderate(0, 'canmoderatevisitormessages') or $this->registry->userinfo['userid'] == $this->profile->userinfo['userid'] and $this->registry->userinfo['permissions']['visitormessagepermissions'] & $this->registry->bf_ugp_visitormessagepermissions['canmanageownprofile']) {
$state[] = 'deleted';
$deljoinsql = "LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON (visitormessage.vmid = deletionlog.primaryid AND deletionlog.type = 'visitormessage')";
} else {
$deljoinsql = '';
}
$state_or = array("visitormessage.state IN ('" . implode("','", $state) . "')");
// Get the viewing user's moderated posts
if ($this->registry->userinfo['userid'] and !fetch_visitor_message_perm('canmoderatevisitormessages', $this->profile->userinfo)) {
$state_or[] = "(visitormessage.postuserid = " . $this->registry->userinfo['userid'] . " AND state = 'moderation')";
}
$perpage = (!$options['perpage'] or $options['perpage'] > $this->registry->options['vm_maxperpage']) ? $this->registry->options['vm_perpage'] : $options['perpage'];
if ($messageinfo['vmid']) {
$getpagenum = $this->registry->db->query_first("\n\t\t\t\tSELECT COUNT(*) AS comments\n\t\t\t\tFROM " . TABLE_PREFIX . "visitormessage AS visitormessage\n\t\t\t\tWHERE userid = " . $this->profile->userinfo['userid'] . "\n\t\t\t\t\tAND (" . implode(" OR ", $state_or) . ")\n\t\t\t\t\tAND dateline >= {$messageinfo['dateline']}\n\t\t\t");
$options['pagenumber'] = ceil($getpagenum['comments'] / $perpage);
}
$pagenumber = $options['pagenumber'];
do {
if (!$pagenumber or $options['tab'] != $id and $options['tab'] != '') {
$pagenumber = 1;
}
$start = ($pagenumber - 1) * $perpage;
$hook_query_fields = $hook_query_joins = $hook_query_where = '';
($hook = vBulletinHook::fetch_hook('member_profileblock_visitormessage_query')) ? eval($hook) : false;
if ($this->registry->options['globalignore'] != '') {
if (!can_moderate(0, 'candeletevisitormessages') and !can_moderate(0, 'canremovevisitormessages')) {
require_once DIR . '/includes/functions_bigthree.php';
$coventry = fetch_coventry('string');
}
}
$messagebits = '';
$messages = $this->registry->db->query_read("\n\t\t\t\tSELECT " . (!isset($this->profile->prepared['vm_total']) ? "SQL_CALC_FOUND_ROWS" : "") . "\n\t\t\t\t\tvisitormessage.*, user.*, visitormessage.ipaddress AS messageipaddress\n\t\t\t\t\t" . ($this->registry->userinfo['userid'] ? ",IF(userlist.userid IS NOT NULL, 1, 0) AS bbuser_iscontact_of_user" : "") . "\n\t\t\t\t\t" . ($deljoinsql ? ",deletionlog.userid AS del_userid, deletionlog.username AS del_username, deletionlog.reason AS del_reason" : "") . "\n\t\t\t\t\t" . ($this->registry->options['avatarenabled'] ? ",avatar.avatarpath, NOT ISNULL(customavatar.userid) AS hascustomavatar, customavatar.dateline AS avatardateline,customavatar.width AS avwidth,customavatar.height AS avheight, customavatar.width_thumb AS avwidth_thumb, customavatar.height_thumb AS avheight_thumb, filedata_thumb, NOT ISNULL(customavatar.userid) AS hascustom" : "") . "\n\t\t\t\t\t{$hook_query_fields}\n\t\t\t\tFROM " . TABLE_PREFIX . "visitormessage AS visitormessage\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (visitormessage.postuserid = user.userid)\n\t\t\t\t" . ($this->registry->userinfo['userid'] ? "LEFT JOIN " . TABLE_PREFIX . "userlist AS userlist ON (userlist.userid = user.userid AND userlist.type = 'buddy' AND userlist.relationid = " . $this->registry->userinfo['userid'] . ")" : "") . "\n\t\t\t\t" . ($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)" : "") . "\n\t\t\t\t{$deljoinsql}\n\t\t\t\t{$hook_query_joins}\n\t\t\t\tWHERE visitormessage.userid = " . $this->profile->userinfo['userid'] . "\n\t\t\t\t\tAND (" . implode(" OR ", $state_or) . ")\n\t\t\t\t" . ($coventry ? "AND visitormessage.postuserid NOT IN (" . $coventry . ")" : '') . "\n\t\t\t\t\t{$hook_query_where}\n\t\t\t\tORDER BY visitormessage.dateline DESC\n\t\t\t\tLIMIT {$start}, {$perpage}\n\t\t\t");
if (!isset($this->profile->prepared['vm_total'])) {
list($messagetotal) = $this->registry->db->query_first("SELECT FOUND_ROWS()", DBARRAY_NUM);
} else {
$messagetotal = $this->profile->prepared['vm_total'];
}
if ($start >= $messagetotal) {
$pagenumber = ceil($messagetotal / $perpage);
}
} while ($start >= $messagetotal and $messagetotal);
$this->block_data['messagestart'] = $start + 1;
$this->block_data['messageend'] = min($start + $perpage, $messagetotal);
$bbcode = new vB_BbCodeParser($this->registry, fetch_tag_list());
$factory = new vB_Visitor_MessageFactory($this->registry, $bbcode, $this->profile->userinfo);
$messagebits = '';
if ($this->registry->userinfo['userid'] and empty($options['showignored'])) {
$ignorelist = preg_split('/( )+/', trim($this->registry->userinfo['ignorelist']), -1, PREG_SPLIT_NO_EMPTY);
} else {
$ignorelist = array();
}
$firstrecord = array();
$read_ids = array();
while ($message = $this->registry->db->fetch_array($messages)) {
// Process user.options
$message = array_merge($message, convert_bits_to_array($message['options'], $this->registry->bf_misc_useroptions));
if (!$firstrecord) {
$firstrecord = $message;
}
if ($ignorelist and in_array($message['postuserid'], $ignorelist)) {
$message['ignored'] = true;
}
if (empty($options['showignored']) and in_coventry($message['postuserid'])) {
$message['ignored'] = true;
}
$response_handler =& $factory->create($message);
$response_handler->converse = true;
if (!$message['vm_enable'] and (!can_moderate(0, 'canmoderatevisitormessages') or $this->registry->userinfo['userid'] == $message['postuserid']) or $message['vm_contactonly'] and !can_moderate(0, 'canmoderatevisitormessages') and $message['postuserid'] != $this->registry->userinfo['userid'] and !$message['bbuser_iscontact_of_user']) {
$response_handler->converse = false;
}
$response_handler->cachable = false;
$messagebits .= $response_handler->construct();
if (!$message['messageread'] and $message['state'] == 'visible') {
$read_ids[] = $message['vmid'];
}
$lastcomment = !$lastcomment ? $message['dateline'] : $lastcomment;
//.........这里部分代码省略.........
示例11: do_get_thread
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
//.........这里部分代码省略.........
示例12: vB_Blog_SearchGenerator
/**
* Constructor.
*
* @param vB_Registry
*/
function vB_Blog_SearchGenerator(&$registry)
{
$this->registry = $registry;
$this->tachy = fetch_coventry('string');
}
示例13: build_thread_counters
function build_thread_counters($threadid)
{
global $vbulletin;
$threadid = intval($threadid);
require_once DIR . '/includes/functions_bigthree.php';
$coventry = fetch_coventry('string', true);
$firstpost = $vbulletin->db->query_first("\n\t\tSELECT post.postid, post.userid, user.username, post.username AS postuser, post.dateline\n\t\tFROM " . TABLE_PREFIX . "post AS post\n\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = post.userid)\n\t\tWHERE post.threadid = {$threadid} AND\n\t\t\tpost.visible = 1\n\t\tORDER BY dateline\n\t\tLIMIT 1\n\t");
if (!$firstpost) {
// sanity -- this should never happen; one post should always be visible
return;
}
$vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "tachythreadcounter WHERE threadid = {$threadid}");
$vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . "tachythreadpost WHERE threadid = {$threadid}");
$replies = $vbulletin->db->query_first("\n\t\tSELECT\n\t\t\tCOUNT(DISTINCT(userid)) AS postercount,\n\t\t\tSUM(IF(visible = 1, attach, 0)) AS attachsum,\n\t\t\tSUM(IF(visible = 1, 1, 0)) AS visible,\n\t\t\tSUM(IF(visible = 0, 1, 0)) AS hidden,\n\t\t\tSUM(IF(visible = 2, 1, 0)) AS deleted\n\t\tFROM " . TABLE_PREFIX . "post AS post\n\t\tWHERE threadid = {$threadid}\n\t\t\t" . ($coventry ? "AND post.userid NOT IN ({$coventry})" : '') . "\n\t");
if ($coventry) {
// Build Tachy Counters
$tachy_db = $vbulletin->db->query_read("\n\t\t\tSELECT post.userid, COUNT(*) AS replycount\n\t\t\tFROM " . TABLE_PREFIX . "post AS post\n\t\t\tWHERE post.userid IN ({$coventry})\n\t\t\t\tAND post.visible = 1\n\t\t\t\tAND post.threadid = {$threadid}\n\t\t\t\tAND post.postid <> {$firstpost['postid']}\n\t\t\tGROUP BY userid\n\t\t");
$tachystats = array();
while ($tachycounter = $vbulletin->db->fetch_array($tachy_db)) {
$tachystats["{$tachycounter['userid']}"]['replycount'] = $tachycounter['replycount'];
}
if ($tachystats) {
foreach ($tachystats as $user => $stats) {
$vbulletin->db->query_write("\n\t\t\t\t\tINSERT INTO " . TABLE_PREFIX . "tachythreadcounter\n\t\t\t\t\t\t(userid, threadid, replycount)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t(" . intval($user) . ",\n\t\t\t\t\t\t" . intval($threadid) . ",\n\t\t\t\t\t\t" . intval($stats['replycount']) . ")\n\t\t\t\t");
}
}
}
$lastpost = $vbulletin->db->query_first("\n\t\tSELECT\n\t\t\tuser.username,\n\t\t\tpost.userid,\n\t\t\tpost.username AS postuser,\n\t\t\tpost.dateline,\n\t\t\tpost.postid\n\t\tFROM " . TABLE_PREFIX . "post AS post\n\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = post.userid)\n\t\tWHERE post.threadid = {$threadid}\n\t\t\tAND post.visible = 1\n\t\t\t" . ($coventry ? "AND post.userid NOT IN ({$coventry})" : '') . "\n\t\tORDER BY dateline DESC\n\t\tLIMIT 1\n\t");
$uniques = $vbulletin->db->query_first("\n\t\tSELECT COUNT(DISTINCT(userid)) AS total\n\t\tFROM " . TABLE_PREFIX . "post\n\t\tWHERE\n\t\t\tthreadid = {$threadid}\n\t\t\t\tAND\n\t\t\tvisible = 1\n\t\t\t" . ($coventry ? "AND userid NOT IN ({$coventry})" : "") . "\n\t");
if (!$uniques['total']) {
$uniques['total'] = 1;
}
if ($lastpost and $coventry) {
// if we have a last post (by a non-tachy user) and coventry users,
// look for a newer last post by a coventry user
$tachy_db = $vbulletin->db->query_read("\n\t\t\tSELECT\n\t\t\t\tuser.username,\n\t\t\t\tpost.userid,\n\t\t\t\tpost.username AS postuser,\n\t\t\t\tpost.dateline,\n\t\t\t\tpost.postid\n\t\t\tFROM " . TABLE_PREFIX . "post AS post\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = post.userid)\n\t\t\tWHERE post.threadid = {$threadid}\n\t\t\t\tAND post.visible = 1\n\t\t\t\tAND post.userid IN ({$coventry})\n\t\t\t\tAND post.dateline > {$lastpost['dateline']}\n\t\t\tORDER BY dateline DESC\n\t\t");
$tachy_posts = array();
while ($tachy = $vbulletin->db->fetch_array($tachy_db)) {
if (!isset($tachy_posts["{$tachy['userid']}"])) {
$tachy_posts["{$tachy['userid']}"] = $tachy;
}
}
if ($tachy_posts) {
$tachy_replace = array();
foreach ($tachy_posts as $tachy) {
$tachy_replace[] = "\n\t\t\t\t\t({$tachy['userid']}, {$threadid}, " . intval($tachy['dateline']) . ",\n\t\t\t\t\t'" . $vbulletin->db->escape_string($tachy['postuser']) . "',\n\t\t\t\t\t{$tachy['userid']},\n\t\t\t\t\t'" . $vbulletin->db->escape_string($tachy['postid']) . "')\n\t\t\t\t";
}
if ($tachy_replace) {
$vbulletin->db->query_write("\n\t\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "tachythreadpost\n\t\t\t\t\t\t(userid, threadid, lastpost, lastposter, lastposterid, lastpostid)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t" . implode(', ', $tachy_replace));
}
}
}
if ($lastpost) {
$lastposter = empty($lastpost['username']) ? $lastpost['postuser'] : $lastpost['username'];
$lastposterid = $lastpost['userid'];
$lastposttime = intval($lastpost['dateline']);
$lastpostid = intval($lastpost['postid']);
} else {
// this will occur on a thread posted by a tachy user.
// since only they will see the thread, the lastpost info can say their name
$lastposter = empty($firstpost['username']) ? $firstpost['postuser'] : $firstpost['username'];
$lastposter = $firstpost['userid'];
$lastposttime = intval($firstpost['dateline']);
$lastpostid = intval($firstpost['postid']);
}
$firstposter = empty($firstpost['username']) ? $firstpost['postuser'] : $firstpost['username'];
$firstposterid = intval($firstpost['userid']);
$firstpostid = intval($firstpost['postid']);
$threadcreation = $firstpost['dateline'];
$ratings = $vbulletin->db->query_first("\n\t\tSELECT\n\t\t\tCOUNT(*) AS votenum,\n\t\t\tSUM(vote) AS votetotal\n\t\tFROM " . TABLE_PREFIX . "threadrate\n\t\tWHERE threadid = {$threadid}\n\t");
$threadinfo = array('threadid' => $threadid);
$threadman =& datamanager_init('Thread', $vbulletin, ERRTYPE_SILENT, 'threadpost');
$threadman->set_existing($threadinfo);
$threadman->set_info('rebuild', true);
$threadman->set('firstpostid', $firstpostid, true, false);
$threadman->set('postuserid', $firstposterid, true, false);
$threadman->set('postusername', $firstposter, true, false);
$threadman->set('lastpost', $lastposttime, true, false);
$threadman->set('replycount', $replies['visible'] - 1, true, false);
$threadman->set('hiddencount', $replies['hidden'], true, false);
$threadman->set('deletedcount', $replies['deleted'], true, false);
$threadman->set('attach', $replies['attachsum'], true, false);
$threadman->set('dateline', $threadcreation, true, false);
$threadman->set('lastposter', $lastposter, true, false);
$threadman->set('lastposterid', $lastposterid, true, false);
$threadman->set('lastpostid', $lastpostid, true, false);
$threadman->set('votenum', $ratings['votenum'], true, false);
$threadman->set('votetotal', intval($ratings['votetotal']), true, false);
$threadman->set('postercount', $uniques['total']);
$threadman->save();
}
示例14: can_view
public function can_view($user)
{
global $vbulletin;
if (in_array($this->get_field('forumid'), $user->getHiddenForums())) {
return false;
}
// permission check to see if user can view other's threads in this forum,
// and if not to make sure this thread was started by current user
if (!$user->hasForumPermission($this->get_field('forumid'), 'canviewothers') and ($this->get_field('postuserid') != $user->get_field('userid') or $user->get_field('userid') == 0)) {
return false;
}
if (!$user->canModerateForum($this->get_field('forumid'))) {
//this is cached. Should be fast.
require_once DIR . "/includes/functions_bigthree.php";
$conventry = fetch_coventry();
if (in_array($this->get_field('postuserid'), $conventry)) {
return false;
}
// thread is deleted and we don't have permission to see it
if ($this->get_field('visible') == 2) {
return false;
}
}
// thread is deleted by moderator and we don't have permission to see it
if (!$this->get_field('visible') and !$user->canModerateForum($this->get_field('forumid'), 'canmoderateposts')) {
return false;
}
return true;
}
示例15: getData
public function getData()
{
if ($this->config['threads_forumids'])
{
if (in_array(-1, $this->config['threads_forumids']))
{
$forumids = array_keys($this->registry->forumcache);
}
else
{
$forumids = $this->config['threads_forumids'];
}
}
else
{
$forumids = array_keys($this->registry->forumcache);
}
$datecut = TIMENOW - ($this->config['datecut'] * 86400);
switch (intval($this->config['threads_type']))
{
case 0:
$ordersql = " thread.dateline DESC";
$datecutoffsql = " AND thread.dateline > $datecut";
break;
case 1:
$ordersql = " thread.lastpost DESC";
$datecutoffsql = " AND thread.lastpost > $datecut";
break;
case 2:
$ordersql = " thread.replycount DESC";
$datecutoffsql = " AND thread.dateline > $datecut";
break;
case 3:
$ordersql = " thread.views DESC";
$datecutoffsql = " AND thread.dateline > $datecut";
break;
}
foreach ($forumids AS $forumid)
{
$forumperms =& $this->registry->userinfo['forumpermissions']["$forumid"];
if ($forumperms & $this->registry->bf_ugp_forumpermissions['canview']
AND ($forumperms & $this->registry->bf_ugp_forumpermissions['canviewothers'])
AND (($forumperms & $this->registry->bf_ugp_forumpermissions['canviewthreads']))
AND verify_forum_password($forumid, $this->registry->forumcache["$forumid"]['password'], false)
)
{
$forumchoice[] = $forumid;
}
}
if (!empty($forumchoice))
{
$forumsql = "AND thread.forumid IN(" . implode(',', $forumchoice) . ")";
// 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 thread.postuserid NOT IN ($Coventry) ";
}
}
// query last threads from visible / chosen forums
$threads = $this->registry->db->query_read_slave("
SELECT thread.threadid, thread.title, thread.prefixid, post.attach,
thread.postusername, thread.dateline, thread.lastpostid, thread.lastpost, thread.lastposterid, thread.lastposter, thread.replycount,
forum.forumid, forum.title_clean as forumtitle,
post.pagetext AS message, post.allowsmilie, post.postid,
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 . "thread AS thread
INNER JOIN " . TABLE_PREFIX . "forum AS forum ON(forum.forumid = thread.forumid)
LEFT JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = thread.firstpostid)
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (thread.postuserid = user.userid)
" . ($this->registry->products['vbcms'] ? " LEFT JOIN " . TABLE_PREFIX . "cms_nodeinfo AS info ON info.associatedthreadid = thread.threadid \n" : '')
. ($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)" : "") . "
WHERE 1=1
$forumsql
AND thread.visible = 1
AND post.visible = 1
AND open <> 10
$datecutoffsql
$globalignore
" . ($this->userinfo['ignorelist'] ? "AND thread.postuserid NOT IN (" . implode(',', explode(' ', $this->userinfo['ignorelist'])) . ")": '')
. ($this->registry->products['vbcms'] ? " AND info.associatedthreadid IS NULL " : '')
. "
ORDER BY$ordersql
LIMIT 0," . intval($this->config['threads_limit']) . "
");
while ($thread = $this->registry->db->fetch_array($threads))
{
// $thread['url'] = fetch_seo_url('thread', $thread);
// $thread['newposturl'] = fetch_seo_url('thread', $thread, array('goto' => 'newpost'));
//.........这里部分代码省略.........