コード例 #1
0
function top10()
{
    $tpl = new templates();
    $q = new mysql();
    $sql = "SELECT SUM(emails) as conx,delivery_domain FROM smtp_logs_day \n\tGROUP BY delivery_domain ORDER BY conx DESC LIMIT 0,10";
    $html = "\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t\t<th>{mails}</th>\n\t\t<th>{domains}</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>";
    $filename = "postfix.domains.top.png";
    $gp = new artica_graphs(dirname(__FILE__) . "/ressources/logs/web/{$filename}", 50);
    $results = $q->QUERY_SQL($sql, "artica_events");
    if (!$q->ok) {
        echo $q->mysql_error;
        return;
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        if ($classtr == "oddRow") {
            $classtr = null;
        } else {
            $classtr = "oddRow";
        }
        $js = "Loadjs('postfix.stats.single-domain.php?domain=" . urlencode($ligne["delivery_domain"]) . "')";
        $style = " style='text-decoration:underline' ";
        $html = $html . "\n\t<tr class={$classtr}>\n\t\t\t<td style='font-size:14px;font-weight:bold' width=1% align='center'><a href=\"javascript:blur()\" OnClick=\"javascript:{$js}\">{$ligne["conx"]}</a></td>\n\t\t\t<td style='font-size:14px;font-weight:bold' nowrap width=99%><a href=\"javascript:blur()\" OnClick=\"javascript:{$js}\" {$style}>{$ligne["delivery_domain"]}</a></td>\n\t\t</tr>\n\t";
        $gp->xdata[] = $ligne["conx"];
        $gp->ydata[] = $ligne["delivery_domain"];
    }
    $table[] = "</table>";
    $time = time();
    $gp->width = 560;
    $gp->height = 580;
    $gp->ViewValues = false;
    $gp->x_title = "{ipaddr}";
    $gp->pie();
    echo "<center><img src='ressources/logs/web/{$filename}?time={$time}'></center>";
    echo "<hr>";
    echo $tpl->_ENGINE_parse_body("{$html}</table>");
}
コード例 #2
0
function paragraphe2()
{
    $table = $_GET["table"];
    $user = $_GET["user"];
    $field = $_GET["field"];
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $sql = "SELECT SUM(hits) as thits,SUM(size) as tsize,category FROM(SELECT {$table}.hits,{$table}.size,{$table}.category,\n\twebfilters_categories_caches.master_category FROM webfilters_categories_caches,{$table}\n\tWHERE webfilters_categories_caches.categorykey={$table}.category \n\tAND {$table}.`{$field}`='{$user}'\n\t) as t\n\tGROUP BY category ORDER BY tsize DESC LIMIT 0,1";
    $ligne2 = mysql_fetch_array($sql);
    $p0 = $tpl->_ENGINE_parse_body("{top_visited_categories_mostwieght}");
    $p0 = str_replace("X", $ligne["category"], $p0);
    $p0 = str_replace("Y", FormatBytes($ligne["tsize"] / 1024), $p0);
    $p0 = "<div style='color:#CF1717;margin-top:5px;font-size:12px'>{$p0}</div>";
    $sql = "SELECT SUM(hits) as thits,SUM(size) as tsize,category FROM(SELECT {$table}.hits,{$table}.size,{$table}.category,\n\twebfilters_categories_caches.master_category FROM webfilters_categories_caches,{$table}\n\tWHERE webfilters_categories_caches.categorykey={$table}.category \n\tAND {$table}.`{$field}`='{$user}'\n\t) as t\n\tGROUP BY category ORDER BY thits DESC LIMIT 0,10";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo "<H4>{$q->mysql_error}</H4>";
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        if ($ligne["category"] == null) {
            continue;
        }
        $ligne["tsize"] = FormatBytes($ligne["tsize"] / 1024);
        $ydata[] = "{$ligne["category"]}";
        $xdata[] = $ligne["thits"];
        $rows[] = "\n\t\t<tr>\n\t\t\t<td width=1%><img src='img/20-categories-personnal.png'></td>\n\t\t\t<td>\n\t\t\t<strong style='font-size:12px'>\n\t\t\t\t<a href=\"javascript:blur();\" \n\t\t\t\tOnClick=\"javascript:Loadjs('squid.traffic.week.user.category.php?category={$ligne["category"]}&table={$table}&field={$field}&user={$user}');\" \n\t\t\t\tstyle='font-size:12px;text-decoration:underline;font-weight:bold'>\n\t\t\t\t{$ligne["category"]}</a> ({$ligne["thits"]} {hits} - {$ligne["tsize"]})\n\t\t\t\t\n\t\t\t</strong>\n\t\t\t</td>\n\t\t</tr>";
    }
    $targetedfile = "ressources/logs/" . basename(__FILE__) . "." . __FUNCTION__ . "." . time() . ".png";
    $gp = new artica_graphs($targetedfile);
    $gp->xdata = $xdata;
    $gp->ydata = $ydata;
    $gp->width = 250;
    $gp->height = 400;
    $gp->ViewValues = true;
    //$gp->PieLegendHide=true;
    $gp->x_title = $tpl->_ENGINE_parse_body("{cache}");
    $gp->pie();
    $html = "<div style='color:#CF1717;font-weight:bold;margin-top:5px;font-size:13.5px'>{top_visited_categories} :</div>\n\t{$p0}\n\t<table style='width:100%'>\n\t\t<tbody>\n\t\t\t" . @implode("\n", $rows) . "\n\t\t</tbody>\n\t</table>\n\t<center style='margin-top:10px'><img src='{$targetedfile}'></center>\n\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
コード例 #3
0
function paragraphe2()
{
    $table = $_GET["table"];
    $user = $_GET["user"];
    $field = $_GET["field"];
    $category = $_GET["category"];
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $qs = "category='{$category}'";
    $sql = "SELECT SUM(hits) as thits,SUM(size) as tsize,category,sitename FROM {$table}\n\tGROUP BY category,sitename\n\tHAVING {$qs} ORDER BY hits DESC LIMIT 0,10";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo "<H4>{$q->mysql_error}</H4>";
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $ligne["tsize"] = FormatBytes($ligne["tsize"] / 1024);
        $ydata[] = "{$ligne["sitename"]}";
        $xdata[] = $ligne["thits"];
        $js = "Loadjs('squid.traffic.statistics.week.website.php?www={$ligne["sitename"]}&field=sitename&table={$table}')";
        $rows[] = "<tr>\n\t\t<td width=1%><img src='img/web-22.png'></td>\n\t\t<td style='font-size:12px;'><a href=\"javascript:blur();\" style='font-size:12px;font-weight:bold;text-decoration:underline' OnClick=\"javascript:{$js}\">{$ligne["sitename"]}</a> ({$ligne["thits"]} {hits} - {$ligne["tsize"]})</strong></td></tr>";
    }
    $targetedfile = "ressources/logs/" . basename(__FILE__) . "." . __FUNCTION__ . "." . time() . ".png";
    $gp = new artica_graphs($targetedfile);
    $gp->xdata = $xdata;
    $gp->ydata = $ydata;
    $gp->width = 250;
    $gp->height = 400;
    $gp->ViewValues = true;
    //$gp->PieLegendHide=true;
    $gp->x_title = $tpl->_ENGINE_parse_body("{cache}");
    $gp->pie();
    $html = "<div style='color:#CF1717;font-weight:bold;margin-top:5px;font-size:13.5px'>{top_visited_websites} :</div>\n\t<table style='width:100%'>\n\t<tbody>\n\t" . @implode("\n", $rows) . "\n\t</tbody>\n\t</table>\n\t<center style='margin-top:10px'><img src='{$targetedfile}'></center>\n\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
