本文整理汇总了PHP中set_bbarray_cookie函数的典型用法代码示例。如果您正苦于以下问题:PHP set_bbarray_cookie函数的具体用法?PHP set_bbarray_cookie怎么用?PHP set_bbarray_cookie使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_bbarray_cookie函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mark_forum_read
//.........这里部分代码省略.........
{
$lastpostset = true;
require_once(DIR . '/includes/functions_forumlist.php');
cache_ordered_forums(1);
$rawlastpostinfo = $vbulletin->forumcache;
fetch_last_post_array();
}
// determine the read time for all forums that we need to consider
$readtimes = array();
$readtimes_query = $db->query_read_slave("
SELECT forumid, readtime
FROM " . TABLE_PREFIX . "forumread
WHERE userid = $userid
AND forumid IN ($top_foruminfo[childlist])
");
while ($readtime = $db->fetch_array($readtimes_query))
{
$readtimes["$readtime[forumid]"] = $readtime['readtime'];
}
$cutoff = (TIMENOW - ($vbulletin->options['markinglimit'] * 86400));
// now work through the parent, grandparent, etc of the forum we just marked
// and mark it read only if all direct children are marked read
foreach ($parentarray AS $parentid)
{
if (empty($vbulletin->forumcache["$parentid"]))
{
continue;
}
$markread = true;
// now look through all the children and confirm they are all read
if (is_array($vbulletin->iforumcache["$parentid"]))
{
foreach ($vbulletin->iforumcache["$parentid"] AS $childid)
{
if (max($cutoff, $readtimes["$childid"]) < $vbulletin->forumcache["$childid"]['lastpost'])
{
$markread = false;
break;
}
}
}
// if all children are read, make sure all the threads in this forum are read too
if ($markread)
{
$forumread = intval(max($readtimes["$parentid"], $cutoff));
$unread = $db->query_first("
SELECT COUNT(*) AS count
FROM " . TABLE_PREFIX . "thread AS thread
LEFT JOIN " . TABLE_PREFIX . "threadread AS threadread ON (threadread.threadid = thread.threadid AND threadread.userid = $userid)
WHERE thread.forumid = $parentid
AND thread.visible = 1
AND thread.sticky IN (0,1)
AND thread.lastpost > $forumread
AND thread.open <> 10
AND (threadread.threadid IS NULL OR threadread.readtime < thread.lastpost)
");
if ($unread['count'] > 0)
{
$markread = false;
}
}
if ($markread)
{
// can mark as read
$readtimes["$parentid"] = $time;
$parents[] = "($parentid, $userid, $time)";
$forums_marked[] = $parentid;
}
else
{
// can't mark this as read, so we have no need to continue with further generations
break;
}
}
if ($parents)
{
$db->query_write("
REPLACE INTO " . TABLE_PREFIX . "forumread
(forumid, userid, readtime)
VALUES
" . implode(', ', $parents)
);
}
}
}
else
{
set_bbarray_cookie('forum_view', $foruminfo['forumid'], $time);
}
return $forums_marked;
}
示例2: post_save_each
/**
* Updating the votecount for that thread
*
* @param boolean Do the query?
*/
function post_save_each($doquery = true)
{
// Are we handeling a multi DM
if (!$this->condition or $this->existing['vote'] != $this->fetch_field('vote')) {
if ($this->info['thread']) {
$threadinfo =& $this->info['thread'];
} else {
$threadinfo = fetch_threadinfo($this->fetch_field('threadid'));
}
if (!$this->condition) {
// Increment the vote count for the thread that has just been voted on
$threadman =& datamanager_init('Thread', $this->registry, ERRTYPE_SILENT, 'threadpost');
$threadman->set_existing($threadinfo);
$threadman->set('votetotal', "votetotal + " . intval($this->fetch_field('vote')), false);
$threadman->set('votenum', 'votenum + 1', false);
$threadman->save();
} else {
// this is an update
$votediff = $this->fetch_field('vote') - $this->existing['vote'];
$threadman =& datamanager_init('Thread', $this->registry, ERRTYPE_SILENT, 'threadpost');
$threadman->set_existing($threadinfo);
$threadman->set('votetotal', "votetotal + {$votediff}", false);
$threadman->save();
}
if ($this->fetch_field('userid') == $this->registry->userinfo['userid']) {
set_bbarray_cookie('thread_rate', $this->fetch_field('threadid'), $this->fetch_field('vote'), 1);
}
}
($hook = vBulletinHook::fetch_hook('threadratedata_postsave')) ? eval($hook) : false;
}
示例3: gmmktime
$templater->register('userbdays', $userbdays);
$templater->register('userevents', $userevents);
$templater->register('weekday', $weekday);
$templater->register('weekdayname', $weekdayname);
$templater->register('weekmonth', $weekmonth);
$templater->register('weekyear', $weekyear);
$weekbits .= $templater->render();
$lastmonth = $weekmonth;
}
$daystamp = gmmktime(0, 0, 0, $day1['0'], ++$day1['1'], $day1['2']);
}
// Make Nav Bar #####################################################################
$navbits = construct_navbits($navbits);
$navbar = render_navbar_template($navbits);
if ($calview != 'displayweek') {
set_bbarray_cookie('calendar', 'calview' . $calendarinfo['calendarid'], 'displayweek');
}
$calendarjump = construct_calendar_jump($calendarinfo['calendarid'], $vbulletin->GPC['month'], $vbulletin->GPC['year']);
($hook = vBulletinHook::fetch_hook('calendar_displayweek_complete')) ? eval($hook) : false;
$templater = vB_Template::create('calendar_weekly');
$templater->register('calendarinfo', $calendarinfo);
$templater->register('weekbits', $weekbits);
$HTML = $templater->render();
$templater = vB_Template::create('CALENDAR');
$templater->register_page_templates();
$templater->register('calendarid', $calendarid);
$templater->register('calendarinfo', $calendarinfo);
$templater->register('HTML', $HTML);
$templater->register('navbar', $navbar);
$templater->register('spacer_close', $spacer_close);
$templater->register('spacer_open', $spacer_open);
示例4: array
$vbulletin->input->clean_array_gpc('r', array(
'newforumpwd' => TYPE_STR,
'url' => TYPE_STR,
'postvars' => TYPE_BINARY,
));
if ($foruminfo['password'] == $vbulletin->GPC['newforumpwd'])
{
// set a temp cookie for guests
if (!$vbulletin->userinfo['userid'])
{
set_bbarray_cookie('forumpwd', $foruminfo['forumid'], md5($vbulletin->userinfo['userid'] . $vbulletin->GPC['newforumpwd']));
}
else
{
set_bbarray_cookie('forumpwd', $foruminfo['forumid'], md5($vbulletin->userinfo['userid'] . $vbulletin->GPC['newforumpwd']), 1);
}
if ($vbulletin->GPC['url'] == $vbulletin->options['forumhome'] . '.php')
{
$vbulletin->GPC['url'] = fetch_seo_url('forum', $foruminfo);
}
else if ($vbulletin->GPC['url'] != '' AND $vbulletin->GPC['url'] != 'forumdisplay.php')
{
$vbulletin->GPC['url'] = str_replace('"', '', $vbulletin->GPC['url']);
}
else
{
$vbulletin->GPC['url'] = fetch_seo_url('forum', $foruminfo);
}
示例5: exec_sg_mark_as_read
/**
* Marks a discussion or group as read.
*
* @param string $type - 'group' or 'discussion'
* @param int $userid - The id of the user
* @param int $itemid - The id of the item to mark
*/
function exec_sg_mark_as_read($type, $itemid)
{
global $vbulletin;
if ($vbulletin->userinfo['userid']) {
if ($vbulletin->options['threadmarking']) {
$table = TABLE_PREFIX . ($type == 'group' ? 'groupread' : 'discussionread');
$idcol = $type == 'group' ? 'groupid' : 'discussionid';
$vbulletin->db->query_write("REPLACE INTO {$table} (userid,{$idcol},readtime)\n\t\t\t\t\t\t\t\t\t\tVALUES (" . intval($vbulletin->userinfo['userid']) . ", " . intval($itemid) . ", " . TIMENOW . ")");
if ('discussion' == $type and 2 == $vbulletin->options['threadmarking']) {
// quite expensive check to see if there are any unread discussions
if ($discussion = fetch_socialdiscussioninfo($itemid)) {
require_once DIR . '/includes/class_groupmessage.php';
// Create discussion collection
$collection_factory =& new vB_Group_Collection_Factory($vbulletin);
$collection = $collection_factory->create('discussion', $discussion['groupid'], 0, 1, false, true);
$collection->filter_show_read(false);
if (!$collection->fetch_count()) {
exec_sg_mark_as_read('group', $discussion['groupid']);
}
unset($collection, $collection_factory);
}
}
} else {
// set read in cookie
set_bbarray_cookie($type . '_marking', $itemid, TIMENOW);
}
} else {
vbsetcookie('lastvisit', TIMENOW);
}
}
示例6: 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
//.........这里部分代码省略.........
示例7: print_no_permission
print_no_permission();
}
//check if poll is closed
if (!$pollinfo['active'] or !$threadinfo['open'] or $pollinfo['dateline'] + $pollinfo['timeout'] * 86400 < TIMENOW and $pollinfo['timeout'] != 0) {
//poll closed
eval(standard_error(fetch_error('pollclosed')));
}
//check if an option was selected
if (!empty($vbulletin->GPC['optionnumber'])) {
if (!$vbulletin->userinfo['userid']) {
$voted = intval(fetch_bbarray_cookie('poll_voted', $pollid));
if ($voted) {
//the user has voted before
eval(standard_error(fetch_error('useralreadyvote')));
} else {
set_bbarray_cookie('poll_voted', $pollid, 1, 1);
}
} else {
if ($uservoteinfo = $db->query_first("\n\t\t\tSELECT userid\n\t\t\tFROM " . TABLE_PREFIX . "pollvote\n\t\t\tWHERE userid = " . $vbulletin->userinfo['userid'] . "\n\t\t\t\tAND pollid = {$pollid}\n\t\t")) {
//the user has voted before
eval(standard_error(fetch_error('useralreadyvote')));
}
}
$totaloptions = substr_count($pollinfo['options'], '|||') + 1;
//Error checking complete, lets get the options
if ($pollinfo['multiple']) {
$insertsql = '';
$skip_voters = false;
foreach ($vbulletin->GPC['optionnumber'] as $val => $vote) {
$val = intval($val);
if ($vote and $val > 0 and $val <= $totaloptions) {
示例8: vb_number_format
$blog = $db->query_first_slave("\r\n\t\t\tSELECT ratingtotal, ratingnum\r\n\t\t\tFROM " . TABLE_PREFIX . "blog\r\n\t\t\tWHERE blogid = {$bloginfo['blogid']}\r\n\t\t");
if ($blog['ratingnum'] > 0 and $blog['ratingnum'] >= $vbulletin->options['vbblog_ratingpost']) {
// Show Voteavg
$blog['ratingavg'] = vb_number_format($blog['ratingtotal'] / $blog['ratingnum'], 2);
$blog['rating'] = intval(round($blog['ratingtotal'] / $blog['ratingnum']));
$xml->add_tag('voteavg', "<img class=\"inlineimg\" src=\"" . vB_Template_Runtime::fetchStyleVar('imgdir_rating') . "/rating-15_{$blog['rating']}.png\" alt=\"" . construct_phrase($vbphrase['rating_x_votes_y_average'], $blog['ratingnum'], $blog['ratingavg']) . "\" border=\"0\" />");
} else {
$xml->add_tag('voteavg', '');
}
if (!function_exists('fetch_phrase')) {
require_once DIR . '/includes/functions_misc.php';
}
$xml->add_tag('message', fetch_phrase('redirect_blog_rate_add', 'frontredirect', 'redirect_'));
} else {
if (!empty($rating['blogid'])) {
set_bbarray_cookie('blog_rate', $rating['blogid'], $rating['vote'], 1);
}
$xml->add_tag('error', fetch_error('blog_rate_voted'));
}
$xml->close_group();
$xml->print_xml();
}
// ############################### start random blog ###############################
if ($_REQUEST['do'] == 'random') {
$sql = array("state = 'visible'", "dateline <= " . TIMENOW, "blog.pending = 0");
if (!($vbulletin->userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_canviewown'])) {
$sql[] = "blog.userid <> " . $vbulletin->userinfo['userid'];
}
if (!($vbulletin->userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_canviewothers'])) {
$sql[] = "blog.userid = " . $vbulletin->userinfo['userid'];
}
示例9: mark_forums_read
/**
* Marks a forum, its child forums and all contained posts as read
*
* @param integer Forum ID to be marked as read - leave blank to mark all forums as read
*
* @return array Array of affected forum IDs
*/
function mark_forums_read($forumid = false)
{
global $vbulletin;
$db =& $vbulletin->db;
$return_url = $vbulletin->options['forumhome'] . '.php' . $vbulletin->session->vars['sessionurl_q'];
$return_phrase = 'markread';
$return_forumids = array();
if (!$forumid) {
if ($vbulletin->userinfo['userid']) {
// init user data manager
$userdata =& datamanager_init('User', $vbulletin, ERRTYPE_STANDARD);
$userdata->set_existing($vbulletin->userinfo);
$userdata->set('lastactivity', TIMENOW);
$userdata->set('lastvisit', TIMENOW - 1);
$userdata->save();
if ($vbulletin->options['threadmarking']) {
$query = '';
foreach ($vbulletin->forumcache as $fid => $finfo) {
// mark the forum and all child forums read
$query .= ", ({$fid}, " . $vbulletin->userinfo['userid'] . ", " . TIMENOW . ")";
}
if ($query) {
$query = substr($query, 2);
$db->query_write("\n\t\t\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "forumread\n\t\t\t\t\t\t\t(forumid, userid, readtime)\n\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t{$query}\n\t\t\t\t\t");
}
}
} else {
vbsetcookie('lastvisit', TIMENOW);
}
$return_forumids = array_keys($vbulletin->forumcache);
} else {
// temp work around code, I need to find another way to mass set some values to the cookie
$vbulletin->input->clean_gpc('c', COOKIE_PREFIX . 'forum_view', TYPE_STR);
global $bb_cache_forum_view;
$bb_cache_forum_view = @unserialize(convert_bbarray_cookie($vbulletin->GPC[COOKIE_PREFIX . 'forum_view']));
require_once DIR . '/includes/functions_misc.php';
$childforums = fetch_child_forums($forumid, 'ARRAY');
$return_forumids = $childforums;
$return_forumids[] = $forumid;
if ($vbulletin->options['threadmarking'] and $vbulletin->userinfo['userid']) {
$query = "({$forumid}, " . $vbulletin->userinfo['userid'] . ", " . TIMENOW . ")";
foreach ($childforums as $child_forumid) {
// mark the forum and all child forums read
$query .= ", ({$child_forumid}, " . $vbulletin->userinfo['userid'] . ", " . TIMENOW . ")";
}
$db->query_write("\n\t\t\t\tREPLACE INTO " . TABLE_PREFIX . "forumread\n\t\t\t\t\t(forumid, userid, readtime)\n\t\t\t\tVALUES\n\t\t\t\t\t{$query}\n\t\t\t");
require_once DIR . '/includes/functions_bigthree.php';
$foruminfo = fetch_foruminfo($forumid);
$parent_marks = mark_forum_read($foruminfo, $vbulletin->userinfo['userid'], TIMENOW);
if (is_array($parent_marks)) {
$return_forumids = array_unique(array_merge($return_forumids, $parent_marks));
}
} else {
foreach ($childforums as $child_forumid) {
// mark the forum and all child forums read
$bb_cache_forum_view["{$child_forumid}"] = TIMENOW;
}
set_bbarray_cookie('forum_view', $forumid, TIMENOW);
}
if ($vbulletin->forumcache["{$forumid}"]['parentid'] == -1) {
$return_url = $vbulletin->options['forumhome'] . '.php' . $vbulletin->session->vars['sessionurl_q'];
} else {
$return_url = 'forumdisplay.php?' . $vbulletin->session->vars['sessionurl'] . 'f=' . $vbulletin->forumcache["{$forumid}"]['parentid'];
}
$return_phrase = 'markread_single';
}
return array('url' => $return_url, 'phrase' => $return_phrase, 'forumids' => $return_forumids);
}
示例10: mark_project_read
/**
* Marks a issue as read using the appropriate method.
*
* @param integer Project id for the project being marked
* @param string The issue type that is being marked as read
* @param integer Unix timestamp that the project is being marked read
*/
function mark_project_read($projectid, $issuetypeid, $time)
{
global $vbulletin, $db;
$projectid = intval($projectid);
$issuetypeid = $db->escape_string($issuetypeid);
$time = intval($time);
if (!$projectid) {
// sanity check -- wouldn't work anyway
return false;
}
if ($vbulletin->options['threadmarking'] and $vbulletin->userinfo['userid']) {
$db->query_write("\r\n\t\t\tREPLACE INTO " . TABLE_PREFIX . "pt_projectread\r\n\t\t\t\t(projectid, issuetypeid, userid, readtime)\r\n\t\t\tVALUES\r\n\t\t\t\t({$projectid}, '{$issuetypeid}', " . $vbulletin->userinfo['userid'] . ", {$time})\r\n\t\t");
} else {
set_bbarray_cookie('project_lastview', $projectid . $issuetypeid, $time);
}
}
示例11: do_get_forum
function do_get_forum()
{
global $vbulletin, $db, $show, $vbphrase, $foruminfo;
$canpost = true;
$vbulletin->input->clean_array_gpc('r', array('fid' => TYPE_INT, 'previewtype' => TYPE_INT));
$previewtype = $vbulletin->GPC['previewtype'];
if (!$previewtype) {
$previewtype = 1;
}
if (empty($foruminfo['forumid'])) {
$forumid = -1;
} else {
$vbulletin->input->clean_array_gpc('r', array('password' => TYPE_STR));
// Check the forum password
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);
}
}
$perpage = $vbulletin->input->clean_gpc('r', 'perpage', TYPE_UINT);
$pagenumber = $vbulletin->input->clean_gpc('r', 'pagenumber', TYPE_UINT);
$daysprune = $vbulletin->input->clean_gpc('r', 'daysprune', TYPE_INT);
$sortfield = $vbulletin->input->clean_gpc('r', 'sortfield', TYPE_STR);
// get permission to view forum
$_permsgetter_ = 'forumdisplay';
$forumperms = fetch_permissions($foruminfo['forumid']);
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview'])) {
json_error(ERR_NO_PERMISSION);
}
// Check for forum password!
if (!verify_forum_password($foruminfo['forumid'], $foruminfo['password'], false)) {
json_error(ERR_NEED_PASSWORD, RV_NEED_FORUM_PASSWORD);
}
// Can we post in this forum?
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canpostnew'])) {
$canpost = false;
}
$forumid = $foruminfo['forumid'];
}
// Can forum contain threads?
$announcements_out = array();
// These $_REQUEST values will get used in the sort template so they are assigned to normal variables
$perpage = $vbulletin->input->clean_gpc('r', 'perpage', TYPE_UINT);
$pagenumber = $vbulletin->input->clean_gpc('r', 'pagenumber', TYPE_UINT);
$daysprune = $vbulletin->input->clean_gpc('r', 'daysprune', TYPE_INT);
$sortfield = $vbulletin->input->clean_gpc('r', 'sortfield', TYPE_STR);
// get permission to view forum
$_permsgetter_ = 'forumdisplay';
$forumperms = fetch_permissions($foruminfo['forumid']);
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview'])) {
json_error(ERR_NO_PERMISSION);
}
// disable thread preview if we can't view threads
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads'])) {
$vbulletin->options['threadpreview'] = 0;
}
// check if there is a forum password and if so, ensure the user has it set
verify_forum_password($foruminfo['forumid'], $foruminfo['password']);
// verify that we are at the canonical SEO url
// and redirect to this if not
//verify_seo_url('forum', $foruminfo, array('pagenumber' => $_REQUEST['pagenumber']));
// get vbulletin->iforumcache - for use by makeforumjump and forums list
// fetch the forum even if they are invisible since its needed
// for the title but we'll unset that further down
// also fetch subscription info for $show['subscribed'] variable
cache_ordered_forums(1, 1, $vbulletin->userinfo['userid']);
$show['newthreadlink'] = iif(!$show['search_engine'] and $foruminfo['allowposting'], true, false);
$show['threadicons'] = iif($foruminfo['allowicons'], true, false);
$show['threadratings'] = iif($foruminfo['allowratings'], true, false);
$show['subscribed_to_forum'] = $vbulletin->forumcache["{$foruminfo['forumid']}"]['subscribeforumid'] != '' ? true : false;
if (!$daysprune) {
if ($vbulletin->userinfo['daysprune']) {
$daysprune = $vbulletin->userinfo['daysprune'];
} else {
$daysprune = iif($foruminfo['daysprune'], $foruminfo['daysprune'], 30);
}
}
$daysprune = -1;
// FRNR
// ### GET FORUMS, PERMISSIONS, MODERATOR iCACHES ########################
cache_moderators();
// draw nav bar
$navbits = array();
$navbits[$vbulletin->options['forumhome'] . '.php' . $vbulletin->session->vars['sessionurl_q']] = $vbphrase['forum'];
$parentlist = array_reverse(explode(',', substr($foruminfo['parentlist'], 0, -3)));
foreach ($parentlist as $forumID) {
$forumTitle = $vbulletin->forumcache["{$forumID}"]['title'];
$navbits[fetch_seo_url('forum', array('forumid' => $forumID, 'title' => $forumTitle))] = $forumTitle;
}
// pop the last element off the end of the $nav array so that we can show it without a link
array_pop($navbits);
$navbits[''] = $foruminfo['title'];
$navbits = construct_navbits($navbits);
$navbar = render_navbar_template($navbits);
$moderatorslist = '';
$listexploded = explode(',', $foruminfo['parentlist']);
$showmods = array();
//.........这里部分代码省略.........
示例12: actionRate
//.........这里部分代码省略.........
$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();
$update = true;
}
}
}
require_once(DIR . '/includes/class_xml.php');
$xml = new vB_AJAX_XML_Builder(vB::$vbulletin, 'text/xml');
$xml->add_group('threadrating');
if ($update)
{
$node = vB::$db->query_first_slave("
SELECT ratingtotal, ratingnum
FROM " . TABLE_PREFIX . "cms_nodeinfo
WHERE nodeid = $nodeid
");
if ($node['ratingnum'] > 0 AND $node['ratingnum'] >= vB::$vbulletin->options['showvotes'])
{ // Show Voteavg
$node['ratingavg'] = vb_number_format($node['ratingtotal'] / $node['ratingnum'], 2);
$node['rating'] = intval(round($node['ratingtotal'] / $node['ratingnum']));
$xml->add_tag('voteavg', "<img class=\"inlineimg\" src=\"" . vB_Template_Runtime::fetchStyleVar('imgdir_rating') . "/rating-15_$node[rating].png\" alt=\"" . construct_phrase($vbphrase['rating_x_votes_y_average'], $node['ratingnum'], $node['ratingavg']) . "\" border=\"0\" />");
}
else
{
$xml->add_tag('voteavg', '');
}
if (!function_exists('fetch_phrase'))
{
require_once(DIR . '/includes/functions_misc.php');
}
$xml->add_tag('message', fetch_phrase('redirect_blog_rate_add', 'frontredirect', 'redirect_'));
}
else // Already voted error...
{
if (!empty($rating['nodeid']))
{
set_bbarray_cookie('cms_rate', $rating['nodeid'], $rating['vote'], 1);
}
$xml->add_tag('error', fetch_error('blog_rate_voted'));
}
$xml->close_group();
$xml->print_xml();
}
示例13: mark_user_blog_read
/**
* Marks a forum as read using the appropriate method.
*
* @param integer User ID of the blog owner
* @param integer User ID that is being marked read for
* @param integer Unix timestamp that the thread is being marked read
*
* @return array Returns an array of forums that were marked as read
*/
function mark_user_blog_read($bloguserid, $userid, $time)
{
global $vbulletin, $db;
$bloguserid = intval($bloguserid);
$userid = intval($userid);
$time = intval($time);
if (empty($bloguserid))
{
// sanity check -- wouldn't work anyway
return false;
}
if ($vbulletin->options['threadmarking'] AND $userid)
{
$db->query_write("
REPLACE INTO " . TABLE_PREFIX . "blog_userread
(userid, bloguserid, readtime)
VALUES
($userid, $bloguserid, $time)
");
}
else
{
set_bbarray_cookie('blog_userread', $bloguserid, $time);
}
return true;
}
示例14: post_save_each
/**
* Updating the votecount for that thread
*
* @param boolean Do the query?
*/
function post_save_each($doquery = true)
{
// Are we handleing a multi DM
if (!$this->condition OR $this->existing['vote'] != $this->fetch_field('vote'))
{
if ($this->info['blog'])
{
$bloginfo =& $this->info['blog'];
}
else
{
$bloginfo = fetch_bloginfo($this->fetch_field('blogid'));
}
if (!$this->condition)
{
// Increment the vote count for the thread that has just been voted on
$blogman =& datamanager_init('Blog', $this->registry, ERRTYPE_SILENT, 'blog');
$blogman->set_existing($bloginfo);
$blogman->set('ratingtotal', "ratingtotal + " . intval($this->fetch_field('vote')), false);
$blogman->set('ratingnum', 'ratingnum + 1', false);
$blogman->set('rating', 'ratingtotal / ratingnum', false);
$blogman->save();
}
else
{
// this is an update
$votediff = $this->fetch_field('vote') - $this->existing['vote'];
$blogman =& datamanager_init('Blog', $this->registry, ERRTYPE_SILENT, 'blog');
$blogman->set_existing($bloginfo);
$blogman->set('ratingtotal', "ratingtotal + $votediff", false);
$blogman->set('rating', "ratingtotal / ratingnum", false);
$blogman->save();
}
build_blog_user_counters($bloginfo['userid']);
if ($this->fetch_field('userid') == $this->registry->userinfo['userid'])
{
set_bbarray_cookie('blog_rate', $this->fetch_field('blogid'), $this->fetch_field('vote'), 1);
}
}
($hook = vBulletinHook::fetch_hook('blog_ratedata_postsave')) ? eval($hook) : false;
}