~ubuntu-fr-forum-admins/ubuntu-fr-website/forum.prod

« back to all changes in this revision

Viewing changes to admin_index.php

  • Committer: xabilon
  • Date: 2010-10-08 13:18:35 UTC
  • Revision ID: xabilonmodo@yahoo.fr-20101008131835-i22ldl3u83y1t0di
Copie de forum.dev r155 pour mise en ligne

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?php
2
 
/***********************************************************************
3
 
 
4
 
  Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)
5
 
 
6
 
  This file is part of PunBB.
7
 
 
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.
12
 
 
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.
17
 
 
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,
21
 
  MA  02111-1307  USA
22
 
 
23
 
************************************************************************/
24
 
 
 
2
 
 
3
/**
 
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
 
7
 */
25
8
 
26
9
// Tell header.php to use the admin template
27
10
define('PUN_ADMIN_CONSOLE', 1);
31
14
require PUN_ROOT.'include/common_admin.php';
32
15
 
33
16
 
34
 
if ($pun_user['g_id'] > PUN_MOD)
 
17
if (!$pun_user['is_admmod'])
35
18
        message($lang_common['No permission']);
36
19
 
 
20
// Load the admin_index.php language file
 
21
require PUN_ROOT.'lang/'.$admin_language.'/admin_index.php';
37
22
 
38
23
$action = isset($_GET['action']) ? $_GET['action'] : null;
39
24
 
41
26
if ($action == 'check_upgrade')
42
27
{
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']);
45
30
 
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']);
49
34
 
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']);
52
37
        else
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>'));
54
39
}
55
40
 
56
41
 
58
43
else if ($action == 'phpinfo' && $pun_user['g_id'] == PUN_ADMIN)
59
44
{
60
45
        // Is phpinfo() a disabled function?
61
 
        if (strpos(strtolower((string)@ini_get('disable_functions')), 'phpinfo') !== false)
62
 
                message('The PHP function phpinfo() has been disabled on this server.');
 
46
        if (strpos(strtolower((string) ini_get('disable_functions')), 'phpinfo') !== false)
 
47
                message($lang_admin_index['PHPinfo disabled message']);
63
48
 
64
49
        phpinfo();
65
50
        exit;
74
59
        $load_averages = @fread($fh, 64);
75
60
        @fclose($fh);
76
61
 
 
62
        if (($fh = @fopen('/proc/loadavg', 'r')))
 
63
        {
 
64
                $load_averages = fread($fh, 64);
 
65
                fclose($fh);
 
66
        }
 
67
        else
 
68
                $load_averages = '';
 
69
 
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'];
79
72
}
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];
82
75
else
83
 
        $server_load = 'Not available';
 
76
        $server_load = $lang_admin_index['Not available'];
84
77
 
85
78
 
86
79
// Get number of current visitors
88
81
$num_online = $db->result($result);
89
82
 
90
83
 
91
 
// Get the database system version
92
 
switch ($db_type)
93
 
{
94
 
        case 'sqlite':
95
 
                $db_version = 'SQLite '.sqlite_libversion();
96
 
                break;
97
 
 
98
 
        default:
99
 
                $result = $db->query('SELECT VERSION()') or error('Unable to fetch version info', __FILE__, __LINE__, $db->error());
100
 
                $db_version = $db->result($result);
101
 
                break;
102
 
}
103
 
 
104
 
 
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')
107
86
{
108
 
        $db_version = 'MySQL '.$db_version;
109
 
 
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());
112
89
 
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'];
118
95
        }
119
96
 
120
 
        $total_size = $total_size / 1024;
121
 
 
122
 
        if ($total_size > 1024)
123
 
                $total_size = round($total_size / 1024, 2).' MB';
124
 
        else
125
 
                $total_size = round($total_size, 2).' KB';
 
97
        $total_size = file_size($total_size);
126
98
}
127
99
 
128
100
 
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>';
134
114
else
135
 
        $php_accelerator = 'N/A';
136
 
 
137
 
 
138
 
$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin';
 
115
        $php_accelerator = $lang_admin_index['NA'];
 
116
 
 
117
 
 
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';
140
121
 
141
122
generate_admin_menu('index');
142
123
 
143
124
?>
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">
148
129
                                <p>
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
 
                                        &nbsp;- organize categories and forums.<br />
151
 
                                        &nbsp;- set forum-wide options and preferences.<br />
152
 
                                        &nbsp;- control permissions for users and guests.<br />
153
 
                                        &nbsp;- view IP statistics for users.<br />
154
 
                                        &nbsp;- ban users.<br />
155
 
                                        &nbsp;- censor words.<br />
156
 
                                        &nbsp;- set up user ranks.<br />
157
 
                                        &nbsp;- prune old posts.<br />
158
 
                                        &nbsp;- handle post reports.
 
130
                                        <?php echo $lang_admin_index['Welcome to admin'] ?><br /><br />
 
131
                                        &#160;- <?php echo $lang_admin_index['Welcome 1'] ?><br />
 
132
                                        &#160;- <?php echo $lang_admin_index['Welcome 2'] ?><br />
 
133
                                        &#160;- <?php echo $lang_admin_index['Welcome 3'] ?><br />
 
134
                                        &#160;- <?php echo $lang_admin_index['Welcome 4'] ?><br />
 
135
                                        &#160;- <?php echo $lang_admin_index['Welcome 5'] ?><br />
 
136
                                        &#160;- <?php echo $lang_admin_index['Welcome 6'] ?><br />
 
137
                                        &#160;- <?php echo $lang_admin_index['Welcome 7'] ?><br />
 
138
                                        &#160;- <?php echo $lang_admin_index['Welcome 8'] ?><br />
 
139
                                        &#160;- <?php echo $lang_admin_index['Welcome 9'] ?>
159
140
                                </p>
160
141
                        </div>
161
142
                </div>
162
143
 
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">
166
147
                                <dl>
167
 
                                        <dt>FluxBB version</dt>
168
 
                                        <dd>
169
 
                                                FluxBB <?php echo $pun_config['o_cur_version'] ?> - <a href="admin_index.php?action=check_upgrade">Check for upgrade</a><br />
170
 
                                        </dd>
171
 
                                        <dt>Server load</dt>
172
 
                                        <dd>
173
 
                                                <?php echo $server_load ?> (<?php echo $num_online ?> users online)
174
 
                                        </dd>
175
 
<?php if ($pun_user['g_id'] == PUN_ADMIN): ?>                                   <dt>Environment</dt>
176
 
                                        <dd>
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" ?>
180
 
                                        </dd>
181
 
                                        <dt>Database</dt>
182
 
                                        <dd>
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>
 
149
                                        <dd>
 
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 />
 
151
                                        </dd>
 
152
                                        <dt><?php echo $lang_admin_index['Server load label'] ?></dt>
 
153
                                        <dd>
 
154
                                                <?php printf($lang_admin_index['Server load data'], $server_load, $num_online) ?>
 
155
                                        </dd>
 
156
<?php if ($pun_user['g_id'] == PUN_ADMIN): ?>                                   <dt><?php echo $lang_admin_index['Environment label'] ?></dt>
 
157
                                        <dd>
 
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) ?>
 
161
                                        </dd>
 
162
                                        <dt><?php echo $lang_admin_index['Database label'] ?></dt>
 
163
                                        <dd>
 
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>
187
168
                                </dl>
188
169
                        </div>