本文整理汇总了PHP中cache_ordered_forums函数的典型用法代码示例。如果您正苦于以下问题:PHP cache_ordered_forums函数的具体用法?PHP cache_ordered_forums怎么用?PHP cache_ordered_forums使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cache_ordered_forums函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetch_subforum_list
function fetch_subforum_list($parentid = -1)
{
global $vbulletin;
cache_ordered_forums(1);
// 1 means: also cache thread/reply counts
$result = array();
if (!isset($vbulletin->iforumcache["{$parentid}"])) {
return $result;
}
foreach ($vbulletin->iforumcache["{$parentid}"] as $forumid) {
$forum = $vbulletin->forumcache["{$forumid}"];
$forumperms = $vbulletin->userinfo['forumpermissions']["{$forumid}"];
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) and ($vbulletin->forumcache["{$forumid}"]['showprivate'] == 1 or !$vbulletin->forumcache["{$forumid}"]['showprivate'] and !$vbulletin->options['showprivateforums'])) {
// no permission to view current forum
continue;
}
if (!$forum['displayorder'] or !($forum['options'] & $vbulletin->bf_misc_forumoptions['active'])) {
// forum not active
continue;
}
// get on/off status
//$lastpostinfo = $vbulletin->forumcache["$lastpostarray[$forumid]"];
//$forum['statusicon'] = fetch_forum_lightbulb($forumid, $lastpostinfo, $forum);
//$show['newposticon'] = ($forum['statusicon'] ? true : false);
$result[] = array('id' => $forum['forumid'], 'title' => str($forum['title'], true), 'description' => str($forum['description'], true), 'threadcount' => intval($forum['threadcount']), 'replycount' => intval($forum['replycount']));
}
return $result;
}
示例2: get_avaliable_group_list
/**
* Get available groups
*
* @global vB_Registry $vbulletin
* @param array $member_group_id_list
* @return array
*/
public function get_avaliable_group_list($member_group_id_list)
{
$active_groups = $this->get_groups_list(true);
global $vbulletin;
if (empty($active_groups)) {
return $active_groups;
}
require_once DIR . '/includes/functions.php';
cache_ordered_forums();
$forum_permissions = array();
foreach (array_keys($vbulletin->forumcache) as $forumid) {
if (!isset($forum_permissions[$forumid])) {
$forum_permissions[$forumid] = 0;
}
foreach ($member_group_id_list as $user_group_id) {
$forum_permissions[$forumid] |= $vbulletin->forumcache[$forumid]['permissions'][$user_group_id];
}
}
$forum_id_list = array();
// Get forums that allow canview access
foreach ($forum_permissions as $forumid => $perm) {
if ($perm & $vbulletin->bf_ugp_forumpermissions['canview'] and $perm & $vbulletin->bf_ugp_forumpermissions['canviewthreads'] and $perm & $vbulletin->bf_ugp_forumpermissions['cangetattachment']) {
$forum_id_list[$forumid] = $forumid;
}
}
foreach ($active_groups as $nntpid => &$group) {
if (isset($forum_id_list[$group['map_id']])) {
$group['available'] = true;
}
}
return $active_groups;
}
示例3: output
public function output()
{
global $vbulletin;
require_once DIR . '/includes/functions_forumlist.php';
if (empty($vbulletin->iforumcache)) {
cache_ordered_forums(1, 1);
}
return $this->getforumlist(-1);
}
示例4: construct_move_forums_options
/**
* Constructs a Forum Jump Menu for use when moving an item to a new forum
*
* @param integer The "Root" ID from which to generate this Menu
* @param integer A Forum ID to "exclude" from the menu
* @param integer If 1, removes all previous information from the Forum Jump Menu
* @param string Characters to prepend to the items in the Jump Box
*
* @return string The generated forum jump menu
*
*/
function construct_move_forums_options($parentid = -1, $excludeforumid = NULL, $addbox = 1, $prependchars = '')
{
global $vbulletin, $optionselected, $jumpforumid, $jumpforumtitle, $jumpforumbits, $vbphrase, $curforumid;
if (empty($vbulletin->iforumcache)) {
// get the vbulletin->iforumcache, as we use it all over the place, not just for forumjump
cache_ordered_forums(0, 1);
}
if (empty($vbulletin->iforumcache["{$parentid}"]) or !is_array($vbulletin->iforumcache["{$parentid}"])) {
return;
}
if ($addbox == 1) {
$jumpforumbits = array();
}
foreach ($vbulletin->iforumcache["{$parentid}"] as $forumid) {
$forumperms =& $vbulletin->userinfo['forumpermissions']["{$forumid}"];
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview'])) {
continue;
} else {
// set $forum from the $vbulletin->forumcache
$forum = $vbulletin->forumcache["{$forumid}"];
$optionvalue = $forumid;
$optiontitle = $prependchars . $forum[title];
if ($forum['link']) {
$optiontitle .= " ({$vbphrase['link']})";
} else {
if (!($forum['options'] & $vbulletin->bf_misc_forumoptions['cancontainthreads'])) {
$optiontitle .= " ({$vbphrase['category']})";
} else {
if (!($forum['options'] & $vbulletin->bf_misc_forumoptions['allowposting'])) {
$optiontitle .= " ({$vbphrase['no_posting']})";
}
}
}
$optionclass = 'd' . iif($forum['depth'] > 3, 3, $forum['depth']);
if ($curforumid == $optionvalue) {
$optionselected = ' ' . 'selected="selected"';
$optionclass .= ' fjsel';
$selectedone = 1;
} else {
$optionselected = '';
}
if ($excludeforumid == NULL or $excludeforumid != $forumid) {
$jumpforumbits[$forumid] = array('optiontitle' => $optiontitle, 'optionvalue' => $optionvalue, 'optionselected' => $optionselected, 'optionclass' => $optionclass);
}
construct_move_forums_options($optionvalue, $excludeforumid, 0, $prependchars ? $prependchars . ' ' : ' ');
}
// if can view
}
// end foreach ($vbulletin->iforumcache[$parentid] AS $forumid)
return $jumpforumbits;
}
示例5: print_no_permission
print_no_permission();
}
if (empty($_REQUEST['action'])) {
if (empty($_REQUEST['do'])) {
$_REQUEST['do'] = 'list';
}
}
// ###########################################################################
// ############################### LIST FORUMS ###############################
// ###########################################################################
if ($_REQUEST['do'] == "list") {
if (!$vbulletin->userinfo['userid']) {
print_no_permission();
}
// get all forums
cache_ordered_forums(1, 0);
$show['forums'] = true;
$showallinstant = 0;
//generate the radio button form
foreach ($vbulletin->forumcache as $forumid => $forum) {
if (!$forum['link']) {
$showinstant = 0;
//get full forum info
$forum = fetch_foruminfo($forum["forumid"], false);
//if the user has permission to view the given forum, and if forum is postable...
if ($perms = fetch_permissions($forum["forumid"]) and $perms & $vbulletin->bf_ugp_forumpermissions["canview"] and $forum["cancontainthreads"] and $forum["displayorder"] > 0 and $forum["options"] & $vbulletin->bf_misc_forumoptions['active']) {
//get the level of the subscription for the given forum
$sub_level = $db->query_first("\r\n\t\t\t\t\tSELECT emailupdate\r\n\t\t\t\t\tFROM " . TABLE_PREFIX . "subscribeforum\r\n\t\t\t\t\tWHERE forumid = '" . $forum["forumid"] . "' AND userid = " . $vbulletin->userinfo['userid'] . " LIMIT 1\r\n\t\t\t\t");
$usergroupids = explode(",", $forum["ei_usergroups"]);
//if the user hits the set all none or set all instant buttons...
if ($_REQUEST["setall"] == "none") {
示例6: do_post_edit
function do_post_edit()
{
global $vbulletin, $db, $foruminfo, $forumperms, $threadinfo;
global $postinfo, $vbphrase, $stylevar, $permissions;
$checked = array();
$edit = array();
$postattach = array();
$contenttype = 'vBForum_Post';
if (!$postinfo['postid'] or $postinfo['isdeleted'] or !$postinfo['visible'] and !can_moderate($threadinfo['forumid'], 'canmoderateposts')) {
json_error(ERR_INVALID_TOP, RV_POST_ERROR);
}
if (!$threadinfo['threadid'] or $threadinfo['isdeleted'] or !$threadinfo['visible'] and !can_moderate($threadinfo['forumid'], 'canmoderateposts')) {
json_error(ERR_INVALID_TOP, RV_POST_ERROR);
}
if ($vbulletin->options['wordwrap']) {
$threadinfo['title'] = fetch_word_wrapped_string($threadinfo['title']);
}
// get permissions info
$_permsgetter_ = 'edit post';
$forumperms = fetch_permissions($threadinfo['forumid']);
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) and ($threadinfo['postuserid'] != $vbulletin->userinfo['userid'] or $vbulletin->userinfo['userid'] == 0)) {
json_error(ERR_NO_PERMISSION, RV_POST_ERROR);
}
$foruminfo = fetch_foruminfo($threadinfo['forumid'], false);
// check if there is a forum password and if so, ensure the user has it set
verify_forum_password($foruminfo['forumid'], $foruminfo['password']);
// need to get last post-type information
cache_ordered_forums(1);
// determine if we are allowed to be updating the thread's info
$can_update_thread = ($threadinfo['firstpostid'] == $postinfo['postid'] and (can_moderate($threadinfo['forumid'], 'caneditthreads') or $postinfo['dateline'] + $vbulletin->options['editthreadtitlelimit'] * 60 > TIMENOW));
// otherwise, post is being edited
if (!can_moderate($threadinfo['forumid'], 'caneditposts')) {
// check for moderator
if (!$threadinfo['open']) {
$vbulletin->url = 'showthread.php?' . $vbulletin->session->vars['sessionurl'] . "t={$threadinfo['threadid']}";
json_error(fetch_error('threadclosed'), RV_POST_ERROR);
}
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['caneditpost'])) {
json_error(ERR_NO_PERMISSION, RV_POST_ERROR);
} else {
if ($vbulletin->userinfo['userid'] != $postinfo['userid']) {
// check user owns this post
json_error(ERR_NO_PERMISSION, RV_POST_ERROR);
} else {
// check for time limits
if ($postinfo['dateline'] < TIMENOW - $vbulletin->options['edittimelimit'] * 60 and $vbulletin->options['edittimelimit'] != 0) {
json_error(fetch_error('edittimelimit', $vbulletin->options['edittimelimit'], $vbulletin->options['contactuslink']), RV_POST_ERROR);
}
}
}
}
// Variables reused in templates
$poststarttime =& $vbulletin->input->clean_gpc('r', poststarttime, TYPE_UINT);
$posthash = md5($vbulletin->GPC['poststarttime'] . $vbulletin->userinfo['userid'] . $vbulletin->userinfo['salt']);
$vbulletin->input->clean_array_gpc('p', array('stickunstick' => TYPE_BOOL, 'openclose' => TYPE_BOOL, 'wysiwyg' => TYPE_BOOL, 'message' => TYPE_STR, 'title' => TYPE_STR, 'prefixid' => TYPE_NOHTML, 'iconid' => TYPE_UINT, 'parseurl' => TYPE_BOOL, 'signature' => TYPE_BOOL, 'disablesmilies' => TYPE_BOOL, 'reason' => TYPE_NOHTML, 'preview' => TYPE_STR, 'folderid' => TYPE_UINT, 'emailupdate' => TYPE_UINT, 'ajax' => TYPE_BOOL, 'advanced' => TYPE_BOOL, 'postcount' => TYPE_UINT, 'podcasturl' => TYPE_STR, 'podcastsize' => TYPE_UINT, 'podcastexplicit' => TYPE_BOOL, 'podcastkeywords' => TYPE_STR, 'podcastsubtitle' => TYPE_STR, 'podcastauthor' => TYPE_STR, 'quickeditnoajax' => TYPE_BOOL));
if ($vbulletin->GPC['message']) {
$vbulletin->GPC['message'] = prepare_remote_utf8_string($vbulletin->GPC['message']);
}
$vbulletin->GPC['signature'] = $vbulletin->GPC_exists['signature'] = true;
// Make sure the posthash is valid
($hook = vBulletinHook::fetch_hook('editpost_update_start')) ? eval($hook) : false;
if (md5($poststarttime . $vbulletin->userinfo['userid'] . $vbulletin->userinfo['salt']) != $posthash) {
$posthash = 'invalid posthash';
// don't phrase me
}
// ### PREP INPUT ###
if ($vbulletin->GPC['wysiwyg']) {
require_once DIR . '/includes/functions_wysiwyg.php';
$edit['message'] = convert_wysiwyg_html_to_bbcode($vbulletin->GPC['message'], $foruminfo['allowhtml']);
} else {
$edit['message'] =& $vbulletin->GPC['message'];
}
$cansubscribe = true;
// Are we editing someone else's post? If so load that users subscription info for this thread.
if ($vbulletin->userinfo['userid'] != $postinfo['userid']) {
if ($postinfo['userid']) {
$userinfo = fetch_userinfo($postinfo['userid']);
cache_permissions($userinfo);
}
$cansubscribe = ($userinfo['forumpermissions']["{$foruminfo['forumid']}"] & $vbulletin->bf_ugp_forumpermissions['canview'] and $userinfo['forumpermissions']["{$foruminfo['forumid']}"] & $vbulletin->bf_ugp_forumpermissions['canviewthreads'] and ($threadinfo['postuserid'] == $userinfo['userid'] or $userinfo['forumpermissions']["{$foruminfo['forumid']}"] & $vbulletin->bf_ugp_forumpermissions['canviewothers']));
if ($cansubscribe and $otherthreadinfo = $db->query_first_slave("\n\t\t\tSELECT emailupdate, folderid\n\t\t\tFROM " . TABLE_PREFIX . "subscribethread\n\t\t\tWHERE threadid = {$threadinfo['threadid']} AND\n\t\t\t\tuserid = {$postinfo['userid']} AND\n\t\t\t\tcanview = 1")) {
$threadinfo['issubscribed'] = true;
$threadinfo['emailupdate'] = $otherthreadinfo['emailupdate'];
$threadinfo['folderid'] = $otherthreadinfo['folderid'];
} else {
$threadinfo['issubscribed'] = false;
// use whatever emailupdate setting came through
}
}
if ($vbulletin->GPC['ajax'] or $vbulletin->GPC['quickeditnoajax']) {
// quick edit
$tmpmessage = $vbulletin->GPC['ajax'] ? convert_urlencoded_unicode($edit['message']) : $edit['message'];
$edit = $postinfo;
$edit['message'] =& $tmpmessage;
$edit['title'] = unhtmlspecialchars($edit['title']);
$edit['signature'] =& $edit['showsignature'];
$edit['enablesmilies'] =& $edit['allowsmilie'];
$edit['disablesmilies'] = $edit['enablesmilies'] ? 0 : 1;
$edit['parseurl'] = true;
$edit['prefixid'] = $threadinfo['prefixid'];
//.........这里部分代码省略.........
示例7: mark_forum_read
/**
* Marks a forum as read using the appropriate method.
*
* @param array Array of data for the forum being marked
* @param integer User ID this thread is being marked read for
* @param integer Unix timestamp that the thread is being marked read
* @param boolean Whether to automatically check if the parents' read times need to be updated
*
* @return array Returns an array of forums that were marked as read
*/
function mark_forum_read(&$foruminfo, $userid, $time, $check_parents = true)
{
global $vbulletin, $db;
if (empty($foruminfo['forumid']))
{
// sanity check -- wouldn't work anyway
return array();
}
$userid = intval($userid);
$time = intval($time);
$forums_marked = array($foruminfo['forumid']);
if ($vbulletin->options['threadmarking'] AND $userid)
{
$db->query_write("
REPLACE INTO " . TABLE_PREFIX . "forumread
(forumid, userid, readtime)
VALUES
($foruminfo[forumid], $userid, $time)
");
if (!$check_parents)
{
return $forums_marked;
}
// check to see if any parent forums should be marked as read as well
$parentarray = array_diff(explode(',', $foruminfo['parentlist']), array($foruminfo['forumid'], -1));
if (!empty($parentarray))
{
// find the top most entry in the parent list -- we need its child list
$top_parentid = end($parentarray);
$top_foruminfo = $vbulletin->forumcache["$top_parentid"];
if (!$top_foruminfo['childlist'])
{
return $forums_marked;
}
// fetch the effective (including children) and raw last post times
static $lastpostset = false, $rawlastpostinfo;
if (!$lastpostset)
{
$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;
}
}
}
//.........这里部分代码省略.........
示例8: verify_forum_password
{
$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);
示例9: print_forums
function print_forums($parentid = -1, $indent = "\t")
{
// new version - DRASTICALLY reduces queries...
global $vbulletin, $imodcache, $accesscache, $vbphrase;
// check to see if we need to do the queries
if (empty($vbulletin->iforumcache)) {
cache_ordered_forums(0, 1);
}
if (!is_array($imodcache)) {
require_once DIR . '/includes/functions_forumlist.php';
cache_moderators();
}
// check to see if this forum actually exists / has children
if (empty($vbulletin->iforumcache["{$parentid}"])) {
return;
}
foreach ($vbulletin->iforumcache["{$parentid}"] as $forumid) {
$forum =& $vbulletin->forumcache["{$forumid}"];
echo "{$indent}<ul class=\"lsq\">\n";
// forum title and links
echo "{$indent}<li><b><a name=\"forum{$forumid}\" href=\"forum.php?{$session['sessionurl']}do=edit&f={$forumid}\">{$forum['title']}</a> <span class=\"smallfont\">(" . construct_link_code($vbphrase['reset'], "accessmask.php?{$session['sessionurl']}do=resetforum&f={$forumid}&hash=" . CP_SESSIONHASH) . ")</span></b>";
// get moderators
if (is_array($imodcache["{$forumid}"])) {
echo "<span class=\"smallfont\"><br /> - <i>" . $vbphrase['moderators'] . ":";
foreach ($imodcache["{$forumid}"] as $moderator) {
// moderator username and links
echo " <a href=\"moderator.php?" . $vbulletin->session->vars['sessionurl'] . "do=edit&moderatorid={$moderator['moderatorid']}\">{$moderator['username']}</a>";
}
echo "</i></span>";
}
$allaccessmasks = 0;
$forbidden = '';
$permitted = '';
$deny = $accesscache["{$forumid}"]['0'];
$permit = $accesscache["{$forumid}"]['1'];
/*echo "<pre>--$forumid--\n";
print_r($accesscache["$forumid"]);
echo '</pre>';*/
if (is_array($deny)) {
$forbidden = "{$indent}\t<li class=\"am-deny\"><b>" . construct_phrase($vbphrase['access_denied_x_users'], $deny['count']) . '</b>' . construct_link_code($vbphrase['display_users'], "accessmask.php?" . $vbulletin->session->vars['sessionurl'] . "&do=edit&f={$forumid}&accessmask={$deny['accessmask']}") . "</li>\n";
$allaccessmasks = $deny['count'];
}
if (is_array($permit)) {
$permitted = "{$indent}\t<li class=\"am-grant\"><b>" . construct_phrase($vbphrase['access_granted_x_users'], $permit['count']) . '</b>' . construct_link_code($vbphrase['display_users'], "accessmask.php?" . $vbulletin->session->vars['sessionurl'] . "&do=edit&f={$forumid}&accessmask={$permit['accessmask']}") . "</li>\n";
$allaccessmasks = $allaccessmasks + $permit['count'];
}
if ($allaccessmasks > 0) {
echo "{$indent}\t<ul class=\"usergroups\">\n";
echo "{$indent}\t<li>" . construct_phrase($vbphrase['x_access_masks_set'], $allaccessmasks) . ' ' . construct_link_code('<b>' . $vbphrase['display_all_users'] . '</b>', "accessmask.php?" . $vbulletin->session->vars['sessionurl'] . "&do=edit&f={$forum['forumid']}&accessmask=2") . "</li>";
echo $permitted;
echo $forbidden;
echo "{$indent}\t</ul><br />\n";
} else {
echo "{$indent}\t\n";
echo "{$indent}\t<br />\n";
}
print_forums($forumid, "{$indent}\t");
echo "{$indent}</li>\n";
echo "{$indent}</ul>\n";
if ($forum['parentid'] == -1) {
echo "<hr size=\"1\" />\n";
}
}
unset($vbulletin->iforumcache["{$parentid}"]);
}
示例10: 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'];
}
}
示例11: get_forums
function get_forums($parentid = -1, &$forums)
{
global $vbulletin, $db, $foruminfo, $forumperms, $threadinfo, $postinfo, $vbphrase;
if (empty($vbulletin->iforumcache)) {
// get the vbulletin->iforumcache, as we use it all over the place, not just for forumjump
cache_ordered_forums(0, 1);
}
if (is_array($vbulletin->iforumcache[$parentid])) {
foreach ($vbulletin->iforumcache["{$parentid}"] as $forumid) {
$forumperms =& $vbulletin->userinfo['forumpermissions']["{$forumid}"];
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview'])) {
continue;
} else {
// set $forum from the $vbulletin->forumcache
$forum = $vbulletin->forumcache["{$forumid}"];
$optionvalue = $forumid;
$optiontitle = $forum[title];
$ok = true;
if ($forum['link']) {
$ok = false;
} else {
if (!($forum['options'] & $vbulletin->bf_misc_forumoptions['cancontainthreads'])) {
$ok = false;
} else {
if (!($forum['options'] & $vbulletin->bf_misc_forumoptions['allowposting'])) {
$ok = false;
}
}
}
if ($ok) {
$forums[] = array('id' => $forumid, 'title' => prepare_utf8_string($optiontitle));
}
get_forums($forumid, $forums);
}
// if can view
}
// end foreach ($vbulletin->iforumcache[$parentid] AS $forumid)
}
}
示例12: cv_construct_forum_list
function cv_construct_forum_list($parentid = -1, &$ret, $depth = 0)
{
global $vbulletin, $stylevar, $vbphrase, $defaultselected, $forum_url, $debug_mode, $use_vbseo_links, $excluded_forums;
$parent_count = 0;
if (!($vbulletin->userinfo['permissions']['forumpermissions'] & $vbulletin->bf_ugp_forumpermissions['canview'])) {
return $ret;
}
if (empty($vbulletin->iforumcache)) {
require_once './includes/functions_forumlist.php';
cache_ordered_forums(1, 1);
}
if (empty($vbulletin->iforumcache["{$parentid}"]) or !is_array($vbulletin->iforumcache["{$parentid}"])) {
return $ret;
}
foreach ($vbulletin->iforumcache["{$parentid}"] as $forumid) {
$forum = $vbulletin->forumcache["{$forumid}"];
$forum_title = $forum[title_clean];
$forum_desc = strip_tags($forum['description']);
if ($vbulletin->options['cv_ffl_permissions_usergroupid']) {
$forumperms = $forum['permissions'][$vbulletin->options['cv_ffl_permissions_usergroupid']];
} else {
$forumperms = $vbulletin->userinfo['forumpermissions']["{$forumid}"];
}
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) and !$vbulletin->options['showprivateforums'] or !$forum['displayorder'] or !($forum['options'] & $vbulletin->bf_misc_forumoptions['active']) or $forum['link'] and !$vbulletin->options['cv_ffl_show_linked'] and !$forum['nametitle'] or $excluded_forums and in_array($forum['forumid'], $excluded_forums)) {
if ($debug_mode) {
$debug_msg = 'SKIPPING FORUM ' . $forum[forumid] . ' - ' . $forum_title . ' ... ';
eval('$ret .= "' . fetch_template('cv_ffl_debug_msg') . '";');
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) and !$vbulletin->options['showprivateforums']) {
$debug_msg = 'User does not have permissions to view the forum';
eval('$ret .= "' . fetch_template('cv_ffl_debug_msg') . '";');
}
if (!$forum['displayorder']) {
$debug_msg = 'Forum does not have a display order assigned to it';
eval('$ret .= "' . fetch_template('cv_ffl_debug_msg') . '";');
}
if (!($forum['options'] & $vbulletin->bf_misc_forumoptions['active'])) {
$debug_msg = 'Forum is not active';
eval('$ret .= "' . fetch_template('cv_ffl_debug_msg') . '";');
}
if ($forum['link'] and !$vbulletin->options['cv_ffl_show_linked'] and !$forum['nametitle']) {
$debug_msg = 'Forum is a link, not a real forum';
eval('$ret .= "' . fetch_template('cv_ffl_debug_msg') . '";');
}
if ($excluded_forums and in_array($forum['forumid'], $excluded_forums)) {
$debug_msg = 'Forum has been specified in the ACP to be excluded.';
eval('$ret .= "' . fetch_template('cv_ffl_debug_msg') . '";');
}
}
continue;
} else {
if ($depth == 1) {
eval('$ret .= "' . fetch_template('cv_ffl_forum_category_seperator') . '";');
}
if ($depth >= 2) {
for ($i = 0; $i < $depth - 2; $i++) {
eval('$title_prefix = "' . fetch_template('cv_ffl_forum_sub_forum_indicator') . '";');
}
}
if ($use_vbseo_links) {
$vbseo_forum_link = vbseo_forum_url($forum['forumid'], 1);
}
eval('$forum_link = "' . fetch_template('cv_ffl_forum_link') . '";');
eval('$forum_feed_link = "' . fetch_template('cv_ffl_forum_feed_link') . '";');
if ($forum['options'] & $vbulletin->bf_misc_forumoptions['cancontainthreads'] and !$forum['link']) {
eval('$ret .= "' . fetch_template('cv_ffl_forum_bit_posts') . '";');
} else {
eval('$ret .= "' . fetch_template('cv_ffl_forum_bit_noposts') . '";');
}
// If the current forum has any sub-forums, then create that list
$depth++;
cv_construct_forum_list($forumid, $ret, $depth);
$depth--;
}
// if can view
}
// end
return $ret;
}
示例13: ListForums
function ListForums($who, $forumid)
{
global $db, $vbulletin, $server, $structtypes, $lastpostarray;
$result = RegisterService($who);
if ($result['Code'] != 0) {
$retval['Result'] = $result;
return $retval;
}
$userid = $vbulletin->userinfo['userid'];
//$xml = new XMLexporter($vbulletin);
// ### GET FORUMS & MODERATOR iCACHES ########################
cache_ordered_forums(1, 1);
if (empty($vbulletin->iforumcache)) {
$forums = $vbulletin->db->query_read_slave("\r\n SELECT forumid, title, link, parentid, displayorder, title_clean, description, description_clean,\r\n (options & " . $vbulletin->bf_misc_forumoptions['cancontainthreads'] . ") AS cancontainthreads\r\n FROM " . TABLE_PREFIX . "forum AS forum\r\n WHERE displayorder <> 0 AND\r\n password = '' AND\r\n (options & " . $vbulletin->bf_misc_forumoptions['active'] . ")\r\n ORDER BY displayorder\r\n ");
$vbulletin->iforumcache = array();
while ($forum = $vbulletin->db->fetch_array($forums)) {
$vbulletin->iforumcache["{$forum['parentid']}"]["{$forum['displayorder']}"]["{$forum['forumid']}"] = $forum;
}
unset($forum);
$vbulletin->db->free_result($forums);
}
// define max depth for forums display based on $vbulletin->options[forumhomedepth]
define('MAXFORUMDEPTH', 1);
if (is_array($vbulletin->iforumcache["{$forumid}"])) {
$childarray = $vbulletin->iforumcache["{$forumid}"];
} else {
$childarray = array($vbulletin->iforumcache["{$forumid}"]);
}
if (!is_array($lastpostarray)) {
fetch_last_post_array();
}
// add the current forum info
// get the current location title
$current = $db->query_first("SELECT title FROM " . TABLE_PREFIX . "forum AS forum WHERE (forumid = {$forumid})");
if (strlen($current['title']) == 0) {
$current['title'] = 'INDEX';
}
$forum = fetch_foruminfo($forumid);
$lastpostinfo = $vbulletin->forumcache["{$lastpostarray[$forumid]}"];
$isnew = fetch_forum_lightbulb($forumid, $lastpostinfo, $forum);
$curforum['ForumID'] = $forumid;
$curforum['Title'] = $current['title'];
$curforum['IsNew'] = $isnew == "new";
$curforum['IsCurrent'] = true;
$forumlist = array();
foreach ($childarray as $subforumid) {
// hack out the forum id
$forum = fetch_foruminfo($subforumid);
if (!$forum['displayorder'] or !($forum['options'] & $vbulletin->bf_misc_forumoptions['active'])) {
continue;
}
$forumperms = $vbulletin->userinfo['forumpermissions']["{$subforumid}"];
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) and ($vbulletin->forumcache["{$subforumid}"]['showprivate'] == 1 or !$vbulletin->forumcache["{$subforumid}"]['showprivate'] and !$vbulletin->options['showprivateforums'])) {
// no permission to view current forum
continue;
}
$lastpostinfo = $vbulletin->forumcache["{$lastpostarray[$subforumid]}"];
$isnew = fetch_forum_lightbulb($forumid, $lastpostinfo, $forum);
$tempforum['ForumID'] = $forum['forumid'];
$tempforum['Title'] = $forum['title'];
$tempforum['IsNew'] = $isnew == "new";
$tempforum['IsCurrent'] = false;
array_push($forumlist, $tempforum);
unset($tempforum);
}
$result['RemoteUser'] = ConsumeArray($vbulletin->userinfo, $structtypes['RemoteUser']);
$retval['Result'] = $result;
$retval['CurrentForum'] = $curforum;
$retval['ForumList'] = $forumlist;
return $retval;
}
示例14: print_description_row
print_description_row("<b><a href=\"forumpermission.php?" . $vbulletin->session->vars['sessionurl'] . "do=duplicate\">" . $vbphrase['permission_duplication_tools'] . "</a> | <a href=\"forumpermission.php?" . $vbulletin->session->vars['sessionurl'] . "do=quickedit\">" . $vbphrase['permissions_quick_editor'] . "</a> | <a href=\"forumpermission.php?" . $vbulletin->session->vars['sessionurl'] . "do=quickforum\">" . $vbphrase['quick_forum_permission_setup'] . "</a></b>", 0, 2, '', 'center');
print_table_footer();
print_form_header('', '');
print_table_header($vbphrase['forum_permissions']);
print_description_row('
<div class="darkbg" style="border: 2px inset"><ul class="darkbg">
<li><b>' . $vbphrase['color_key'] . '</b></li>
<li class="col-g">' . $vbphrase['standard_using_default_usergroup_permissions'] . '</li>
<li class="col-c">' . $vbphrase['customized_using_custom_permissions_for_this_usergroup'] . '</li>
<li class="col-i">' . $vbphrase['inherited_using_custom_permissions_inherited_from_a_parent_forum'] . '</li>
</ul></div>
');
print_table_footer();
require_once DIR . '/includes/functions_forumlist.php';
// get forum orders
cache_ordered_forums(0, 1);
// get moderators
cache_moderators();
// query forum permissions
$fpermscache = array();
$forumpermissions = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "forumpermission");
while ($fp = $db->fetch_array($forumpermissions)) {
$fpermscache["{$fp['forumid']}"]["{$fp['usergroupid']}"] = $fp;
}
// get usergroup default permissions
$permissions = array();
foreach ($vbulletin->usergroupcache as $usergroupid => $usergroup) {
$permissions["{$usergroupid}"] = $usergroup['forumpermissions'];
}
?>
<center>
示例15: construct_quick_nav
/**
* Returns the HTML for the forum jump menu
*
* @param array Information about current page (id, title, and link)
* @param integer ID of the parent forum for the group to be shown (-1 for all)
* @param boolean If true, evaluate the forumjump template too
* @param boolean Override $complete
*/
function construct_quick_nav($navpopup = array(), $parentid = -1, $addbox = true, $override = false)
{
global $vbulletin, $daysprune, $vbphrase, $forumjump;
static $complete = false;
if ($override)
{
$complete = false;
}
if (!$navpopup['id'])
{
$navpopup['id'] = 'navpopup';
}
if ($complete OR !$vbulletin->options['useforumjump'] OR !($vbulletin->userinfo['permissions']['forumpermissions'] & $vbulletin->bf_ugp_forumpermissions['canview']))
{
return;
}
if (empty($vbulletin->iforumcache))
{
// get the vbulletin->iforumcache, as we use it all over the place, not just for forumjump
cache_ordered_forums(0, 1);
}
if (empty($vbulletin->iforumcache["$parentid"]) OR !is_array($vbulletin->iforumcache["$parentid"]))
{
return;
}
foreach($vbulletin->iforumcache["$parentid"] AS $forumid)
{
$forumperms = $vbulletin->userinfo['forumpermissions']["$forumid"];
if ((!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) AND ($vbulletin->forumcache["$forumid"]['showprivate'] == 1 OR (!$vbulletin->forumcache["$forumid"]['showprivate'] AND !$vbulletin->options['showprivateforums']))) OR !($vbulletin->forumcache["$forumid"]['options'] & $vbulletin->bf_misc_forumoptions['showonforumjump']) OR !$vbulletin->forumcache["$forumid"]['displayorder'] OR !($vbulletin->forumcache["$forumid"]['options'] & $vbulletin->bf_misc_forumoptions['active']))
{
continue;
}
else
{
// set $forum from the $vbulletin->forumcache
$forum = $vbulletin->forumcache["$forumid"];
$children = explode(',', trim($forum['childlist']));
if (sizeof($children) <= 2)
{
$templater = vB_Template::create('forumjump_link');
$templater->register('forum', $forum);
$jumpforumbits .= $templater->render();
}
else
{
if ($forumbits = construct_quick_nav($navpopup, $forumid, false))
{
$templater = vB_Template::create('forumjump_subforum');
$forum['depth']++;
$templater->register('forum', $forum);
$templater->register('forumbits', $forumbits);
$jumpforumbits .= $templater->render();
}
else
{
$templater = vB_Template::create('forumjump_link');
$templater->register('forum', $forum);
$jumpforumbits .= $templater->render();
}
}
} // if can view
} // end foreach ($vbulletin->iforumcache[$parentid] AS $forumid)
if ($addbox)
{
($hook = vBulletinHook::fetch_hook('forumjump')) ? eval($hook) : false;
$templater = vB_Template::create('forumjump');
if ($daysprune)
{
$templater->register('daysprune', intval($daysprune));
}
$templater->register('jumpforumbits', $jumpforumbits);
$templater->register('navpopup', $navpopup);
$forumjump = $templater->render();
// prevent forumjump from being built more than once
$complete = true;
}
else
{
return $jumpforumbits;
}
}