示例#1
0
function pie_single_mailbox_user()
{
    $tpl = new Templates();
    $USER_STORAGE_USAGE = $_GET["USER_STORAGE_USAGE"];
    $USER_STORAGE_LIMIT = $_GET["STORAGE_LIMIT"];
    $FREE = $_GET["FREE"];
    writelogs("USER_STORAGE_USAGE={$USER_STORAGE_USAGE}", __FUNCTION__, __FILE__);
    writelogs("STORAGE_LIMIT={$USER_STORAGE_LIMIT}", __FUNCTION__, __FILE__);
    if ($USER_STORAGE_LIMIT == null) {
        $USER_STORAGE_LIMIT = 1000000;
        $USER_STORAGE_USAGE = 0;
        $FREE = $USER_STORAGE_LIMIT;
    }
    $USER_STORAGE_RESTANT = $USER_STORAGE_LIMIT - $USER_STORAGE_USAGE;
    if ($USER_STORAGE_RESTANT > 1) {
        $reste = round($USER_STORAGE_RESTANT / 1024);
        $data = array($USER_STORAGE_USAGE, $USER_STORAGE_RESTANT);
    } else {
        $data = array($USER_STORAGE_USAGE);
    }
    $title = $tpl->_ENGINE_parse_body("{your mailbox usage}\n ({$reste} mb free)");
    writelogs("USER_STORAGE_USAGE={$USER_STORAGE_USAGE} - USER_STORAGE_LIMIT={$USER_STORAGE_LIMIT} FREE={$FREE}", __FUNCTION__, __FILE__);
    $date = date('Y-m-d');
    $textes = array();
    $donnees = array();
    $zlabel = array();
    $date = date('Y-m-d');
    $textes[] = 'title';
    $donnees[] = '';
    $donnees[] = $FREE;
    $textes[] = "Free";
    $donnees[] = $USER_STORAGE_USAGE;
    $textes[] = "used";
    BuildPieChart(array($textes, $donnees));
}
示例#2
0
function build_statistics(){

	$today=date('Y-m-d');
	$yesterday=date("Y-m-d",mktime(0,0,0,date("m") ,date("d")-1,date("Y")));
	$mysql=new mysql();
	$query_aliases=query_aliases();
	$search_pattern=$_GET["search"];
	if(!isset($_GET["section"])){$_GET["section"]='today';}	
	
	switch ($_GET["section"]) {
			
			case "today":$todate="AND DATE_FORMAT(`quarantine`.zDate,'%Y-%m-%d')='$today'";break;
			case "yesterday";$todate="AND DATE_FORMAT(`quarantine`.zDate,'%Y-%m-%d')='$yesterday'";break;
			case "week";
				$todate="AND WEEK(`quarantine`.zDate)=WEEK(NOW())";
				$date_plus=",DATE_FORMAT(`quarantine`.zDate,'%W') AS WeekDay";
				break;
			default:$todate="AND DATE_FORMAT(`quarantine`.zDate,'%Y-%m-%d')='$today'";break;
			
		}

		
	if(isset($_GET["datas"])){
		$field="`mailfrom_domain`,`mailfrom`";
		$addp="AND mailfrom_domain='{$_GET["datas"]}'";
	}else{
		$field="`mailfrom_domain`";
	}
	$sql="SELECT COUNT(*) as tcount, $field FROM quarantine,storage_recipients WHERE 
		`quarantine`.MessageID=storage_recipients.MessageID  $todate 
		 AND (".query_aliases().")
		 $addp
		 $search_patternq GROUP BY $field ORDER BY tcount DESC LIMIT 0,10";

$results=$mysql->QUERY_SQL($sql,'artica_backup');
		$textes[]='title';
		$donnees[]='';

		while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){
			if(isset($ligne["mailfrom"])){
				$textes[]=$ligne["mailfrom"];
			}else{
				$textes[]=$ligne["mailfrom_domain"];
			}
			$donnees[]=$ligne["tcount"];
			
		}
		
		$page=CurrentPageName();
unset($_GET["QuaratinePie"]);
while (list ($num, $val) = each ($_GET) ){
	$datas=$datas. "&$num=$val";
	
}		
		
		$links=array("url"=>"javascript:LoadAjax('content_q','$page?main=stats$datas',_category_)","target"=>"javascript");
		//javascript:display_info( _col_, _row_, _value_, _category_, _series_, 'Hello World!' )" target='javascript'
		    include_once(dirname(__FILE__).'/listener.graphs.php');
			BuildPieChart(array($textes,$donnees),$links);
	
}