function central_information(){
	$t=$_GET["t"];
	$page=CurrentPageName();
	$tpl=new templates();	
	$users=new usersMenus();
	$TRPTEXT=null;
	$sock=new sockets();
	$processes=unserialize(base64_decode($sock->getFrameWork("squidstats.php?processes-queue=yes")));
	$DisableArticaProxyStatistics=$sock->GET_INFO("DisableArticaProxyStatistics");
	if(!is_numeric($DisableArticaProxyStatistics)){$DisableArticaProxyStatistics=0;}
	$APP_SQUIDDB_INSTALLED=trim($sock->getFrameWork("squid.php?IS_APP_SQUIDDB_INSTALLED=yes"));
	
	if(is_array($processes)){
		$TRP[]="<table style='width:99%' class=form>";
		while (list ($index, $ligne) = each ($processes) ){
			$TTL=$ligne["TTL"];
			$PID=$ligne["PID"];
			$day=$ligne["day"];
			
		
			$TRP[]="<tr>
				<td width=1%><img src='img/preloader.gif'></td>
				<td style='font-weight:bold'>{processing} $day PID:$PID {since} $TTL</td>
				</tr>";
			
		}
		$TRP[]="</table>";
		$TRPTEXT=@implode("\n", $TRP);
	}
	//database-connect-settings-32.png

		$squiddb=Paragraphe32('mysql_statistics_engine','mysql_statistics_engine_params'
				,"blur()","database-connect-settings-32-grey.png");	
	
	if($users->PROXYTINY_APPLIANCE){$squiddb=null;}
		
	
	
	if(!$users->PROXYTINY_APPLIANCE){
	//$tr[]=Paragraphe32("old_statistics_interface", "old_statistics_interface_text", "SquidQuickLinksStatistics();", "status_statistics-22.png");

	
	
	
	if(!$users->PROXYTINY_APPLIANCE){
		
		$tr[]=Paragraphe32('remote_statistics_server','remote_statistics_server_text',"javascript:Loadjs('squid.stats-appliance.php',true)",'syslog-32-client.png');
		

		if($DisableArticaProxyStatistics==0){
			$tr[]=Paragraphe32('import_squid_logs','import_squid_logs_explain',"Loadjs('squid.logs.import.php',true)",'32-import.png');
		}

		
		$tr[]=Paragraphe32('APP_ARTICADB','APP_ARTICADB_TEXT',"Loadjs('squid.categories.php?onlyDB=yes',true)",'32-categories.png');

	
	if($DisableArticaProxyStatistics==0){
			
		$tr[]=table_heures_enretard();
		$tr[]=Paragraphe32('remote_mysql_server','remote_mysqlsquidserver_text',"Loadjs('squid.remote-mysql.php',true)","artica-meta-32.png");
		$tr[]=Paragraphe32('restore_purged_statistics','restore_purged_statistics_explain',"Loadjs('squid.artica.statistics.restore.php',true)","32-import.png");		
		
		}
		
		
		$tr[]=Paragraphe32('source_logs','source_logs_squid_text'
				,"Loadjs('squid.logrotate.php',true)","32-logs.png");		
		
		$tr[]=Paragraphe32('enable_disable_statistics','ARTICA_STATISTICS_TEXT'
				,"Loadjs('squid.artica.statistics.php',true)","statistics-32.png");
		
		
		
	}
	
	if(!$users->CORP_LICENSE){$more_features="<div class=text-info style='font-size:16px;'>{squid_stats_nolicence_explain}</div>";}
	
	
	if($DisableArticaProxyStatistics==1){
		$more_features="<div class=text-info style='font-size:16px;'>{squid_stats_disabled_explain}</div>";
		
	}
	
	
	
	}
		
	
		//
	$tr[]=Paragraphe32('APP_SARG','APP_SARG_TXT',"Loadjs('sarg.php',true)","sarg-logo-32.png");
	$tr[]=Paragraphe32('APP_SARG_HOWTO','APP_SARG_HOWTO_TXT',
		"s_PopUpFull('http://proxy-appliance.org/index.php?cID=203',1024,768,'Statistics');","help-32.png");
	
	
	if($users->URLSNARF_INSTALLED){
		//$tr[]=Paragraphe32('APP_URLSNARF','APP_URLSNARF_TEXT',"Loadjs('urlsnarf.php')","website-32.png");
	}
	
	
	$table=CompileTr2($tr,true);	
	
	$garphs="<div id='graph1-$t' style='height:250px'><center style='margin:50px'><img src='img/wait-clock.gif'></center></div>
	<div style='text-align:right'>". imgtootltip("refresh-24.png","{refresh}","Loadjs('$page?graphique_heure=yes&container=graph1-$t');")."</div>";
	
	$garphsjs="Loadjs('$page?graphique_heure=yes&container=graph1-$t');";
	
	if($sock->SQUID_LOCAL_STATS_DISABLED()){
		$garphs=$tpl->_ENGINE_parse_body(FATAL_WARNING_SHOW_128("{artica_statistics_disabled}"));
		$garphsjs=null;
		
	}
	
	$EnableSquidRemoteMySQL=$sock->GET_INFO("EnableSquidRemoteMySQL");
	if(!is_numeric($EnableSquidRemoteMySQL)){$EnableSquidRemoteMySQL=0;}
	if($EnableSquidRemoteMySQL==1){
		$garphs="<div id='graph1-$t' style='height:250px'><center style='margin:50px'><img src='img/wait-clock.gif'></center></div>
		<div style='text-align:right'>". imgtootltip("refresh-24.png","{refresh}","Loadjs('$page?graphique_heure=yes&container=graph1-$t');")."</div>";
		
		$garphsjs="Loadjs('$page?graphique_heure=yes&container=graph1-$t');";
		$more_features=null;}
	
	$html="
	<div style='font-size:22px;margin-bottom:15px'>{SQUID_STATS}</div>
	$garphs
	$TRPTEXT
	$more_features
	
	<center>
	<div style='margin-top:15px;width:80%'>$table</div>
	</center>
	<script>
		LoadAjax('info-gene-$t','squid.traffic.statistics.php?squid-status-stats=yes',true);
		$garphsjs
	</script>
	";
	

	echo $tpl->_ENGINE_parse_body($html);
	
}
function PageDeGarde()
{
    $page = CurrentPageName();
    $time = time();
    $DISABLE_STATS = false;
    $sock = new sockets();
    $SquidPerformance = intval($sock->GET_INFO("SquidPerformance"));
    if ($sock->SQUID_LOCAL_STATS_DISABLED()) {
        $SquidPerformance = 2;
    }
    if ($SquidPerformance > 1) {
        $DISABLE_STATS = true;
    }
    if (!$DISABLE_STATS) {
        if (is_file("/usr/share/artica-postfix/ressources/logs/web/CACHED_HOUR.db")) {
            $f1[] = "<div style='width:1150px;height:340px' id='{$time}-squid-01'></div>";
            $f2[] = "function XSquid01{$time}(){\n\t\t\t\tAnimateDiv('{$time}-squid-01');\n\t\t\t\tLoadjs('{$page}?graph-squid-01=yes&container={$time}-squid-01&time={$time}',true);\n\t\t\t}\n\t\t\tsetTimeout(\"XSquid01{$time}()\",500);";
        }
        if (is_file("/usr/share/artica-postfix/ressources/logs/web/NOT_CACHED_HOUR.db")) {
            $f1[] = "<div style='width:1150px;height:340px' id='{$time}-squid-02'></div>";
            $f2[] = "function XSquid02{$time}(){\n\t\t\tAnimateDiv('{$time}-squid-02');\n\t\t\tLoadjs('{$page}?graph-squid-02=yes&container={$time}-squid-02&time={$time}',true);\n\t\t}\n\t\tsetTimeout(\"XSquid02{$time}()\",500);";
        }
        $file1 = "/usr/share/artica-postfix/ressources/logs/web/CACHED_DAY.db";
        $file2 = "/usr/share/artica-postfix/ressources/logs/web/NOT_CACHED_DAY.db";
        if (is_file($file1)) {
            $f1[] = "<div style='width:1150px;height:340px' id='{$time}-squid-03'></div>";
            $f2[] = "function XSquid03{$time}(){\n\t\t\tAnimateDiv('{$time}-squid-03');\n\t\t\tLoadjs('{$page}?graph-squid-03=yes&container={$time}-squid-03&time={$time}',true);\n\t\t}\n\t\tsetTimeout(\"XSquid03{$time}()\",500);";
        }
        if (is_file($file2)) {
            $f1[] = "<div style='width:1150px;height:340px' id='{$time}-squid-04'></div>";
            $f2[] = "function XSquid04{$time}(){\n\t\t\tAnimateDiv('{$time}-squid-04');\n\t\t\tLoadjs('{$page}?graph-squid-04=yes&container={$time}-squid-04&time={$time}',true);\n\t\t}\n\t\tsetTimeout(\"XSquid04{$time}()\",500);";
        }
        $file1 = "/usr/share/artica-postfix/ressources/logs/web/CACHED_HIER_DAY.db";
        $file2 = "/usr/share/artica-postfix/ressources/logs/web/NOT_CACHED_HIER_DAY.db";
        if (is_file($file1)) {
            $f1[] = "<div style='width:1150px;height:340px' id='{$time}-squid-05'></div>";
            $f2[] = "function XSquid05{$time}(){\n\t\t\tAnimateDiv('{$time}-squid-05');\n\t\t\tLoadjs('{$page}?graph-squid-05=yes&container={$time}-squid-05&time={$time}',true);\n\t\t}\n\t\tsetTimeout(\"XSquid05{$time}()\",500);";
        }
        if (is_file($file2)) {
            $f1[] = "<div style='width:1150px;height:340px' id='{$time}-squid-06'></div>";
            $f2[] = "function XSquid06{$time}(){\n\t\t\tAnimateDiv('{$time}-squid-06');\n\t\t\tLoadjs('{$page}?graph-squid-06=yes&container={$time}-squid-06&time={$time}',true);\n\t\t}\n\t\tsetTimeout(\"XSquid06{$time}()\",500);";
        }
    }
    $sock = new sockets();
    $DisableBWMng = intval($sock->GET_INFO("DisableBWMng"));
    if ($DisableBWMng == 0) {
        if (is_file("ressources/logs/web/BWMRT_OUT.db")) {
            $f1[] = "<div style='width:1150px;height:340px' id='{$time}-01'></div>";
            $f2[] = "function XDeux{$time}(){\n\t\t\tAnimateDiv('{$time}-01');\n\t\t\tLoadjs('{$page}?graph-bwrt-out=yes&container={$time}-01&time={$time}',true);\n\t\t}\n\t\tsetTimeout(\"XDeux{$time}()\",500);";
        }
        if (is_file("/usr/share/artica-postfix/ressources/logs/web/BWMRT_IN.db")) {
            $f1[] = "<div style='width:1150px;height:340px' id='{$time}-02'></div>";
            $f2[] = "\n\t\t\t\nfunction XCDeux{$time}(){\n\t\t\tAnimateDiv('{$time}-02');\n\t\t\tLoadjs('{$page}?graph-bwrt-in=yes&container={$time}-02',true);\n\t\t}\n\t\tsetTimeout(\"XCDeux{$time}()\",500);";
        }
    }
    if (is_file("/usr/share/artica-postfix/ressources/logs/web/INTERFACE_LOAD_AVG3.db")) {
        $f1[] = "<div style='width:1150px;height:340px' id='{$time}-3'></div>";
        $f2[] = "function FTrois{$time}(){AnimateDiv('{$time}-3');Loadjs('{$page}?graph3=yes&container={$time}-3',true);} setTimeout(\"FTrois{$time}()\",600);";
    } else {
        if ($GLOBALS["VERBOSE"]) {
            echo "<H1>ressources/logs/web/INTERFACE_LOAD_AVG3.db no such file</H1>\n";
        }
    }
    if (!$DISABLE_STATS) {
        $cacheFile = "/usr/share/artica-postfix/ressources/logs/web/INTERFACE_LOAD_AVG5.db";
        if (is_file($cacheFile)) {
            $f1[] = "<div style='width:1150px;height:340px' id='{$time}-5'></div>";
            $f2[] = "function FCinq{$time}(){\n\t\t\tAnimateDiv('{$time}-5');\n\t\t\tLoadjs('{$page}?graph5=yes&container={$time}-5',true);\n\t\t}\n\t\tsetTimeout(\"FCinq{$time}()\",600);";
        } else {
            if ($GLOBALS["VERBOSE"]) {
                echo "<H1>ressources/logs/web/INTERFACE_LOAD_AVG5.db no such file</H1>\n";
            }
        }
    }
    $html = @implode("\n", $f1) . "<script>" . @implode("\n", $f2) . "</script>";
    echo $html;
}
Ejemplo n.º 3
0
function tabs()
{
    $sock = new sockets();
    $EnableMacAddressFilter = $sock->GET_INFO("EnableMacAddressFilter");
    if (!is_numeric($EnableMacAddressFilter)) {
        $EnableMacAddressFilter = 1;
    }
    $SQUID_LOCAL_STATS_DISABLED = $sock->SQUID_LOCAL_STATS_DISABLED();
    if ($SQUID_LOCAL_STATS_DISABLED) {
        $tpl = new templates();
        echo $tpl->_ENGINE_parse_body("<p class=text-error>{SQUID_LOCAL_STATS_DISABLED}</p>");
    }
    $page = CurrentPageName();
    $tpl = new templates();
    $t = time();
    $boot = new boostrap_form();
    $q = new mysql_squid_builder();
    if (!$SQUID_LOCAL_STATS_DISABLED) {
        $array["{statistics}"] = "{$page}?webstats-left=yes&t={$t}&year={$_GET["year"]}&month={$_GET["month"]}&day={$_GET["day"]}&week={$_GET["week"]}";
        $array["{general_settings}"] = "{$page}?settings=yes";
    }
    $array["{users_translation}"] = "{$page}?tabs-translate=yes";
    $YoutubeCount = $q->COUNT_ROWS("youtube_objects");
    if ($YoutubeCount > 0) {
        $array["{$YoutubeCount} {youtube_videos}"] = "miniadm.webstats.youtube.php?master-content=yes=yes&title=yes";
    }
    $array["{APP_SARG}"] = "miniadm.webstats.sarg.php?tabs=yes";
    echo $boot->build_tab($array);
    //LoadAjax('webstats-left','$page?webstats-left=yes&t=$t&year={$_GET["year"]}&month={$_GET["month"]}&day={$_GET["day"]}&week={$_GET["week"]}');
}
Ejemplo n.º 4
0
function webstats_stats()
{
    $sock = new sockets();
    $SQUID_LOCAL_STATS_DISABLED = $sock->SQUID_LOCAL_STATS_DISABLED();
    if ($SQUID_LOCAL_STATS_DISABLED) {
        return;
    }
    $t = $_GET["t"];
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $DAYSNumbers = $q->COUNT_ROWS("tables_day");
    $month = $_GET["month"];
    $year = $_GET["year"];
    $requests = $q->EVENTS_SUM();
    $requests = numberFormat($requests, 0, "", " ");
    $virtdates = strtotime("{$year}-{$month}-01 00:00:00");
    if (is_numeric($month)) {
        $xdate = date("{F}", $virtdates);
        $add1 = "&nbsp;|&nbsp;<strong>{$xdate} {$year}</strong>";
    }
    if (!isset($_SESSION[date('YmdH')]["add0"])) {
        $sql = "SELECT COUNT(sitename) as tcount FROM visited_sites WHERE LENGTH(category)=0";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
        if ($ligne["tcount"] > 0) {
            $add0 = "&nbsp;|&nbsp;<strong><a href=\"miniadm.webstats.notcategorized-days.php?t={$t}&year={$_GET["year"]}&month={$_GET["month"]}&day={$_GET["day"]}\">" . numberFormat($ligne["tcount"], 0, "", " ") . " {unknown_websites}</a></strong>";
        }
        //not_categorized
        $_SESSION[date('YmdHi')]["add0"] = $add0;
    } else {
        $add0 = $_SESSION[date('YmdHi')]["add0"];
    }
    $html = "<b>{$requests}</b> {requests}&nbsp;|&nbsp;<b>{$DAYSNumbers}</b> {daysOfStatistics}{$add0}{$add1}";
    echo $tpl->_ENGINE_parse_body($html);
}