本文整理汇总了PHP中cache_moderators函数的典型用法代码示例。如果您正苦于以下问题:PHP cache_moderators函数的具体用法?PHP cache_moderators怎么用?PHP cache_moderators使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cache_moderators函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cache_moderators_once
/**
* A version of cache_moderators that can be safely called multiple times
* without doing extra work.
*/
function cache_moderators_once($userid = null)
{
global $imodcache;
if (!isset($imodcache)) {
cache_moderators($userid);
}
}
示例2: run_tool
/**
* Run Tool
*
* Does the actual stuff we want the tool to do after submission
*/
function run_tool()
{
if (!function_exists('cache_moderators')) {
global $phpbb_root_path, $phpEx;
include "{$phpbb_root_path}includes/functions_admin.{$phpEx}";
}
cache_moderators();
trigger_error('RECACHE_MODERATORS_COMPLETE');
}
示例3: run_tool
/**
* Run Tool
*
* Does the actual stuff we want the tool to do after submission
*/
function run_tool(&$error)
{
global $auth, $cache;
$cache->purge();
// Clear permissions
$auth->acl_clear_prefetch();
cache_moderators();
add_log('admin', 'LOG_PURGE_CACHE');
trigger_error('PURGE_CACHE_COMPLETE');
}
示例4: fetch_validated_list
public function fetch_validated_list($user, $ids, $gids)
{
require_once DIR . '/includes/functions_forumlist.php';
cache_moderators();
$list = array_fill_keys($ids, false);
foreach (vB_Legacy_Thread::create_array($ids) as $key => $thread) {
$item = vBForum_Search_Result_Thread::create_from_thread($thread);
if ($item->can_search($user)) {
$list[$key] = $item;
}
}
$retval = array('list' => $list, 'groups_rejected' => $rejected_groups);
($hook = vBulletinHook::fetch_hook('search_validated_list')) ? eval($hook) : false;
return $retval;
}
示例5: do_get_profile
function do_get_profile()
{
global $vbulletin;
$userinfo = vB_Api::instance('user')->fetchUserInfo();
$cleaned = vB::getCleaner()->cleanArray($_REQUEST, array('userid' => vB_Cleaner::TYPE_UINT));
if (!$userinfo['userid'] && !$cleaned['userid']) {
return json_error(ERR_INVALID_LOGGEDIN, RV_NOT_LOGGED_IN);
}
if (!$cleaned['userid']) {
$cleaned['userid'] = $userinfo['userid'];
}
$profile = vB_Api::instance('user')->fetchProfileInfo($cleaned['userid']);
if (empty($profile)) {
return json_error(ERR_NO_PERMISSION);
}
$values = array();
foreach ($profile['customFields']['default'] as $name => $value) {
$value = $value['val'];
if ($value === null) {
$value = '';
}
$values[] = array('name' => (string) new vB_Phrase('cprofilefield', $name), 'value' => $value);
}
$groups = array();
$groups[] = array('name' => 'about', 'values' => $values);
$out = array('username' => prepare_utf8_string($profile['username']), 'joindate' => prepare_utf8_string(fr_date($profile['joindate'])), 'posts' => $profile['posts'], 'online' => fr_get_user_online($profile['lastactivity']), 'avatar_upload' => $profile['canuseavatar'] ? true : false, 'groups' => $groups);
$avatarurl = vB_Library::instance('vb4_functions')->avatarUrl($cleaned['userid']);
if ($avatarurl) {
$out['avatarurl'] = $avatarurl;
}
cache_moderators();
cache_permissions($vbulletin->userinfo);
$canbanuser = ($vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel'] or can_moderate(0, 'canbanusers'));
if ($canbanuser) {
$out['ban'] = true;
}
return $out;
}
示例6: print_description_row
print_description_row("<b><a href=\"forumpermission.php?" . vB::getCurrentSession()->get('sessionurl') . "do=duplicate\">" . $vbphrase['permission_duplication_tools'] . "</a> | <a href=\"forumpermission.php?" . vB::getCurrentSession()->get('sessionurl') . "do=quickedit\">" . $vbphrase['permissions_quick_editor'] . "</a> | <a href=\"forumpermission.php?" . vB::getCurrentSession()->get('sessionurl') . "do=quickforum\">" . $vbphrase['quick_channel_permission_setup'] . "</a></b>", 0, 2, '', 'center');
print_table_footer();
print_form_header('', '');
print_table_header($vbphrase['view_channel_permissions_gcppermission']);
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_channel_permissions'] . '</li>
<li class="col-c">' . $vbphrase['customized_using_custom_permissions_for_this_usergroup_gcppermission'] . '</li>
<li class="col-i">' . $vbphrase['inherited_using_custom_permissions_inherited_channel_a_parent_channel'] . '</li>
</ul></div>
');
print_table_footer();
require_once DIR . '/includes/functions_forumlist.php';
// get moderators
cache_moderators();
//query channel permissions
$result = vB::getDbAssertor()->assertQuery('vBForum:permission', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT));
$npermscache = array();
foreach ($result as $permission) {
$npermscache[$permission['nodeid']][$permission['groupid']] = $permission;
}
// get usergroup default permissions
$permissions = array();
$usergroupcache = vB::getDatastore()->getValue('usergroupcache');
foreach ($usergroupcache as $usergroupid => $usergroup) {
$permissions["{$usergroupid}"] = $usergroup['forumpermissions'];
}
//build_channel_permissions();
?>
<center>
示例7: finish_conversion
/**
* Finish conversion, the last function to be called.
*/
function finish_conversion()
{
global $db, $phpbb_root_path, $phpEx, $convert, $config, $language, $user, $template;
$db->sql_query('DELETE FROM ' . CONFIG_TABLE . "
WHERE config_name = 'convert_progress'
OR config_name = 'convert_options'
OR config_name = 'convert_db_server'
OR config_name = 'convert_db_user'");
$db->sql_query('DELETE FROM ' . SESSIONS_TABLE);
@unlink($phpbb_root_path . 'cache/data_global.' . $phpEx);
cache_moderators();
// And finally, add a note to the log
add_log('admin', 'LOG_INSTALL_CONVERTED', $convert->convertor_data['forum_name'], $config['version']);
$url = $this->p_master->module_url . "?mode={$this->mode}&sub=final&language=$language";
$template->assign_vars(array(
'L_SUBMIT' => $user->lang['FINAL_STEP'],
'U_ACTION' => $url,
));
$this->meta_refresh($url);
return;
}
示例8: remove_permissions
/**
* Remove permissions
*/
function remove_permissions($mode, $permission_type, &$auth_admin, &$user_id, &$group_id, &$forum_id)
{
global $user, $db, $auth;
// User or group to be set?
$ug_type = sizeof($user_id) ? 'user' : 'group';
// Check the permission setting again
if (!$auth->acl_get('a_' . str_replace('_', '', $permission_type) . 'auth') || !$auth->acl_get('a_auth' . $ug_type . 's')) {
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
}
$auth_admin->acl_delete($ug_type, $ug_type == 'user' ? $user_id : $group_id, sizeof($forum_id) ? $forum_id : false, $permission_type);
// Do we need to recache the moderator lists?
if ($permission_type == 'm_') {
cache_moderators();
}
$this->log_action($mode, 'del', $permission_type, $ug_type, $ug_type == 'user' ? $user_id : $group_id, sizeof($forum_id) ? $forum_id : array(0 => 0));
if ($mode == 'setting_forum_local' || $mode == 'setting_mod_local') {
trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action . '&forum_id[]=' . implode('&forum_id[]=', $forum_id)));
} else {
trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action));
}
}
示例9: copy_forum_permissions
/**
* Handles copying permissions from one forum to others
*/
function copy_forum_permissions()
{
global $auth, $cache, $template, $user;
$user->add_lang('acp/forums');
$submit = isset($_POST['submit']) ? true : false;
if ($submit) {
$src = request_var('src_forum_id', 0);
$dest = request_var('dest_forum_ids', array(0));
if (confirm_box(true)) {
if (copy_forum_permissions($src, $dest)) {
cache_moderators();
$auth->acl_clear_prefetch();
$cache->destroy('sql', FORUMS_TABLE);
trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action));
} else {
trigger_error($user->lang['SELECTED_FORUM_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING);
}
} else {
$s_hidden_fields = array('submit' => $submit, 'src_forum_id' => $src, 'dest_forum_ids' => $dest);
$s_hidden_fields = build_hidden_fields($s_hidden_fields);
confirm_box(false, $user->lang['COPY_PERMISSIONS_CONFIRM'], $s_hidden_fields);
}
}
$template->assign_vars(array('S_FORUM_OPTIONS' => make_forum_select(false, false, false, false, false)));
}
示例10: do_get_profile
function do_get_profile()
{
global $vbulletin, $db, $show, $vbphrase, $permissions, $imodcache;
$vbulletin->input->clean_array_gpc('r', array('userid' => TYPE_UINT));
if (!$vbulletin->userinfo['userid'] && !$vbulletin->GPC['userid']) {
json_error(ERR_INVALID_LOGGEDIN, RV_NOT_LOGGED_IN);
}
if (!($permissions['forumpermissions'] & $vbulletin->bf_ugp_forumpermissions['canview']) or !($permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canviewmembers'])) {
json_error(ERR_NO_PERMISSION);
}
if (!$vbulletin->GPC['userid']) {
$vbulletin->GPC['userid'] = $vbulletin->userinfo['userid'];
}
$fetch_userinfo_options = FETCH_USERINFO_AVATAR | FETCH_USERINFO_LOCATION | FETCH_USERINFO_PROFILEPIC | FETCH_USERINFO_SIGPIC | FETCH_USERINFO_USERCSS | FETCH_USERINFO_ISFRIEND;
$userinfo = verify_id('user', $vbulletin->GPC['userid'], 1, $fetch_userinfo_options);
if ($userinfo['usergroupid'] == 4 and !($permissions['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel'])) {
json_error(ERR_NO_PERMISSION);
}
$posts = $userinfo['posts'];
$joindate = vbdate($vbulletin->options['dateformat'], $userinfo['joindate']);
$out = array('username' => html_entity_decode($userinfo['username']), 'online' => fetch_online_status($userinfo, false), 'avatar_upload' => $vbulletin->options['avatarenabled'] && $permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canuseavatar'], 'posts' => $posts, 'joindate' => $joindate);
$avatarurl_info = fetch_avatar_url($userinfo['userid']);
if ($avatarurl_info) {
$out['avatarurl'] = process_avatarurl($avatarurl_info[0]);
}
cache_moderators();
$canbanuser = ($vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel'] or can_moderate(0, 'canbanusers'));
if ($canbanuser) {
$out['ban'] = true;
}
$groups = array();
// About
$out_group = array('name' => 'about', 'values' => array(array('name' => prepare_utf8_string($vbphrase['posts']), 'value' => strval(vb_number_format($userinfo['posts']))), array('name' => prepare_utf8_string($vbphrase['join_date']), 'value' => vbdate($vbulletin->options['dateformat'], $userinfo['joindate']))));
if (function_exists('itrader_user')) {
itrader_user($userinfo);
$out_group['values'][] = array('name' => 'iTrader', 'value' => vb_number_format($userinfo['tradescore']) . ', ' . $userinfo['tradepcnt'] . '%');
$out += array('itrader_score' => vb_number_format($userinfo['tradescore']), 'itrader_percent' => $userinfo['tradepcnt'] . '%');
}
$groups[] = $out_group;
$profileobj = new vB_UserProfile($vbulletin, $userinfo);
$blockfactory = new vB_ProfileBlockFactory($vbulletin, $profileobj);
$profileblock =& $blockfactory->fetch('ProfileFields');
$profileblock->build_field_data(false);
$profile = $profileblock->categories[0];
// Additional information
if (count($profile)) {
$out_group = array('name' => 'additional');
foreach ($profile as $profilefield) {
$field_value = $userinfo["field{$profilefield['profilefieldid']}"];
fetch_profilefield_display($profilefield, $field_value);
if (!strlen(trim($field_value))) {
continue;
}
$out_group['values'][] = array('name' => prepare_utf8_string($profilefield['title']), 'value' => prepare_utf8_string($profilefield['value']));
}
if (count($out_group['values'])) {
$groups[] = $out_group;
}
}
$out['groups'] = $groups;
return $out;
}
示例11: group_update_listings
/**
* Re-cache moderators and foes if group has a_ or m_ permissions
*/
function group_update_listings($group_id)
{
global $auth;
$hold_ary = $auth->acl_group_raw_data($group_id, array('a_', 'm_'));
if (!sizeof($hold_ary)) {
return;
}
$mod_permissions = $admin_permissions = false;
foreach ($hold_ary as $g_id => $forum_ary) {
foreach ($forum_ary as $forum_id => $auth_ary) {
foreach ($auth_ary as $auth_option => $setting) {
if ($mod_permissions && $admin_permissions) {
break 3;
}
if ($setting != ACL_YES) {
continue;
}
if ($auth_option == 'm_') {
$mod_permissions = true;
}
if ($auth_option == 'a_') {
$admin_permissions = true;
}
}
}
}
if ($mod_permissions) {
if (!function_exists('cache_moderators')) {
global $phpbb_root_path, $phpEx;
include $phpbb_root_path . 'includes/functions_admin.' . $phpEx;
}
cache_moderators();
}
if ($mod_permissions || $admin_permissions) {
if (!function_exists('update_foes')) {
global $phpbb_root_path, $phpEx;
include $phpbb_root_path . 'includes/functions_admin.' . $phpEx;
}
update_foes(array($group_id));
}
}
示例12: 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();
//.........这里部分代码省略.........
示例13: print_channels
function print_channels($parentid = 0, $indent = "\t")
{
global $vbulletin, $imodcache, $accesscache, $vbphrase;
// check to see if we need to do the queries
if (!is_array($imodcache)) {
require_once DIR . '/includes/functions_forumlist.php';
cache_moderators();
}
if ($parentid === 0) {
$channels = vB_Api::instanceInternal('search')->getChannels(false);
} else {
$channels = vB_Api::instanceInternal('search')->getChannels(true);
if (empty($channels["{$parentid}"]) or empty($channels["{$parentid}"]['channels'])) {
return;
}
$channels = $channels["{$parentid}"]['channels'];
}
// check to see if this channel actually exists / has children
foreach ($channels as $nodeid => $node) {
echo "{$indent}<ul class=\"lsq\">\n";
// node title and links
echo "{$indent}<li><b><a name=\"node{$nodeid}\" href=\"forum.php?" . vB::getCurrentSession()->get('sessionurl') . "do=edit&n={$nodeid}\">{$node['htmltitle']}</a> <span class=\"smallfont\">(" . construct_link_code($vbphrase['reset'], "accessmask.php?" . vB::getCurrentSession()->get('sessionurl') . "do=resetchannel&n={$nodeid}&hash=" . CP_SESSIONHASH) . ")</span></b>";
// get moderators
if (is_array($imodcache["{$nodeid}"])) {
echo "<span class=\"smallfont\"><br /> - <i>" . $vbphrase['moderators'] . ":";
foreach ($imodcache["{$nodeid}"] as $moderator) {
// moderator username and links
echo " <a href=\"moderator.php?" . vB::getCurrentSession()->get('sessionurl') . "do=edit&moderatorid={$moderator['moderatorid']}\">{$moderator['username']}</a>";
}
echo "</i></span>";
}
$allaccessmasks = 0;
$forbidden = '';
$permitted = '';
$deny = $accesscache["{$nodeid}"]['0'];
$permit = $accesscache["{$nodeid}"]['1'];
/*echo "<pre>--$nodeid--\n";
print_r($accesscache["$nodeid"]);
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?" . vB::getCurrentSession()->get('sessionurl') . "&do=edit&n={$nodeid}&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?" . vB::getCurrentSession()->get('sessionurl') . "&do=edit&n={$nodeid}&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?" . vB::getCurrentSession()->get('sessionurl') . "&do=edit&n={$nodeid}&accessmask=2") . "</li>";
echo $permitted;
echo $forbidden;
echo "{$indent}\t</ul><br />\n";
} else {
echo "{$indent}\t\n";
echo "{$indent}\t<br />\n";
}
print_channels($nodeid, "{$indent}\t");
echo "{$indent}</li>\n";
echo "{$indent}</ul>\n";
if ($node['parentid'] == 0) {
echo "<hr size=\"1\" />\n";
}
}
}
示例14: main
//.........这里部分代码省略.........
WHERE t.forum_id = ' . $forum_id . '
AND t.topic_moved_id = 0
AND t.topic_last_post_time > ' . $get_from_time . '
AND t.topic_id = p.topic_id
AND p.poster_id <> ' . ANONYMOUS . '
GROUP BY p.poster_id, p.topic_id';
$result = $db->sql_query($sql);
$posted = array();
while ($row = $db->sql_fetchrow($result)) {
$posted[$row['poster_id']][] = $row['topic_id'];
}
$db->sql_freeresult($result);
$sql_ary = array();
foreach ($posted as $user_id => $topic_row) {
foreach ($topic_row as $topic_id) {
$sql_ary[] = array('user_id' => (int) $user_id, 'topic_id' => (int) $topic_id, 'topic_posted' => 1);
}
}
unset($posted);
if (sizeof($sql_ary)) {
$db->sql_multi_insert(TOPICS_POSTED_TABLE, $sql_ary);
}
}
add_log('admin', 'LOG_RESYNC_POST_MARKING');
break;
case 'purge_cache':
if ((int) $user->data['user_type'] !== USER_FOUNDER) {
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
}
global $cache;
$cache->purge();
// Clear permissions
$auth->acl_clear_prefetch();
cache_moderators();
add_log('admin', 'LOG_PURGE_CACHE');
break;
}
}
}
// Get forum statistics
$total_posts = $config['num_posts'];
$total_topics = $config['num_topics'];
$total_users = $config['num_users'];
$total_files = $config['num_files'];
$start_date = $user->format_date($config['board_startdate']);
$boarddays = (time() - $config['board_startdate']) / 86400;
$posts_per_day = sprintf('%.2f', $total_posts / $boarddays);
$topics_per_day = sprintf('%.2f', $total_topics / $boarddays);
$users_per_day = sprintf('%.2f', $total_users / $boarddays);
$files_per_day = sprintf('%.2f', $total_files / $boarddays);
$upload_dir_size = get_formatted_filesize($config['upload_dir_size']);
$avatar_dir_size = 0;
if ($avatar_dir = @opendir($phpbb_root_path . $config['avatar_path'])) {
while (($file = readdir($avatar_dir)) !== false) {
if ($file[0] != '.' && $file != 'CVS' && strpos($file, 'index.') === false) {
$avatar_dir_size += filesize($phpbb_root_path . $config['avatar_path'] . '/' . $file);
}
}
closedir($avatar_dir);
$avatar_dir_size = get_formatted_filesize($avatar_dir_size);
} else {
// Couldn't open Avatar dir.
$avatar_dir_size = $user->lang['NOT_AVAILABLE'];
}
if ($posts_per_day > $total_posts) {
$posts_per_day = $total_posts;
示例15: main
function main($id, $mode)
{
global $db, $user, $auth, $template, $cache;
global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx;
$user->add_lang('acp/forums');
$this->tpl_name = 'acp_forums';
$this->page_title = 'ACP_MANAGE_FORUMS';
$form_key = 'acp_forums';
add_form_key($form_key);
$action = request_var('action', '');
$update = isset($_POST['update']) ? true : false;
$forum_id = request_var('f', 0);
$this->parent_id = request_var('parent_id', 0);
$forum_data = $errors = array();
if ($update && !check_form_key($form_key)) {
$update = false;
$errors[] = $user->lang['FORM_INVALID'];
}
// Check additional permissions
switch ($action) {
case 'progress_bar':
$start = request_var('start', 0);
$total = request_var('total', 0);
$this->display_progress_bar($start, $total);
break;
case 'delete':
if (!$auth->acl_get('a_forumdel')) {
trigger_error($user->lang['NO_PERMISSION_FORUM_DELETE'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING);
}
break;
case 'add':
if (!$auth->acl_get('a_forumadd')) {
trigger_error($user->lang['NO_PERMISSION_FORUM_ADD'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING);
}
break;
}
// Major routines
if ($update) {
switch ($action) {
case 'delete':
$action_subforums = request_var('action_subforums', '');
$subforums_to_id = request_var('subforums_to_id', 0);
$action_posts = request_var('action_posts', '');
$posts_to_id = request_var('posts_to_id', 0);
$errors = $this->delete_forum($forum_id, $action_posts, $action_subforums, $posts_to_id, $subforums_to_id);
if (sizeof($errors)) {
break;
}
$auth->acl_clear_prefetch();
$cache->destroy('sql', FORUMS_TABLE);
trigger_error($user->lang['FORUM_DELETED'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id));
break;
case 'edit':
$forum_data = array('forum_id' => $forum_id);
// No break here
// No break here
case 'add':
$forum_data += array('parent_id' => request_var('forum_parent_id', $this->parent_id), 'forum_type' => request_var('forum_type', FORUM_POST), 'type_action' => request_var('type_action', ''), 'forum_status' => request_var('forum_status', ITEM_UNLOCKED), 'forum_parents' => '', 'forum_name' => utf8_normalize_nfc(request_var('forum_name', '', true)), 'forum_link' => request_var('forum_link', ''), 'forum_link_track' => request_var('forum_link_track', false), 'forum_desc' => utf8_normalize_nfc(request_var('forum_desc', '', true)), 'forum_desc_uid' => '', 'forum_desc_options' => 7, 'forum_desc_bitfield' => '', 'forum_rules' => utf8_normalize_nfc(request_var('forum_rules', '', true)), 'forum_rules_uid' => '', 'forum_rules_options' => 7, 'forum_rules_bitfield' => '', 'forum_rules_link' => request_var('forum_rules_link', ''), 'forum_image' => request_var('forum_image', ''), 'forum_style' => request_var('forum_style', 0), 'display_subforum_list' => request_var('display_subforum_list', false), 'display_on_index' => request_var('display_on_index', false), 'forum_topics_per_page' => request_var('topics_per_page', 0), 'enable_indexing' => request_var('enable_indexing', true), 'enable_icons' => request_var('enable_icons', false), 'enable_prune' => request_var('enable_prune', false), 'enable_post_review' => request_var('enable_post_review', true), 'enable_quick_reply' => request_var('enable_quick_reply', false), 'prune_days' => request_var('prune_days', 7), 'prune_viewed' => request_var('prune_viewed', 7), 'prune_freq' => request_var('prune_freq', 1), 'prune_old_polls' => request_var('prune_old_polls', false), 'prune_announce' => request_var('prune_announce', false), 'prune_sticky' => request_var('prune_sticky', false), 'forum_password' => request_var('forum_password', '', true), 'forum_password_confirm' => request_var('forum_password_confirm', '', true), 'forum_password_unset' => request_var('forum_password_unset', false));
// On add, add empty forum_options... else do not consider it (not updating it)
if ($action == 'add') {
$forum_data['forum_options'] = 0;
}
// Use link_display_on_index setting if forum type is link
if ($forum_data['forum_type'] == FORUM_LINK) {
$forum_data['display_on_index'] = request_var('link_display_on_index', false);
}
// Linked forums and categories are not able to be locked...
if ($forum_data['forum_type'] == FORUM_LINK || $forum_data['forum_type'] == FORUM_CAT) {
$forum_data['forum_status'] = ITEM_UNLOCKED;
}
$forum_data['show_active'] = $forum_data['forum_type'] == FORUM_POST ? request_var('display_recent', true) : request_var('display_active', false);
// Get data for forum rules if specified...
if ($forum_data['forum_rules']) {
generate_text_for_storage($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options'], request_var('rules_parse_bbcode', false), request_var('rules_parse_urls', false), request_var('rules_parse_smilies', false));
}
// Get data for forum description if specified
if ($forum_data['forum_desc']) {
generate_text_for_storage($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options'], request_var('desc_parse_bbcode', false), request_var('desc_parse_urls', false), request_var('desc_parse_smilies', false));
}
$errors = $this->update_forum_data($forum_data);
if (!sizeof($errors)) {
$forum_perm_from = request_var('forum_perm_from', 0);
$cache->destroy('sql', FORUMS_TABLE);
$copied_permissions = false;
// Copy permissions?
if ($forum_perm_from && $forum_perm_from != $forum_data['forum_id'] && ($action != 'edit' || empty($forum_id) || $auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth'))) {
copy_forum_permissions($forum_perm_from, $forum_data['forum_id'], $action == 'edit' ? true : false);
cache_moderators();
$copied_permissions = true;
}
/* Commented out because of questionable UI workflow - re-visit for 3.0.7
else if (!$this->parent_id && $action != 'edit' && $auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth'))
{
$this->copy_permission_page($forum_data);
return;
}
*/
$auth->acl_clear_prefetch();
$acl_url = '&mode=setting_forum_local&forum_id[]=' . $forum_data['forum_id'];
$message = $action == 'add' ? $user->lang['FORUM_CREATED'] : $user->lang['FORUM_UPDATED'];
//.........这里部分代码省略.........