本文整理汇总了PHP中in_coventry函数的典型用法代码示例。如果您正苦于以下问题:PHP in_coventry函数的具体用法?PHP in_coventry怎么用?PHP in_coventry使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了in_coventry函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: post_save_once
/**
* Code to run after Saving a Visitor Message
*
* @param boolean Do the query?
*/
function post_save_once($doquery = true)
{
$vmid = intval($this->fetch_field('vmid'));
if (!$this->condition) {
if ($this->fetch_field('userid')) {
$this->insert_dupehash($this->fetch_field('userid'));
}
}
if (!$this->info['profileuser']) {
$this->info['profileuser'] = fetch_userinfo($this->fetch_field('userid'));
}
if ($this->info['profileuser'] and !in_coventry($this->fetch_field('postuserid'), true)) {
$userdata =& datamanager_init('User', $this->registry, ERRTYPE_SILENT);
$userdata->set_existing($this->info['profileuser']);
if ($this->fetch_field('state') == 'visible') {
if (!$this->condition and !$this->fetch_field('messageread')) {
// new vm, not been read, visible -> increase unread count
$userdata->set('vmunreadcount', 'vmunreadcount + 1', false);
} else {
if ($this->condition and $this->fetch_field('messageread') and isset($this->existing['messageread']) and !$this->existing['messageread']) {
// existing vm going from unread to read -> decrease unread count
// isset() check ensures that messageread info was explicitly passed in
$userdata->set('vmunreadcount', 'vmunreadcount - 1', false);
}
}
}
if ($this->fetch_field('state') == 'visible' and $this->existing['state'] == 'moderation') {
// moderated message made visible -> decrease moderated count
$userdata->set('vmmoderatedcount', 'vmmoderatedcount - 1', false);
} else {
if ($this->fetch_field('state') == 'moderation' and $this->fetch_field('state') != $this->existing['state']) {
// message is moderated and wasn't moderated before -> increase moderated count
$userdata->set('vmmoderatedcount', 'vmmoderatedcount + 1', false);
}
}
$userdata->save();
}
if ($this->fetch_field('state') == 'moderation') {
/*insert query*/
$this->dbobject->query_write("\n\t\t\t\tINSERT IGNORE INTO " . TABLE_PREFIX . "moderation\n\t\t\t\t\t(primaryid, type, dateline)\n\t\t\t\tVALUES\n\t\t\t\t\t({$vmid}, 'visitormessage', " . TIMENOW . ")\n\t\t\t");
} else {
if ($this->fetch_field('state') == 'visible' and $this->existing['state'] == 'moderation') {
// message was made visible, remove the moderation record
$this->dbobject->query_write("\n\t\t\t\tDELETE FROM " . TABLE_PREFIX . "moderation\n\t\t\t\tWHERE primaryid = {$vmid} AND type = 'visitormessage'\n\t\t\t");
}
}
($hook = vBulletinHook::fetch_hook('visitormessagedata_postsave')) ? eval($hook) : false;
}
示例2: eval
}
($hook = vBulletinHook::fetch_hook('misc_showattachments_start')) ? eval($hook) : false;
$forumperms = fetch_permissions($threadinfo['forumid']);
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads'])) {
print_no_permission();
}
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) and ($threadinfo['postuserid'] != $vbulletin->userinfo['userid'] or !$vbulletin->userinfo['userid'])) {
print_no_permission();
}
$attachs = $db->query_read_slave("\n\t\tSELECT attachment.*\n\t\tFROM " . TABLE_PREFIX . "post AS post\n\t\tINNER JOIN " . TABLE_PREFIX . "attachment AS attachment ON (attachment.postid=post.postid AND attachment.visible=1)\n\t\tWHERE threadid = {$threadinfo['threadid']}\n\t\t\tAND post.visible = 1\n\t\tORDER BY filename DESC\n\t");
if ($db->num_rows($attachs)) {
require_once DIR . '/includes/functions_bigthree.php';
while ($attachment = $db->fetch_array($attachs)) {
// hide users in Coventry
$ast = '';
if (in_coventry($attachment['userid']) and !can_moderate($threadinfo['forumid'])) {
continue;
}
$attachment['filename'] = fetch_censored_text(htmlspecialchars_uni($attachment['filename']));
$attachment['attachmentextension'] = strtolower(file_extension($attachment['filename']));
$attachment['filesize'] = vb_number_format($attachment['filesize'], 1, true);
exec_switch_bg();
eval('$attachments .= "' . fetch_template('attachmentbit') . '";');
}
($hook = vBulletinHook::fetch_hook('misc_showattachments_complete')) ? eval($hook) : false;
eval('print_output("' . fetch_template('ATTACHMENTS') . '");');
} else {
eval(standard_error(fetch_error('noattachments')));
}
}
// ############################### start show avatars ###############################
示例3: fetch_quotable_posts
/**
* Fetches and prepares posts for quoting. Returned text is BB code.
*
* @param array Array of post IDs to pull from
* @param integer The ID of the thread that is being quoted into
* @param integer Returns the number of posts that were unquoted because of the value of the next argument
* @param array Returns the IDs of the posts that were actually quoted
* @param string Controls what posts are successfully quoted: all, only (only the thread ID), other (only other thread IDs)
* @param boolean Whether to undo the htmlspecialchars calls; useful when returning HTML to be entered via JS
*/
function fetch_quotable_posts($quote_postids, $threadid, &$unquoted_posts, &$quoted_post_ids, $limit_thread = 'only', $unhtmlspecialchars = false)
{
global $vbulletin;
$unquoted_posts = 0;
$quoted_post_ids = array();
$quote_postids = array_diff_assoc(array_unique(array_map('intval', $quote_postids)), array(0));
// limit to X number of posts
if ($vbulletin->options['mqlimit'] > 0) {
$quote_postids = array_slice($quote_postids, 0, $vbulletin->options['mqlimit']);
}
if (empty($quote_postids)) {
// nothing to quote
return '';
}
$hook_query_fields = $hook_query_joins = '';
($hook = vBulletinHook::fetch_hook('quotable_posts_query')) ? eval($hook) : false;
$quote_post_data = $vbulletin->db->query_read_slave("\n\t\tSELECT post.postid, post.title, post.pagetext, post.dateline, post.userid, post.visible AS postvisible,\n\t\t\tIF(user.username <> '', user.username, post.username) AS username,\n\t\t\tthread.threadid, thread.title AS threadtitle, thread.postuserid, thread.visible AS threadvisible,\n\t\t\tforum.forumid, forum.password\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 (post.userid = user.userid)\n\t\tINNER JOIN " . TABLE_PREFIX . "thread AS thread ON (post.threadid = thread.threadid)\n\t\tINNER JOIN " . TABLE_PREFIX . "forum AS forum ON (thread.forumid = forum.forumid)\n\t\t{$hook_query_joins}\n\t\tWHERE post.postid IN (" . implode(',', $quote_postids) . ")\n\t");
$quote_posts = array();
while ($quote_post = $vbulletin->db->fetch_array($quote_post_data)) {
if ((!$quote_post['postvisible'] or $quote_post['postvisible'] == 2) and !can_moderate($quote_post['forumid']) or (!$quote_post['threadvisible'] or $quote_post['threadvisible'] == 2) and !can_moderate($quote_post['forumid'])) {
// no permission to view this post
continue;
}
$forumperms = fetch_permissions($quote_post['forumid']);
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) and ($quote_post['postuserid'] != $vbulletin->userinfo['userid'] or $vbulletin->userinfo['userid'] == 0) or !verify_forum_password($quote_post['forumid'], $quote_post['password'], false) or in_coventry($quote_post['postuserid']) and !can_moderate($quote_post['forumid']) or in_coventry($quote_post['userid']) and !can_moderate($quote_post['forumid'])) {
// no permission to view this post
continue;
}
if ($limit_thread == 'only' and $quote_post['threadid'] != $threadid or $limit_thread == 'other' and $quote_post['threadid'] == $threadid or $limit_thread == 'all') {
$unquoted_posts++;
continue;
}
$skip_post = false;
($hook = vBulletinHook::fetch_hook('quotable_posts_logic')) ? eval($hook) : false;
if ($skip_post) {
continue;
}
$quote_posts["{$quote_post['postid']}"] = $quote_post;
}
$message = '';
foreach ($quote_postids as $quote_postid) {
if (!isset($quote_posts["{$quote_postid}"])) {
continue;
}
$quote_post =& $quote_posts["{$quote_postid}"];
$originalposter = fetch_quote_username($quote_post['username'] . ";{$quote_post['postid']}");
$postdate = vbdate($vbulletin->options['dateformat'], $quote_post['dateline']);
$posttime = vbdate($vbulletin->options['timeformat'], $quote_post['dateline']);
$pagetext = htmlspecialchars_uni($quote_post['pagetext']);
$pagetext = trim(strip_quotes($pagetext));
($hook = vBulletinHook::fetch_hook('newreply_quote')) ? eval($hook) : false;
eval('$message .= "' . fetch_template('newpost_quote', 0, false) . '\\n";');
$quoted_post_ids[] = $quote_postid;
}
if ($unhtmlspecialchars) {
$message = unhtmlspecialchars($message);
}
return $message;
}
示例4: post_save_each
function post_save_each($doquery = true)
{
$blogid = intval($this->fetch_field('blogid'));
$blogtextid = intval($this->fetch_field('blogtextid'));
$userid = intval($this->fetch_field('userid'));
$this->post_save_each_blogtext($doquery);
require_once(DIR . '/vb/search/indexcontroller/queue.php');
vb_Search_Indexcontroller_Queue::indexQueue('vBBlog', 'BlogComment', 'index', $blogtextid);
require_once(DIR . '/vb/search/indexcontroller/queue.php');
vb_Search_Indexcontroller_Queue::indexQueue('vBBlog', 'BlogComment', 'index', $blogtextid);
if ($this->info['blog'] AND ($attach = intval($this->info['newattach']) OR !$this->condition))
{
// things that apply to a new comment and an edit
$blog =& datamanager_init('Blog', $this->registry, ERRTYPE_SILENT, 'blog');
$blog->set_existing($this->info['blog']);
if ($attach)
{
$blog->set('attach', "attach + $attach", false);
}
}
if (!$this->condition)
{ // things that apply just to a new comment
if ($this->fetch_field('dateline') == TIMENOW)
{
$this->insert_dupehash($this->fetch_field('blogid'));
}
if ($this->fetch_field('state') == 'visible' AND $this->info['blog'] AND $this->info['blog']['state'] == 'visible')
{
$blog->set('comments_visible', 'comments_visible + 1', false);
if (in_coventry($userid, true))
{
// posted by someone in coventry, so don't update the blog last post time
// just put it in this person's tachy last post table
$replaceval = "$userid,
$blogid,
" . intval(TIMENOW) . ",
'" . $this->dbobject->escape_string($this->fetch_field('username')) . "',
$blogtextid
";
$this->dbobject->query_write("
REPLACE INTO " . TABLE_PREFIX . "blog_tachyentry
(userid, blogid, lastcomment, lastcommenter, lastblogtextid)
VALUES
($replaceval)
");
}
else
{
$blog->set('lastcomment', TIMENOW);
$blog->set('lastcommenter', $this->fetch_field('username'));
$blog->set('lastblogtextid', $blogtextid);
// empty out the tachy posts for this blog
$this->dbobject->query_write("
DELETE FROM " . TABLE_PREFIX . "blog_tachyentry
WHERE blogid = $blogid
");
// Send Email Notification
if ($this->registry->options['enableemail'])
{
$lastposttime = $this->dbobject->query_first("
SELECT MAX(dateline) AS dateline
FROM " . TABLE_PREFIX . "blog_text AS blog_text
WHERE blogid = $blogid
AND dateline < " . $this->fetch_field('dateline') . "
AND state = 'visible'
");
$entrytitle = unhtmlspecialchars($this->info['blog']['title']);
if (defined('VBBLOG_PERMS') AND $this->registry->userinfo['userid'] == $this->info['blog']['userid'])
{
$blogtitle = unhtmlspecialchars($this->registry->userinfo['blog_title']);
$username = unhtmlspecialchars($this->registry->userinfo['username']);
$userinfo =& $this->registry->userinfo;
}
else
{
if (!defined('VBBLOG_PERMS'))
{ // Tell the fetch_userinfo plugin that we need the blog fields in case this class is being called by a non blog script
define('VBBLOG_PERMS', true);
}
$userinfo = fetch_userinfo($this->info['blog']['userid'], 1);
cache_permissions($userinfo, false);
$blogtitle = unhtmlspecialchars($userinfo['blog_title']);
if ($userinfo['userid'] != $this->fetch_field('userid'))
{
$userinfo2 = fetch_userinfo($this->fetch_field('userid'), 1);
$username = unhtmlspecialchars($userinfo2['username']);
//.........这里部分代码省略.........
示例5: prepare_lastpost
/**
* Prepares the User's last post information
*
*/
function prepare_lastpost()
{
global $show, $vbphrase;
$this->prepared['lastposttitle'] = '';
if ($this->registry->options['profilelastpost'] and $this->userinfo['lastpost'] and !in_coventry($this->userinfo['userid'])) {
if ($this->userinfo['lastpostid'] and $getlastpost = $this->registry->db->query_first_slave("\n\t\t\t\tSELECT thread.title, thread.threadid, thread.forumid, post.postid, post.dateline\n\t\t\t\tFROM " . TABLE_PREFIX . "post AS post\n\t\t\t\tINNER JOIN " . TABLE_PREFIX . "thread AS thread USING (threadid)\n\t\t\t\tWHERE post.postid = " . $this->userinfo['lastpostid'] . "\n\t\t\t\t\tAND post.visible = 1\n\t\t\t\t\tAND thread.visible = 1\n\t\t\t")) {
$getperms = fetch_permissions($getlastpost['forumid']);
if ($getperms & $this->registry->bf_ugp_forumpermissions['canview']) {
$this->prepared['lastposttitle'] = $getlastpost['title'];
$this->prepared['lastposturl'] = 'showthread.php?' . $this->registry->session->vars['sessionurl'] . "p={$getlastpost['postid']}#post{$getlastpost['postid']}";
$this->prepared['lastpostdate'] = vbdate($this->registry->options['dateformat'], $getlastpost['dateline'], true);
$this->prepared['lastposttime'] = vbdate($this->registry->options['timeformat'], $getlastpost['dateline']);
}
}
if ($this->prepared['lastposttitle'] === '') {
$getlastposts = $this->registry->db->query_read_slave("\n\t\t\t\t\tSELECT thread.title, thread.threadid, thread.forumid, post.postid, post.dateline\n\t\t\t\t\tFROM " . TABLE_PREFIX . "post AS post\n\t\t\t\t\tINNER JOIN " . TABLE_PREFIX . "thread AS thread USING (threadid)\n\t\t\t\t\tWHERE thread.visible = 1\n\t\t\t\t\t\tAND post.userid = " . $this->userinfo['userid'] . "\n\t\t\t\t\t\tAND post.visible = 1\n\t\t\t\t\tORDER BY post.dateline DESC\n\t\t\t\t\tLIMIT 20\n\t\t\t\t");
while ($getlastpost = $this->registry->db->fetch_array($getlastposts)) {
$getperms = fetch_permissions($getlastpost['forumid']);
if ($getperms & $this->registry->bf_ugp_forumpermissions['canview']) {
$this->prepared['lastposttitle'] = $getlastpost['title'];
$this->prepared['lastposturl'] = 'showthread.php?' . $this->registry->session->vars['sessionurl'] . "p={$getlastpost['postid']}#post{$getlastpost['postid']}";
$this->prepared['lastpostdate'] = vbdate($this->registry->options['dateformat'], $getlastpost['dateline'], true);
$this->prepared['lastposttime'] = vbdate($this->registry->options['timeformat'], $getlastpost['dateline']);
break;
}
}
}
}
$this->prepared['lastpost'] = true;
}
示例6: is_displayable
/**
* Determines whether the post should actually be displayed.
*
* @return bool True if the post should be displayed; false otherwise
*/
function is_displayable()
{
// hide users in Coventry from non-staff members
if ($tachyuser = in_coventry($this->post['userid']) AND !can_moderate($this->thread['forumid']))
{
return false;
}
return true;
}
示例7: if
/**
* Create a message object for the specified message
*
* @param array message information
*
* @return vB_Visitor_Message
*/
function &create($message, $type = '')
{
$class_name = 'vB_Visitor_Message_';
if ($type)
{
$class_name .= $type . '_';
}
switch ($message['state'])
{
case 'deleted':
$class_name .= 'Deleted';
break;
case 'moderation':
case 'visible':
default:
{
if (in_coventry($message['userid']) AND !empty($message['ignored']))
{
$class_name .= 'Global_Ignored';
}
else if (!empty($message['ignored']))
{
$class_name .= 'Ignored';
}
else
{
$class_name .= 'Message';
}
}
}
($hook = vBulletinHook::fetch_hook('visitor_messagebit_factory')) ? eval($hook) : false;
if (class_exists($class_name, false))
{
return new $class_name($this->registry, $this, $this->bbcode, $this->userinfo, $message);
}
else
{
trigger_error('vB_Visitor_MessageFactory::create(): Invalid type ' . htmlspecialchars_uni($class_name) . '.', E_USER_ERROR);
}
}
示例8: ceil
$pagenum = $vbulletin->GPC['pagenumber'] > 0 ? $vbulletin->GPC['pagenumber'] : 1;
$maxpages = ceil($search['resultcount'] / $perpage);
if ($pagenum > $maxpages) {
$pagenum = $maxpages;
}
if (!$vbulletin->GPC['start']) {
$vbulletin->GPC['start'] = ($pagenum - 1) * $perpage;
$previous_results = $vbulletin->GPC['start'];
} else {
$previous_results = ($pagenum - 1) * $perpage;
}
$previouspage = $pagenum - 1;
$nextpage = $pagenum + 1;
$hook_query_fields = $hook_query_joins = $hook_query_where = '';
($hook = vBulletinHook::fetch_hook('blog_search_results_query')) ? eval($hook) : false;
$results = $db->query_read("\r\n\t\tSELECT blog.*, blog_searchresult.offset, IF(blog_user.title <> '', blog_user.title, blog.username) AS blogtitle\r\n\t\t" . (($vbulletin->userinfo['userid'] and in_coventry($vbulletin->userinfo['userid'], true)) ? "\r\n\t\t,IF(blog_tachyentry.userid IS NULL, blog.lastcomment, blog_tachyentry.lastcomment) AS lastcomment\r\n\t\t,IF(blog_tachyentry.userid IS NULL, blog.lastcommenter, blog_tachyentry.lastcommenter) AS lastcommenter\r\n\t\t,IF(blog_tachyentry.userid IS NULL, blog.lastblogtextid, blog_tachyentry.lastblogtextid) AS lastblogtextid\r\n\t\t" : "") . "\r\n\t\t\t{$hook_query_fields}\r\n\t\tFROM " . TABLE_PREFIX . "blog_searchresult AS blog_searchresult\r\n\t\tINNER JOIN " . TABLE_PREFIX . "blog AS blog ON (blog_searchresult.id = blog.blogid)\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "blog_user AS blog_user ON (blog_user.bloguserid = blog.userid)\r\n\t\t" . (($vbulletin->userinfo['userid'] and in_coventry($vbulletin->userinfo['userid'], true)) ? "\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "blog_tachyentry AS blog_tachyentry ON (blog_tachyentry.blogid = blog.blogid AND blog_tachyentry.userid = " . $vbulletin->userinfo['userid'] . ")\r\n\t\t" : "") . "\r\n\t\t{$hook_query_joins}\r\n\t\tWHERE blog_searchresult.blogsearchid = {$search['blogsearchid']}\r\n\t\t\tAND blog_searchresult.offset >= " . $vbulletin->GPC['start'] . "\r\n\t\t{$hook_query_where}\r\n\t\tORDER BY offset\r\n\t\tLIMIT {$perpage}\r\n\t");
$resultbits = '';
while ($blog = $db->fetch_array($results)) {
$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);
$show['blogtitle'] = $blog['blogtitle'] != $blog['username'];
$templater = vB_Template::create('blog_search_results_result');
$templater->register('blog', $blog);
$resultbits .= $templater->render();
}
$next_result = $previous_results + $db->num_rows($results) + 1;
$show['next_page'] = $next_result <= $search['resultcount'];
示例9: fetch_picturecommentbits
//.........这里部分代码省略.........
AND
picturecomment.userid = $pictureinfo[userid]
AND (" . implode(" OR ", $state_or) . ")
" . ($coventry ? "AND picturecomment.postuserid NOT IN (" . $coventry . ")" : '' ) . "
$hook_query_where
ORDER BY picturecomment.dateline
LIMIT $start, $perpage
");
list($messagestats['total']) = $vbulletin->db->query_first("SELECT FOUND_ROWS()", DBARRAY_NUM);
if ($start >= $messagestats['total'])
{
$pagenumber = ceil($messagestats['total'] / $perpage);
}
}
while ($start >= $messagestats['total'] AND $messagestats['total']);
$messagestats['start'] = $start + 1;
$messagestats['end'] = min($start + $perpage, $messagestats['total']);
$bbcode = new vB_BbCodeParser($vbulletin, fetch_tag_list());
$factory = new vB_Picture_CommentFactory($vbulletin, $bbcode, $pictureinfo);
$messagebits = '';
$firstrecord = array();
$read_ids = array();
if ($vbulletin->userinfo['userid'] AND !$showignored)
{
$ignorelist = preg_split('/( )+/', trim($vbulletin->userinfo['ignorelist']), -1, PREG_SPLIT_NO_EMPTY);
}
else
{
$ignorelist = array();
}
while ($message = $vbulletin->db->fetch_array($messages))
{
if (!$firstrecord)
{
$firstrecord = $message;
}
if ($ignorelist AND in_array($message['postuserid'], $ignorelist))
{
$message['ignored'] = true;
}
if (!$showignored AND in_coventry($message['postuserid']))
{
$message['ignored'] = true;
}
$response_handler =& $factory->create($message);
$response_handler->cachable = false;
$messagebits .= $response_handler->construct();
if (!$message['messageread'] AND $message['state'] == 'visible' AND $pictureinfo['userid'] == $vbulletin->userinfo['userid'])
{
$read_ids[] = $message['commentid'];
}
$messagestats['lastcomment'] = $message['dateline'];
}
if ($pictureinfo['userid'] == $vbulletin->userinfo['userid'])
{
$readpcs = 0;
if (!empty($read_ids))
{
$readpcs = sizeof($read_ids);
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "picturecomment SET messageread = 1 WHERE commentid IN (" . implode(',', $read_ids) . ")");
}
if ($vbulletin->userinfo['pcunreadcount'] - $readpcs > 0 AND $vbulletin->options['globalignore'] != '')
{
build_picture_comment_counters($vbulletin->userinfo['userid']);
}
else if ($readpcs)
{
$vbulletin->db->query_write("
UPDATE " . TABLE_PREFIX . "user
SET
pcunreadcount = IF(pcunreadcount >= $readpcs, pcunreadcount - $readpcs, 0)
WHERE
userid = " . $vbulletin->userinfo['userid']
);
}
}
$messagestats['perpage'] = $perpage;
$show['delete'] = fetch_user_picture_message_perm('candeletemessages', $pictureinfo);
$show['undelete'] = fetch_user_picture_message_perm('canundeletemessages', $pictureinfo);
$show['approve'] = fetch_user_picture_message_perm('canmoderatemessages', $pictureinfo);
$show['inlinemod'] = ($show['delete'] OR $show['undelete'] OR $show['approve']);
return $messagebits;
}
示例10: verify_blog_customblock
/**
* Fetches information about the selected custompage with permission checks
*
* @param integer The custompage we want info about
* @param string The type of customblock that we are working with (page or block)
* @param bool Should an error be displayed when block is not found
* @param bool Should a permission check be performed as well
*
* @return array Array of information about the custom page or prints an error if it doesn't exist / permission problems
*/
function verify_blog_customblock($customblockid, $type = null, $alert = true, $perm_check = true)
{
global $vbulletin, $vbphrase;
if (!($blockinfo = fetch_customblock_info($customblockid)))
{
if ($alert)
{
standard_error(fetch_error('invalidid', $vbphrase['custom_block'], $vbulletin->options['contactuslink']));
}
else
{
return 0;
}
}
else if ($type AND $blockinfo['type'] != $type)
{
standard_error(fetch_error('invalidid', $vbphrase['custom_block'], $vbulletin->options['contactuslink']));
}
$blockinfo['userinfo'] = verify_id('user', $blockinfo['userid'], 1, 1, 10);
if ($perm_check)
{
if ($vbulletin->userinfo['userid'] != $blockinfo['userinfo']['userid'] AND empty($blockinfo['userinfo']['bloguserid']))
{
standard_error(fetch_error('blog_noblog', $blockinfo['userinfo']['username']));
}
if (!$blockinfo['userinfo']['canviewmyblog'])
{
print_no_permission();
}
if (in_coventry($blockinfo['userinfo']['userid']) AND !can_moderate_blog())
{
standard_error(fetch_error('invalidid', $vbphrase['custom_block'], $vbulletin->options['contactuslink']));
}
if ($vbulletin->userinfo['userid'] == $blockinfo['userinfo']['userid'] AND !($vbulletin->userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_canviewown']))
{
print_no_permission();
}
if ($vbulletin->userinfo['userid'] != $blockinfo['userinfo']['userid'] AND !($vbulletin->userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_canviewothers']))
{
// Can't view other's entries so off you go to your own blog.
exec_header_redirect("blog.php?$session[sessionurl]u=" . $vbulletin->userinfo['userid']);
}
}
return $blockinfo;
}
示例11: get_article_comments
function get_article_comments($article, $associated_thread_id, $userinfo, &$pageno, &$perpage, &$total)
{
require_once DIR . '/includes/functions_misc.php';
require_once DIR . '/includes/functions.php';
require_once DIR . '/includes/functions_databuild.php';
require_once DIR . '/includes/functions_bigthree.php';
$posts_out = array();
fetch_phrase_group('posting');
$threadinfo = verify_id('thread', $associated_thread_id, 0, 1);
$foruminfo = verify_id('forum', $threadinfo['forumid'], 0, 1);
//First let's see if we have forum/thread view permissions. If not,
// we're done
if (!($permissions = can_view_thread($article->getNodeId(), $userinfo))) {
return array();
}
$forumperms = fetch_permissions($threadinfo['forumid']);
//Normally this thread will be wide open, so let's get the list first
// without checking. We'll verify each post anyway.
//get our results
$results = get_comments($permissions, $associated_thread_id);
$record_count = count($results);
if (!$results or !count($results)) {
return array();
}
//we accept the parameter "last" for pageno.
if ($pageno == FR_LAST_POST) {
$pageno = intval(($record_count + $perpage - 1) / $perpage);
$first = ($pageno - 1) * $perpage;
} else {
$pageno = max(1, intval($pageno));
$first = $perpage * ($pageno - 1);
}
//Let's trim off the results we need.
//This also tells us if we should show the "next" button.
$post_array = array_slice($results, $first, $perpage, true);
if (!$post_array) {
return array();
}
$firstpostid = false;
$displayed_dateline = 0;
if (vB::$vbulletin->options['threadmarking'] and vB::$vbulletin->userinfo['userid']) {
$threadview = max($threadinfo['threadread'], $threadinfo['forumread'], TIMENOW - vB::$vbulletin->options['markinglimit'] * 86400);
} else {
$threadview = intval(fetch_bbarray_cookie('thread_lastview', $thread['threadid']));
if (!$threadview) {
$threadview = vB::$vbulletin->userinfo['lastvisit'];
}
}
require_once DIR . '/includes/functions_user.php';
$show['inlinemod'] = false;
$postids = array();
$postids = ' post.postid in (' . implode(', ', $post_array) . ')';
$posts = vB::$vbulletin->db->query_read($sql = "\n\tSELECT\n\tpost.*, post.username AS postusername, post.ipaddress AS ip, IF(post.visible = 2, 1, 0) AS isdeleted,\n\t user.*, userfield.*, usertextfield.*,\n\t " . iif($forum['allowicons'], 'icon.title as icontitle, icon.iconpath,') . "\n\t " . iif(vB::$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 " . ((can_moderate($thread['forumid'], 'canmoderateposts') or can_moderate($thread['forumid'], 'candeleteposts')) ? 'spamlog.postid AS spamlog_postid,' : '') . "\n\t " . iif($deljoin, 'deletionlog.userid AS del_userid, deletionlog.username AS del_username, deletionlog.reason AS del_reason,') . "\n\t editlog.userid AS edit_userid, editlog.username AS edit_username, editlog.dateline AS edit_dateline,\n\t editlog.reason AS edit_reason, editlog.hashistory,\n\t postparsed.pagetext_html, postparsed.hasimages,\n\t sigparsed.signatureparsed, sigparsed.hasimages AS sighasimages,\n\t sigpic.userid AS sigpic, sigpic.dateline AS sigpicdateline, sigpic.width AS sigpicwidth, sigpic.height AS sigpicheight,\n\t IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid, infractiongroupid,\n\t customprofilepic.userid AS profilepic, customprofilepic.dateline AS profilepicdateline, customprofilepic.width AS ppwidth, customprofilepic.height AS ppheight\n\t " . iif(!($permissions['genericpermissions'] & vB::$vbulletin->bf_ugp_genericpermissions['canseehiddencustomfields']), vB::$vbulletin->profilefield['hidden']) . "\n\t {$hook_query_fields}\n\t FROM " . TABLE_PREFIX . "post AS post\n\t LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = post.userid)\n\t LEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON(userfield.userid = user.userid)\n\t LEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON(usertextfield.userid = user.userid)\n\t " . iif($forum['allowicons'], "LEFT JOIN " . TABLE_PREFIX . "icon AS icon ON(icon.iconid = post.iconid)") . "\n\t " . iif(vB::$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 " . ((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 {$deljoin}\n\t LEFT JOIN " . TABLE_PREFIX . "editlog AS editlog ON(editlog.postid = post.postid)\n\t LEFT JOIN " . TABLE_PREFIX . "postparsed AS postparsed ON(postparsed.postid = post.postid AND postparsed.styleid = " . intval(STYLEID) . " AND postparsed.languageid = " . intval(LANGUAGEID) . ")\n\t LEFT JOIN " . TABLE_PREFIX . "sigparsed AS sigparsed ON(sigparsed.userid = user.userid AND sigparsed.styleid = " . intval(STYLEID) . " AND sigparsed.languageid = " . intval(LANGUAGEID) . ")\n\t LEFT JOIN " . TABLE_PREFIX . "sigpic AS sigpic ON(sigpic.userid = post.userid)\n\t LEFT JOIN " . TABLE_PREFIX . "customprofilepic AS customprofilepic ON (user.userid = customprofilepic.userid)\n\t {$hook_query_joins}\n\t WHERE {$postids}\n\t ORDER BY post.dateline\n\t ");
if (!($forumperms & vB::$vbulletin->bf_ugp_forumpermissions['canseethumbnails']) and !($forumperms & vB::$vbulletin->bf_ugp_forumpermissions['cangetattachment'])) {
vB::$vbulletin->options['attachthumbs'] = 0;
}
if (!($forumperms & vB::$vbulletin->bf_ugp_forumpermissions['cangetattachment'])) {
vB::$vbulletin->options['viewattachedimages'] = 0;
}
$postcount = count($postid_array);
$counter = 0;
$postbits = '';
vB::$vbulletin->noheader = true;
while ($post = vB::$vbulletin->db->fetch_array($posts)) {
if (!$privileges['can_moderate_forums']) {
if ($privileges['is_coventry'] or $post['visible'] == 2) {
continue;
}
}
// post/thread is deleted by moderator and we don't have permission to see it
if (!($post['visible'] or $privileges['can_moderate_posts'])) {
continue;
}
if (!intval($post['userid'])) {
$post['avatarid'] = false;
} else {
if (!$post['hascustomavatar']) {
if ($post['profilepic']) {
$post['hascustomavatar'] = 1;
$post['avatarid'] = true;
$post['avatarpath'] = "./image.php?u=" . $post['userid'] . "&dateline=" . $post['profilepicdateline'] . "&type=profile";
$post['avwidth'] = $post['ppwidth'];
$post['avheight'] = $post['ppheight'];
} else {
$post['hascustomavatar'] = 1;
$post['avatarid'] = true;
// explicity setting avatarurl to allow guests comments to show unknown avatar
$post['avatarurl'] = $post['avatarpath'] = vB_Template_Runtime::fetchStyleVar('imgdir_misc') . '/unknown.gif';
$post['avwidth'] = 60;
$post['avheight'] = 60;
}
}
}
if ($tachyuser = in_coventry($post['userid']) and !can_moderate($thread['forumid'])) {
continue;
}
if ($post['visible'] == 1 and !$tachyuser) {
++$counter;
if ($postorder) {
$post['postcount'] = --$postcount;
//.........这里部分代码省略.........
示例12: array
$sql_or = array();
($hook = vBulletinHook::fetch_hook('blog_comments_start')) ? eval($hook) : false;
// Set Perpage .. this limits it to 10. Any reason for more?
if ($vbulletin->GPC['perpage'] == 0 or $vbulletin->GPC['perpage'] > $vbulletin->options['blog_commentsperpage']) {
$perpage = $vbulletin->options['blog_commentsperpage'];
} else {
$perpage = $vbulletin->GPC['perpage'];
}
if ($vbulletin->GPC['userid']) {
$userinfo = verify_id('user', $vbulletin->GPC['userid'], 1, 1, 10);
cache_permissions($userinfo, false);
$show['entry_userinfo'] = false;
if (!$userinfo['canviewmyblog']) {
print_no_permission();
}
if (in_coventry($userinfo['userid']) and !can_moderate_blog()) {
standard_error(fetch_error('invalidid', $vbphrase['blog'], $vbulletin->options['contactuslink']));
}
if ($vbulletin->userinfo['userid'] == $userinfo['userid'] and !($vbulletin->userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_canviewown'])) {
print_no_permission();
}
if ($vbulletin->userinfo['userid'] != $userinfo['userid'] and !($vbulletin->userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_canviewothers'])) {
if ($vbulletin->userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_canviewown']) {
// Can't view other's entries so off you go to your own blog.
$bloginfo = array('userid' => $vbulletin->userinfo['userid'], 'title' => $vbulletin->userinfo['blog_title'] ? $vbulletin->userinfo['blog_title'] : $vbulletin->userinfo['username']);
exec_header_redirect(fetch_seo_url('blog|js', $bloginfo));
} else {
print_no_permission();
}
}
$sql_and[] = "blog_text.bloguserid = {$userinfo['userid']}";
示例13: load_show_variables
/**
* Loads assorted show variables. Ideally, these would be used in templates,
* but sometimes they're used within code.
*/
public function load_show_variables()
{
parent::load_show_variables();
global $vbulletin, $show, $threadinfo, $foruminfo;
$show['foruminfo'] = (THIS_SCRIPT == 'forumdisplay' and $vbulletin->userinfo['forumpermissions']["{$foruminfo['forumid']}"] & $vbulletin->bf_ugp_forumpermissions['canview']);
if (THIS_SCRIPT == 'showthread' and $threadinfo['threadid']) {
if (!($vbulletin->userinfo['forumpermissions']["{$foruminfo['forumid']}"] & $vbulletin->bf_ugp_forumpermissions['canview']) or (!$threadinfo['visible'] and !can_moderate($foruminfo['forumid'], 'canmoderateposts') or $threadinfo['isdeleted'] and !can_moderate($foruminfo['forumid'])) or in_coventry($threadinfo['postuserid']) and !can_moderate($foruminfo['forumid']) or !($vbulletin->userinfo['forumpermissions']["{$foruminfo['forumid']}"] & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) or !($vbulletin->userinfo['forumpermissions']["{$foruminfo['forumid']}"] & $vbulletin->bf_ugp_forumpermissions['canviewothers']) and ($threadinfo['postuserid'] != $vbulletin->userinfo['userid'] or $vbulletin->userinfo['userid'] == 0) or !verify_forum_password($foruminfo['forumid'], $foruminfo['password'], false)) {
$show['threadinfo'] = false;
} else {
$show['threadinfo'] = true;
}
} else {
$show['threadinfo'] = false;
}
}
示例14: ISNULL
$start = ($pagenumber - 1) * $perpage;
$messages = $db->query_read_slave("\n\t(\n\t\tSELECT\n\t\t\tvisitormessage.*, visitormessage.dateline AS pmdateline, user.*, visitormessage.ipaddress AS messageipaddress, visitormessage.userid AS profileuserid\n\t\t\t{$delsql1}\n\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, customavatar.width_thumb AS avwidth_thumb, customavatar.height_thumb AS avheight_thumb, filedata_thumb, NOT ISNULL(customavatar.userid) AS hascustom" : "") . "\n\t\t\t{$hook_query_fields1}\n\t\tFROM " . TABLE_PREFIX . "visitormessage AS visitormessage\n\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (visitormessage.postuserid = user.userid)\n\t\t" . ($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{$deljoinsql1}\n\t\t{$hook_query_joins1}\n\t\tWHERE " . implode(" AND ", $sql1) . "\n\t\t{$hook_query_where1}\n\t)\n\tUNION\n\t(\n\t\tSELECT\n\t\t\tvisitormessage.*, visitormessage.dateline AS pmdateline, user.*, visitormessage.ipaddress AS messageipaddress, visitormessage.userid AS profileuserid\n\t\t\t" . ($deljoinsql2 ? ",deletionlog.userid AS del_userid, deletionlog.username AS del_username, deletionlog.reason AS del_reason" : "") . "\n\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, customavatar.width_thumb AS avwidth_thumb, customavatar.height_thumb AS avheight_thumb, filedata_thumb, NOT ISNULL(customavatar.userid) AS hascustom" : "") . "\n\t\t\t{$hook_query_fields2}\n\t\tFROM " . TABLE_PREFIX . "visitormessage AS visitormessage\n\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (visitormessage.postuserid = user.userid)\n\t\t" . ($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{$deljoinsql2}\n\t\t{$hook_query_joins2}\n\t\tWHERE " . implode(" AND ", $sql2) . "\n\t\t{$hook_query_where2}\n\t)\n\tORDER BY pmdateline DESC\n\tLIMIT {$start}, {$perpage}\n\t");
$messagetotal = $db->found_rows();
if ($start >= $messagetotal) {
$pagenumber = ceil($messagetotal / $perpage);
}
} while ($start >= $messagetotal and $messagetotal);
$block_data = array('messagestart' => $start + 1, 'messageend' => min($start + $perpage, $messagetotal), 'fromconverse' => 1);
$prepared = array('vm_total' => $messagetotal);
$bbcode = new vB_BbCodeParser($vbulletin, fetch_tag_list());
$factory = new vB_Visitor_MessageFactory($vbulletin, $bbcode, $userinfo2);
$show['conversepage'] = true;
$block_data['messagebits'] = '';
$have_inlinemod = false;
while ($message = $db->fetch_array($messages)) {
if (in_coventry($message['postuserid']) and !$vbulletin->GPC['showignored']) {
$message['ignored'] = true;
}
if ($message['profileuserid'] == $vbulletin->userinfo['userid'] and $message['state'] == 'visible' and !$message['messageread']) {
$read_ids[] = $message['vmid'];
}
$response_handler =& $factory->create($message);
$response_handler->converse = false;
$response_handler->cachable = false;
$block_data['messagebits'] .= $response_handler->construct();
if ($show['inlinemod']) {
$have_inlinemod = true;
}
$block_data['lastcomment'] = !$block_data['lastcomment'] ? $message['dateline'] : $block_data['lastcomment'];
}
// our profile and ids that need read
示例15: 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
//.........这里部分代码省略.........