2
/***********************************************************************
4
Copyright (C) 2002-2005 Rickard Andersson (rickard@punbb.org)
6
This file is part of PunBB.
8
PunBB is free software; you can redistribute it and/or modify it
9
under the terms of the GNU General Public License as published
10
by the Free Software Foundation; either version 2 of the License,
11
or (at your option) any later version.
13
PunBB is distributed in the hope that it will be useful, but
14
WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
GNU General Public License for more details.
18
You should have received a copy of the GNU General Public License
19
along with this program; if not, write to the Free Software
20
Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23
************************************************************************/
4
* Copyright (C) 2008-2010 FluxBB
5
* based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
6
* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
26
9
// Tell header.php to use the admin template
27
10
define('PUN_ADMIN_CONSOLE', 1);
41
26
if ($action == 'check_upgrade')
43
28
if (!ini_get('allow_url_fopen'))
44
message('Unable to check for upgrade since \'allow_url_fopen\' is disabled on this system.');
29
message($lang_admin_index['fopen disabled message']);
46
31
$latest_version = trim(@file_get_contents('http://fluxbb.org/latest_version'));
47
32
if (empty($latest_version))
48
message('Check for upgrade failed for unknown reasons.');
33
message($lang_admin_index['Upgrade check failed message']);
50
35
if (version_compare($pun_config['o_cur_version'], $latest_version, '>='))
51
message('You are running the latest version of FluxBB.');
36
message($lang_admin_index['Running latest version message']);
53
message('A new version of FluxBB has been released. You can download the latest version at <a href="http://fluxbb.org/">FluxBB.org</a>.');
38
message(sprintf($lang_admin_index['New version available message'], '<a href="http://fluxbb.org/">FluxBB.org</a>'));
74
59
$load_averages = @fread($fh, 64);
62
if (($fh = @fopen('/proc/loadavg', 'r')))
64
$load_averages = fread($fh, 64);
77
70
$load_averages = @explode(' ', $load_averages);
78
$server_load = isset($load_averages[2]) ? $load_averages[0].' '.$load_averages[1].' '.$load_averages[2] : 'Not available';
71
$server_load = isset($load_averages[2]) ? $load_averages[0].' '.$load_averages[1].' '.$load_averages[2] : $lang_admin_index['Not available'];
80
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))
73
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))
81
74
$server_load = $load_averages[1].' '.$load_averages[2].' '.$load_averages[3];
83
$server_load = 'Not available';
76
$server_load = $lang_admin_index['Not available'];
86
79
// Get number of current visitors
88
81
$num_online = $db->result($result);
91
// Get the database system version
95
$db_version = 'SQLite '.sqlite_libversion();
99
$result = $db->query('SELECT VERSION()') or error('Unable to fetch version info', __FILE__, __LINE__, $db->error());
100
$db_version = $db->result($result);
105
84
// Collect some additional info about MySQL
106
if ($db_type == 'mysql' || $db_type == 'mysqli')
85
if ($db_type == 'mysql' || $db_type == 'mysqli' || $db_type == 'mysql_innodb' || $db_type == 'mysqli_innodb')
108
$db_version = 'MySQL '.$db_version;
110
87
// Calculate total db size/row count
111
$result = $db->query('SHOW TABLE STATUS FROM `'.$db_name.'`') or error('Unable to fetch table status', __FILE__, __LINE__, $db->error());
88
$result = $db->query('SHOW TABLE STATUS LIKE \''.$db->prefix.'%\'') or error('Unable to fetch table status', __FILE__, __LINE__, $db->error());
113
90
$total_records = $total_size = 0;
114
91
while ($status = $db->fetch_assoc($result))
117
94
$total_size += $status['Data_length'] + $status['Index_length'];
120
$total_size = $total_size / 1024;
122
if ($total_size > 1024)
123
$total_size = round($total_size / 1024, 2).' MB';
125
$total_size = round($total_size, 2).' KB';
97
$total_size = file_size($total_size);
129
// See if MMCache or PHPA is loaded
101
// Check for the existence of various PHP opcode caches/optimizers
130
102
if (function_exists('mmcache'))
131
$php_accelerator = '<a href="http://turck-mmcache.sourceforge.net/">Turck MMCache</a>';
103
$php_accelerator = '<a href="http://'.$lang_admin_index['Turck MMCache link'].'">'.$lang_admin_index['Turck MMCache'].'</a>';
132
104
else if (isset($_PHPA))
133
$php_accelerator = '<a href="http://www.php-accelerator.co.uk/">ionCube PHP Accelerator</a>';
105
$php_accelerator = '<a href="http://'.$lang_admin_index['ionCube PHP Accelerator link'].'">'.$lang_admin_index['ionCube PHP Accelerator'].'</a>';
106
else if (ini_get('apc.enabled'))
107
$php_accelerator ='<a href="http://'.$lang_admin_index['Alternative PHP Cache (APC) link'].'">'.$lang_admin_index['Alternative PHP Cache (APC)'].'</a>';
108
else if (ini_get('zend_optimizer.optimization_level'))
109
$php_accelerator = '<a href="http://'.$lang_admin_index['Zend Optimizer link'].'">'.$lang_admin_index['Zend Optimizer'].'</a>';
110
else if (ini_get('eaccelerator.enable'))
111
$php_accelerator = '<a href="http://'.$lang_admin_index['eAccelerator link'].'">'.$lang_admin_index['eAccelerator'].'</a>';
112
else if (ini_get('xcache.cacher'))
113
$php_accelerator = '<a href="http://'.$lang_admin_index['XCache link'].'">'.$lang_admin_index['XCache'].'</a>';
135
$php_accelerator = 'N/A';
138
$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin';
115
$php_accelerator = $lang_admin_index['NA'];
118
$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Index']);
119
define('PUN_ACTIVE_PAGE', 'admin');
139
120
require PUN_ROOT.'header.php';
141
122
generate_admin_menu('index');
144
125
<div class="block">
145
<h2>Forum administration</h2>
126
<h2><span><?php echo $lang_admin_index['Forum admin head'] ?></span></h2>
146
127
<div id="adintro" class="box">
147
128
<div class="inbox">
149
Welcome to the FluxBB 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<br /><br />
150
- organize categories and forums.<br />
151
- set forum-wide options and preferences.<br />
152
- control permissions for users and guests.<br />
153
- view IP statistics for users.<br />
154
- ban users.<br />
155
- censor words.<br />
156
- set up user ranks.<br />
157
- prune old posts.<br />
158
- handle post reports.
130
<?php echo $lang_admin_index['Welcome to admin'] ?><br /><br />
131
 - <?php echo $lang_admin_index['Welcome 1'] ?><br />