コード例 #4
0
        if ($cached_size > 0 && $not_cached_size > 0) {
            $sum = $cached_size + $not_cached_size;
            $pourcent = round($cached_size / $sum * 100);
            $title = $tpl->_ENGINE_parse_body("{cache_performance} {$pourcent}%");
            $gp = new artica_graphs(dirname(__FILE__) . "/ressources/logs/web/squid.cache.perf.today.png", 0);
            $gp->xdata[] = $cached_size;
            $gp->ydata[] = "{$cachedTXT} " . FormatBytes($cached_size / 1024);
            $gp->xdata[] = $not_cached_size;
            $gp->ydata[] = "{$NOTcachedTXT} " . FormatBytes($not_cached_size / 1024);
            $gp->width = 300;
            $gp->height = 120;
            $gp->PieExplode = 5;
            $gp->PieLegendHide = true;
            $gp->ViewValues = false;
            $gp->x_title = null;
            $gp->pie();
            if (is_file("ressources/logs/web/squid.cache.perf.today.png")) {
                echo "<div onmouseout=\"javascript:this.className='paragraphe';this.style.cursor='default';\" onmouseover=\"javascript:this.className='paragraphe_over';\n\t\t\t\t\tthis.style.cursor='pointer';\" id=\"6ce2f4832d82c6ebaf5dfbfa1444ed58910\" OnClick=\"javascript:Loadjs('squid.cache.perf.stats.php')\" class=\"paragraphe\" style=\"width: 300px; min-height: 112px; cursor: default;\">\n\t\t\t\t\t<h3 style='text-transform: none;margin-bottom:5px'>{$title}</h3>\n\t\t\t\t\t<div style='font-size:11px;margin-top:-8px'>{$today}: {$cachedTXT}: " . FormatBytes($cached_size / 1024) . " - {$NOTcachedTXT} " . FormatBytes($not_cached_size / 1024) . "</div>\n\t\t\t\t\t<img src='ressources/logs/web/squid.cache.perf.today.png'>\n\t\t\t\t\t</div>";
            } else {
                writelogs("ressources/logs/web/squid.cache.perf.today.png no such file", __FUNCTION__, __FILE__, __LINE__);
            }
        }
    }
}
// --------------------------------------------------------------------------------------
echo "</center>\n<div id='notifs-part'></div>\n<script>LoadAjax('notifs-part','admin.left.php?partall=yes');</script>\n\n";
function hour()
{
    $page = CurrentPageName();
    $GLOBALS["CPU_NUMBER"] = intval($users->CPU_NUMBER);
    $cpunum = $GLOBALS["CPU_NUMBER"] + 1;
コード例 #5
0
function user_category_graph()
{
    $tpl = new templates();
    if ($_GET["time"] == 0) {
        $d = date("W");
        $sqlq = "WEEK(days)=WEEK(NOW())";
    }
    if ($_GET["time"] == 1) {
        $d = date("Y-m");
        $sqlq = "MONTH(days)=MONTH(NOW())";
    }
    $html = "<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n\t\t<thead class='thead'>\n\t\t\t<tr>\n\t\t\t<th>{size}</th>\n\t\t\t<th>{members}</th>\n\t\t\t</tr>\n\t\t</thead>\n\t\t<tbody class='tbody'>";
    $sql = "SELECT COUNT(hits) as thits,category FROM squid_events_clients_sites \n\tWHERE {$sqlq} \n\tAND YEAR(days)=YEAR(NOW()) \n\tAND client='{$_GET["client"]}' \n\tGROUP BY category ORDER BY thits \n\tDESC LIMIT 0,10";
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_events");
    if (mysql_num_rows($results) == 0) {
        $tpl = new templates();
        echo $tpl->_ENGINE_parse_body("<H2 style='color:black'>{NO_DATA_COME_BACK_LATER}</H2>");
        return;
    }
    if (!$q->ok) {
        echo $q->mysql_error;
    }
    $gp = new artica_graphs(dirname(__FILE__) . "/ressources/logs/web/squid.{$d}.user.{$_GET["client"]}.category.png", 0);
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        if (trim($ligne["category"]) == null) {
            $ligne["category"] = "unknown";
        }
        if ($classtr == "oddRow") {
            $classtr = null;
        } else {
            $classtr = "oddRow";
        }
        $js = "Loadjs('squid.stats.client.php?client-js=yes&time={$xtime}&client=" . urlencode($ligne["CLIENT"]) . "')";
        $html = $html . "\n\t\t\t<tr class={$classtr}>\n\t\t\t<td style='font-size:15px'><a href=\"javascript:blur();\" OnClick=\"javascript:{$js}\">{$ligne["thits"]}</a></td>\n\t\t\t<td style='font-size:15px'><a href=\"javascript:blur();\" OnClick=\"javascript:{$js}\">{$ligne["category"]}</a></td>\n\t\t\t</tr>";
        $gp->xdata[] = $ligne["thits"];
        $gp->ydata[] = $ligne["category"];
    }
    $gp->width = 560;
    $gp->height = 580;
    $gp->ViewValues = false;
    $gp->x_title = "{categories}";
    $gp->pie();
    $html = "<img src='ressources/logs/web/squid.{$d}.user.{$_GET["client"]}.category.png'  border=0>\n\t<hr>{$html}</table>";
    return $tpl->_ENGINE_parse_body($html);
}
コード例 #6
0
function countries_month()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $sql = "SELECT SUM(hits) as thits,country FROM kav4proxyDays WHERE MONTH(days)=MONTH(NOW()) AND YEAR(days)=YEAR(NOW()) GROUP BY country ORDER BY thits DESC LIMIT 0,10";
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_events");
    if (!$q->ok) {
        echo "<H2>{$q->mysql_error}\n</H2>";
        return;
    }
    $html = "\n\t<table style='width:100%'>\n\t<tr>\n\t<td valign='top' width=1%><img src=img/domain-64.png></td>\n\t<td><div class=explain>{kav4proxycountry_month_stats_explain}</div></td>\n\t</tr>\n\t</table>\n\t<center style='margin:5px'><img src='ressources/logs/web/kav4proxy.MCOUNT.png'  border=0></center>\n\t\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t\t<th width=1% colspan=2>{hits}</th>\n\t\t<th width=1%>{country}</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>";
    $gp->xdata[] = "";
    $gp->ydata[] = "";
    @unlink(dirname(__FILE__) . "/ressources/logs/web/kav4proxy.MCOUNT.png");
    $gp = new artica_graphs(dirname(__FILE__) . "/ressources/logs/web/kav4proxy.MCOUNT.png", 0);
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        if ($classtr == "oddRow") {
            $classtr = null;
        } else {
            $classtr = "oddRow";
        }
        $gp->xdata[] = $ligne["thits"];
        $text_category = $ligne["country"];
        $country = $ligne["country"];
        if ($country != null) {
            $img_country = GetFlags($country);
        } else {
            $img_country = "flags/name.png";
        }
        if ($text_category == null) {
            $text_category = $tpl->_ENGINE_parse_body("{unknown}");
        }
        $gp->ydata[] = $text_category;
        $html = $html . "<tr class={$classtr}>\n\t\t\t<td width=1% nowrap><img src='img/{$img_country}'></td>\n\t\t\t<td width=1% nowrap><strong style='font-size:14px'>{$ligne["thits"]}</strong></td>\n\t\t\t<td width=99% nowrap align=left><strong style='font-size:14px'>{$text_category}</strong></td>\n\t\t\t</tr>\n\t\t\t";
    }
    $html = $html . "\n\t</tbody>\n\t</table>\n\t";
    $gp->width = 560;
    $gp->height = 580;
    $gp->ViewValues = false;
    $gp->x_title = "{country}";
    $gp->pie();
    echo $tpl->_ENGINE_parse_body($html);
}
コード例 #7
0
function senders()
{
    $domain = $_GET["domain"];
    $q = new mysql();
    $tpl = new templates();
    $sql = "\n\tSELECT SUM(hits) as hits, sender_user as mailto \n\tFROM smtp_logs_day_users\n\tWHERE zDay>=DATE_SUB(NOW(),INTERVAL 7 DAY)\n\tAND recipient_domain='{$domain}'\n\tGROUP BY sender_user\n\tORDER BY hits DESC \n\tLIMIT 0,10";
    $html = "\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t\t<th>{hits}</th>\n\t\t<th>{senders}</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>";
    $filename = "postfix.domain.{$domain}.top.senders.png";
    $gp = new artica_graphs(dirname(__FILE__) . "/ressources/logs/web/{$filename}", 50);
    $results = $q->QUERY_SQL($sql, "artica_events");
    if (!$q->ok) {
        echo $q->mysql_error;
        return;
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        if ($ligne["mailto"] == null) {
            continue;
        }
        if ($classtr == "oddRow") {
            $classtr = null;
        } else {
            $classtr = "oddRow";
        }
        //$js="Loadjs('postfix.stats.single-domain.php?domain=".urlencode($ligne["delivery_domain"])."')";
        //$style=" style='text-decoration:underline' ";
        $html = $html . "\n\t<tr class={$classtr}>\n\t\t\t<td style='font-size:14px;font-weight:bold' width=1% align='center'><a href=\"javascript:blur()\" OnClick=\"javascript:{$js}\">{$ligne["hits"]}</a></td>\n\t\t\t<td style='font-size:14px;font-weight:bold' nowrap width=99%><a href=\"javascript:blur()\" OnClick=\"javascript:{$js}\" {$style}>{$ligne["mailto"]}</a></td>\n\t\t</tr>\n\t";
        $gp->xdata[] = $ligne["hits"];
        $gp->ydata[] = $ligne["mailto"];
    }
    $table[] = "</table>";
    $time = time();
    $gp->width = 560;
    $gp->height = 580;
    $gp->ViewValues = false;
    $gp->x_title = "{mailto}";
    $gp->pie();
    echo "<center><img src='ressources/logs/web/{$filename}?time={$time}'></center>";
    echo "<hr>";
    echo $tpl->_ENGINE_parse_body("{$html}</table>");
}
コード例 #8
0
function day_top_members(){
	$page=CurrentPageName();
	$tpl=new templates();	
	$q=new mysql_squid_builder();	
	$search=trim($_GET["search"]);
	if(!isset($_GET["day"])){$_GET["day"]=$q->HIER();}
	if($_GET["day"]==null){$_GET["day"]=$q->HIER();}
	$dayfull="{$_GET["day"]} 00:00:00";
	$date=strtotime($dayfull);
	$tablesrc=date("Ymd",$date)."_members";
	$sql="SELECT SUM(hits) as tcount,client,uid,MAC,hostname FROM $tablesrc GROUP BY client,uid,MAC,hostname ORDER BY SUM(hits) DESC LIMIT 0,10";
	$dayText=date('l',$date);
	if(!$q->TABLE_EXISTS($tablesrc)){return;}
	
		$table="
	<center>
<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>
<thead class='thead'>
	<tr>
		<th width=1%>&nbsp;</th>
		<th width=1%>{hits}</th>
		<th width=99%>{members}</th>
	</tr>
</thead>
<tbody>";	
	
	$targetedfile="ressources/logs/".basename(__FILE__).".".__FUNCTION__.".$mdF$tablesrc.png";
	$gp=new artica_graphs($targetedfile,0);	
	$results=$q->QUERY_SQL($sql);
	if(!$q->ok){echo "<H2>$q->mysql_error</H2><center style='font-size:11px'><code>$sql</code></center>";}	
		
		while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){	
			$mac=trim($ligne["MAC"]);
			$ipaddr=$ligne["client"];
			$hostname=$ligne["hostname"];
			$ipaddrlink=
			"<a href=\"javascript:blur();\" 
				OnClick=\"javascript:LoadAjax('day_graphs_for_members','$page?day-graphs-perform=yes&day={$_GET["day"]}&user-field=client&user={$ligne["client"]}');\" style='text-decoration:underline'>{$ligne["client"]}</a>";
			
			$uid=trim($ligne["uid"]);
			if($uid=='-'){$uid=null;}
			if($uid==null){
				$legendHREF=$ipaddr;
				if($hostname<>null){
					if(!preg_match("#^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+#", $hostname)){
						$tt=explode(".", $hostname);
						$hostname=$tt[0];
					}
					$legendHREF=$hostname;}
				
				$uid="<a href=\"javascript:blur();\" 
				OnClick=\"javascript:LoadAjax('day_graphs_for_members','$page?day-graphs-perform=yes&day={$_GET["day"]}&user-field=client&user=$ipaddr');\" 
				style='text-decoration:underline'>$legendHREF</a>";
				
				if($mac<>null){
					$uid="<a href=\"javascript:blur();\" 
					OnClick=\"javascript:LoadAjax('day_graphs_for_members','$page?day-graphs-perform=yes&day={$_GET["day"]}&user-field=MAC&user=$mac');\" 
					style='text-decoration:underline'>$legendHREF</a>";
				}
				
				
				
			}else{
				$uid="<a href=\"javascript:blur();\" 
				OnClick=\"javascript:LoadAjax('day_graphs_for_members','$page?day-graphs-perform=yes&day={$_GET["day"]}&user-field=uid&user=$uid');\" 
				style='text-decoration:underline'>$uid</a>";
				
			}
			
			
			if($classtr=="oddRow"){$classtr=null;}else{$classtr="oddRow";}	
			$table=$table.
				"
				<tr class=$classtr style='height:auto'>
					<td width=1%  style='font-size:14px;' nowrap><img src='img/user-18.png'></td>
					<td width=1%  style='font-size:14px;'nowrap><strong>{$ligne["tcount"]}</strong></td>
					<td width=99%  style='font-size:14px;' nowrap><strong>$uid ($ipaddrlink)<div>$mac</div></strong></td>
				</tr>
				";	
			
			
			
				if(trim($ligne["uid"])=='-'){$ligne["uid"]=null;}
				$legend=$ligne["client"];
				if($hostname<>null){$legend=$hostname;}
				$gp->xdata[]=$ligne["tcount"];
				$gp->ydata[]=$ligne["uid"]."-".$legend;
		}	
	

	$gp->width=560;
	$gp->height=350;
	$gp->ViewValues=false;
	$gp->x_title="{hits}";
	$gp->pie();			
	if(!is_file($targetedfile)){writelogs("Fatal \"$targetedfile\" no such file!",__FUNCTION__,__FILE__,__LINE__);$targetedfile="img/kas-graph-no-datas.png";}
	echo $tpl->_ENGINE_parse_body("<div style='font-size:16px'>{{$dayText}} TOP {members} ({hits})</div>
	<center>
	<img src='$targetedfile'>
	</center>
	</div>
	$table</tbody></table>
	
	");	
	
}
コード例 #9
0
function blocked_ip_stats()
{
    $tpl = new templates();
    $page = CurrentPageName();
    switch ($_GET["time"]) {
        case 1:
            $sql = "SELECT SUM(conx) as conx,zhour as ttime FROM mail_con_err_stats WHERE zday=DAY(NOW()) AND YEAR(zDate)=YEAR(NOW()) GROUP BY zhour ORDER BY zhour";
            $x_title = "Hours";
            $sql2 = "\n\t\t\tSELECT SUM( conx ) AS conx, ipaddr\n\t\t\tFROM mail_con_err_stats\n\t\t\tWHERE zday = DAY( NOW( ) )\n\t\t\tAND YEAR( zDate ) = YEAR( NOW( ) )\n\t\t\tGROUP BY ipaddr\n\t\t\tORDER BY conx DESC\n\t\t\tLIMIT 0 , 10";
            break;
        case 2:
            $sql = "SELECT COUNT(conx) AS conx, zday AS ttime\n\t\t\tFROM mail_con_err_stats\n\t\t\tWHERE YEAR( zDate ) = YEAR( NOW( ) ) \n\t\t\tAND zDate>=DATE_SUB(NOW(),INTERVAL 7 DAY)\n\t\t\tGROUP BY zDate,zday\n\t\t\tORDER BY zDate\n\t\t\tLIMIT 0 , 8";
            $x_title = "Days";
            $sql2 = "\n\t\t\tSELECT SUM( conx ) AS conx, ipaddr\n\t\t\tFROM mail_con_err_stats\n\t\t\tWHERE YEAR( zDate ) = YEAR( NOW( ) )\n\t\t\tAND zDate>=DATE_SUB(NOW(),INTERVAL 7 DAY)\n\t\t\tGROUP BY ipaddr\n\t\t\tORDER BY conx DESC\n\t\t\tLIMIT 0 , 10";
            break;
        default:
            break;
    }
    echo $tpl->_ENGINE_parse_body("<span style='font-size:16px'>{GRAPH_POSTFIX_REJECTED_CONNEXIONS}</span><hr>");
    $gp = new artica_graphs(dirname(__FILE__) . "/ressources/logs/web/postfix.{$_GET["time"]}.hits.png", 50);
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_events");
    if (!$q->ok) {
        echo "<span style='font-size:16px'>{$q->mysql_error}</span>";
    }
    $count = mysql_num_rows($results);
    writelogs($count . " rows", __FUNCTION__, __FILE__, __LINE__);
    if (mysql_num_rows($results) == 0) {
        $tpl = new templates();
        echo $tpl->_ENGINE_parse_body("<H2>{NO_DATA_COME_BACK_LATER}</H2>");
        return;
    }
    if (!$q->ok) {
        echo $q->mysql_error;
        return;
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $xdata[] = $ligne["ttime"];
        $ydata[] = $ligne["conx"];
    }
    $gp->width = 600;
    $gp->xdata = $xdata;
    $gp->ydata = $ydata;
    $gp->y_title = "Connexions";
    $gp->x_title = $x_title;
    $gp->title = null;
    //$gp->Fillcolor="blue@0.9";
    //$gp->color="146497";
    $gp->line_green();
    $time = time();
    echo "<center><img src='ressources/logs/web/postfix.{$_GET["time"]}.hits.png?time={$time}'></center>";
    echo "<hr>";
    $gp = new artica_graphs(dirname(__FILE__) . "/ressources/logs/web/postfix.{$_GET["time"]}.top-hits.png", 50);
    $table[] = "\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t\t<th>{connexions}</th>\n\t\t<th>{ipaddr}</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>";
    $results = $q->QUERY_SQL($sql2, "artica_events");
    if (!$q->ok) {
        echo "<span style='font-size:16px'>{$q->mysql_error}</span>";
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $js = "Loadjs('{$page}?blocked-ip-single=" . urlencode($ligne["ipaddr"]) . "')";
        $style = " style='text-decoration:underline' ";
        if ($classtr == "oddRow") {
            $classtr = null;
        } else {
            $classtr = "oddRow";
        }
        $table[] = "\n\t<tr class={$classtr}>\n\t\t\t<td style='font-size:14px;font-weight:bold' nowrap width=1%><a href=\"javascript:blur()\" OnClick=\"javascript:{$js}\" {$style}>{$ligne["conx"]}</a></td>\n\t\t\t<td style='font-size:14px;font-weight:bold' nowrap width=99%><a href=\"javascript:blur()\" OnClick=\"javascript:{$js}\" {$style}>{$ligne["ipaddr"]}</a></td>\n\t\t</tr>\n\t";
        $gp->xdata[] = $ligne["conx"];
        $gp->ydata[] = $ligne["ipaddr"];
    }
    $table[] = "</table>";
    $time = time();
    $gp->width = 560;
    $gp->height = 580;
    $gp->ViewValues = false;
    $gp->x_title = "{ipaddr}";
    $gp->pie();
    echo $tpl->_ENGINE_parse_body("\n\t<center>\n\t<img src='ressources/logs/web/postfix.{$_GET["time"]}.top-hits.png?time={$time}'  border=0>\n\t<hr>" . @implode("\n", $table));
}
コード例 #10
0
function what_popup()
{
    $q = new mysql_squid_builder();
    $tpl = new templates();
    $tableQuery = $_GET["table"];
    $tpl = new templates();
    $page = 1;
    $FORCE_FILTER = null;
    $total = 0;
    $field = $_GET["field"];
    $value = $_GET["value"];
    if (preg_match("#quotamonth#", $tableQuery)) {
        $xtime = $q->TIME_FROM_QUOTAMONTH_TABLE($tableQuery);
        $tableQuery = date("Ym", $xtime) . "_day";
    }
    if ($tableQuery == null) {
        $MyTableMonth = date("Ym") . "_day";
        $tableQuery = $MyTableMonth;
    }
    if (preg_match("#_week#", $_GET["table"])) {
        $title_add = "&raquo;" . $tpl->_ENGINE_parse_body($q->WEEK_TITLE_FROM_TABLENAME($_GET["table"]));
    }
    if (preg_match("#_day\$#", $_GET["table"])) {
        $title_add = "&raquo;" . $tpl->_ENGINE_parse_body($q->MONTH_TITLE_FROM_TABLENAME($_GET["table"]));
    }
    if (preg_match("#_hour\$#", $_GET["table"])) {
        $title_add = "&raquo;" . $tpl->_ENGINE_parse_body($q->DAY_TITLE_FROM_TABLENAME($_GET["table"]));
    }
    if ($_GET["field"] == "ipaddr") {
        $_GET["field"] = "client";
    }
    $sql = "SELECT familysite,{$_GET["field"]},SUM(hits) as hits,category FROM {$tableQuery}\n\tWHERE {$_GET["field"]}='{$_GET["value"]}' GROUP BY familysite,{$_GET["field"]} ORDER BY hits DESC LIMIT 0,10";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo $q->mysql_error_html();
    }
    if ($GLOBALS["VERBOSE"]) {
        echo mysql_num_rows($results) . " entries <br>";
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        if (strpos($ligne["category"], ",") > 0) {
            $tp = explode(",", $ligne["category"]);
            while (list($index, $cat) = each($tp)) {
                if (isset($valsz[$cat])) {
                    continue;
                }
                $valsz[$cat] = $ligne["hits"];
            }
            continue;
        }
        $valsz[$cat] = $ligne["hits"];
    }
    while (list($cat, $count) = each($valsz)) {
        $xdata[] = $count;
        $ydata[] = $cat;
    }
    $targetedfilePie = "ressources/logs/" . basename(__FILE__) . "." . __FUNCTION__ . "." . md5($sql) . ".pie.png";
    $gp = new artica_graphs($targetedfilePie);
    $gp->xdata = $xdata;
    $gp->ydata = $ydata;
    $gp->width = 750;
    $gp->height = 550;
    $gp->ViewValues = true;
    $gp->x_title = $tpl->_ENGINE_parse_body("{what} ? {$MyMonthText}");
    $gp->pie();
    if (!is_file($targetedfilePie)) {
        $html = "<center>{$targetedfilePie} no such file</center>";
        writelogs("Fatal \"{$targetedfilePie}\" no such file!", __FUNCTION__, __FILE__, __LINE__);
    } else {
        $html = $html . "\n\t\t<center>\n\t\t\t<div style='width:99%' class=form>\n\t\t\t\t<div style='font-size:18px;margin:8px'>&laquo;{$value}&raquo;&nbsp;{what} {$title_add}</div>\n\t\t\t\t<img src='{$targetedfilePie}'>\n\t\t\t</div>\n\t\t\t\n\t\t\t\n\t\t</center>\n\t\t\n\t\t";
    }
    echo $tpl->_ENGINE_parse_body($html);
}
コード例 #11
0
function week_topwebsites_graph()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $q = new mysql_squid_builder();
    if ($_GET["table"] == null) {
        $table = date("YW") . "_week";
    } else {
        $table = $_GET["table"];
    }
    if (!$q->TABLE_EXISTS($table)) {
        echo "<H3>" . $tpl->_ENGINE_parse_body("{week_table_was_not_builded}") . "</h3>";
    }
    $results = $q->QUERY_SQL("SELECT SUM(size) as tsize,familysite FROM {$table} GROUP BY familysite ORDER BY tsize DESC LIMIT 0,5");
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $downloaded_bin = $ligne["tsize"];
        $downloaded_text = FormatBytes($downloaded_bin / 1024);
        $downloaded_text = str_replace("&nbsp;", " ", $downloaded_text);
        $downloaded_bin = round($downloaded_bin / 1024 / 1000);
        $website = $ligne["familysite"];
        $ydata[] = "MB {$website} {$downloaded_text}";
        $xdata[] = $downloaded_bin;
    }
    $targetedfile = "ressources/logs/" . basename(__FILE__) . "." . __FUNCTION__ . "." . time() . ".png";
    $gp = new artica_graphs($targetedfile);
    $gp->xdata = $xdata;
    $gp->ydata = $ydata;
    $gp->width = 250;
    $gp->height = 400;
    $gp->ViewValues = true;
    //$gp->PieLegendHide=true;
    $gp->x_title = $tpl->_ENGINE_parse_body("{cache}");
    $gp->pie();
    echo $tpl->_ENGINE_parse_body("<center style='margin:0px;margin-bottom:5px;padding:3px;border:1px solid #CCCCCC'>\n\t\t<strong style='font-size:12px'>{phrase_topwebsize_bysize}</strong>\n\t\t<img src='{$targetedfile}' style='margin-bottom:5px'>\n\t\t\n\t \t</center>\n\t \t\n\t") . "<script>LoadAjax('panel-right-top','{$page}?users-usually=yes&table={$table}')</script>";
}
コード例 #12
0
function popup()
{
    $img = "<img src='img/bg_sqlgrey-300.jpg'>";
    $page = CurrentPageName();
    $mg = Paragraphe('folder-mailbox-64.png', '{main_settings}', '{main_settings_text}', "javascript:PostfixMultiMilterGreymain_settings_greylist()", null, 210, 100, 0, true);
    $mg1 = Paragraphe('folder-logs-643.png', '{events}', '{events_text}', "javascript:PostfixMultiMilterGreymain_events_greylist()", null, 210, 100, 0, true);
    if (is_file("ressources/logs/greylist-count-{$_GET["hostname"]}.tot")) {
        $datas = unserialize(@file_get_contents("ressources/logs/greylist-count-{$_GET["hostname"]}.tot"));
        if (is_array($datas)) {
            @unlink("ressources/logs/web/mgreylist.master1.db.png");
            $gp = new artica_graphs(dirname(__FILE__) . "/ressources/logs/web/mgreylist.{$_GET["hostname"]}1.db.png", 0);
            $gp->xdata[] = $datas["GREYLISTED"];
            $gp->ydata[] = "greylisted";
            $gp->xdata[] = $datas["WHITELISTED"];
            $gp->ydata[] = "whitelisted";
            $gp->width = 310;
            $gp->height = 310;
            $gp->ViewValues = false;
            $gp->x_title = "{status}";
            $gp->pie();
            $imgG = "<img src='ressources/logs/web/mgreylist.{$_GET["hostname"]}1.db.png'>";
        }
    }
    $content = "\n\t<H2>{smtp_server}::{$_GET["hostname"]}</H2>\n\t<table style='width:100'>\n\t<tr>\n\t\t<td valign='top'>{$mg}</td>\n\t\t<td valign='top'>{$mg1}</td>\n\t</table>\n\t<center>{$imgG}</center>\n\t";
    $html = "\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top'>\n\t\t\t{$img}\n\t\t\t<br>\n\t\t\t<div style='text-align:right;margin:5px'>" . imgtootltip("refresh-24.png", "{refresh}", "MiltergreylistMilterStatus()") . "</div>\n\t\t\t<div id='milter-greylist-status'></div>\n\t\t</td>\n\t\t<td valign='top'>\n\t\t\t\n\t\t\t{$content}\n\t\t</td>\n\t</tr>\n\t</table>\n\t<script>MiltergreylistMilterStatus();</script>\n\t";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
}
コード例 #13
0
function right_category(){
	$page=CurrentPageName();
	$tpl=new templates();		
	$q=new mysql_squid_builder();	
	$time=strtotime($_GET["day"]."00:00:00");
	$buttonRepair=button("{rescan_database}","Loadjs('squid.stats.repair.day.php?time=$time')",18);	
	$hour_table=date('Ymd',strtotime($_GET["day"]))."_hour";
	$sql="SELECT COUNT( sitename ) as thits , category FROM $hour_table GROUP BY category ORDER BY thits DESC LIMIT 0 , 10";

	$results=$q->QUERY_SQL($sql);
	if(!$q->ok){echo "<H2>$q->mysql_error</H2><center style='font-size:11px'><code>$sql</code></center>";}	
	if(mysql_num_rows($results)==0){echo $tpl->_ENGINE_parse_body("$title<center style='margin:50px'><H2>{error_no_datas}</H2>$sql<p>$buttonRepair</p></center>");return;}
	
	while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){
		if($ligne["category"]==null){$ligne["category"]=$tpl->javascript_parse_text("{unknown}");}
		$ydata[]=$ligne["category"];
		$xdata[]=$ligne["thits"];
	}
		
	$title=$tpl->_ENGINE_parse_body("{top_categories}/{websites}");
	$targetedfile="ressources/logs/".basename(__FILE__).".".__FUNCTION__.".day.top.10.websites.$hour_table.category.png";
	$gp=new artica_graphs($targetedfile);	
	$gp->xdata=$xdata;
	$gp->ydata=$ydata;	
	$gp->width=550;
	$gp->height=550;
	$gp->ViewValues=true;
	$gp->x_title=$tpl->_ENGINE_parse_body("{top_categories}");
	$gp->pie();		
	$t=time();
	$html="
	
	<div style='font-size:16px;margin-bottom:5px'>$title</div>
	<center style='margin:10px'><img src='$targetedfile?$t'></center>
	<div id='table-websites-categories-days'></div>
	
	<script>
		LoadAjax('table-websites-categories-days','squid.traffic.table.days.php?day={$_GET["day"]}');
	</script>
	";
	echo $html;
	
}
コード例 #14
0
function right()
{
    $q = new mysql_squid_builder();
    $page = CurrentPageName();
    $tpl = new templates();
    if (!isset($_GET["day"])) {
        $_GET["day"] = $q->HIER();
    }
    if (!isset($_GET["type"])) {
        $_GET["type"] = "size";
    }
    if ($_GET["type"] == null) {
        $_GET["type"] = "size";
    }
    $type = $_GET["type"];
    $field_query = "size";
    $hour_table = date('Ymd', strtotime($_GET["day"])) . "_hour";
    $title = "<div style='font-size:16px;width:100%;font-weight:bold'>{statistics}:&nbsp;" . strtolower(date('{l} d {F} Y', strtotime($_GET["day"]))) . " ({$GLOBALS["title_array"][$type]})</div>";
    if (!$q->TABLE_EXISTS($hour_table)) {
        echo $tpl->_ENGINE_parse_body("<input type='hidden' id='squid-stats-day-hide-type' value='{$_GET["type"]}'>{$title}<center style='margin:50px'><H2>{error_no_datas}</H2></center>");
        return;
    }
    if ($type == "req") {
        $field_query = "hits";
    }
    $sql = "SELECT SUM({$field_query}) as totalsize,hour FROM {$hour_table} GROUP BY hour ORDER BY hour";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo "<H2>{$q->mysql_error}</H2><center style='font-size:11px'><code>{$sql}</code></center>";
    }
    if (mysql_num_rows($results) == 0) {
        echo $tpl->_ENGINE_parse_body("{$title}<center style='margin:50px'><H2>{error_no_datas}</H2></center>");
        return;
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $xdata[] = $ligne["tdate"];
        if ($_GET["type"] == "size") {
            $ydata[] = round($ligne["totalsize"] / 1024 / 1000);
        } else {
            $ydata[] = $ligne["totalsize"];
        }
    }
    $targetedfile = "ressources/logs/" . basename(__FILE__) . "." . __FUNCTION__ . ".day.{$hour_table}.{$type}.png";
    $gp = new artica_graphs();
    $gp->width = 550;
    $gp->height = 350;
    $gp->filename = "{$targetedfile}";
    $gp->xdata = $xdata;
    $gp->ydata = $ydata;
    $gp->y_title = null;
    $gp->x_title = $tpl->_ENGINE_parse_body("{hours}");
    $gp->title = null;
    $gp->margin0 = true;
    $gp->Fillcolor = "blue@0.9";
    $gp->color = "146497";
    $gp->line_green();
    if (!is_file($targetedfile)) {
        writelogs("Fatal \"{$targetedfile}\" no such file!", __FUNCTION__, __FILE__, __LINE__);
        return;
    }
    $sql = "SELECT SUM({$field_query}) as totalsize,familysite FROM {$hour_table} GROUP BY familysite ORDER BY totalsize DESC LIMIT 0,10";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo "<H2>{$q->mysql_error}</H2><center style='font-size:11px'><code>{$sql}</code></center>";
    }
    if (mysql_num_rows($results) == 0) {
        echo $tpl->_ENGINE_parse_body("{$title}<center style='margin:50px'><H2>{error_no_datas}</H2></center>");
        return;
    }
    $table = "\n\t<input type='hidden' id='squid-stats-day-hide-type' value='{$_GET["type"]}'>\n\t<center>\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:350px'>\n<thead class='thead'>\n\t<tr>\n\t<th width=1%>{size}</th>\n\t<th>{website}</th>\n\t</tr>\n</thead>\n<tbody>";
    $xdata = array();
    $ydata = array();
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        if (trim($ligne["familysite"]) == null) {
            continue;
        }
        $ydata[] = $ligne["familysite"];
        if ($_GET["type"] == "size") {
            $size = round($ligne["totalsize"] / 1024);
            $size_text = FormatBytes($ligne["totalsize"] / 1024);
        } else {
            $size = $ligne["totalsize"];
            $size_text = $size;
        }
        if ($_GET["type"] == "size") {
            $xdata[] = round($ligne["totalsize"] / 1024);
        } else {
            $xdata[] = $ligne["totalsize"];
        }
        if ($classtr == "oddRow") {
            $classtr = null;
        } else {
            $classtr = "oddRow";
        }
        $table = $table . "\n\t\t<tr class={$classtr}>\n\t\t\t\n\t\t\t<td width=1%  style='font-size:14px' nowrap><strong>{$size_text}</strong></td>\n\t\t\t<td  style='font-size:14px' nowrap width=99%><strong><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('{$page}?today-zoom=yes&type={$_GET["type"]}&familysite={$ligne["familysite"]}&day={$_GET["day"]}')\" style='font-size:14px;font-weight:bold;text-decoration:underline'>{$ligne["familysite"]}</a></strong></td>\n\t\t</tr>\n\t\t";
    }
    $table = $table . "</tbody></table>";
    $targetedfile2 = "ressources/logs/" . basename(__FILE__) . "." . __FUNCTION__ . ".day.top.10.websites.{$hour_table}.{$type}.png";
    $gp = new artica_graphs($targetedfile2);
    $gp->xdata = $xdata;
    $gp->ydata = $ydata;
    $gp->width = 550;
    $gp->height = 550;
    $gp->ViewValues = true;
    $gp->x_title = $tpl->_ENGINE_parse_body("{top_websites}");
    $gp->pie();
    $html = "\n\t<input type='hidden' id='squid-stats-day-hide-type' value='{$type}'>\n\t{$title}\n\t<center style='margin:10px'><img src='{$targetedfile}'></center>\n\t<center style='margin:10px'><img src='{$targetedfile2}'></center>\n\t{$table}\n\t<script>\n\t\tLoadAjax('statistics-days-left-status','{$page}?statistics-days-left-status=yes&day={$_GET["day"]}');\n\t</script>\n\t\n";
    echo $tpl->_ENGINE_parse_body($html);
}
コード例 #15
0
function category_show()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $q = new mysql();
    $interval = $_GET["interval"];
    $cat = $_GET["category"];
    $sql = "SELECT SUM(messages) as conx,SUM(size) AS tsize,{$_GET["user"]} as tdomain FROM amavis_event_hours\n\tWHERE zDate>=DATE_SUB(NOW(),INTERVAL {$interval} DAY)\n\tAND bounce_error='{$cat}'\n\tGROUP BY tdomain ORDER BY conx DESC LIMIT 0,10\n\t";
    $html = "\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t\t<th>{connexions}</th>\n\t\t<th>{size}</th>\n\t\t<th>{domains}</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>";
    $filename = "postfix.amavis.{$cat}.{$interval}.{$_GET["user"]}.as.png";
    $gp = new artica_graphs(dirname(__FILE__) . "/ressources/logs/web/{$filename}", 50);
    $results = $q->QUERY_SQL($sql, "artica_events");
    if (!$q->ok) {
        echo $q->mysql_error . "<hr><code>{$sql}</code><hr>";
        return;
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        if ($classtr == "oddRow") {
            $classtr = null;
        } else {
            $classtr = "oddRow";
        }
        $style = "style='text-decoration:underline'";
        $js = "YahooWin5(700,'{$page}?mails-list=yes&category={$_GET["category"]}&interval={$interval}&user={$_GET["user"]}&domain={$ligne["tdomain"]}','{$_GET["category"]} &raquo; {$interval} {days} &raquo; {$ligne["tdomain"]} &raquo; {$_GET["user"]}');";
        $size = $ligne["tsize"] / 1024;
        $size = FormatBytes($size);
        if ($ligne["tdomain"] == null) {
            $ligne["tdomain"] = "undisclosed";
        }
        $html = $html . "\n\t<tr class={$classtr}>\n\t\t\t<td style='font-size:14px;font-weight:bold' width=1% align='center'><a href=\"javascript:blur()\" OnClick=\"javascript:{$js}\" {$style}>{$ligne["conx"]}</a></td>\n\t\t\t<td style='font-size:14px;font-weight:bold' width=1% align='center'><a href=\"javascript:blur()\" OnClick=\"javascript:{$js}\" {$style}>{$size}</a></td>\n\t\t\t<td style='font-size:14px;font-weight:bold' nowrap width=99%><a href=\"javascript:blur()\" OnClick=\"javascript:{$js}\" {$style}>{$ligne["tdomain"]}</a></td>\n\t\t</tr>\n\t";
        $gp->xdata[] = $ligne["conx"];
        $gp->ydata[] = $ligne["tdomain"];
    }
    $table[] = "</table>";
    $time = time();
    $gp->width = 560;
    $gp->height = 580;
    $gp->ViewValues = false;
    $gp->x_title = "{ipaddr}";
    $gp->pie();
    echo "<center><img src='ressources/logs/web/{$filename}?time={$time}'></center>";
    echo "<hr>";
    echo $tpl->_ENGINE_parse_body("{$html}</table>");
}
コード例 #16
0
function query_perform(){
	$page=CurrentPageName();
	$tpl=new templates();
	$q=new mysql_squid_builder();
	$day=$_GET["day"];
	$time=strtotime("$day 00:00:00");
	$tableWeek=date("YW",$time)."_week";	
	$tableDay=date("Ymd",$time)."_day";
	$category=$_GET["category"];
	$DAYNUM=false;
	$weeksd=array(1 => "Sunday", 2 => "Monday",3=>"Tuesday",4=>"Wednesday",5=>"Thursday",6=>"Friday",7=>"Saturday");
	
	if($_GET["field-search"]<>null){
		$title_add="{$_GET["field-search"]}:{$_GET["data-search"]}";
		$FIELDADD="`{$_GET["field-search"]}`,";
		$HAVING=" AND `{$_GET["field-search"]}`='{$_GET["data-search"]}'";
	}
	
	switch ($_GET["TimeType"]) {
		case "week":$table=$tableWeek;$FIELD_TIME="day";$DAYNUM=true; break;
		default:$table=$tableDay;$FIELD_TIME="hour";
		break;
	}
	
	
	$sql="SELECT {$FIELDADD}SUM(hits) as thits,category,$FIELD_TIME FROM $table GROUP BY {$FIELDADD}category,$FIELD_TIME HAVING `category`='$category'$HAVING   ORDER BY $FIELD_TIME";
	$results=array();
	$results=$q->QUERY_SQL($sql);
	if(!$q->ok){echo "<H2>$q->mysql_error</H2><hr><code style='font-size:12px'>$sql</code><hr>";}
	$title=TITLE_SQUID_STATSTABLE($sql,"{statistics}:&nbsp;$category&nbsp;{{$_GET["TimeType"]}}:{$_GET["day"]} ({requests})&nbsp;$title_add");
	if(mysql_num_rows($results)>1){
		while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){
			$x=$ligne[$FIELD_TIME];
			if($DAYNUM){$x=$weeksd[$ligne[$FIELD_TIME]];}
			$xdata[]=$x;
			$ydata[]=$ligne["thits"];
		}
		$targetedfile="ressources/logs/".basename(__FILE__).".".__FUNCTION__.".". md5($sql).".png";
		$gp=new artica_graphs();
		$gp->width=400;
		$gp->height=350;
		$gp->filename="$targetedfile";
		$gp->xdata=$xdata;
		$gp->ydata=$ydata;
		$gp->y_title=null;
		$gp->x_title=$tpl->_ENGINE_parse_body("{days}");
		$gp->title=null;
		$gp->margin0=true;
		$gp->Fillcolor="blue@0.9";
		$gp->color="146497";
	
		$gp->line_green();
		if(!is_file($targetedfile)){writelogs("Fatal \"$targetedfile\" no such file!",__FUNCTION__,__FILE__,__LINE__);}		
		
			
		$html[]="<div class=RoundedGrey>$title<img src='$targetedfile' style='margin:10px'></div>";
	}else{
		
		$ligne=array();
		$ligne=mysql_fetch_array($results);
		$htmlHeader="<center><table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'><thead class='thead'><tr>";
		while (list ($a, $b) = each ($ligne) ){if(is_numeric($a)){continue;}if($a=="category"){continue;}$heads[]="<th>{{$a}}</th>";$datas[]="<td style='font-size:14px'>$b</td>";}
		$html[]="<div class=RoundedGrey>$title$htmlHeader". @implode("\n", $heads)."</tr><tr>". @implode("\n", $datas)."</tr></tbody></table></div>";
		
		
	}
		
	
