sibtracker/system/inc/main.php

232 lines
8.6 KiB
PHP
Raw Permalink Normal View History

2019-05-18 13:46:03 +08:00
<?PHP
if( !defined( 'DATALIFEENGINE' ) OR !defined( 'LOGGED_IN' ) ) {
die( "Hacking attempt!" );
}
echoheader( "home", "" );
if( $_GET['action'] == "clearsubscribe" ) {
$db->query("TRUNCATE TABLE " . PREFIX . "_subscribe");
}
if( $_GET['action'] == "clear" ) {
$cache->delete('usergroup.php' );
$cache->delete('category.php' );
$cache->delete('banned.php' );
$cache->delete('cron.php' );
$cache->clear();
}
$row = $db->super_query( "SELECT COUNT(*) as count FROM " . PREFIX . "_post" );
$stats_news = $row['count'];
$row = $db->super_query( "SELECT COUNT(*) as count FROM " . PREFIX . "_subscribe" );
$count_subscribe = $row['count'];
$row = $db->super_query( "SELECT COUNT(*) as count FROM " . PREFIX . "_comments" );
$count_comments = $row['count'];
$row = $db->super_query( "SELECT COUNT(*) as count FROM " . USERPREFIX . "_users" );
$stats_users = $row['count'];
$row = $db->super_query( "SELECT COUNT(*) as count FROM " . USERPREFIX . "_users where banned='yes'" );
$stats_banned = $row['count'];
if ($stats_banned) $stats_banned = "( <font color=\"red\">{$stats_banned}</font> )";
else $stats_banned = "";
$row = $db->super_query( "SELECT COUNT(*) as count FROM " . PREFIX . "_post where approve = '0'" );
$approve = $row['count'];
if( $approve and $user_group[$member_id['user_group']]['allow_all_edit'] ) {
$approve = "( <b>" .$approve . "</b> ) [ <a href=\"?mod=editnews&action=list&news_status=2\">{$lang['stat_medit_link']}</a> ]";
} else {$approve = "";}
$db->query( "SHOW TABLE STATUS FROM `" . DBNAME . "`" );
$mysql_size = 0;
while ( $r = $db->get_array() ) {
if( strpos( $r['Name'], PREFIX . "_" ) !== false ) $mysql_size += $r['Data_length'] + $r['Index_length'];
}
$db->free();
$mysql_size = mksize( $mysql_size );
$cache_size = mksize( $cache->size() );
$dts = @disk_total_space(".");
$dfs = @disk_free_space(".");
$totalspace = mksize($dts);
$freespace = mksize($dfs);
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$winstats = shell_exec("net statistics server");
preg_match("(\d{1,2}/\d{1,2}/\d{4}\s+\d{1,2}\:\d{2}\s+\w{2})", $winstats, $matches);
$uptimeSecs = time() - strtotime($matches[0]);
$uptime = format_uptime($uptimeSecs);
} else {
/*$data = shell_exec('uptime');
$uptime = explode(' up ', $data);
$uptime = explode(',', $uptime[1]);
$uptime = $uptime[0].', '.$uptime[1];*/
$uptime = exec("cat /proc/uptime");
$uptime = split(" ",$uptime);
$uptimeSecs = $uptime[0];
$uptime = format_uptime($uptimeSecs);
}
if( $member_id['user_group'] == 1 ) {
echo <<<HTML
<div style="padding-top:5px;padding-bottom:2px;">
<table width="100%">
<tr>
<td width="4"><img src="system/skins/images/tl_lo.gif" width="4" height="4" border="0"></td>
<td background="system/skins/images/tl_oo.gif"><img src="system/skins/images/tl_oo.gif" width="1" height="4" border="0"></td>
<td width="6"><img src="system/skins/images/tl_ro.gif" width="6" height="4" border="0"></td>
</tr>
<tr>
<td background="system/skins/images/tl_lb.gif"><img src="system/skins/images/tl_lb.gif" width="4" height="1" border="0"></td>
<td style="padding:5px;" bgcolor="#FFFFFF">
<table width="100%">
<tr>
<td bgcolor="#EFEFEF" height="29" style="padding-left:10px;"><div class="navigation">{$lang['main_quick']}</div></td>
</tr>
</table>
<div class="unterline"></div>
<table width="100%">
<tr>
<td>
<table width="100%">
<tr>
<td width="70" height="70" valign="middle" align="center" style="padding-top:5px;padding-bottom:5px;"><img src="system/skins/images/tools.png" border="0"></td>
<td valign="middle"><div class="quick"><a href="$PHP_SELF?mod=options&action=syscon"><h3>{$lang['opt_all']}</h3>{$lang['opt_allc']}</a></div></td>
</tr>
</table>
</td>
<td>
<table width="100%">
<tr>
<td width="70" height="70" valign="middle" align="center" style="padding-top:5px;padding-bottom:5px;"><img src="system/skins/images/nset.png" border="0"></td>
<td valign="middle"><div class="quick"><a href="$PHP_SELF?mod=newsletter"><h3>{$lang['main_newsl']}</h3>{$lang['main_newslc']}</a></div></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%">
<tr>
<td width="70" height="70" valign="middle" align="center" style="padding-top:5px;padding-bottom:5px;"><img src="system/skins/images/spset.png" border="0"></td>
<td valign="middle"><div class="quick"><a href="$PHP_SELF?mod=static"><h3>{$lang['opt_static']}</h3>{$lang['opt_staticd']}</a></div></td>
</tr>
</table>
</td>
<td>
<table width="100%">
<tr>
<td width="70" height="70" valign="middle" align="center" style="padding-top:5px;padding-bottom:5px;"><img src="system/skins/images/clean.png" border="0"></td>
<td valign="middle"><div class="quick"><a href="$PHP_SELF?mod=clean"><h3>{$lang['opt_clean']}</h3>{$lang['opt_cleanc']}</a></div></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td background="system/skins/images/tl_rb.gif"><img src="system/skins/images/tl_rb.gif" width="6" height="1" border="0"></td>
</tr>
<tr>
<td><img src="system/skins/images/tl_lu.gif" width="4" height="6" border="0"></td>
<td background="system/skins/images/tl_ub.gif"><img src="system/skins/images/tl_ub.gif" width="1" height="6" border="0"></td>
<td><img src="system/skins/images/tl_ru.gif" width="6" height="6" border="0"></td>
</tr>
</table>
</div>
HTML;
} else {
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}
echo <<<HTML
<div style="padding-top:5px;padding-bottom:2px;">
<table width="100%">
<tr>
<td width="4"><img src="system/skins/images/tl_lo.gif" width="4" height="4" border="0"></td>
<td background="system/skins/images/tl_oo.gif"><img src="system/skins/images/tl_oo.gif" width="1" height="4" border="0"></td>
<td width="6"><img src="system/skins/images/tl_ro.gif" width="6" height="4" border="0"></td>
</tr>
<tr>
<td background="system/skins/images/tl_lb.gif"><img src="system/skins/images/tl_lb.gif" width="4" height="1" border="0"></td>
<td style="padding:5px;" bgcolor="#FFFFFF">
<table width="100%">
<tr>
<td bgcolor="#EFEFEF" height="29" style="padding-left:10px;"><div class="navigation" id="main_title"><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></div></td>
</tr>
</table>
<div class="unterline"></div>
<div id="main_box"><table width="100%">
<tr>
<td width="265" style="padding:2px;"><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:</td>
<td>{$uptime} </td>
</tr>
<tr>
<td width="265" style="padding:2px;">{$lang['stat_allnews']}</td>
<td>{$stats_news} {$approve} </td>
</tr>
<tr>
<td style="padding:2px;">{$lang['stat_comments']}</td>
<td>{$count_comments} [ <a href="{$config['http_home_url']}index.php?do=lastcomments" target="_blank">{$lang['last_comm']}</a> ]</td>
</tr>
<tr>
<td style="padding:2px;">{$lang['stat_users']}</td>
<td>{$stats_users} {$stats_banned} [ <a href="?mod=editusers&action=list"><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></a> ]</td>
</tr>
<tr>
<td style="padding:2px;">{$lang['stat_bd']}</td>
<td>{$mysql_size}</td>
</tr>
<tr>
<td style="padding:2px;"><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>:</td>
<td>{$cache_size}</td>
</tr>
<tr>
<td style="padding:2px;">{$lang['free_size']}</td>
<td>{$freespace} ({$totalspace})</td>
</tr>
</table>
HTML;
if( ! is_writable( ROOT_DIR . "/cache/" ) or ! is_writable( ROOT_DIR . "/cache/system/" ) ) {
echo "<br><table width=\"100%\" align=\"center\"><tr><td style='padding:3px; border:1px dashed red; background-color:lightyellow;' class=main>
$lang[stat_cache]
</td></tr><tr><td>&nbsp;</td></tr></table>";
}
if( $member_id['user_group'] == 1 ) {
echo "<br /><input onclick=\"document.location='?mod=main&action=clear'\" class=\"edit\" style=\"width:150px;\" type=\"button\" value=\"{$lang['btn_clearcache']}\"></a>";
if ($count_subscribe) echo "&nbsp;<input onclick=\"var agree=confirm('{$lang['confirm_action']}'); if (agree) document.location='?mod=main&action=clearsubscribe'\" class=\"edit\" style=\"width:300px;\" type=\"button\" value=\"{$lang['btn_clearsubscribe']}\">";
echo "<br />";
}
echo <<<HTML
</div>
</td>
<td background="system/skins/images/tl_rb.gif"><img src="system/skins/images/tl_rb.gif" width="6" height="1" border="0"></td>
</tr>
<tr>
<td><img src="system/skins/images/tl_lu.gif" width="4" height="6" border="0"></td>
<td background="system/skins/images/tl_ub.gif"><img src="system/skins/images/tl_ub.gif" width="1" height="6" border="0"></td>
<td><img src="system/skins/images/tl_ru.gif" width="6" height="6" border="0"></td>
</tr>
</table>
</div>
HTML;
echofooter();
?>