Portions created by the Initial Developer are Copyright (C) 2008-2012 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane James Rose */ include "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; if (permission_exists('system_view_info') || permission_exists('system_view_cpu') || permission_exists('system_view_hdd') || permission_exists('system_view_ram') || permission_exists('system_view_backup')) { //access granted } else { echo "access denied"; exit; } //add multi-lingual support $language = new text; $text = $language->get(); require_once "resources/header.php"; $document['title'] = $text['title-sys-status']; // OS Support // // For each section below wrap in an OS detection statement like: // if (stristr(PHP_OS, 'Linux')) {} // // Some possibilites for PHP_OS... // // CYGWIN_NT-5.1 // Darwin // FreeBSD // HP-UX // IRIX64 // Linux // NetBSD // OpenBSD // SunOS // Unix // WIN32 // WINNT // Windows // //system information echo "".$text['header-sys-status'].""; echo "

"; echo "\n"; echo "\n"; echo " \n"; echo "\n"; if (permission_exists('system_view_info')) { echo "\n"; echo " \n"; echo " \n"; echo "\n"; echo "\n"; if (strlen($tmp_result) > 0) { echo "\n"; echo " \n"; echo " \n"; echo "\n"; } unset($tmp_result); echo "\n"; if (strlen($tmp_result) > 0) { echo "\n"; echo " \n"; echo " \n"; echo "\n"; } unset($tmp_result); } echo "\n"; echo " \n"; echo " \n"; echo "\n"; echo "
".$text['title-sys-info']."
\n"; echo " Version\n"; echo " \n"; echo " ".software_version()."\n"; echo "
\n"; echo " ".$text['label-os']." \n"; echo " \n"; echo " ".$tmp_result." \n"; echo "
\n"; echo " Uptime\n"; echo " \n"; echo " ".$tmp_result." \n"; echo "
\n"; echo " Date\n"; echo " \n"; echo " ".date('r')." \n"; echo "
\n"; echo "

"; //memory information if (permission_exists('system_view_ram')) { //linux if (stristr(PHP_OS, 'Linux')) { echo "\n"; if (strlen($shell_result) > 0) { echo "\n"; echo "\n"; echo " \n"; echo "\n"; echo "\n"; echo " \n"; echo " \n"; echo "\n"; echo "
".$text['title-mem']."
\n"; echo " ".$text['label-mem']."\n"; echo " \n"; echo "
\n";
				echo "$shell_result
"; echo "
\n"; unset($shell_result); echo "
\n"; echo "

"; } } //freebsd if (stristr(PHP_OS, 'FreeBSD')) { echo "\n"; if (strlen($shell_result) > 0) { echo "\n"; echo "\n"; echo " \n"; echo "\n"; echo "\n"; echo " \n"; echo " \n"; echo "\n"; echo "
".$text['title-mem']."
\n"; echo " ".$text['label-mem']."\n"; echo " \n"; echo "
\n";
				echo "$shell_result
"; echo "
\n"; unset($shell_result); echo "
\n"; echo "

"; } } } //cpu information if (permission_exists('system_view_cpu')) { //linux if (stristr(PHP_OS, 'Linux')) { echo "\n"; if (strlen($shell_result) > 0) { echo "\n"; echo "\n"; echo " \n"; echo "\n"; echo "\n"; echo " \n"; echo " \n"; echo "\n"; echo "
".$text['title-cpu']."
\n"; echo " ".$text['label-cpu']."\n"; echo " \n"; echo "
\n";

				//$last_line = shell_exec($shellcmd, $shell_result);
				//foreach ($shell_result as $value) {
				//	echo substr($value, 0, 100);
				//	echo "
"; //} echo "$shell_result
"; echo "
\n"; unset($shell_result); echo "
\n"; echo "

"; } } //freebsd if (stristr(PHP_OS, 'FreeBSD')) { echo "\n"; if (strlen($shell_result) > 0) { echo "\n"; echo "\n"; echo " \n"; echo "\n"; echo "\n"; echo " \n"; echo " \n"; echo "\n"; echo "
".$text['title-cpu']."
\n"; echo " ".$text['label-cpu']."\n"; echo " \n"; echo "
\n";
				echo "$shell_result
"; echo "
\n"; unset($shell_result); echo "
\n"; echo "

"; } } } //drive space if (permission_exists('system_view_hdd')) { if (stristr(PHP_OS, 'Linux') || stristr(PHP_OS, 'FreeBSD')) { echo "\n"; echo "\n"; echo " \n"; echo "\n"; echo "\n"; echo " \n"; echo " \n"; echo "\n"; echo "
".$text['title-drive']."
\n"; echo " ".$text['label-drive']." \n"; echo " \n"; echo "
\n";
			$shellcmd = 'df -h';
			$shell_result = shell_exec($shellcmd);
			echo "$shell_result
"; echo "
\n"; echo "
\n"; } else if (stristr(PHP_OS, 'WIN')) { //disk_free_space returns the number of bytes available on the drive; //1 kilobyte = 1024 byte //1 megabyte = 1024 kilobyte $driveletter = substr($_SERVER["DOCUMENT_ROOT"], 0, 2); $disksize = round(disk_total_space($driveletter)/1024/1024, 2); $disksizefree = round(disk_free_space($driveletter)/1024/1024, 2); $diskpercentavailable = round(($disksizefree/$disksize) * 100, 2); echo "\n"; echo "\n"; echo " \n"; echo "\n"; echo "\n"; echo " \n"; echo " \n"; echo "\n"; echo "\n"; echo " \n"; echo " \n"; echo "\n"; echo "\n"; echo " \n"; echo " \n"; echo "\n"; echo "
".$text['label-drive']."
\n"; echo " ".$text['label-drive-capacity']." \n"; echo " \n"; echo " $disksize mb\n"; echo "
\n"; echo " ".$text['label-drive-free']." \n"; echo " \n"; echo " $disksizefree mb\n"; echo "
\n"; echo " ".$text['label-drive-percent']." \n"; echo " \n"; echo " $diskpercentavailable% \n"; echo "
\n"; } echo "

"; } //memcache information if (permission_exists('system_view_memcache')) { echo "\n"; echo " \n"; echo " \n"; echo " \n"; $mc_fail = false; $mod = new modules; if ($mod -> active("mod_memcache")) { $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); if ($fp) { $switch_cmd = "memcache status verbose"; $switch_result = event_socket_request($fp, 'api '.$switch_cmd); $mc_lines = preg_split('/\n/', $switch_result); foreach($mc_lines as $mc_line) { if (strlen(trim($mc_line)) > 0 && substr_count($mc_line, ': ') > 0) { $mc_temp = explode(': ', $mc_line); $mc_status[$mc_temp[0]] = $mc_temp[1]; } } if (is_array($mc_status) && sizeof($mc_status) > 0) { foreach($mc_status as $mc_field => $mc_value) { echo "\n"; echo " \n"; echo " \n"; echo "\n"; } } else { $mc_fail = true; } } else { $mc_fail = true; } } else { $mc_fail = true; } if ($mc_fail) { echo "\n"; echo " \n"; echo " \n"; echo "\n"; } echo "
".$text['title-memcache']."
".$mc_field."".$mc_value."
".$text['label-memcache_status']."".$text['message-unavailable']."
\n"; echo "

\n"; } //backup if (permission_exists('zzz') && $db_type == 'sqlite') { require_once "core/backup/backupandrestore.php"; } //include the footer require_once "resources/footer.php"; ?>