Exemplo n.º 1
0
function export_allcategories()
{
    $q = new mysql_squid_builder();
    $tables = $q->LIST_TABLES_CATEGORIES();
    while (list($table, $none) = each($tables)) {
        export_category($table);
    }
}
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;
}
Exemplo n.º 3
0
function subtitle_categories(){
	if(CACHE_SESSION_GET(__FUNCTION__, __FILE__,15)){return;}
	$tpl=new templates();
	$q=new mysql_squid_builder();
	$categories=$q->COUNT_CATEGORIES();
	$categories=numberFormat($categories,0,""," ");
	$tablescat=$q->LIST_TABLES_CATEGORIES();
	$tablescatNUM=numberFormat(count($tablescat),0,""," ");		
	$html="<div style='font-size:16px'><b>$categories</b> {websites_categorized}&nbsp;|&nbsp;<b>$tablescatNUM</b> {categories}</div>";
	CACHE_SESSION_SET(__FUNCTION__, __FILE__, $tpl->_ENGINE_parse_body($html));
}
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);
    }
}
Exemplo n.º 5
0
function rules_toolbox_left()
{
    if (!isset($_GET["t"])) {
        $_GET["t"] = time();
    }
    $updateutility = null;
    $q = new mysql_squid_builder();
    $page = CurrentPageName();
    $tpl = new templates();
    $users = new usersMenus();
    $mouse = "OnMouseOver=\";this.style.cursor='pointer';\" OnMouseOut=\";this.style.cursor='default';\"";
    $t = $_GET["t"];
    if (!is_numeric($t)) {
        $t = time();
    }
    $Computers = $q->COUNT_ROWS("webfilters_nodes");
    if (!$q->TABLE_EXISTS("webfilter_certs")) {
        $q->CheckTables();
    }
    if ($q->COUNT_ROWS("webfilter_certs") == 0) {
        $q->fill_webfilter_certs();
    }
    $Computers = numberFormat($Computers, 0, "", " ");
    $sock = new sockets();
    $EnableUfdbGuard = intval($sock->EnableUfdbGuard());
    $tablescat = $q->LIST_TABLES_CATEGORIES();
    $CountDeCategories = numberFormat(count($tablescat), 0, "", " ");
    $categoryuris_malware = numberFormat($q->COUNT_ROWS("categoryuris_malware"), 0, "", " ");
    $disable_service = $tpl->_ENGINE_parse_body("{disable_service}");
    $datasUFDB = unserialize(base64_decode($sock->GET_INFO("ufdbguardConfig")));
    if (!is_numeric($datasUFDB["DebugAll"])) {
        $datasUFDB["DebugAll"] = 0;
    }
    $update_parameters = $tpl->_ENGINE_parse_body("{update_parameters}");
    $EnableWebProxyStatsAppliance = $sock->GET_INFO("EnableWebProxyStatsAppliance");
    $SquidDatabasesUtlseEnable = $sock->GET_INFO("SquidDatabasesUtlseEnable");
    $UseRemoteUfdbguardService = $sock->GET_INFO("UseRemoteUfdbguardService");
    $UFDB = unserialize(base64_decode($sock->GET_INFO("ufdbguardConfig")));
    $EnableKerbAuth = $sock->GET_INFO("EnableKerbAuth");
    $SquidPerformance = intval($sock->GET_INFO("SquidPerformance"));
    if (!is_numeric($UseRemoteUfdbguardService)) {
        $UseRemoteUfdbguardService = 0;
    }
    if (!is_numeric($EnableWebProxyStatsAppliance)) {
        $EnableWebProxyStatsAppliance = 0;
    }
    if (!is_numeric($UseRemoteUfdbguardService)) {
        $UseRemoteUfdbguardService = 0;
    }
    if (!is_numeric($EnableKerbAuth)) {
        $EnableKerbAuth = 0;
    }
    if (!is_numeric($SquidDatabasesUtlseEnable)) {
        $SquidDatabasesUtlseEnable = 1;
    }
    $SquidDatabasesArticaEnable = $sock->GET_INFO("SquidDatabasesArticaEnable");
    if (!is_numeric($SquidDatabasesArticaEnable)) {
        $SquidDatabasesArticaEnable = 1;
    }
    if ($EnableWebProxyStatsAppliance == 1) {
        $EnableUfdbGuard = 1;
    }
    if ($UseRemoteUfdbguardService == 0) {
        if ($UFDB["UseRemoteUfdbguardService"] == 1) {
            $sock->SET_INFO("UseRemoteUfdbguardService", 1);
            $UseRemoteUfdbguardService = 1;
        }
    }
    if ($users->WEBSTATS_APPLIANCE) {
        $EnableWebProxyStatsAppliance = 1;
    }
    if (!$users->APP_UFDBGUARD_INSTALLED) {
        $EnableUfdbGuard = 0;
    }
    if ($users->UPDATE_UTILITYV2_INSTALLED) {
        $updateutility = "\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/kaspersky-update-32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('ufdbguard.UpdateUtility.php')\" nowrap>UpdateUtility</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>";
    }
    $ufdbgverb_icon = "ok24-grey.png";
    $ufdbgverb_txt = "OFF";
    if ($datasUFDB["DebugAll"] == 1) {
        $ufdbgverb_icon = "ok32.png";
        $ufdbgverb_txt = "ON";
    }
    if ($SquidDatabasesUtlseEnable == 1) {
        $SquidDatabasesUtlseEnable_P = "<tr>\n\t\t<td valign='middle' width=1%><img src='img/ok32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='middle' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('squid.toulouse-university.disable.php')\" nowrap>\n\t\t\t\t<b><span style='font-size:13px;text-decoration:underline'>{toulouse_university} {enabled}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t\t</tr>\t\t\n\t\t";
    } else {
        $SquidDatabasesUtlseEnable_P = "<tr>\n\t\t<td valign='middle' width=1%><img src='img/ok32-grey.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t<td valign='middle' {$mouse} style='font-size:13px;text-decoration:underline'\n\t\tOnClick=\"javascript:Loadjs('squid.toulouse-university.disable.php')\" nowrap>\n\t\t<b><span style='font-size:13px;text-decoration:underline'>{toulouse_university} {disabled}</td>\n\t\t</tr>\n\t\t</table>\n\t\t</td>\n\t\t</tr>\n\t\t";
    }
    if ($SquidDatabasesArticaEnable == 1) {
        $SquidDatabasesArticaEnable_P = "<tr>\n\t\t<td valign='middle' width=1%><img src='img/ok32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t<td valign='middle' {$mouse} style='font-size:13px;text-decoration:underline'\n\t\tOnClick=\"javascript:Loadjs('squid.artica-databases.disable.php')\" nowrap>\n\t\t<b><span style='font-size:13px;text-decoration:underline'>{artica_databases} {enabled}</td>\n\t\t</tr>\n\t\t</table>\n\t\t</td>\n\t\t</tr>\n\t\t";
    } else {
        $SquidDatabasesArticaEnable_P = "<tr>\n\t\t<td valign='middle' width=1%><img src='img/ok32-grey.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t<td valign='middle' {$mouse} style='font-size:13px;text-decoration:underline'\n\t\tOnClick=\"javascript:Loadjs('squid.artica-databases.disable.php')\" nowrap>\n\t\t<b><span style='font-size:13px;text-decoration:underline'>{artica_databases} {disabled}</td>\n\t\t</tr>\n\t\t</table>\n\t\t</td>\n\t\t</tr>\n\t\t";
    }
    if (!$users->CORP_LICENSE) {
        $SquidDatabasesArticaEnable_P = "<tr>\n\t\t<td valign='middle' width=1%><img src='img/ok32-grey.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t<td valign='middle' {$mouse} style='font-size:13px;text-decoration:underline'\n\t\tOnClick=\"javascript:blur()\" nowrap>\n\t\t<b><span style='font-size:13px;text-decoration:underline'>{artica_databases} {no_license}</td>\n\t\t</tr>\n\t\t</table>\n\t\t</td>\n\t\t</tr>\n\t\t";
    }
    if ($EnableUfdbGuard == 1) {
        $DisableUfdbGuard = "\n\t\t\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/ok32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='middle' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('squid.disableUfdb.php')\" nowrap><b><span style='font-size:13px;text-decoration:underline'>{$disable_service}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t\t</tr>\n\t\t{$SquidDatabasesArticaEnable_P}\n\t\t{$SquidDatabasesUtlseEnable_P}\t\n\t\t";
    }
    if ($UseRemoteUfdbguardService == 1) {
        $DisableUfdbGuard = null;
    }
    $html = "\n\t<table style='width:98%' class=form>\n\t{$DisableUfdbGuard}\n\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/computer-32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='middle' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('squid.nodes.php',true)\" nowrap><b><span style='font-size:13px;text-decoration:underline'>{$Computers}</span></b><span style='font-size:13px'> {computers}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/check-32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='middle' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('squid.categories.urls.php?popup-js=yes&category=malware&tablesize=695');\" nowrap><b><span style='font-size:13px;text-decoration:underline'>{$categoryuris_malware} Malware Uris</span></td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\t\n\t\n\t\n\t\n\t\n\t";
    $html = $html . "\n\t\t\t\n\t\n\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/check-32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('ufdbguard.tests.php')\" nowrap>\n\t\t\t\t<span style='font-size:13px;text-decoration:underline'>{verify_rules}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\t\t\n\t\n\t\n\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/loupe-32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('squid.category.tests.php')\" nowrap><span style='font-size:13px;text-decoration:underline'>{test_categories}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\t\t\t\n\t\n\t\n\t\n";
    if ($UseRemoteUfdbguardService == 0) {
        $html = $html . "<tr>\n\t\t<td valign='middle' width=1%><img src='img/service-restart-32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('ufdbguard.php?force-reload-js=yes')\" nowrap><span style='font-size:13px;text-decoration:underline'>{reload_service}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/events-32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('ufdbguard.sevents.php?js=yes')\" nowrap><span style='font-size:13px;text-decoration:underline'>{service_events}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\t\t\t\n\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/{$ufdbgverb_icon}'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top' {$mouse} style='font-size:13px;text-decoration:underline;text-transform:capitalize' \n\t\t\t\tOnClick=\"javascript:Loadjs('ufdbguard.debug.php')\" nowrap><span style='font-size:13px;text-decoration:underline'>{debug} [{$ufdbgverb_txt}]</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\n\n\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/32-stop.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('squidguardweb.php')\" nowrap><span style='font-size:13px;text-decoration:underline'>{banned_page_webservice}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\n\t";
    }
    $html = $html . "";
    if ($UseRemoteUfdbguardService == 0) {
        $html = $html . "\n\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/script-32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('ufdbguard.conf.php');\" nowrap>\n\t\t\t\t\t<span style='font-size:13px;text-decoration:underline'>{config_status}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\t\n\t{$updateutility}\t\n";
    }
    $html = $html . "\n\n\t</table> \n\t\n\t\n\t";
    $shield = null;
    if ($EnableUfdbGuard == 1) {
        if ($UseRemoteUfdbguardService == 0) {
            if (!$users->CORP_LICENSE) {
                $shield = "shield-warn-64.png";
                $warn["{warn_ufdbguard_no_license}"] = null;
            }
            $ini = new Bs_IniHandler();
            $sock = new sockets();
            $sock->getFrameWork('squid2.php?ufdb-ini-status-write=yes');
            $ini->loadFile("/usr/share/artica-postfix/ressources/interface-cache/UFDB_STATUS");
            $restartlocalservice = "Loadjs('system.services.cmd.php?APPNAME=APP_UFDBGUARD&action=restart&cmd=%2Fetc%2Finit.d%2Fufdb&id=ed8cebc50034e96ed26a4d3cb953403f&appcode=APP_UFDBGUARD');";
            $redirector_file = "/usr/share/artica-postfix/ressources/logs/web/squid_redirectors_status.db";
            $redirectors_array = unserialize(@file_get_contents($redirector_file));
            if (count($redirectors_array) > 1) {
                $redirectors_count = count($redirectors_array);
                if (strlen($redirectors_count) == 1) {
                    $redirectors_count = "0{$redirectors_count}";
                }
                $OBS["{redirectors}:{$redirectors_count}"] = "Loadjs('squid.redirectors.php');";
            }
            if ($ini->_params["APP_UFDBGUARD"]["running"] == 0) {
                $shield = "shield-red-64.png";
                $err["{warn_ufdbguard_stopped}"] = $restartlocalservice;
            } else {
                if ($shield == null) {
                    $shield = "shield-ok-64.png";
                }
                $OBS["{running_since}:&nbsp;{$ini->_params["APP_UFDBGUARD"]["uptime"]}"] = null;
                $OBS["{memory}:&nbsp;" . FormatBytes($ini->_params["APP_UFDBGUARD"]["master_memory"])] = null;
            }
        }
        if ($UseRemoteUfdbguardService == 1) {
            $server = $UFDB["remote_server"];
            $port = $UFDB["remote_port"] = 3977;
            if (!@fsockopen($server, $port, $errno, $errstr, 1)) {
                $shield = "shield-red-64.png";
                $err["{server}:&laquo;{$server}&raquo;:{$port}<br>{error} {$errno} {$errstr}"] = "Loadjs('ufdbguard.php?client-js=yes');";
            } else {
                $OBS["{warn_ufdbguard_remote_use}"] = "Loadjs('ufdbguard.php?client-js=yes')";
            }
        }
        if ($EnableWebProxyStatsAppliance == 0) {
            if (trim($sock->getFrameWork("squid.php?isufdbguard-squidconf=yes")) != "OK") {
                $shield = "shield-warn-64.png";
                $warn["{warn_ufdbguard_not_squidconf}"] = "Loadjs('squid.compile.progress.php')";
            }
        }
        $OBS["{refresh}"] = "LoadAjaxTiny('rules-toolbox-left','{$page}?rules-toolbox-left=yes&RemoveCache=yes');";
        $html2[] = "\n\t  <table style='width:100%'>\n\t  <tr>\n\t  \t<td valign='top' style='width:64px'><img src='img/{$shield}'></td>\n\t  \t<td>\t\t\n\t  \t\t<table style='width:100%'>\n\t  ";
        while (list($num, $js) = each($warn)) {
            if ($js == null) {
                $js = "blur();";
            }
            $html2[] = "\n\t  \t\t<tr>\n\t  \t\t<td width=16px style='vertical-align:top'><img src='img/arrow-right-yellow-16.png'></td>\n\t\t\t<td>\n\t  \t\t<a href=\"javascript:blur();\" \n\t  \t\tOnClick=\"javascript:{$js}\" \n\t  \t\tstyle='color:#black !important;font-weight:normal !important;font-size:12px;text-decoration:underline'>{$num}</a>\n\t  \t\t<hr style='border:1px'>\n\t  \t\t</td>\n\t  \t\t</tr>\n\t  \t\t";
        }
        while (list($num, $js) = each($err)) {
            if ($js == null) {
                $js = "blur();";
            }
            $html2[] = "\n\t  \t<tr>\n\t  \t<td width=16px style='vertical-align:top'><img src='img/arrow-right-red-16.png'></td>\n\t  \t<td >\n\t  \t\t<a href=\"javascript:blur();\" \n\t  \t\tOnClick=\"javascript:{$js}\" \n\t  \t\tstyle='color:#d32d2d !important;text-decoration:underline;font-weight:bold !important;font-size:12px'>{$num}</a>\n\t  \t\t<hr style='border:1px'>\n\t  \t</td>\n\t  \t</tr>\n\t  \t";
        }
        while (list($num, $js) = each($OBS)) {
            if ($js == null) {
                $js = "blur();";
            }
            $html2[] = "\n\t  \t<tr>\n\t  \t<td width=16px style='vertical-align:top'><img src='img/arrow-right-16.png'></td>\n\t  \t<td >\n\t  \t\t<a href=\"javascript:blur();\" \n\t  \t\tOnClick=\"javascript:{$js}\" \n\t  \t\tstyle='color:#46a346 !important;font-weight:bold !important;font-size:12px;text-decoration:underline'>{$num}</a>\n\t  \t\t\n\t  \t</td>\n\t  \t\n\t  \t</td>\n\t  \t</tr>\n\t  \t";
        }
        $html2[] = "</table>\n\t  </td>\n\t  </tr>\n\t  </table>\n\t  <p>&nbsp;</p>\n\t  ";
        echo $tpl->_ENGINE_parse_body(@implode("\n", $html2));
    }
    $t = time();
    $users = new usersMenus();
    $PERF = true;
    $serverMem = round($users->MEM_TOTAL_INSTALLEE / 1024);
    $CPU = $users->CPU_NUMBER;
    if ($serverMem < 2000) {
        $PERF = FALSE;
    }
    if ($CPU < 2) {
        $PERF = FALSE;
    }
    if (!$PERF) {
        $echo1 = $echo1 . $tpl->_ENGINE_parse_body("\n\t\t<div id='{$t}' style='width:90%;margin-bottom:20px' class=form>\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t<td valign='top' width=99%>\n\t\t<div style='font-size:14px;color:#CC0A0A'>\n\t\t<img src='img/warning-panneau-42.png' style='float:left;margin:3px'>\n\t\t<span style='font-size:11px'>{warn_no_performance_minimal}</span>\n\t\t</div>\n\t\t</td>\n\t\t</tr>\n\t\t</table>\n\t\t</div>");
    }
    $t = time() + 1;
    echo $tpl->_ENGINE_parse_body($echo1 . $html);
}
Exemplo n.º 6
0
function dansguardian_status()
{
    $users = new usersMenus();
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $categories = $q->LIST_TABLES_CATEGORIES();
    $sock = new sockets();
    $ufdb = null;
    $dansgu = null;
    $t = 0;
    if ($users->APP_UFDBGUARD_INSTALLED) {
        $t++;
        $APP_UFDBGUARD_INSTALLED = "{installed}";
        $EnableUfdbGuard = $sock->GET_INFO("EnableUfdbGuard");
        if ($EnableUfdbGuard == 1) {
            $EnableUfdbGuard = "{enabled}";
        } else {
            $EnableUfdbGuard = "{disabled}";
        }
        $ufdb = "<tr>\n\t\t\t<td class=legend>{APP_UFDBGUARD}:</td>\n\t\t\t<td><div style='font-size:14px'>" . texthref($EnableUfdbGuard, "Loadjs('squid.popups.php?script=plugins')") . "</td>\n\t\t\t</tr>";
    }
    if ($users->DANSGUARDIAN_INSTALLED) {
        $t++;
        $DANSGUARDIAN_INSTALLED = "{installed}";
        $DansGuardianEnabled = $sock->GET_INFO("DansGuardianEnabled");
        if ($DansGuardianEnabled == 1) {
            $DansGuardianEnabled = "{enabled}";
        } else {
            $DansGuardianEnabled = "{disabled}";
        }
        $dansgu = "<tr>\n\t\t\t<td class=legend>{APP_DANSGUARDIAN}:</td>\n\t\t\t<td><div style='font-size:14px'>" . texthref($DansGuardianEnabled, "Loadjs('squid.popups.php?script=plugins')") . "</td>\n\t\t\t</tr>";
    }
    if ($users->KAV4PROXY_INSTALLED) {
        $t++;
        $kavicapserverEnabled = $sock->GET_INFO("kavicapserverEnabled");
        if ($kavicapserverEnabled == 1) {
            $kavicapserverEnabled = "{enabled}";
        } else {
            $kavicapserverEnabled = "{disabled}";
        }
        $kav = "<tr>\n\t\t\t<td class=legend>{APP_KAV4PROXY}:</td>\n\t\t\t<td><div style='font-size:14px'>" . texthref($kavicapserverEnabled, "Loadjs('squid.popups.php?script=plugins')") . "</td>\n\t\t\t</tr>";
    } else {
        $kavicapserverEnabled = "{not_installed}";
        $kav = "<tr>\n\t\t\t<td class=legend>{APP_KAV4PROXY}:</td>\n\t\t\t<td><div style='font-size:14px'>{$kavicapserverEnabled}</td>\n\t\t\t</tr>";
    }
    if ($t > 0) {
        $table = "<table style='width:100%' class=form><tbody>{$ufdb}{$dansgu}{$kav}</tbody></table>";
    }
    $html = "\n\t{$table}\n\t<script>\n\t\tfunction RefreshDansguardianMainService(){\n\t\t\tLoadAjax('dansguardian-service-status','{$page}?dansguardian-service-status=yes');\n\t\t}\n\t\tRefreshDansguardianMainService();\n\t</script>\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
function PurgeCategoriesDatabase()
{
    $q = new mysql_squid_builder();
    $categories = $q->LIST_TABLES_CATEGORIES();
    $sql = "SELECT category FROM personal_categories";
    $results = $q->QUERY_SQL($sql);
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        $tablename = "category_{$ligne["category"]}";
        $Perso[$tablename] = true;
    }
    while (list($table, $ligne) = each($categories)) {
        if ($Perso[$table]) {
            continue;
        }
        $q->QUERY_SQL("TRUNCATE TABLE {$table}");
        if (!$q->ok) {
            echo $q->mysql_error;
        }
    }
    $q = new mysql();
    $q->QUERY_SQL("TRUNCATE TABLE updates_categories", "artica_backup");
    $sock = new sockets();
    $sock->getFrameWork("squid.php?purge-categories=yes");
}
Exemplo n.º 8
0
function Export($asPid = false)
{
    $unix = new unix();
    $restartProcess = false;
    $nohup = $unix->find_program("nohup");
    $php5 = $unix->LOCATE_PHP5_BIN();
    $restart_cmd = trim("{$nohup} {$php5} " . __FILE__ . " --export >/dev/null 2>&1 &");
    if ($asPid) {
        $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
        $cachetime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
        $unix = new unix();
        $pid = @file_get_contents($pidfile);
        if ($unix->process_exists($pid)) {
            WriteMyLogs("Already executed PID:{$pid}, die()", __FUNCTION__, __FILE__, __LINE__);
            die;
        }
        @file_put_contents($pidfile, getmypid());
    }
    export_deleted_categories();
    $q = new mysql_squid_builder();
    $tables = $q->LIST_TABLES_CATEGORIES();
    while (list($table, $www) = each($tables)) {
        $sql = "SELECT COUNT(zmd5) as tcount FROM {$table} WHERE sended=0 and enabled=1";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
        $prefix = "INSERT IGNORE INTO categorize (zmd5 ,pattern,zDate,uuid,category) VALUES";
        if ($ligne["tcount"] > 0) {
            echo "{$table} {$ligne["tcount"]} items to export\n";
            $results = $q->QUERY_SQL("SELECT * FROM {$table} WHERE sended=0 and enabled=1");
            while ($ligne2 = mysql_fetch_array($results, MYSQL_ASSOC)) {
                $f[] = "('{$ligne2["zmd5"]}','{$ligne2["pattern"]}','{$ligne2["zDate"]}','{$uuid}','{$ligne2["category"]}')";
                $c++;
                if (count($f) > 1000) {
                    $q->QUERY_SQL($prefix . @implode(",", $f));
                    if (!$q->ok) {
                        echo $q->mysql_error . "\n";
                        return;
                    }
                    $f = array();
                }
            }
            $q->QUERY_SQL("UPDATE {$table} SET sended=1 WHERE sended=0");
        }
    }
    if (count($f) > 0) {
        $q->QUERY_SQL($prefix . @implode(",", $f));
        $f = array();
    }
    $ALLCOUNT = $q->COUNT_ROWS("categorize");
    if ($ALLCOUNT > 4000) {
        $restartProcess = true;
    }
    $sql = "SELECT * FROM categorize ORDER BY zDate DESC LIMIT 0,4000";
    $results = $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        echo $q->mysql_error . "\n{$sql}\n";
        return;
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        if ($ligne["category"] == null) {
            continue;
        }
        if ($ligne["pattern"] == null) {
            continue;
        }
        if ($ligne["zmd5"] == null) {
            continue;
        }
        $logsExp[] = "{$ligne["pattern"]}:{$ligne["category"]}";
        $array[$ligne["zmd5"]] = array("category" => $ligne["category"], "pattern" => $ligne["pattern"], "uuid" => $ligne["uuid"]);
    }
    if (!is_array($array)) {
        WriteMyLogs("Nothing to export", __FUNCTION__, __FILE__, __LINE__);
        return;
    }
    if (count($array) == 0) {
        WriteMyLogs("Nothing to export", __FUNCTION__, __FILE__, __LINE__);
        return;
    }
    WriteMyLogs("Exporting " . count($array) . " websites", __FUNCTION__, __FILE__, __LINE__);
    $f = base64_encode(serialize($array));
    $curl = new ccurl("http://www.artica.fr/shalla-orders.php");
    $curl->parms["COMMUNITY_POST"] = $f;
    if (!$curl->get()) {
        writelogs("Failed exporting " . count($array) . " categorized websites to Artica cloud repository servers", __FUNCTION__, __FILE__, __LINE__);
        $unix->send_email_events("Failed exporting " . count($array) . " categorized websites to Artica cloud repository servers", null, "proxy");
        writelogs_squid("Failed exporting " . count($array) . " categorized websites to Artica cloud repository servers \"{$curl->error}\"", __FUNCTION__, __FILE__, __LINE__, "export");
        return null;
    }
    if (preg_match("#<ANSWER>OK</ANSWER>#is", $curl->data)) {
        WriteMyLogs("Exporting success " . count($array) . " websites", __FUNCTION__, __FILE__, __LINE__);
        if (count($logsExp) < 10) {
            $textadd = @implode(",", $logsExp);
        }
        writelogs_squid("Success exporting " . count($array) . " categorized websites to Artica cloud repository servers", __FUNCTION__, __FILE__, __LINE__, "export");
        writelogs("Deleting websites...", __FUNCTION__, __FILE__, __LINE__);
        while (list($md5, $datas) = each($array)) {
            $sql = "DELETE FROM categorize WHERE zmd5='{$md5}'";
            $q->QUERY_SQL($sql, "artica_backup");
        }
        if ($restartProcess) {
            writelogs("{$restart_cmd}", __FUNCTION__, __FILE__, __LINE__);
            shell_exec($restart_cmd);
        } else {
            $q->QUERY_SQL("OPTIMIZE TABLE categorize", "artica_backup");
        }
    } else {
        writelogs_squid("Failed exporting " . count($array) . " categorized websites to Artica cloud repository servers \"{$curl->data}\"", __FUNCTION__, __FILE__, __LINE__, "export");
    }
}
Exemplo n.º 9
0
function export_last_websites()
{
    $q = new mysql_squid_builder();
    $categories = $q->LIST_TABLES_CATEGORIES();
    $prefix = "INSERT IGNORE INTO categorize (zmd5,pattern,zdate,uuid,category) VALUES ";
    while (list($num, $table) = each($categories)) {
        $sql = "SELECT * FROM {$table} WHERE enabled=1 ORDER BY zDate DESC LIMIT 0,1000";
        $results = $GLOBALS["Q"]->QUERY_SQL($sql);
        while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
            if (trim($ligne["pattern"]) == null) {
                $q->QUERY_SQL("DELETE FROM {$table} WHERE zmd5='{$ligne["zmd5"]}'");
                writelogs_squid("{$ligne["zmd5"]} has no website.\nIt has been deleted from table {$table}", __FUNCTION__, __FILE__, __LINE__);
                continue;
            }
            $f[] = "('{$ligne["zmd5"]}','{$ligne["pattern"]}','{$ligne["zDate"]}','{$ligne["uuid"]}','{$ligne["category"]}')";
        }
        if (count($f) > 0) {
            $q->QUERY_SQL($prefix . @implode(",", $f));
            $f = array();
        }
    }
}
Exemplo n.º 10
0
function do_export()
{
    if ($_GET["single-id"] > 0) {
        do_export_single_id();
        return;
    }
    $q = new mysql_squid_builder();
    $q->BD_CONNECT();
    $t = $_GET["t"];
    $LIST_TABLES_CATEGORIES = $q->LIST_TABLES_CATEGORIES();
    while (list($num, $ligne) = each($LIST_TABLES_CATEGORIES)) {
        $squidlogs[$num] = true;
    }
    $squidlogs["webfilter_rules"] = true;
    $squidlogs["webfilter_assoc_groups"] = true;
    $squidlogs["webfilter_blks"] = true;
    $squidlogs["webfilter_group"] = true;
    $squidlogs["webfilter_bannedexts"] = true;
    $squidlogs["webfilters_dtimes_blks"] = true;
    $squidlogs["webfilter_bannedextsdoms"] = true;
    $squidlogs["webfilter_termsg"] = true;
    $squidlogs["webfilter_blklnk"] = true;
    $squidlogs["webfilter_blkgp"] = true;
    $squidlogs["webfilter_blkcnt"] = true;
    $artica_backup["personal_categories"] = true;
    $dir = dirname(__FILE__) . "/ressources/logs/web/webfiltering.sql";
    $final = dirname(__FILE__) . "/ressources/logs/web/webfiltering.export";
    $compressed = dirname(__FILE__) . "/ressources/logs/web/webfiltering.gz";
    @unlink($dir);
    @unlink($final);
    @unlink($compressed);
    $databases["squidlogs"] = $squidlogs;
    $databases["artica_backup"] = $artica_backup;
    if (is_file($dir)) {
        @unlink($dir);
    }
    $dump = new phpMyDumper("squidlogs", $q->mysql_connection, "{$dir}", false, $squidlogs);
    $dump->doDump();
    if (!is_file($dir)) {
        $tpl = new templates();
        echo $tpl->_ENGINE_parse_body("<div style='font-size:18px;color:#d32d2d;margin-top:15px;margin-bottom:15px'>{failed}</div>");
        return;
    }
    $sock = new sockets();
    $DansGuardianDefaultMainRule = $sock->GET_INFO("DansGuardianDefaultMainRule");
    $array["SQL"] = @file_get_contents($dir);
    $array["DansGuardianDefaultMainRule"] = $DansGuardianDefaultMainRule;
    @file_put_contents($final, base64_encode(serialize($array)));
    compress($final, $compressed);
    $size = @filesize($compressed);
    @unlink($dir);
    @unlink($final);
    echo "\n\t\t<div style='margin-top:15px;margin-bottom:15px;text-align:center'>\t\n\t\t\t<a href=\"ressources/logs/web/webfiltering.gz\" \n\t\t\tstyle='text-decoration:underline;font-size:18px;font-weight:bold'>webfiltering.gz " . FormatBytes($size / 1024) . "</a>\n\t\t</div>\n\t\t\t<script>\n\t\t\tif(document.getElementById('text-{$t}')){\n\t\t\t\tdocument.getElementById('text-{$t}').innerHTML='';\n\t\t\t\n\t\t\t}\n\t\t\t\t\n\t\t\t</script>\n\t\t\t\n\t";
}
Exemplo n.º 11
0
function dansguardian_status($asroot = false)
{
    $page = CurrentPageName();
    $users = new usersMenus();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $categories = $q->LIST_TABLES_CATEGORIES();
    $sock = new sockets();
    $squid = new squidbee();
    $SquidGuardIPWeb = trim($sock->GET_INFO("SquidGuardIPWeb"));
    $SquidGuardServerName = $sock->GET_INFO("SquidGuardServerName");
    $SquidDisableAllFilters = $sock->GET_INFO("SquidDisableAllFilters");
    $SquideCapAVEnabled = $sock->GET_INFO("SquideCapAVEnabled");
    $kavicapserverEnabled = $sock->GET_INFO("kavicapserverEnabled");
    $EnableSquidRemoteMySQL = $sock->GET_INFO("EnableSquidRemoteMySQL");
    if (!is_numeric($EnableSquidRemoteMySQL)) {
        $EnableSquidRemoteMySQL = 0;
    }
    $EnableSplashScreen = $sock->GET_INFO("EnableArticaHotSpot");
    $PdnsHotSpot = $sock->GET_INFO("EnableSplashScreen");
    $EnableMalwarePatrol = $sock->GET_INFO("EnableMalwarePatrol");
    $AsSquidLoadBalancer = $sock->GET_INFO("AsSquidLoadBalancer");
    $SquidActHasReverse = $sock->GET_INFO("SquidActHasReverse");
    if ($squid->isNGnx()) {
        $SquidActHasReverse = 0;
    }
    $UfdbEnabledCentral = $sock->GET_INFO('UfdbEnabledCentral');
    $AntivirusEnabledCentral = $sock->GET_INFO('AntivirusEnabledCentral');
    $EnableKerbAuthCentral = $sock->GET_INFO('EnableKerbAuthCentral');
    $EnableUfdbGuard = intval($sock->EnableUfdbGuard());
    $DnsFilterCentral = $sock->GET_INFO('DnsFilterCentral');
    $SquidBubbleMode = $sock->GET_INFO('SquidBubbleMode');
    $EnableCNTLM = $sock->GET_INFO("EnableCNTLM");
    $EnableRDPProxy = $sock->GET_INFO("EnableRDPProxy");
    $EnableLocalDNSMASQ = $sock->GET_INFO("EnableLocalDNSMASQ");
    $WizardStatsApplianceDisconnected = intval($sock->GET_INFO("WizardStatsApplianceDisconnected"));
    $SquidNoAccessLogs = intval($sock->GET_INFO("SquidNoAccessLogs"));
    $EnableFTPProxy = $sock->GET_INFO('EnableFTPProxy');
    $MonitConfig = unserialize(base64_decode($sock->GET_INFO("SquidWatchdogMonitConfig")));
    $Watchdog = $MonitConfig["watchdog"];
    $UnlockWebStats = $sock->GET_INFO("UnlockWebStats");
    if (!is_numeric($UnlockWebStats)) {
        $UnlockWebStats = 0;
    }
    if ($UnlockWebStats == 1) {
        $EnableRemoteStatisticsAppliance = 0;
    }
    $EnableHaarp = $sock->GET_INFO("EnableHaarp");
    if (!is_numeric($EnableHaarp)) {
        $EnableHaarp = 0;
    }
    // APP_HAARP $EnableHaarp
    if (!is_numeric($EnableRDPProxy)) {
        $EnableRDPProxy = 0;
    }
    if (!is_numeric($EnableFTPProxy)) {
        $EnableFTPProxy = 0;
    }
    $PDSNInUfdb = $sock->GET_INFO("PDSNInUfdb");
    $EnableKerbAuth = $sock->GET_INFO("EnableKerbAuth");
    if (!is_numeric($EnableKerbAuth)) {
        $EnableKerbAuth = 0;
    }
    if (!is_numeric($EnableUfdbGuard)) {
        $EnableUfdbGuard = 0;
    }
    if (!is_numeric($SquideCapAVEnabled)) {
        $SquideCapAVEnabled = 0;
    }
    if (!is_numeric($EnableMalwarePatrol)) {
        $EnableMalwarePatrol = 0;
    }
    if (!is_numeric($SquidDisableAllFilters)) {
        $SquidDisableAllFilters = 0;
    }
    if (!is_numeric($EnableSplashScreen)) {
        $EnableSplashScreen = 0;
    }
    if (!is_numeric($PdnsHotSpot)) {
        $PdnsHotSpot = 0;
    }
    if (!is_numeric($AsSquidLoadBalancer)) {
        $AsSquidLoadBalancer = 0;
    }
    if (!is_numeric($SquidActHasReverse)) {
        $SquidActHasReverse = 0;
    }
    if (!is_numeric($kavicapserverEnabled)) {
        $kavicapserverEnabled = 0;
    }
    if (!is_numeric($SquidBubbleMode)) {
        $SquidBubbleMode = 0;
    }
    if (!is_numeric($EnableCNTLM)) {
        $EnableCNTLM = 0;
    }
    if (!is_numeric($Watchdog)) {
        $Watchdog = 1;
    }
    $t = 1;
    if (!is_numeric($DnsFilterCentral)) {
        $DnsFilterCentral = 0;
    }
    if (!is_numeric($EnableLocalDNSMASQ)) {
        $EnableLocalDNSMASQ = 0;
    }
    if ($users->APP_CHILLI_INSTALLED) {
        $EnableChilli = $sock->GET_INFO("EnableChilli");
        if (!is_numeric($EnableChilli)) {
            $EnableChilli = 0;
        }
        $EnableSplashScreen = $EnableChilli;
    }
    if (!is_numeric($PDSNInUfdb)) {
        $PDSNInUfdb = 0;
    }
    if ($PdnsHotSpot == 1) {
        $EnableSplashScreen = 1;
    }
    if ($EnableRemoteStatisticsAppliance == 1) {
        if (is_numeric($EnableKerbAuthCentral)) {
            $EnableKerbAuth = $EnableKerbAuthCentral;
        }
        if (is_numeric($DnsFilterCentral)) {
            $PDSNInUfdb = $DnsFilterCentral;
        }
        if (is_numeric($UfdbEnabledCentral)) {
            $EnableUfdbGuard = $UfdbEnabledCentral;
        }
        if (is_numeric($AntivirusEnabledCentral)) {
            $SquideCapAVEnabled = $AntivirusEnabledCentral;
            $kavicapserverEnabled = $AntivirusEnabledCentral;
        }
    }
    if ($SquidGuardIPWeb == null) {
        $SquidGuardApachePort = $sock->GET_INFO("SquidGuardApachePort");
        if (!is_numeric($SquidGuardApachePort)) {
            $SquidGuardApachePort = 9020;
        }
        $fulluri = "http://" . $_SERVER['SERVER_ADDR'] . ':' . $SquidGuardApachePort . "/ufdbguardd.php";
        $sock->SET_INFO("SquidGuardIPWeb", $fulluri);
    }
    if ($SquidGuardServerName == null) {
        $sock->SET_INFO("SquidGuardServerName", $_SERVER['SERVER_ADDR']);
    }
    $eCapClam = null;
    $pic = "status_ok-grey.png";
    $picSplashScreen = "status_ok-grey.png";
    $picSquidBubbleMode = "status_ok-grey.png";
    $SquidBubbleModeText = "{disabled}";
    // APP_HAARP $EnableHaarp
    $picFTPMode = "status_ok-grey.png";
    $picDNSMode = "status_ok-grey.png";
    $EnableFTPProxyText = "<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:Loadjs('ftp.proxy.php');\"\n\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{disabled}</a>";
    $EnableLocalDNSMASQText = "<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:Loadjs('squid.popups.php?script=dns');\"\n\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{disabled}</a>";
    $EnableHaarpText = "<span style='font-size:12px;font-weight:bold;text-decoration:underline'>{disabled}</span>";
    $picHaarp = "status_ok-grey.png";
    $picCNTLM = "status_ok-grey.png";
    $picRDPProxy = "status_ok-grey.png";
    $picAccessLogs = "status_ok.png";
    $EnableAccessLogsText = "<a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:Loadjs('squid.NoAccessLogs.php');\"\n\t\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{enabled}</a>";
    $status_users = status_users();
    if (!$users->dnsmasq_installed) {
        $EnableLocalDNSMASQText = "-";
    } else {
        if ($EnableLocalDNSMASQ == 1) {
            $picDNSMode = "status_ok.png";
            $EnableLocalDNSMASQText = "<a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:Loadjs('squid.popups.php?script=dns');\"\n\t\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{enabled}</a>";
        }
    }
    if (!$users->APP_FTP_PROXY) {
        $EnableFTPProxyText = "-";
    } else {
        if ($EnableFTPProxy == 1) {
            $picFTPMode = "status_ok.png";
            $EnableFTPProxyText = "<a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:Loadjs('ftp.proxy.php');\"\n\t\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{enabled}</a>";
        }
    }
    if (!$users->HAARP_INSTALLED) {
        $EnableHaarpText = "-";
    } else {
        if ($EnableHaarp == 1) {
            $picHaarp = "status_ok.png";
            $EnableHaarpText = "<a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:Loadjs('{$page}?disable-haarp-js=yes',true);\"\n\t\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{enabled}</a>";
        }
    }
    if (!$users->CNTLM_INSTALLED) {
        $EnableCNTLMText = "-";
    } else {
        $EnableCNTLMText = "<a href=\"javascript:blur();\"\n\t\t\t\tOnClick=\"javascript:Loadjs('squid.adker.php',true);\"\n\t\t\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{disabled}</a>";
        if ($EnableCNTLM == 1) {
            $picCNTLM = "status_ok.png";
            $EnableCNTLMText = "<a href=\"javascript:blur();\"\n\t\t\t\tOnClick=\"javascript:Loadjs('squid.adker.php',true);\" \n\t\t\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{enabled}</a>";
        }
    }
    if ($SquidNoAccessLogs == 1) {
        $picAccessLogs = "status_ok-grey.png";
        $EnableAccessLogsText = "<a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:Loadjs('squid.NoAccessLogs.php');\"\n\t\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{disabled}</a>";
    }
    $EnableActiveDirectoryText = "<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:Loadjs('squid.adker.php',true);\" \n\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{disabled}</a>";
    $EnableSplashScreenText = "<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:Loadjs('squid.webauth.php',true);\" \n\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{disabled}</a>";
    if ($SquidBubbleMode == 1) {
        $SquidBubbleModeText = "{enabled}";
        $picSquidBubbleMode = "status_ok.png";
    }
    $SquidBubbleModeTR = "<tr>\n\t<td width=1%><span id='AdSquidStatusLeft3'><img src='img/{$picSquidBubbleMode}'></span></td>\n\t<td class=legend nowrap style='font-size:12px'>{bubble_mode}:</td>\n\t<td><div style='font-size:12px' nowrap>\n\t<a href=\"javascript:blur();\"\n\tOnClick=\"javascript:Loadjs('squid.bubble.php');\"\n\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{$SquidBubbleModeText}</a></td>\n\t</tr>";
    if ($EnableKerbAuth == 1) {
        $pic = "status_ok.png";
        $EnableActiveDirectoryText = "<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:Loadjs('squid.adker.php',true);\" \n\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{enabled}</a>";
    }
    if ($EnableSplashScreen == 1) {
        $picSplashScreen = "status_ok.png";
        $EnableSplashScreenText = "<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:Loadjs('squid.webauth.php',true);\" \n\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{enabled}</a>";
    }
    $EnableActiveDirectoryTextTR = "<tr>\n\t\t\t\t<td width=1%><span id='AdSquidStatusLeft'><img src='img/{$pic}'></span></td>\n\t\t\t\t<td class=legend style='font-size:12px'>Active Directory:</td>\n\t\t\t\t<td><div style='font-size:12px' nowrap>{$EnableActiveDirectoryText}</td>\n\t\t\t\t</tr>";
    $EnableFTPProxyTextTR = "<tr>\n\t<td width=1%><span id='AdSquidStatusLeft'><img src='img/{$picFTPMode}'></span></td>\n\t<td class=legend style='font-size:12px'>{APP_FTP_PROXY}:</td>\n\t<td><div style='font-size:12px' nowrap>{$EnableFTPProxyText}</td>\n\t</tr>";
    //APP_FTP_PROXY // $EnableFTPProxy
    $EnableHaarpTextTR = "<tr>\n\t<td width=1%><span id='AdSquidStatusLeft'><img src='img/{$picHaarp}'></span></td>\n\t<td class=legend style='font-size:12px'>{APP_HAARP}:</td>\n\t<td><div style='font-size:12px' nowrap>{$EnableHaarpText}</td>\n\t</tr>";
    $EnableCNTLMTextTR = "<tr>\n\t<td width=1%><span id='AdSquidStatusLeft'><img src='img/{$picCNTLM}'></span></td>\n\t<td class=legend style='font-size:12px'>{APP_CNTLM}:</td>\n\t<td><div style='font-size:12px' nowrap>{$EnableCNTLMText}</td>\n\t</tr>";
    if ($AsSquidLoadBalancer == 1) {
        $t++;
        $AsSquidLoadBalancerText = "<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:Loadjs('squid.loadbalancer.main.php?js=yes');\" \n\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{enabled}</a>";
        $AsSquidLoadBalancerText = "<tr>\n\t\t\t\t<td width=1%><span id='AdSquidStatusLeft3'><img src='img/status_ok.png'></span></td>\n\t\t\t\t<td class=legend style='font-size:12px'>Load-balancer:</td>\n\t\t\t\t<td><div style='font-size:12px' nowrap>{$AsSquidLoadBalancerText}</td>\n\t\t\t\t</tr>";
    }
    // ----------------------------------------------------------------------------------------------------------------
    $EnableRemoteStatisticsAppliancePic = "status_ok-grey.png";
    $EnableRemoteStatisticsApplianceText = "{disabled}";
    if ($EnableSquidRemoteMySQL == 1) {
        $EnableRemoteStatisticsAppliancePic = "status_ok.png";
        $EnableRemoteStatisticsApplianceText = "{enabled}";
    }
    if ($WizardStatsApplianceDisconnected == 1) {
        $EnableRemoteStatisticsAppliancePic = "status_ok.png";
        $EnableRemoteStatisticsApplianceText = "{disconnected_mode}";
    }
    $EnableRemoteStatisticsApplianceTextTR = "<tr>\n\t\t\t\t<td width=1%><span id='AdSquidStatusLeft3'><img src='img/{$EnableRemoteStatisticsAppliancePic}'></span></td>\n\t\t\t\t<td class=legend style='font-size:12px'>Stats Appliance:</td>\n\t\t\t\t<td><div style='font-size:12px' nowrap>\n\t\t\t\t<a href=\"javascript:blur();\"\n\t\t\t\tOnClick=\"javascript:Loadjs('squid.stats-appliance.php');\" \n\t\t\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{$EnableRemoteStatisticsApplianceText}</a></td>\n\t\t\t\t</tr>";
    // ----------------------------------------------------------------------------------------------------------------
    $EnableWatchdogPic = "status_ok-grey.png";
    $EnableWatchdogText = "{disabled}";
    if ($Watchdog == 1) {
        $EnableWatchdogPic = "status_ok.png";
        $EnableWatchdogText = "{enabled}";
    }
    $t++;
    $EnableWatchdogTextTR = "<tr>\n\t<td width=1%><span id='AdSquidStatusLeft3'><img src='img/{$EnableWatchdogPic}'></span></td>\n\t<td class=legend nowrap style='font-size:12px'>{squid_watchdog_mini}:</td>\n\t<td><div style='font-size:12px' nowrap>\n\t<a href=\"javascript:blur();\"\n\tOnClick=\"javascript:Loadjs('squid.watchdog.php');\"\n\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{$EnableWatchdogText}</a></td>\n\t</tr>";
    // ----------------------------------------------------------------------------------------------------------------
    if ($users->SQUID_REVERSE_APPLIANCE) {
        $SquidActHasReverse = 1;
    }
    if ($squid->isNGnx()) {
        $SquidActHasReverse = 0;
    }
    if ($SquidActHasReverse == 1) {
        $SquidBubbleModeTR = null;
        $t++;
        $AsSquidLoadBalancerText = "<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:Loadjs('squid.reverse.websites.php');\" \n\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{enabled}</a>";
        $AsSquidLoadBalancerText = "<tr>\n\t\t\t\t<td width=1%><span id='AdSquidStatusLeft2'><img src='img/status_ok.png'></span></td>\n\t\t\t\t<td class=legend style='font-size:12px'>{squid_reverse_proxy}:</td>\n\t\t\t\t<td><div style='font-size:12px' nowrap>{$AsSquidLoadBalancerText}</td>\n\t\t\t\t</tr>";
    }
    if ($users->SQUID_REVERSE_APPLIANCE) {
        $AsSquidLoadBalancerText = "<tr>\n\t\t\t\t<td width=1%><span id='AdSquidStatusLeft2'><img src='img/status_ok-grey.png'></span></td>\n\t\t\t\t<td class=legend style='font-size:12px'>{squid_reverse_proxy}:</td>\n\t\t\t\t<td><div style='font-size:12px' nowrap><a href=\"javascript:blur();\"\n\t\t\t\tOnClick=\"javascript:blur();\" \n\t\t\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{disabled}</a></td>\n\t\t\t\t</tr>";
    }
    if ($users->NGINX_INSTALLED) {
        $EnableNginx = $sock->GET_INFO("EnableNginx");
        if (!is_numeric($EnableNginx)) {
            $EnableNginx = 1;
        }
        if ($EnableNginx == 1) {
            $AsSquidLoadBalancerText = "<tr>\n\t\t\t\t<td width=1%><span id='AdSquidStatusLeft2'><img src='img/status_ok.png'></span></td>\n\t\t\t\t<td class=legend style='font-size:12px'>{squid_reverse_proxy}:</td>\n\t\t\t\t<td><div style='font-size:12px' nowrap><a href=\"javascript:blur();\"\n\t\t\t\tOnClick=\"javascript:Loadjs('squid.nginx.php');\"\n\t\t\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{enabled}</a></td>\n\t\t\t\t</tr>";
        } else {
            $AsSquidLoadBalancerText = "<tr>\n\t\t\t\t<td width=1%><span id='AdSquidStatusLeft2'><img src='img/status_ok-grey.png'></span></td>\n\t\t\t\t<td class=legend style='font-size:12px'>{squid_reverse_proxy}:</td>\n\t\t\t\t<td><div style='font-size:12px' nowrap><a href=\"javascript:blur();\"\n\t\t\t\tOnClick=\"javascript:Loadjs('squid.nginx.php');\"\n\t\t\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{disabled}</a></td>\n\t\t\t\t</tr>";
        }
    }
    // ----------------------------------------------------------------------------------------------------------------
    $ufdb = null;
    $dansgu = null;
    $time = time();
    if ($EnableRemoteStatisticsAppliance == 1) {
        $datas = unserialize(base64_decode($sock->GET_INFO("ufdbguardConfig")));
        $users->APP_UFDBGUARD_INSTALLED = true;
        $UseRemoteUfdbguardService = $datas["UseRemoteUfdbguardService"];
        if (!is_numeric($UseRemoteUfdbguardService)) {
            $UseRemoteUfdbguardService = 0;
        }
    }
    if ($users->APP_UFDBGUARD_INSTALLED) {
        $t++;
        $APP_UFDBGUARD_INSTALLED = "{installed}";
        $pic = "status_ok-grey.png";
        $EnableUfdbGuardText = "<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:EnableUfdbGuard(1);\" \n\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{disabled}</a>";
        if ($EnableUfdbGuard == 1) {
            $pic = "status_ok.png";
            $EnableUfdbGuardText = "<a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:EnableUfdbGuard(0);\" \n\t\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{enabled}</a>";
        }
        $ufdb = "\n\t\t<tr>\n\t\t\t<td width=1%><span id='ufd-{$time}'><img src='img/{$pic}'></span></td>\n\t\t\t<td class=legend nowrap style='font-size:12px'>{APP_UFDBGUARD}:</td>\n\t\t\t<td><div style='font-size:12px' nowrap><span id='ufd-{$time}'>{$EnableUfdbGuardText}</span></td>\n\t\t</tr>";
        if ($users->POWER_DNS_INSTALLED) {
            $t++;
            if ($EnableUfdbGuard == 0) {
                $PDSNInUfdb = 0;
            }
            $pic = "status_ok-grey.png";
            $EnableUfdbPDNSText = "<a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:Loadjs('pdns.ufdb.php');\"\n\t\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{disabled}</a>";
            if ($EnableUfdbGuard == 1) {
                if ($PDSNInUfdb == 1) {
                    $pic = "status_ok.png";
                    $EnableUfdbPDNSText = "<a href=\"javascript:blur();\"\n\t\t\t\t\tOnClick=\"javascript:Loadjs('pdns.ufdb.php');\"\n\t\t\t\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{enabled}</a>";
                }
            }
        }
        $ufdbPDNS = "\n\t\t<tr>\n\t\t\t<td width=1%><span id='ufdPDNS-{$time}'><img src='img/{$pic}'></span></td>\n\t\t\t<td class=legend nowrap style='font-size:12px'>{dns_filter}:</td>\n\t\t\t<td><div style='font-size:12px' nowrap><span id='ufd-{$time}'>{$EnableUfdbPDNSText}</span></td>\n\t\t</tr>";
    }
    if ($users->DANSGUARDIAN_INSTALLED) {
        $t++;
        $pic = null;
        $DANSGUARDIAN_INSTALLED = "{installed}";
        $DansGuardianEnabled = $sock->GET_INFO("DansGuardianEnabled");
        if (!is_numeric($DansGuardianEnabled)) {
            $DansGuardianEnabled = 0;
        }
        $DansGuardianEnabledText = "<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:EnableDansguardian(1);\" \n\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{disabled}</a>";
        $pic = "status_ok-grey.png";
        if ($DansGuardianEnabled == 1) {
            $DansGuardianEnabledText = "<a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:EnableDansguardian(0);\" \n\t\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{enabled}</a>";
            $pic = "status_ok.png";
        }
        $dansgu = "<tr>\n\t\t\t<td width=1%><span id='dans-{$time}'><img src='img/{$pic}'></td>\n\t\t\t<td class=legend nowrap style='font-size:12px'>{APP_DANSGUARDIAN}:</td>\n\t\t\t<td><div style='font-size:12px' nowrap>{$DansGuardianEnabledText}</td>\n\t\t\t</tr>";
    }
    $SplashScreenFinal = "<tr>\n\t\t\t<td width=1%><span id='spalsh-{$time}'><img src='img/{$picSplashScreen}'></td>\n\t\t\t<td class=legend nowrap style='font-size:12px'>HotSpot:</td>\n\t\t\t<td><div style='font-size:12px' nowrap>{$EnableSplashScreenText}</td>\n\t\t\t</tr>";
    if (!$users->KASPERSKY_WEB_APPLIANCE) {
        $pic = "status_ok-grey.png";
        $eCapAVText = "{not_installed}";
        if ($users->ECAPAV_INSTALLED) {
            if ($SquideCapAVEnabled == 0) {
                $eCapAVText = "<a href=\"javascript:blur();\"\n\t\t\t\tOnClick=\"javascript:EnableeCapAV(1);\" \n\t\t\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{disabled}</a>";
            } else {
                $eCapAVText = "<a href=\"javascript:blur();\"\n\t\t\t\tOnClick=\"javascript:EnableeCapAV(0);\" \n\t\t\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{enabled}</a>";
                $pic = "status_ok.png";
            }
        }
        $eCapClam = "\n\t\t\t<tr>\n\t\t\t\t<td width=1%><span id='ecapav-{$time}'><img src='img/{$pic}'></span></td>\n\t\t\t\t<td class=legend style='font-size:12px'>{APP_ECAPAV}:</td>\n\t\t\t\t<td><div style='font-size:12px' nowrap>{$eCapAVText}</td>\n\t\t\t</tr>";
    }
    if ($users->KAV4PROXY_INSTALLED) {
        $t++;
        $kavicapserverEnabledText = "<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:Loadjs('kav4proxy.php?js-popup=yes');\" \n\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{disabled}</a>";
        $pic = "status_ok-grey.png";
        if ($kavicapserverEnabled == 1) {
            $kavicapserverEnabledText = "<a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:Loadjs('kav4proxy.php?js-popup=yes');\" \n\t\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{enabled}</a>";
            $pic = "status_ok.png";
        }
        $kav = "<tr>\n\t\t\t<td width=1%><span id='kav4-{$time}'><img src='img/{$pic}'></span></td>\n\t\t\t<td class=legend nowrap>Kaspersky:</td>\n\t\t\t<td><div style='font-size:12px' nowrap>{$kavicapserverEnabledText}</td>\n\t\t\t</tr>";
    } else {
        $pic = "status_ok-grey.png";
        $kavicapserverEnabledText = "<a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:Loadjs('Kav4Proxy.install.php')\" \n\t\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{installation}</a>";
        $kav = "<tr>\n\t\t\t<td width=1%><img src='img/{$pic}'></td>\n\t\t\t<td class=legend nowrap style='font-size:12px'>Kaspersky:</td>\n\t\t\t<td><div style='font-size:12px' nowrap>{$kavicapserverEnabledText}</td>\n\t\t\t</tr>";
    }
    if ($users->C_ICAP_INSTALLED) {
        $CicapEnabled = $sock->GET_INFO("CicapEnabled");
        if (!is_numeric($CicapEnabled)) {
            $CicapEnabled = 0;
        }
        if ($users->WEBSTATS_APPLIANCE) {
            $CicapEnabled = 1;
        }
        $pic = "status_ok-grey.png";
        $CicapEnabledText = "<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:Loadjs('c-icap.index.php',true);\" \n\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{disabled}</a>";
        if ($CicapEnabled == 1) {
            $CicapEnabledText = "<a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:Loadjs('c-icap.index.php',true);\" \n\t\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{enabled}</a>";
            $pic = "status_ok.png";
        }
        if ($users->APP_KHSE_INSTALLED) {
            $KavMetascannerEnable = $sock->GET_INFO("KavMetascannerEnable");
            if (!is_numeric($KavMetascannerEnable)) {
                $KavMetascannerEnable = 0;
            }
            if ($KavMetascannerEnable == 1) {
                $CicapEnabledText = "<span style='font-size:12px;font-weight:bold;'>{enabled}</span>";
            }
        }
        $cicap = "<tr>\n\t\t\t\t<td width=1%><span id='cicap-{$time}'><img src='img/{$pic}'></span></td>\n\t\t\t\t<td class=legend style='font-size:12px'>Antivirus:</td>\n\t\t\t\t<td><div style='font-size:12px' nowrap>{$CicapEnabledText}</td>\n\t\t\t\t</tr>";
        if ($users->APP_KHSE_INSTALLED) {
            $t++;
            $pic = "status_ok-grey.png";
            $KavMetascannerEnableText = "<a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:EnableMetaScan(1);\" \n\t\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{disabled}</a>";
            if ($KavMetascannerEnable == 1) {
                $KavMetascannerEnableText = "<a href=\"javascript:blur();\"\n\t\t\t\tOnClick=\"javascript:EnableMetaScan(0);\" \n\t\t\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{enabled}</a>";
                $pic = "status_ok.png";
            }
            $kavMeta = "\n\t\t\t\t<tr>\n\t\t\t\t<td width=1%><span id='kavmeta-{$time}'><img src='img/{$pic}'></span></td>\n\t\t\t\t<td class=legend style='font-size:12px'>{APP_KAVMETASCANNER}:</td>\n\t\t\t\t<td><div style='font-size:12px' nowrap>{$KavMetascannerEnableText}</td>\n\t\t\t\t</tr>";
        } else {
            $kavMeta = "\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td width=1%><img src='img/{$pic}'></td>\n\t\t\t\t\t<td class=legend style='font-size:12px'>{APP_KAVMETASCANNER}:</td>\n\t\t\t\t\t<td><div style='font-size:12px' nowrap>{not_installed}</td>\n\t\t\t\t\t</tr>";
        }
    } else {
        $pic = "status_ok-grey.png";
        $cicap = "<tr>\n\t\t\t\t<td width=1%><img src='img/{$pic}'></td>\n\t\t\t\t<td class=legend style='font-size:12px'>Antivirus:</td>\n\t\t\t\t<td><div style='font-size:12px' nowrap>-</td>\n\t\t\t\t</tr>";
    }
    //-------------------------- MALWARE PATROL --------------------------------------
    $pic = "status_ok-grey.png";
    $SquidEnableMalWarePatrol = "<a href=\"javascript:blur();\"\n\tOnClick=\"javascript:JSEnableMalWarePatrol(1);\" \n\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{disabled}";
    if ($EnableMalwarePatrol == 1) {
        $pic = "status_ok.png";
        $SquidEnableMalWarePatrol = "<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:JSEnableMalWarePatrol(0);\" \n\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{enabled}</a>";
    }
    $MalWarePatrol = "<tr>\n\t\t\t\t<td width=1%><span id='malwarepatrol-{$time}'><img src='img/{$pic}'></span></td>\n\t\t\t\t<td class=legend style='font-size:12px'>Malware Patrol:</td>\n\t\t\t\t<td><div style='font-size:12px' nowrap>{$SquidEnableMalWarePatrol}</td>\n\t\t\t</tr>";
    //-----------------------------------------------------------------------------------
    $MalWarePatrol = null;
    $SquidDisableAllFiltersText = "<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:JSDisableAllFilters(1);\" \n\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{disabled}</a>";
    $pic = "status_ok-grey.png";
    if ($SquidDisableAllFilters == 1) {
        $pic = "status_ok_red.png";
        $SquidDisableAllFiltersText = "<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:JSDisableAllFilters(0);\" \n\t\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{enabled}</a>";
    }
    $DisableAllFilters = "<tr>\n\t\t\t\t\t<td width=1%><span id='disableall-{$time}'><img src='img/{$pic}'></span></td>\n\t\t\t\t\t<td class=legend style='font-size:12px'>{disable_filters}:</td>\n\t\t\t\t\t<td><div style='font-size:12px' nowrap>{$SquidDisableAllFiltersText}</td>\n\t\t\t\t\t</tr>";
    $EnableLocalDNSMASQTR = "<tr>\n\t\t\t\t\t<td width=1%><span id='aaaaa-{$time}'><img src='img/{$picDNSMode}'></span></td>\n\t\t\t\t\t<td class=legend style='font-size:12px'>DNS:</td>\n\t\t\t\t\t<td><div style='font-size:12px' nowrap>{$EnableLocalDNSMASQText}</td>\n\t\t\t\t\t</tr>";
    $EnableLocalAccessLogsTR = "<tr>\n\t\t\t\t\t<td width=1%><span id='aaaaa-{$time}'><img src='img/{$picAccessLogs}'></span></td>\n\t\t\t\t\t<td class=legend style='font-size:12px'>{access_log}:</td>\n\t\t\t\t\t<td><div style='font-size:12px' nowrap>{$EnableAccessLogsText}</td>\n\t\t\t\t\t</tr>";
    $eCapClam = null;
    if ($squid->isNGnx()) {
        $SquidActHasReverse = 0;
    }
    if ($SquidActHasReverse == 1) {
        $ufdb = null;
        $ufdbPDNS = null;
        $MalWarePatrol = null;
        $dansgu = null;
        $SplashScreenFinal = null;
        $SquidBubbleModeTR = null;
        $EnableActiveDirectoryTextTR = null;
    }
    if (!$users->APP_KHSE_INSTALLED) {
        $kavMeta = null;
    }
    if ($t > 0) {
        $table = "\n\t\t<div style='width:93%' class=form>\n\t\t<table style='width:250px' class='TableRemove TableMarged'><tbody>\n\t\t{$EnableWatchdogTextTR}\n\t\t{$EnableLocalAccessLogsTR}\n\t\t{$EnableActiveDirectoryTextTR}\n\t\t{$status_users}\n\t\t{$EnableCNTLMTextTR}\n\t\t{$EnableLocalDNSMASQTR}\n\t\t{$SquidBubbleModeTR}\n\t\t{$EnableRemoteStatisticsApplianceTextTR}\n\t\t{$AsSquidLoadBalancerText}\n\t\t{$SplashScreenFinal}\n\t\t{$ufdb}\n\t\t{$ufdbPDNS}\n\t\t{$eCapClam}\n\t\t{$dansgu}\n\t\t{$cicap}\n\t\t{$kav}\n\t\t{$kavMeta}\n\t\t{$MalWarePatrol}\n\t\t{$EnableHaarpTextTR}\n\t\t{$EnableFTPProxyTextTR}\n\t\t\n\t\t{$DisableAllFilters}\n\t\t\n\t\t</tbody>\n\t\t</table></div>";
    }
    if (!is_numeric($EnableRemoteStatisticsAppliance)) {
        $EnableRemoteStatisticsAppliance = 0;
    }
    $MEM_HIGER_1G = 1;
    if (!$users->MEM_HIGER_1G) {
        $MEM_HIGER_1G = 0;
    }
    $t = time();
    $off = "<script>UnlockPage();</script>";
    $html = "\n\t{$table}\n\t\n\t<script>\n\t\tfunction RefreshDansguardianMainService(){\n\t\t\tLoadAjax('dansguardian-service-status','{$page}?dansguardian-service-status=yes');\n\t\t}\n\t\t\n\t\tvar x_enable_plugins{$t}= function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>5){alert(results);}\n\t\t\tLoadjs('squid.popups.php?x-save-plugins=yes');\n\t\t}\n\n\t\tfunction ThisisAClientStats(){\n\t\t\tvar EnableRemoteStatisticsAppliance={$EnableRemoteStatisticsAppliance};\n\t\t\tif(EnableRemoteStatisticsAppliance){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t\n\t\tfunction EnableUfdbGuard(value){\n\t\t\t if(ThisisAClientStats()){return 1;}\n\t\t\t var XHR = new XHRConnection();\n\t\t\t XHR.appendData('enable_plugins','yes');\n\t\t\t XHR.appendData('enable_ufdbguardd',value);\n\t\t\t XHR.sendAndLoad('squid.popups.php', 'GET',x_enable_plugins{$t});\t\n\t\t}\n\t\tfunction EnableKav4Proxy(value){\n\t\t\t var MEM_HIGER_1G={$MEM_HIGER_1G};\n\t\t\t if(MEM_HIGER_1G==0){alert('Not enough memory..');return;}\n\t\t\t if(ThisisAClientStats()){return 1;}\n\t\t\t var XHR = new XHRConnection();\n\t\t\t XHR.appendData('enable_plugins','yes');\n\t\t\t XHR.appendData('enable_kavproxy',value);\n\t\t\t document.getElementById('kav4-{$time}').innerHTML='<center style=\"width:100%\"><img src=img/wait.gif></center>';\n\t\t\t XHR.sendAndLoad('squid.popups.php', 'GET',x_enable_plugins{$t});\t\n\t\t}\n\t\t\n\t\tfunction EnableDansguardian(value){\n\t\t\t if(ThisisAClientStats()){return 1;}\n\t\t\t var XHR = new XHRConnection();\n\t\t\t XHR.appendData('enable_plugins','yes');\n\t\t\t XHR.appendData('enable_dansguardian',value);\n\t\t\t document.getElementById('dans-{$time}').innerHTML='<center style=\"width:100%\"><img src=img/wait.gif></center>';\n\t\t\t XHR.sendAndLoad('squid.popups.php', 'GET',x_enable_plugins{$t});\t\t\n\t\t}\n\t\t\n\t\tfunction JSDisableAllFilters(value){\n\t\t\tif(ThisisAClientStats()){return 1;}\n\t\t\t var XHR = new XHRConnection();\n\t\t\t XHR.appendData('DisableAllFilters','yes');\n\t\t\t XHR.appendData('value',value);\n\t\t\t document.getElementById('disableall-{$time}').innerHTML='<center style=\"width:100%\"><img src=img/wait.gif></center>';\n\t\t\t XHR.sendAndLoad('{$page}', 'POST',x_enable_plugins);\t\t\n\t\t}\n\t\t\n\t\tfunction JSEnableMalWarePatrol(value){\n\t\t\tif(ThisisAClientStats()){return 1;}\n\t\t\t var XHR = new XHRConnection();\n\t\t\t XHR.appendData('EnableMalWarePatrol','yes');\n\t\t\t if(value==1){\n\t\t\t \tLoadjs('squid.newbee.php?warn-enable-malware-patrol-js=yes');\n\t\t\t }\n\t\t\t XHR.appendData('value',value);\n\t\t\t document.getElementById('malwarepatrol-{$time}').innerHTML='<center style=\"width:100%\"><img src=img/wait.gif></center>';\n\t\t\t XHR.sendAndLoad('{$page}', 'POST',x_enable_plugins);\t\t\n\t\t}\t\t\n\n\t\t\n\t\tfunction EnableeCapAV(value){\n\t\t\tif(ThisisAClientStats()){return 1;}\n\t\t\t var XHR = new XHRConnection();\n\t\t\t XHR.appendData('enable_plugins','yes');\n\t\t\t XHR.appendData('enable_ecapav',value);\n\t\t\t document.getElementById('ecapav-{$time}').innerHTML='<center style=\"width:100%\"><img src=img/wait.gif></center>';\n\t\t\t XHR.sendAndLoad('squid.popups.php', 'GET',x_enable_plugins{$t});\t\n\t\t}\t\t\t\n\t\t\n\t\t\n\n\t\tfunction EnableCiCap(value){\n\t\t\tif(ThisisAClientStats()){return 1;}\n\t\t\t var MEM_HIGER_1G={$MEM_HIGER_1G};\n\t\t\t if(MEM_HIGER_1G==0){alert('Not enough memory..');return;}\n\t\t\t var XHR = new XHRConnection();\n\t\t\t if(value==0){\n\t\t\t \tLoadjs('c-icap.index.php');\n\t\t\t \treturn;\n\t\t\t }\n\t\t\t \n\t\t\t \n\t\t\t XHR.appendData('enable_plugins','yes');\n\t\t\t XHR.appendData('enable_c_icap',value);\n\t\t\t document.getElementById('cicap-{$time}').innerHTML='<center style=\"width:100%\"><img src=img/wait.gif></center>';\n\t\t\t XHR.sendAndLoad('squid.popups.php', 'GET',x_enable_plugins{$t});\t\n\t\t}\t\t\n\t\tfunction EnableMetaScan(value){\n\t\t\t var MEM_HIGER_1G={$MEM_HIGER_1G};\n\t\t\t if(MEM_HIGER_1G==0){alert('Not enough memory..');return;}\n\t\t\t if(ThisisAClientStats()){return 1;}\n\t\t\t var XHR = new XHRConnection();\n\t\t\t XHR.appendData('enable_plugins','yes');\n\t\t\t XHR.appendData('enable_metascanner',value);\n\t\t\t document.getElementById('kavmeta-{$time}').innerHTML='<center style=\"width:100%\"><img src=img/wait.gif></center>';\n\t\t\t XHR.sendAndLoad('squid.popups.php', 'GET',x_enable_plugins{$t});\t\n\t\t}\t\t\n\t\t\n\t\t\n\t\t\n\t\tRefreshDansguardianMainService();\n\t\tUnlockPage();\n\t</script>\t\n\t";
    SET_CACHED(__FILE__, __FUNCTION__, __FUNCTION__, $html);
    if ($asroot) {
        return;
    }
    echo $tpl->_ENGINE_parse_body($html);
}
Exemplo n.º 12
0
function Export($asPid = false)
{
    return;
    $unix = new unix();
    $restartProcess = false;
    $nohup = $unix->find_program("nohup");
    $php5 = $unix->LOCATE_PHP5_BIN();
    $cachetime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    if ($GLOBALS["VERBOSE"]) {
        echo "CacheTime: {$cachetime}\n";
    }
    $restart_cmd = trim("{$nohup} {$php5} " . __FILE__ . " --export >/dev/null 2>&1 &");
    $sock = new sockets();
    shell_exec(trim("{$nohup} {$php5} " . __FILE__ . " --export-not-categorized >/dev/null 2>&1 &"));
    if ($asPid) {
        $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
        $unix = new unix();
        $pid = @file_get_contents($pidfile);
        if ($unix->process_exists($pid, basename(__FILE__))) {
            WriteMyLogs("Already executed PID:{$pid}, die()", __FUNCTION__, __FILE__, __LINE__);
            die;
        }
        @file_put_contents($pidfile, getmypid());
    }
    $uuid = $unix->GetUniqueID();
    if ($uuid == null) {
        if ($GLOBALS["VERBOSE"]) {
            echo "No system ID !\n";
        }
        return;
    }
    $q = new mysql_squid_builder();
    $tables = $q->LIST_TABLES_CATEGORIES();
    $c = 0;
    while (list($table, $www) = each($tables)) {
        $limit = null;
        $limitupate = null;
        if (!preg_match("#category_(.+?)\$#", $table)) {
            continue;
        }
        if (!$q->TABLE_EXISTS($table)) {
            continue;
        }
        $sql = "SELECT COUNT(zmd5) as tcount FROM {$table} WHERE sended=0 and enabled=1";
        $q->CreateCategoryTable(null, $table);
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
        if (!$q->ok) {
            writelogs("{$table} {$q->mysql_error}", __FUNCTION__, __FILE__, __LINE__);
            return;
        }
        $prefix = "INSERT IGNORE INTO categorize (zmd5 ,pattern,zDate,uuid,category) VALUES";
        if ($ligne["tcount"] > 0) {
            writelogs("{$table} {$ligne["tcount"]} items to export", __FUNCTION__, __FILE__, __LINE__);
            if ($ligne["tcount"] > 5000) {
                $limit = "LIMIT 0,5000";
                $limitupate = "LIMIT 5000";
            }
            $results = $q->QUERY_SQL("SELECT * FROM {$table} WHERE sended=0 AND enabled=1 {$limit}");
            while ($ligne2 = mysql_fetch_array($results, MYSQL_ASSOC)) {
                $md5 = md5("{$ligne2["category"]}{$ligne2["pattern"]}");
                $f[] = "('{$md5}','{$ligne2["pattern"]}','{$ligne2["zDate"]}','{$uuid}','{$ligne2["category"]}')";
                $c++;
                if (count($f) > 1000) {
                    $q->QUERY_SQL($prefix . @implode(",", $f));
                    if (!$q->ok) {
                        echo $q->mysql_error . "\n";
                        return;
                    }
                    $f = array();
                }
            }
            $q->QUERY_SQL("UPDATE {$table} SET sended=1 WHERE sended=0 {$limitupate}");
        }
    }
    if (count($f) > 0) {
        $q->QUERY_SQL($prefix . @implode(",", $f));
        $f = array();
    }
    $ALLCOUNT = $q->COUNT_ROWS("categorize");
    if ($GLOBALS["VERBOSE"]) {
        echo "Total row in categorize table: {$ALLCOUNT}\n";
    }
    if ($ALLCOUNT > 2000) {
        $restartProcess = true;
    }
    $sql = "SELECT * FROM categorize ORDER BY zDate DESC LIMIT 0,2000";
    if ($GLOBALS["VERBOSE"]) {
        echo "Execute query\n";
    }
    $results = $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        echo $q->mysql_error . "\n{$sql}\n";
        return;
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        if ($ligne["category"] == null) {
            continue;
        }
        if ($ligne["pattern"] == null) {
            continue;
        }
        if ($ligne["zmd5"] == null) {
            continue;
        }
        $logsExp[] = "{$ligne["pattern"]}:{$ligne["category"]}";
        $array[$ligne["zmd5"]] = array("category" => $ligne["category"], "pattern" => $ligne["pattern"], "uuid" => $ligne["uuid"]);
    }
    if (!isset($array)) {
        WriteMyLogs("Nothing to export", __FUNCTION__, __FILE__, __LINE__);
        return;
    }
    if (!is_array($array)) {
        WriteMyLogs("Nothing to export", __FUNCTION__, __FILE__, __LINE__);
        return;
    }
    if (count($array) == 0) {
        WriteMyLogs("Nothing to export", __FUNCTION__, __FILE__, __LINE__);
        return;
    }
    $WHITELISTED["1636b7346f2e261c5b21abfcaef45a69"] = true;
    $WHITELISTED["8cdd119c-2dc1-452d-b9d0-451c6046464f"] = true;
    if (!isset($WHITELISTED[$uuid])) {
        if (count($array) > 500) {
            $q->QUERY_SQL("TRUNCATE TABLE categorize_delete");
            WriteMyLogs("Too much categories to export " . count($array) . ">500, aborting", __FUNCTION__, __FILE__, __LINE__, "export");
        }
    }
    WriteMyLogs("Exporting " . count($array) . " websites", __FUNCTION__, __FILE__, __LINE__);
    $f = base64_encode(serialize($array));
    $unix = new unix();
    $URIBASE = $unix->MAIN_URI();
    if ($GLOBALS["VERBOSE"]) {
        echo "Sending " . strlen($f) . " bytes to repository server\n";
    }
    $curl = new ccurl("{$URIBASE}/shalla-orders.php", false);
    $curl->parms["COMMUNITY_POST"] = $f;
    if (!$curl->get()) {
        writelogs("Failed exporting " . count($array) . " categorized websites to Artica cloud repository servers", __FUNCTION__, __FILE__, __LINE__);
        squid_admin_mysql("Failed exporting " . count($array) . " categorized websites to Artica cloud repository servers \"{$curl->error}\"", null, __FILE__, __LINE__, "export");
        return null;
    }
    if (preg_match("#<ANSWER>OK</ANSWER>#is", $curl->data)) {
        squid_admin_mysql(2, "Exporting success " . count($array) . " websites", null, __FILE__, __LINE__);
        if (count($logsExp) < 10) {
            $textadd = @implode(",", $logsExp);
        }
        $curl = new ccurl("{$URIBASE}/webfilters-instant.php?checks=yes", false);
        $curl->NoHTTP_POST = true;
        if (!$curl->get()) {
            squid_admin_mysql(1, "Failed to order to build webfilter instant with HTTP ERROR: `{$curl->error}`", null, __FILE__, __LINE__, "export");
        }
        if (preg_match("#<ANSWER>OK</ANSWER>#is", $curl->data)) {
            writelogs_squid("Success to order to build webfilter instant", __FUNCTION__, __FILE__, __LINE__, "export");
        } else {
            writelogs_squid("Failed to order to build webfilter instant ANSWER NOT OK in server response.", __FUNCTION__, __FILE__, __LINE__, "export");
            if ($GLOBALS["VERBOSE"]) {
                echo $curl->data;
            }
        }
        writelogs("Deleting websites...", __FUNCTION__, __FILE__, __LINE__);
        while (list($md5, $datas) = each($array)) {
            $sql = "DELETE FROM categorize WHERE zmd5='{$md5}'";
            $q->QUERY_SQL($sql, "artica_backup");
        }
        if ($restartProcess) {
            writelogs("{$restart_cmd}", __FUNCTION__, __FILE__, __LINE__);
            shell_exec($restart_cmd);
        } else {
            $q->QUERY_SQL("OPTIMIZE TABLE categorize", "artica_backup");
        }
    } else {
        WriteMyLogs("Failed exporting " . count($array) . " categorized websites to Artica cloud repository servers \"{$curl->data}\"", __FUNCTION__, __FILE__, __LINE__, "export");
    }
}
Exemplo n.º 13
0
function RepairCategoriesBases()
{
    $q = new mysql_squid_builder();
    $tables_cats = $q->LIST_TABLES_CATEGORIES();
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $timeF = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    $pid = @file_get_contents($pidfile);
    if ($pid < 100) {
        $pid = null;
    }
    $unix = new unix();
    if ($unix->process_exists($pid)) {
        ufdbguard_admin_events("Fatal Already executed pid {$pid}", __FUNCTION__, __FILE__, __LINE__, "stats");
        echo "Already executed pid {$pid}\n";
        return;
    }
    if ($unix->file_time_min($timeF) < 10) {
        $time = $unix->file_time_min($timeF);
        ufdbguard_admin_events("Need 10Mn, currently {$time}Mn", __FUNCTION__, __FILE__, __LINE__, "stats");
        @unlink($timeF);
        @file_put_contents($timeF, time());
        return;
    }
    while (list($num, $tablename) = each($tables_cats)) {
        $newcat = $q->tablename_tocat($tablename);
        if ($newcat == null) {
            continue;
        }
        if ($tablename == "category_english_malware") {
            continue;
        }
        if ($tablename == "category_spywmare") {
            $newcat = "spyware";
        }
        if ($tablename == "category_forum") {
            $newcat = "forums";
        }
        if ($tablename == "category_housing_reale_state_") {
            $newcat = "housing/reale_state_office";
        }
        if ($tablename == "category_radio") {
            $newcat = "webradio";
        }
        if ($tablename == "category_radiotv") {
            $newcat = "webradio";
        }
        if ($tablename == "category_shopping") {
            continue;
        }
        echo "{$tablename} -> {$newcat}\n";
        ufdbguard_admin_events("define {$tablename} to {$newcat} done", __FUNCTION__, __FILE__, __LINE__, "maintenance");
        $q->QUERY_SQL("UPDATE `{$tablename}` SET category='{$newcat}' WHERE category='{$ligne["category"]}'");
    }
}
Exemplo n.º 14
0
function myhome2(){
	$page=CurrentPageName();
	$q=new mysql_squid_builder();
	$tpl=new templates();
	$categories=$q->COUNT_CATEGORIES();
	$categories=numberFormat($categories,0,""," ");
	
	$tablescat=$q->LIST_TABLES_CATEGORIES();
	$tablescatNUM=numberFormat(count($tablescat),0,""," ");	
	
	$PhishingURIS=$q->COUNT_ROWS("uris_phishing");
	$PhishingURIS=numberFormat($PhishingURIS,0,""," ");	
	
	
	$MalwaresURIS=$q->COUNT_ROWS("uris_malwares");
	$MalwaresURIS=numberFormat($MalwaresURIS,0,""," ");	
	
	$sql="SELECT COUNT(category) as tcount FROM usersisp_catztables WHERE userid='{$_SESSION["uid"]}' AND blck=0";
	$ligne=@mysql_fetch_array($q->QUERY_SQL($sql));
	$PersonalBlacklists=$ligne["tcount"];
	
	$sql="SELECT COUNT(category) as tcount FROM usersisp_catztables WHERE userid='{$_SESSION["uid"]}' AND blck=1";
	$ligne=@mysql_fetch_array($q->QUERY_SQL($sql));
	$PersonalWhitelists=$ligne["tcount"];

	

	
	$html="
	
	<table style='width:99%' class=form>
	<tbody>
	<tr>
	<td width=1% valign='top'><img src='img/webfilter-64.png'></td>
	<td width=99% valign='top'>
		<table style='width:100%'>
			<tbody>
				<tr>
					<td colspan=2><div style='font-size:16px'>{webfiltering_service}</div></td>
				</tr>
				<tr>
					<td valign='top' $mouse style='font-size:14px;text-decoration:underline' OnClick=\"blur()\"><b>$tablescatNUM</b> {categories}</td>
				</tr>		
				<tr>
					<td valign='top' $mouse style='font-size:14px;text-decoration:underline' OnClick=\"blur()\"><b>$categories</b> {websites_categorized}</td>
				</tr>
				<tr>
					<td valign='top' $mouse style='font-size:14px;text-decoration:underline' OnClick=\"blur()\"><b>$PhishingURIS</b> {phishing_uris}</td>
				</tr>	
				<tr>
					<td valign='top' $mouse style='font-size:14px;text-decoration:underline' OnClick=\"blur()\"><b>$MalwaresURIS</b> {viruses_uris}</td>
				</tr>				
			</tbody>
		</table>
	</td>
	</tr>
	</tbody>
	</table>	
	<br>
	<table style='width:99%' class=form>
	<tbody>
	<tr>
		<td width=1% valign='top'><img src='img/web-ssl-64.png'></td>
		<td width=99% valign='top'>
		<table style='width:100%'>
			<tbody>
				<tr>
					<td colspan=2><div style='font-size:16px'>{your_settings}</div></td>
				</tr>
				<tr>
					<td valign='top' $mouse style='font-size:14px;text-decoration:underline' OnClick=\"javascript:QuickLinkSystems('section_webfiltering_dansguardian')\"><b>$PersonalBlacklists</b> {blacklist_categories}</td>
				</tr>	
				<tr>
					<td valign='top' $mouse style='font-size:14px;text-decoration:underline' OnClick=\"javascript:QuickLinkSystems('section_webfiltering_dansguardian')\"><b>$PersonalWhitelists</b> {whitelist_categories}</td>
				</tr>
			</tbody>
		</table>
		</td>
	</td>
	</tr>
	</tbody>
	</table>	
	
	<script>
		LoadAjax('myhome3','$page?myhome3=yes');
	</script>
	";
	
	echo $tpl->_ENGINE_parse_body($html);
	
}
Exemplo n.º 15
0
function UFDBGUARD_COMPILE_ALL_CATEGORIES()
{
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $oldpid = @file_get_contents($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        return;
    }
    @file_put_contents($pidfile, getmypid());
    ufdbguard_admin_events("start all categories compilation", __FUNCTION__, __FILE__, __LINE__, "compile");
    $q = new mysql_squid_builder();
    $t = time();
    $cats = $q->LIST_TABLES_CATEGORIES();
    $ufdb = new compile_ufdbguard();
    while (list($table, $line) = each($cats)) {
        if (preg_match("#category_(.+)#", $table, $re)) {
            $ufdb->compile_category($re[1]);
        }
    }
    $ttook = $unix->distanceOfTimeInWords($t, time(), true);
    ufdbguard_admin_events("Compilation all categories done ({$ttook})", __FUNCTION__, __FILE__, __LINE__, "global-compile");
    ufdbguard_admin_events("Service will be reloaded", __FUNCTION__, __FILE__, __LINE__, "config");
    shell_exec("/etc/init.d/ufdb reload");
}
Exemplo n.º 16
0
function export_all_tables()
{
    $q = new mysql_squid_builder();
    $tables = $q->LIST_TABLES_CATEGORIES();
    while (list($table, $row) = each($tables)) {
        export_table($table);
    }
}
Exemplo n.º 17
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));
}
Exemplo n.º 18
0
function UFDBGUARD_COMPILE_ALL_CATEGORIES()
{
    $sock = new sockets();
    if (system_is_overloaded(basename(__FILE__))) {
        squid_admin_mysql(1, "Overloaded system: {$GLOBALS["SYSTEM_INTERNAL_LOAD"]}, aborting recompiling personal categories", null, __FILE__, __LINE__);
        die;
    }
    $EnableRemoteStatisticsAppliance = $sock->GET_INFO("EnableRemoteStatisticsAppliance");
    if (!is_numeric($EnableRemoteStatisticsAppliance)) {
        $EnableRemoteStatisticsAppliance = 0;
    }
    $UseRemoteUfdbguardService = $sock->GET_INFO("UseRemoteUfdbguardService");
    if (!is_numeric($UseRemoteUfdbguardService)) {
        $UseRemoteUfdbguardService = 0;
    }
    if ($EnableRemoteStatisticsAppliance == 1) {
        return;
    }
    if ($UseRemoteUfdbguardService == 1) {
        return;
    }
    if ($EnableRemoteStatisticsAppliance == 1) {
        return;
    }
    $unix = new unix();
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $pid = @file_get_contents($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        return;
    }
    @file_put_contents($pidfile, getmypid());
    $sock = new sockets();
    $EnableRemoteStatisticsAppliance = $sock->GET_INFO("EnableRemoteStatisticsAppliance");
    if (!is_numeric($EnableRemoteStatisticsAppliance)) {
        $EnableRemoteStatisticsAppliance = 0;
    }
    if ($EnableRemoteStatisticsAppliance == 1) {
        UFDBGUARD_DOWNLOAD_ALL_CATEGORIES();
        return;
    }
    $EnableWebProxyStatsAppliance = $sock->GET_INFO("EnableWebProxyStatsAppliance");
    if (!is_numeric($EnableWebProxyStatsAppliance)) {
        $EnableWebProxyStatsAppliance = 0;
    }
    $q = new mysql_squid_builder();
    $t = time();
    $cats = $q->LIST_TABLES_CATEGORIES();
    $ufdb = new compile_ufdbguard();
    while (list($table, $line) = each($cats)) {
        if (preg_match("#categoryuris_#", $table)) {
            continue;
        }
        $category = $q->tablename_tocat($table);
        if ($category == null) {
            squid_admin_mysql(1, "Compilation failed for table {$table}, unable to determine category", null, __FILE__, __LINE__);
            continue;
        }
        $ufdb->compile_category($category);
    }
    $ttook = $unix->distanceOfTimeInWords($t, time(), true);
    squid_admin_mysql(2, "All personal categories are compiled ({$ttook})", @implode("\n", $cats), __FILE__, __LINE__, "global-compile");
    if ($EnableWebProxyStatsAppliance == 1) {
        CompressCategories();
        return;
    }
}
Exemplo n.º 19
0
function rules_toolbox_left()
{
    if (!isset($_GET["t"])) {
        $_GET["t"] = time();
    }
    $cachefile = "/usr/share/artica-postfix/ressources/logs/web/ufdb.rules_toolbox_left.html";
    if (isset($_GET["RemoveCache"])) {
        @unlink($cachefile);
    }
    /*	ini_set('display_errors', 1);
    	ini_set('error_reporting', E_ALL);
    	ini_set('error_prepend_string',"<p class=text-error>");
    	ini_set('error_append_string',"</p>");
    	
    */
    if (!$GLOBALS["AS_ROOT"]) {
        if (is_file($cachefile)) {
            $tpl = new templates();
            echo $tpl->_ENGINE_parse_body(@file_get_contents($cachefile));
            return;
        }
    } else {
        include_once dirname(__FILE__) . '/framework/class.unix.inc';
        include_once dirname(__FILE__) . '/framework/frame.class.inc';
        $unix = new unix();
        if ($unix->file_time_min($cachefile) < 5) {
            return;
        }
    }
    $updateutility = null;
    $q = new mysql_squid_builder();
    $page = CurrentPageName();
    $tpl = new templates();
    $users = new usersMenus();
    $mouse = "OnMouseOver=\";this.style.cursor='pointer';\" OnMouseOut=\";this.style.cursor='default';\"";
    $t = $_GET["t"];
    if (!is_numeric($t)) {
        $t = time();
    }
    $Computers = $q->COUNT_ROWS("webfilters_nodes");
    if (!$q->TABLE_EXISTS("webfilter_certs")) {
        $q->CheckTables();
    }
    if ($q->COUNT_ROWS("webfilter_certs") == 0) {
        $q->fill_webfilter_certs();
    }
    $Computers = numberFormat($Computers, 0, "", " ");
    $sock = new sockets();
    $EnableUfdbGuard = $sock->EnableUfdbGuard();
    $tablescat = $q->LIST_TABLES_CATEGORIES();
    $CountDeCategories = numberFormat(count($tablescat), 0, "", " ");
    $todayblocked = date("Ymd") . "_blocked";
    $CountDeBlocked = $sql = $q->COUNT_ROWS($todayblocked);
    $CountDeBlocked = numberFormat($CountDeBlocked, 0, "", " ");
    $disable_service = $tpl->_ENGINE_parse_body("{disable_service}");
    $datasUFDB = unserialize(base64_decode($sock->GET_INFO("ufdbguardConfig")));
    if (!is_numeric($datasUFDB["DebugAll"])) {
        $datasUFDB["DebugAll"] = 0;
    }
    $update_parameters = $tpl->_ENGINE_parse_body("{update_parameters}");
    $EnableWebProxyStatsAppliance = $sock->GET_INFO("EnableWebProxyStatsAppliance");
    $UseRemoteUfdbguardService = $sock->GET_INFO("UseRemoteUfdbguardService");
    $UFDB = unserialize(base64_decode($sock->GET_INFO("ufdbguardConfig")));
    $EnableKerbAuth = $sock->GET_INFO("EnableKerbAuth");
    $SquidPerformance = intval($sock->GET_INFO("SquidPerformance"));
    if (!is_numeric($UseRemoteUfdbguardService)) {
        $UseRemoteUfdbguardService = 0;
    }
    if (!is_numeric($EnableWebProxyStatsAppliance)) {
        $EnableWebProxyStatsAppliance = 0;
    }
    if (!is_numeric($UseRemoteUfdbguardService)) {
        $UseRemoteUfdbguardService = 0;
    }
    if (!is_numeric($EnableKerbAuth)) {
        $EnableKerbAuth = 0;
    }
    if ($EnableWebProxyStatsAppliance == 1) {
        $EnableUfdbGuard = 1;
    }
    if ($UseRemoteUfdbguardService == 0) {
        if ($UFDB["UseRemoteUfdbguardService"] == 1) {
            $sock->SET_INFO("UseRemoteUfdbguardService", 1);
            $UseRemoteUfdbguardService = 1;
        }
    }
    if ($users->WEBSTATS_APPLIANCE) {
        $EnableWebProxyStatsAppliance = 1;
    }
    if (!$users->APP_UFDBGUARD_INSTALLED) {
        $EnableUfdbGuard = 0;
    }
    if ($users->UPDATE_UTILITYV2_INSTALLED) {
        $updateutility = "\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/kaspersky-update-32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('ufdbguard.UpdateUtility.php')\" nowrap>UpdateUtility</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>";
    }
    $ufdbgverb_icon = "ok24-grey.png";
    $ufdbgverb_txt = "OFF";
    if ($datasUFDB["DebugAll"] == 1) {
        $ufdbgverb_icon = "ok32.png";
        $ufdbgverb_txt = "ON";
    }
    if ($EnableUfdbGuard == 1) {
        $DisableUfdbGuard = "\n\t\t\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/ok32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='middle' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('squid.disableUfdb.php')\" nowrap><b><span style='font-size:13px;text-decoration:underline'>{$disable_service}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t\t</tr>\t\t\n\t\t";
    }
    if ($UseRemoteUfdbguardService == 1) {
        $DisableUfdbGuard = null;
    }
    $html = "\n\t<table style='width:98%' class=form>\n\t{$DisableUfdbGuard}\n\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/computer-32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='middle' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('squid.nodes.php',true)\" nowrap><b><span style='font-size:13px;text-decoration:underline'>{$Computers}</span></b><span style='font-size:13px'> {computers}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>";
    $html = $html . "\n\t\t\t\n\t\n\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/check-32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('ufdbguard.tests.php')\" nowrap>\n\t\t\t\t<span style='font-size:13px;text-decoration:underline'>{verify_rules}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\t\t\n\t\n\t\n\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/loupe-32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('squid.category.tests.php')\" nowrap><span style='font-size:13px;text-decoration:underline'>{test_categories}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\t\t\t\n\t\n\t\n\t\n";
    if ($SquidPerformance < 3) {
        $html = $html . "\n\t\n<tr>\n\t<td valign='middle' width=1%><img src='img/group-red-32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('squid.blocked.events.php?js=yes')\" nowrap><b><span style='font-size:13px;text-decoration:underline'>{$CountDeBlocked}</span></b><span style='font-size:13px'> {blocked_requests}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\t\n";
    }
    if ($UseRemoteUfdbguardService == 0) {
        $html = $html . "<tr>\n\t\t<td valign='middle' width=1%><img src='img/service-restart-32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('ufdbguard.php?force-reload-js=yes')\" nowrap><span style='font-size:13px;text-decoration:underline'>{reload_service}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/events-32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('ufdbguard.sevents.php?js=yes')\" nowrap><span style='font-size:13px;text-decoration:underline'>{service_events}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\t\t\t\n\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/{$ufdbgverb_icon}'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top' {$mouse} style='font-size:13px;text-decoration:underline;text-transform:capitalize' \n\t\t\t\tOnClick=\"javascript:Loadjs('ufdbguard.debug.php')\" nowrap><span style='font-size:13px;text-decoration:underline'>{debug} [{$ufdbgverb_txt}]</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\n\n\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/32-stop.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('squidguardweb.php')\" nowrap><span style='font-size:13px;text-decoration:underline'>{banned_page_webservice}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\n\t";
    }
    $html = $html . "\t\n\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/32-categories.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('squid.categories.php')\" nowrap><strong style='font-size:13px;text-decoration:underline'>{$CountDeCategories}&nbsp;{categories}</strong></td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\t\n";
    if ($UseRemoteUfdbguardService == 0) {
        $html = $html . "\n\t<tr>\n\t\t<td valign='middle' width=1%><img src='img/script-32.png'></td>\n\t\t<td valign='middle' width=99%>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='middle' width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top' {$mouse} style='font-size:13px;text-decoration:underline' \n\t\t\t\tOnClick=\"javascript:Loadjs('ufdbguard.conf.php');\" nowrap><span style='font-size:13px;text-decoration:underline'>{config_status}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t</tr>\t\n\t{$updateutility}\t\n";
    }
    $html = $html . "\n\n\t</table> \n\t\n\t\n\t";
    if ($EnableUfdbGuard == 1) {
        if ($UseRemoteUfdbguardService == 0) {
            if (!$users->CORP_LICENSE) {
                echo $tpl->_ENGINE_parse_body("\n\t\t\t\t<div id='{$t}' style='width:90%;margin-bottom:20px' class=form>\n\t\t\t\t\t<table style='width:100%;'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td valign='top' width=99%>\n\t\t\t\t\t\t<div style='font-size:14px;color:#CC0A0A'>\n\t\t\t\t\t\t<img src='img/info-48.png' style='float:left;margin:3px'>\n\t\t\t\t\t\t<span style='font-size:11px'>{warn_ufdbguard_no_license}</span>\n\t\t\t\t\t\t<table style='width:100%'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t\t\t\t<td width=99%><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('artica.license.php');\" \n\t\t\t\t\t\t\tstyle='text-decoration:underline;color:black'>{artica_license}</a></td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t\t</div>");
            }
            $ini = new Bs_IniHandler();
            $sock = new sockets();
            $ini->loadString(base64_decode($sock->getFrameWork('cmd.php?ufdb-ini-status=yes')));
            $restartlocalservice = "Loadjs('system.services.cmd.php?APPNAME=APP_UFDBGUARD&action=restart&cmd=%2Fetc%2Finit.d%2Fufdb&id=ed8cebc50034e96ed26a4d3cb953403f&appcode=APP_UFDBGUARD');";
            $redirector_file = "/usr/share/artica-postfix/ressources/logs/web/squid_redirectors_status.db";
            $redirectors_array = unserialize(@file_get_contents($redirector_file));
            if (count($redirectors_array) > 1) {
                $redirectors_count = count($redirectors_array);
                if (strlen($redirectors_count) == 1) {
                    $redirectors_count = "0{$redirectors_count}";
                }
                $redirectors_text = "\n\t\t\t\t<tr>\n\t\t\t\t\t<td width=1%><strong style='font-size:14px;color:#04A910'>{$redirectors_count}</strong></td>\n\t\t\t\t\t<td width=99%><a href=\"javascript:blur();\" \n\t\t\t\t\t\tOnClick=\"javascript:Loadjs('squid.redirectors.php');\"\n\t\t\t\t\t\tstyle='text-decoration:underline;color:black;font-size:14px'>{redirectors}</a>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>";
            }
            if ($ini->_params["APP_UFDBGUARD"]["running"] == 0) {
                $echo1 = $tpl->_ENGINE_parse_body(toolp("<span style='font-size:14px;color:#ED0D0D'>{warn_ufdbguard_stopped}</span>", "\n\t\t\t\t\t\t<span style='font-size:14px;color:#ED0D0D'>{warn_ufdbguard_stopped}</span>\n\t\t\t\t\t\t\t\t\t<table style='width:100%'>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t\t\t\t\t\t\t\t<td width=99%><a href=\"javascript:blur();\" \n\t\t\t\t\t\t\t\tOnClick=\"javascript:{$restartlocalservice}\"\n\t\t\t\t\t\t\t\tstyle='text-decoration:underline;color:black;font-size:14px'>{start_service}</a></td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t{$redirectors_text}\n\t\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td width=1%><img src='img/16-refresh.png'></td>\n\t\t\t\t\t\t\t\t\t\t\t<td width=99%><a href=\"javascript:blur();\" \n\t\t\t\t\t\t\t\tOnClick=\"javascript:LoadAjaxTiny('rules-toolbox-left','{$page}?rules-toolbox-left=yes&RemoveCache=yes');\"\n\t\t\t\t\t\t\t\tstyle='text-decoration:underline;color:black;font-size:14px'>{refresh}</a></td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t</table>", null, "error-48.png"));
            } else {
                $echo1 = $tpl->_ENGINE_parse_body(toolp("<span style='font-size:14px;color:#04A910;'>{service_running}</span>", "\n\t\t\t\t\t\t<p style='font-size:14px'>\n\t\t\t\t\t\t{running_since}:&nbsp;{$ini->_params["APP_UFDBGUARD"]["uptime"]}<br>\n\t\t\t\t\t\t{memory}:&nbsp;" . FormatBytes($ini->_params["APP_UFDBGUARD"]["master_memory"]) . "</strong>\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t</p>\n\t\t\t\t\t\t<table style='width:100%'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t\t\t<td width=99%><a href=\"javascript:blur();\" OnClick=\"javascript:{$restartlocalservice}\"\n\t\t\t\t\t\tstyle='text-decoration:underline;color:black;font-size:14px'>{restart_service}</a></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t{$redirectors_text}\n\t\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td width=1%><img src='img/16-refresh.png'></td>\n\t\t\t\t\t\t\t\t\t\t\t<td width=99%><a href=\"javascript:blur();\" \n\t\t\t\t\t\t\t\tOnClick=\"javascript:LoadAjaxTiny('rules-toolbox-left','{$page}?rules-toolbox-left=yes&RemoveCache=yes');\"\n\t\t\t\t\t\t\t\tstyle='text-decoration:underline;color:black;font-size:14px'>{refresh}</a></td>\n\t\t\t\t\t\t\t\t\t\t</tr>\t\t\t\t\t\t\n\t\t\t\t\t\t</table>", null, "ok-42.png"));
            }
        }
        if ($UseRemoteUfdbguardService == 1) {
            $server = $UFDB["remote_server"];
            $port = $UFDB["remote_port"] = 3977;
            if (!@fsockopen($server, $port, $errno, $errstr, 1)) {
                $echo1 = $echo1 . $tpl->_ENGINE_parse_body("\n\t\t\t\t\t\t<div id='{$t}' style='width:90%;margin-bottom:20px' class=form>\n\t\t\t\t\t\t<table style='width:100%'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign='top' width=99%>\n\t\t\t\t\t\t<div style='font-size:14px;color:#CC0A0A'>\n\t\t\t\t\t\t\t<img src='img/error-48.png' style='float:left;margin:3px'>\n\t\t\t\t\t\t\t<strong style='font-size:11px'>{warn_ufdbguard_remote_error}</strong>\n\t\t\t\t\t\t\t<p style='font-size:11px'>{server}:&laquo;{$server}&raquo;:{$port}<br>{error} {$errno} {$errstr}</p>\n\t\t\t\t\t\t<table style='width:100%'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t\t\t<td width=99%><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('ufdbguard.php?client-js=yes');\"\n\t\t\t\t\t\tstyle='text-decoration:underline;color:black'>{client_parameters}</a></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t\t</div>");
            } else {
                $echo1 = $echo1 . $tpl->_ENGINE_parse_body("\n\t\t\t\t\t\t<div id='{$t}' style='width:90%;margin-bottom:20px' class=form>\n\t\t\t\t\t\t<table style='width:100%'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign='top' width=99%>\n\t\t\t\t\t\t<div style='font-size:14px;color:black'>\n\t\t\t\t\t\t<img src='img/48-network-server-star.png' style='float:left;margin:3px'>\n\t\t\t\t\t\t<strong style='font-size:11px'>{warn_ufdbguard_remote_use}</strong>\n\t\t\t\t\t\t<p style='font-size:11px'>{server}:&laquo;{$server}&raquo;:{$port}</p>\n\t\t\t\t\t\t<table style='width:100%'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t\t\t<td width=99%><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('ufdbguard.php?client-js=yes');\"\n\t\t\t\t\t\tstyle='text-decoration:underline;color:black'>{client_parameters}</a></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t\t</div>");
            }
        } else {
        }
        if ($EnableWebProxyStatsAppliance == 0) {
            if (trim($sock->getFrameWork("squid.php?isufdbguard-squidconf=yes")) != "OK") {
                $echo1 = $echo1 . $tpl->_ENGINE_parse_body("\n\t\t\t\t\t\t<div id='{$t}-2' style='width:90%;margin-bottom:20px' class=form>\n\t\t\t\t\t\t<table style='width:100%'>\t\t\t\t\t\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign='top' width=99%>\n\t\t\t\t\t\t<div style='font-size:14px;color:#CC0A0A'>\n\t\t\t\t\t\t<img src='img/info-48.png' style='float:left;margin:3px'>\n\t\t\t\t\t\t<span style='font-size:11px'>{warn_ufdbguard_not_squidconf}</span>\n\t\t\t\t\t\t<table style='width:100%'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t\t\t<td width=99%><a href=\"javascript:blur();\" \n\t\t\tOnClick=\"javascript:Loadjs('squid.compile.progress.php');\"\n\t\t\tstyle='font-size:12px;text-decoration:underline'>{APP_SQUID}:{reconfigure}</a></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t\t</div>");
            }
        }
    }
    $echo1 = $echo1 . $tpl->_ENGINE_parse_body($artica_databases);
    $t = time();
    $users = new usersMenus();
    $PERF = true;
    $serverMem = round($users->MEM_TOTAL_INSTALLEE / 1024);
    $CPU = $users->CPU_NUMBER;
    if ($serverMem < 2000) {
        $PERF = FALSE;
    }
    if ($CPU < 2) {
        $PERF = FALSE;
    }
    if (!$PERF) {
        $echo1 = $echo1 . $tpl->_ENGINE_parse_body("\n\t\t<div id='{$t}' style='width:90%;margin-bottom:20px' class=form>\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t<td valign='top' width=99%>\n\t\t<div style='font-size:14px;color:#CC0A0A'>\n\t\t<img src='img/warning-panneau-42.png' style='float:left;margin:3px'>\n\t\t<span style='font-size:11px'>{warn_no_performance_minimal}</span>\n\t\t</div>\n\t\t</td>\n\t\t</tr>\n\t\t</table>\n\t\t</div>");
    }
    $t = time() + 1;
    $CICAPEnableSquidGuard = intval($sock->GET_INFO("CICAPEnableSquidGuard"));
    if ($CICAPEnableSquidGuard == 0) {
        if ($EnableUfdbGuard == 0) {
            $echo1 = $echo1 . $tpl->_ENGINE_parse_body("\n\t\t\t<div id='{$t}' style='width:90%;margin-bottom:20px' class=form>\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t<td valign='top' width=99%>\n\t\t\t<div style='font-size:14px;color:#CC0A0A'>\n\t\t\t<img src='img/warning-panneau-42.png' style='float:left;margin:3px'>\n\t\t\t<span style='font-size:11px'>{warn_ufdbguard_not_activated_explain}</span>\n\t\t\t<table style='width:100%'>\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 width=99%><a href=\"javascript:blur();\" OnClick=\"javascript:EnableUFDB2();\" \n\t\t\t\tstyle='text-decoration:underline;color:black'>{activate_webfilter_engine}</a></td>\n\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</div>\n\t\t</td>\n\t\t</tr>\n\t\t</table>\n\t\t</div>\n\t\t<script>\n\t\tfunction EnableUFDB2(){\n\t\t  Loadjs('squid.EnableUfdb.php');\n\t\t }\t\n\t\t\n\t\t</script>\n\t\t\n\t\t");
        }
    }
    if ($CICAPEnableSquidGuard == 1) {
        $q = new mysql_squid_builder();
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT `status` FROM c_icap_services WHERE ID=12"));
        $status = $ligne["status"];
        $STATUS_ARRAY[0] = "32-green-grey.png";
        $STATUS_ARRAY[1] = "32-green.png";
        $STATUS_ARRAY[2] = "32-red.png";
        $STATUS_ARRAY[3] = "warning32.png";
        $echo1 = $echo1 . $tpl->_ENGINE_parse_body("\n\t\t\t\t<div id='{$t}' style='width:90%;margin-bottom:20px' class=form>\n\t\t\t\t\t<table style='width:100%'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td valign='middle' width=1%>\n\t\t\t\t\t\t\t<img src='img/{$STATUS_ARRAY[$ligne["status"]]}' style='float:left;margin:3px'>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td valign='middle' width=98%>\n\t\t\t\t\t\t\t<div style='font-size:14px;color:black'>\n\t\t\t\t\t\t\t\t\t<span style='font-size:11px'>{icap_webfiltering_status}</span>\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t</div>\n\t\t");
    }
    @file_put_contents($cachefile, $echo1 . $html);
    @chmod($cachefile, 0755);
    echo $tpl->_ENGINE_parse_body($echo1 . $html);
}