Commit | Line | Data |
---|---|---|
c495c100 P |
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 | ||
25 | ||
26 | // Tell header.php to use the admin template | |
27 | define('PUN_ADMIN_CONSOLE', 1); | |
28 | ||
29 | define('PUN_ROOT', './'); | |
30 | require PUN_ROOT.'include/common.php'; | |
31 | require PUN_ROOT.'include/common_admin.php'; | |
32 | ||
33 | ||
34 | if ($pun_user['g_id'] > PUN_MOD) | |
35 | message($lang_common['No permission']); | |
36 | ||
37 | ||
38 | $action = isset($_GET['action']) ? $_GET['action'] : null; | |
39 | ||
40 | // Check for upgrade | |
41 | if ($action == 'check_upgrade') | |
42 | { | |
43 | if (!ini_get('allow_url_fopen')) | |
44 | message('Impossible de vérifier les mises à jour tant que \'allow_url_fopen\' est désactivé sur ce système.'); | |
45 | ||
46 | $latest_version = trim(@file_get_contents('http://fluxbb.org/latest_version')); | |
47 | if (empty($latest_version)) | |
48 | message('La vérification de mise à jour a échouée pour une raison inconnue.'); | |
49 | ||
50 | if (version_compare($pun_config['o_cur_version'], $latest_version, '>=')) | |
51 | message('Vous utilisez la dernière version de FluxBB.'); | |
52 | else | |
53 | message('Une nouvelle version de FluxBB est disponible ! Vous pouvez télécharger cette dernière version sur <a href="http://fluxbb.org/">FluxBB.org</a>.'); | |
54 | } | |
55 | ||
56 | // Check for french upgrade | |
57 | if ($action == 'check_upgrade_fr') | |
58 | { | |
59 | if (!ini_get('allow_url_fopen')) | |
60 | message('Impossible de vérifier les mises à jour tant que \'allow_url_fopen\' est désactivé sur ce système.'); | |
61 | ||
62 | $latest_version = trim(@file_get_contents('http://www.fluxbb.fr/latest_version')); | |
63 | if (empty($latest_version)) | |
64 | message('La vérification de mise à jour a échouée pour une raison inconnue.'); | |
65 | ||
66 | if (version_compare($pun_config['o_cur_version_fr'], $latest_version, '>=')) | |
67 | message('Vous utilisez la dernière version de FluxBB en français.'); | |
68 | else | |
69 | message('Une nouvelle version de FluxBB en français est disponible ! Vous pouvez télécharger cette dernière version sur <a href="http://www.fluxbb.fr/">FluxBB.fr</a>.'); | |
70 | } | |
71 | ||
72 | ||
73 | // Show phpinfo() output | |
74 | else if ($action == 'phpinfo' && $pun_user['g_id'] == PUN_ADMIN) | |
75 | { | |
76 | // Is phpinfo() a disabled function? | |
77 | if (strpos(strtolower((string)@ini_get('disable_functions')), 'phpinfo') !== false) | |
78 | message('La fonction phpinfo() de PHP est désactivée sur ce serveur.'); | |
79 | ||
80 | phpinfo(); | |
81 | exit; | |
82 | } | |
83 | ||
84 | ||
85 | // Get the server load averages (if possible) | |
86 | if (@file_exists('/proc/loadavg') && is_readable('/proc/loadavg')) | |
87 | { | |
88 | // We use @ just in case | |
89 | $fh = @fopen('/proc/loadavg', 'r'); | |
90 | $load_averages = @fread($fh, 64); | |
91 | @fclose($fh); | |
92 | ||
93 | $load_averages = @explode(' ', $load_averages); | |
94 | $server_load = isset($load_averages[2]) ? $load_averages[0].' '.$load_averages[1].' '.$load_averages[2] : 'Indisponible'; | |
95 | } | |
96 | 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)) | |
97 | $server_load = $load_averages[1].' '.$load_averages[2].' '.$load_averages[3]; | |
98 | else | |
99 | $server_load = 'Indisponible'; | |
100 | ||
101 | ||
102 | // Get number of current visitors | |
103 | $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()); | |
104 | $num_online = $db->result($result); | |
105 | ||
106 | ||
107 | // Get the database system version | |
108 | switch ($db_type) | |
109 | { | |
110 | case 'sqlite': | |
111 | $db_version = 'SQLite '.sqlite_libversion(); | |
112 | break; | |
113 | ||
114 | default: | |
115 | $result = $db->query('SELECT VERSION()') or error('Unable to fetch version info', __FILE__, __LINE__, $db->error()); | |
116 | $db_version = $db->result($result); | |
117 | break; | |
118 | } | |
119 | ||
120 | ||
121 | // Collect some additional info about MySQL | |
122 | if ($db_type == 'mysql' || $db_type == 'mysqli') | |
123 | { | |
124 | $db_version = 'MySQL '.$db_version; | |
125 | ||
126 | // Calculate total db size/row count | |
127 | $result = $db->query('SHOW TABLE STATUS FROM `'.$db_name.'`') or error('Unable to fetch table status', __FILE__, __LINE__, $db->error()); | |
128 | ||
129 | $total_records = $total_size = 0; | |
130 | while ($status = $db->fetch_assoc($result)) | |
131 | { | |
132 | $total_records += $status['Rows']; | |
133 | $total_size += $status['Data_length'] + $status['Index_length']; | |
134 | } | |
135 | ||
136 | $total_size = $total_size / 1024; | |
137 | ||
138 | if ($total_size > 1024) | |
139 | $total_size = round($total_size / 1024, 2).' MB'; | |
140 | else | |
141 | $total_size = round($total_size, 2).' KB'; | |
142 | } | |
143 | ||
144 | ||
145 | // See if MMCache or PHPA is loaded | |
146 | if (function_exists('mmcache')) | |
147 | $php_accelerator = '<a href="http://turck-mmcache.sourceforge.net/">Turck MMCache</a>'; | |
148 | else if (isset($_PHPA)) | |
149 | $php_accelerator = '<a href="http://www.php-accelerator.co.uk/">ionCube PHP Accelerator</a>'; | |
150 | else | |
151 | $php_accelerator = 'N/A'; | |
152 | ||
153 | ||
154 | $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin'; | |
155 | require PUN_ROOT.'header.php'; | |
156 | ||
157 | generate_admin_menu('index'); | |
158 | ||
159 | ?> | |
160 | <div class="block"> | |
161 | <h2>Administration Forum</h2> | |
162 | <div id="adintro" class="box"> | |
163 | <div class="inbox"> | |
164 | <p>Bienvenue sur le panneau de contrôles de FluxBB. Depuis cet espace vous pouvez contrôler les points essentiels de votre forum. Selon que vous êtes un administrateur ou un modérateur vous pouvez :<br /><br /> | |
165 | - organiser les catégories et les forums.<br /> | |
166 | - régler les principales options et préférences.<br /> | |
167 | - contrôler les permissions pour les utilisateurs et les visiteurs.<br /> | |
168 | - voir les statistiques des IP pour les utilisateurs.<br /> | |
169 | - bannir des utilisateurs.<br /> | |
170 | - censurer des mots.<br /> | |
171 | - régler les rangs des utilisateurs.<br /> | |
172 | - élaguer les anciens messages.<br /> | |
173 | - traiter les messages signalés. | |
174 | </p> | |
175 | </div> | |
176 | </div> | |
177 | ||
178 | <h2 class="block2"><span>Statistiques</span></h2> | |
179 | <div id="adstats" class="box"> | |
180 | <div class="inbox"> | |
181 | <dl> | |
182 | <dt>Version FluxBB</dt> | |
183 | <dd> | |
184 | FluxBB version française <?php echo $pun_config['o_cur_version_fr'] ?> basée sur FluxBB <?php echo $pun_config['o_cur_version'] ?><br /> | |
185 | <a href="admin_index.php?action=check_upgrade">Vérifier la version officielle</a> - <a href="admin_index.php?action=check_upgrade_fr">Vérifier la version française</a> | |
186 | </dd> | |
187 | <dt>Exécution serveur</dt> | |
188 | <dd> | |
189 | <?php echo $server_load ?> (<?php echo $num_online ?> utilisateurs en ligne) | |
190 | </dd> | |
191 | <?php if ($pun_user['g_id'] == PUN_ADMIN): ?> <dt>Environnement</dt> | |
192 | <dd> | |
193 | Système d'exploitation : <?php echo PHP_OS ?><br /> | |
194 | PHP : <?php echo phpversion() ?> - <a href="admin_index.php?action=phpinfo">Afficher infos</a><br /> | |
195 | Accélérateur PHP : <?php echo $php_accelerator."\n" ?> | |
196 | </dd> | |
197 | <dt>Base de données</dt> | |
198 | <dd> | |
199 | <?php echo $db_version."\n" ?> | |
200 | <?php if (isset($total_records) && isset($total_size)): ?> <br />Lignes : <?php echo $total_records."\n" ?> | |
201 | <br />Taille : <?php echo $total_size."\n" ?> | |
202 | <?php endif; endif; ?> </dd> | |
203 | </dl> | |
204 | </div> | |
205 | </div> | |
206 | </div> | |
207 | <div class="clearer"></div> | |
208 | </div> | |
209 | <?php | |
210 | ||
211 | require PUN_ROOT.'footer.php'; |