// ------------------------------------------------------------------------------------------------------------------------------------------------
	@mysql_free_result($results);
	$sql="SELECT {$FIELDADD}SUM(size) as tsize,category,$FIELD_TIME FROM $table GROUP BY {$FIELDADD}category,$FIELD_TIME HAVING `category`='$category'$HAVING   ORDER BY $FIELD_TIME";
	$results=array();
	
	$results=$q->QUERY_SQL($sql);
	if(!$q->ok){echo "<H2>$q->mysql_error</H2><hr><code style='font-size:12px'>$sql</code><hr>";}
	unset($xdata);unset($ydata);
	$title=TITLE_SQUID_STATSTABLE($sql,"{statistics}:&nbsp;$category&nbsp;{{$_GET["TimeType"]}}:{$_GET["day"]} ({downloaded_flow} MB)&nbsp;$title_add");
if(mysql_num_rows($results)>1){	
		while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){
			$x=$ligne[$FIELD_TIME];
			if($DAYNUM){$x=$weeksd[$ligne[$FIELD_TIME]];}		
			$xdata[]=$x;
			$ydata[]=round(($ligne["tsize"]/1024)/1000);
		}
		$targetedfile="ressources/logs/".basename(__FILE__).".".__FUNCTION__.".". md5($sql).".png";
		$gp=new artica_graphs();
		$gp->width=400;
		$gp->height=350;
		$gp->filename="$targetedfile";
		$gp->xdata=$xdata;
		$gp->ydata=$ydata;
		$gp->y_title=null;
		$gp->x_title=$tpl->_ENGINE_parse_body("{days}");
		$gp->title=null;
		$gp->margin0=true;
		$gp->Fillcolor="blue@0.9";
		$gp->color="146497";
	
		$gp->line_green();
		if(!is_file($targetedfile)){writelogs("Fatal \"$targetedfile\" no such file!",__FUNCTION__,__FILE__,__LINE__);}		
		
			
		$html[]="<div class=RoundedGrey>$title<img src='$targetedfile' style='margin:10px'></div>";	
	}else{
		$ligne=array();
		$ligne=mysql_fetch_array($results);
		$htmlHeader="<center><table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'><thead class='thead'><tr>";
		while (list ($a, $b) = each ($ligne) ){
			if(isset($already[$a])){continue;}
			if($a=="category"){continue;}
			if(is_numeric($a)){continue;}
			$heads[]="<th>{{$a}}</th>";
			$datas[]="<td style='font-size:14px'>$b</td>";
		}
		$html[]="<div class=RoundedGrey>$title$htmlHeader". @implode("\n", $heads)."</tr><tr>". @implode("\n", $datas)."</tr></tbody></table></div>";
		
		
	}
	
