本文整理汇总了PHP中fetch_bbarray_cookie函数的典型用法代码示例。如果您正苦于以下问题:PHP fetch_bbarray_cookie函数的具体用法?PHP fetch_bbarray_cookie怎么用?PHP fetch_bbarray_cookie使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fetch_bbarray_cookie函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process_new_subscribed_issues
/**
* Shows the new subscribed PT issues in the user CP
*
* @return string Printable issue bits
*/
function process_new_subscribed_issues()
{
global $vbulletin, $show, $stylevar, $vbphrase, $template_hook, $vbcollapse;
if (!($vbulletin->userinfo['permissions']['ptpermissions'] & $vbulletin->bf_ugp_ptpermissions['canviewprojecttools'])) {
return '';
}
$perms_query = build_issue_permissions_query($vbulletin->userinfo);
if (!$perms_query) {
return '';
}
$marking = ($vbulletin->options['threadmarking'] and $vbulletin->userinfo['userid']);
if ($marking) {
$issueview_sql = "IF(issueread IS NOT NULL, issueread, " . intval(TIMENOW - $vbulletin->options['markinglimit'] * 86400) . ")";
$issueview_sql2 = "IF(projectread IS NOT NULL, projectread, " . intval(TIMENOW - $vbulletin->options['markinglimit'] * 86400) . ")";
} else {
$issueview = max(intval(fetch_bbarray_cookie('issue_lastview', $issue['issueid'])), intval(fetch_bbarray_cookie('issue_lastview', $issue['projectid'] . $issue['issuetypeid'])));
if (!$issueview) {
$issueview = $vbulletin->userinfo['lastvisit'];
}
$issueview_sql = intval($issueview);
$issueview_sql2 = '';
}
build_issue_private_lastpost_sql_all($vbulletin->userinfo, $private_lastpost_join, $private_lastpost_fields);
$replycount_clause = fetch_private_replycount_clause($vbulletin->userinfo);
$subscriptions = $vbulletin->db->query_read("\r\n\t\tSELECT issue.*, issuesubscribe.subscribetype,\r\n\t\t\tproject.title_clean\r\n\t\t\t" . ($marking ? ", issueread.readtime AS issueread, projectread.readtime AS projectread" : '') . "\r\n\t\t\t" . ($private_lastpost_fields ? ", {$private_lastpost_fields}" : '') . "\r\n\t\t\t" . ($replycount_clause ? ", {$replycount_clause} AS replycount" : '') . "\r\n\t\tFROM " . TABLE_PREFIX . "pt_issuesubscribe AS issuesubscribe\r\n\t\tINNER JOIN " . TABLE_PREFIX . "pt_issue AS issue ON (issue.issueid = issuesubscribe.issueid)\r\n\t\tINNER JOIN " . TABLE_PREFIX . "pt_project AS project ON (project.projectid = issue.projectid)\r\n\t\t" . ($marking ? "\r\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "pt_issueread AS issueread ON (issueread.issueid = issue.issueid AND issueread.userid = " . $vbulletin->userinfo['userid'] . ")\r\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "pt_projectread as projectread ON (projectread.projectid = issue.projectid AND projectread.userid = " . $vbulletin->userinfo['userid'] . " AND projectread.issuetypeid = issue.issuetypeid)\r\n\t\t" : '') . "\r\n\t\t{$private_lastpost_join}\r\n\t\tWHERE issuesubscribe.userid = " . $vbulletin->userinfo['userid'] . "\r\n\t\t\tAND (" . implode(' OR ', $perms_query) . ")\r\n\t\tHAVING lastpost > " . intval(TIMENOW - $vbulletin->options['markinglimit'] * 86400) . "\r\n\t\t\tAND lastpost > " . $issueview_sql . "\r\n\t\t\t" . (!empty($issueview_sql2) ? " AND lastpost > " . $issueview_sql2 : '') . "\r\n\t\tORDER BY lastpost DESC\r\n\t");
$show['issuebit_project_title'] = true;
$subscriptionbits = '';
while ($issue = $vbulletin->db->fetch_array($subscriptions)) {
$issue = prepare_issue($issue);
eval('$subscriptionbits .= "' . fetch_template('pt_issuebit') . '";');
}
if (!$subscriptionbits) {
return '';
}
eval('$return = "' . fetch_template('pt_usercp_subscriptions') . '";');
return $return;
}
示例2: eval
} else {
eval(standard_error(fetch_error('invalidid', $idname, $vbulletin->options['contactuslink'])));
}
}
if ($eventinfo['eventid'] and $eventinfo['userid'] != $vbulletin->userinfo['userid'] and !($vbulletin->userinfo['calendarpermissions']["{$eventinfo['calendarid']}"] & $vbulletin->bf_ugp_calendarpermissions['canviewothersevent'])) {
print_no_permission();
}
$calendarinfo = verify_id('calendar', $vbulletin->GPC['calendarid'], 1, 1);
$getoptions = convert_bits_to_array($calendarinfo['options'], $_CALENDAROPTIONS);
$calendarinfo = array_merge($calendarinfo, $getoptions);
$geteaster = convert_bits_to_array($calendarinfo['holidays'], $_CALENDARHOLIDAYS);
$calendarinfo = array_merge($calendarinfo, $geteaster);
$calendarid =& $calendarinfo['calendarid'];
$calview = htmlspecialchars_uni(fetch_bbarray_cookie('calendar', 'calview' . $calendarinfo['calendarid']));
$calmonth = intval(fetch_bbarray_cookie('calendar', 'calmonth'));
$calyear = intval(fetch_bbarray_cookie('calendar', 'calyear'));
$show['neweventlink'] = $vbulletin->userinfo['calendarpermissions'][$calendarid] & $vbulletin->bf_ugp_calendarpermissions['canpostevent'] ? true : false;
if (empty($_REQUEST['do'])) {
$defaultview = !empty($calendarinfo['weekly']) ? 'displayweek' : (!empty($calendarinfo['yearly']) ? 'displayyear' : 'displaymonth');
$_REQUEST['do'] = !empty($calview) ? $calview : $defaultview;
}
if ($vbulletin->GPC['sb']) {
// Allow showbirthdays to be turned on if they are off -- mainly for the birthday link from the front page
$calendarinfo['showbirthdays'] = true;
}
// chande the start of week for invalid values or guests (which are currently forced to 1, Sunday)
if ($vbulletin->userinfo['startofweek'] > 7 or $vbulletin->userinfo['startofweek'] < 1 or $vbulletin->userinfo['userid'] == 0) {
$vbulletin->userinfo['startofweek'] = $calendarinfo['startofweek'];
}
// Make first part of Calendar Nav Bar
$navbits = array('calendar.php' . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['calendar']);
示例3: vB_BbCodeParser
$bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
$pollinfo['question'] = $bbcode_parser->parse(unhtmlspecialchars($pollinfo['question']), $forum['forumid'], true);
$splitoptions = explode('|||', $pollinfo['options']);
$splitoptions = array_map('rtrim', $splitoptions);
$splitvotes = explode('|||', $pollinfo['votes']);
$showresults = 0;
$uservoted = 0;
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canvote'])) {
$nopermission = 1;
}
if (!$pollinfo['active'] or !$thread['open'] or $pollinfo['dateline'] + $pollinfo['timeout'] * 86400 < TIMENOW and $pollinfo['timeout'] != 0 or $nopermission) {
//thread/poll is closed, ie show results no matter what
$showresults = 1;
} else {
//get userid, check if user already voted
$voted = intval(fetch_bbarray_cookie('poll_voted', $pollid));
if ($voted) {
$uservoted = 1;
}
}
($hook = vBulletinHook::fetch_hook('showthread_poll_start')) ? eval($hook) : false;
if ($pollinfo['timeout'] and !$showresults) {
$pollendtime = vbdate($vbulletin->options['timeformat'], $pollinfo['dateline'] + $pollinfo['timeout'] * 86400);
$pollenddate = vbdate($vbulletin->options['dateformat'], $pollinfo['dateline'] + $pollinfo['timeout'] * 86400);
$show['pollenddate'] = true;
} else {
$show['pollenddate'] = false;
}
foreach ($splitvotes as $index => $value) {
$pollinfo['numbervotes'] += $value;
}
示例4: construct_quick_nav
);
construct_quick_nav($navpopup);
/////////////////////////////////
if ($foruminfo['cancontainthreads'])
{
/////////////////////////////////
if ($vbulletin->options['threadmarking'] AND $vbulletin->userinfo['userid'])
{
$foruminfo['forumread'] = $vbulletin->forumcache["$foruminfo[forumid]"]['forumread'];
$lastread = max($foruminfo['forumread'], TIMENOW - ($vbulletin->options['markinglimit'] * 86400));
}
else
{
$bbforumview = intval(fetch_bbarray_cookie('forum_view', $foruminfo['forumid']));
$lastread = max($bbforumview, $vbulletin->userinfo['lastvisit']);
}
// Inline Moderation
$show['movethread'] = (can_moderate($forumid, 'canmanagethreads')) ? true : false;
$show['deletethread'] = (can_moderate($forumid, 'candeleteposts') OR can_moderate($forumid, 'canremoveposts')) ? true : false;
$show['approvethread'] = (can_moderate($forumid, 'canmoderateposts')) ? true : false;
$show['openthread'] = (can_moderate($forumid, 'canopenclose')) ? true : false;
$show['inlinemod'] = ($show['movethread'] OR $show['deletethread'] OR $show['approvethread'] OR $show['openthread']) ? true : false;
$show['spamctrls'] = ($show['inlinemod'] AND $show['deletethread']);
$url = $show['inlinemod'] ? SCRIPTPATH : '';
// fetch popup menu
if ($show['popups'] AND $show['inlinemod'])
{
示例5: prepare_socialgroup
/**
* Takes information regardign a group, and prepares the information within it
* for display
*
* @param array Group Array
* @param bool Whether to fetch group members and avatars
*
* @return array Group Array with prepared information
*
*/
function prepare_socialgroup($group, $fetchmembers = false)
{
global $vbulletin;
if (!is_array($group)) {
return array();
}
if ($fetchmembers) {
$membersinfo = cache_group_members();
$group['membersinfo'] = $membersinfo[$group['groupid']];
}
$group['joindate'] = !empty($group['joindate']) ? vbdate($vbulletin->options['dateformat'], $group['joindate'], true) : '';
$group['createtime'] = !empty($group['createdate']) ? vbdate($vbulletin->options['timeformat'], $group['createdate'], true) : '';
$group['createdate'] = !empty($group['createdate']) ? vbdate($vbulletin->options['dateformat'], $group['createdate'], true) : '';
$group['lastupdatetime'] = !empty($group['lastupdate']) ? vbdate($vbulletin->options['timeformat'], $group['lastupdate'], true) : '';
$group['lastupdatedate'] = !empty($group['lastupdate']) ? vbdate($vbulletin->options['dateformat'], $group['lastupdate'], true) : '';
$group['visible'] = vb_number_format($group['visible']);
$group['moderation'] = vb_number_format($group['moderation']);
$group['members'] = vb_number_format($group['members']);
$group['moderatedmembers'] = vb_number_format($group['moderatedmembers']);
$group['categoryname'] = htmlspecialchars_uni($group['categoryname']);
$group['discussions'] = vb_number_format($group['discussions']);
$group['lastdiscussion'] = fetch_word_wrapped_string(fetch_censored_text($group['lastdiscussion']));
$group['trimdiscussion'] = fetch_trimmed_title($group['lastdiscussion']);
if (!($group['options'] & $vbulletin->bf_misc_socialgroupoptions['enable_group_albums'])) {
// albums disabled in this group - force 0 pictures
$group['picturecount'] = 0;
}
$group['rawpicturecount'] = $group['picturecount'];
$group['picturecount'] = vb_number_format($group['picturecount']);
$group['rawname'] = $group['name'];
$group['rawdescription'] = $group['description'];
$group['name'] = fetch_word_wrapped_string(fetch_censored_text($group['name']));
if ($group['description']) {
$group['shortdescription'] = fetch_word_wrapped_string(fetch_censored_text(fetch_trimmed_title($group['description'], 185)));
} else {
$group['shortdescription'] = $group['name'];
}
$group['mediumdescription'] = fetch_word_wrapped_string(fetch_censored_text(fetch_trimmed_title($group['description'], 1000)));
$group['description'] = nl2br(fetch_word_wrapped_string(fetch_censored_text($group['description'])));
$group['is_owner'] = $group['creatoruserid'] == $vbulletin->userinfo['userid'];
$group['is_automoderated'] = ($group['options'] & $vbulletin->bf_misc_socialgroupoptions['owner_mod_queue'] and $vbulletin->options['sg_allow_owner_mod_queue'] and !$vbulletin->options['social_moderation']);
$group['canviewcontent'] = (!($group['options'] & $vbulletin->bf_misc_socialgroupoptions['join_to_view']) or !$vbulletin->options['sg_allow_join_to_view'] or $group['membertype'] == 'member' or can_moderate(0, 'canmoderategroupmessages') or can_moderate(0, 'canremovegroupmessages') or can_moderate(0, 'candeletegroupmessages') or fetch_socialgroup_perm('canalwayspostmessage') or fetch_socialgroup_perm('canalwascreatediscussion'));
$group['lastpostdate'] = vbdate($vbulletin->options['dateformat'], $group['lastpost'], true);
$group['lastposttime'] = vbdate($vbulletin->options['timeformat'], $group['lastpost']);
$group['lastposterid'] = $group['canviewcontent'] ? $group['lastposterid'] : 0;
$group['lastposter'] = $group['canviewcontent'] ? $group['lastposter'] : '';
// check read marking
//remove notice and make readtime determination a bit more clear
if (!empty($group['readtime'])) {
$readtime = $group['readtime'];
} else {
$readtime = fetch_bbarray_cookie('group_marking', $group['groupid']);
if (!$readtime) {
$readtime = $vbulletin->userinfo['lastvisit'];
}
}
// get thumb url
$group['iconurl'] = fetch_socialgroupicon_url($group, true);
// check if social group is moderated to join
$group['membermoderated'] = 'moderated' == $group['type'];
// posts older than markinglimit days won't be highlighted as new
$oldtime = TIMENOW - $vbulletin->options['markinglimit'] * 24 * 60 * 60;
$readtime = max((int) $readtime, $oldtime);
$group['readtime'] = $readtime;
$group['is_read'] = $readtime >= $group['lastpost'];
// Legacy Hook 'group_prepareinfo' Removed //
return $group;
}
示例6: renderResult
private static function renderResult($userinfo, $post_array, $permissions,
$forumperms, $target_url, $nodeid)
{
if (!count($post_array))
{
return '';
}
require_once DIR . '/includes/functions_bigthree.php' ;
require_once DIR . '/includes/class_postbit.php' ;
fetch_phrase_group('showthread');
fetch_phrase_group('postbit');
global $vbphrase;
global $template_hook;
global $show;
global $thread;
$thread = $thread->get_record();
$threadinfo = verify_id('thread', $thread['threadid'], 1, 1);
$foruminfo = verify_id('forum', $threadinfo['forumid'], 1, 1);
$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();
if (! isset(vB::$vbulletin->userinfo['permissions']['cms']))
{
vBCMS_Permissions::getUserPerms();
}
$postids = ' post.postid in ('
. implode(', ', $post_array) .')';
$posts = vB::$vbulletin->db->query_read($sql = "
SELECT
post.*, post.username AS postusername, post.ipaddress AS ip, IF(post.visible = 2, 1, 0) AS isdeleted,
user.*, userfield.*, usertextfield.*,
" . iif($forum['allowicons'], 'icon.title as icontitle, icon.iconpath,') . "
" . 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,') . "
" . ((can_moderate($thread['forumid'], 'canmoderateposts') OR can_moderate($thread['forumid'], 'candeleteposts')) ? 'spamlog.postid AS spamlog_postid,' : '') . "
" . iif($deljoin, 'deletionlog.userid AS del_userid, deletionlog.username AS del_username, deletionlog.reason AS del_reason,') . "
editlog.userid AS edit_userid, editlog.username AS edit_username, editlog.dateline AS edit_dateline,
editlog.reason AS edit_reason, editlog.hashistory,
postparsed.pagetext_html, postparsed.hasimages,
sigparsed.signatureparsed, sigparsed.hasimages AS sighasimages,
sigpic.userid AS sigpic, sigpic.dateline AS sigpicdateline, sigpic.width AS sigpicwidth, sigpic.height AS sigpicheight,
IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid, infractiongroupid,
customprofilepic.userid AS profilepic, customprofilepic.dateline AS profilepicdateline, customprofilepic.width AS ppwidth, customprofilepic.height AS ppheight
" . iif(!($permissions['genericpermissions'] & vB::$vbulletin->bf_ugp_genericpermissions['canseehiddencustomfields']), vB::$vbulletin->profilefield['hidden']) . "
$hook_query_fields
FROM " . TABLE_PREFIX . "post AS post
LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = post.userid)
LEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON(userfield.userid = user.userid)
LEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON(usertextfield.userid = user.userid)
" . iif($forum['allowicons'], "LEFT JOIN " . TABLE_PREFIX . "icon AS icon ON(icon.iconid = post.iconid)") . "
" . 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)") . "
" . ((can_moderate($thread['forumid'], 'canmoderateposts') OR can_moderate($thread['forumid'], 'candeleteposts')) ? "LEFT JOIN " . TABLE_PREFIX . "spamlog AS spamlog ON(spamlog.postid = post.postid)" : '') . "
$deljoin
LEFT JOIN " . TABLE_PREFIX . "editlog AS editlog ON(editlog.postid = post.postid)
LEFT JOIN " . TABLE_PREFIX . "postparsed AS postparsed ON(postparsed.postid = post.postid AND postparsed.styleid = " . intval(STYLEID) . " AND postparsed.languageid = " . intval(LANGUAGEID) . ")
LEFT JOIN " . TABLE_PREFIX . "sigparsed AS sigparsed ON(sigparsed.userid = user.userid AND sigparsed.styleid = " . intval(STYLEID) . " AND sigparsed.languageid = " . intval(LANGUAGEID) . ")
LEFT JOIN " . TABLE_PREFIX . "sigpic AS sigpic ON(sigpic.userid = post.userid)
LEFT JOIN " . TABLE_PREFIX . "customprofilepic AS customprofilepic ON (user.userid = customprofilepic.userid)
$hook_query_joins
WHERE $postids
ORDER BY post.dateline
");
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 = '';
//.........这里部分代码省略.........
示例7: do_get_poll
function do_get_poll()
{
global $vbulletin, $db, $foruminfo, $threadinfo, $postid, $vbphrase;
if (empty($threadinfo['threadid'])) {
json_error(ERR_INVALID_THREAD);
}
$threadid = $vbulletin->GPC['threadid'];
$counter = 1;
$pollid = $threadinfo['pollid'];
if (!$pollid) {
json_error(ERR_INVALID_THREAD);
}
$forumperms = fetch_permissions($threadinfo['forumid']);
// get poll info
$pollinfo = $db->query_first_slave("\n\tSELECT *\n\tFROM " . TABLE_PREFIX . "poll\n\tWHERE pollid = {$pollid}\n ");
require_once DIR . '/includes/class_bbcode.php';
$bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
$pollinfo['question'] = prepare_utf8_string(strip_tags(remove_bbcode(unhtmlspecialchars($pollinfo['question']), true, true)));
$splitoptions = explode('|||', $pollinfo['options']);
$splitoptions = array_map('rtrim', $splitoptions);
$splitvotes = explode('|||', $pollinfo['votes']);
$showresults = 0;
$uservoted = 0;
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canvote'])) {
$nopermission = 1;
}
if (!$pollinfo['active'] or !$threadinfo['open'] or $pollinfo['dateline'] + $pollinfo['timeout'] * 86400 < TIMENOW and $pollinfo['timeout'] != 0 or $nopermission) {
//thread/poll is closed, ie show results no matter what
$showresults = 1;
} else {
//get userid, check if user already voted
$voted = intval(fetch_bbarray_cookie('poll_voted', $pollid));
if ($voted) {
$uservoted = 1;
}
}
if ($pollinfo['timeout'] and !$showresults) {
$pollendtime = vbdate($vbulletin->options['timeformat'], $pollinfo['dateline'] + $pollinfo['timeout'] * 86400);
$pollenddate = vbdate($vbulletin->options['dateformat'], $pollinfo['dateline'] + $pollinfo['timeout'] * 86400);
$show['pollenddate'] = true;
} else {
$show['pollenddate'] = false;
}
foreach ($splitvotes as $index => $value) {
$pollinfo['numbervotes'] += $value;
}
if ($vbulletin->userinfo['userid'] > 0) {
$pollvotes = $db->query_read_slave("\n\t SELECT voteoption\n\t FROM " . TABLE_PREFIX . "pollvote\n\t WHERE userid = " . $vbulletin->userinfo['userid'] . " AND pollid = {$pollid}\n\t");
if ($db->num_rows($pollvotes) > 0) {
$uservoted = 1;
}
}
if ($showresults or $uservoted) {
if ($uservoted) {
$uservote = array();
while ($pollvote = $db->fetch_array($pollvotes)) {
$uservote["{$pollvote['voteoption']}"] = 1;
}
}
}
$options = array();
foreach ($splitvotes as $index => $value) {
$arrayindex = $index + 1;
if ($value <= 0) {
$percent = 0;
} else {
$percent = vb_number_format($value < $pollinfo['numbervotes'] ? $value / $pollinfo['numbervotes'] * 100 : 100, 0);
}
$options[] = array('voted' => iif($uservote["{$arrayindex}"], true, false), 'percent' => $percent, 'title' => prepare_utf8_string(strip_tags(remove_bbcode(unhtmlspecialchars($splitoptions["{$index}"]), true, true)) . $titleadd), 'votes' => $value);
}
// Phrase parts below
if ($nopermission) {
$pollstatus = $vbphrase['you_may_not_vote_on_this_poll'];
} else {
if ($showresults) {
$pollstatus = $vbphrase['this_poll_is_closed'];
} else {
if ($uservoted) {
$pollstatus = $vbphrase['you_have_already_voted_on_this_poll'];
}
}
}
$out = array('title' => prepare_utf8_string($pollinfo['question']), 'pollstatus' => prepare_utf8_string($pollstatus), 'options' => $options, 'total' => $pollinfo['numbervotes'], 'canvote' => !$nopermission && !$uservoted);
if ($pollinfo['multiple']) {
$out['multiple'] = true;
}
return $out;
}
示例8: do_get_forum_data
function do_get_forum_data()
{
global $vbulletin, $db, $show, $vbphrase;
$vbulletin->input->clean_array_gpc('r', array('forumids' => TYPE_STR));
if (!$vbulletin->GPC['forumids'] || strlen($vbulletin->GPC['forumids']) == 0) {
return array('forums' => array());
}
cache_ordered_forums(1, 1);
$forumids = split(',', $vbulletin->GPC['forumids']);
$forum_data = array();
foreach ($forumids as $forumid) {
$foruminfo = fetch_foruminfo($forumid);
$type = 'old';
if (is_array($foruminfo) and !empty($foruminfo['link'])) {
// see if it is a redirect
$type = 'link';
} else {
if ($vbulletin->userinfo['lastvisitdate'] == -1) {
$type = 'new';
} else {
if ($vbulletin->options['threadmarking'] and $vbulletin->userinfo['userid']) {
$userlastvisit = !empty($foruminfo['forumread']) ? $foruminfo['forumread'] : TIMENOW - $vbulletin->options['markinglimit'] * 86400;
} else {
$forumview = intval(fetch_bbarray_cookie('forum_view', $foruminfo['forumid']));
//use which one produces the highest value, most likely cookie
$userlastvisit = $forumview > $vbulletin->userinfo['lastvisit'] ? $forumview : $vbulletin->userinfo['lastvisit'];
}
if ($foruminfo['lastpost'] and $userlastvisit < $foruminfo['lastpost']) {
$type = 'new';
} else {
$type = 'old';
}
}
}
// If this forum has a password, check to see if we have
// the proper cookie. If so, don't prompt for one
$password = false;
if ($foruminfo['password']) {
$pw_ok = verify_forum_password($foruminfo['forumid'], $foruminfo['password'], false);
if (!$pw_ok) {
$password = true;
}
}
$out = array('id' => $foruminfo['forumid'], 'new' => $type == 'new' ? true : false, 'name' => prepare_utf8_string(strip_tags($foruminfo['title'])), 'password' => $password);
$icon = fr_get_forum_icon($foruminfo['forumid'], $foruminfo == 'new');
if ($icon) {
$out['icon'] = $icon;
}
if ($foruminfo['link'] != '') {
$link = fr_fix_url($foruminfo['link']);
if (is_int($link)) {
$out['id'] = $link;
} else {
$out['link'] = $link;
}
$linkicon = fr_get_forum_icon($foruminfo['forumid'], false, true);
if ($linkicon) {
$out['icon'] = $linkicon;
}
}
if ($foruminfo['description'] != '') {
$desc = prepare_utf8_string(strip_tags($foruminfo['description']));
if (strlen($desc) > 0) {
$out['desc'] = $desc;
}
}
$forum_data[] = $out;
}
return array('forums' => $forum_data);
}
示例9: process_post_preview
}
// ### PREVIEW POST ###
$postpreview = process_post_preview($newpost, 0, $postattach);
$_REQUEST['do'] = 'newreply';
$newpost['message'] = htmlspecialchars_uni($newpost['message']);
}
else
{
if ($vbulletin->options['threadmarking'] AND $vbulletin->userinfo['userid'])
{
$threadview = max($threadinfo['threadread'], $threadinfo['forumread'], TIMENOW - ($vbulletin->options['markinglimit'] * 86400));
}
else
{
$threadview = intval(fetch_bbarray_cookie('thread_lastview', $thread['threadid']));
if (!$threadview)
{
$threadview = $vbulletin->userinfo['lastvisit'];
}
}
// ### NOT PREVIEW - ACTUAL POST ###
if ($vbulletin->GPC['ajax'])
{
// #############################################################################
// #############################################################################
// #############################################################################
require_once(DIR . '/includes/class_postbit.php');
require_once(DIR . '/includes/functions_bigthree.php');
require_once(DIR . '/includes/class_xml.php');
示例10: process_display
/**
* Sets up different display variables for the Group Message
*
* @access protected
*/
function process_display()
{
global $show, $vbphrase;
$this->item['canview'] = ($this->item['state'] == 'visible' or $this->item['state'] == 'deleted' and fetch_socialgroup_modperm('canundeletediscussions', $this->group) or $this->item['state'] == 'moderation' and fetch_socialgroup_modperm('canmoderatediscussions', $this->group));
// Simplify moderation for templating
if (fetch_socialgroup_modperm('canmoderategroupmessages', $this->group)) {
$this->item['moderated_replies'] = ($this->item['moderation'] > 1 or $this->item['state'] != 'moderation' and $this->item['moderation'] == 1);
} else {
$this->item['moderated_replies'] = 0;
}
$this->item['moderated'] = $this->item['state'] == 'moderation';
// Show inline selection tools
if ($this->show_moderation_tools and !$this->force_inline_selection) {
$this->item['inlinemod'] = ($this->item['state'] != 'deleted' and fetch_socialgroup_modperm('canmoderatediscussions', $this->group) or fetch_socialgroup_modperm('canundeletediscussions', $this->group) or fetch_socialgroup_modperm('canremovediscussions', $this->group));
$show['inlinemod'] = ($show['inlinemod'] or $this->item['inlinemod']);
} else {
$show['inlinemod'] = $this->item['inlinemod'] = $this->force_inline_selection;
}
// Show edit links
$this->item['edit'] = ($this->show_moderation_tools and can_edit_group_discussion($this->item, $this->group));
$show['edit'] = $this->item['edit'];
if ($this->check_read) {
if (!$this->item['is_read']) {
if (!$this->item['readtime']) {
$this->item['readtime'] = 0;
// no database marking, check cookie
if (!$this->registry->options['threadmarking'] or !$this->registry->userinfo['userid']) {
$this->item['readtime'] = max(fetch_bbarray_cookie('discussion_marking', $this->item['discussionid']), $this->registry->userinfo['lastvisit']);
}
}
// posts older than markinglimit days won't be highlighted as new
$oldtime = TIMENOW - $this->registry->options['markinglimit'] * 24 * 60 * 60;
$this->item['readtime'] = max($this->group['readtime'], $this->item['readtime'], $oldtime);
$this->item['is_read'] = $this->item['readtime'] > $this->item['lastpost'];
$this->item['goto_readtime'] = array('goto' => $this->item['readtime']);
}
} else {
$this->item['is_read'] = true;
}
$this->item['readstate'] = $this->item['is_read'] ? 'old' : 'new';
$this->item['replies'] = max(0, $this->item['visible'] - 1);
if ($this->show_subscription) {
$this->item['showsubsinfo'] = $this->show_subscription;
$this->item['notification'] = $this->item['emailupdate'] ? $vbphrase['instant'] : $vbphrase['none'];
} else {
$this->item['showsubsinfo'] = false;
$this->item['notification'] = "";
}
}
示例11: array
{
cache_ordered_forums(1);
$colspan = 5;
$show['threadicons'] = false;
// get last read info for each thread
$lastread = array();
foreach (array_keys($forumids) AS $forumid)
{
if ($vbulletin->options['threadmarking'])
{
$lastread["$forumid"] = max($vbulletin->forumcache["$forumid"]['forumread'], TIMENOW - ($vbulletin->options['markinglimit'] * 86400));
}
else
{
$lastread["$forumid"] = max(intval(fetch_bbarray_cookie('forum_view', $forumid)), $vbulletin->userinfo['lastvisit']);
}
if ($vbulletin->forumcache["$forumid"]['options'] & $vbulletin->bf_misc_forumoptions['allowicons'])
{
$show['threadicons'] = true;
$colspan = 6;
}
}
// get thread preview?
if ($vbulletin->options['threadpreview'] > 0)
{
$previewfield = 'post.pagetext AS preview,';
$previewjoin = "LEFT JOIN " . TABLE_PREFIX . "post AS post ON(post.postid = thread.firstpostid)";
}
else
示例12: actionRate
/**
* Rate a node (ajax only)
*
* @return string
*/
public function actionRate()
{
global $bootstrap;
$nodeid = intval($this->node->getNodeId());
// Load the style
$bootstrap->force_styleid($this->node->getStyleId());
$bootstrap->load_style();
vB::$vbulletin->input->clean_array_gpc('r', array(
'vote' => vB_Input::TYPE_UINT
));
$vote = vB::$vbulletin->GPC['vote'];
if ($vote < 0 OR $vote > 5)
{
die;
}
$rated = intval(fetch_bbarray_cookie('cms_rate', $nodeid));
$update = false;
if (vB::$vbulletin->userinfo['userid'])
{
if ($rating = vB::$db->query_first("
SELECT *
FROM " . TABLE_PREFIX . "cms_rate
WHERE userid = " . vB::$vbulletin->userinfo['userid'] . "
AND nodeid = $nodeid
"))
{
if (vB::$vbulletin->options['votechange'])
{
if ($vote != $rating['vote'])
{
$rateitem = new vBCms_Item_Rate($rating['rateid']);
$ratedm = new vBCms_DM_Rate($rateitem);
$ratedm->set('nodeid', $nodeid);
$ratedm->set('userid', vB::$vbulletin->userinfo['userid']);
$ratedm->set('vote', intval($vote));
$ratedm->save();
}
$update = true;
}
}
else
{
$ratedm = new vBCms_DM_Rate();
$ratedm->set('nodeid', $nodeid);
$ratedm->set('userid', vB::$vbulletin->userinfo['userid']);
$ratedm->set('vote', intval($vote));
$ratedm->save();
$update = true;
}
}
else
{
// Check for cookie on user's computer for this blogid
if ($rated AND !vB::$vbulletin->options['votechange'])
{
}
else
{
// Check for entry in Database for this Ip Addr/blogid
if ($rating = vB::$db->query_first("
SELECT *
FROM " . TABLE_PREFIX . "cms_rate
WHERE ipaddress = '" . vB::$db->escape_string(IPADDRESS) . "'
AND nodeid = $nodeid
"))
{
if (vB::$vbulletin->options['votechange'])
{
if ($vote != $rating['vote'])
{
$rateitem = new vBCms_Item_Rate($rating['rateid']);
$ratedm = new vBCms_DM_Rate($rateitem);
$ratedm->set('nodeid', $nodeid);
$ratedm->set('vote', intval($vote));
$ratedm->save();
}
$update = true;
}
}
else
{
$ratedm = new vBCms_DM_Rate();
$ratedm->set('nodeid', $nodeid);
$ratedm->set('userid', 0);
$ratedm->set('vote', intval($vote));
$ratedm->save();
//.........这里部分代码省略.........
示例13: verify_forum_password
/**
* Returns whether or not the visiting user can view the specified password-protected forum
*
* @param integer Forum ID
* @param string Provided password
* @param boolean If true, show error when access is denied
*
* @return boolean
*/
function verify_forum_password($forumid, $password, $showerror = true)
{
global $vbulletin;
if (!$password or $vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel'] or $vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['ismoderator'] or can_moderate($forumid)) {
return true;
}
$foruminfo = fetch_foruminfo($forumid);
$parents = explode(',', $foruminfo['parentlist']);
if (!VB_API) {
foreach ($parents as $fid) {
// get the pwd from any parent forums -- allows pwd cookies to cascade down
if ($temp = fetch_bbarray_cookie('forumpwd', $fid) and $temp === md5($vbulletin->userinfo['userid'] . $password)) {
return true;
}
}
} else {
$forumpwdmd5 = $vbulletin->input->clean_gpc('r', 'forumpwdmd5', TYPE_STR);
if ($forumpwdmd5 === md5($vbulletin->userinfo['userid'] . $password)) {
return true;
}
}
// didn't match the password in any cookie
if ($showerror) {
require_once DIR . '/includes/functions_misc.php';
$security_token_html = '<input type="hidden" name="securitytoken" value="' . $vbulletin->userinfo['securitytoken'] . '" />';
// forum password is bad - show error
//use the basic link here. I'm not sure how the advanced link will play with the postvars in the form.
require_once DIR . '/includes/class_friendly_url.php';
$forumlink = vB_Friendly_Url::fetchLibrary($vbulletin, 'forum|nosession', $foruminfo, array('do' => 'doenterpwd'));
$forumlink = $forumlink->get_url(FRIENDLY_URL_OFF);
// TODO convert the 'forumpasswordmissoing' phrase to vB4
eval(standard_error(fetch_error('forumpasswordmissing', $vbulletin->session->vars['sessionhash'], $vbulletin->scriptpath, $forumid, construct_post_vars_html() . $security_token_html, 10, 1, $forumlink)));
} else {
// forum password is bad - return false
return false;
}
}
示例14: get_last_read_by_current_user
/**
* Does this forum allow icons
*
* @return boolean
*/
public function get_last_read_by_current_user($user)
{
global $vbulletin;
if ($vbulletin->options['threadmarking'] and !$user->isGuest()) {
//deal with the fact that the forum cache (from which we likely loaded this object)
//doesn't have the forumread field.
//we should consider a query to just look the value up for this forum -- it will likely
//be faster in actual use and will almost certainly be simpler
if (!$this->has_field('forumread')) {
if (array_key_exists('forumread', $vbulletin->forumcache[$this->get_field('forumid')])) {
$this->set_field('forumread', $vbulletin->forumcache[$this->get_field('forumid')]['forumread']);
} else {
//if we don't have forum read in the cache, then reload the cache.
//this implicitly references the current
cache_ordered_forums(1);
$this->set_field('forumread', $vbulletin->forumcache[$this->get_field('forumid')]['forumread']);
}
}
return max($this->get_field('forumread'), TIMENOW - $vbulletin->options['markinglimit'] * 86400);
} else {
$forumview = intval(fetch_bbarray_cookie('forum_view', $this->get_field('forumid')));
//use which one produces the highest value, most likely cookie
return $forumview > $vbulletin->userinfo['lastvisit'] ? $forumview : $vbulletin->userinfo['lastvisit'];
}
}
示例15: array
// ######################## START MAIN SCRIPT ############################
// #######################################################################
$vbulletin->input->clean_array_gpc('p', array('vote' => TYPE_UINT, 'pagenumber' => TYPE_UINT, 'perpage' => TYPE_UINT, 'ajax' => TYPE_BOOL));
if ($vbulletin->GPC['vote'] < 1 or $vbulletin->GPC['vote'] > 5) {
eval(standard_error(fetch_error('invalidvote')));
}
if (!$threadinfo['threadid'] or !$threadinfo['visible'] and !can_moderate($threadinfo['forumid'], 'canmoderateposts') or !$threadinfo['open'] and !can_moderate($threadinfo['forumid'], 'canopenclose') or $threadinfo['isdeleted'] and !can_moderate($threadinfo['forumid'], 'candeleteposts')) {
eval(standard_error(fetch_error('threadrateclosed')));
}
$forumperms = fetch_permissions($threadinfo['forumid']);
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canthreadrate']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) and $threadinfo['postuserid'] != $vbulletin->userinfo['userid']) {
print_no_permission();
}
// check if there is a forum password and if so, ensure the user has it set
verify_forum_password($foruminfo['forumid'], $foruminfo['password']);
$rated = intval(fetch_bbarray_cookie('thread_rate', $threadinfo['threadid']));
($hook = vBulletinHook::fetch_hook('threadrate_start')) ? eval($hook) : false;
$update = false;
if ($vbulletin->userinfo['userid']) {
if ($rating = $db->query_first("\n\t\tSELECT *\n\t\tFROM " . TABLE_PREFIX . "threadrate\n\t\tWHERE userid = " . $vbulletin->userinfo['userid'] . "\n\t\t\tAND threadid = {$threadinfo['threadid']}\n\t")) {
if ($vbulletin->options['votechange']) {
if ($vbulletin->GPC['vote'] != $rating['vote']) {
$threadrate =& datamanager_init('ThreadRate', $vbulletin, ERRTYPE_STANDARD);
$threadrate->set_info('thread', $threadinfo);
$threadrate->set_existing($rating);
$threadrate->set('vote', $vbulletin->GPC['vote']);
($hook = vBulletinHook::fetch_hook('threadrate_update')) ? eval($hook) : false;
$threadrate->save();
}
$update = true;
if (!$vbulletin->GPC['ajax']) {