author | Dan |
Sun, 06 Apr 2008 00:28:50 -0400 | |
changeset 7 | 98bbc533541c |
parent 6 | 5e1f1e916419 |
permissions | -rw-r--r-- |
6 | 1 |
<?php |
2 |
/*********************************************************************** |
|
3 |
||
4 |
Copyright (C) 2002-2008 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 |
// if (!defined('PUN_ROOT')) |
|
27 |
// define('PUN_ROOT', '../'); |
|
28 |
// require PUN_ROOT.'include/common.php'; |
|
29 |
require PUN_ROOT.'include/common_admin.php'; |
|
30 |
||
31 |
// import globals (I really hope this isn't dangerous) |
|
32 |
foreach ( $GLOBALS as $key => $_ ) |
|
33 |
{ |
|
34 |
$$key =& $GLOBALS[$key]; |
|
35 |
} |
|
36 |
||
37 |
$db_name =& $dbname; |
|
38 |
||
39 |
($hook = get_hook('ain_start')) ? eval($hook) : null; |
|
40 |
||
41 |
if (!$pun_user['is_admmod']) |
|
42 |
message($lang_common['No permission']); |
|
43 |
||
44 |
// Load the admin.php language file |
|
45 |
require PUN_ROOT.'lang/'.$pun_user['language'].'/admin.php'; |
|
46 |
$GLOBALS['lang_admin'] = $lang_admin; |
|
47 |
||
48 |
// Show phpinfo() output |
|
7
98bbc533541c
Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
6
diff
changeset
|
49 |
if (isset($_GET['action']) && $_GET['action'] == 'phpinfo' && $session->user_level >= USER_LEVEL_ADMIN) |
6 | 50 |
{ |
51 |
($hook = get_hook('ain_phpinfo_selected')) ? eval($hook) : null; |
|
52 |
||
53 |
// Is phpinfo() a disabled function? |
|
54 |
if (strpos(strtolower((string)@ini_get('disable_functions')), 'phpinfo') !== false) |
|
55 |
message($lang_admin['phpinfo disabled']); |
|
56 |
||
57 |
phpinfo(); |
|
58 |
exit; |
|
59 |
} |
|
60 |
||
61 |
||
62 |
// Generate check for updates text block |
|
63 |
if ($pun_config['o_check_for_updates'] == '1') |
|
64 |
$punbb_updates = $lang_admin['Check for updates enabled']; |
|
65 |
else |
|
66 |
{ |
|
67 |
// Get a list of installed hotfix extensions |
|
68 |
$query = array( |
|
69 |
'SELECT' => 'e.id', |
|
70 |
'FROM' => 'extensions AS e', |
|
71 |
'WHERE' => 'e.id LIKE \'hotfix_%\'' |
|
72 |
); |
|
73 |
||
74 |
($hook = get_hook('ain_qr_get_hotfixes')) ? eval($hook) : null; |
|
75 |
$result = $pun_db->query_build($query) or error(__FILE__, __LINE__); |
|
76 |
$num_hotfixes = $pun_db->num_rows($result); |
|
77 |
||
78 |
$hotfixes = array(); |
|
79 |
for ($i = 0; $i < $num_hotfixes; ++$i) |
|
80 |
$hotfixes[] = urlencode($pun_db->result($result, $i)); |
|
81 |
||
82 |
$punbb_updates = '<a href="http://punbb.org/update/?version='.urlencode($pun_config['o_cur_version']).'&hotfixes='.implode(',', $hotfixes).'">'.$lang_admin['Check for updates manual'].'</a>'; |
|
83 |
} |
|
84 |
||
85 |
||
86 |
// Get the server load averages (if possible) |
|
87 |
if (function_exists('sys_getloadavg')) |
|
88 |
{ |
|
89 |
$load_averages = sys_getloadavg(); |
|
90 |
array_walk($load_averages, create_function('&$v', '$v = round($v, 3);')); |
|
91 |
$server_load = $load_averages[0].' '.$load_averages[1].' '.$load_averages[2]; |
|
92 |
} |
|
93 |
else if (@file_exists('/proc/loadavg') && is_readable('/proc/loadavg')) |
|
94 |
{ |
|
95 |
// We use @ just in case |
|
96 |
$fh = @fopen('/proc/loadavg', 'r'); |
|
97 |
$load_averages = @fread($fh, 64); |
|
98 |
@fclose($fh); |
|
99 |
||
100 |
$load_averages = @explode(' ', $load_averages); |
|
101 |
$server_load = isset($load_averages[2]) ? $load_averages[0].' '.$load_averages[1].' '.$load_averages[2] : 'Not available'; |
|
102 |
} |
|
103 |
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)) |
|
104 |
$server_load = $load_averages[1].' '.$load_averages[2].' '.$load_averages[3]; |
|
105 |
else |
|
106 |
$server_load = $lang_admin['Not available']; |
|
107 |
||
108 |
||
109 |
// Get number of current visitors |
|
110 |
$query = array( |
|
111 |
'SELECT' => 'COUNT(o.user_id)', |
|
112 |
'FROM' => 'online AS o', |
|
113 |
'WHERE' => 'o.idle=0' |
|
114 |
); |
|
115 |
||
116 |
($hook = get_hook('ain_qr_get_users_online')) ? eval($hook) : null; |
|
117 |
$result = $pun_db->query_build($query) or error(__FILE__, __LINE__); |
|
118 |
$num_online = $pun_db->result($result); |
|
119 |
||
120 |
||
121 |
// Get the database system version |
|
122 |
switch ($db_type) |
|
123 |
{ |
|
124 |
case 'sqlite': |
|
125 |
$db_version = 'SQLite '.sqlite_libversion(); |
|
126 |
break; |
|
127 |
||
128 |
default: |
|
129 |
$result = $pun_db->query('SELECT VERSION()') or error(__FILE__, __LINE__); |
|
130 |
$db_version = $pun_db->result($result); |
|
131 |
break; |
|
132 |
} |
|
133 |
||
134 |
||
135 |
// Collect some additional info about MySQL |
|
136 |
if ($db_type == 'mysql' || $db_type == 'mysqli') |
|
137 |
{ |
|
138 |
$db_version = 'MySQL '.$db_version; |
|
139 |
||
140 |
// Calculate total db size/row count |
|
141 |
$result = $pun_db->query('SHOW TABLE STATUS FROM `'.$db_name.'` LIKE \''.$db_prefix.'%\'') or error(__FILE__, __LINE__); |
|
142 |
||
143 |
$total_records = $total_size = 0; |
|
144 |
while ($status = $pun_db->fetch_assoc($result)) |
|
145 |
{ |
|
146 |
$total_records += $status['Rows']; |
|
147 |
$total_size += $status['Data_length'] + $status['Index_length']; |
|
148 |
} |
|
149 |
||
150 |
$total_size = $total_size / 1024; |
|
151 |
||
152 |
if ($total_size > 1024) |
|
153 |
$total_size = round($total_size / 1024, 2).' MB'; |
|
154 |
else |
|
155 |
$total_size = round($total_size, 2).' KB'; |
|
156 |
} |
|
157 |
||
158 |
||
159 |
// Check for the existance of various PHP opcode caches/optimizers |
|
160 |
if (function_exists('mmcache')) |
|
161 |
$php_accelerator = '<a href="http://turck-mmcache.sourceforge.net/">Turck MMCache</a>'; |
|
162 |
else if (isset($_PHPA)) |
|
163 |
$php_accelerator = '<a href="http://www.php-accelerator.co.uk/">ionCube PHP Accelerator</a>'; |
|
164 |
else if (ini_get('apc.enabled')) |
|
165 |
$php_accelerator ='<a href="http://www.php.net/apc/">Alternative PHP Cache (APC)</a>'; |
|
166 |
else if (ini_get('zend_optimizer.optimization_level')) |
|
167 |
$php_accelerator = '<a href="http://www.zend.com/products/zend_optimizer/">Zend Optimizer</a>'; |
|
168 |
else if (ini_get('eaccelerator.enable')) |
|
169 |
$php_accelerator = '<a href="http://eaccelerator.net/">eAccelerator</a>'; |
|
170 |
else if (ini_get('xcache.cacher')) |
|
171 |
$php_accelerator = '<a href="http://trac.lighttpd.net/xcache/">XCache</a>'; |
|
172 |
else |
|
173 |
$php_accelerator = 'N/A'; |
|
174 |
||
175 |
$pun_page['item_num'] = 0; |
|
176 |
||
177 |
// Setup breadcrumbs |
|
178 |
$pun_page['crumbs'] = array( |
|
179 |
array($pun_config['o_board_title'], pun_link($pun_url['index'])), |
|
180 |
array($lang_admin['Forum administration'], pun_link($pun_url['admin_index'])), |
|
181 |
$lang_admin['Information'] |
|
182 |
); |
|
183 |
||
184 |
($hook = get_hook('ain_pre_header_load')) ? eval($hook) : null; |
|
185 |
||
186 |
define('PUN_PAGE_SECTION', 'start'); |
|
187 |
define('PUN_PAGE', 'admin-information'); |
|
188 |
require PUN_ROOT.'header.php'; |
|
189 |
||
190 |
?> |
|
191 |
<div id="pun-main" class="main sectioned admin"> |
|
192 |
||
193 |
<?php echo generate_admin_menu(); ?> |
|
194 |
||
195 |
<div class="main-head"> |
|
196 |
<h1><span>{ <?php echo end($pun_page['crumbs']) ?> }</span></h1> |
|
197 |
</div> |
|
198 |
||
199 |
<div class="main-content frm"> |
|
200 |
<div class="frm-head"> |
|
201 |
<h2><span><?php echo $lang_admin['Information head'] ?></span></h2> |
|
202 |
</div> |
|
203 |
<div class="frm-info"> |
|
204 |
<p><?php echo $lang_admin['Welcome info'] ?></p> |
|
205 |
</div> |
|
206 |
<div class="datagrid"> |
|
207 |
<?php ($hook = get_hook('ain_pre_version')) ? eval($hook) : null; ?> |
|
208 |
<div class="idx-item databox db<?php echo ++$pun_page['item_num']?>"> |
|
209 |
<h3 class="legend"><span><?php echo $lang_admin['PunBB version'] ?></span></h3> |
|
210 |
<ul class="data"> |
|
211 |
<li><span>PunBB <?php echo $pun_config['o_cur_version'] ?></span></li> |
|
212 |
<li><span>© Copyright 2002-2008 <a href="http://punbb.org/">PunBB.org</a></span></li> |
|
213 |
<li><span><?php echo $punbb_updates ?></span></li> |
|
214 |
</ul> |
|
215 |
</div> |
|
7
98bbc533541c
Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
6
diff
changeset
|
216 |
|
98bbc533541c
Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
6
diff
changeset
|
217 |
<div class="idx-item databox db<?php echo ++$pun_page['item_num']?>"> |
98bbc533541c
Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
6
diff
changeset
|
218 |
<h3 class="legend"><span><?php echo $lang_admin['Enano version'] ?></span></h3> |
98bbc533541c
Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
6
diff
changeset
|
219 |
<ul class="data"> |
98bbc533541c
Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
6
diff
changeset
|
220 |
<li><span><a href="<?php echo makeUrlNS('Special', 'About_Enano', false, true); ?>">Enano CMS</a> v<?php echo enano_version(true); ?></span></li> |
98bbc533541c
Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
6
diff
changeset
|
221 |
<li><span>© 2006-2008 Dan Fuhry and the <a href="http://enanocms.org/Enano_CMS:Team">Enano Team</a></span></li> |
98bbc533541c
Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
6
diff
changeset
|
222 |
</ul> |
98bbc533541c
Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
6
diff
changeset
|
223 |
</div> |
98bbc533541c
Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
6
diff
changeset
|
224 |
|
98bbc533541c
Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
6
diff
changeset
|
225 |
<div class="idx-item databox db<?php echo ++$pun_page['item_num']?>"> |
98bbc533541c
Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
6
diff
changeset
|
226 |
<h3 class="legend"><span><?php echo $lang_admin['PunBB port version'] ?></span></h3> |
98bbc533541c
Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
6
diff
changeset
|
227 |
<ul class="data"> |
98bbc533541c
Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
6
diff
changeset
|
228 |
<li><span>Punano Bridge <?php echo PUNANO_VERSION; ?></span></li> |
98bbc533541c
Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
6
diff
changeset
|
229 |
<li><span>© 2008 Dan Fuhry</span></li> |
98bbc533541c
Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
6
diff
changeset
|
230 |
</ul> |
98bbc533541c
Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
6
diff
changeset
|
231 |
</div> |
6 | 232 |
<?php ($hook = get_hook('ain_pre_server_load')) ? eval($hook) : null; ?> |
233 |
<div class="idx-item databox db<?php echo ++$pun_page['item_num']?>"> |
|
234 |
<h3 class="legend"><span><?php echo $lang_admin['Server load'] ?></span></h3> |
|
235 |
<p class="data"><?php echo $server_load ?> (<?php echo $num_online.' '.$lang_admin['users online']?>)</p> |
|
236 |
</div> |
|
7
98bbc533541c
Finishing re-add, addremove didn't work last time. Integrated with Enano's template engine properly.
Dan
parents:
6
diff
changeset
|
237 |
<?php ($hook = get_hook('ain_pre_environment')) ? eval($hook) : null; if ($session->user_level >= USER_LEVEL_ADMIN): ?> <div class="idx-item databox db<?php echo ++$pun_page['item_num']?>"> |
6 | 238 |
<h3 class="legend"><span><?php echo $lang_admin['Environment'] ?></span></h3> |
239 |
<ul class="data"> |
|
240 |
<li><span><?php echo $lang_admin['Operating system'] ?>: <?php echo PHP_OS ?></span></li> |
|
241 |
<li><span>PHP: <?php echo PHP_VERSION ?> - <a href="<?php echo pun_link($pun_url['admin_index']) ?>&action=phpinfo"><?php echo $lang_admin['Show info'] ?></a></span></li> |
|
242 |
<li><span><?php echo $lang_admin['Accelerator'] ?>: <?php echo $php_accelerator ?></span></li> |
|
243 |
</ul> |
|
244 |
</div> |
|
245 |
<?php ($hook = get_hook('ain_pre_database')) ? eval($hook) : null; ?> |
|
246 |
<div class="idx-item databox db<?php echo ++$pun_page['item_num']?>"> |
|
247 |
<h3 class="legend"><span><?php echo $lang_admin['Database'] ?></span></h3> |
|
248 |
<ul class="data"> |
|
249 |
<li><span><?php echo $db_version ?></span></li> |
|
250 |
<?php if (isset($total_records) && isset($total_size)): ?> <li><span><?php echo $lang_admin['Rows'] ?>: <?php echo $total_records ?></span></li> |
|
251 |
<li><span><?php echo $lang_admin['Size'] ?>: <?php echo $total_size ?></span></li> |
|
252 |
</ul> |
|
253 |
</div> |
|
254 |
<?php endif; endif; ($hook = get_hook('ain_items_end')) ? eval($hook) : null; ?> </div> |
|
255 |
</div> |
|
256 |
||
257 |
</div> |
|
258 |
<?php |
|
259 |
||
260 |
require PUN_ROOT.'footer.php'; |