// ------------------------------------------------------------------------------------------------------------------------------------------------	
	@mysql_free_result($results);unset($xdata);unset($ydata);
	$sql="SELECT {$FIELDADD}SUM(hits) as requests,category,familysite as sitename FROM $table GROUP BY {$FIELDADD}category,familysite HAVING `category`='$category'$HAVING   ORDER BY requests DESC LIMIT 0,10";
	$results=array();
	
	$results=$q->QUERY_SQL($sql);
	if(!$q->ok){echo "<H2>$q->mysql_error</H2><hr><code style='font-size:12px'>$sql</code><hr>";}
	unset($xdata);unset($ydata);
	$title=TITLE_SQUID_STATSTABLE($sql,"{statistics}:&nbsp;$category&nbsp;{{$_GET["TimeType"]}}:{$_GET["day"]} (TOP 10 {websites} {requests})&nbsp;$title_add");
if(mysql_num_rows($results)>1){	
		while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){
		$xdata[]=$ligne["requests"];
		$ydata[]=$ligne["sitename"];
		}
		$targetedfile="ressources/logs/".basename(__FILE__).".".__FUNCTION__.".". md5($sql).".png";
		$gp=new artica_graphs();
		$gp->width=400;
		$gp->height=350;
		$gp->filename="$targetedfile";
		$gp->xdata=$xdata;
		$gp->ydata=$ydata;
		$gp->y_title=null;
		$gp->x_title=$tpl->_ENGINE_parse_body("{days}");
		$gp->title=null;
		$gp->margin0=true;
		$gp->Fillcolor="blue@0.9";
		$gp->color="146497";
	
		$gp->pie();
		if(!is_file($targetedfile)){writelogs("Fatal \"$targetedfile\" no such file!",__FUNCTION__,__FILE__,__LINE__);}		
		
			
		$html2[]="<div class=RoundedGrey>$title<img src='$targetedfile' style='margin:10px'></div>";	
	}else{
		$ligne=array();
		$ligne=mysql_fetch_array($results);
		$htmlHeader="<center><table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'><thead class='thead'><tr>";
		while (list ($a, $b) = each ($ligne) ){
			if(isset($already[$a])){continue;}
			if($a=="category"){continue;}
			if(is_numeric($a)){continue;}
			$heads[]="<th>{{$a}}</th>";
			$datas[]="<td style='font-size:14px'>$b</td>";
		}
		$html2[]="<div class=RoundedGrey>$title$htmlHeader". @implode("\n", $heads)."</tr><tr>". @implode("\n", $datas)."</tr></tbody></table></div>";
		
		
	}	
	
