107 lines
4.4 KiB
PHP
107 lines
4.4 KiB
PHP
<?php global $lang, $session, $db, $error;
|
|
/**
|
|
* Project: BeCast WebEngine - simple site engine
|
|
* File: /admin/index.php
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*
|
|
* @link http://www.BeCast.at
|
|
* @copyright 2009-2025 becast.at
|
|
* @author Bernhard Jaud <bernhard at becast dot at>
|
|
* @package BeCast Webengine core
|
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
* @version $Id$
|
|
*/
|
|
ERROR_REPORTING(E_ALL ^E_NOTICE);
|
|
$basepath="";
|
|
$nav_include="../";
|
|
require_once dirname(__FILE__, 2) .'/core/init_core.inc.php';
|
|
$session->page_begin("Admincenter", True);
|
|
define("in_BL_ADMIN",TRUE);
|
|
|
|
function size_format($num, $prec = 2)
|
|
{
|
|
if ($num >= 1024000){
|
|
return number_format($num / 1048576, $prec) . ' MB';
|
|
}elseif ($num >= 1000){
|
|
return sprintf("%.{$prec}f KB", $num / 1024);
|
|
}else{
|
|
return $num . ' bytes';
|
|
}
|
|
}
|
|
if(isset($session->userdata['uid']) && $session->userdata['uid']!=0 && ($session->userdata["admin_cp"] && $session->userdata["is_admin"])){
|
|
require_once dirname(dirname(__FILE__)).'/inc/admin.class.php';
|
|
require_once dirname(dirname(__FILE__)).'/inc/panel.class.php';
|
|
$admin=new admin();
|
|
$panel=new panel();
|
|
$panel->menu_item("page_home",$lang->_('BACKTOPAGE'),"house");
|
|
$panel->menu_item("admin_home",$lang->_('ADMININDEX'),"layout");
|
|
$admin->create_admin_nav();
|
|
$panel->menu_item("group_only",$lang->_('NAVIGATION'));
|
|
$panel->menu_item("navigation",$lang->_('NAVIGATIONADMIN'),"table_multiple");
|
|
$panel->menu_item("group_only",$lang->_('USERADMIN'));
|
|
$panel->menu_item("adduser",$lang->_('ADDUSER'),"user_add");
|
|
$panel->menu_item("editusers",$lang->_('EDITUSER'),"user_edit");
|
|
$panel->menu_item("banips",$lang->_('IPBAN'),"disconnect");
|
|
$panel->menu_item("group_only",$lang->_('GROUPADMIN'));
|
|
$panel->menu_item("addgroup",$lang->_('ADDGROUP'),"group_add");
|
|
$panel->menu_item("editgroup",$lang->_('EDITGROUP'),"group_edit");
|
|
$panel->menu_item("group_only",$lang->_('CONFIG'));
|
|
$panel->menu_item("config",$lang->_('CONFIG'),"wrench");
|
|
$panel->menu_item("module",$lang->_('MODULES'),"bricks");
|
|
$panel->menu_item("versions",$lang->_('VERSION'),"shield_go");
|
|
if(isset($_GET["panel"])){
|
|
$admin->get_panel($_GET["panel"]);
|
|
}else{
|
|
$panel->content=$lang->_('STARTTEXT');
|
|
$panel->title=$lang->_('ADMINMENU');
|
|
$panel->content.='<table border="0" cellspacing="1" width="98%" cellpadding="5">
|
|
<tr><td colspan="5" style="font-weight:bold; text-align:center;">'.$lang->_('DATABASE').'</td></tr>
|
|
<tr><th>'.$lang->_('TABLE').'</th><th>'.$lang->_('ROWCOUNT').'</th><th>'.$lang->_('INDEXSIZE').'</th><th>'.$lang->_('DATASIZE').'</th><th>'.$lang->_('SUMSIZE').'</th></tr>';
|
|
|
|
|
|
$total_rows = 0;
|
|
$total_data = 0;
|
|
$total_index = 0;
|
|
|
|
// Table sizes
|
|
$result = $db->query("SHOW TABLE STATUS");
|
|
while ($row = $db->fetch_array($result))
|
|
{
|
|
$total_rows += $row['Rows'];
|
|
$total_data += $row['Data_length'];
|
|
$total_index += $row['Index_length'];
|
|
$rows = number_format($row['Rows']);
|
|
$data = size_format($row['Data_length']);
|
|
$index = size_format($row['Index_length']);
|
|
$total = size_format($row['Data_length'] + $row['Index_length']);
|
|
$panel->content.='<tr><td>'.$row["Name"].'</td><td align="right">'.$rows.'</td><td align="right">'.$index.'</td><td align="right">'.$data.'</td><td align="right">'.$total.'</td></tr>';
|
|
}
|
|
|
|
|
|
// Total
|
|
$rows = number_format($total_rows);
|
|
$data = size_format($total_data);
|
|
$index = size_format($total_index);
|
|
$total = size_format($total_data + $total_index);
|
|
$panel->content.='<tr style="font-weight:bold;"><td>Gesamt</td><td align="right">'.$rows.'</td><td align="right">'.$index.'</td><td align="right">'.$data.'</td><td align="right">'.$total.'</td></tr></table>';
|
|
$panel->parse_page();
|
|
}
|
|
|
|
}else{
|
|
return $error->http_error("404");
|
|
}
|
|
?>
|
|
|