aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/modules/acp/acp_main.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/modules/acp/acp_main.php')
-rw-r--r--phpBB/modules/acp/acp_main.php172
1 files changed, 85 insertions, 87 deletions
diff --git a/phpBB/modules/acp/acp_main.php b/phpBB/modules/acp/acp_main.php
index ee96eab767..91918166cf 100644
--- a/phpBB/modules/acp/acp_main.php
+++ b/phpBB/modules/acp/acp_main.php
@@ -25,32 +25,30 @@ class acp_main
function main($id, $mode)
{
- global $db, $user, $auth, $template;
-
// Show restore permissions notice
- if ($user->data['user_perm_from'] && $auth->acl_get('a_switchperm'))
+ if (phpbb::$user->data['user_perm_from'] && phpbb::$acl->acl_get('a_switchperm'))
{
$this->tpl_name = 'acp_main';
$this->page_title = 'ACP_MAIN';
$sql = 'SELECT user_id, username, user_colour
FROM ' . USERS_TABLE . '
- WHERE user_id = ' . $user->data['user_perm_from'];
- $result = $db->sql_query($sql);
- $user_row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
+ WHERE user_id = ' . phpbb::$user->data['user_perm_from'];
+ $result = phpbb::$db->sql_query($sql);
+ $user_row = phpbb::$db->sql_fetchrow($result);
+ phpbb::$db->sql_freeresult($result);
$perm_from = '<strong' . (($user_row['user_colour']) ? ' style="color: #' . $user_row['user_colour'] . '">' : '>');
- $perm_from .= ($user_row['user_id'] != ANONYMOUS) ? '<a href="' . append_sid('memberlist', 'mode=viewprofile&amp;u=' . $user_row['user_id']) . '">' : '';
+ $perm_from .= ($user_row['user_id'] != ANONYMOUS) ? '<a href="' . phpbb::$url->append_sid('memberlist', 'mode=viewprofile&amp;u=' . $user_row['user_id']) . '">' : '';
$perm_from .= $user_row['username'];
$perm_from .= ($user_row['user_id'] != ANONYMOUS) ? '</a>' : '';
$perm_from .= '</strong>';
- $template->assign_vars(array(
+ phpbb::$template->assign_vars(array(
'S_RESTORE_PERMISSIONS' => true,
- 'U_RESTORE_PERMISSIONS' => append_sid('ucp', 'mode=restore_perm'),
+ 'U_RESTORE_PERMISSIONS' => phpbb::$url->append_sid('ucp', 'mode=restore_perm'),
'PERM_FROM' => $perm_from,
- 'L_PERMISSIONS_TRANSFERRED_EXPLAIN' => sprintf($user->lang['PERMISSIONS_TRANSFERRED_EXPLAIN'], $perm_from, append_sid('ucp', 'mode=restore_perm')),
+ 'L_PERMISSIONS_TRANSFERRED_EXPLAIN' => sprintf(phpbb::$user->lang['PERMISSIONS_TRANSFERRED_EXPLAIN'], $perm_from, phpbb::$url->append_sid('ucp', 'mode=restore_perm')),
));
return;
@@ -62,10 +60,10 @@ class acp_main
{
if ($action === 'admlogout')
{
- $user->unset_admin();
- $redirect_url = append_sid(PHPBB_ROOT_PATH . 'index.' . PHP_EXT);
+ phpbb::$user->unset_admin();
+ $redirect_url = phpbb::$url->append_sid(PHPBB_ROOT_PATH . 'index.' . PHP_EXT);
meta_refresh(3, $redirect_url);
- trigger_error($user->lang['ADM_LOGGED_OUT'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . $redirect_url . '">', '</a>'));
+ trigger_error(phpbb::$user->lang['ADM_LOGGED_OUT'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_INDEX'], '<a href="' . $redirect_url . '">', '</a>'));
}
if (!confirm_box(true))
@@ -104,7 +102,7 @@ class acp_main
if ($confirm)
{
- confirm_box(false, $user->lang[$confirm_lang], build_hidden_fields(array(
+ confirm_box(false, phpbb::$user->lang[$confirm_lang], build_hidden_fields(array(
'i' => $id,
'mode' => $mode,
'action' => $action,
@@ -117,9 +115,9 @@ class acp_main
{
case 'online':
- if (!$auth->acl_get('a_board'))
+ if (!phpbb::$acl->acl_get('a_board'))
{
- trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
+ trigger_error(phpbb::$user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
}
set_config('record_online_users', 1, true);
@@ -128,45 +126,45 @@ class acp_main
break;
case 'stats':
- if (!$auth->acl_get('a_board'))
+ if (!phpbb::$acl->acl_get('a_board'))
{
- trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
+ trigger_error(phpbb::$user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
}
$sql = 'SELECT COUNT(post_id) AS stat
FROM ' . POSTS_TABLE . '
WHERE post_approved = 1';
- $result = $db->sql_query($sql);
- set_config('num_posts', (int) $db->sql_fetchfield('stat'), true);
- $db->sql_freeresult($result);
+ $result = phpbb::$db->sql_query($sql);
+ set_config('num_posts', (int) phpbb::$db->sql_fetchfield('stat'), true);
+ phpbb::$db->sql_freeresult($result);
$sql = 'SELECT COUNT(topic_id) AS stat
FROM ' . TOPICS_TABLE . '
WHERE topic_approved = 1';
- $result = $db->sql_query($sql);
- set_config('num_topics', (int) $db->sql_fetchfield('stat'), true);
- $db->sql_freeresult($result);
+ $result = phpbb::$db->sql_query($sql);
+ set_config('num_topics', (int) phpbb::$db->sql_fetchfield('stat'), true);
+ phpbb::$db->sql_freeresult($result);
$sql = 'SELECT COUNT(user_id) AS stat
FROM ' . USERS_TABLE . '
WHERE user_type IN (' . phpbb::USER_NORMAL . ',' . phpbb::USER_FOUNDER . ')';
- $result = $db->sql_query($sql);
- set_config('num_users', (int) $db->sql_fetchfield('stat'), true);
- $db->sql_freeresult($result);
+ $result = phpbb::$db->sql_query($sql);
+ set_config('num_users', (int) phpbb::$db->sql_fetchfield('stat'), true);
+ phpbb::$db->sql_freeresult($result);
$sql = 'SELECT COUNT(attach_id) as stat
FROM ' . ATTACHMENTS_TABLE . '
WHERE is_orphan = 0';
- $result = $db->sql_query($sql);
- set_config('num_files', (int) $db->sql_fetchfield('stat'), true);
- $db->sql_freeresult($result);
+ $result = phpbb::$db->sql_query($sql);
+ set_config('num_files', (int) phpbb::$db->sql_fetchfield('stat'), true);
+ phpbb::$db->sql_freeresult($result);
$sql = 'SELECT SUM(filesize) as stat
FROM ' . ATTACHMENTS_TABLE . '
WHERE is_orphan = 0';
- $result = $db->sql_query($sql);
- set_config('upload_dir_size', (float) $db->sql_fetchfield('stat'), true);
- $db->sql_freeresult($result);
+ $result = phpbb::$db->sql_query($sql);
+ set_config('upload_dir_size', (float) phpbb::$db->sql_fetchfield('stat'), true);
+ phpbb::$db->sql_freeresult($result);
if (!function_exists('update_last_username'))
{
@@ -178,9 +176,9 @@ class acp_main
break;
case 'user':
- if (!$auth->acl_get('a_board'))
+ if (!phpbb::$acl->acl_get('a_board'))
{
- trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
+ trigger_error(phpbb::$user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
}
// Resync post counts
@@ -189,18 +187,18 @@ class acp_main
// Find the maximum post ID, we can only stop the cycle when we've reached it
$sql = 'SELECT MAX(forum_last_post_id) as max_post_id
FROM ' . FORUMS_TABLE;
- $result = $db->sql_query($sql);
- $max_post_id = (int) $db->sql_fetchfield('max_post_id');
- $db->sql_freeresult($result);
+ $result = phpbb::$db->sql_query($sql);
+ $max_post_id = (int) phpbb::$db->sql_fetchfield('max_post_id');
+ phpbb::$db->sql_freeresult($result);
// No maximum post id? :o
if (!$max_post_id)
{
$sql = 'SELECT MAX(post_id)
FROM ' . POSTS_TABLE;
- $result = $db->sql_query($sql);
- $max_post_id = (int) $db->sql_fetchfield('max_post_id');
- $db->sql_freeresult($result);
+ $result = phpbb::$db->sql_query($sql);
+ $max_post_id = (int) phpbb::$db->sql_fetchfield('max_post_id');
+ phpbb::$db->sql_freeresult($result);
}
// Still no maximum post id? Then we are finished
@@ -211,7 +209,7 @@ class acp_main
}
$step = (phpbb::$config['num_posts']) ? (max((int) (phpbb::$config['num_posts'] / 5), 20000)) : 20000;
- $db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_posts = 0');
+ phpbb::$db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_posts = 0');
while ($start < $max_post_id)
{
@@ -220,18 +218,18 @@ class acp_main
WHERE post_id BETWEEN ' . ($start + 1) . ' AND ' . ($start + $step) . '
AND post_postcount = 1 AND post_approved = 1
GROUP BY poster_id';
- $result = $db->sql_query($sql);
+ $result = phpbb::$db->sql_query($sql);
- if ($row = $db->sql_fetchrow($result))
+ if ($row = phpbb::$db->sql_fetchrow($result))
{
do
{
$sql = 'UPDATE ' . USERS_TABLE . " SET user_posts = user_posts + {$row['num_posts']} WHERE user_id = {$row['poster_id']}";
- $db->sql_query($sql);
+ phpbb::$db->sql_query($sql);
}
- while ($row = $db->sql_fetchrow($result));
+ while ($row = phpbb::$db->sql_fetchrow($result));
}
- $db->sql_freeresult($result);
+ phpbb::$db->sql_freeresult($result);
$start += $step;
}
@@ -241,9 +239,9 @@ class acp_main
break;
case 'date':
- if (!$auth->acl_get('a_board'))
+ if (!phpbb::$acl->acl_get('a_board'))
{
- trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
+ trigger_error(phpbb::$user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
}
set_config('board_startdate', time() - 1);
@@ -251,13 +249,13 @@ class acp_main
break;
case 'db_track':
- if ($db->truncate)
+ if (phpbb::$db->features['truncate'])
{
- $db->sql_query('TRUNCATE TABLE ' . TOPICS_POSTED_TABLE);
+ phpbb::$db->sql_query('TRUNCATE TABLE ' . TOPICS_POSTED_TABLE);
}
else
{
- $db->sql_query('DELETE FROM ' . TOPICS_POSTED_TABLE);
+ phpbb::$db->sql_query('DELETE FROM ' . TOPICS_POSTED_TABLE);
}
// This can get really nasty... therefore we only do the last six months
@@ -267,14 +265,14 @@ class acp_main
$sql = 'SELECT forum_id
FROM ' . FORUMS_TABLE . '
WHERE forum_type <> ' . FORUM_CAT;
- $result = $db->sql_query($sql);
+ $result = phpbb::$db->sql_query($sql);
$forum_ids = array();
- while ($row = $db->sql_fetchrow($result))
+ while ($row = phpbb::$db->sql_fetchrow($result))
{
$forum_ids[] = $row['forum_id'];
}
- $db->sql_freeresult($result);
+ phpbb::$db->sql_freeresult($result);
// Any global announcements? ;)
$forum_ids[] = 0;
@@ -290,14 +288,14 @@ class acp_main
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);
+ $result = phpbb::$db->sql_query($sql);
$posted = array();
- while ($row = $db->sql_fetchrow($result))
+ while ($row = phpbb::$db->sql_fetchrow($result))
{
$posted[$row['poster_id']][] = $row['topic_id'];
}
- $db->sql_freeresult($result);
+ phpbb::$db->sql_freeresult($result);
$sql_ary = array();
foreach ($posted as $user_id => $topic_row)
@@ -315,7 +313,7 @@ class acp_main
if (sizeof($sql_ary))
{
- $db->sql_multi_insert(TOPICS_POSTED_TABLE, $sql_ary);
+ phpbb::$db->sql_multi_insert(TOPICS_POSTED_TABLE, $sql_ary);
}
}
@@ -323,15 +321,15 @@ class acp_main
break;
case 'purge_cache':
- if ((int) $user->data['user_type'] !== phpbb::USER_FOUNDER)
+ if (!phpbb::$user->is_founder)
{
- trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
+ trigger_error(phpbb::$user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
}
phpbb::$acm->purge();
// Clear permissions
- $auth->acl_clear_prefetch();
+ phpbb::$acl->acl_clear_prefetch();
cache_moderators();
add_log('admin', 'LOG_PURGE_CACHE');
@@ -346,7 +344,7 @@ class acp_main
$total_users = phpbb::$config['num_users'];
$total_files = phpbb::$config['num_files'];
- $start_date = $user->format_date(phpbb::$config['board_startdate']);
+ $start_date = phpbb::$user->format_date(phpbb::$config['board_startdate']);
$boarddays = (time() - phpbb::$config['board_startdate']) / 86400;
@@ -375,7 +373,7 @@ class acp_main
else
{
// Couldn't open Avatar dir.
- $avatar_dir_size = $user->lang['NOT_AVAILABLE'];
+ $avatar_dir_size = phpbb::$user->lang['NOT_AVAILABLE'];
}
if ($posts_per_day > $total_posts)
@@ -404,9 +402,9 @@ class acp_main
FROM ' . ATTACHMENTS_TABLE . '
WHERE is_orphan = 1
AND filetime < ' . (time() - 3*60*60);
- $result = $db->sql_query($sql);
- $total_orphan = (int) $db->sql_fetchfield('total_orphan');
- $db->sql_freeresult($result);
+ $result = phpbb::$db->sql_query($sql);
+ $total_orphan = (int) phpbb::$db->sql_fetchfield('total_orphan');
+ phpbb::$db->sql_freeresult($result);
}
else
{
@@ -415,7 +413,7 @@ class acp_main
$dbsize = get_database_size();
- $template->assign_vars(array(
+ phpbb::$template->assign_vars(array(
'TOTAL_POSTS' => $total_posts,
'POSTS_PER_DAY' => $posts_per_day,
'TOTAL_TOPICS' => $total_topics,
@@ -430,38 +428,38 @@ class acp_main
'UPLOAD_DIR_SIZE' => $upload_dir_size,
'TOTAL_ORPHAN' => $total_orphan,
'S_TOTAL_ORPHAN' => ($total_orphan === false) ? false : true,
- 'GZIP_COMPRESSION' => (phpbb::$config['gzip_compress']) ? $user->lang['ON'] : $user->lang['OFF'],
- 'DATABASE_INFO' => $db->sql_server_info(),
+ 'GZIP_COMPRESSION' => (phpbb::$config['gzip_compress']) ? phpbb::$user->lang['ON'] : phpbb::$user->lang['OFF'],
+ 'DATABASE_INFO' => phpbb::$db->sql_server_info(),
'BOARD_VERSION' => phpbb::$config['version'],
'U_ACTION' => $this->u_action,
- 'U_ADMIN_LOG' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=logs&amp;mode=admin'),
- 'U_INACTIVE_USERS' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=inactive&amp;mode=list'),
+ 'U_ADMIN_LOG' => phpbb::$url->append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=logs&amp;mode=admin'),
+ 'U_INACTIVE_USERS' => phpbb::$url->append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, 'i=inactive&amp;mode=list'),
- 'S_ACTION_OPTIONS' => ($auth->acl_get('a_board')) ? true : false,
- 'S_FOUNDER' => ($user->data['user_type'] == phpbb::USER_FOUNDER) ? true : false,
+ 'S_ACTION_OPTIONS' => (phpbb::$acl->acl_get('a_board')) ? true : false,
+ 'S_FOUNDER' => phpbb::$user->is_founder,
)
);
$log_data = array();
$log_count = 0;
- if ($auth->acl_get('a_viewlogs'))
+ if (phpbb::$acl->acl_get('a_viewlogs'))
{
view_log('admin', $log_data, $log_count, 5);
foreach ($log_data as $row)
{
- $template->assign_block_vars('log', array(
+ phpbb::$template->assign_block_vars('log', array(
'USERNAME' => $row['username_full'],
'IP' => $row['ip'],
- 'DATE' => $user->format_date($row['time']),
+ 'DATE' => phpbb::$user->format_date($row['time']),
'ACTION' => $row['action'])
);
}
}
- if ($auth->acl_get('a_user'))
+ if (phpbb::$acl->acl_get('a_user'))
{
$inactive = array();
$inactive_count = 0;
@@ -470,14 +468,14 @@ class acp_main
foreach ($inactive as $row)
{
- $template->assign_block_vars('inactive', array(
- 'INACTIVE_DATE' => $user->format_date($row['user_inactive_time']),
- 'JOINED' => $user->format_date($row['user_regdate']),
- 'LAST_VISIT' => (!$row['user_lastvisit']) ? ' - ' : $user->format_date($row['user_lastvisit']),
+ phpbb::$template->assign_block_vars('inactive', array(
+ 'INACTIVE_DATE' => phpbb::$user->format_date($row['user_inactive_time']),
+ 'JOINED' => phpbb::$user->format_date($row['user_regdate']),
+ 'LAST_VISIT' => (!$row['user_lastvisit']) ? ' - ' : phpbb::$user->format_date($row['user_lastvisit']),
'REASON' => $row['inactive_reason'],
'USER_ID' => $row['user_id'],
'USERNAME' => $row['username'],
- 'U_USER_ADMIN' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=users&amp;mode=overview&amp;u={$row['user_id']}"))
+ 'U_USER_ADMIN' => phpbb::$url->append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=users&amp;mode=overview&amp;u={$row['user_id']}"))
);
}
@@ -487,7 +485,7 @@ class acp_main
$option_ary += array('remind' => 'REMIND');
}
- $template->assign_vars(array(
+ phpbb::$template->assign_vars(array(
'S_INACTIVE_USERS' => true,
'S_INACTIVE_OPTIONS' => build_select($option_ary))
);
@@ -496,13 +494,13 @@ class acp_main
// Warn if install is still present
if (file_exists(PHPBB_ROOT_PATH . 'install'))
{
- $template->assign_var('S_REMOVE_INSTALL', true);
+ phpbb::$template->assign_var('S_REMOVE_INSTALL', true);
}
if (!defined('PHPBB_DISABLE_CONFIG_CHECK') && file_exists(PHPBB_ROOT_PATH . 'config.' . PHP_EXT) && is_writable(PHPBB_ROOT_PATH . 'config.' . PHP_EXT))
{
// World-Writable? (000x)
- $template->assign_var('S_WRITABLE_CONFIG', (bool) (@fileperms(PHPBB_ROOT_PATH . 'config.' . PHP_EXT) & 0x0002));
+ phpbb::$template->assign_var('S_WRITABLE_CONFIG', (bool) (@fileperms(PHPBB_ROOT_PATH . 'config.' . PHP_EXT) & 0x0002));
}
$this->tpl_name = 'acp_main';