Esempio n. 1
0
function graph()
{
    $q = new mysql_squid_builder();
    $sql = "SELECT SUM(hits) as hits,zDate FROM youtube_dayz GROUP BY zDate ORDER BY zDate";
    $results = $q->QUERY_SQL($sql);
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $ligne["zDate"] = str_replace(date("Y") . "-", "", $ligne["zDate"]);
        $xdata[] = $ligne["zDate"];
        $ydata[] = $ligne["hits"];
        if ($GLOBALS["VERBOSE"]) {
            echo "\"{$ligne["zDate"]}\" = {$ligne["hits"]}<br>\n";
        }
    }
    $highcharts = new highcharts();
    $highcharts->container = $_GET["container"];
    $highcharts->xAxis = $xdata;
    $highcharts->Title = "{downloaded_videos}/{day}";
    $highcharts->yAxisTtitle = "{videos}";
    $highcharts->xAxisTtitle = "{days}";
    $highcharts->datas = array("{videos}" => $ydata);
    echo $highcharts->BuildChart();
}
function gengraph()
{
    $styleTitle = "font-size:18px;color:#005447";
    if (intval($_GET["current"]) == 0) {
        if (intval($_GET["max"]) == 0) {
            echo "document.getElementById('{$_GET["container"]}').innerHTML='<center><span style=\"{$styleTitle}\">{$_GET["name"]}</span><center style=\"margin-top:10px\"><img src=img/cache-status-off.png></center></center>'";
            return;
        }
    }
    $free = $_GET["max"] - $_GET["current"];
    $PieData["{free}"] = $free;
    $PieData["{used}"] = $_GET["current"];
    $highcharts = new highcharts();
    $highcharts->container = $_GET["container"];
    $highcharts->PieDatas = $PieData;
    $highcharts->ChartType = "pie";
    $highcharts->PiePlotTitle = ">>";
    $highcharts->PieDataLabels = false;
    $highcharts->PieRedGreen = true;
    $highcharts->Title = $_GET["name"];
    $highcharts->LegendSuffix = " MB";
    echo $highcharts->BuildChart();
}
function graph3()
{
    $page = CurrentPageName();
    $MAIN = unserialize(@file_get_contents("{$GLOBALS["BASEDIR"]}/SMTP_DASHBOARD_GRAPHS"));
    $tpl = new templates();
    $tpl = new templates();
    $title = "{rejected}";
    $timetext = "{hours}";
    $highcharts = new highcharts();
    $highcharts->container = "graph3-dashboard";
    $highcharts->xAxis = $MAIN["REJECTED"]["X"];
    $highcharts->Title = $title;
    $highcharts->TitleFontSize = "22px";
    $highcharts->AxisFontsize = "12px";
    $highcharts->yAxisTtitle = "{messages}";
    $highcharts->xAxis_labels = false;
    $highcharts->LegendPrefix = $tpl->javascript_parse_text('{date}: ');
    $highcharts->LegendSuffix = "Mails";
    $highcharts->xAxisTtitle = $timetext;
    $highcharts->datas = array("{size}" => $MAIN["REJECTED"]["Y"]);
    echo $highcharts->BuildChart();
}
function graph3()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $zmd5 = $_GET["zmd5"];
    if ($zmd5 == null) {
        echo "alert('no key sended');UnlockPage();";
        die;
    }
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT `values` FROM reports_cache WHERE `zmd5`='{$zmd5}'"));
    $values = $ligne["values"];
    if (strlen($values) == 0) {
        echo "alert('NO data...{$ligne["values"]}');UnlockPage();";
        $q->QUERY_SQL("DELETE FROM reports_cache WHERE `zmd5`='{$zmd5}'");
        return;
    }
    $MAIN = unserialize(base64_decode($values));
    $PieData = $MAIN["TOP_WEBSITES_MEMBERS"];
    $highcharts = new highcharts();
    $highcharts->container = "graph3-{$zmd5}";
    $highcharts->PieDatas = $PieData;
    $highcharts->ChartType = "pie";
    $highcharts->PiePlotTitle = "{members}";
    $highcharts->Title = $tpl->_ENGINE_parse_body("TOP {members}/{size} (KB)");
    echo $highcharts->BuildChart();
    echo "\n";
    echo "if(document.getElementById('websites-button-area')){document.getElementById('websites-button-area').innerHTML='';}\n";
    echo "LoadAjax('table3-{$zmd5}','{$page}?table3=yes&zmd5={$zmd5}&t={$_GET["t"]}');\n";
}
function graph_uid_4()
{
    $q = new mysql_squid_builder();
    $tpl = new templates();
    $sql = "SELECT SUM(RQS) as RQS,FAMILYSITE FROM dashboard_memberwebsite_day  \n\t\t\tWHERE USER='******' GROUP BY FAMILYSITE ORDER BY RQS DESC LIMIT 0,15";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        $q->mysql_error_jsdiv($_GET["id"]);
        die;
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $FAMILYSITE = $ligne["FAMILYSITE"];
        $SIZE = $ligne["RQS"];
        $MAIN[$FAMILYSITE] = $SIZE;
    }
    $highcharts = new highcharts();
    $highcharts->container = $_GET["id"];
    $highcharts->SQL_QUERY = $sql;
    $highcharts->PieDatas = $MAIN;
    $highcharts->ChartType = "pie";
    $highcharts->PiePlotTitle = "{$_GET["uid"]} - {top_websites_by_hits}";
    $highcharts->Title = $tpl->_ENGINE_parse_body("{$_GET["uid"]} - {top_websites_by_hits}");
    echo $highcharts->BuildChart();
}
Esempio n. 6
0
function graph3()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $zmd5 = $_GET["zmd5"];
    if ($zmd5 == null) {
        echo "alert('no key sended');UnlockPage();";
        die;
    }
    $table = "{$zmd5}report";
    $q = new mysql_squid_builder();
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM reports_cache WHERE `zmd5`='{$zmd5}'"));
    $params = unserialize($ligne["params"]);
    $user = strtolower($params["USER"]);
    $q = new postgres_sql();
    $results = $q->QUERY_SQL("SELECT SUM(xcount) as xcount,dst_ip FROM \"{$table}\" GROUP BY dst_ip ORDER BY xcount DESC LIMIT 10");
    if ($GLOBALS["VERBOSE"]) {
        echo $sql . "<br>\n";
    }
    while ($ligne = @pg_fetch_assoc($results)) {
        $size = $ligne["xcount"];
        $dst_ip = $ligne["dst_ip"];
        $PieData[$dst_ip] = $size;
    }
    $highcharts = new highcharts();
    $highcharts->container = "graph3-{$zmd5}";
    $highcharts->PieDatas = $PieData;
    $highcharts->ChartType = "pie";
    $highcharts->PiePlotTitle = "{dst_ip}";
    $highcharts->Title = $tpl->_ENGINE_parse_body("TOP {dst_ip}/{events}");
    echo $highcharts->BuildChart();
    echo "\n";
    echo "if(document.getElementById('websites-button-area')){document.getElementById('websites-button-area').innerHTML='';}\n";
    echo "LoadAjax('table3-{$zmd5}','{$page}?table3=yes&zmd5={$zmd5}&t={$_GET["t"]}');\n";
}
function graph5()
{
    $q = new mysql_squid_builder();
    $page = CurrentPageName();
    $tpl = new templates();
    $t = $_GET["t"];
    $ff = time();
    $tablename = date("Ymd", $_GET["xtime"]) . "_hour";
    $category = mysql_escape_string2($_GET["category"]);
    $sql = "SELECT SUM(size) as thits, category,uid FROM `{$tablename}`\n\tGROUP BY category,uid \n\tHAVING category='{$category}'\n\tORDER BY thits DESC LIMIT 0,10";
    $unknown = $tpl->_ENGINE_parse_body("{unknown}");
    $c = 0;
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        $tpl->javascript_senderror($q->mysql_error, $_GET["container"]);
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        if (trim($ligne["uid"]) == null) {
            $ligne["uid"] = $unknown;
        }
        $ligne["thits"] = round($ligne["thits"] / 1024 / 1000);
        $PieData[$ligne["uid"]] = $ligne["thits"];
        $c++;
    }
    $tpl = new templates();
    $highcharts = new highcharts();
    $highcharts->container = $_GET["container"];
    $highcharts->PieDatas = $PieData;
    $highcharts->ChartType = "pie";
    $highcharts->PiePlotTitle = "{hits}";
    $highcharts->Title = $tpl->_ENGINE_parse_body("{$category}: {top_members_by_size} (MB)");
    echo $highcharts->BuildChart();
}
function graph2()
{
    $hour_table = date('Ymd', strtotime($_GET["day"])) . "_hour";
    $q = new mysql_squid_builder();
    $sql = "SELECT SUM(hits) as hits,hour,{$_GET["field"]},familysite\n\tFROM {$hour_table} GROUP BY hour,{$_GET["field"]},familysite\n\tHAVING familysite='{$_GET["familysite"]}' AND {$_GET["field"]}='{$_GET["value"]}' ORDER BY hour";
    if ($GLOBALS["VERBOSE"]) {
        echo $sql . "<br>\n";
    }
    $results = $q->QUERY_SQL($sql);
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $xdata[] = $ligne["hour"] . "h";
        $ydata[] = $ligne["hits"];
    }
    $highcharts = new highcharts();
    $highcharts->container = $_GET["container"];
    $highcharts->xAxis = $xdata;
    $highcharts->Title = "{requests} {for} {$_GET["value"]} {with} {$_GET["familysite"]}";
    $highcharts->yAxisTtitle = "{requests}";
    $highcharts->xAxisTtitle = "{hours}";
    $highcharts->datas = array("{hits}" => $ydata);
    echo $highcharts->BuildChart();
}
Esempio n. 9
0
function graph_current_month_day()
{
    $timekey = date('Ym');
    $time = time();
    $page = CurrentPageName();
    $q = new mysql_squid_builder();
    $table = "squidmemoryM_{$timekey}";
    $sql = "SELECT `day` zhour,memoryuse FROM `{$table}` ORDER BY `day`";
    $results = $q->QUERY_SQL($sql);
    while ($ligne = mysql_fetch_assoc($results)) {
        if (strlen($ligne["zhour"]) == 1) {
            $ligne["zhour"] = "0{$ligne["zhour"]}";
        }
        $ttime = "{$ligne["zhour"]}";
        $xdata[] = $ttime;
        $ydata[] = $ligne["memoryuse"];
    }
    $title = "{this_month} (MB)";
    $timetext = "{day}";
    $highcharts = new highcharts();
    $highcharts->container = $_GET["container"];
    $highcharts->xAxis = $xdata;
    $highcharts->TitleFontSize = "14px";
    $highcharts->AxisFontsize = "12px";
    $highcharts->Title = $title;
    $highcharts->yAxisTtitle = "{size} (MB)";
    $highcharts->xAxisTtitle = $timetext;
    $highcharts->xAxis_labels = false;
    $highcharts->LegendPrefix = date("m") . "/" . date("Y") . " ";
    $highcharts->LegendSuffix = "MB";
    $highcharts->datas = array("{size}" => $ydata);
    echo $highcharts->BuildChart();
}
function graph4()
{
    $q = new mysql_squid_builder();
    $tpl = new templates();
    $tablename = "www_" . $q->uid_to_tablename($_GET["uid"]);
    $sql = "SELECT SUM(hits) as hits,familysite,category FROM `{$tablename}` GROUP BY familysite,category\n\tHAVING `category`='{$_GET["category"]}'\n\tORDER BY hits DESC LIMIT 0,15";
    if ($_GET["category"] == null) {
        $sql = "SELECT SUM(hits) as hits,familysite,category FROM `{$tablename}` GROUP BY familysite,category\n\t\tHAVING `category` IS NULL\n\t\tORDER BY hits DESC LIMIT 0,15";
    }
    $results = $q->QUERY_SQL($sql);
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $size = $ligne["hits"];
        $PieData[$ligne["familysite"]] = $size;
    }
    if (!$q->ok) {
        $tpl->javascript_senderror($q->mysql_error, $_GET["container"]);
    }
    $tpl = new templates();
    $highcharts = new highcharts();
    $highcharts->container = $_GET["container"];
    $highcharts->PieDatas = $PieData;
    $highcharts->ChartType = "pie";
    $highcharts->PiePlotTitle = "{hits}";
    $highcharts->Title = $tpl->_ENGINE_parse_body("{$_GET["category"]}/{top_websites}/{size}");
    echo $highcharts->BuildChart();
}
function graph3()
{
    $q = new mysql_squid_builder();
    $page = CurrentPageName();
    $tpl = new templates();
    $t = $_GET["t"];
    $ff = time();
    $tablename = date("Ymd", $_GET["xtime"]) . "_blocked";
    $sql = "SELECT COUNT(ID) as thits, uid FROM `{$tablename}`\n\tGROUP BY uid\n\tORDER BY thits DESC LIMIT 0,10";
    $c = 0;
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        $tpl->javascript_senderror($q->mysql_error, $_GET["container"]);
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $PieData[$ligne["uid"]] = $ligne["thits"];
        $c++;
    }
    $tpl = new templates();
    $highcharts = new highcharts();
    $highcharts->container = $_GET["container"];
    $highcharts->PieDatas = $PieData;
    $highcharts->ChartType = "pie";
    $highcharts->PiePlotTitle = "{hits}";
    $highcharts->Title = $tpl->_ENGINE_parse_body("{top_members_by_hits} ({uid})");
    echo $highcharts->BuildChart();
}
function graph2()
{
    $q = new mysql_squid_builder();
    $tpl = new templates();
    $xtime = $_GET["xtime"];
    $hourtable = date("Ymd", $xtime) . "_hour";
    $sql = "SELECT SUM(size) as size,`hour`,uid,familysite FROM {$hourtable} GROUP BY\n\tfamilysite,`hour`,uid HAVING familysite='{$_GET["familysite"]}' AND uid='{$_GET["uid"]}' ORDER BY `hour`";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        $tpl->javascript_senderror($q->mysql_error);
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $size = $ligne["size"];
        $size = $size / 1024;
        $size = $size / 1024;
        $size = round($size, 2);
        $xdata[] = $ligne["hour"];
        $ydata[] = $size;
    }
    $highcharts = new highcharts();
    $highcharts->container = $_GET["container"];
    $highcharts->xAxis = $xdata;
    $highcharts->Title = "{$_GET["familysite"]} {size}/{hour} (MB)";
    $highcharts->yAxisTtitle = "{size}";
    $highcharts->xAxisTtitle = "{hours}";
    $highcharts->datas = array("{size}" => $ydata);
    echo $highcharts->BuildChart();
}
function build_webfiltering_chart2()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $zmd5 = $_GET["zmd5"];
    if ($zmd5 == null) {
        echo "alert('no key sended');UnlockPage();";
        die;
    }
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT `values` FROM reports_cache WHERE `zmd5`='{$zmd5}'"));
    $values = $ligne["values"];
    if (strlen($values) == 0) {
        echo "alert('NO data...{$ligne["values"]}');UnlockPage();";
        $q->QUERY_SQL("DELETE FROM reports_cache WHERE `zmd5`='{$zmd5}'");
        return;
    }
    $MAIN = unserialize(base64_decode($values));
    $PieData = $MAIN["WEBFILTERING_TOPSITES"];
    $highcharts = new highcharts();
    $highcharts->container = "webfiltering-3-{$zmd5}";
    $highcharts->PieDatas = $PieData;
    $highcharts->ChartType = "pie";
    $highcharts->PiePlotTitle = "{websites}";
    $highcharts->Title = $tpl->_ENGINE_parse_body("TOP {websites}/{hits}");
    echo $highcharts->BuildChart();
    echo "\nLoadAjaxRound('webfiltering-4-{$zmd5}','{$page}?build-webfiltering-table2=yes&zmd5={$zmd5}');\n";
}
Esempio n. 14
0
function graph2()
{
    if (!class_exists("highcharts")) {
        return;
    }
    $tpl = new templates();
    $dnsserver = $_GET["dnsserver"];
    $q = new mysql();
    $sql = "SELECT DATE_FORMAT(zDate,'%Y-%m-%d') as tdate,DATE_FORMAT(zDate,'%d') as tday,DATE_FORMAT(zDate,'%H') as `min`,dnsserver,\n\tAVG(percent) as value FROM `dnsperfs_week` GROUP BY `min`,dnsserver,tday\n\tHAVING tdate<DATE_FORMAT(NOW(),'%Y-%m-%d') AND dnsserver='{$dnsserver}' ORDER BY tdate,`min`";
    $title = "{$dnsserver}: {this_week}";
    $timetext = "{minutes}";
    $results = $q->QUERY_SQL($sql, "artica_events");
    while ($ligne = mysql_fetch_assoc($results)) {
        $xdata[] = $ligne["tday"] . "/" . $ligne["min"] . "h";
        $ydata[] = round($ligne["value"]);
    }
    $timetext = "{hours}";
    $highcharts = new highcharts();
    $highcharts->container = $_GET["container"];
    $highcharts->xAxis = $xdata;
    $highcharts->Title = $title;
    $highcharts->TitleFontSize = "14px";
    $highcharts->AxisFontsize = "12px";
    $highcharts->yAxisTtitle = "{percent}";
    $highcharts->xAxis_labels = false;
    $highcharts->LegendPrefix = "{day}";
    $highcharts->xAxisTtitle = $timetext;
    $highcharts->LegendSuffix = "%";
    $highcharts->datas = array($dnsserver => $ydata);
    echo $highcharts->BuildChart();
}
Esempio n. 15
0
function rtu_hour()
{
    $page = CurrentPageName();
    $q = new mysql_squid_builder();
    $page = CurrentPageName();
    $table = "RTTD_" . date("Ymd", $q->HIER_TIME());
    $q = new mysql_squid_builder();
    $results = $q->QUERY_SQL("SELECT SUM(size) AS SIZE,uid FROM {$table} GROUP BY uid HAVING LENGTH(uid)>0 ORDER BY SIZE DESC LIMIT 0,10");
    $CountRow = mysql_num_rows($results);
    if (mysql_num_rows($results) < 2) {
        $date = date("YmdH", time() - 60);
        $table = "RTTH_{$date}";
        $results = $q->QUERY_SQL("SELECT SUM(size) AS SIZE,uid FROM {$table} GROUP BY uid HAVING LENGTH(uid)>0 ORDER BY SIZE DESC LIMIT 0,10");
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $ligne["SIZE"] = $ligne["SIZE"] / 1024;
        $ligne["SIZE"] = $ligne["SIZE"] / 1024;
        $PieData[$ligne["uid"]] = $ligne["SIZE"];
    }
    $page = CurrentPageName();
    $tpl = new templates();
    $highcharts = new highcharts();
    $highcharts->TitleFontSize = "14px";
    $highcharts->AxisFontsize = "12px";
    $highcharts->container = $_GET["container"];
    $highcharts->PieDatas = $PieData;
    $highcharts->ChartType = "pie";
    $highcharts->PiePlotTitle = "{size} MB";
    $highcharts->Title = $tpl->_ENGINE_parse_body("{top_members} MB");
    $highcharts->RemoveLock = true;
    echo $highcharts->BuildChart();
}
function paragraphe1_day_graph()
{
    $AR = unserialize(base64_decode($_GET["data"]));
    $highcharts = new highcharts();
    $highcharts->container = $_GET["container"];
    $highcharts->xAxis = $AR[0];
    $highcharts->Title = "{hits}/{hours}";
    $highcharts->yAxisTtitle = "{hits}";
    $highcharts->xAxisTtitle = "{hours}";
    $highcharts->datas = array("{hits}" => $AR[1]);
    echo $highcharts->BuildChart();
}
Esempio n. 17
0
function rtt_full()
{
    $filecache = "/usr/share/artica-postfix/ressources/logs/web/CACHED_AVGD";
    if (!is_file($filecache)) {
        if ($GLOBALS["VERBOSE"]) {
            echo "{$filecache} no such file\n<br>";
        }
        return;
    }
    if (!class_exists("highcharts")) {
        return;
    }
    $tpl = new templates();
    $title = "{cache_rate_by_day}";
    $timetext = "{days}";
    $ARRAY = unserialize(@file_get_contents($filecache));
    while (list($num, $ligne) = each($ARRAY)) {
        $xdata[] = $num;
        $ydata[] = $ligne;
    }
    $highcharts = new highcharts();
    $highcharts->container = $_GET["container"];
    $highcharts->xAxis = $xdata;
    $highcharts->TitleFontSize = "14px";
    $highcharts->AxisFontsize = "12px";
    $highcharts->Title = $title;
    $highcharts->yAxisTtitle = "{rate} %";
    $highcharts->xAxisTtitle = $timetext;
    $highcharts->xAxis_labels = true;
    $highcharts->LegendPrefix = null;
    $highcharts->LegendSuffix = "%";
    //$highcharts->subtitle="<a href=\"javascript:Loadjs('squid.sizegraphs.php')\" style='text-decoration:underline'>{more_details}</a>";
    $highcharts->datas = array("{rate}" => $ydata);
    echo $highcharts->BuildChart();
}
Esempio n. 18
0
function status_videocache_graph3(){
	$q=new mysql_squid_builder();;
	$tpl=new templates();
	
	$sql="SELECT SUM(zSize) as tsize, DATE_FORMAT(zDate,'{%W} %m %Hh') as th FROM videocacheA GROUP BY th ORDER BY th";
	$results=$q->QUERY_SQL($sql);
	
	
	
	while($ligne=mysql_fetch_array($results,MYSQL_ASSOC)){
		
		$x[]=$tpl->javascript_parse_text($ligne["th"]);
		$y[]=round($ligne["tsize"]/1024)/1000;
	}
	
	
	$highcharts=new highcharts();
	$highcharts->container=$_GET["container"];
	$highcharts->xAxis=$x;
	$highcharts->Title="{downloaded_videos}/{hours}";
	$highcharts->yAxisTtitle="{videos}";
	$highcharts->xAxisTtitle="{hours}";
	$highcharts->datas=array("{size}"=>$y);
	echo $highcharts->BuildChart();
	
}
Esempio n. 19
0
function graph4()
{
    $sock = new sockets();
    $tpl = new templates();
    $currentsize = $sock->GET_INFO("CyrusImapPartitionDefaultSize");
    $CyrusImapPartitionDefaultSizeTime = $sock->GET_INFO("CyrusImapPartitionDefaultSizeTime");
    $CyrusImapPartitionDiskSize = $sock->GET_INFO("CyrusImapPartitionDiskSize");
    $tot = $CyrusImapPartitionDiskSize - $currentsize;
    $currentsizeT = FormatBytes($currentsize * 1024);
    $totT = FormatBytes($tot * 1024);
    $PieData["Mailboxes {$currentsizeT}"] = $currentsize;
    $PieData["Disk {$totT}"] = $tot;
    $highcharts = new highcharts();
    $highcharts->container = $_GET["container"];
    $highcharts->PieDatas = $PieData;
    $highcharts->ChartType = "pie";
    $highcharts->PiePlotTitle = "{size}";
    $highcharts->Title = $tpl->_ENGINE_parse_body("{mailboxes}");
    echo $highcharts->BuildChart();
}
function section_topuser_graph1()
{
    $q = new mysql_squid_builder();
    $tpl = new templates();
    $year = $_GET["year"];
    $month = $_GET["month"];
    $table = "quotamonth_{$year}{$month}";
    $page = CurrentPageName();
    $familysite = mysql_escape_string2($_GET["familysite"]);
    $sql = "SELECT `familysite`,SUM(size) as `size`,uid FROM {$table} GROUP BY `familysite`,uid\n\tHAVING familysite='{$familysite}' ORDER BY `size` DESC LIMIT 0,50";
    $results = $q->QUERY_SQL($sql);
    $suffix = suffix();
    if (!$q->ok) {
        $tpl->javascript_senderror($q->mysql_error, $_GET["container"]);
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $size = $ligne["size"];
        $size = $size / 1024;
        $size = $size / 1024;
        $size = round($size);
        $PieData[$ligne["uid"]] = $size;
    }
    $tpl = new templates();
    $highcharts = new highcharts();
    $highcharts->container = $_GET["container"];
    $highcharts->PieDatas = $PieData;
    $highcharts->ChartType = "pie";
    $highcharts->PiePlotTitle = "{size} MB";
    $highcharts->Title = $tpl->_ENGINE_parse_body("{$_GET["familysite"]}: {top_users} {size} MB");
    $highcharts->subtitle = "<a href=\"javascript:Loadjs('{$page}?topmembers-table-js=yes{$suffix}')\" style='text-decoration:underline;font-size:18px'>{more_details}</a>";
    echo $highcharts->BuildChart();
}
function generate_graph_final()
{
    include_once 'ressources/class.artica.graphs.inc';
    $q = new mysql_squid_builder();
    $page = CurrentPageName();
    $tpl = new templates();
    $t = $_GET["t"];
    $ff = time();
    $xtime = $_GET["xtime"];
    $tablename = date("Ymd", $_GET["xtime"]) . "_members";
    if ($_GET["FILTER"] == null) {
        $_GET["FILTER"] = which_filter($tablename);
    }
    $FILTER = $tpl->_ENGINE_parse_body("{{$_GET["FILTER"]}}");
    $sql = "SELECT COUNT({$_GET["FILTER"]}) as tcount, hour FROM {$tablename} GROUP BY hour ORDER BY hour";
    switch ($_GET["FILTER"]) {
        case "client":
            $subtitle = "{ipaddr}";
            break;
        case "uid":
            $subtitle = "{member}";
            break;
        default:
            $subtitle = "{{$_GET["FILTER"]}}";
            break;
    }
    $c = 0;
    $results = $q->QUERY_SQL($sql);
    if (mysql_num_rows($results) > 0) {
        $nb_events = mysql_num_rows($results);
        while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
            $xdata[] = $ligne["hour"];
            $ydata[] = $ligne["tcount"];
            $c++;
        }
    }
    $highcharts = new highcharts();
    $highcharts->container = $_GET["container"];
    $highcharts->xAxis = $xdata;
    $highcharts->Title = "{statistics} " . $tpl->_ENGINE_parse_body("{$subtitle}/{hours}");
    $highcharts->yAxisTtitle = "{members}";
    $highcharts->xAxisTtitle = "{hours}";
    $highcharts->datas = array("{members}" => $ydata);
    echo $highcharts->BuildChart();
}
Esempio n. 22
0
function graph()
{
    $Mypage = CurrentPageName();
    $q = new mysql_squid_builder();
    $tpl = new templates();
    $table = "UserAuthDays";
    $page = 1;
    $data = array();
    $data['rows'] = array();
    $field = $_GET["field"];
    $value = $_GET["value"];
    $sql = "SELECT {$field},zDate,SUM(QuerySize) as size FROM {$table} \n\tGROUP BY  {$field},zDate HAVING {$field}='{$value}'";
    $results = $q->QUERY_SQL($sql);
    while ($ligne = mysql_fetch_assoc($results)) {
        $zdtTime = strtotime($ligne["zDate"]);
        $xdata[] = date("Y-m-d", $zdtTime);
        $ydata[] = round($ligne["size"] / 1024 / 1000);
    }
    $highcharts = new highcharts();
    $highcharts->container = $_GET["container"];
    $highcharts->xAxis = $xdata;
    $highcharts->Title = "{$value}: {downloaded_flow}";
    $highcharts->yAxisTtitle = "{bandwith} MB";
    $highcharts->xAxisTtitle = "{days}";
    $highcharts->datas = array("{bandwith}" => $ydata);
    echo $highcharts->BuildChart();
}
function graph1_1()
{
    $q = new mysql_squid_builder();
    $page = CurrentPageName();
    $tpl = new templates();
    $t = $_GET["t"];
    $ff = time();
    $tablename = date("Ymd", $_GET["xtime"]) . "_hour";
    $category = mysql_escape_string2($_GET["category"]);
    if ($_GET["category"] == "unknown") {
        $_GET["category"] = null;
    }
    $sql = "SELECT SUM( hits ) AS size,zDate, category FROM generic_categories GROUP BY category,zDate\n\tHAVING category='{$_GET["category"]}' ORDER BY zDate";
    $results = $q->QUERY_SQL($sql);
    $c = 0;
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        senderror("{$q->mysql_error}<br>{$sql}");
    }
    if (mysql_num_rows($results) > 0) {
        $nb_events = mysql_num_rows($results);
        while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
            $xdata[] = $ligne["zDate"];
            $ydata[] = $ligne["size"];
            $c++;
        }
    }
    $highcharts = new highcharts();
    $highcharts->container = $_GET["container"];
    $highcharts->xAxis = $xdata;
    $highcharts->Title = "{$category}: {hits}/{day}";
    $highcharts->yAxisTtitle = "{hits}";
    $highcharts->xAxisTtitle = "{days}";
    $highcharts->datas = array("{hits}" => $ydata);
    echo $highcharts->BuildChart();
}
Esempio n. 24
0
function proxy_graph3_js()
{
    $sock = new sockets();
    $SquidPerformance = intval($sock->GET_INFO("SquidPerformance"));
    if ($SquidPerformance > 2) {
        header("content-type: application/x-javascript");
        die;
    }
    $MAIN = unserialize(@file_get_contents("{$GLOBALS["BASEDIR"]}/MEMBERS_GRAPH"));
    $tpl = new templates();
    $title = "{members} " . DATE_START();
    $timetext = "{hours}";
    $highcharts = new highcharts();
    $highcharts->container = "graph3-dashboard";
    $highcharts->xAxis = $MAIN["xdata"];
    $highcharts->Title = $title;
    $highcharts->TitleFontSize = "22px";
    $highcharts->AxisFontsize = "12px";
    $highcharts->yAxisTtitle = " Users";
    $highcharts->xAxis_labels = false;
    $highcharts->LegendPrefix = null;
    $highcharts->LegendSuffix = "{requests}";
    $highcharts->xAxisTtitle = $timetext;
    $highcharts->datas = array("{members}" => $MAIN["ydata"]);
    echo $highcharts->BuildChart();
}
function graph3()
{
    $tpl = new templates();
    $unknown = $tpl->_ENGINE_parse_body("{unknown}");
    $q = new mysql_squid_builder();
    $tpl = new templates();
    $youtube = new YoutubeStats();
    $sql = "SELECT SUM(hits) as hits,uid FROM `youtube_all` GROUP BY\n\tuid ORDER BY hits DESC LIMIT 0,15";
    $results = $q->QUERY_SQL($sql);
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $size = $ligne["hits"];
        $title = $ligne["uid"];
        if ($title == null) {
            $title = $unknown;
        }
        if (strlen($title) > 20) {
            $title = substr($title, 0, 17) . "...";
        }
        $PieData[$title] = $size;
    }
    if (!$q->ok) {
        $tpl->javascript_senderror($q->mysql_error, $_GET["container"]);
    }
    $tpl = new templates();
    $highcharts = new highcharts();
    $highcharts->container = $_GET["container"];
    $highcharts->PieDatas = $PieData;
    $highcharts->ChartType = "pie";
    $highcharts->PiePlotTitle = "{members}";
    $highcharts->Title = $tpl->_ENGINE_parse_body("{top_members}/{hits}");
    echo $highcharts->BuildChart();
}
function flow_month_graph2(){
	$data=unserialize(base64_decode($_GET["serialize"]));
	
	
	
	while (list ($day, $size) = each ($data) ){
	
		
		$xdata[]=$day;
		$ydata[]=$size;
	
	}
	
	
	$title="{requests_number_per_day}";
	$timetext="{days}";
	$highcharts=new highcharts();
	$highcharts->container=$_GET["container"];
	$highcharts->xAxis=$xdata;
	$highcharts->Title=$title;
	//$highcharts->subtitle="<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.rtt.php')\" style='font-size:16px;text-decoration:underline'>{realtime_flow}</a>";
	$highcharts->TitleFontSize="14px";
	$highcharts->AxisFontsize="12px";
	$highcharts->yAxisTtitle="MB";
	$highcharts->xAxis_labels=true;
	//$highcharts->LegendPrefix=date("H")."h";
	$highcharts->LegendSuffix="{requests}";
	$highcharts->xAxisTtitle="{days}";
	$highcharts->datas=array("{requests}"=>$ydata);
	echo $highcharts->BuildChart();
}
function graph5()
{
    $q = new postgres_sql();
    $tpl = new templates();
    $zmd5 = $_GET["zmd5"];
    if ($zmd5 == null) {
        echo "alert('no key sended');UnlockPage();";
        die;
    }
    $page = CurrentPageName();
    $time = time();
    $table = "{$zmd5}report";
    $results = $q->QUERY_SQL("SELECT SUM(size) as size, familysite FROM \"{$table}\" WHERE category='' GROUP BY familysite order by size DESC LIMIT 15");
    while ($ligne = @pg_fetch_assoc($results)) {
        $size = $ligne["size"] / 1024;
        $category = $ligne["familysite"];
        $PieData[$category] = $size;
    }
    $highcharts = new highcharts();
    $highcharts->container = "graph5-{$zmd5}";
    $highcharts->PieDatas = $PieData;
    $highcharts->ChartType = "pie";
    $highcharts->PiePlotTitle = "Unknown";
    $highcharts->Title = $tpl->_ENGINE_parse_body("TOP Unknown {websites}/{size} (KB)");
    echo $highcharts->BuildChart();
    echo "\n";
    echo "if(document.getElementById('websites-button-area')){document.getElementById('websites-button-area').innerHTML='';}\n";
    echo "LoadAjax('table5-{$zmd5}','{$page}?table5=yes&zmd5={$zmd5}&t={$_GET["t"]}');\n";
}
function graph1()
{
    $cacheFile = "/usr/share/artica-postfix/ressources/logs/web/InfluxDB.state";
    $tpl = new templates();
    $ARRAY = unserialize(@file_get_contents($cacheFile));
    $ARRAY["PART"] = $ARRAY["PART"] / 1024;
    $PART = intval($ARRAY["PART"]) - intval($ARRAY["SIZEKB"]);
    $MAIN["Partition " . FormatBytes($ARRAY["PART"])] = $PART;
    $MAIN["DB " . FormatBytes($ARRAY["SIZEKB"])] = $ARRAY["SIZEKB"];
    $PieData = $MAIN;
    $highcharts = new highcharts();
    $highcharts->container = "influx-db-size";
    $highcharts->PieDatas = $PieData;
    $highcharts->ChartType = "pie";
    $highcharts->PiePlotTitle = "{database_size}";
    $highcharts->Title = $tpl->_ENGINE_parse_body("{database_size} " . FormatBytes($ARRAY["SIZEKB"]) . " (MB)");
    echo $highcharts->BuildChart();
}
function graph4()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new postgres_sql();
    $zmd5 = $_GET["zmd5"];
    if ($zmd5 == null) {
        echo "alert('no key sended');UnlockPage();";
        die;
    }
    $table = "{$zmd5}report";
    $results = $q->QUERY_SQL("SELECT SUM(rqs) as rqs,website FROM \"{$table}\" GROUP BY website ORDER BY rqs DESC LIMIT 10");
    while ($ligne = @pg_fetch_assoc($results)) {
        $size = $ligne["rqs"];
        $FAMILYSITE = $ligne["website"];
        $PieData[$FAMILYSITE] = $size;
    }
    $highcharts = new highcharts();
    $highcharts->container = "graph4-{$zmd5}";
    $highcharts->PieDatas = $PieData;
    $highcharts->ChartType = "pie";
    $highcharts->PiePlotTitle = "{website}";
    $highcharts->Title = $tpl->_ENGINE_parse_body("TOP {website}/{hits}");
    echo $highcharts->BuildChart();
    echo "\n";
    echo "if(document.getElementById('websites-button-area')){document.getElementById('websites-button-area').innerHTML='';}\n";
    echo "LoadAjax('table4-{$zmd5}','{$page}?table4=yes&zmd5={$zmd5}&t={$_GET["t"]}');\n";
}
Esempio n. 30
0
function eth_week()
{
    if (!class_exists("highcharts")) {
        return;
    }
    $tpl = new templates();
    $title = "{$_GET["ETH"]} {NIC_{$_GET["type"]}} {this_week}";
    $timetext = "{week}";
    $q = new mysql();
    $results = $q->QUERY_SQL("SELECT ZDATE,{$_GET["type"]} FROM RXTX_WEEK WHERE ETH='{$_GET["ETH"]}' ORDER BY ZDATE", "artica_events");
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $SIZE = $ligne[$_GET["type"]];
        $SIZE = $SIZE / 1024;
        $SIZE = round($SIZE / 1024, 2);
        $time = $ligne["ZDATE"];
        $xdata[] = $time;
        $ydata[] = $SIZE;
    }
    $highcharts = new highcharts();
    $highcharts->container = "{$_GET["ETH"]}-{$_GET["type"]}-week";
    $highcharts->xAxis = $xdata;
    $highcharts->TitleFontSize = "14px";
    $highcharts->AxisFontsize = "12px";
    $highcharts->Title = $title;
    $highcharts->yAxisTtitle = "{size} (MB)";
    $highcharts->xAxisTtitle = $timetext;
    $highcharts->xAxis_labels = false;
    $highcharts->LegendPrefix = null;
    $highcharts->LegendSuffix = "MB";
    //$highcharts->subtitle="<a href=\"javascript:Loadjs('squid.sizegraphs.php')\" style='text-decoration:underline'>{more_details}</a>";
    $highcharts->datas = array("{size}" => $ydata);
    echo $highcharts->BuildChart();
}