|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
*
|
|
|
4c79b5 |
* @package acp
|
|
|
4c79b5 |
* @version $Id: acp_main.php 9171 2008-12-04 14:53:04Z acydburn $
|
|
|
4c79b5 |
* @copyright (c) 2005 phpBB Group
|
|
|
4c79b5 |
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
|
4c79b5 |
*
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* @ignore
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
if (!defined('IN_PHPBB'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
exit;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* @package acp
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
class acp_main
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
var $u_action;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
function main($id, $mode)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
global $config, $db, $user, $auth, $template;
|
|
|
4c79b5 |
global $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Show restore permissions notice
|
|
|
4c79b5 |
if ($user->data['user_perm_from'] && $auth->acl_get('a_switchperm'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$this->tpl_name = 'acp_main';
|
|
|
4c79b5 |
$this->page_title = 'ACP_MAIN';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql = 'SELECT user_id, username, user_colour
|
|
|
4c79b5 |
FROM ' . USERS_TABLE . '
|
|
|
4c79b5 |
WHERE user_id = ' . $user->data['user_perm_from'];
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
$user_row = $db->sql_fetchrow($result);
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$perm_from = '<strong' . (($user_row['user_colour']) ? ' style="color: #' . $user_row['user_colour'] . '">' : '>');
|
|
|
4c79b5 |
$perm_from .= ($user_row['user_id'] != ANONYMOUS) ? '' : '';
|
|
|
4c79b5 |
$perm_from .= $user_row['username'];
|
|
|
4c79b5 |
$perm_from .= ($user_row['user_id'] != ANONYMOUS) ? '' : '';
|
|
|
4c79b5 |
$perm_from .= '';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_vars(array(
|
|
|
4c79b5 |
'S_RESTORE_PERMISSIONS' => true,
|
|
|
4c79b5 |
'U_RESTORE_PERMISSIONS' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=restore_perm'),
|
|
|
4c79b5 |
'PERM_FROM' => $perm_from,
|
|
|
4c79b5 |
'L_PERMISSIONS_TRANSFERRED_EXPLAIN' => sprintf($user->lang['PERMISSIONS_TRANSFERRED_EXPLAIN'], $perm_from, append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=restore_perm')),
|
|
|
4c79b5 |
));
|
|
|
4c79b5 |
|
|
|
4c79b5 |
return;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$action = request_var('action', '');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($action)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if ($action === 'admlogout')
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$user->unset_admin();
|
|
|
4c79b5 |
$redirect_url = append_sid("{$phpbb_root_path}index.$phpEx");
|
|
|
4c79b5 |
meta_refresh(3, $redirect_url);
|
|
|
4c79b5 |
trigger_error($user->lang['ADM_LOGGED_OUT'] . '
' . sprintf($user->lang['RETURN_INDEX'], '', ''));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!confirm_box(true))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
switch ($action)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
case 'online':
|
|
|
4c79b5 |
$confirm = true;
|
|
|
4c79b5 |
$confirm_lang = 'RESET_ONLINE_CONFIRM';
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
case 'stats':
|
|
|
4c79b5 |
$confirm = true;
|
|
|
4c79b5 |
$confirm_lang = 'RESYNC_STATS_CONFIRM';
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
case 'user':
|
|
|
4c79b5 |
$confirm = true;
|
|
|
4c79b5 |
$confirm_lang = 'RESYNC_POSTCOUNTS_CONFIRM';
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
case 'date':
|
|
|
4c79b5 |
$confirm = true;
|
|
|
4c79b5 |
$confirm_lang = 'RESET_DATE_CONFIRM';
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
case 'db_track':
|
|
|
4c79b5 |
$confirm = true;
|
|
|
4c79b5 |
$confirm_lang = 'RESYNC_POST_MARKING_CONFIRM';
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
case 'purge_cache':
|
|
|
4c79b5 |
$confirm = true;
|
|
|
4c79b5 |
$confirm_lang = 'PURGE_CACHE_CONFIRM';
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
default:
|
|
|
4c79b5 |
$confirm = true;
|
|
|
4c79b5 |
$confirm_lang = 'CONFIRM_OPERATION';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($confirm)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
confirm_box(false, $user->lang[$confirm_lang], build_hidden_fields(array(
|
|
|
4c79b5 |
'i' => $id,
|
|
|
4c79b5 |
'mode' => $mode,
|
|
|
4c79b5 |
'action' => $action,
|
|
|
4c79b5 |
)));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
switch ($action)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case 'online':
|
|
|
4c79b5 |
if (!$auth->acl_get('a_board'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
set_config('record_online_users', 1, true);
|
|
|
4c79b5 |
set_config('record_online_date', time(), true);
|
|
|
4c79b5 |
add_log('admin', 'LOG_RESET_ONLINE');
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case 'stats':
|
|
|
4c79b5 |
if (!$auth->acl_get('a_board'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql = 'SELECT COUNT(post_id) AS stat
|
|
|
4c79b5 |
FROM ' . POSTS_TABLE . '
|
|
|
4c79b5 |
WHERE post_approved = 1';
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
set_config('num_posts', (int) $db->sql_fetchfield('stat'), true);
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql = 'SELECT COUNT(topic_id) AS stat
|
|
|
4c79b5 |
FROM ' . TOPICS_TABLE . '
|
|
|
4c79b5 |
WHERE topic_approved = 1';
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
set_config('num_topics', (int) $db->sql_fetchfield('stat'), true);
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql = 'SELECT COUNT(user_id) AS stat
|
|
|
4c79b5 |
FROM ' . USERS_TABLE . '
|
|
|
4c79b5 |
WHERE user_type IN (' . USER_NORMAL . ',' . USER_FOUNDER . ')';
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
set_config('num_users', (int) $db->sql_fetchfield('stat'), true);
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql = 'SELECT COUNT(attach_id) as stat
|
|
|
4c79b5 |
FROM ' . ATTACHMENTS_TABLE . '
|
|
|
4c79b5 |
WHERE is_orphan = 0';
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
set_config('num_files', (int) $db->sql_fetchfield('stat'), true);
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql = 'SELECT SUM(filesize) as stat
|
|
|
4c79b5 |
FROM ' . ATTACHMENTS_TABLE . '
|
|
|
4c79b5 |
WHERE is_orphan = 0';
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
set_config('upload_dir_size', (float) $db->sql_fetchfield('stat'), true);
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!function_exists('update_last_username'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
include($phpbb_root_path . "includes/functions_user.$phpEx");
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
update_last_username();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
add_log('admin', 'LOG_RESYNC_STATS');
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case 'user':
|
|
|
4c79b5 |
if (!$auth->acl_get('a_board'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Resync post counts
|
|
|
4c79b5 |
$start = $max_post_id = 0;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Find the maximum post ID, we can only stop the cycle when we've reached it
|
|
|
4c79b5 |
$sql = 'SELECT MAX(forum_last_post_id) as max_post_id
|
|
|
4c79b5 |
FROM ' . FORUMS_TABLE;
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
$max_post_id = (int) $db->sql_fetchfield('max_post_id');
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// No maximum post id? :o
|
|
|
4c79b5 |
if (!$max_post_id)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$sql = 'SELECT MAX(post_id)
|
|
|
4c79b5 |
FROM ' . POSTS_TABLE;
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
$max_post_id = (int) $db->sql_fetchfield('max_post_id');
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Still no maximum post id? Then we are finished
|
|
|
4c79b5 |
if (!$max_post_id)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
add_log('admin', 'LOG_RESYNC_POSTCOUNTS');
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$step = ($config['num_posts']) ? (max((int) ($config['num_posts'] / 5), 20000)) : 20000;
|
|
|
4c79b5 |
$db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_posts = 0');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
while ($start < $max_post_id)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$sql = 'SELECT COUNT(post_id) AS num_posts, poster_id
|
|
|
4c79b5 |
FROM ' . POSTS_TABLE . '
|
|
|
4c79b5 |
WHERE post_id BETWEEN ' . ($start + 1) . ' AND ' . ($start + $step) . '
|
|
|
4c79b5 |
AND post_postcount = 1 AND post_approved = 1
|
|
|
4c79b5 |
GROUP BY poster_id';
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($row = $db->sql_fetchrow($result))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
do
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$sql = 'UPDATE ' . USERS_TABLE . " SET user_posts = user_posts + {$row['num_posts']} WHERE user_id = {$row['poster_id']}";
|
|
|
4c79b5 |
$db->sql_query($sql);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
while ($row = $db->sql_fetchrow($result));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$start += $step;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
add_log('admin', 'LOG_RESYNC_POSTCOUNTS');
|
|
|
4c79b5 |
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case 'date':
|
|
|
4c79b5 |
if (!$auth->acl_get('a_board'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
set_config('board_startdate', time() - 1);
|
|
|
4c79b5 |
add_log('admin', 'LOG_RESET_DATE');
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case 'db_track':
|
|
|
4c79b5 |
switch ($db->sql_layer)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
case 'sqlite':
|
|
|
4c79b5 |
case 'firebird':
|
|
|
4c79b5 |
$db->sql_query('DELETE FROM ' . TOPICS_POSTED_TABLE);
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
default:
|
|
|
4c79b5 |
$db->sql_query('TRUNCATE TABLE ' . TOPICS_POSTED_TABLE);
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// This can get really nasty... therefore we only do the last six months
|
|
|
4c79b5 |
$get_from_time = time() - (6 * 4 * 7 * 24 * 60 * 60);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Select forum ids, do not include categories
|
|
|
4c79b5 |
$sql = 'SELECT forum_id
|
|
|
4c79b5 |
FROM ' . FORUMS_TABLE . '
|
|
|
4c79b5 |
WHERE forum_type <> ' . FORUM_CAT;
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$forum_ids = array();
|
|
|
4c79b5 |
while ($row = $db->sql_fetchrow($result))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$forum_ids[] = $row['forum_id'];
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Any global announcements? ;)
|
|
|
4c79b5 |
$forum_ids[] = 0;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Now go through the forums and get us some topics...
|
|
|
4c79b5 |
foreach ($forum_ids as $forum_id)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$sql = 'SELECT p.poster_id, p.topic_id
|
|
|
4c79b5 |
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t
|
|
|
4c79b5 |
WHERE t.forum_id = ' . $forum_id . '
|
|
|
4c79b5 |
AND t.topic_moved_id = 0
|
|
|
4c79b5 |
AND t.topic_last_post_time > ' . $get_from_time . '
|
|
|
4c79b5 |
AND t.topic_id = p.topic_id
|
|
|
4c79b5 |
AND p.poster_id <> ' . ANONYMOUS . '
|
|
|
4c79b5 |
GROUP BY p.poster_id, p.topic_id';
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$posted = array();
|
|
|
4c79b5 |
while ($row = $db->sql_fetchrow($result))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$posted[$row['poster_id']][] = $row['topic_id'];
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$sql_ary = array();
|
|
|
4c79b5 |
foreach ($posted as $user_id => $topic_row)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
foreach ($topic_row as $topic_id)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$sql_ary[] = array(
|
|
|
4c79b5 |
'user_id' => (int) $user_id,
|
|
|
4c79b5 |
'topic_id' => (int) $topic_id,
|
|
|
4c79b5 |
'topic_posted' => 1,
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
unset($posted);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (sizeof($sql_ary))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$db->sql_multi_insert(TOPICS_POSTED_TABLE, $sql_ary);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
add_log('admin', 'LOG_RESYNC_POST_MARKING');
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
case 'purge_cache':
|
|
|
4c79b5 |
if ((int) $user->data['user_type'] !== USER_FOUNDER)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
global $cache;
|
|
|
4c79b5 |
$cache->purge();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Clear permissions
|
|
|
4c79b5 |
$auth->acl_clear_prefetch();
|
|
|
4c79b5 |
cache_moderators();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
add_log('admin', 'LOG_PURGE_CACHE');
|
|
|
4c79b5 |
break;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Get forum statistics
|
|
|
4c79b5 |
$total_posts = $config['num_posts'];
|
|
|
4c79b5 |
$total_topics = $config['num_topics'];
|
|
|
4c79b5 |
$total_users = $config['num_users'];
|
|
|
4c79b5 |
$total_files = $config['num_files'];
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$start_date = $user->format_date($config['board_startdate']);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$boarddays = (time() - $config['board_startdate']) / 86400;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$posts_per_day = sprintf('%.2f', $total_posts / $boarddays);
|
|
|
4c79b5 |
$topics_per_day = sprintf('%.2f', $total_topics / $boarddays);
|
|
|
4c79b5 |
$users_per_day = sprintf('%.2f', $total_users / $boarddays);
|
|
|
4c79b5 |
$files_per_day = sprintf('%.2f', $total_files / $boarddays);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$upload_dir_size = get_formatted_filesize($config['upload_dir_size']);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$avatar_dir_size = 0;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($avatar_dir = @opendir($phpbb_root_path . $config['avatar_path']))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
while (($file = readdir($avatar_dir)) !== false)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
if ($file[0] != '.' && $file != 'CVS' && strpos($file, 'index.') === false)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$avatar_dir_size += filesize($phpbb_root_path . $config['avatar_path'] . '/' . $file);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
closedir($avatar_dir);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$avatar_dir_size = get_formatted_filesize($avatar_dir_size);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
// Couldn't open Avatar dir.
|
|
|
4c79b5 |
$avatar_dir_size = $user->lang['NOT_AVAILABLE'];
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($posts_per_day > $total_posts)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$posts_per_day = $total_posts;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($topics_per_day > $total_topics)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$topics_per_day = $total_topics;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($users_per_day > $total_users)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$users_per_day = $total_users;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($files_per_day > $total_files)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$files_per_day = $total_files;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($config['allow_attachments'] || $config['allow_pm_attach'])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$sql = 'SELECT COUNT(attach_id) AS total_orphan
|
|
|
4c79b5 |
FROM ' . ATTACHMENTS_TABLE . '
|
|
|
4c79b5 |
WHERE is_orphan = 1
|
|
|
4c79b5 |
AND filetime < ' . (time() - 3*60*60);
|
|
|
4c79b5 |
$result = $db->sql_query($sql);
|
|
|
4c79b5 |
$total_orphan = (int) $db->sql_fetchfield('total_orphan');
|
|
|
4c79b5 |
$db->sql_freeresult($result);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$total_orphan = false;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$dbsize = get_database_size();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_vars(array(
|
|
|
4c79b5 |
'TOTAL_POSTS' => $total_posts,
|
|
|
4c79b5 |
'POSTS_PER_DAY' => $posts_per_day,
|
|
|
4c79b5 |
'TOTAL_TOPICS' => $total_topics,
|
|
|
4c79b5 |
'TOPICS_PER_DAY' => $topics_per_day,
|
|
|
4c79b5 |
'TOTAL_USERS' => $total_users,
|
|
|
4c79b5 |
'USERS_PER_DAY' => $users_per_day,
|
|
|
4c79b5 |
'TOTAL_FILES' => $total_files,
|
|
|
4c79b5 |
'FILES_PER_DAY' => $files_per_day,
|
|
|
4c79b5 |
'START_DATE' => $start_date,
|
|
|
4c79b5 |
'AVATAR_DIR_SIZE' => $avatar_dir_size,
|
|
|
4c79b5 |
'DBSIZE' => $dbsize,
|
|
|
4c79b5 |
'UPLOAD_DIR_SIZE' => $upload_dir_size,
|
|
|
4c79b5 |
'TOTAL_ORPHAN' => $total_orphan,
|
|
|
4c79b5 |
'S_TOTAL_ORPHAN' => ($total_orphan === false) ? false : true,
|
|
|
4c79b5 |
'GZIP_COMPRESSION' => ($config['gzip_compress']) ? $user->lang['ON'] : $user->lang['OFF'],
|
|
|
4c79b5 |
'DATABASE_INFO' => $db->sql_server_info(),
|
|
|
4c79b5 |
'BOARD_VERSION' => $config['version'],
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'U_ACTION' => $this->u_action,
|
|
|
4c79b5 |
'U_ADMIN_LOG' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=logs&mode=admin'),
|
|
|
4c79b5 |
'U_INACTIVE_USERS' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=inactive&mode=list'),
|
|
|
4c79b5 |
|
|
|
4c79b5 |
'S_ACTION_OPTIONS' => ($auth->acl_get('a_board')) ? true : false,
|
|
|
4c79b5 |
'S_FOUNDER' => ($user->data['user_type'] == USER_FOUNDER) ? true : false,
|
|
|
4c79b5 |
)
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$log_data = array();
|
|
|
4c79b5 |
$log_count = 0;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($auth->acl_get('a_viewlogs'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
view_log('admin', $log_data, $log_count, 5);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
foreach ($log_data as $row)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$template->assign_block_vars('log', array(
|
|
|
4c79b5 |
'USERNAME' => $row['username_full'],
|
|
|
4c79b5 |
'IP' => $row['ip'],
|
|
|
4c79b5 |
'DATE' => $user->format_date($row['time']),
|
|
|
4c79b5 |
'ACTION' => $row['action'])
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($auth->acl_get('a_user'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$inactive = array();
|
|
|
4c79b5 |
$inactive_count = 0;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
view_inactive_users($inactive, $inactive_count, 10);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
foreach ($inactive as $row)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$template->assign_block_vars('inactive', array(
|
|
|
4c79b5 |
'INACTIVE_DATE' => $user->format_date($row['user_inactive_time']),
|
|
|
4c79b5 |
'JOINED' => $user->format_date($row['user_regdate']),
|
|
|
4c79b5 |
'LAST_VISIT' => (!$row['user_lastvisit']) ? ' - ' : $user->format_date($row['user_lastvisit']),
|
|
|
4c79b5 |
'REASON' => $row['inactive_reason'],
|
|
|
4c79b5 |
'USER_ID' => $row['user_id'],
|
|
|
4c79b5 |
'USERNAME' => $row['username'],
|
|
|
4c79b5 |
'U_USER_ADMIN' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&mode=overview&u={$row['user_id']}"))
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$option_ary = array('activate' => 'ACTIVATE', 'delete' => 'DELETE');
|
|
|
4c79b5 |
if ($config['email_enable'])
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$option_ary += array('remind' => 'REMIND');
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_vars(array(
|
|
|
4c79b5 |
'S_INACTIVE_USERS' => true,
|
|
|
4c79b5 |
'S_INACTIVE_OPTIONS' => build_select($option_ary))
|
|
|
4c79b5 |
);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Warn if install is still present
|
|
|
4c79b5 |
if (file_exists($phpbb_root_path . 'install'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$template->assign_var('S_REMOVE_INSTALL', true);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (!defined('PHPBB_DISABLE_CONFIG_CHECK') && file_exists($phpbb_root_path . 'config.' . $phpEx) && is_writable($phpbb_root_path . 'config.' . $phpEx))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
// World-Writable? (000x)
|
|
|
4c79b5 |
$template->assign_var('S_WRITABLE_CONFIG', (bool) (@fileperms($phpbb_root_path . 'config.' . $phpEx) & 0x0002));
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$this->tpl_name = 'acp_main';
|
|
|
4c79b5 |
$this->page_title = 'ACP_MAIN';
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
?>
|