/***************************************************************************
Jupiter Content System @ Jupiterportal.com
Copyright (C) 2005 Cosmin Flavius (highstrike@gmail.com)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
More Info About The Licence At http://www.gnu.org/copyleft/gpl.html
****************************************************************************/
function b_debug()
{
$name_function = "b_debug";
global $a, $db, $blocks_db, $template, $language, $config, $misc, $PHP_SELF, $is_loged_in, $is_moderator, $is_administrator, $is_webmaster, $months, $days, $m, $y, $OnlineGuestsCount, $OnlineMembersCount;
if(!file_exists("blocks/$name_function/language/{$config['language']}")) include "blocks/$name_function/language/en.php";
else include "blocks/$name_function/language/{$config['language']}";
$random_code = md5("$name_function");
$random_code = substr("$random_code", 0, 5);
if(!isset($content)) $content = NULL;
if(!isset($_GET["$random_code"])) $_GET["$random_code"] = NULL;
if($_GET["$random_code"] == "on") $_SESSION["$random_code"] = "on";
elseif($_GET["$random_code"] == "off") $_SESSION["$random_code"] = "off";
$query_string = "?{$_SERVER['QUERY_STRING']}";
foreach($blocks_db as $blocks)
{
$block_code = md5("{$blocks['name']}");
$block_code = substr("$block_code", 0, 5);
$query_string = str_replace("&$block_code=off","", $query_string);
$query_string = str_replace("&$block_code=on","", $query_string);
}
if($query_string == "?" || strpos($query_string, '=on') !== false || strpos($query_string, '=off') !== false) $code_query = "?";
else $code_query = "$query_string&";
if(!isset($_SESSION["$random_code"]) || $_SESSION["$random_code"] == "on") $links = " {$language_block['Debugs title']}";
elseif($_SESSION["$random_code"] == "off") $links = " {$language_block['Debugs title']}";
$template_block = implode("", file("templates/$template/block.php"));
$template_block = str_replace("{template}", $template, $template_block);
$template_block = str_replace("{links}", $links, $template_block);
if(!isset($_SESSION["$random_code"]) || $_SESSION["$random_code"] == "on")
{
function view($first,$second)
{
global $template;
$percent = round(($first / $second) * 100, 1);
if($percent == 0) $output = "";
if($percent > 0) $output = "";
if($percent >= 10) $output = "";
if($percent >= 20) $output = "";
if($percent >= 30) $output = "";
if($percent >= 40) $output = "";
if($percent >= 50) $output = "";
if($percent >= 60) $output = "";
if($percent >= 70) $output = "";
if($percent >= 80) $output = "";
if($percent >= 90) $output = "";
if($percent >= 100) $output = "";
return $output;
}
$cookies = 0; $sessions = 0; $querys = 0;
foreach($_COOKIE as $cookie){ $cookies++; }
foreach($_SESSION as $session){ $sessions++; }
foreach($db->debugtext as $query){ $querys++; }
$link_time = $db->link_time;
list($usec, $sec) = explode(" ", microtime());
$link_time=(float)$usec+(float)$sec-$link_time;
$link_time = substr($link_time, 0, 4);
$cookies_count = $cookies; $cookies_limit = 10;
$sessions_count = $sessions; $sessions_limit = 20;
$querys_count = $querys; $querys_limit = 100;
$link_time_count = $link_time; $link_time_limit = 2.00;
$content .= "
{$language_block['Debugs desc']} $cookies | ".view($cookies_count,$cookies_limit)." |
|
";
$content .= "{$language_block['Debugs desc2']} $sessions | ".view($sessions_count,$sessions_limit)." |
|
";
$content .= "{$language_block['Debugs desc3']} $querys | ".view($querys_count,$querys_limit)." |
|
";
$content .= "{$language_block['Debugs desc4']} $link_time | ".view($link_time_count,$link_time_limit)." |
|
";
}
$template_block = str_replace("{content}", $content, $template_block);
$output = $template_block;
return $output;
}
?>