// ------------------------------------------------------------------------------------------------------------------------------------------------	
	@mysql_free_result($results);unset($xdata);unset($ydata);
	$sql="SELECT {$FIELDADD}SUM(size) as totalsize,category,familysite as sitename FROM $table GROUP BY {$FIELDADD}category,familysite HAVING `category`='$category'$HAVING   ORDER BY totalsize DESC LIMIT 0,10";
	$results=array();
	
	$results=$q->QUERY_SQL($sql);
	if(!$q->ok){echo "<H2>$q->mysql_error</H2><hr><code style='font-size:12px'>$sql</code><hr>";}
	unset($xdata);unset($ydata);
	$title=TITLE_SQUID_STATSTABLE($sql,"{statistics}:&nbsp;$category&nbsp;{{$_GET["TimeType"]}}:{$_GET["day"]} (TOP 10 {websites} {downloaded_flow})&nbsp;$title_add");
if(mysql_num_rows($results)>1){	
		while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){
		$xdata[]=$ligne["totalsize"];
		$ydata[]=$ligne["sitename"];
		}
		$targetedfile="ressources/logs/".basename(__FILE__).".".__FUNCTION__.".". md5($sql).".png";
		$gp=new artica_graphs();
		$gp->width=400;
		$gp->height=350;
		$gp->filename="$targetedfile";
		$gp->xdata=$xdata;
		$gp->ydata=$ydata;
		$gp->y_title=null;
		$gp->x_title=$tpl->_ENGINE_parse_body("{days}");
		$gp->title=null;
		$gp->margin0=true;
		$gp->Fillcolor="blue@0.9";
		$gp->color="146497";
	
		$gp->pie();
		if(!is_file($targetedfile)){writelogs("Fatal \"$targetedfile\" no such file!",__FUNCTION__,__FILE__,__LINE__);}		
		
			
		$html2[]="<div class=RoundedGrey>$title<img src='$targetedfile' style='margin:10px'></div>";	
	}else{
		$ligne=array();
		$ligne=mysql_fetch_array($results);
		$htmlHeader="<center><table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'><thead class='thead'><tr>";
		while (list ($a, $b) = each ($ligne) ){
			if(isset($already[$a])){continue;}
			if($a=="category"){continue;}
			if(is_numeric($a)){continue;}
			$heads[]="<th>{{$a}}</th>";
			$datas[]="<td style='font-size:14px'>$b</td>";
		}
		$html2[]="<div class=RoundedGrey>$title$htmlHeader". @implode("\n", $heads)."</tr><tr>". @implode("\n", $datas)."</tr></tbody></table></div>";
		
		
	}	
	echo 
	"<table style='width:100%'>
	<tbody>
	<tr>
	<td width=50% valign='top'>".$tpl->_ENGINE_parse_body(@implode("\n", $html))."</td>
	<td width=50% valign='top'>".$tpl->_ENGINE_parse_body(@implode("\n", $html2))."</td>
	</tr>
	</tbody>
	</table>
	";
	
	
}
コード例 #17
0
function right(){
	if($_GET["ShowTable"]==1){right_showtable();exit;}
	$q=new mysql_squid_builder();
	$page=CurrentPageName();
	$tpl=new templates();	
	if(!isset($_GET["day"])){$_GET["day"]=$q->HIER();}
	if(!isset($_GET["type"])){$_GET["type"]="size";}
	if($_GET["type"]==null){$_GET["type"]="size";}
	$type=$_GET["type"];
	$field_query="size";
	

	
	$SourceTable=date('Ymd',strtotime($_GET["day"]))."_blocked";
	$title="<div style='font-size:16px;width:100%;font-weight:bold'>{statistics}:&nbsp;". strtolower(date('{l} d {F} Y',strtotime($_GET["day"])))." ({hits})</div>";
	if(!$q->TABLE_EXISTS($SourceTable)){echo $tpl->_ENGINE_parse_body("<input type='hidden' id='squid-stats-day-hide-type' value='{$_GET["type"]}'>$title<center style='margin:50px'><H2>{error_no_datas}</H2></center>");return;}
	
	
	if($type=="req"){
		$field_query="hits";
	}
	
	$sql="SELECT COUNT(ID) as tcount,HOUR(zDate) as `hour` FROM $SourceTable GROUP BY HOUR(zDate)  ORDER BY HOUR(zDate) ";
	$results=$q->QUERY_SQL($sql);
	if(!$q->ok){echo "<H2>$q->mysql_error</H2><center style='font-size:11px'><code>$sql</code></center>";}	
	if(mysql_num_rows($results)==0){
		echo $tpl->_ENGINE_parse_body("$title<center style='margin:50px'><H2>{error_no_datas}</H2></center>");
		return;
	}
	
	
	while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){
		$xdata[]=$ligne["tdate"];
		$ydata[]=$ligne["tcount"];
	}	
	
	$targetedfile="ressources/logs/".basename(__FILE__).".".__FUNCTION__.".day.$SourceTable.$type.png";
	$gp=new artica_graphs();
	$gp->width=550;
	$gp->height=350;
	$gp->filename="$targetedfile";
	$gp->xdata=$xdata;
	$gp->ydata=$ydata;
	$gp->y_title=null;
	$gp->x_title=$tpl->_ENGINE_parse_body("{hours}");
	$gp->title=null;
	$gp->margin0=true;
	$gp->Fillcolor="blue@0.9";
	$gp->color="146497";

	$gp->line_green();
	if(!is_file($targetedfile)){
		writelogs("Fatal \"$targetedfile\" no such file!",__FUNCTION__,__FILE__,__LINE__);
		$targetedfile="/img/kas-graph-no-datas.png";
	}	
	
	
	$sql="SELECT COUNT(ID) as tcount,category FROM $SourceTable GROUP BY category ORDER BY tcount DESC LIMIT 0,10";
	$results=$q->QUERY_SQL($sql);
	if(!$q->ok){echo "<H2>$q->mysql_error</H2><center style='font-size:11px'><code>$sql</code></center>";}	
	if(mysql_num_rows($results)==0){echo $tpl->_ENGINE_parse_body("$title<center style='margin:50px'><H2>{error_no_datas}</H2></center>");return;}	
	
	$table="
	<input type='hidden' id='squid-stats-day-hide-type' value='{$_GET["type"]}'>
	<center>
<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:350px'>
<thead class='thead'>
	<tr>
	<th width=1%>{hits}</th>
	<th>{category}</th>
	</tr>
</thead>
<tbody>";
	$xdata=array();
	$ydata=array();
	
	while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){
		if(trim($ligne["category"])==null){continue;}
		$ydata[]=$ligne["category"];
		$xdata[]=$ligne["tcount"];
		
	if($classtr=="oddRow"){$classtr=null;}else{$classtr="oddRow";}
$table=$table.
		"
		<tr class=$classtr>
			
			<td width=1%  style='font-size:14px' nowrap><strong>{$ligne["tcount"]}</strong></td>
			<td  style='font-size:14px' nowrap width=99%>
				<strong><a href=\"javascript:blur();\" 
				OnClick=\"javascript:Loadjs('$page?today-zoom=yes&category={$ligne["category"]}&day={$_GET["day"]}')\" 
				style='font-size:14px;font-weight:bold;text-decoration:underline'>{$ligne["category"]}</a></strong></td>
		</tr>
		";		
		
	}	
$table=$table."</tbody></table>";
	$targetedfile2="ressources/logs/".basename(__FILE__).".".__FUNCTION__.".day.top.10.websites.$SourceTable.$type.png";
	$gp=new artica_graphs($targetedfile2);	
	$gp->xdata=$xdata;
	$gp->ydata=$ydata;	
	$gp->width=550;
	$gp->height=550;
	$gp->ViewValues=true;
	$gp->x_title=$tpl->_ENGINE_parse_body("{top_categories}");
	$gp->pie();		
	
	$html="
	<input type='hidden' id='squid-stats-day-hide-type' value='$type'>
	$title
	<center style='margin:10px'><img src='$targetedfile'></center>
	<center style='margin:10px'><img src='$targetedfile2'></center>
	$table
	<script>
		LoadAjax('statistics-days-left-status','squid.traffic.statistics.days.php?statistics-days-left-status=yes&day={$_GET["day"]}');
	</script>
	
