function page()
{
    $sock = new sockets();
    $EnableRemoteStatisticsAppliance = $sock->GET_INFO("EnableRemoteStatisticsAppliance");
    $MalwarePatrolDatabasesCount = $sock->getFrameWork("cmd.php?MalwarePatrolDatabasesCount=yes");
    if (GET_CACHED(__FILE__, __FUNCTION__, __FUNCTION__)) {
        return;
    }
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $users = new usersMenus();
    $websitesnums = $q->COUNT_ROWS("visited_sites");
    $websitesnums = numberFormat($websitesnums, 0, "", " ");
    $sql = "DELETE FROM categorize WHERE LENGTH(pattern)=0";
    $q->QUERY_SQL($sql);
    $export = $q->COUNT_ROWS("categorize");
    $export = numberFormat($export, 0, "", " ");
    $categories = $q->COUNT_CATEGORIES();
    $categories = numberFormat($categories, 0, "", " ");
    $tablescat = $q->LIST_TABLES_CATEGORIES();
    $tablescatNUM = numberFormat(count($tablescat), 0, "", " ");
    $q = new mysql_squid_builder();
    $requests = $q->EVENTS_SUM();
    $requests = numberFormat($requests, 0, "", " ");
    $PhishingURIS = $q->COUNT_ROWS("uris_phishing");
    $PhishingURIS = numberFormat($PhishingURIS, 0, "", " ");
    $MalwaresURIS = $q->COUNT_ROWS("uris_malwares");
    $MalwaresURIS = numberFormat($MalwaresURIS, 0, "", " ");
    $Computers = $q->COUNT_ROWS("webfilters_nodes");
    $Computers = numberFormat($Computers, 0, "", " ");
    $DAYSNumbers = $q->COUNT_ROWS("tables_day");
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(totalsize) as tsize FROM tables_day"));
    $totalsize = FormatBytes($ligne["tsize"] / 1024);
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT AVG(cache_perfs) as pourc FROM tables_day"));
    $pref = round($ligne["pourc"]);
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT COUNT(sitename) as tcount FROM visited_sites WHERE LENGTH(category)=0"));
    $websitesnumsNot = numberFormat($ligne["tcount"], 0, "", " ");
    $CachePermformance = $q->CachePerfHour();
    if ($CachePermformance > -1) {
        $color = "#E01313";
        if ($CachePermformance > 20) {
            $color = "#6DBB6A";
        }
        $cachePerfText = "\n\t\t<tr>\n\t\t<td valign='top' style='font-size:14px;'><b style='color:{$color}'>{$CachePermformance}%</b> {cache_performance} ({now})</td>\n\t\t</tr>\n\t\t";
    }
    $mouse = "OnMouseOver=\";this.style.cursor='pointer';\" OnMouseOut=\";this.style.cursor='default';\"";
    $submenu = "\t\n\t<tr>\n\t\t<td valign='top' style='font-size:14px'><b>{$totalsize}</b> {downloaded_flow}</td>\n\t</tr>\n\t<tr>\n\t\t<td valign='top' style='font-size:14px'><b>{$pref}%</b> {cache_performance}</td>\n\t</tr>\n\t";
    $main_table = "\n\t<table style='width:98%' class=form>\n\t<tr><td style='font-size:16px'>{statistics}::{status}</td></tr>\n\t{$cachePerfText}\n\t<tr>\n\t\t<td valign='top' style='font-size:14px;><b>{$DAYSNumbers}</b> {daysOfStatistics}</td>\n\t</tr>\n\t<tr>\n\t\t<td valign='top' style='font-size:14px'><b>{$requests}</b> {requests}</td>\n\t</tr>\n\t<tr>\n\t\t<td valign='top' style='font-size:14px'><b>{$Computers}</b> {computers}</td>\n\t</tr>\t\t\n\t<tr>\n\t\t<td valign='top' style='font-size:14px;'><b>{$websitesnums}</b> {visited_websites}</td>\n\t</tr>\t\n\n\t<tr>\n\t\t<td valign='top' style='font-size:14px;'><b>{$categories}</b> {websites_categorized}</td>\n\t</tr>\n\t<tr>\n\t\t<td valign='top'  style='font-size:14px;'><b>{$PhishingURIS}</b> {phishing_uris}</td>\n\t</tr>\t\n\t<tr>\n\t\t<td valign='top'  style='font-size:14px;'><b>{$MalwaresURIS}</b> {viruses_uris}</td>\n\t</tr>\n\t<tr>\n\t\t<td valign='top'  style='font-size:14px;'><b>{$MalwarePatrolDatabasesCount}</b> Malware Patrol</td>\n\t</tr>\t\t\t\t\t\n\t<tr>\n\t\t<td valign='top'  style='font-size:14px;'><b>{$websitesnumsNot}</b> {not_categorized}</td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td valign='top'  style='font-size:14px;'><b>{$tablescatNUM}</b> {categories}</td>\n\t</tr>\n\t</table>\t\n";
    $main_table = $tpl->_ENGINE_parse_body($main_table);
    SET_CACHED(__FILE__, __FUNCTION__, __FUNCTION__, $main_table);
    echo $main_table;
}
Ejemplo n.º 2
0
function show_tables()
{
    $q = new mysql_squid_builder();
    $q->EVENTS_SUM();
}
Ejemplo n.º 3
0
function status_squid_left($asroot=false){
	
	if(GET_CACHED(__FILE__, __FUNCTION__,__FUNCTION__)){return;}
	$page=CurrentPageName();
	$tpl=new templates();
	$users=new usersMenus();

	include_once(dirname(__FILE__)."/ressources/class.status.inc");
	$sock=new sockets();
	$SquidBinIpaddr=$sock->GET_INFO("SquidBinIpaddr");
	if($SquidBinIpaddr==null){$SquidBinIpaddr="0.0.0.0";}
	$urgency_mode_img="20-check-grey.png";
	if($SquidBinIpaddr=="0.0.0.0"){$SquidBinIpaddr="{all}";}
	$CacheManagement2=$sock->GET_INFO("CacheManagement2");
	if(!is_numeric($CacheManagement2)){$CacheManagement2=0;}
	$squid=new squidbee();
	$q=new mysql();
	$master_version=$squid->SQUID_VERSION;
	$text_kavicap_error=null;
	$text_script=null;
	$cache_mem=$squid->global_conf_array["cache_mem"];	
	$users=new usersMenus();
	
	$As32=false;
	if(!isset($_GET["uuid"])){$_GET["uuid"]=$sock->getframework("cmd.php?system-unique-id=yes");}
	

	$EnableKavICAPRemote=$sock->GET_INFO("EnableKavICAPRemote");
	$KavICAPRemoteAddr=$sock->GET_INFO("KavICAPRemoteAddr");
	$KavICAPRemotePort=$sock->GET_INFO("KavICAPRemotePort");	
	if(!is_numeric($EnableKavICAPRemote)){$EnableKavICAPRemote=0;}
	$CPU_NUMBER=$sock->getFrameWork("services.php?CPU-NUMBER=yes");
	
	if($EnableKavICAPRemote==1){
		$fp=@fsockopen($KavICAPRemoteAddr, $KavICAPRemotePort, $errno, $errstr, 1);
			if(!$fp){
				$text_kavicap_error="<div>{kavicap_unavailable_text}<br><strong>
				<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.kavicap.php');\" style='font-size:12px;color:#D70707;text-decoration:underline'>$KavICAPRemoteAddr:$KavICAPRemotePort</a><br>$errstr</div>";				
			}
		
		@fclose($fp);			
	}
	
	$q=new mysql_squid_builder();
	
	$text_error_sql="<div id='db-status-infos'></div>
	<script>LoadAjax('db-status-infos','$page?db-status-infos=yes',true);</script>
	";
	
	
	
	$q=new mysql_squid_builder();
	$requests=$q->EVENTS_SUM();
	$requests=numberFormat($requests,0,""," ");
	
	
	$tableblock=date('Ymd')."_blocked";
	$ligneW=$q->COUNT_ROWS($tableblock);
	$blocked_today=numberFormat($ligneW,0,""," ")." {blocked_websites} {this_day}";
	
	$q=new mysql_squid_builder();
	$websitesnums=$q->COUNT_ROWS("dansguardian_sitesinfos","artica_backup");
	$websitesnums=numberFormat($websitesnums,0,""," ");	
	
	$q=new mysql_squid_builder();
	$categories=$q->COUNT_ROWS("dansguardian_community_categories");
	$categories=numberFormat($categories,0,""," ");		
	
	$sock=new sockets();
	$sock->SET_INFO("squidStatsCategoriesNum",$categories);
	$sock->SET_INFO("squidStatsWebSitesNum",$websitesnums);
	$sock->SET_INFO("squidStatsBlockedToday",$blocked_today);
	$sock->SET_INFO("squidStatsRequestNumber",$requests);
	$styleText="font-size:12px;font-weight:bold";
	$migration_pid=unserialize(base64_decode($sock->getFrameWork("squid.php?migration-stats=yes")));
	if(is_array($migration_pid)){
		$text_script="<span style='color:#B80000;font-size:13px'>{migration_script_run_text} PID:{$migration_pid[0]} {since}:{$migration_pid[1]}Mn</span>";
	}	
	
	
	$DisableSquidSNMPModeText="{disabled}";
	$DisableSquidSNMPModeCK="20-check-grey.png";
	$SquidEnableRockStoreCK="20-check-grey.png";
	if(preg_match("#^([0-9]+)\.([0-9]+)#", $master_version,$re)){
		$MAJOR=$re[1];
		$MINOR=$re[2];
		if($MAJOR>2){if($MINOR>1){$As32=true;}}
		$master_version_text="$MAJOR.$MINOR";
	}	
	
	if(preg_match("#^([0-9]+)\.([0-9]+)\.([0-9]+)#", $master_version,$re)){
		$MAJOR=$re[1];
		$MINOR=$re[2];
		$REV=$re[3];
		$master_version_text="$MAJOR.$MINOR.$REV";
	}
	
	
	if($master_version_text==null){$master_version_text="Unknown";}
	
	
	
	if($As32){
		if($CPU_NUMBER>1){
			$SquidEnableRockStore=$sock->GET_INFO("SquidEnableRockStore");
			$SquidRockStoreSize=$sock->GET_INFO("SquidRockStoreSize");
			if(!is_numeric($SquidEnableRockStore)){$SquidEnableRockStore=0;}
			if(!is_numeric($SquidRockStoreSize)){$SquidRockStoreSize=2000;}
			
			
				$DisableSquidSNMPModeText=$CPU_NUMBER." cpu(s)";
				$DisableSquidSNMPModeCK="20-check.png";
			
			
			
			
			if($SquidEnableRockStore==1){
				$SquidRockStoreSize=FormatBytes($SquidRockStoreSize*1024);
				$SquidEnableRockStoreCK="20-check.png";
			}else{
				$SquidRockStoreSize="{disabled}";
			}
			
			$smptr="		
			<tr>
				<td width=1%><img src='img/$DisableSquidSNMPModeCK'></td>
				<td class=legend nowrap style='font-size:12px'>SMP:</td>
				<td style='font-size:14px'>
				<a href=\"javascript:blur();\"
				OnClick=\"javascript:Loadjs('squid.caches32.php?smp-js=yes&uuid={$_GET["uuid"]}');\"
				style='$styleText;text-decoration:underline'>$DisableSquidSNMPModeText</a></span></td>
			</tr>
			<tr>
				<td width=1%><img src='img/$SquidEnableRockStoreCK'></td>
				<td class=legend nowrap style='font-size:12px'>Rock store:</td>
				<td style='font-size:14px'>
				<a href=\"javascript:blur();\"
				OnClick=\"javascript:Loadjs('squid.rockstore.php');\"
				style='$styleText;text-decoration:underline'>$SquidRockStoreSize</a></td>
			</tr>";			
			
		}
	}
	
	
	$qs=new mysql();
	if(!$qs->FIELD_EXISTS("nics","ucarp-enable","artica_backup")){$qs->QUERY_SQL("ALTER TABLE `nics` ADD `ucarp-enable` smallint( 1 ) NULL DEFAULT '0'",'artica_backup'); }
	$sql="SELECT COUNT(*) as tcount FROM nics WHERE `ucarp-enable`=1";
	$ligne2=mysql_fetch_array($qs->QUERY_SQL($sql,"artica_backup"));
	$failover_icon="20-check-grey.png";
	if($ligne2["tcount"]==0){
		$failover_text="{disabled}";
	}else{
		$failover_text="{enabled}";
		$failover_icon="20-check.png";
	}
	if(!$users->UCARP_INSTALLED){
		$failover_text="-";
		$failover_icon="20-check-grey.png";
	}
	
	if($CacheManagement2==1){$smptr=null;}
	$DisableAnyCache=$sock->GET_INFO("DisableAnyCache");
	if(!is_numeric($DisableAnyCache)){$DisableAnyCache=0;}
	$SquidCacheLevel=$sock->GET_INFO("SquidCacheLevel");
	if(!is_numeric($SquidCacheLevel)){$SquidCacheLevel=4;}
	if($SquidCacheLevel==0){$DisableAnyCache=1;}
	
	
	$hasProxyTransparent=$sock->GET_INFO("hasProxyTransparent");
	if(!is_numeric($hasProxyTransparent)){$hasProxyTransparent=0;}
	
	$hasProxyTransparentText="{disabled}";
	$hasProxyTransparentCheck="20-check-grey.png";
	
	$DisableAnyCacheText="{enabled}";
	$DisableAnyCacheCheck="20-check.png";
	
	if($hasProxyTransparent==1){
		$hasProxyTransparentText="{enabled}";
		$hasProxyTransparentCheck="20-check.png";
	}
	
	if($DisableAnyCache==1){
		$DisableAnyCacheText="{disabled}";
		$DisableAnyCacheCheck="20-check-grey.png";
		
	}else{
		$qN=new mysql();
		$ligne=mysql_fetch_array($qN->QUERY_SQL("SELECT SUM(cache_size) as size FROM squid_caches_center WHERE enabled=1","artica_backup"));
		$size=$ligne["size"];
		$DisableAnyCacheText=FormatBytes($size*1024);
	}	
	
	
	
	if(preg_match("#^([0-9]+)\s+#", $cache_mem)){
		$cache_mem2=$re[1];
		$cache_mem2=($cache_mem*1024);
		$cache_mem2=FormatBytes($cache_mem2);
	}
	$EnableCNTLM=$sock->GET_INFO("EnableCNTLM");
	$CNTLMPort=$sock->GET_INFO("CnTLMPORT");
	$EnableRDPProxy=$sock->GET_INFO("EnableRDPProxy");
	$SquidUrgency=$sock->GET_INFO("SquidUrgency");
	if(!is_numeric($SquidUrgency)){$SquidUrgency=0;}
	$urgency_mode_color=null;
	$urgency_text="{disabled}";
	
	if($SquidUrgency==1){
		$urgency_mode_color=";color:#BE0303";
		$urgency_mode_img="20-check-red.png";
		$urgency_text="{enabled}";
	}
	
	
	
	if(!is_numeric($EnableRDPProxy)){$EnableRDPProxy=0;}
	if(!is_numeric($EnableCNTLM)){$EnableCNTLM=0;}
	if(!is_numeric($CNTLMPort)){$CNTLMPort=3155;}
	
	$PP[]=$squid->listen_port;
	
	if(!is_numeric($squid->second_listen_port)){$squid->second_listen_port=0;}
	if($squid->second_listen_port>0){
		$PP[]=$squid->second_listen_port;
	}
	
	if($EnableCNTLM==0){
		if($CNTLMPort>0){
			$PP[]=$CNTLMPort;
		}
	}
	
	$transparent_mode="
		<tr>
			<td width=1%><img src='img/$hasProxyTransparentCheck'></td>
			<td class=legend nowrap style='font-size:12px'>{transparent}:</td>
			<td style='font-size:14px'>
			<a href=\"javascript:blur();\"
			OnClick=\"Loadjs('squid.newbee.php?squid-transparent-js=yes');\"
			style='$styleText;text-decoration:underline'>$hasProxyTransparentText</a></td>
		</tr>";	
	
	$DisableAnyCache="
		<tr>
			<td width=1%><img src='img/$DisableAnyCacheCheck'></td>
			<td class=legend nowrap style='font-size:12px'>{caches} {disk}:</td>
			<td style='font-size:14px'>
			<a href=\"javascript:blur();\"
			
			style='$styleText'>$DisableAnyCacheText</a></td>
		</tr>";	
	
	
	
	
	
	$CacheMemory="<tr>
			<td width=1%><img src='img/20-check.png'></td>
			<td class=legend nowrap style='font-size:12px'>{cache_memory}:</td>
			<td style='font-size:14px'><a href=\"javascript:blur();\" 
			OnClick=\"javascript:Loadjs('squid.cache_mem.php');\" 
			style='$styleText;text-decoration:underline'>{$cache_mem2}</a></td>
		</tr>";
	
	if($CacheManagement2==1){$CacheMemory=null;}
	$squidversion="	
	<center>
	<div class=form style='width:93%'>
	<table style='width:250px;margin-top:10px;' class='TableRemove TableMarged'>
	<tbody>
		<tr>
			<td colspan=3 style='font-size:14px;text-align:center;padding-bottom:10px'><a href=\"javascript:blur();\"
		OnClick=\"javascript:Loadjs('squid.popups.php?script=visible_hostname');\"
		style='font-size:14px;text-decoration:underline;'>$squid->visible_hostname</a>
			</td>
		</tr>	
	
	
		<tr>
			<td width=1%><img src='img/20-check.png'></td>
			<td class=legend nowrap style='font-size:12px'>Proxy {version}:</td>
			<td style='$styleText'><a href=\"javascript:blur();\" 
			OnClick=\"javascript:Loadjs('squid.compilation.status.php');\" 
			style='$styleText;text-decoration:underline'>$master_version_text</a></td>
		</tr>
		<tr>
			<td width=1%><img src='img/20-check.png'></td>
			<td class=legend nowrap style='font-size:12px'>{listen_addr}:</td>
			<td style='font-size:14px'><a href=\"javascript:blur();\" 
			OnClick=\"javascript:Loadjs('squid.nic.php');\" 
			style='$styleText;text-decoration:underline'>$SquidBinIpaddr</a></td>
		</tr>	

		<tr>
			<td width=1%><img src='img/$urgency_mode_img'></td>
			<td class=legend nowrap style='font-size:12px$urgency_mode_color'>{urgency_mode}:</td>
			<td style='$styleText'><a href=\"javascript:blur();\" 
			OnClick=\"javascript:Loadjs('squid.urgency.php');\" 
			style='$styleText;text-decoration:underline$urgency_mode_color'>$urgency_text</a></td>
		</tr>		
		
		$smptr
		$transparent_mode
		$DisableAnyCache
		$CacheMemory

		<tr>
			<td width=1%><img src='img/$failover_icon'></td>
			<td class=legend nowrap style='font-size:12px'>{failover2}:</td>
			<td style='font-size:14px'><a href=\"javascript:blur();\" 
			OnClick=\"javascript:Loadjs('squid.failover.php');\" 
			style='$styleText;text-decoration:underline'>{$failover_text}</a></td>
		</tr>	
		
		
		</tbody>
	</table>
	</div>
	</center>
	";
	
	if($users->WEBSTATS_APPLIANCE){$squidversion=null;}
	
	$design="
	$text_error_sql
	$text_script
	$text_kavicap_error
	$squidversion
	<div id='squid-plugins-activated'></div>
	<div style='width:100%;text-align:right'>". 
	imgtootltip("refresh-24.png","{refresh}",
			"LoadAjax('squid-status','squid.main.quicklinks.php?status=yes');")."
	</div>
	
	";
	
	$classform="class=form";
	$sock=new sockets();
	$EnableRemoteStatisticsAppliance=$sock->GET_INFO("EnableRemoteStatisticsAppliance");
	if(!is_numeric($EnableRemoteStatisticsAppliance)){$EnableRemoteStatisticsAppliance=0;}
	$UnlockWebStats=$sock->GET_INFO("UnlockWebStats");
	if(!is_numeric($UnlockWebStats)){$UnlockWebStats=0;}
	if($UnlockWebStats==1){$EnableRemoteStatisticsAppliance=0;}	
	
	
	if($EnableRemoteStatisticsAppliance==1){$classform=null;}	
	
	$html="
	$design
	<center>
	
		<div id='squid-status-stats' $classform style='width:90%'></div>
	</center>
	
	
	<script>
		LoadAjax('squid-status-stats','squid.traffic.statistics.php?squid-status-stats=yes');	
		LoadAjax('squid-services','$page?squid-services=yes');
		LoadAjax('squid-plugins-activated','dansguardian2.php?dansguardian-status=yes');
	</script>
	";
	

	if($asroot){
		SET_CACHED(__FILE__, __FUNCTION__, __FUNCTION__, $html);
		return;
	}
	
	$html=$tpl->_ENGINE_parse_body($html);
	SET_CACHED(__FILE__, __FUNCTION__, __FUNCTION__, $html);
	echo $html;
	
	
}
function squid_status_stats(){
	$page=CurrentPageName();
	$tpl=new templates();	
	$q=new mysql_squid_builder();
	
	$websitesnums=$q->COUNT_ROWS("visited_sites");
	$websitesnums=numberFormat($websitesnums,0,""," ");	
	
	
	$categories=$q->COUNT_CATEGORIES();
	$categories=numberFormat($categories,0,""," ");

	$q=new mysql_squid_builder();
	$requests=$q->EVENTS_SUM();
	$requests=numberFormat($requests,0,""," ");	
	
	$DAYSNumbers=$q->COUNT_ROWS("tables_day");
	
	$ligne=mysql_fetch_array($q->QUERY_SQL("SELECT SUM(totalsize) as tsize FROM tables_day"));
	$totalsize=FormatBytes($ligne["tsize"]/1024);
	
	$ligne=mysql_fetch_array($q->QUERY_SQL("SELECT AVG(cache_perfs) as pourc FROM tables_day"));
	$pref=round($ligne["pourc"]);	

$html="
<table style='width:100%'>
	<tbody>
	<tr>
		<td valign='top' style='font-size:14px'><b>$DAYSNumbers</b> {daysOfStatistics}</td>
	</tr>
	<tr>
		<td valign='top' style='font-size:14px'><b>$requests</b> {requests}</td>
	</tr>
	<tr>
		<td valign='top' style='font-size:14px'><b>$websitesnums</b> {visited_websites}</td>
	</tr>		
	<tr>
		<td valign='top' style='font-size:14px'><b>$categories</b> {websites_categorized}</td>
	</tr>			
	<tr>
		<td valign='top' style='font-size:14px'><b>$totalsize</b> {downloaded_flow}</td>
	</tr>
	<tr>
		<td valign='top' style='font-size:14px'><b>$pref%</b> {cache_performance}</td>
	</tr>	
	</tbody>
	</table>";

echo $tpl->_ENGINE_parse_body($html);
	
}
Ejemplo n.º 5
0
function squid_status_stats()
{
    $off = "<script>UnlockPage();</script>";
    if (!$GLOBALS["AS_ROOT"]) {
        $cachefile = "/usr/share/artica-postfix/ressources/logs/web/traffic.statistics.html";
        if (is_file($cachefile)) {
            $tpl = new templates();
            $cacheContent = @file_get_contents($cachefile);
            if (strlen($cacheContent) > 20) {
                echo $tpl->_ENGINE_parse_body(@file_get_contents($cachefile)) . $off;
                return;
            }
        }
    }
    if (CACHE_SESSION_GET(__FUNCTION__, __FILE__)) {
        return;
    }
    if ($GLOBALS["VERBOSE"]) {
        echo __LINE__ . " Loading classes<br>\n";
    }
    $sock = new sockets();
    $users = new usersMenus();
    $EnableRemoteStatisticsAppliance = $sock->GET_INFO("EnableRemoteStatisticsAppliance");
    $SquidActHasReverse = $sock->GET_INFO("SquidActHasReverse");
    if (!is_numeric($SquidActHasReverse)) {
        $SquidActHasReverse = 0;
    }
    if ($EnableRemoteStatisticsAppliance == 1) {
        return;
    }
    $DisableArticaProxyStatistics = $sock->GET_INFO("DisableArticaProxyStatistics");
    if (!is_numeric($DisableArticaProxyStatistics)) {
        $DisableArticaProxyStatistics = 0;
    }
    $MalwarePatrolDatabasesCount = $sock->getFrameWork("cmd.php?MalwarePatrolDatabasesCount=yes");
    $mouse = "OnMouseOver=\";this.style.cursor='pointer';\" OnMouseOut=\";this.style.cursor='default';\"";
    $EnableMacAddressFilter = $sock->GET_INFO("EnableMacAddressFilter");
    if (!is_numeric($EnableMacAddressFilter)) {
        $EnableMacAddressFilter = 1;
    }
    if ($GLOBALS["VERBOSE"]) {
        echo __LINE__ . " Loading mysql_storelogs()<br>\n";
    }
    $syslogs = new mysql_storelogs();
    if ($GLOBALS["VERBOSE"]) {
        echo __LINE__ . " Count accesslogs<br>\n";
    }
    $SyslogsFiles = $syslogs->COUNT_ROWS("accesslogs");
    $TR_ACCESSLOG = "\n\t<tr>\n\t<td width=1%><img src='img/arrow-right-16.png'></td>\n\t<td valign='top' {$mouse} style='font-size:12px;text-decoration:underline' \n\t\tOnClick=\"javascript:Loadjs('squid.accesses.rotate.php')\"><b><span style='font-size:12px'>{$SyslogsFiles}</span></b><span style='font-size:12px'> {access_logs}</td>\n\t</tr>";
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    if ($users->PROXYTINY_APPLIANCE) {
        $DisableArticaProxyStatistics = 1;
    }
    if ($DisableArticaProxyStatistics == 0) {
        $websitesnums = $q->COUNT_ROWS("visited_sites");
        $websitesnums = numberFormat($websitesnums, 0, "", " ");
        $sql = "DELETE FROM categorize WHERE LENGTH(pattern)=0";
        $q->QUERY_SQL($sql);
        $export = $q->COUNT_ROWS("categorize");
        $export = numberFormat($export, 0, "", " ");
    }
    $catz = new mysql_catz();
    $categories = $catz->COUNT_CATEGORIES();
    $categories = numberFormat($categories, 0, "", " ");
    if ($GLOBALS["VERBOSE"]) {
        echo __LINE__ . " categories= {$categories}<br>\n";
    }
    $YourItems = $q->COUNT_CATEGORIES();
    $YourItems = numberFormat($YourItems, 0, "", " ");
    if ($GLOBALS["VERBOSE"]) {
        echo __LINE__ . " LIST_TABLES_CATEGORIES()<br>\n";
    }
    $tablescat = $q->LIST_TABLES_CATEGORIES();
    if ($GLOBALS["VERBOSE"]) {
        echo __LINE__ . " tablescat={$tablescat}<br>\n";
    }
    $tablescatNUM = numberFormat(count($tablescat), 0, "", " ");
    if ($DisableArticaProxyStatistics == 0) {
        if ($GLOBALS["VERBOSE"]) {
            echo __LINE__ . " EVENTS_SUM()<br>\n";
        }
        $requests = $q->EVENTS_SUM();
        $requests = numberFormat($requests, 0, "", " ");
        if ($GLOBALS["VERBOSE"]) {
            echo __LINE__ . " requests = {$requests}<br>\n";
        }
    }
    if ($GLOBALS["VERBOSE"]) {
        echo __LINE__ . " no_license -> translate<br>\n";
    }
    $nolicense = $tpl->_ENGINE_parse_body("{no_license}");
    $PhishingURIS = $q->COUNT_ROWS("categoryuris_phishing");
    $PhishingURIS = numberFormat($PhishingURIS, 0, "", " ");
    if ($GLOBALS["VERBOSE"]) {
        echo __LINE__ . " >COUNT_ROWS('categoryuris_malware')<br>\n";
    }
    $MalwaresURIS = $q->COUNT_ROWS("categoryuris_malware");
    $MalwaresURIS = numberFormat($MalwaresURIS, 0, "", " ");
    if (!$users->CORP_LICENSE) {
        $PhishingURIS = $nolicense;
        $MalwaresURIS = $nolicense;
    }
    if ($DisableArticaProxyStatistics == 0) {
        if ($EnableMacAddressFilter == 1) {
            $Computers = $q->COUNT_ROWS("webfilters_nodes");
            $Computers = numberFormat($Computers, 0, "", " ");
            $nodes = "\n\t\t\t<tr>\n\t\t\t\t<td width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top' {$mouse} style='font-size:12px;text-decoration:underline' OnClick=\"javascript:Loadjs('squid.nodes.php',true)\"><b><span style='font-size:12px'>{$Computers}</span></b><span style='font-size:12px'> {computers}</td>\n\t\t\t</tr>";
        } else {
            $Computers = $q->COUNT_ROWS("UserAutDB");
            $Computers = numberFormat($Computers, 0, "", " ");
            $nodes = "\n\t\t\t<tr>\n\t\t\t<td width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t<td valign='top' {$mouse} style='font-size:12px;text-decoration:underline' OnClick=\"javascript:Loadjs('squid.UserAutDB.php')\"><b><span style='font-size:12px'>{$Computers}</span></b><span style='font-size:12px'> {clients}</td>\n\t\t\t</tr>";
        }
        if (!$users->CORP_LICENSE) {
            $license_inactive = "<br><strong style='font-size:11px;font-weight:bolder;color:#BA1010'>{license_inactive}</strong>";
        }
        if (!$q->TABLE_EXISTS("tables_day")) {
            $q->CheckTables();
        }
        $DAYSNumbers = $q->COUNT_ROWS("tables_day");
        if ($GLOBALS["VERBOSE"]) {
            echo __LINE__ . " DAYSNumbers = {$DAYSNumbers}<br>\n";
        }
        //$GLOBALS["FULL_DEBUG"]
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(totalsize) as tsize FROM tables_day"));
        $totalsize = FormatBytes($ligne["tsize"] / 1024);
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT AVG(cache_perfs) as pourc FROM tables_day"));
        $pref = round($ligne["pourc"]);
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT COUNT(sitename) as tcount FROM visited_sites WHERE LENGTH(category)=0"));
        $websitesnumsNot = numberFormat($ligne["tcount"], 0, "", " ");
        if ($GLOBALS["VERBOSE"]) {
            echo __LINE__ . " SELECT count(youtubeid),youtubeid FROM `youtube_dayz` GROUP BY youtubeid<br>\n";
        }
        $results = $q->QUERY_SQL("SELECT count(youtubeid),youtubeid FROM `youtube_dayz` GROUP BY youtubeid");
        $youtube_objects = mysql_num_rows($results);
        $youtube_objects = numberFormat($youtube_objects, 0, "", " ");
        $CachePermformance = $q->CachePerfHour();
        if ($GLOBALS["VERBOSE"]) {
            echo __LINE__ . " CachePermformance = {$CachePermformance}<br>\n";
        }
        if ($CachePermformance > -1) {
            $color = "#E01313";
            if ($CachePermformance > 20) {
                $color = "#6DBB6A";
            }
            $cachePerfText = "\n\t\t\t<tr>\n\t\t\t<td width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t<td valign='top' style='font-size:12px;'><b style='color:{$color}'>{$CachePermformance}%</span></b><span style='font-size:12px'> {cache_performance} ({now})</td>\n\t\t\t</tr>\n\t\t\t";
        }
        if ($SquidActHasReverse == 1) {
            $TR_CAT_NUMBER = null;
        }
        $TR_CAT_NUMBER = "\n\t<tr>\n\t\t<td width=1%><img src='img/arrow-right-16.png'></td>\n\t\t<td valign='top' {$mouse} style='font-size:12px;text-decoration:underline' OnClick=\"javascript:Loadjs('squid.categories.php')\"><b><span style='font-size:12px'>{$categories}</span></b><span style='font-size:12px'> {websites_categorized}{$license_inactive}</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 valign='top' {$mouse} style='font-size:12px;text-decoration:underline' OnClick=\"javascript:Loadjs('squid.categories.php')\"><span style='font-size:12px'>{youritems}: <b>{$YourItems}</span></b><span style='font-size:12px'></td>\n\t</tr>";
        $TR_CATZ = "\t\n\t<tr>\n\t\t<td width=1%><img src='img/arrow-right-16.png'></td>\n\t\t<td width=99% valign='top' style='font-size:12px;text-decoration:underline' \n\t\t{$mouse} OnClick=\"javascript:Loadjs('squid.traffic.statistics.days.php?js=yes&with-purge=yes')\"><b><span style='font-size:12px'>{$DAYSNumbers}</span></b><span style='font-size:12px'> {daysOfStatistics}</td>\n\t</tr>\n\t\n\t<tr>\n\t\t<td width=1%><img src='img/arrow-right-16.png'></td>\n\t\t<td valign='top' style='font-size:12px'><b><span style='font-size:12px'>{$requests}</span></b><span style='font-size:12px'> {requests}</td>\n\t</tr>\n\t{$nodes}\n\t\t\n\t{$TR_CAT_NUMBER}\n";
        $TR_YOUTUBE = "\t<tr>\n\t\t<td width=1%><img src='img/arrow-right-16.png'></td>\n\t\t<td valign='top' {$mouse} style='font-size:12px;text-decoration:underline'\n\t\t{$mouse} OnClick=\"javascript:Loadjs('squid.youtube.all.php')\"\n\t\t><b><span style='font-size:12px'>{$youtube_objects}</span></b><span style='font-size:12px'> Youtube {objects}</td>\n\t</tr>";
        if ($DisableArticaProxyStatistics == 1) {
            $TR_YOUTUBE = null;
            $TR_CATZ = null;
        }
        if ($SquidActHasReverse == 1) {
            $TR_YOUTUBE = null;
        }
        $submenu = "\t\n\t\n\t<tr>\n\t\t<td width=1%><img src='img/arrow-right-16.png'></td>\n\t\t<td valign='top' style='font-size:12px'><b><span style='font-size:12px'>{$totalsize}</span></b><span style='font-size:12px'> {downloaded_flow}</td>\n\t</tr>\n\t\n\t<tr>\n\t\t<td width=1%><img src='img/arrow-right-16.png'></td>\n\t\t<td valign='top' style='font-size:12px'><b><span style='font-size:12px'>{$pref}%</span></b><span style='font-size:12px'> {cache_performance}</td>\n\t</tr>\n\t\n\t{$cachePerfText}";
        $main_table = "\n\t\t\n\t\t{$TR_CATZ}\n\t\t{$TR_YOUTUBE}\t\n\t<tr>\n\t\t<td width=1%><img src='img/arrow-right-16.png'></td>\n\t\t<td valign='top' {$mouse} style='font-size:12px;text-decoration:underline' OnClick=\"blur()\"><b><span style='font-size:12px'>{$PhishingURIS}</span></b><span style='font-size:12px'> {phishing_uris}</td>\n\t</tr>\t\n\t\n\t<tr>\n\t\t<td width=1%><img src='img/arrow-right-16.png'></td>\n\t\t<td valign='top' {$mouse} style='font-size:12px;text-decoration:underline' OnClick=\"blur()\"><b><span style='font-size:12px'>{$MalwaresURIS}</span></b><span style='font-size:12px'> {viruses_uris}</td>\n\t</tr>\n\t\n\t<tr>\n\t\t<td width=1%><img src='img/arrow-right-16.png'></td>\n\t\t<td valign='top' {$mouse} style='font-size:12px;text-decoration:underline' OnClick=\"blur()\"><b><span style='font-size:12px'>{$MalwarePatrolDatabasesCount}</span></b><span style='font-size:12px'> Malware Patrol</td>\n\t</tr>\t\n\t\t\t\t\t\n\t<tr>\n\t\t<td width=1%><img src='img/arrow-right-16.png'></td>\n\t\t<td valign='top' {$mouse} style='font-size:12px;text-decoration:underline' OnClick=\"javascript:Loadjs('squid.visited.php?onlyNot=yes')\"><b><span style='font-size:12px'>{$websitesnumsNot}</span></b><span style='font-size:12px'> {not_categorized}</td>\n\t</tr>\t\n\t\t\t\t\n\t<tr>\n\t\t<td width=1%><img src='img/arrow-right-16.png'></td>\n\t\t<td valign='top' {$mouse} style='font-size:12px;text-decoration:underline' OnClick=\"javascript:Loadjs('squid.categories.php')\"><b><span style='font-size:12px'>{$tablescatNUM}</span></b><span style='font-size:12px'> {categories}</td>\n\t</tr>\t\n\t\n\t<tr>\n\t\t<td width=1%><img src='img/arrow-right-16.png'></td>\n\t\t<td valign='top' {$mouse} style='font-size:12px;text-decoration:underline' OnClick=\"javascript:Loadjs('squid.categories.toexport.php')\"><b><span style='font-size:12px'>{$export}</span></b><span style='font-size:12px'> {websites_to_export}</td>\n\t</tr>";
    }
    if ($DisableArticaProxyStatistics == 1) {
        $main_table = "\t\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top' {$mouse} style='font-size:12px;text-decoration:underline' OnClick=\"blur()\"><b><span style='font-size:12px'>{$PhishingURIS}</span></b><span style='font-size:12px'> {phishing_uris}</td>\n\t\t\t</tr>\t\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top' {$mouse} style='font-size:12px;text-decoration:underline' OnClick=\"blur()\"><b><span style='font-size:12px'>{$MalwaresURIS}</span></b><span style='font-size:12px'> {viruses_uris}</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top' {$mouse} style='font-size:12px;text-decoration:underline' OnClick=\"blur()\"><b><span style='font-size:12px'>{$MalwarePatrolDatabasesCount}</span></b><span style='font-size:12px'> Malware Patrol</td>\n\t\t\t</tr>";
    }
    $addwebsites = "\n\t\t<tr>\n\t\t\t<td width=1%><img src='img/plus-16.png'></td>\n\t\t\t<td valign='top' {$mouse} style='font-size:12px;text-decoration:underline' \n\t\t\tOnClick=\"javascript:Loadjs('squid.visited.php?add-www=yes')\"><b><span style='font-size:12px'>{categorize_websites}</span></b><span style='font-size:12px'></td>\n\t\t</tr>\t";
    if ($users->PROXYTINY_APPLIANCE) {
        $addwebsites = null;
        $submenu = null;
    }
    $html = "\n<table style='width:100%'>\n\t<tbody>\n\t{$TR_ACCESSLOG}\n\t{$main_table}\t\n\t{$submenu}\n\t{$addwebsites}\n\t</tbody>\n\t</table>\n{$off}";
    if ($GLOBALS["VERBOSE"]) {
        echo __LINE__ . " tpl->_ENGINE_parse_body<br>\n";
    }
    $html = $tpl->_ENGINE_parse_body($html);
    if (!$GLOBALS["AS_ROOT"]) {
        CACHE_SESSION_SET(__FUNCTION__, __FILE__, $html);
    }
}
Ejemplo n.º 6
0
function status_squid_left()
{
    if (CACHE_SESSION_GET(__FUNCTION__, __FILE__, 30)) {
        return;
    }
    $tpl = new templates();
    $page = CurrentPageName();
    include_once dirname(__FILE__) . "/ressources/class.status.inc";
    $status = new status();
    $squid_status = $status->Squid_status();
    $q = new mysql();
    $ini = new Bs_IniHandler();
    $sock = new sockets();
    $ini->loadString(base64_decode($sock->getFrameWork("cmd.php?squid-ini-status=yes")));
    $master_version = $ini->_params["SQUID"]["master_version"];
    $master_pid = $ini->_params["SQUID"]["master_pid"];
    $users = new usersMenus();
    $squid = new squidbee();
    if ($ini->_params["SQUID"]["running"] == 0) {
        $img = "status_postfix_bg_failed.png";
        $status = "{stopped}";
        $start = "<hr><div style='text-align:right'>" . button("{start}", "Loadjs('StartStopServices.php?APP=APP_SQUID&cmd=squid-cache&action=start')") . "</div>";
    } else {
        if (preg_match("#2\\.3.*#", $master_version)) {
            $img = 'status_postfix_bg_ok23.png';
        }
        if (preg_match("#2\\.5.*#", $master_version)) {
            $img = 'status_postfix_bg_ok25.png';
        }
        if (preg_match("#2\\.7.*#", $master_version)) {
            $img = 'status_postfix_bg_ok27.png';
        }
        if (preg_match("#2\\.6.*#", $master_version)) {
            $img = 'status_postfix_bg_ok26.png';
        }
        if (preg_match("#2\\.8.*#", $master_version)) {
            $img = 'status_postfix_bg_ok28.png';
        }
        if (preg_match("#2\\.9.*#", $master_version)) {
            $img = 'status_postfix_bg_ok29.png';
        }
        if (preg_match("#3\\.0.*#", $master_version)) {
            $img = 'status_postfix_bg_ok30.png';
        }
        if (preg_match("#3\\.1.*#", $master_version)) {
            $img = 'status_postfix_bg_ok31.png';
        }
        if (preg_match("#3\\.2.*#", $master_version)) {
            $img = 'status_postfix_bg_ok32.png';
        }
        if (preg_match("#3\\.3.*#", $master_version)) {
            $img = 'status_postfix_bg_ok33.png';
        }
        $text = "{service_running}<br>{using_version} {$master_version} {pid} {$master_pid}";
    }
    if ($ini->_params["SQUID"]["icap_enabled"] != '1') {
        $icap = "<table style='width:100%;margin:0px;' " . CellRollOver($js_service) . ">\n\t\t<tr>\n\t\t\t<td width=1%><img src='img/danger16.png'></td>\n\t\t\t<td align='left' nowrap><strong style='color:#D01A1A;font-size:11px'>{no_icap_support}</td>\n\t\t\t<td width=1% align='right'>&nbsp;</td>\n\t\t</tr>\n\t</table>";
    }
    $EnableKavICAPRemote = $sock->GET_INFO("EnableKavICAPRemote");
    $KavICAPRemoteAddr = $sock->GET_INFO("KavICAPRemoteAddr");
    $KavICAPRemotePort = $sock->GET_INFO("KavICAPRemotePort");
    if (!is_numeric($EnableKavICAPRemote)) {
        $EnableKavICAPRemote = 0;
    }
    if ($EnableKavICAPRemote == 1) {
        $fp = @fsockopen($KavICAPRemoteAddr, $KavICAPRemotePort, $errno, $errstr, 1);
        if (!$fp) {
            $text_kavicap_error = "<div>{kavicap_unavailable_text}<br><strong>\n\t\t\t\t<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.kavicap.php');\" style='font-size:12px;color:#D70707;text-decoration:underline'>{$KavICAPRemoteAddr}:{$KavICAPRemotePort}</a><br>{$errstr}</div>";
        }
        @fclose($fp);
    }
    $q = new mysql_squid_builder();
    if (!$q->TestingConnection()) {
        $img = "status_postfix_bg_failed.png";
        $title = "{MYSQL_ERROR}";
        $text_error_sql = "<div><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.mysql.php');\" \n\t\tstyle='font-size:12px;color:#D70707;text-decoration:underline'>{$title}:{$q->mysql_error}</a></div>";
    }
    $q = new mysql_squid_builder();
    $requests = $q->EVENTS_SUM();
    $requests = numberFormat($requests, 0, "", " ");
    $tableblock = date('Ymd') . "_blocked";
    $ligneW = $q->COUNT_ROWS($tableblock);
    $blocked_today = numberFormat($ligneW["tcount"], 0, "", " ") . " {blocked_websites} {this_day}";
    $q = new mysql_squid_builder();
    $websitesnums = $q->COUNT_ROWS("dansguardian_sitesinfos", "artica_backup");
    $websitesnums = numberFormat($websitesnums, 0, "", " ");
    $q = new mysql_squid_builder();
    $categories = $q->COUNT_ROWS("dansguardian_community_categories");
    $categories = numberFormat($categories, 0, "", " ");
    $sock = new sockets();
    $sock->SET_INFO("squidStatsCategoriesNum", $categories);
    $sock->SET_INFO("squidStatsWebSitesNum", $websitesnums);
    $sock->SET_INFO("squidStatsBlockedToday", $blocked_today);
    $sock->SET_INFO("squidStatsRequestNumber", $requests);
    $migration_pid = unserialize(base64_decode($sock->getFrameWork("squid.php?migration-stats=yes")));
    if (is_array($migration_pid)) {
        $text_script = "<span style='color:#B80000;font-size:13px'>{migration_script_run_text} PID:{$migration_pid[0]} {since}:{$migration_pid[1]}Mn</span>";
    }
    if ($users->KAV4PROXY_INSTALLED) {
        $img = "info-18.png";
        $text = "{enabled}";
        if ($squid->enable_kavproxy != 1) {
            $text = "{disabled}";
            $img = "status_warning.gif";
        }
        $services_enabled = $services_enabled . "\n\t\t\t<tr " . CellRollOver("Loadjs('squid.popups.php?script=plugins')") . ">\n\t\t\t\t<td width=1%><img src='img/{$img}'></td>\n\t\t\t\t<td class=legend style='font-size:13px;' align='left' width=1% nowrap>{APP_KAV4PROXY}:</td>\n\t\t\t\t<td class=legend style='font-size:14px' align='left' width=100%>{$text}</td>\n\t\t\t</tr>\n\t\t\t";
    }
    if ($users->APP_UFDBGUARD_INSTALLED) {
        $img = "info-18.png";
        $text = "{enabled}";
        $EnableUfdbGuard = $sock->GET_INFO("EnableUfdbGuard");
        if ($EnableUfdbGuard != 1) {
            $text = "{disabled}";
            $img = "status_warning.gif";
        }
        $services_enabled = $services_enabled . "\n\t\t\t<tr " . CellRollOver("Loadjs('squid.popups.php?script=plugins')") . ">\n\t\t\t\t<td width=1%><img src='img/{$img}'></td>\n\t\t\t\t<td class=legend style='font-size:13px;' nowrap width=1% align='left'>{APP_UFDBGUARD}:</td>\n\t\t\t\t<td class=legend style='font-size:14px' width=100% align='left'>{$text}</td>\n\t\t\t</tr>\n\t\t\t";
    }
    $design = "\n\t{$text_error_sql}\n\t{$text_script}\n\t{$text_kavicap_error}\n\t<table style='width:250px;margin-top:10px;' class=form>\n\t<tbody>\n\t\t<tr>\n\t\t\t<td>&nbsp;</td>\n\t\t\t<td class=legend nowrap>{version}:</td>\n\t\t\t<td style='font-size:14px'>{$master_version}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td>&nbsp;</td>\n\t\t\t<td class=legend>PID:</td>\n\t\t\t<td style='font-size:14px'>{$master_pid}</td>\n\t\t</tr>\n\t\t\t{$services_enabled}\n\t\t</tbody>\n\t</table>\t\n\t</table>\n\t<div style='width:100%;text-align:right'>" . imgtootltip("refresh-24.png", "{refresh}", "LoadAjax('squid-status','squid.main.quicklinks.php?status=yes');") . "</div>\n\t\n\t";
    $html = "\n\t{$design}\n\t<center>\n\t\n\t\t<div id='squid-status-stats' class=form style='width:90%'></div>\n\t</center>\n\t\n\t\n\t<script>\n\t\tLoadAjax('squid-status-stats','squid.traffic.statistics.php?squid-status-stats=yes');\t\n\t\tLoadAjax('squid-services','{$page}?squid-services=yes');\n\t</script>\n\t";
    $html = $tpl->_ENGINE_parse_body($html);
    CACHE_SESSION_SET(__FUNCTION__, __FILE__, $html);
}
Ejemplo n.º 7
0
function squid_status_stats()
{
    if (CACHE_SESSION_GET(__FUNCTION__, __FILE__)) {
        return;
    }
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $users = new usersMenus();
    $websitesnums = $q->COUNT_ROWS("visited_sites");
    $websitesnums = numberFormat($websitesnums, 0, "", " ");
    $sql = "DELETE FROM categorize WHERE LENGTH(pattern)=0";
    $q->QUERY_SQL($sql);
    $export = $q->COUNT_ROWS("categorize");
    $export = numberFormat($export, 0, "", " ");
    $categories = $q->COUNT_CATEGORIES();
    $categories = numberFormat($categories, 0, "", " ");
    $tablescat = $q->LIST_TABLES_CATEGORIES();
    $tablescatNUM = numberFormat(count($tablescat), 0, "", " ");
    $q = new mysql_squid_builder();
    $requests = $q->EVENTS_SUM();
    $requests = numberFormat($requests, 0, "", " ");
    $DAYSNumbers = $q->COUNT_ROWS("tables_day");
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(totalsize) as tsize FROM tables_day"));
    $totalsize = FormatBytes($ligne["tsize"] / 1024);
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT AVG(cache_perfs) as pourc FROM tables_day"));
    $pref = round($ligne["pourc"]);
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT COUNT(sitename) as tcount FROM visited_sites WHERE LENGTH(category)=0"));
    $websitesnumsNot = numberFormat($ligne["tcount"], 0, "", " ");
    $mouse = "OnMouseOver=\";this.style.cursor='pointer';\" OnMouseOut=\";this.style.cursor='default';\"";
    $submenu = "\t\n\t<tr>\n\t\t<td valign='top' style='font-size:14px'><b>{$totalsize}</b> {downloaded_flow}</td>\n\t</tr>\n\t<tr>\n\t\t<td valign='top' style='font-size:14px'><b>{$pref}%</b> {cache_performance}</td>\n\t</tr>";
    $html = "\n<table style='width:100%'>\n\t<tbody>\n\t<tr>\n\t\t<td valign='top' style='font-size:14px;text-decoration:underline' {$mouse} OnClick=\"javascript:SquidQuickLinks()\"><b>{$DAYSNumbers}</b> {daysOfStatistics}</td>\n\t</tr>\n\t<tr>\n\t\t<td valign='top' style='font-size:14px'><b>{$requests}</b> {requests}</td>\n\t</tr>\n\t<tr>\n\t\t<td valign='top' {$mouse} style='font-size:14px;text-decoration:underline' OnClick=\"javascript:Loadjs('squid.visited.php')\"><b>{$websitesnums}</b> {visited_websites}</td>\n\t</tr>\t\n\n\t<tr>\n\t\t<td valign='top' {$mouse} style='font-size:14px;text-decoration:underline' OnClick=\"javascript:Loadjs('squid.categories.php')\"><b>{$categories}</b> {websites_categorized}</td>\n\t</tr>\t\n\t<tr>\n\t\t<td valign='top' {$mouse} style='font-size:14px;text-decoration:underline' OnClick=\"javascript:Loadjs('squid.visited.php?onlyNot=yes')\"><b>{$websitesnumsNot}</b> {not_categorized}</td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td valign='top' {$mouse} style='font-size:14px;text-decoration:underline' OnClick=\"javascript:Loadjs('squid.categories.php')\"><b>{$tablescatNUM}</b> {categories}</td>\n\t</tr>\t\n\t<tr>\n\t\t<td valign='top' {$mouse} style='font-size:14px;text-decoration:underline' OnClick=\"javascript:Loadjs('squid.categories.toexport.php')\"><b>{$export}</b> {websites_to_export}</td>\n\t</tr>\t\n\t\n\t{$submenu}\n\t</tbody>\n\t</table>\n";
    CACHE_SESSION_SET(__FUNCTION__, __FILE__, $tpl->_ENGINE_parse_body($html));
}
Ejemplo n.º 8
0
function webstats_stats()
{
    if (isset($_SESSION[__FILE__][__FUNCTION__])) {
        echo $_SESSION[__FILE__][__FUNCTION__];
        return;
    }
    $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"];
    }
    $NotCategorizedTests = $q->COUNT_ROWS("webtests");
    $html = "<b>{$requests}</b> {requests}&nbsp;|&nbsp;<b>{$DAYSNumbers}</b> {daysOfStatistics}{$add0}{$add1}&nbsp;|&nbsp;{not_categorized}:&nbsp;<b>" . numberFormat($NotCategorizedTests, 0, "", " ") . "</b>";
    $html = $tpl->_ENGINE_parse_body($html);
    $_SESSION[__FILE__][__FUNCTION__] = $html;
    echo $html;
}
Ejemplo n.º 9
0
function squid_status_stats()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $websitesnums = $q->COUNT_ROWS("dansguardian_sitesinfos", "artica_backup");
    $websitesnums = numberFormat($websitesnums, 0, "", " ");
    $q = new mysql_squid_builder();
    $requests = $q->EVENTS_SUM();
    $requests = numberFormat($requests, 0, "", " ");
    $DAYSNumbers = $q->COUNT_ROWS("tables_day");
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(totalsize) as tsize FROM tables_day"));
    $totalsize = FormatBytes($ligne["tsize"] / 1024);
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT AVG(cache_perfs) as pourc FROM tables_day"));
    $pref = round($ligne["pourc"]);
    $html = "\n<table style='width:100%'>\n\t<tbody>\n\t<tr>\n\t\t<td valign='top' style='font-size:14px'><b>{$DAYSNumbers}</b> {daysOfStatistics}</td>\n\t</tr>\n\t<tr>\n\t\t<td valign='top' style='font-size:14px'><b>{$requests}</b> {requests}</td>\n\t</tr>\t\t\n\t<tr>\n\t\t<td valign='top' style='font-size:14px'><b>{$totalsize}</b> {downloaded_flow}</td>\n\t</tr>\n\t<tr>\n\t\t<td valign='top' style='font-size:14px'><b>{$pref}%</b> {cache_performance}</td>\n\t</tr>\t\n\t</tbody>\n\t</table>";
    echo $tpl->_ENGINE_parse_body($html);
}