本文整理汇总了PHP中fetch_permissions函数的典型用法代码示例。如果您正苦于以下问题:PHP fetch_permissions函数的具体用法?PHP fetch_permissions怎么用?PHP fetch_permissions使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fetch_permissions函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetch_moderator_forum_options
/**
* Returns a nice <select> list of forums, complete with displayorder, parenting and depth information
*
* @param string Optional name of the first <option>
* @param boolean Show the top <option> or not
* @param boolean Display an <option> labelled 'Select a forum'
* @param string Name of can_moderate() option to check for each forum - if 'none', show all forums
* @param string Character(s) to use to indicate forum depth
* @param boolean Show '(no posting)' after title of category-type forums
*
* @return array Array for use in building a <select> to show options
*/
function fetch_moderator_forum_options($topname = NULL, $displaytop = true, $displayselectforum = false, $permcheck = '', $depthmark = '--', $show_no_posting = true)
{
global $vbphrase, $vbulletin;
$select_options = array();
if ($displayselectforum) {
$selectoptions[0] = $vbphrase['select_forum'];
$selectedid = 0;
}
if ($displaytop) {
$select_options['-1'] = $topname === NULL ? $vbphrase['no_one'] : $topname;
$startdepth = $depthmark;
} else {
$startdepth = '';
}
foreach ($vbulletin->forumcache as $forum) {
$perms = fetch_permissions($forum['forumid']);
if (!($perms & $vbulletin->bf_ugp_forumpermissions['canview'])) {
continue;
}
if (empty($forum['link'])) {
if ($permcheck == 'none' or can_moderate($forum['forumid'], $permcheck)) {
$select_options["{$forum['forumid']}"] = str_repeat($depthmark, $forum['depth']) . "{$startdepth} {$forum['title']}";
if ($show_no_posting) {
$select_options["{$forum['forumid']}"] .= ' ' . ($forum['options'] & $vbulletin->bf_misc_forumoptions['allowposting'] ? '' : " ({$vbphrase['no_posting']})") . " {$forum['allowposting']}";
}
}
}
}
return $select_options;
}
示例2: create_new_thread
/**
* Creates new thread or gives error and then redirects user
*
* @param string Title of thread
* @param string Message of post
* @param integer ForumID for thread
* @param boolean Allow guest posts
*/
function create_new_thread($title = 'Defauglt Title', $message = 'Defagult Message', $id = 3, $guest = false)
{
// set some globals
global $forumperms, $vbulletin, $vbphrase;
// init some variables
$fail = 0;
$errors = array();
$newpost = array();
// init post information
if ($guest and $vbulletin->userinfo['userid'] == 0) {
$newpost['username'] = $vbphrase['guest'];
}
$newpost['title'] = $title;
$newpost['message'] = $message;
$newpost['signature'] = '0';
if ($vbulletin->userinfo['signature'] != '') {
$newpost['signature'] = '1';
}
$newpost['parseurl'] = '1';
$newpost['emailupdate'] = '9999';
// attempt thread create
$foruminfo = verify_id('forum', $id, 0, 1);
if (!$foruminfo['forumid']) {
$fail = 1;
}
$forumperms = fetch_permissions($foruminfo['forumid']);
if (!function_exists('build_new_post')) {
require_once DIR . '/includes/functions_newpost.php';
}
build_new_post('thread', $foruminfo, array(), array(), $newpost, $errors);
if (sizeof($errors) > 0) {
$fail = 1;
}
// do redirection
if (!$fail) {
$vbulletin->url = $vbulletin->options['bburl'] . '/showthread.php?' . $vbulletin->session->vars['sessionurl'] . "p=" . $newpost['postid'] . "#post" . $newpost['postid'];
eval(print_standard_redirect('redirect_postthanks'));
} else {
$vbulletin->url = $vbulletin->options['bburl'];
eval(print_standard_redirect($vbphrase['error'] . ': ' . $vbphrase['redirecting'], 0, 1));
}
}
示例3: fetchTemplate
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();
}
}
示例4: get_tags_status_list
/**
* Get an array of bbtags stusus(allow / forbid) for user
*
*
* @global vB_Registry $vbulletin
* @param array $user_info
* @param mixed $forumid
* @param string $optiongroup
* @param bool $is_filter_type_inbound - Indicates whether the filtering is for presaving or for output rendering.
* @return array
*
*/
function get_tags_status_list($user_info = NULL, $forumid = NULL, $optiongroup = NULL, $is_filter_type_inbound = true)
{
global $vbulletin;
$allawbbcodes = array('BASIC', 'COLOR', 'SIZE', 'FONT', 'ALIGN', 'LIST', 'URL', 'CODE', 'PHP', 'HTML');
// user init
if (is_null($user_info) || empty($user_info)) {
$user_info = $vbulletin->userinfo;
}
$userid = $user_info['userid'];
// optiongroup init
if (is_null($optiongroup)) {
switch (THIS_SCRIPT) {
case 'group':
$optiongroup = 'sg_allowed_bbcode';
break;
case 'visitormessage':
$optiongroup = 'vm_allowed_bbcode';
break;
case 'picturecomment':
$optiongroup = 'pc_allowed_bbcode';
break;
default:
$optiongroup = 'allowedbbcodes';
}
}
$permissions = fetch_permissions(0, $userid, $user_info);
$aditional_bbcode_filters = unserialize($permissions['aditional_bbcode_filters']);
$is_need_aditional_verification = is_need_aditional_bbtags_verification($permissions, $forumid, $optiongroup, $is_filter_type_inbound);
// checking tags
$tags = array();
foreach ($allawbbcodes as $bbtag) {
$tag_bit = @constant('ALLOW_BBCODE_' . strtoupper($bbtag));
if ($is_need_aditional_verification and array_key_exists($tag_bit, $aditional_bbcode_filters)) {
$tags[$bbtag] = $aditional_bbcode_filters[$tag_bit] ? $tag_bit : 0;
} else {
$tags[$bbtag] = $vbulletin->options[$optiongroup] & $tag_bit;
}
}
return $tags;
}
示例5: convert_ids_to_titles
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']);
}
}
//.........这里部分代码省略.........
示例6: do_subscribe_thread
function do_subscribe_thread()
{
global $vbulletin, $db, $foruminfo, $threadinfo;
if (!$vbulletin->userinfo['userid']) {
json_error(ERR_INVALID_LOGGEDIN, RV_NOT_LOGGED_IN);
}
$vbulletin->input->clean_array_gpc('r', array('emailupdate' => TYPE_UINT, 'folderid' => TYPE_INT));
$vbulletin->GPC['folderid'] = 0;
if (!$foruminfo['forumid']) {
json_error(ERR_INVALID_THREAD);
}
$forumperms = fetch_permissions($foruminfo['forumid']);
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview'])) {
json_error(ERR_INVALID_THREAD);
}
if (!$foruminfo['allowposting'] or $foruminfo['link'] or !$foruminfo['cancontainthreads']) {
json_error(ERR_CANNOT_SUB_FORUM_CLOSED);
}
// check if there is a forum password and if so, ensure the user has it set
if (!verify_forum_password($foruminfo['forumid'], $foruminfo['password'], false)) {
json_error(ERR_CANNOT_SUB_PASSWORD);
}
if ($threadinfo['threadid']) {
if (!$threadinfo['visible'] and !can_moderate($threadinfo['forumid'], 'canmoderateposts') or $threadinfo['isdeleted'] and !can_moderate($threadinfo['forumid'], 'candeleteposts')) {
json_error(ERR_INVALID_THREAD);
}
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) or ($vbulletin->userinfo['userid'] != $threadinfo['postuserid'] or !$vbulletin->userinfo['userid']) and !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers'])) {
json_error(ERR_INVALID_THREAD);
}
/*insert query*/
$db->query_write("\n\t\t\tREPLACE INTO " . TABLE_PREFIX . "subscribethread (userid, threadid, emailupdate, folderid, canview)\n\t\t\tVALUES (" . $vbulletin->userinfo['userid'] . ", {$threadinfo['threadid']}, " . $vbulletin->GPC['emailupdate'] . ", " . $vbulletin->GPC['folderid'] . ", 1)\n\t\t");
} else {
if ($foruminfo['forumid']) {
/*insert query*/
$db->query_write("\n\t\t\tREPLACE INTO " . TABLE_PREFIX . "subscribeforum (userid, emailupdate, forumid)\n\t\t\tVALUES (" . $vbulletin->userinfo['userid'] . ", " . $vbulletin->GPC['emailupdate'] . ", " . $vbulletin->GPC['forumid'] . ")\n\t\t");
}
}
return array('success' => true);
}
示例7: pre_delete
/**
* pre_delete function - extend if the contenttype needs to do anything
*
* @param array list of deleted attachment ids to delete
* @param boolean verify permission to delete
*
* @return boolean
*/
public function pre_delete($list, $checkperms = true)
{
@ignore_user_abort(true);
// init lists
$this->lists = array('postlist' => array(), 'threadlist' => array());
if ($checkperms) {
// Verify that we have permission to view these attachmentids
$attachmultiple = new vB_Attachment_Display_Multiple($this->registry);
$attachments = $attachmultiple->fetch_results("a.attachmentid IN (" . implode(", ", $list) . ")");
if (count($list) != count($attachments)) {
return false;
}
}
$ids = $this->registry->db->query_read("\n\t\t\tSELECT\n\t\t\t\ta.attachmentid, a.userid, IF(a.contentid = 0, 1, 0) AS inprogress,\n\t\t\t\tpost.postid, post.threadid, post.dateline AS p_dateline, post.userid AS post_userid,\n\t\t\t\tthread.forumid, thread.threadid, thread.open,\n\t\t\t\teditlog.hashistory\n\t\t\tFROM " . TABLE_PREFIX . "attachment AS a\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = a.contentid)\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "thread AS thread ON (thread.threadid = post.threadid)\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "editlog AS editlog ON (editlog.postid = post.postid)\n\t\t\tWHERE a.attachmentid IN (" . implode(", ", $list) . ")\n\t\t");
while ($id = $this->registry->db->fetch_array($ids)) {
if (!$id['inprogress'] and $checkperms) {
if (!$id['open'] and !can_moderate($id['forumid'], 'canopenclose') and !$this->registry->options['allowclosedattachdel']) {
return false;
} else {
if (!can_moderate($id['forumid'], 'caneditposts')) {
$forumperms = fetch_permissions($id['forumid']);
if (!($forumperms & $this->registry->bf_ugp_forumpermissions['caneditpost']) or $this->registry->userinfo['userid'] != $id['userid']) {
return false;
} else {
if (!$this->registry->options['allowattachdel'] and $this->registry->options['edittimelimit'] and $id['p_dateline'] < TIMENOW - $this->registry->options['edittimelimit'] * 60) {
return false;
}
}
}
}
}
if ($id['postid']) {
$this->lists['postlist']["{$id['postid']}"]++;
if ($this->log) {
if ($this->registry->userinfo['permissions']['genericoptions'] & $this->registry->bf_ugp_genericoptions['showeditedby'] and $id['p_dateline'] < TIMENOW - $this->registry->options['noeditedbytime'] * 60) {
if (empty($replaced["{$id['postid']}"])) {
/*insert query*/
$this->registry->db->query_write("\n\t\t\t\t\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "editlog\n\t\t\t\t\t\t\t\t\t\t(postid, userid, username, dateline, hashistory)\n\t\t\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t\t\t({$id['postid']},\n\t\t\t\t\t\t\t\t\t" . $this->registry->userinfo['userid'] . ",\n\t\t\t\t\t\t\t\t\t'" . $this->registry->db->escape_string($this->registry->userinfo['username']) . "',\n\t\t\t\t\t\t\t\t\t" . TIMENOW . ",\n\t\t\t\t\t\t\t\t\t" . intval($id['hashistory']) . ")\n\t\t\t\t\t\t\t");
$replaced["{$id['postid']}"] = true;
}
}
if ($this->registry->userinfo['userid'] != $id['post_userid'] and can_moderate($id['forumid'], 'caneditposts')) {
$postinfo = array('postid' => &$id['postid'], 'threadid' => &$id['threadid'], 'forumid' => &$id['forumid'], 'attachmentid' => &$id['attachmentid']);
require_once DIR . '/includes/functions_log_error.php';
log_moderator_action($postinfo, 'attachment_removed');
}
}
}
if ($id['threadid']) {
$this->lists['threadlist']["{$id['threadid']}"]++;
}
}
return true;
}
示例8: construct_hidden_code
construct_hidden_code('oldpermissions', $user['adminpermissions']);
print_table_header(construct_phrase($vbphrase['x_y_id_z'], $vbphrase['administrator_permissions'], $user['username'], $user['userid']));
print_label_row("{$vbphrase['administrator']}: <a href=\"user.php?" . $vbulletin->session->vars['sessionurl'] . "do=edit&u=" . $vbulletin->GPC['userid'] . "\">{$user['username']}</a>", '<div align="' . $stylevar['right'] . '"><input type="button" class="button" value=" ' . $vbphrase['all_yes'] . ' " onclick="js_check_all_option(this.form, 1);" /> <input type="button" class="button" value=" ' . $vbphrase['all_no'] . ' " onclick="js_check_all_option(this.form, 0);" /></div>', 'thead');
foreach (convert_bits_to_array($user['adminpermissions'], $ADMINPERMISSIONS) as $field => $value) {
print_yes_no_row($permsphrase["{$field}"] == '' ? $vbphrase['n_a'] : $permsphrase["{$field}"], "adminpermissions[{$field}]", $value);
}
($hook = vBulletinHook::fetch_hook('admin_permissions_form')) ? eval($hook) : false;
print_select_row($vbphrase['control_panel_style_choice'], 'cssprefs', array_merge(array('' => "({$vbphrase['default']})"), fetch_cpcss_options()), $user['cssprefs']);
print_input_row($vbphrase['dismissed_news_item_ids'], 'dismissednews', $user['dismissednews']);
print_submit_row();
}
// #############################################################################
if ($_REQUEST['do'] == 'modify') {
print_form_header('adminpermissions', 'edit');
print_table_header($vbphrase['administrator_permissions'], 3);
$users = $db->query_read("\n\t\tSELECT user.username, usergroupid, membergroupids, infractiongroupids, administrator.*\n\t\tFROM " . TABLE_PREFIX . "administrator AS administrator\n\t\tINNER JOIN " . TABLE_PREFIX . "user AS user USING(userid)\n\t\tORDER BY user.username\n\t");
while ($user = $db->fetch_array($users)) {
$perms = fetch_permissions(0, $user['userid'], $user);
if ($perms['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel']) {
print_cells_row(array("<a href=\"user.php?" . $vbulletin->session->vars['sessionurl'] . "do=edit&u={$user['userid']}\" name=\"user{$user['userid']}\"><b>{$user['username']}</b></a>", '-', construct_link_code($vbphrase['view_control_panel_log'], "adminlog.php?" . $vbulletin->session->vars['sessionurl'] . "do=view&script=&u={$user['userid']}") . construct_link_code($vbphrase['edit_permissions'], "adminpermissions.php?" . $vbulletin->session->vars['sessionurl'] . "do=edit&u={$user['userid']}")), 0, '', 0);
}
}
print_table_footer();
}
print_cp_footer();
/*======================================================================*\
|| ####################################################################
|| # Downloaded: 12:56, Sat Oct 11th 2008
|| # CVS: $RCSfile$ - $Revision: 25308 $
|| ####################################################################
\*======================================================================*/
示例9: do_report
/**
* Does the report
*
* @param string The Reason for the report
* @param array Information regarding the item being reported
*
*/
function do_report($reason, &$iteminfo)
{
global $vbphrase;
$this->iteminfo =& $iteminfo;
$reportinfo = array('rusername' => unhtmlspecialchars($this->registry->userinfo['username']), 'ruserid' => $this->registry->userinfo['userid'], 'remail' => $this->registry->userinfo['email']);
if ($this->registry->options['postmaxchars'] > 0) {
$reportinfo['reason'] = substr($reason, 0, $this->registry->options['postmaxchars']);
} else {
$reportinfo['reason'] = $reason;
}
$reportthread = ($rpforumid = $this->registry->options['rpforumid'] and $rpforuminfo = fetch_foruminfo($rpforumid));
$reportemail = ($this->registry->options['enableemail'] and $this->registry->options['rpemail']);
$mods = array();
$reportinfo['modlist'] = '';
$moderators = $this->fetch_affected_moderators();
if ($moderators) {
while ($moderator = $this->registry->db->fetch_array($moderators)) {
$mods["{$moderator['userid']}"] = $moderator;
$reportinfo['modlist'] .= (!empty($reportinfo['modlist']) ? ', ' : '') . unhtmlspecialchars($moderator['username']);
}
}
if (empty($reportinfo['modlist'])) {
$reportinfo['modlist'] = $vbphrase['n_a'];
}
$this->set_reportinfo($reportinfo);
if ($reportthread) {
// Determine if we need to create a thread or a post
if (!$this->iteminfo['reportthreadid'] or !($rpthreadinfo = fetch_threadinfo($this->iteminfo['reportthreadid'])) or $rpthreadinfo and ($rpthreadinfo['isdeleted'] or !$rpthreadinfo['visible'] or $rpthreadinfo['forumid'] != $rpforuminfo['forumid'])) {
eval(fetch_email_phrases('report' . $this->phrasekey . '_newthread', 0));
if (!$this->registry->options['rpuserid'] or !($userinfo = fetch_userinfo($this->registry->options['rpuserid']))) {
$userinfo =& $this->registry->userinfo;
}
$threadman =& datamanager_init('Thread_FirstPost', $this->registry, ERRTYPE_SILENT, 'threadpost');
$threadman->set_info('forum', $rpforuminfo);
$threadman->set_info('is_automated', true);
$threadman->set_info('skip_moderator_email', true);
$threadman->set_info('mark_thread_read', true);
$threadman->set_info('parseurl', true);
$threadman->set('allowsmilie', true);
$threadman->set('userid', $userinfo['userid']);
$threadman->setr_info('user', $userinfo);
$threadman->set('title', $subject);
$threadman->set('pagetext', $message);
$threadman->set('forumid', $rpforuminfo['forumid']);
$threadman->set('visible', 1);
if ($userinfo['userid'] != $this->registry->userinfo['userid']) {
// not posting as the current user, IP won't make sense
$threadman->set('ipaddress', '');
}
$rpthreadid = $threadman->save();
if ($this->update_item_reportid($rpthreadid)) {
$threadman->set_info('skip_moderator_email', false);
$threadman->email_moderators(array('newthreademail', 'newpostemail'));
$this->iteminfo['reportthreadid'] = 0;
$rpthreadinfo = array('threadid' => $rpthreadid, 'forumid' => $rpforuminfo['forumid'], 'postuserid' => $userinfo['userid']);
// check the permission of the other user
$userperms = fetch_permissions($rpthreadinfo['forumid'], $userinfo['userid'], $userinfo);
if ($userperms & $this->registry->bf_ugp_forumpermissions['canview'] and $userperms & $this->registry->bf_ugp_forumpermissions['canviewthreads'] and $userinfo['autosubscribe'] != -1) {
$this->registry->db->query_write("\n\t\t\t\t\t\t\tINSERT IGNORE INTO " . TABLE_PREFIX . "subscribethread\n\t\t\t\t\t\t\t\t(userid, threadid, emailupdate, folderid, canview)\n\t\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t\t(" . $userinfo['userid'] . ", {$rpthreadinfo['threadid']}, {$userinfo['autosubscribe']}, 0, 1)\n\t\t\t\t\t\t");
}
} else {
// Delete the thread we just created
if ($delthread = fetch_threadinfo($rpthreadid)) {
$threadman =& datamanager_init('Thread', $this->registry, ERRTYPE_SILENT, 'threadpost');
$threadman->set_existing($delthread);
$threadman->delete($rpforuminfo['countposts'], true, NULL, false);
unset($threadman);
}
$this->refetch_iteminfo();
}
}
if ($this->iteminfo['reportthreadid'] and $rpthreadinfo = fetch_threadinfo($this->iteminfo['reportthreadid']) and !$rpthreadinfo['isdeleted'] and $rpthreadinfo['visible'] == 1 and $rpthreadinfo['forumid'] == $rpforuminfo['forumid']) {
eval(fetch_email_phrases('reportitem_newpost', 0));
// Already reported, thread still exists/visible, and thread is in the right forum.
// Technically, if the thread exists but is in the wrong forum, we should create the
// thread, but that should only occur in a race condition.
if (!$this->registry->options['rpuserid'] or !$userinfo and !($userinfo = fetch_userinfo($this->registry->options['rpuserid']))) {
$userinfo =& $this->registry->userinfo;
}
$postman =& datamanager_init('Post', $this->registry, ERRTYPE_STANDARD, 'threadpost');
$postman->set_info('thread', $rpthreadinfo);
$postman->set_info('forum', $rpforuminfo);
$postman->set_info('is_automated', true);
$postman->set_info('parseurl', true);
$postman->set('threadid', $rpthreadinfo['threadid']);
$postman->set('userid', $userinfo['userid']);
$postman->set('allowsmilie', true);
$postman->set('visible', true);
$postman->set('title', $subject);
$postman->set('pagetext', $message);
if ($userinfo['userid'] != $this->registry->userinfo['userid']) {
// not posting as the current user, IP won't make sense
$postman->set('ipaddress', '');
//.........这里部分代码省略.........
示例10: construct_forum_bit
//.........这里部分代码省略.........
// 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;
}
示例11: 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, $vbulletin, $userperms, $permissions;
if ($vbulletin->options['reputationenable'] and ($this->profile->userinfo['showreputation'] or !($userperms['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canhiderep']))) {
$reputations = $vbulletin->db->query_read_slave("\n\t\t\t\tSELECT user.username, reputation.whoadded, reputation.postid, thread.title, thread.forumid, post.threadid,\n\t\t\t\treputation.reputation, reputation.reason, reputation.dateline, thread.postuserid, reputation.reputationid\n\t\t\t\tFROM " . TABLE_PREFIX . "reputation AS reputation\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "post AS post USING (postid)\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "thread AS thread USING (threadid)\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = reputation.whoadded)\n\t\t\t\tWHERE reputation.userid = " . $this->profile->userinfo['userid'] . "\n\t\t\t\tAND thread.visible = 1 AND post.visible = 1\n\t\t\t\tORDER BY reputation.dateline DESC\n\t\t\t");
$this->block_data['reputation'] = array();
if ($vbulletin->userinfo['userid'] == $this->profile->userinfo['userid']) {
$options['showraters'] = true;
}
require_once DIR . '/includes/class_bbcode.php';
$bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
while ($reputation = $vbulletin->db->fetch_array($reputations) and $this->count < $options['comments']) {
$forumperms = fetch_permissions($reputation['forumid']);
if ($forumperms & $vbulletin->bf_ugp_forumpermissions['canview'] and $forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads'] and ($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers'] or $reputation['postuserid'] == $vbulletin->userinfo['userid'])) {
$this->count++;
if ($reputation['reputation'] > 0) {
$reputation['posneg'] = 'pos';
} else {
if ($reputation['reputation'] < 0) {
$reputation['posneg'] = 'neg';
} else {
$reputation['posneg'] = 'balance';
}
}
$reputation['postinfo'] = array('p' => $reputation['postid']);
$reputation['threadinfo'] = array('title' => $reputation['title'], 'threadid' => $reputation['threadid']);
$reputation['timestamp'] = $reputation['dateline'];
$reputation['showraters'] = $options['showraters'];
$reputation['timeline'] = vbdate($vbulletin->options['timeformat'], $reputation['dateline']);
$reputation['dateline'] = vbdate($vbulletin->options['dateformat'], $reputation['dateline']);
$reputation['reason'] = $bbcode_parser->parse($reputation['reason']);
$reputation['username'] = $reputation['username'] ? $reputation['username'] : $vbphrase['n_a'];
if (empty($reputation['reason'])) {
$reputation['reason'] = $vbphrase['no_comment'];
}
($hook = vBulletinHook::fetch_hook('member_profileblock_reputationbit')) ? eval($hook) : false;
$this->block_data['reputation'][] = $reputation;
}
}
}
}
示例12: construct_navbits
$navbits = construct_navbits(array('' => $vbphrase['user_control_panel']));
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('USERCP_SHELL') . '");');
}
// ###########################################################################
// ########################### UPDATE SUBSCRIPTIONS ##########################
// ###########################################################################
if ($_REQUEST['action'] == "updatesubs") {
if (!$vbulletin->userinfo['userid']) {
print_no_permission();
}
//get a list of all the forum ID's
$tables = $db->query_read("\r\n\t\tSELECT forumid\r\n\t\tFROM " . TABLE_PREFIX . "forum\r\n\t");
//scan through the list to perform the subscription action
while ($curr_forum = $db->fetch_array($tables)) {
//get full forum info
$curr_forum = fetch_foruminfo($curr_forum['forumid'], false);
//if the user has permission to view the given forum, and if forum is postable...
if ($perms = fetch_permissions($curr_forum["forumid"]) and $perms & $vbulletin->bf_ugp_forumpermissions['canview'] and $curr_forum["cancontainthreads"]) {
$vbulletin->input->clean_gpc('r', 'forumid' . $curr_forum['forumid'], TYPE_UINT);
$new_sublevel = $vbulletin->GPC["forumid" . $curr_forum["forumid"]];
if ($new_sublevel == 0) {
$db->query_write("\r\n\t\t\t\tDELETE FROM " . TABLE_PREFIX . "subscribeforum\r\n\t\t\t\tWHERE userid = '" . $vbulletin->userinfo['userid'] . "'\r\n\t\t\t\tAND forumid = '" . $curr_forum['forumid'] . "'");
} else {
$db->query_write("\r\n\t\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "subscribeforum (userid, emailupdate, forumid)\r\n\t\t\t\t\tVALUES ('" . $vbulletin->userinfo['userid'] . "', '" . $new_sublevel . "', '" . $curr_forum['forumid'] . "')\r\n\t\t\t\t");
}
}
}
$vbulletin->url = "subscribeforums.php";
eval(print_standard_redirect('ei_sub_forums_updated', true, true));
}
示例13: array
<?php
if ($_REQUEST['do'] == 'vietvbb_stats' and $vbulletin->options['vietvbbtopstats_enable_global']) {
// Check forum permission
$vietvbbstatsforumperms = array();
foreach ($vbulletin->forumcache as $vietvbbtsforum) {
$vietvbbstatsforumperms[$vietvbbtsforum["forumid"]] = fetch_permissions($vietvbbtsforum['forumid']);
if (!($vietvbbstatsforumperms[$vietvbbtsforum["forumid"]] & $vbulletin->bf_ugp_forumpermissions['canview']) or !($vietvbbtsforum['options'] & $vbulletin->bf_misc_forumoptions['active']) and !$vbulletin->options['showprivateforums'] and !in_array($vbulletin->userinfo['usergroupid'], array(5, 6, 7))) {
$vietvbbexclfids .= ',' . $vietvbbtsforum['forumid'];
}
}
// Excl
if ($vbulletin->options['vietvbbtopstats_excl_forums']) {
$vietvbbexclfids .= ',' . $vbulletin->options['vietvbbtopstats_excl_forums'];
}
$vietvbbexclfids = substr($vietvbbexclfids, 1);
if ($vietvbbexclfids) {
$vietvbbexclforums_lastposts = "AND thread.forumid NOT IN({$vietvbbexclfids})";
$vietvbbexclforums_topforums = "AND thread.forumid NOT IN({$vietvbbexclfids})";
$vietvbbexclforums = "AND forumid NOT IN({$vietvbbexclfids})";
}
if ($vbulletin->options['vietvbbtopstats_excl_groups_listing']) {
$vietvbbexclgroups = "AND user.usergroupid NOT IN (" . $vbulletin->options['vietvbbtopstats_excl_groups_listing'] . ")";
}
//trim
$trimthreadtitle = $vbulletin->options['vietvbbtopstats_trim_threadtitles'];
$trimusername = $vbulletin->options['vietvbbtopstats_trim_usernames'];
$trimforumtitles = $vbulletin->options['vietvbbtopstats_trim_forumtitles'];
$vietvbb_afs_bpar = array("<strong>", "</strong>", "<b>", "</b>", "font-weight: bold", "font-weight:bold");
// Number result
switch ($vbulletin->options['vietvbbtopstats_result']) {
示例14: showComments
private static function showComments($nodeid, $userinfo, $pageno,
$perpage, $target_url, $associatedthreadid )
{
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';
global $vbphrase;
global $show;
global $sessionhash;
fetch_phrase_group('posting');
//First let's see if we have forum/thread view permissions. If not,
// we're done
if (! $permissions = self::canViewThread($nodeid, $userinfo))
{
return false;
}
$forumperms = fetch_permissions(self::getForumId($nodeid));
//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 = self::getComments($nodeid, $userinfo, $permissions, $associatedthreadid);
$record_count = count($results);
if (!$results OR !count($results))
{
return '';
}
//If we are passed a postid, we'll display just that comment.
if (vB::$vbulletin->GPC_exists['postid'] AND intval(vB::$vbulletin->GPC['postid'])
AND ($record_count > $perpage) AND in_array(vB::$vbulletin->GPC['postid'], $results))
{
$index = array_search(vB::$vbulletin->GPC['postid'], $results) ;
$pageno = max(1,ceil($index/$perpage));
$first = ($pageno -1) * $perpage;
}
else
{
//we accept the parameter "last" for pageno.
if ($pageno == 'last')
{
$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.
$results = array_slice($results, $first, $perpage, true);
//Now format the overall block.
if (!count($results) OR !$comments = self::renderResult( $userinfo, $results, $permissions,
$forumperms, $target_url, $nodeid)
OR ($comments == ''))
{
return false;
}
if (strpos($target_url,'?') === false)
{
$target_url .= '?';
}
$pagenav = construct_page_nav($pageno, $perpage, $record_count, $target_url, '', 'comments');
$template = vB_Template::create('vbcms_comments_block');
$template->register('comment_count', $record_count );
$template->register('sessionhash', $sessionhash );
$template->register('pagenav', $pagenav);
$template->register('cms_comments', $comments);
$template->register('this_url', $target_url);
$template->register('nodeid', $nodeid);
$template->register('target_url', $target_url);
return $template->render() ;
}
示例15: 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;
//.........这里部分代码省略.........