";
	echo $tpl->_ENGINE_parse_body($html);
	
	
	
	
}
コード例 #18
0
function report_by_members($pdf, $report_id)
{
    $unix = new unix();
    $pdf->AddPage('P');
    $pdf->SetFontSize(32);
    $pdf->Write(5, "Members");
    $pdf->Ln();
    $TMP_FILE = $unix->FILE_TEMP() . ".png";
    $TMP_FILE2 = $unix->FILE_TEMP() . ".png";
    $q = new mysql_squid_reports($report_id);
    $results = $q->QUERY_SQL("SELECT client,uid,SUM(size) as size FROM users_dayz GROUP BY client,uid ORDER BY size DESC");
    $gp = new artica_graphs($TMP_FILE, 0);
    $gp2 = new artica_graphs($TMP_FILE2, 0);
    $c = 0;
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $pdf->SetFontSize(14);
        $size = FormatBytes($ligne["size"] / 1024, true);
        $sizeK = $ligne["size"] / 1024;
        $sizeM = round($sizeK / 1024);
        if ($ligne["uid"] == null) {
            $ligne["uid"] = $ligne["client"];
        }
        if ($c < 15) {
            $gp->xdata[] = $sizeM;
            $gp2->xdata[] = $sizeM;
            $gp->ydata[] = $ligne["uid"];
            $gp2->ydata[] = $ligne["client"];
        }
        $c++;
    }
    $gp->width = 700;
    $gp->height = 400;
    $gp->PieExplode = 5;
    $gp->PieLegendHide = false;
    $gp->ViewValues = true;
    $gp->title = "Top User by size (MB)";
    $gp->pie();
    $gp2->width = 700;
    $gp2->height = 400;
    $gp2->PieExplode = 5;
    $gp2->PieLegendHide = false;
    $gp2->ViewValues = true;
    $gp2->title = "Top IP address by size (MB)";
    $gp2->pie();
    if (is_file($TMP_FILE)) {
        $pdf->Ln();
        $pdf->Cell(0, 6, "Top User by size (MB)", 0, 0, 'C');
        $pdf->Ln();
        $positiondemonimage = (210 - 600) / 2;
        $pdf->Image($TMP_FILE);
        @unlink($TMP_FILE);
    }
    if (is_file($TMP_FILE2)) {
        $pdf->Ln();
        $pdf->Cell(0, 6, "Top Ip Address by size (MB)", 0, 0, 'C');
        $pdf->Ln();
        $pdf->Image($TMP_FILE2);
        @unlink($TMP_FILE2);
    }
    return $pdf;
}
コード例 #19
0
function week_consumption_graph($xtime = 0)
{
    $cache_file = "/usr/share/artica-postfix/ressources/logs/web/" . basename(__FILE__) . "." . md5(serialize($_GET)) . "." . __FUNCTION__ . '.cache';
    $time = file_time_min_Web($cache_file);
    //if($time<360){echo @file_get_contents($cache_file);return;}
    if ($xtime == -1) {
        $d = date("Y-m-d");
        $sqlq = "DATE_FORMAT(days,'%Y-%m-%d')='{$d}'";
    }
    if ($xtime == 0) {
        $d = date("W");
        $sqlq = "WEEK(days)=WEEK(NOW()) AND YEAR(days)=YEAR(NOW())";
    }
    if ($xtime == 1) {
        $d = date("Y-m");
        $sqlq = "MONTH(days)=MONTH(NOW()) AND YEAR(days)=YEAR(NOW())";
    }
    $page = CurrentPageName();
    $gp = new artica_graphs(dirname(__FILE__) . "/ressources/logs/web/squid.{$d}.consumption.png", 0);
    $tpl = new templates();
    //$gp->ImageMap="javascript:Loadjs('squid.stats.category.php?category-js=yes&time=week&category=";
    $html = "<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t<th>{size}</th>\n\t<th>{members}</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>";
    $sql = "SELECT SUM(size) as tsum,CLIENT FROM squid_events_clients_day WHERE \n\t{$sqlq}  GROUP BY CLIENT ORDER BY tsum DESC LIMIT 0,10";
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_events");
    if (mysql_num_rows($results) == 0) {
        $tpl = new templates();
        echo $tpl->_ENGINE_parse_body("<H2>{NO_DATA_COME_BACK_LATER}</H2><hr>{$sql}</hr>");
        return;
    }
    if (!$q->ok) {
        echo $q->mysql_error;
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        if (trim($ligne["CLIENT"]) == null) {
            $ligne["CLIENT"] = "unknown";
        }
        $ligne["tsum"] = FormatBytes($ligne["tsum"] / 1024);
        if ($classtr == "oddRow") {
            $classtr = null;
        } else {
            $classtr = "oddRow";
        }
        $js = "Loadjs('squid.stats.client.php?client-js=yes&time={$xtime}&client=" . urlencode($ligne["CLIENT"]) . "')";
        $html = $html . "\n\t\t\t<tr class={$classtr}>\n\t\t\t<td style='font-size:15px'><a href=\"javascript:blur();\" OnClick=\"javascript:{$js}\">{$ligne["tsum"]}</a></td>\n\t\t\t<td style='font-size:15px'><a href=\"javascript:blur();\" OnClick=\"javascript:{$js}\">{$ligne["CLIENT"]}</a></td>\n\t\t\t</tr>";
        $gp->xdata[] = $ligne["tsum"];
        $gp->ydata[] = $ligne["CLIENT"];
    }
    $gp->width = 560;
    $gp->height = 580;
    $gp->ViewValues = false;
    $gp->x_title = "{categories}";
    $gp->pie();
    $html = $tpl->_ENGINE_parse_body("<img src='ressources/logs/web/squid.{$d}.consumption.png'  border=0><hr>{$html}</table>");
    @file_put_contents($cache_file, $html);
    echo $html;
}
コード例 #20
0
function status()
{
    $page = CurrentPageName();
    $q = new mysql();
    $tpl = new templates();
    $hostname = $_GET["hostname"];
    $ou_encoded = base64_encode("master");
    $pause_queue = Paragraphe('pause-64.png', '{pause_the_queue}', '{pause_the_queue_text}', "javascript:Loadjs('postfix.freeze.queue.php?hostname={$hostname}')");
    $mems = Paragraphe('bg_memory-64.png', '{postfix_tmpfs}', '{postfix_tmpfs_text}', "javascript:Loadjs('domains.postfix.memory.php?ou={$ou_encoded}&hostname={$hostname}')");
    $repro_queue = Paragraphe('restart-queue-64.png', '{reprocess_queue}', '{reprocess_queues_text}', "javascript:PostQueueFF()");
    $q = new mysql();
    $sql = "SELECT SUM(`size`) as tsize,COUNT(msgid) as tcount FROM postqueue WHERE `instance`='master'";
    $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_events'));
    $tot = $ligne["tcount"];
    $tot_size = $ligne["tsize"] / 1024;
    $tot_size = FormatBytes($tot_size);
    $table[] = "<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t\t<th>{mails}</th>\n\t\t<th>{errors}</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>";
    $filename = "postqueue.status.{$hostname}.png";
    $gp = new artica_graphs(dirname(__FILE__) . "/ressources/logs/web/{$filename}", 50);
    $sql = "SELECT COUNT(context) as tcount,context FROM postqueue WHERE instance='{$hostname}' GROUP BY context ORDER BY tcount DESC";
    $results = $q->QUERY_SQL($sql, "artica_events");
    if (!$q->ok) {
        $table[] = "<tr><td>" . $q->mysql_error . "</td></tr>";
    }
    $page = CurrentPageName();
    $rowscount = mysql_num_rows($results);
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        if ($ligne["context"] == null) {
            $ligne["context"] = "{unknown}";
        }
        if ($classtr == "oddRow") {
            $classtr = null;
        } else {
            $classtr = "oddRow";
        }
        $js = "PostQueueContext('{$ligne["context"]}');";
        $style = " style='text-decoration:underline' ";
        $table[] = "\n\t<tr class={$classtr}>\n\t\t\t<td style='font-size:14px;font-weight:bold' width=1% align='center'><a href=\"javascript:blur()\" OnClick=\"javascript:{$js}\">{$ligne["tcount"]}</a></td>\n\t\t\t<td style='font-size:14px;font-weight:bold' nowrap width=99%><a href=\"javascript:blur()\" OnClick=\"javascript:{$js}\" {$style}>{$ligne["context"]}</a></td>\n\t\t</tr>\n\t";
        $gp->xdata[] = $ligne["tcount"];
        $gp->ydata[] = $tpl->javascript_parse_text($ligne["context"]);
    }
    $table[] = "</table>";
    $table_finale = @implode("\n", $table);
    $time = time();
    if ($rowscount > 0) {
        $gp->width = 350;
        $gp->height = 450;
        $gp->ViewValues = false;
        $gp->x_title = "{errors}";
        $gp->pie();
        if (count($gp->xdata) > 1) {
            $img = "<center><img src='ressources/logs/web/{$filename}?time={$time}'></center>";
        }
    }
    $html = "\n\t<center style='font-size:16px'>{$tot} {mails}, {$tot_size}</center>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top'>\t\n\t\t\t{$img}\n\t\t\t<hr>\n\t\t\t{$table_finale}\n\t\t</td>\n\t\t<td valign='top'>\n\t\t\t{$pause_queue}\n\t\t\t{$mems}\n\t\t\t{$repro_queue}\n\t\t</td>\n\t</tr>\n\t</table>\n\t\n\t<script>\n\t\nvar x_PostQueueFF= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>2){alert(results);}\n\tRefreshTab('queue_monitor'); \n\t}\t\t\n\t\n\tfunction PostQueueFF(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('PostQueueF','yes');\n\t\tXHR.appendData('hostname','{$_GET["hostname"]}');\n\t\tXHR.appendData('output','yes');\n\t\tXHR.setRefreshArea('queuelist');\n\t\tXHR.sendAndLoad('postfix.queue.monitoring.php', 'GET',x_PostQueueFF);\n\t}\n\t\n\tfunction PostQueueContext(context){\n\t\tvar zcontext=escape(context);\n\t\tYahooWin4(850,'{$page}?postqueue-context='+zcontext+'&hostname={$hostname}',context);\n\t\n\t}\n\t\n\t\n</script>\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