132
 - <?php echo $lang_admin_index['Welcome 2'] ?><br />
133
 - <?php echo $lang_admin_index['Welcome 3'] ?><br />
134
 - <?php echo $lang_admin_index['Welcome 4'] ?><br />
135
 - <?php echo $lang_admin_index['Welcome 5'] ?><br />
136
 - <?php echo $lang_admin_index['Welcome 6'] ?><br />
137
 - <?php echo $lang_admin_index['Welcome 7'] ?><br />
138
 - <?php echo $lang_admin_index['Welcome 8'] ?><br />
139
 - <?php echo $lang_admin_index['Welcome 9'] ?>
163
<h2 class="block2"><span>Statistics</span></h2>
144
<h2 class="block2"><span><?php echo $lang_admin_index['Statistics head'] ?></span></h2>
164
145
<div id="adstats" class="box">
165
146
<div class="inbox">
167
<dt>FluxBB version</dt>
169
FluxBB <?php echo $pun_config['o_cur_version'] ?> - <a href="admin_index.php?action=check_upgrade">Check for upgrade</a><br />
173
<?php echo $server_load ?> (<?php echo $num_online ?> users online)
175
<?php if ($pun_user['g_id'] == PUN_ADMIN): ?> <dt>Environment</dt>
177
Operating system: <?php echo PHP_OS ?><br />
178
PHP: <?php echo phpversion() ?> - <a href="admin_index.php?action=phpinfo">Show info</a><br />
179
Accelerator: <?php echo $php_accelerator."\n" ?>
183
<?php echo $db_version."\n" ?>
184
<?php if (isset($total_records) && isset($total_size)): ?> <br />Rows: <?php echo $total_records."\n" ?>
185
<br />Size: <?php echo $total_size."\n" ?>
148
<dt><?php echo $lang_admin_index['FluxBB version label'] ?></dt>
150
<?php printf($lang_admin_index['FluxBB version data'], $pun_config['o_cur_version'], '<a href="admin_index.php?action=check_upgrade">'.$lang_admin_index['Check for upgrade'].'</a>') ?><br />
152
<dt><?php echo $lang_admin_index['Server load label'] ?></dt>
154
<?php printf($lang_admin_index['Server load data'], $server_load, $num_online) ?>
156
<?php if ($pun_user['g_id'] == PUN_ADMIN): ?> <dt><?php echo $lang_admin_index['Environment label'] ?></dt>
158
<?php printf($lang_admin_index['Environment data OS'], PHP_OS) ?><br />
159
<?php printf($lang_admin_index['Environment data version'], phpversion(), '<a href="admin_index.php?action=phpinfo">'.$lang_admin_index['Show info'].'</a>') ?><br />
160
<?php printf($lang_admin_index['Environment data acc'], $php_accelerator) ?>
162
<dt><?php echo $lang_admin_index['Database label'] ?></dt>
164
<?php echo implode(' ', $db->get_version())."\n" ?>
165
<?php if (isset($total_records) && isset($total_size)): ?> <br /><?php printf($lang_admin_index['Database data rows'], forum_number_format($total_records)) ?>
166
<br /><?php printf($lang_admin_index['Database data size'], $total_size) ?>
186
167
<?php endif; endif; ?> </dd>