diff -r 000000000000 -r f9ffdbd96607 punbb/admin_index.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/punbb/admin_index.php Wed Jul 11 21:01:48 2007 -0400 @@ -0,0 +1,205 @@ + PUN_MOD) + message($lang_common['No permission']); + + +$action = isset($_GET['action']) ? $_GET['action'] : null; + +// Check for upgrade +if ($action == 'check_upgrade') +{ + if (!ini_get('allow_url_fopen')) + message('Unable to check for upgrade since \'allow_url_fopen\' is disabled on this system.'); + + $fp = @fopen('http://www.punbb.org/latest_version', 'r'); + $latest_version = trim(@fread($fp, 16)); + @fclose($fp); + + if ($latest_version == '') + message('Check for upgrade failed for unknown reasons.'); + + $cur_version = str_replace(array('.', 'dev', 'beta', ' '), '', strtolower($pun_config['o_cur_version'])); + $cur_version = (strlen($cur_version) == 2) ? intval($cur_version) * 10 : intval($cur_version); + + $latest_version = str_replace('.', '', strtolower($latest_version)); + $latest_version = (strlen($latest_version) == 2) ? intval($latest_version) * 10 : intval($latest_version); + + if ($cur_version >= $latest_version) + message('You are running the latest version of PunBB.'); + else + message('A new version of PunBB has been released. You can download the latest version at PunBB.org.'); +} + + +// Show phpinfo() output +else if ($action == 'phpinfo' && $pun_user['g_id'] == PUN_ADMIN) +{ + // Is phpinfo() a disabled function? + if (strpos(strtolower((string)@ini_get('disable_functions')), 'phpinfo') !== false) + message('The PHP function phpinfo() has been disabled on this server.'); + + phpinfo(); + exit; +} + + +// Get the server load averages (if possible) +if (@file_exists('/proc/loadavg') && is_readable('/proc/loadavg')) +{ + // We use @ just in case + $fh = @fopen('/proc/loadavg', 'r'); + $load_averages = @fread($fh, 64); + @fclose($fh); + + $load_averages = @explode(' ', $load_averages); + $server_load = isset($load_averages[2]) ? $load_averages[0].' '.$load_averages[1].' '.$load_averages[2] : 'Not available'; +} +else if (!in_array(PHP_OS, array('WINNT', 'WIN32')) && preg_match('/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/i', @exec('uptime'), $load_averages)) + $server_load = $load_averages[1].' '.$load_averages[2].' '.$load_averages[3]; +else + $server_load = 'Not available'; + + +// Get number of current visitors +$result = $db->query('SELECT COUNT(user_id) FROM '.$db->prefix.'online WHERE idle=0') or error('Unable to fetch online count', __FILE__, __LINE__, $db->error()); +$num_online = $db->result($result); + + +// Get the database system version +switch ($db_type) +{ + case 'sqlite': + $db_version = 'SQLite '.sqlite_libversion(); + break; + + default: + $result = $db->query('SELECT VERSION()') or error('Unable to fetch version info', __FILE__, __LINE__, $db->error()); + $db_version = $db->result($result); + break; +} + + +// Collect some additional info about MySQL +if ($db_type == 'mysql' || $db_type == 'mysqli') +{ + $db_version = 'MySQL '.$db_version; + + // Calculate total db size/row count + $result = $db->query('SHOW TABLE STATUS FROM `'.$db_name.'`') or error('Unable to fetch table status', __FILE__, __LINE__, $db->error()); + + $total_records = $total_size = 0; + while ($status = $db->fetch_assoc($result)) + { + $total_records += $status['Rows']; + $total_size += $status['Data_length'] + $status['Index_length']; + } + + $total_size = $total_size / 1024; + + if ($total_size > 1024) + $total_size = round($total_size / 1024, 2).' MB'; + else + $total_size = round($total_size, 2).' KB'; +} + + +// See if MMCache or PHPA is loaded +if (function_exists('mmcache')) + $php_accelerator = 'Turck MMCache'; +else if (isset($_PHPA)) + $php_accelerator = 'ionCube PHP Accelerator'; +else + $php_accelerator = 'N/A'; + + +$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin'; +require PUN_ROOT.'header.php'; + +generate_admin_menu('index'); + +?> +
+

Forum administration

+
+
+

+ Welcome to the PunBB administration control panel. From here you can control vital aspects of the forum. Depending on whether you are an administrator or a moderator you can

+  - organize categories and forums.
+  - set forum-wide options and preferences.
+  - control permissions for users and guests.
+  - view IP statistics for users.
+  - ban users.
+  - censor words.
+  - set up user ranks.
+  - prune old posts.
+  - handle post reports. +

+
+
+ +

Statistics

+
+
+
+
PunBB version
+
+ PunBB - Check for upgrade
+ © Copyright 2002, 2003, 2004, 2005 Rickard Andersson +
+
Server load
+
+ ( users online) +
+
Environment
+
+ Operating system:
+ PHP: - Show info
+ Accelerator: +
+
Database
+
+ +
Rows: +
Size: +
+
+
+
+
+
+ +