コード例 #21
0
function generate_graph2()
{
    include_once 'ressources/class.artica.graphs.inc';
    $q = new mysql_squid_builder();
    $page = CurrentPageName();
    $tpl = new templates();
    $t = $_GET["t"];
    $ff = time();
    $graph1 = null;
    $graph2 = null;
    $xtime = $_GET["xtime"];
    $tablename = "youtubeday_" . date("Ymd", $xtime);
    $sql = "(SELECT {$tablename}.hits as hits, youtube_objects.category FROM `{$tablename}`,`youtube_objects`\n\tWHERE youtube_objects.youtubeid={$tablename}.youtubeid) as t";
    $sql = "SELECT SUM(hits) as thits,category FROM {$sql} GROUP BY category ORDER BY thits DESC LIMIT 0,10";
    $unknown = $tpl->_ENGINE_parse_body("{unknown}");
    $c = 0;
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo "<H2>{$q->mysql_error}</H2><center style='font-size:11px'><code>{$sql}</code></center>";
    }
    if (mysql_num_rows($results) > 0) {
        while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
            if (trim($ligne["category"]) == null) {
                $ligne["category"] = $unknown;
            }
            $ydata[] = $ligne["category"];
            $xdata[] = $ligne["thits"];
            $c++;
        }
        $targetedfile = "ressources/logs/" . md5(basename(__FILE__) . "." . __FUNCTION__ . __LINE__ . "." . time()) . ".png";
        $gp = new artica_graphs($targetedfile);
        $gp->xdata = $xdata;
        $gp->ydata = $ydata;
        $gp->width = 460;
        $gp->height = 500;
        $gp->ViewValues = true;
        $gp->PieLegendHide = false;
        $gp->x_title = $tpl->_ENGINE_parse_body("{top_categories_by_hits}");
        $gp->pie(true);
        if (is_file("{$targetedfile}")) {
            $graph1 = "\n\t\t<center style='font-size:18px;margin:10px'>{$gp->x_title}</center>\n\t\t<img src='{$targetedfile}'>";
        }
    }
    $html = "<center style='margin:10Px'>{$graph1}</center>";
    echo $html;
}
コード例 #22
0
function popup()
{
    $page = CurrentPageName();
    $t = time();
    $sock = new sockets();
    $MilterGreyListEnabled = intval($sock->GET_INFO('MilterGreyListEnabled'));
    $RemoteMilterService = $sock->GET_INFO("RemoteMilterService");
    if ($_GET["hostname"] == null) {
        $_GET["hostname"] = "master";
    }
    if ($_GET["ou"] == null) {
        $_GET["ou"] = "master";
    }
    if (is_file("ressources/logs/greylist-count-master.tot")) {
        $datas = unserialize(@file_get_contents("ressources/logs/greylist-count-master.tot"));
        if (is_array($datas)) {
            @unlink("ressources/logs/web/mgreylist.master1.db.png");
            $gp = new artica_graphs(dirname(__FILE__) . "/ressources/logs/web/mgreylist.master1.db.png", 0);
            $gp->xdata[] = $datas["GREYLISTED"];
            $gp->ydata[] = "greylisted";
            $gp->xdata[] = $datas["WHITELISTED"];
            $gp->ydata[] = "whitelisted";
            $gp->width = 750;
            $gp->height = 750;
            $gp->ViewValues = false;
            $gp->x_title = "{status}";
            $gp->pie();
            $imgG = "<img src='ressources/logs/web/mgreylist.master1.db.png'>";
        }
    }
    $P1 = Paragraphe_switch_img("{enable_milter}", "{enable_milter_text}", "MilterGreyListEnabled-{$t}", $MilterGreyListEnabled, null, 1040);
    $content = "\n\t\t\t\n\t<div id='animate-{$t}' style='font-size:50px;margin-bottom:15px'>{server}:{$_GET["hostname"]}</div>\n\t{$P1}\n\t</div>\n\t\n\t\n\t<div style='width:100%;text-align:right'><hr>" . button("{apply}", "Save{$t}();", 45) . "</div>\n\t\n\t";
    $html = "\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td style='vertical-align:top'>\n\t\t\t<div id='mgreylist-status' style='width:400px'></div>\n\t\t</td>\n\t\t<td style='vertical-align:top'>\n\t\t\t{$content}<br><center>{$imgG}</center>\n\t\t</td>\n\t</tr>\n\t\n\t</table>\n\t\n<script>\nvar x_Save{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>3){alert(results);return;}\n\tLoadjs('postfix.milters.progress.php');\n\tRefreshTab('main_config_mgreylist');\n}\t\n\t\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('MilterGreyListEnabled',document.getElementById('MilterGreyListEnabled-{$t}').value);\n\tXHR.appendData('hostname','{$_GET["hostname"]}');\n\tXHR.appendData('ou','{$_GET["ou"]}');\n\tXHR.sendAndLoad('{$page}', 'POST',x_Save{$t});\t\n}\n\nfunction miltergreylist_status(){\n\tLoadAjax('mgreylist-status','{$page}?status=yes&hostname={$_GET["hostname"]}&ou={$_GET["ou"]}');\n}\nmiltergreylist_status();\n</script>\n";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
}
コード例 #23
0
function right()
{
    $q = new mysql_squid_builder();
    $page = CurrentPageName();
    $tpl = new templates();
    if (!isset($_GET["day"])) {
        $_GET["day"] = date('Y-m-d');
    }
    $title_style = "font-size:16px;width:100%;font-weight:bold;text-decoration:underline";
    $day = $_GET["day"];
    $time = strtotime("{$day} 00:00:00");
    $table = date("YW", $time) . "_week";
    echo "<!-- LINE:" . __LINE__ . ">\n";
    $_GET["week"] = date("W", $time);
    $_GET["year"] = date("Y", $time);
    $tt = getDaysInWeek($_GET["week"], $_GET["year"]);
    foreach ($tt as $dayTime) {
        $f[] = date('{l} d {F}', $dayTime);
    }
    if ($_GET["field-user"] != null) {
        $title_add = "<br>{{$_GET["field-user"]}}:{$_GET["field-user-value"]}";
        $fieldadd = "{$_GET["field-user"]},";
        $GROUP_SELECT = " HAVING `{$_GET["field-user"]}`='{$_GET["field-user-value"]}'";
    }
    echo "<script>\n\t\tLoadAjax('statistics-week-left-status','{$page}?left-status=yes&day={$_GET["day"]}');\n\t</script>\n\t";
    echo "<!-- LINE:" . __LINE__ . ">\n";
    $sourcetable = "{$_GET["year"]}{$_GET["week"]}_week";
    $title00 = $tpl->_ENGINE_parse_body("\n\t<center style='font-size:16px;width:100%;font-weight:bold;margin:10px'>\n\t\t\t{week}:&nbsp;{from}&nbsp;{$f[0]}&nbsp;{to}&nbsp;{$f[6]}{$title_add}\n\t</center>");
    if (!$q->TABLE_EXISTS($sourcetable)) {
        echo $tpl->_ENGINE_parse_body("{$title}<center style='margin:50px'>\n\t\t<H2>{$sourcetable}:{error_no_datas} ({$sourcetable} no such table)</H2></center>");
    }
    echo "<!-- LINE:" . __LINE__ . ">\n";
    $sql = "SELECT {$fieldadd}category,SUM(hits) as totalsize FROM {$sourcetable} GROUP BY {$fieldadd}category {$GROUP_SELECT} ORDER BY totalsize DESC LIMIT 0,10";
    $title0 = TITLE_SQUID_STATSTABLE($sql, "{statistics}:&nbsp;{week}:{$_GET["week"]} ({categories} TOP 10){$title_add}");
    $results = $q->QUERY_SQL($sql);
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $xdata[] = $ligne["totalsize"];
        $ydata[] = $ligne["category"];
    }
    echo "<!-- LINE:" . __LINE__ . ">\n";
    $targetedfilePie = "ressources/logs/" . basename(__FILE__) . "." . __FUNCTION__ . "." . md5($sql) . ".pie.png";
    $gp = new artica_graphs($targetedfilePie);
    $gp->xdata = $xdata;
    $gp->ydata = $ydata;
    $gp->width = 550;
    $gp->height = 550;
    $gp->ViewValues = true;
    $gp->x_title = $tpl->_ENGINE_parse_body("{top_websites}");
    $gp->pie();
    echo "<!-- LINE:" . __LINE__ . ">\n";
    $sql = "SELECT {$fieldadd}SUM(hits) as totalsize,`day` FROM {$sourcetable} GROUP BY {$fieldadd}`day` {$GROUP_SELECT} ORDER BY `day`";
    $title1 = TITLE_SQUID_STATSTABLE($sql, "{statistics}:&nbsp;{week}:{$_GET["week"]} ({requests}){$title_add}");
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo "<H2>{$q->mysql_error}</H2><center style='font-size:11px'><code>{$sql}</code></center>";
    }
    if (mysql_num_rows($results) == 0) {
        echo $tpl->_ENGINE_parse_body("{$title00}\n\t<center style='margin:50px'>\n\t\t<H2>{error_no_datas}</H2>\n\t\t<i>{$sourcetable} (no such data in line " . __LINE__ . ")</i>\n\t</center>");
        return;
    }
    $weeksd = array(1 => "Sunday", 2 => "Monday", 3 => "Tuesday", 4 => "Wednesday", 5 => "Thursday", 6 => "Friday", 7 => "Saturday");
    $xdata = array();
    $ydata = array();
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $xdata[] = $tpl->_ENGINE_parse_body("{{$weeksd[$ligne["day"]]}}");
        $ydata[] = $ligne["totalsize"];
    }
    $targetedfile = "ressources/logs/" . basename(__FILE__) . "." . __FUNCTION__ . "." . md5($sql) . ".png";
    $gp = new artica_graphs();
    $gp->width = 550;
    $gp->height = 350;
    $gp->filename = "{$targetedfile}";
    $gp->xdata = $xdata;
    $gp->ydata = $ydata;
    $gp->y_title = null;
    $gp->x_title = $tpl->_ENGINE_parse_body("{days}");
    $gp->title = null;
    $gp->margin0 = true;
    $gp->Fillcolor = "blue@0.9";
    $gp->color = "146497";
    $gp->line_green();
    if (!is_file($targetedfile)) {
        writelogs("Fatal \"{$targetedfile}\" no such file!", __FUNCTION__, __FILE__, __LINE__);
    }
    $sql = "SELECT {$fieldadd}SUM(size) as totalsize,`day` FROM {$sourcetable} GROUP BY {$fieldadd}`day` {$GROUP_SELECT} ORDER BY `day`";
    $title2 = TITLE_SQUID_STATSTABLE($sql, "{statistics}:&nbsp;{week}:{$_GET["week"]} ({downloaded_flow} MB){$title_add}");
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo "<H2>{$q->mysql_error}</H2><center style='font-size:11px'><code>{$sql}</code></center>";
    }
    if (mysql_num_rows($results) == 0) {
        echo $tpl->_ENGINE_parse_body("\n\t\t{$title00}\n\t\t<center style='margin:50px'>\n\t\t\t<H2>{error_no_datas}</H2><i>{$sourcetable} no such data (no such data in line " . __LINE__ . ")</i>\n\t\t</center>");
    }
    $weeksd = array(1 => "Sunday", 2 => "Monday", 3 => "Tuesday", 4 => "Wednesday", 5 => "Thursday", 6 => "Friday", 7 => "Saturday");
    $xdata = array();
    $ydata = array();
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $xdata[] = $tpl->_ENGINE_parse_body("{{$weeksd[$ligne["day"]]}}");
        $ydata[] = round($ligne["totalsize"] / 1024 / 1000);
    }
    $targetedfile2 = "ressources/logs/" . basename(__FILE__) . "." . __FUNCTION__ . "." . md5($sql) . ".png";
    $gp = new artica_graphs();
    $gp->width = 550;
    $gp->height = 350;
    $gp->filename = "{$targetedfile2}";
    $gp->xdata = $xdata;
    $gp->ydata = $ydata;
    $gp->y_title = null;
    $gp->x_title = $tpl->_ENGINE_parse_body("{days}");
    $gp->title = null;
    $gp->margin0 = true;
    $gp->Fillcolor = "blue@0.9";
    $gp->color = "146497";
    $gp->line_green();
    if (!is_file($targetedfile2)) {
        writelogs("Fatal \"{$targetedfile2}\" no such file!", __FUNCTION__, __FILE__, __LINE__);
    }
    $html = "\n\t{$title00}\n\t<div class=RoundedGrey>\n\t\t{$title0}\n\t\t<img src='{$targetedfilePie}' style='margin:10px'>\n\t</div>\n\t<div class=RoundedGrey>\n\t{$title1}<img src='{$targetedfile}' style='margin:10px'>\n\t</div>\n\t<div class=RoundedGrey>\n\t{$title2}\n\t<img src='{$targetedfile2}' style='margin:10px'>\n\t</div>\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
コード例 #24
0
function generate_graph2()
{
    include_once 'ressources/class.artica.graphs.inc';
    $q = new mysql_squid_builder();
    $page = CurrentPageName();
    $tpl = new templates();
    $t = $_GET["t"];
    $ff = time();
    $graph1 = null;
    $graph2 = null;
    $ID = $_GET["ID"];
    $tablename = "WebTrackMem{$ID}";
    $sql = "SELECT SUM(hits) as thits, category FROM `{$tablename}` GROUP BY category ORDER BY thits DESC LIMIT 0,10";
    $unknown = $tpl->_ENGINE_parse_body("{unknown}");
    $c = 0;
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo "<H2>{$q->mysql_error}</H2><center style='font-size:11px'><code>{$sql}</code></center>";
    }
    if (mysql_num_rows($results) > 0) {
        while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
            if (trim($ligne["category"]) == null) {
                $ligne["category"] = $unknown;
            }
            $ydata[] = $ligne["category"];
            $xdata[] = $ligne["thits"];
            $c++;
        }
        $targetedfile = "ressources/logs/" . md5(basename(__FILE__) . "." . __FUNCTION__ . __LINE__ . "." . time()) . ".png";
        $gp = new artica_graphs($targetedfile);
        $gp->xdata = $xdata;
        $gp->ydata = $ydata;
        $gp->width = 460;
        $gp->height = 500;
        $gp->ViewValues = true;
        $gp->PieLegendHide = false;
        $gp->x_title = $tpl->_ENGINE_parse_body("{top_categories_by_hits}");
        $gp->pie(true);
        if (is_file("{$targetedfile}")) {
            $graph1 = "\n\t\t<center style='font-size:18px;margin:10px'>{$gp->x_title}</center>\n\t\t<img src='{$targetedfile}'>";
        }
    }
    $xdata = array();
    $ydata = array();
    $sql = "SELECT SUM(size) as thits, category FROM `{$tablename}` GROUP BY category ORDER BY thits DESC LIMIT 0,10";
    $unknown = $tpl->_ENGINE_parse_body("{unknown}");
    $c = 0;
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo "<H2>{$q->mysql_error}</H2><center style='font-size:11px'><code>{$sql}</code></center>";
    }
    if (mysql_num_rows($results) > 0) {
        while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
            if (trim($ligne["category"]) == null) {
                $ligne["category"] = $unknown;
            }
            $ligne["thits"] = round($ligne["thits"] / 1024) / 1000;
            $ydata[] = $ligne["category"];
            $xdata[] = $ligne["thits"];
            $c++;
        }
        $targetedfile = "ressources/logs/" . md5(basename(__FILE__) . "." . __FUNCTION__ . __LINE__ . "." . time()) . ".png";
        $gp = new artica_graphs($targetedfile);
        $gp->xdata = $xdata;
        $gp->ydata = $ydata;
        $gp->width = 460;
        $gp->height = 500;
        $gp->ViewValues = true;
        $gp->PieLegendHide = false;
        $gp->x_title = $tpl->_ENGINE_parse_body("{top_categories_by_size}");
        $gp->pie();
        if (is_file("{$targetedfile}")) {
            $graph2 = "\n\t\t<center style='font-size:18px;margin:10px'>{$gp->x_title}<br>MB</center>\n\t\t<img src='{$targetedfile}'>";
        }
    }
    $html = "<table style='width:100%'>\n\t<tr>\n\t\t<td width=50%>{$graph1}</td>\n\t\t<td width=50%>{$graph2}</td>\n\t</tr>\n\t</table>";
    echo $html;
}
コード例 #25
0
function popup()
{
    $img = "<img src='img/bg_sqlgrey-300.jpg'>";
    $page = CurrentPageName();
    $t = time();
    $tpl = new templates();
    $title = $tpl->_ENGINE_parse_body("{APP_MILTER_GREYLIST}");
    if (is_file("ressources/logs/greylist-count-{$_GET["hostname"]}.tot")) {
        $datas = unserialize(@file_get_contents("ressources/logs/greylist-count-{$_GET["hostname"]}.tot"));
        if (is_array($datas)) {
            @unlink("ressources/logs/web/mgreylist.master1.db.png");
            $gp = new artica_graphs(dirname(__FILE__) . "/ressources/logs/web/mgreylist.{$_GET["hostname"]}1.db.png", 0);
            $gp->xdata[] = $datas["GREYLISTED"];
            $gp->ydata[] = "greylisted";
            $gp->xdata[] = $datas["WHITELISTED"];
            $gp->ydata[] = "whitelisted";
            $gp->width = 310;
            $gp->height = 310;
            $gp->ViewValues = false;
            $gp->x_title = "{status}";
            $gp->pie();
            $imgG = "<img src='ressources/logs/web/mgreylist.{$_GET["hostname"]}1.db.png'>";
        }
    }
    $toolbox = "\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td width=1%><img src='img/arrow-right-16.png'></td>\n\t\t<td><a href=\"javascript:blur();\" OnClick=\"javascript:MiltergreylistMilterStatus()\" style='font-size:14px;text-decoration:underline'>{refresh_status}</a></td>\n\t</tr>\n\t<tr>\n\t\t<td width=1%><img src='img/arrow-right-16.png'></td>\n\t\t<td><a href=\"javascript:blur();\" OnClick=\"javascript:SrvMilterServ{$t}('stop')\" style='font-size:14px;text-decoration:underline'>{stop_service}</a></td>\n\t</tr>\n\t<tr>\n\t\t<td width=1%><img src='img/arrow-right-16.png'></td>\n\t\t<td><a href=\"javascript:blur();\" OnClick=\"javascript:SrvMilterServ{$t}('start')\" style='font-size:14px;text-decoration:underline'>{start_service}</a></td>\n\t</tr>\t\t\n\t</table>\n\t\n\t";
    $html = "\n\t<div style='font-size:18px'>{instance}::{$_GET["hostname"]}</div>\n\t<table style='width:99%' class=form>\n\t<tr>\n\t\t<td valign='top'>{$img}</td>\n\t\t<td valign='top' style='width:100%'>\n\t\t\t\t<div id='milter-greylist-status'></div>\n\t\t\t\t{$toolbox}\n\t\t\t</td>\n\t</table>\n\t<center>{$imgG}</center>\n\t\t<script>\n\t\tfunction SrvMilterServ{$t}(type){\n\t\t\tYahooWin5('650','{$page}?SrvMilterServ=yes&hostname={$_GET["hostname"]}&ou={$_GET["ou"]}&type='+type,'{APP_MILTERGREYLIST}&raquo;{service}&raquo;'+type);\n\t\t}\n\t\t\n\t\t\n\t\tMiltergreylistMilterStatus();\n\t\t\n\t\t\n\t\t</script>\n\t";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
}
コード例 #26
0
function popup()
{
    $img = "<img src='img/bg_sqlgrey-240.jpg'>";
    $page = CurrentPageName();
    $mg = Paragraphe('folder-mailbox-64.png', '{main_settings}', '{main_settings_text}', "javascript:main_settings_greylist()", null, 210, 100, 0, true);
    //$mg1=Paragraphe('folder-rules2-64.png','{acl}','{acl_text}',"javascript:main_accesslist_greylist()",null,210,100,0,true);
    $mg2 = Paragraphe('folder-logs-643.png', '{events}', '{events_text}', "javascript:main_events_greylist()", null, 210, 100, 0, true);
    //$mg3=Buildicon64("DEF_ICO_EVENTS_MGREYLITS_DUMP");
    if (is_file("ressources/logs/greylist-count-master.tot")) {
        $datas = unserialize(@file_get_contents("ressources/logs/greylist-count-master.tot"));
        if (is_array($datas)) {
            @unlink("ressources/logs/web/mgreylist.master1.db.png");
            $gp = new artica_graphs(dirname(__FILE__) . "/ressources/logs/web/mgreylist.master1.db.png", 0);
            $gp->xdata[] = $datas["GREYLISTED"];
            $gp->ydata[] = "greylisted";
            $gp->xdata[] = $datas["WHITELISTED"];
            $gp->ydata[] = "whitelisted";
            $gp->width = 350;
            $gp->height = 350;
            $gp->ViewValues = false;
            $gp->x_title = "{status}";
            $gp->pie();
            $imgG = "<img src='ressources/logs/web/mgreylist.master1.db.png'>";
        }
    }
    $content = "\n\t<table style='width:100'>\n\t<tr>\n\t\t<td valign='top'>{$mg}</td>\n\t\t<td valign='top'>{$mg2}</td>\n\t</tr>\n\t</table>\n\t";
    $html = "\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top'>\n\t\t\t{$img}\n\t\t\t<br>\n\t\t\t<div id='mgreylist-status'></div>\n\t\t</td>\n\t\t<td valign='top'>\n\t\t\t{$content}<br><center>{$imgG}</center>\n\t\t</td>\n\t</tr>\n\t\n\t</table>\n\t\n\t<script>\n\t\tmiltergreylist_status();\n\t</script>\n\t\n\t";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
}
コード例 #27
0
function topwebsites_graph(){
	$tpl=new templates();
	$page=CurrentPageName();
	$q=new mysql_squid_builder();
	
	
	$table=$_GET["table"];
	$id=md5($_GET["table"].$_GET["hour"]);
	if(!$q->TABLE_EXISTS($table)){echo "<H3>".$tpl->_ENGINE_parse_body("{ERROR_NO_DATA}")."</h3>";}

	$sql="SELECT SUM(size) as tsize,`hour`,familysite FROM $table GROUP BY familysite,`hour` HAVING `hour`='{$_GET["hour"]}' ORDER BY tsize DESC LIMIT 0,5";
	$results=$q->QUERY_SQL($sql);
	while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){
		$downloaded_bin=$ligne["tsize"];
		$downloaded_text=FormatBytes($downloaded_bin/1024);
		$downloaded_text=str_replace("&nbsp;", " ", $downloaded_text);
		$downloaded_bin=round((($downloaded_bin/1024)/1000));
		
		$website=$ligne["familysite"];
		$ydata[]="MB $website $downloaded_text";
		$xdata[]=$downloaded_bin;	
		
		
	}
	
	
	$targetedfile="ressources/logs/".basename(__FILE__).".".__FUNCTION__.".".time().".png";
	$gp=new artica_graphs($targetedfile);	
	$gp->xdata=$xdata;
	$gp->ydata=$ydata;	
	$gp->width=250;
	$gp->height=400;
	$gp->ViewValues=true;
	//$gp->PieLegendHide=true;
	$gp->x_title=$tpl->_ENGINE_parse_body("{cache}");
	$gp->pie();		
	echo $tpl->_ENGINE_parse_body("<center style='margin:0px;margin-bottom:5px;padding:3px;border:1px solid #CCCCCC'>
		<strong style='font-size:12px'>{phrase_topwebsize_bysize}</strong>
		<img src='$targetedfile' style='margin-bottom:5px'>
		
	 	</center>
	 	
	")."<script>LoadAjax('panel-right-$id','$page?users-usually=yes&time={$_GET["time"]}&hour={$_GET["hour"]}&table={$_GET["table"]}')</script>";
	
}
コード例 #28
0
function popup1()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $table = $_GET["table"];
    $user = $_GET["user"];
    $field = $_GET["field"];
    $category = $_GET["category"];
    $t = $_GET["divkey"];
    $titleW = $q->WEEK_TITLE_FROM_TABLENAME($table);
    $weeksd = array(1 => "Sunday", 2 => "Monday", 3 => "Tuesday", 4 => "Wednesday", 5 => "Thursday", 6 => "Friday", 7 => "Saturday");
    $sql = "SELECT SUM(hits) as thits,SUM(size) as tsize,familysite,\n\tcategory,{$field} FROM {$table} GROUP BY familysite,category,{$field} HAVING category='{$category}' AND {$field}='{$user}' ORDER BY thits DESC LIMIT 0,10";
    $results = $q->QUERY_SQL($sql);
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $ligne["tsize"] = FormatBytes($ligne["tsize"] / 1024);
        $ydata[] = "{$ligne["familysite"]}";
        $xdata[] = $ligne["thits"];
    }
    $targetedfile = "ressources/logs/" . basename(__FILE__) . "." . __FUNCTION__ . "." . time() . ".png";
    $gp = new artica_graphs($targetedfile);
    $gp->xdata = $xdata;
    $gp->ydata = $ydata;
    $gp->width = 250;
    $gp->height = 400;
    $gp->ViewValues = true;
    //$gp->PieLegendHide=true;
    $gp->x_title = $tpl->_ENGINE_parse_body("{cache}");
    $gp->pie();
    $xdata = array();
    $ydata = array();
    $sql = "SELECT SUM(hits) as thits,SUM(size) as tsize,`day`,category,{$field} FROM {$table} GROUP BY `day`,category,{$field} \n\tHAVING category='{$category}' AND {$field}='{$user}' ORDER BY `day`";
    $results = $q->QUERY_SQL($sql);
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $ligne["tsize"] = FormatBytes($ligne["tsize"] / 1024);
        $xdata[] = $tpl->_ENGINE_parse_body("{{$weeksd[$ligne["day"]]}}");
        $ydata[] = $ligne["thits"];
        $tr2[] = "\n\t\t<tr>\n\t\t\t<td width=1%><img src='img/calendar.gif'></td>\n\t\t\t<td style='font-size:12px;font-weight:bold' width=1%>" . $tpl->_ENGINE_parse_body("{{$weeksd[$ligne["day"]]}}") . "</td>\n\t\t\t<td style='font-size:12px;font-weight:bold' width=99% nowrap>{$ligne["thits"]} {hits} - {$ligne["tsize"]}</td>\n\t\t</tr>\n\t\t\t\n\t\t";
    }
    $targetedfile2 = "ressources/logs/" . basename(__FILE__) . "." . __FUNCTION__ . ".2." . time() . ".png";
    $gp = new artica_graphs();
    $gp->width = 270;
    $gp->height = 150;
    $gp->filename = "{$targetedfile2}";
    $gp->xdata = $xdata;
    $gp->ydata = $ydata;
    $gp->y_title = null;
    $gp->x_title = $tpl->_ENGINE_parse_body("{days}");
    $gp->title = null;
    $gp->margin0 = true;
    $gp->Fillcolor = "blue@0.9";
    $gp->color = "146497";
    $gp->line_green();
    if (!is_file($targetedfile2)) {
        $targetedfile2 = "img/nograph-000.png";
    }
    $html = "<table style='width:99%' class=form>\n\t<tbody>\n\t<tr>\n\t\t<td width=1%><img src='img/postmaster-48.png'></td>\n\t\t<td><div style='width:100%;font-size:16px;font-weight:bold'>\n\t\t\t{$user} ({{$field}}) <br>{$titleW}<br>{category}:{$category}\n\t\t</div></td>\n\t</tr>\n\t</tbody>\n\t</table>\n\t<table style='width:99%' class=form>\n\t<tbody>\n\t<tr>\n\t<td valign='top' width=50%>\n\t\t<div style='font-size:13px;font-weight:bold;color: rgb(207, 23, 23);margin-top:15px'>{$category}:{top_visited_websites}:</div>\n\t\t<p>&nbsp;</p>\n\t\t<center><img src='{$targetedfile}'></center>\n\t</td>\n\t<td valign='top' width=50%>\n\t\t<div style='font-size:13px;font-weight:bold;color: rgb(207, 23, 23);margin-top:15px'>{$category}:{hits} {byday}:</div>\n\t\t<p>&nbsp;</p>\n\t\t<center><img src='{$targetedfile2}'>\n\t\t<table style='width:50%;border:1px solid #CCCCCC'><tbody>" . @implode("\n", $tr2) . "</tbody></table>\n\t\t</center>\n\t</td>\n\t</tr>\n\t</tbody>\n\t</table>\n\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}