Ejemplo n.º 1
0
function page()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $squid_reverse = new squid_reverse();
    $sslcertificates = $squid_reverse->ssl_certificates_list();
    $you_need_to_compile = $tpl->javascript_parse_text("{you_need_to_compile}");
    $servername = $_GET["servername"];
    $q = new mysql_squid_builder();
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM reverse_www WHERE servername='{$servername}'"));
    if (!is_numeric($ligne["ssl_backend_port"])) {
        $ligne["ssl_backend_port"] = 443;
    }
    $t = time();
    $ssl_use_rcert = 0;
    $to = null;
    $AS_PEER_CERTIFICATE = 0;
    $AS_PEER_CERTIFICATE_EXPLAIN = null;
    $cache_peer_id = $ligne["cache_peer_id"];
    if ($cache_peer_id > 0) {
        if (!$q->FIELD_EXISTS("reverse_sources", "ssl_remotecert")) {
            $q->QUERY_SQL("ALTER TABLE `reverse_sources` ADD `ssl_remotecert` smallint(1) NOT NULL DEFAULT '0'");
            if (!$q->ok) {
                echo $q->mysql_error_html();
            }
        }
        $ligne2 = mysql_fetch_array($q->QUERY_SQL("SELECT servername,ssl_remotecert FROM reverse_sources WHERE ID='{$cache_peer_id}'"));
        if (!$q->ok) {
            echo $q->mysql_error_html();
        }
        $to = " {to} «{$ligne2["servername"]}»";
    }
    if (intval($cache_peer_id) > 0) {
        $ligne2 = mysql_fetch_array($q->QUERY_SQL("SELECT certificate FROM reverse_sources WHERE ID='{$cache_peer_id}'"));
        if (trim($ligne2["certificate"] != null)) {
            $ligne["certificate"] = $ligne2["certificate"];
            $AS_PEER_CERTIFICATE = 1;
        }
    }
    if ($AS_PEER_CERTIFICATE == 1) {
        $AS_PEER_CERTIFICATE_EXPLAIN = "<div class=text-info>{reverse_proxy_use_destination_server_certificate}</div>";
    }
    $html[] = "<div style='width:98%' class=form>{$AS_PEER_CERTIFICATE_EXPLAIN}";
    $html[] = "<table style='width:100%'>";
    $html[] = "<tr><td colspan=2 style='font-size:28px;padding-bottom:20px'>{port}:{$ligne["port"]} &laquo;{$servername}&raquo;{$to}</td></tr>";
    $html[] = "<tr><td colspan=2>" . Paragraphe_switch_img("{reverse_proxy_ssl}", "{NGINX_USE_SSL_EXPLAIN}", "ssl-{$t}", $ligne["ssl"], null, 700, "SwitchOffCertificate{$t}") . "</td></tr>";
    $html[] = Field_list_table("certificate-{$t}", "{certificate}", $ligne["certificate"], 22, $sslcertificates, null, 450);
    if ($cache_peer_id > 0) {
        $html[] = "<tr><td colspan=2>" . Paragraphe_switch_img("{destination_use_ssl}", "{NGINX_USE_SSL_EXPLAIN2}", "ssl_backend-{$t}", $ligne["ssl_backend"], null, 700) . "</td></tr>";
        $html[] = "<tr><td colspan=2>" . Paragraphe_switch_img("{SSL_CLIENT_VERIFICATION}", "{SSL_CLIENT_VERIFICATION_EXPLAIN}", "ssl_client_certificate-{$t}", $ligne["ssl_client_certificate"], null, 700) . "</td></tr>";
    }
    $html[] = Field_button_table_autonome("{apply}", "Submit{$t}", 30);
    $html[] = "</table>";
    $html[] = "</div>\n<script>\nvar xSubmit{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>3){alert(results);return;}\n\t\$('#NGINX_MAIN_TABLE').flexReload();\n\talert('{$you_need_to_compile}');\n}\n\t\n\t\nfunction Submit{$t}(){\n\tvar XHR = new XHRConnection();\n\tvar AS_PEER_CERTIFICATE={$AS_PEER_CERTIFICATE};\n\tXHR.appendData('servername','{$servername}');\n\tXHR.appendData('cache_peer_id','{$cache_peer_id}');\n\tXHR.appendData('ssl',document.getElementById('ssl-{$t}').value);\n\tif(document.getElementById('ssl_backend-{$t}')){\n\t\tXHR.appendData('ssl_backend',document.getElementById('ssl_backend-{$t}').value);\n\t}\n\tif(document.getElementById('ssl_client_certificate-{$t}')){\n\t\tXHR.appendData('ssl_client_certificate',document.getElementById('ssl_client_certificate-{$t}').value);\n\t}\t\n\t\n\t\n\t\n\tXHR.appendData('certificate',document.getElementById('certificate-{$t}').value);\n\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n}\n\nfunction SwitchOffCertificate{$t}(){\n\tvar ssl=document.getElementById('ssl-{$t}').value;\n\t\n}\n\nfunction Check{$t}(){\n\tvar AS_PEER_CERTIFICATE={$AS_PEER_CERTIFICATE};\n\tif( AS_PEER_CERTIFICATE==1){\n\t\tdocument.getElementById('certificate-{$t}').disabled=true;\n\t}\n\tSwitchOffCertificate{$t}();\n}\nCheck{$t}();\n</script>\n\t\n\t";
    echo $tpl->_ENGINE_parse_body(@implode("\n", $html));
}
Ejemplo n.º 2
0
function popup()
{
    $tpl = new templates();
    $sock = new sockets();
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $sql = "CREATE TABLE IF NOT EXISTS `nginx_exchecp` (\n\t\t\t`ID` INT( 5 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,\n\t\t\t`hostname` VARCHAR( 255 ) NOT NULL ,\n\t\t\t`ipsrc` VARCHAR( 255 ) NOT NULL ,\n\t\t\t`enabled` INT( 1 ) NOT NULL DEFAULT '1',\n\t\t\tINDEX ( `enabled`,`ipsrc`,`hostname` )) ENGINE=MYISAM;";
    $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo $q->mysql_error_html();
    }
    $enabled = $tpl->_ENGINE_parse_body("{enable}");
    $delete = $tpl->_ENGINE_parse_body("{delete}");
    $new_proxy = $tpl->javascript_parse_text("{new_host}");
    $files = $tpl->_ENGINE_parse_body("{files}");
    $hosts = $tpl->javascript_parse_text("{hosts}");
    $apply_params = $tpl->_ENGINE_parse_body("{apply}");
    $title = $tpl->javascript_parse_text("ECP:{clients_restrictions}");
    $remove = $tpl->javascript_parse_text("{delete} {host}");
    $new_host = $tpl->javascript_parse_text("{new_host}");
    $apache_auth_ip_explain = $tpl->javascript_parse_text("{apache_auth_ip_explain}");
    $tt = $_GET["tt"];
    $servernameenc = urlencode($_GET["servername"]);
    $t = time();
    $html = "\n\t<table class='NGINX_EXCHECP_TABLE' style='display: none' id='NGINX_EXCHECP_TABLE' style='width:99%'></table>\n<script>\nvar tmp{$t}='';\n\$(document).ready(function(){\n\$('#NGINX_EXCHECP_TABLE').flexigrid({\n\turl: '{$page}?proxies-list=yes&t={$t}&servername={$servernameenc}',\n\tdataType: 'json',\n\tcolModel : [\n\t\t{display: '<span style=font-size:18px>{$hosts}</span>', name : 'ipsrc', width : 936, sortable : true, align: 'left'},\n\t\t{display: '&nbsp;', name : 'delete', width : 60, sortable : true, align: 'center'},\n\t\t\n\t],\nbuttons : [\n{name: '<strong style=font-size:22px>{$new_host}</strong>', bclass: 'Add', onpress : AuthIpAdd{$t}},\t\n{name: '<strong style=font-size:22px >{$apply_params}</strong>', bclass: 'apply', onpress : Apply{$t}},\n\t\t],\t\n\tsearchitems : [\n\t\t{display: '{$hosts}', name : 'zDate'},\n\t\t\n\t\t\n\t\t],\n\tsortname: 'ipsrc',\n\tsortorder: 'asc',\n\tusepager: true,\n\ttitle: '<strong style=font-size:30px>{$title}</strong>',\n\tuseRp: true,\n\trp: 50,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: 600,\n\tsingleSelect: true\n\t\n\t});   \n});\t\n\tfunction SquidBuildNow{$t}(){\n\t\tLoadjs('squid.windowsupdate.whitelist.progress.php');\n\t}\n\t\nfunction AddProxyChild(){\n\tYahooWin5('750','{$page}?add-proxy=yes&t={$t}','{$new_proxy}');\n\n}\n\tvar x_EnableDisableProxyClient{$t}= function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>2){alert(results);return;}\n\t\t\t\$('#NGINX_EXCHECP_TABLE').flexReload();\n\t\t}\t\n\nfunction AuthIpAdd{$t}(){\n\tvar ip=prompt('{$apache_auth_ip_explain}');\n\tif(ip){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('authip-add',ip);\n\t\tXHR.appendData('servername','{$_GET["servername"]}');\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_EnableDisableProxyClient{$t});\n\t}\n}\nfunction Apply{$t}(){\n\tLoadjs('nginx.single.progress.php?servername={$servernameenc}');\n}\n\n\n\nfunction LocalForwardedFor(){\n\tLoadjs('squid.forwarded_for.php');\n}\n\n\tvar x_DeleteSquidChild{$t}= function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>2){alert(results);return;}\n\t\t\t\$('#rowTSC'+tmp{$t}).remove();\n\t\t}\t\t\n\n\tfunction DeleteSquidChild(ID){\n\t\ttmp{$t}=ID;\n\t\tif(confirm('{$remove} '+ID+' ?')){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('proxy-delete',ID);\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_DeleteSquidChild{$t});\n\t\t}\n\t}\n\t\n\t\n\t\n\tfunction EnableDisableProxyClient(ID){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('proxy-enable',ID);\n\t\tif(document.getElementById('ProxyClient_'+ID).checked){\n\t\t\tXHR.appendData('enable',1);\n\t\t}else{\n\t\t\tXHR.appendData('enable',0);\n\t\t}\n\t\t\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_EnableDisableProxyClient{$t});\t\n\t}\n\t\n</script>\n";
    echo $html;
}
function table()
{
    $q = new mysql_squid_builder();
    $tpl = new templates();
    $page = CurrentPageName();
    $page = CurrentPageName();
    $sock = new sockets();
    $t = time();
    if (!$q->TABLE_EXISTS("ufdbunlock")) {
        $sql = "CREATE TABLE IF NOT EXISTS `squidlogs`.`ufdbunlock` (\n\t\t\t`md5` VARCHAR( 90 ) NOT NULL ,\n\t\t\t`logintime` BIGINT UNSIGNED ,\n\t\t\t`finaltime` INT UNSIGNED ,\n\t\t\t`uid` VARCHAR(128) NOT NULL,\n\t\t\t`MAC` VARCHAR( 90 ) NULL,\n\t\t\t`www` VARCHAR( 128 ) NOT NULL ,\n\t\t\t`ipaddr` VARCHAR( 128 ) ,\n\t\t\tPRIMARY KEY ( `md5` ) ,\n\t\t\tKEY `MAC` (`MAC`),\n\t\t\tKEY `logintime` (`logintime`),\n\t\t\tKEY `finaltime` (`finaltime`),\n\t\t\tKEY `uid` (`uid`),\n\t\t\tKEY `www` (`www`),\n\t\t\tKEY `ipaddr` (`ipaddr`)\n\t\t\t)  ENGINE = MEMORY;";
        $q->QUERY_SQL($sql);
        if (!$q->ok) {
            echo FATAL_ERROR_SHOW_128($q->mysql_error_html());
            return;
        }
    }
    //
    $ipaddr = $tpl->_ENGINE_parse_body("{ipaddr}");
    $uid = $tpl->_ENGINE_parse_body("{uid}");
    $sitename = $tpl->_ENGINE_parse_body("{sitename}");
    $date = $tpl->_ENGINE_parse_body("{created}");
    $finish = $tpl->_ENGINE_parse_body("{finish}");
    $delete = $tpl->_ENGINE_parse_body("{delete}");
    $member = $tpl->javascript_parse_text("{members}");
    $parameters = $tpl->javascript_parse_text("{settings}");
    $title = $tpl->_ENGINE_parse_body("{unblock_queue}");
    $buttons = "\n\tbuttons : [\n\t\t{name: '{$parameters}', bclass: 'Reconf', onpress : unblock_parms},\n\t\n\t],";
    $buttons = null;
    $html = "\n\n<table class='UFDBGUARD_QUEUE_RELEASE' style='display: none' id='UFDBGUARD_QUEUE_RELEASE' style='width:100%'></table>\n<script>\nvar rowid{$t}='';\n\$(document).ready(function(){\n\$('#UFDBGUARD_QUEUE_RELEASE').flexigrid({\n\turl: '{$page}?rules-table-list=yes&t={$t}',\n\tdataType: 'json',\n\tcolModel : [\n\t\t{display: '{$date}', name : 'logintime', width : 180, sortable : true, align: 'left'},\t\n\t\t{display: '{$ipaddr}', name : 'ipaddr', width : 160, sortable : true, align: 'left'},\n\t\t{display: '{$uid}', name : 'uid', width : 160, sortable : true, align: 'left'},\t\t\n\t\t{display: '{$sitename}', name : 'www', width : 299, sortable : true, align: 'left'},\n\t\t{display: '{$finish}', finaltime : 'uid', width :180, sortable : true, align: 'left'},\n\t\t{display: '{$delete}', name : 'delete', width : 70, sortable : false, align: 'center'},\n\t\t],\n\t{$buttons}\n\tsearchitems : [\n\t\t{display: '{$ipaddr}', name : 'ipaddr'},\n\t\t{display: '{$member}', name : 'uid'},\n\t\t{display: '{$sitename}', name : 'www'},\n\t\t],\n\tsortname: 'logintime',\n\tsortorder: 'desc',\n\tusepager: true,\n\ttitle: '<strong style=font-size:22px>{$title}</strong>',\n\tuseRp: true,\n\trp: 50,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: 400,\n\tsingleSelect: true,\n\trpOptions: [10, 20, 30, 50,100,200]\n\t\n\t});   \n});\n\n\tfunction unblock_parms(){\n\t\tLoadjs('squidguardweb.unblock.php')\n\t}\n\n\tvar xBannedDeleteQueueUFDB= function (obj) {\n\t\tvar res=obj.responseText;\n\t\tif (res.length>3){alert(res);return;}\n\t\t\$('#row'+rowid{$t}).remove();\n\t\t\$('#UFDBGUARD_QUEUE_RELEASE').flexReload();\n\t}\t\t\n\t\t\n\tfunction BannedDeleteQueueUFDB(md5){\n\t\trowid{$t}=md5;\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('DeleteWhiteListed', md5);\n\t\tXHR.sendAndLoad('{$page}', 'POST',xBannedDeleteQueueUFDB);  \n\t}\n\n</script>\n";
    echo $html;
}
function items_js()
{
    $ID = $_GET["ID"];
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $objects = $tpl->_ENGINE_parse_body("{objects}");
    $items = $tpl->_ENGINE_parse_body("{items}");
    $new_item = $tpl->_ENGINE_parse_body("{link_object}");
    $new_group = $tpl->_ENGINE_parse_body("{new_proxy_object}");
    $reverse = $tpl->_ENGINE_parse_body("{reverse}");
    $t = $_GET["t"];
    $MyTime = time();
    $q = new mysql_squid_builder();
    $sql = "CREATE TABLE IF NOT EXISTS `squidlogs`.`qos_sqacllinks` (\n\t\t\t`zmd5` VARCHAR( 90 ) NOT NULL PRIMARY KEY ,\n\t\t\t`aclid` BIGINT UNSIGNED ,\n\t\t\t`negation` smallint(1) NOT NULL ,\n\t\t\t`gpid` INT UNSIGNED ,\n\t\t\t`zOrder` INT( 10 ) NOT NULL ,\n\t\t\tINDEX ( `aclid` , `gpid`,`negation`),\n\t\t\tKEY `zOrder`(`zOrder`)\n\t\t\t)  ENGINE = MYISAM;";
    $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo $q->mysql_error_html();
        die;
    }
    $html = "\n\t<table class='QOS_RULES_GROUPS_ID' style='display: none' id='QOS_RULES_GROUPS_ID' style='width:99%'></table>\n<script>\nvar DeleteAclKey=0;\nfunction LoadTable{$t}(){\n\$('#QOS_RULES_GROUPS_ID').flexigrid({\n\turl: '{$page}?items-list=yes&ID={$ID}&t={$t}&aclid={$_GET["aclid"]}',\n\tdataType: 'json',\n\tcolModel : [\n\t\t{display: '&nbsp;', name : 'zOrder', width :20, sortable : true, align: 'center'},\t\n\t\t{display: '{$objects}', name : 'gpid', width : 311, sortable : true, align: 'left'},\n\t\t{display: '{$reverse}', name : 'negation', width : 31, sortable : false, align: 'center'},\n\t\t{display: '{$items}', name : 'items', width : 69, sortable : false, align: 'center'},\n\t\t{display: '&nbsp;', name : 'up', width :20, sortable : false, align: 'center'},\n\t\t{display: '&nbsp;', name : 'down', width :20, sortable : false, align: 'center'},\t\t\n\t\t{display: '&nbsp;', name : 'del', width : 31, sortable : false, align: 'center'},\n\t\t\n\t],\nbuttons : [\n\t{name: '<strong style=font-size:18px>{$new_item}</strong>', bclass: 'add', onpress : LinkAclItem},\n\n\t\t],\t\n\tsearchitems : [\n\t\t{display: '{$items}', name : 'GroupName'},\n\t\t],\n\tsortname: 'zOrder',\n\tsortorder: 'asc',\n\tusepager: true,\n\ttitle: '',\n\tuseRp: true,\n\trp: 15,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: 350,\n\tsingleSelect: true\n\t\n\t});   \n}\nfunction LinkAclItem() {\n\tLoadjs('squid.BrowseAclGroups.php?callback=LinkAclRuleGpid{$_GET["aclid"]}&FilterType=IPTABLES');\n\t\n}\t\n\nfunction LinkAddAclItem(){\n\tLoadjs('squid.acls.groups.php?AddGroup-js=-1&link-acl={$_GET["aclid"]}&table-acls-t={$t}');\n}\n\nvar x_LinkAclRuleGpid{$MyTime}= function (obj) {\n\tvar res=obj.responseText;\n\tif(res.length>3){alert(res);return;}\n\t\n\tif(document.getElementById('GLOBAL_SSL_CENTER_ID')){\n\t\t\$('#'+document.getElementById('GLOBAL_SSL_CENTER_ID').value).flexReload();\n\t}\n\t\n\t\$('#QOS_RULES_GROUPS_ID').flexReload();\n\t\$('#table-{$t}').flexReload();\n\n\t\n\t\n}\t\n\nfunction LinkAclRuleGpid{$_GET["aclid"]}(gpid){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('acl-rule-link', '{$_GET["aclid"]}');\n\t\tXHR.appendData('gpid', gpid);\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_LinkAclRuleGpid{$MyTime});  \t\t\n\t}\n\t\n\tfunction DeleteObjectLinks(mkey){\n\t\tDeleteAclKey=mkey;\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('acl-rule-link-delete', mkey);\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_DeleteObjectLinks{$MyTime});\n\t\t\t\t\n\t}\n\t\n\tfunction ChangeNegation(mkey){\n\t\tvar value=0;\n\t\tvar XHR = new XHRConnection();\n\t\tif(document.getElementById('negation-'+mkey).checked){value=1;}\n\t\tXHR.appendData('acl-rule-link-negation', mkey);\n\t\tXHR.appendData('value', value);\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_LinkAclRuleGpid{$MyTime});\n\t}\n\t\nvar xQosRuleGroupUpDown{$_GET["aclid"]}= function (obj) {\n\tvar res=obj.responseText;\n\tif(res.length>3){alert(res);return;}\n\t\$('#QOS_RULES_GROUPS_ID').flexReload();\n}\t\n\t\nfunction QosRuleGroupUpDown(mkey,direction){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('acl-rule-link-order', mkey);\n\tXHR.appendData('direction', direction);\n\tXHR.appendData('aclid', '{$_GET["aclid"]}');\n\tXHR.sendAndLoad('{$page}', 'POST',xQosRuleGroupUpDown{$_GET["aclid"]});\n\n}\n\n\tvar x_DeleteObjectLinks{$MyTime}= function (obj) {\n\t\tvar res=obj.responseText;\n\t\tif(res.length>3){alert(res);return;}\n\t\t\$('#row'+DeleteAclKey).remove();\n\t\t\$('#table-{$t}').flexReload();\n\t\tif(document.getElementById('GLOBAL_SSL_CENTER_ID')){\n\t\t\t\$('#'+document.getElementById('GLOBAL_SSL_CENTER_ID').value).flexReload();\n\t\t}\n\t}\t\n\t\nLoadTable{$t}();\n</script>\n\t\n\t";
    echo $html;
}
function step5()
{
    $allsystems = 0;
    $final = "<script>\n\t\t\tYahooWin5Hide();\n\t\t\tLoadjs('dansguardian2.compile.php');\n\t\t\tCacheOff();\n\t\t\tLoadAjaxRound('main-ufdb-frontend','ufdbguard.status.php');\n\t\t\t\t\n\t\t</script>";
    $tpl = new templates();
    $sock = new sockets();
    $WizardUFDB = unserialize(base64_decode($sock->GET_INFO("WizardUFDB")));
    if ($WizardUFDB["SOURCE_TYPE"] == "ALL") {
        $allsystems = 1;
    }
    $ARRAY[0] = "{block_sexual_websites}";
    $ARRAY[1] = "{block_susp_websites}";
    $ARRAY[2] = "{block_multi_websites}";
    $wizard_Name = strtolower('Wizard - rule ' . $tpl->javascript_parse_text($ARRAY[$WizardUFDB["CATZ"]]));
    $wizard_Name_tests = addslashes(utf8_encode($wizard_Name));
    $q = new mysql_squid_builder();
    $sql = "SELECT ID FROM webfilter_rules WHERE `groupname`='{$wizard_Name_tests}'";
    $results = $q->QUERY_SQL($sql);
    $mysql_num_rows = intval(mysql_num_rows($results));
    if ($mysql_num_rows > 0) {
        $wizard_Name = "{$wizard_Name} - " . intval($mysql_num_rows + 1);
    }
    $RULES["AllSystems"] = $allsystems;
    $RULES["ExternalWebPage"] = null;
    $RULES["UseExternalWebPage"] = 0;
    $RULES["UseSecurity"] = 0;
    $RULES["bypass"] = 0;
    $RULES["enabled"] = 1;
    $RULES["endofrule"] = 'any';
    $RULES["freeweb"] = '';
    $RULES["groupmode"] = 1;
    $RULES["groupname"] = $wizard_Name;
    $RULES["zOrder"] = 0;
    $fieldsAddA = array();
    $fieldsAddB = array();
    while (list($num, $ligne) = each($RULES)) {
        $fieldsAddA[] = "`{$num}`";
        $fieldsAddB[] = "'" . addslashes(utf8_encode($ligne)) . "'";
        $fieldsEDIT[] = "`{$num}`='" . addslashes(utf8_encode($ligne)) . "'";
        $DEFAULTARRAY[$num] = $ligne;
    }
    $sql_add = "INSERT IGNORE INTO webfilter_rules (" . @implode(",", $fieldsAddA) . ") VALUES (" . @implode(",", $fieldsAddB) . ")";
    $q->QUERY_SQL($sql_add);
    if (!$q->ok) {
        echo $q->mysql_error_html();
        return;
    }
    $ruleid = $q->last_id;
    if ($ruleid == 0) {
        echo "<p class=text-error>Fatal last ID = 0</p>";
        return;
    }
    $array["malware"] = true;
    $array["warez"] = true;
    $array["hacking"] = true;
    $array["phishing"] = true;
    $array["spyware"] = true;
    $array["weapons"] = true;
    $array["violence"] = true;
    $array["suspicious"] = true;
    $array["paytosurf"] = true;
    $array["sect"] = true;
    $array["proxy"] = true;
    $array["gamble"] = true;
    $array["redirector"] = true;
    if ($WizardUFDB["CATZ"] == 0) {
        $array["p**n"] = true;
        $array["agressive"] = true;
        $array["dynamic"] = true;
        $array["alcohol"] = true;
        $array["astrology"] = true;
        $array["dangerous_material"] = true;
        $array["drugs"] = true;
        $array["hacking"] = true;
        $array["tattooing"] = true;
        $array["terrorism"] = true;
        $array["dating"] = true;
        $array["mixed_adult"] = true;
        $array["sex/lingerie"] = true;
        $array["publicite"] = true;
        $array["tracker"] = true;
        $array["marketingware"] = true;
        $array["mailing"] = true;
        $array["downloads"] = true;
        $array["gamble"] = true;
    }
    if ($WizardUFDB["CATZ"] == 1) {
        $array["p**n"] = true;
        $array["dating"] = true;
        $array["mixed_adult"] = true;
        $array["sex/lingerie"] = true;
    }
    if ($WizardUFDB["CATZ"] == 2) {
        $array["publicite"] = true;
        $array["tracker"] = true;
        $array["marketingware"] = true;
        $array["mailing"] = true;
    }
    if ($WizardUFDB["CATZ"] == 3) {
        $array["audio-video"] = true;
        $array["youtube"] = true;
        $array["webtv"] = true;
        $array["music"] = true;
        $array["movies"] = true;
        $array["games"] = true;
        $array["gamble"] = true;
        $array["socialnet"] = true;
        $array["webradio"] = true;
        $array["chat"] = true;
        $array["webphone"] = true;
        $array["downloads"] = true;
    }
    if (count($array) < 2) {
        echo "<p class=text-error>No category set</p>\n";
        return;
    }
    while (list($key, $val) = each($array)) {
        $q = new mysql_squid_builder();
        $q->QUERY_SQL("DELETE FROM webfilter_blks WHERE category='{$key}' AND modeblk=0 AND webfilter_id='{$ruleid}'");
        $q->QUERY_SQL("INSERT IGNORE INTO webfilter_blks (webfilter_id,category,modeblk) VALUES ('{$ruleid}','{$key}','0')");
        if (!$q->ok) {
            echo $q->mysql_error_html();
            return;
        }
    }
    $q->QUERY_SQL("DELETE FROM webfilter_blks WHERE category='liste_bu' AND modeblk=1 AND webfilter_id='{$ruleid}'");
    $q->QUERY_SQL("INSERT IGNORE INTO webfilter_blks (webfilter_id,category,modeblk) VALUES ('{$ruleid}','liste_bu','1')");
    if ($allsystems == 1) {
        echo $final;
        return;
    }
    $GPS["description"] = "Wizard new group for<br>{$wizard_Name}";
    $GPS["enabled"] = 1;
    $GPS["gpid"] = null;
    $GPS["groupname"] = mysql_escape_string2("Group: {$WizardUFDB["TYPE_VALUE"]}");
    if ($WizardUFDB["SOURCE_TYPE"] == "IPADDR") {
        $GPS["localldap"] = 1;
    }
    if ($WizardUFDB["SOURCE_TYPE"] == "AD") {
        $dndata = $WizardUFDB["TYPE_VALUE"];
        if (preg_match("#AD:(.*?):(.+)#", $WizardUFDB["TYPE_VALUE"], $re)) {
            $dnEnc = $re[2];
            $LDAPID = $re[1];
        }
        $GPS["localldap"] = 2;
        $GPS["gpid"] = 0;
        $GPS["dn"] = $dndata;
        $ACtiveDir = new ActiveDirectory($LDAPID);
        $array = $ACtiveDir->ObjectProperty(base64_decode($dnEnc));
        $GPS["groupname"] = $array["cn"];
    }
    $fieldsAddA = array();
    $fieldsAddB = array();
    $q = new mysql_squid_builder();
    while (list($num, $ligne) = each($GPS)) {
        $fieldsAddA[] = "`{$num}`";
        $fieldsAddB[] = "'" . addslashes(utf8_encode($ligne)) . "'";
        $fieldsEDIT[] = "`{$num}`='" . addslashes(utf8_encode($ligne)) . "'";
    }
    $sql_add = "INSERT IGNORE INTO webfilter_group (" . @implode(",", $fieldsAddA) . ") VALUES (" . @implode(",", $fieldsAddB) . ")";
    $q = new mysql_squid_builder();
    $q->QUERY_SQL($sql_add);
    if (!$q->ok) {
        echo $q->mysql_error_html();
        return;
    }
    $gpid = $q->last_id;
    if ($gpid == 0) {
        echo "<p class=text-error>Fatal:" . __LINE__ . " last ID = 0</p>";
        return;
    }
    $md5 = md5("{$ruleid}{$gpid}");
    $q->QUERY_SQL("INSERT INTO webfilter_assoc_groups (zMD5,webfilter_id,group_id) VALUES('{$md5}',{$ruleid},{$gpid})");
    if (!$q->ok) {
        echo $q->mysql_error_html();
        return;
    }
    $PAT["enabled"] = 1;
    $PAT["groupid"] = $gpid;
    if ($WizardUFDB["SOURCE_TYPE"] != "IPADDR") {
        echo $final;
        return;
    }
    $PAT["membertype"] = 1;
    if (preg_match("#(.+?)\\/(.+)#", $WizardUFDB["TYPE_VALUE"])) {
        $PAT["membertype"] = 2;
    }
    $PAT["pattern"] = $WizardUFDB["TYPE_VALUE"];
    $fieldsAddA = array();
    $fieldsAddB = array();
    $q = new mysql_squid_builder();
    while (list($num, $ligne) = each($GPS)) {
        $fieldsAddA[] = "`{$num}`";
        $fieldsAddB[] = "'" . addslashes(utf8_encode($ligne)) . "'";
        $fieldsEDIT[] = "`{$num}`='" . addslashes(utf8_encode($ligne)) . "'";
    }
    $sql_add = "INSERT IGNORE INTO webfilter_members (" . @implode(",", $fieldsAddA) . ") VALUES (" . @implode(",", $fieldsAddB) . ")";
    $q->QUERY_SQL($sql_add);
    if (!$q->ok) {
        echo $q->mysql_error_html();
        return;
    }
    echo $final;
}
function remove_cache_button()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $button_browse = null;
    $button_empty = null;
    $sql = "SELECT COUNT(ID) as tcount,report_type FROM `reports_cache` GROUP BY report_type HAVING `report_type`='FLOW'";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
    if (!$q->ok) {
        echo $q->mysql_error_html();
    }
    if (intval($ligne["tcount"]) > 0) {
        $button_browse = $tpl->_ENGINE_parse_body(button("{browse_cache}", "Loadjs('squid.statistics.browse-cache.php?report_type=FLOW')", 16));
    }
    $button_empty = $tpl->_ENGINE_parse_body(button("{empty_cache}", "Loadjs('{$page}?remove-cache-js=yes&zmd5={$_GET["zmd5"]}')", 16));
    echo "<table><tr><td nowrap>{$button_browse}</td><td>&nbsp;</td><td>{$button_empty}</td></tr></table>";
}
Ejemplo n.º 7
0
function wifidog_password_perform()
{
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $sessionkey = $_REQUEST["sessionkey"];
    if ($sessionkey == null) {
        return wifidog_password("Missing field sessionkey");
    }
    $url = $_REQUEST["url"];
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT uid FROM hotspot_members WHERE `sessionkey`='{$sessionkey}'"));
    if ($ligne["uid"] == null) {
        echo BuildFullPage(null, "<center>{this_account_didnot_exists}<hr><span style='font-size:12px'>{$sessionkey}</span></center>", "<META http-equiv=\"refresh\" content=\"5; URL={$url}\">");
        return;
    }
    $password2 = trim($_POST["password2"]);
    $password = trim($_POST["password"]);
    if ($password2 != $password) {
        return wifidog_password("{password_mismatch}");
    }
    $password = md5($password);
    $sql = "UPDATE hotspot_members\n\tSET autocreate_confirmed=1,\n\t\tautocreate=1,\n\t\tpassword='******'\n\t\tWHERE sessionkey='{$sessionkey}'";
    $q->QUERY_SQL($sql);
    if (!$q->ok) {
        return wifidog_password($q->mysql_error_html());
    }
    $ArticaHotSpotSMTP = SMTP_SETTINGS();
    $btsize = $ArticaHotSpotSMTP["SKIN_BUTTON_SIZE"];
    $fontsize = $ArticaHotSpotSMTP["SKIN_FONT_SIZE"];
    $text_form = "\n\t<div style='width:98%' class=form>\n\t<center>\n\t<div style='font-size:{$fontsize}'><center>{updated_password_successfully}<br>{$url}</center></div>\n\t<img src='img/wait_verybig_mini_red.gif'></center></div>";
    $text_form = $tpl->_ENGINE_parse_body($text_form);
    echo BuildFullPage($text_form, null, "<META http-equiv=\"refresh\" content=\"5; URL={$url}\">");
}
Ejemplo n.º 8
0
function category_table()
{
    $ID = $_GET["mainid"];
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $category = $tpl->_ENGINE_parse_body("{extension}");
    $description = $tpl->_ENGINE_parse_body("{description}");
    $category = $tpl->_ENGINE_parse_body("{category}");
    $delete = $tpl->_ENGINE_parse_body("{delete}");
    $group = $tpl->_ENGINE_parse_body("{group}");
    $add = $tpl->_ENGINE_parse_body("{add}:{extension}");
    $addDef = $tpl->_ENGINE_parse_body("{add}:{default}");
    $new_category = $tpl->_ENGINE_parse_body("{new_category}");
    $OnlyActive = $tpl->_ENGINE_parse_body("{OnlyActive}");
    $Group = $tpl->_ENGINE_parse_body("{group}");
    $All = $tpl->_ENGINE_parse_body("{all}");
    $TB_WIDTH = 897;
    $group = $_GET["group"];
    if (isset($_GET["CatzByEnabled"])) {
        $CatzByEnabled = "&CatzByEnabled=yes";
    }
    $t = $_GET["t"];
    $d = time();
    $sql = "CREATE TABLE IF NOT EXISTS `cicap_profiles_blks` (\n\t\t\t\t   `ID` INT( 5 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,\n\t\t\t\t    mainid INT(3) NOT NULL,\n\t\t\t\t  \tbltype smallint(1) NOT NULL,\n\t\t\t\t  \tcategory VARCHAR(128) NOT NULL,\n\t\t\t\t  KEY `mainid` (`mainid`),\n\t\t\t\t  KEY `category` (`category`),\n\t\t\t\t  KEY `bltype` (`bltype`)\n\t\t\t\t)  ENGINE = MYISAM;";
    $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo $q->mysql_error_html();
        return;
    }
    $description_size = 639;
    $buttons = "\tbuttons : [\n\t{name: '{$new_category}', bclass: 'add', onpress : AddCatz},\n\t{name: '{$OnlyActive}', bclass: 'Search', onpress : OnlyActive{$t}},\n\t{name: '{$All}', bclass: 'Search', onpress : OnlyAll{$t}},\n\t{name: '{$Group}', bclass: 'Search', onpress : GroupBy{$t}},\n\t],";
    $buttons = null;
    if ($_GET["bltype"] == 1) {
        $title = $tpl->javascript_parse_text("{categories}: {whitelist}");
    } else {
        $title = $tpl->javascript_parse_text("{categories}: {blacklist}");
    }
    if (is_numeric($_GET["table-size"])) {
        $TB_WIDTH = $_GET["table-size"];
    }
    if (is_numeric($_GET["group-size"])) {
        $description_size = $_GET["group-size"];
    }
    $html = "\n\t<table class='blacklist{$t}{$_GET["bltype"]}' style='display: none' id='blacklist{$t}{$_GET["bltype"]}' style='width:99%'></table>\n\t<script>\n\tvar CatzByEnable{$t}=0;\n\t\$(document).ready(function(){\n\t\$('#blacklist{$t}{$_GET["bltype"]}').flexigrid({\n\turl: '{$page}?category-list=yes&mainid={$ID}&bltype={$_GET["bltype"]}&t={$_GET["t"]}',\n\tdataType: 'json',\n\tcolModel : [\n\t{display: '&nbsp;', name : 'none', width :28, sortable : false, align: 'center'},\n\t{display: '{$category}', name : 'categorykey', width : 108, sortable : true, align: 'left'},\n\t{display: '{$description}', name : 'description', width : {$description_size}, sortable : false, align: 'left'},\n\t{display: '', name : 'none2', width : 25, sortable : false, align: 'left'},\n\n\t],\n\t{$buttons}\n\tsearchitems : [\n\t{display: '{$category}', name : 'categorykey'},\n\t{display: '{$description}', name : 'description'},\n\t{display: '{$group}', name : 'master_category'},\n\t],\n\tsortname: 'categorykey',\n\tsortorder: 'asc',\n\tusepager: true,\n\ttitle: '<span style=font-size:18px>{$title}</span>',\n\tuseRp: true,\n\trp: 15,\n\tshowTableToggleBtn: false,\n\twidth: {$TB_WIDTH},\n\theight: 350,\n\tsingleSelect: true\n\n});\n});\nfunction ChooseGroup(group) {\nalert(group);\n\n}\n\nfunction GroupBy{$t}(){\nYahooSearchUser(300,'{$page}?blacklist-list-group=yes&iditem=blacklist-table-{$t}-{$d}&RULEID={$ID}&modeblk={$_GET["modeblk"]}&TimeID={$_GET["TimeID"]}&CatzByEnable='+CatzByEnable{$t},'{$Group}');\n}\n\nfunction OnlyActive{$t}(){\nCatzByEnable{$t}=1;\n\$('#blacklist-table-{$t}-{$d}').flexOptions({url: '{$page}?blacklist-list=yes&RULEID={$ID}&modeblk={$_GET["modeblk"]}&group={$group}&CatzByEnabled=yes&TimeID={$_GET["TimeID"]}'}).flexReload(); ExecuteByClassName('SearchFunction');\n}\nfunction OnlyAll{$t}(){\nCatzByEnable{$t}=0;\n\$('#blacklist-table-{$t}-{$d}').flexOptions({url: '{$page}?blacklist-list=yes&RULEID={$ID}&modeblk={$_GET["modeblk"]}&group={$group}&TimeID={$_GET["TimeID"]}'}).flexReload(); ExecuteByClassName('SearchFunction');\n}\n\nvar x_bannedextensionlist_AddDefault=function(obj){\nvar results=obj.responseText;\nif(results.length>3){alert(results);}\nYahooWin6Hide();\nRefreshBannedextensionlist();\n}\n\nfunction bannedextensionlist_AddDefault(){\nvar XHR = new XHRConnection();\nXHR.appendData('bannedextensionlist-default','{$ID}');\nAnimateDiv('annedextensionlist-div');\nXHR.sendAndLoad('{$page}', 'POST',x_bannedextensionlist_AddDefault);\n\n}\n\nvar x_bannedextensionlist_enable=function(obj){\nvar results=obj.responseText;\nif(results.length>3){alert(results);RefreshBannedextensionlist();}\n}\n\nfunction bannedextensionlist_enable(md5){\nvar XHR = new XHRConnection();\nXHR.appendData('bannedextensionlist-key',md5);\nif(document.getElementById('disable_'+md5).checked){XHR.appendData('bannedextensionlist-enable','1');}else{XHR.appendData('bannedextensionlist-enable','0');}\nXHR.sendAndLoad('{$page}', 'POST',x_bannedextensionlist_enable);\n}\n\nvar x_bannedextensionlist_delete=function(obj){\nvar results=obj.responseText;\nif(results.length>3){alert(results);return;}\n\$('#row'+bannedextensionlist_KEY).remove();\n}\n\nfunction bannedextensionlist_delete(md5){\nbannedextensionlist_KEY=md5;\nvar XHR = new XHRConnection();\nXHR.appendData('bannedextensionlist-delete',md5);\nXHR.sendAndLoad('{$page}', 'POST',x_bannedextensionlist_delete);\n}\n\nfunction AddCatz(){\nLoadjs('dansguardian2.databases.php?add-perso-cat-js=yes');\n}\n\n</script>\t";
    echo $tpl->_ENGINE_parse_body($html);
}
function search()
{
    $page = CurrentPageName();
    $boot = new boostrap_form();
    $tpl = new templates();
    $searchstring = string_to_flexquery("search");
    $ORDER = $boot->TableOrder(array("subject" => "ASC"));
    $limitSql = "LIMIT 0,250";
    $sql = "SELECT * FROM reverse_pages_content WHERE 1 {$searchstring} ORDER BY {$ORDER} {$limitSql}";
    $q = new mysql_squid_builder();
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo $q->mysql_error_html();
    }
    while ($ligne = mysql_fetch_assoc($results)) {
        $ID = $ligne["ID"];
        $jsselect = null;
        $select = null;
        $js = $boot->trswitch("Loadjs('miniadmin.crm.pages.php?ID={$ID}')");
        if ($_GET["field-id"] != null) {
            $select = "Loadjs('{$page}?select-js=yes&ID={$ID}&field-id={$_GET["field-id"]}')";
            $jsselect = $boot->trswitch($select);
            $select_img = imgsimple("arrow-right-24.png", null, $select);
        }
        $delete_img = imgsimple("delete-24.png", null, "Loadjs('{$page}?delete-js=yes&ID={$ID}')");
        $tr[] = "\n\t<tr id='{$ligne["ID"]}'>\n\t<td width='99%' nowrap {$js}><i class='icon-tags'></i> {$ligne["subject"]}</a></td>\n\t<td width='45px' nowrap style='vertical-align:middle;text-align:center'>{$select_img}</td>\n\t<td width='45px' nowrap style='vertical-align:middle;text-align:center'>{$delete_img}</td>\n\t</tr>";
    }
    $html = $boot->TableCompile(array("subject" => "{subject}", "ID" => "select", "delete" => "{delete}"), $tr);
    echo $tpl->_ENGINE_parse_body($html);
}
Ejemplo n.º 10
0
function CategoriesCheckRightsRead()
{
    $users = new usersMenus();
    if ($users->AsDansGuardianAdministrator) {
        return true;
    }
    $q = new mysql_squid_builder();
    $sql = "SELECT PublicMode FROM personal_categories WHERE category='{$_REQUEST["category"]}'";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
    if (!$q->ok) {
        echo $q->mysql_error_html();
        return;
    }
    $GLOBALS["CategoriesCheckRights"][] = "{$_REQUEST["category"]}: Public Mode: {$ligne["PublicMode"]}";
    if ($ligne["PublicMode"] == 1) {
        return true;
    }
    $CategoriesCheckPerms = CategoriesCheckPerms();
    if ($CategoriesCheckPerms[$_REQUEST["category"]] == 1) {
        return true;
    }
    return false;
}
Ejemplo n.º 11
0
function upload_artica_final()
{
    $fileName = $_GET["fileName"];
    $content_dir = dirname(__FILE__) . "/ressources/conf/upload";
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $page = CurrentPageName();
    $t = time();
    $ID = $_GET["ID"];
    $FilePath = "{$content_dir}/{$fileName}";
    $data = mysql_escape_string2(@file_get_contents($FilePath));
    $size = strlen($data);
    $q->QUERY_SQL("UPDATE itcharters SET `PdfContent`='{$data}',`PdfFileSize`='{$size}',`PdfFileName`='{$fileName}' WHERE ID='{$ID}'");
    if (!$q->ok) {
        echo $q->mysql_error_html();
        return;
    }
    echo "<script>RefreshTab('itchart_tabs');YahooWinBrowseHide();\$('#IT_CHART_TABLE').flexReload();</script>";
}
Ejemplo n.º 12
0
function graph_current_hour_day(){
	$timekey=date('Ymd');
	$time=time();
	$page=CurrentPageName();
	$q=new mysql_squid_builder();
	$table="squidmemory_$timekey";
	
	$sql="SELECT HOUR(zDate) as zhour,AVG(memoryuse) as memoryuse FROM `$table` GROUP BY HOUR(zDate) ORDER BY HOUR(zDate)";
	$results=$q->QUERY_SQL($sql);
	if(!$q->ok){echo $q->mysql_error_html();return;}
	
	while ($ligne = mysql_fetch_assoc($results)) {
		if(strlen($ligne["zhour"])==1){$ligne["zhour"]="0{$ligne["zhour"]}";}
		$ttime="{$ligne["zhour"]}h";
		$size=$size/1024;
		$xdata[]=$ttime;
		$ydata[]=$ligne["memoryuse"];
	
	}
	
	$title="{memory_size_this_day} (MB)";
	$timetext="{minutes}";
	
	
	$highcharts=new highcharts();
	$highcharts->container=$_GET["container"];
	$highcharts->xAxis=$xdata;
	$highcharts->TitleFontSize="14px";
	$highcharts->AxisFontsize="12px";
	$highcharts->Title=$title;
	$highcharts->yAxisTtitle="{size} (MB)";
	$highcharts->xAxisTtitle=$timetext;
	$highcharts->xAxis_labels=false;
	$highcharts->LegendPrefix=date("H")."h";
	$highcharts->LegendSuffix="MB";
	//$highcharts->subtitle="<a href=\"javascript:Loadjs('squid.sizegraphs.php')\" style='text-decoration:underline'>{more_details}</a>";
	$highcharts->datas=array("{size}"=>$ydata);
	echo $highcharts->BuildChart();	
	
	
	
}
function create_table()
{
    $sql = "CREATE TABLE IF NOT EXISTS `artica_caches_wl` (\n\t\t`ID` BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,\n\t\t`sitename` VARCHAR( 256 ) NOT NULL,\n\t\t`enabled` smallint(1) NOT NULL DEFAULT 1,\n\t\t UNIQUE KEY `sitename` (`sitename`),\n\t\t KEY `enabled` (`enabled`)\n\t\t)  ENGINE = MYISAM;\n\t\t\t";
    $q = new mysql_squid_builder();
    $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo $q->mysql_error_html();
    }
}
Ejemplo n.º 14
0
function history_content()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $xdata = array();
    $ydata = array();
    $field = $_GET["field"];
    $value = $_GET["value"];
    $familysite = $_GET["familysite"];
    $month_table = "quotamonth_" . date("Ym");
    $month_text = date("{F}");
    if ($q->COUNT_ROWS($month_table) == 0) {
        $month_text = date("{F}", strtotime('first day of previous month'));
        $month_table = "quotamonth_" . date("Ym", strtotime('first day of previous month'));
    }
    $sql = "SELECT `day`,`familysite`,`{$field}`,SUM(size) as QuerySize FROM \n\t\t`{$month_table}`  GROUP BY `day`,`familysite` ,`{$field}`\n\t\tHAVING `{$field}`='{$value}' AND familysite='{$familysite}' ORDER BY `day`";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo $q->mysql_error_html();
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $size = round($ligne["QuerySize"] / 1024 / 1000);
        $day = $ligne["day"];
        $xdata[] = $day;
        $ydata[] = $size;
    }
    $targetedfile = "ressources/logs/" . basename(__FILE__) . "." . __FUNCTION__ . "." . md5($sql) . ".png";
    $targetedfile2 = "ressources/logs/" . basename(__FILE__) . "." . __FUNCTION__ . "." . md5($sql) . ".2.png";
    $gp = new artica_graphs();
    $gp->width = 650;
    $gp->height = 350;
    $gp->filename = "{$targetedfile}";
    $gp->xdata = $xdata;
    $gp->ydata = $ydata;
    $gp->y_title = $tpl->_ENGINE_parse_body("{size}");
    $gp->x_title = $tpl->_ENGINE_parse_body("{days}");
    $gp->title = null;
    $gp->margin0 = true;
    $gp->Fillcolor = "blue@0.9";
    $gp->color = "146497";
    $gp->line_green();
    if (!is_file($targetedfile)) {
        writelogs("Fatal \"{$targetedfile}\" no such file!", __FUNCTION__, __FILE__, __LINE__);
    } else {
        $html = $html . "\n\t\t<div style='font-size:18px;margin:8px'>&laquo;{$value}&raquo;&nbsp;|&nbsp;{$familysite}&nbsp;|&nbsp;{$month_text}</div>\n\t\t<center>\n\t\t\t<div style='width:99%' class=form>\n\t\t\t\t\n\t\t\t\t<img src='{$targetedfile}'>\n\t\t\t</div>\n\t\n\t\t</center>\n\t\t\n\t\t";
    }
    echo $tpl->_ENGINE_parse_body($html);
}
Ejemplo n.º 15
0
function status_remote_mysql_server(){
	$tpl=new templates();
	$q=new mysql_squid_builder();
	if(!$q->BD_CONNECT()){
		return Paragraphe32("mysql_error", "noacco:mysql://$q->mysql_server:$q->mysql_port<br>$q->mysql_error","","database-error-32.png");
	}else{
		$results=$q->EXECUTE_SQL("SHOW STATUS");
		
		if(!$q->ok){echo $q->mysql_error_html();}
		while ($ligne = mysql_fetch_assoc($results)) { $ARRAY[$ligne["Variable_name"]]=$ligne["Value"]; }
		
		$time=time()-$ARRAY["Uptime"];
		$Uptime=distanceOfTimeInWords($time,time());
		$Threads_connected=$ARRAY["Threads_connected"];
		$Connections=$ARRAY["Connections"];
		$Connections=FormatNumber($Connections);
		$MySqlServer="$q->mysql_server:$q->mysql_port";
		if($q->mysql_server){$MySqlServer=$tpl->_ENGINE_parse_body("{local_database}");}
		
		return Paragraphe32("noacco:$MySqlServer", "{running} {since} $Uptime<br>Threads: $Threads_connected<br>{connections}:$Connections	
				","","database-link-32.png");
	}
	
	
}
Ejemplo n.º 16
0
function proxy_status()
{
    $ntmlauthenticators_array = array();
    $COUNT_DE_CACHES_TEXT = null;
    $webfilters_paranoid_text = null;
    $users = new usersMenus();
    if ($users->STATS_APPLIANCE) {
        return influxdb_status();
    }
    if ($users->POSTFIX_INSTALLED) {
        return postfix_status();
    }
    $sock = new sockets();
    $SQUIDEnable = $sock->GET_INFO("SQUIDEnable");
    if (!is_numeric($SQUIDEnable)) {
        $SQUIDEnable = 1;
    }
    $EnableArticaMetaServer = intval($sock->GET_INFO("EnableArticaMetaServer"));
    $EnableNginx = intval($sock->GET_INFO("EnableNginx"));
    $EnableHaProxy = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableHaProxy"));
    if ($SQUIDEnable == 0) {
        if ($EnableArticaMetaServer == 1) {
            return meta_server_status();
        }
        if ($EnableNginx == 1) {
            return nginx_server_status();
        }
        if ($EnableHaProxy == 1) {
            return haproxy_server_status();
        }
    }
    $SquidCacheLevel = $sock->GET_INFO("SquidCacheLevel");
    $HTTrackInSquid = intval($sock->GET_INFO("HTTrackInSquid"));
    if (!is_numeric($SquidCacheLevel)) {
        $SquidCacheLevel = 4;
    }
    unset($_GET["_"]);
    $sock = new sockets();
    if (!isset($_GET["ForceCache"])) {
        $md5CacheF = md5("proxy_status{$_SESSION["uid"]}{$tpl->language}" . serialize($_GET));
        $cachefile = "/usr/share/artica-postfix/ressources/interface-cache/{$md5CacheF}";
        if (file_time_sec_Web($cachefile) < 5) {
            return @file_get_contents($cachefile);
        }
    }
    if (isset($_GET["ForceCache"])) {
        $sock->getFrameWork("cmd.php?Global-Applications-Status=yes");
    }
    $q = new mysql_squid_builder();
    $tpl = new templates();
    $page = CurrentPageName();
    $ini = new Bs_IniHandler();
    $users = new usersMenus();
    $perc_cache = null;
    $active_resquests = null;
    $important_events = null;
    $CountDeServices = null;
    $icon = "disks-128-ok.png";
    $rqs = null;
    $NOT_CATEGORIZED_ROW = null;
    $mgr_client_list = $q->COUNT_ROWS("mgr_client_list");
    $SNMP_WALK = proxy_snmp();
    $EnableUfdbGuard = intval($sock->EnableUfdbGuard());
    $SquidUrgency = intval($sock->GET_INFO("SquidUrgency"));
    $MacToUidUrgency = intval($sock->GET_INFO("MacToUidUrgency"));
    $SquidSSLUrgency = intval($sock->GET_INFO("SquidSSLUrgency"));
    $EnableKerbAuth = intval($sock->GET_INFO("EnableKerbAuth"));
    $LogsWarninStop = intval($sock->GET_INFO("LogsWarninStop"));
    $SquidUFDBUrgency = intval($sock->GET_INFO("SquidUFDBUrgency"));
    $IsPortsConverted = intval($sock->GET_INFO("IsPortsConverted"));
    $SquidCacheFullHideWarn = intval($sock->GET_INFO("SquidCacheFullHideWarn"));
    $ActiveDirectoryEmergency = intval($sock->GET_INFO("ActiveDirectoryEmergency"));
    $BasicAuthenticatorEmergency = intval($sock->GET_INFO("BasicAuthenticatorEmergency"));
    $eCAPClamavEmergency = intval($sock->GET_INFO("eCAPClamavEmergency"));
    $ParanoidBlockerEmergency = intval($sock->GET_INFO("ParanoidBlockerEmergency"));
    $EnableeCapClamav = intval($sock->GET_INFO("EnableeCapClamav"));
    $curs = "OnMouseOver=\"this.style.cursor='pointer';\"\n\tOnMouseOut=\"this.style.cursor='auto'\"";
    $WebFiltering_blocked = null;
    $CACHES_AVG = round(@file_get_contents("{$GLOBALS["BASEDIR"]}/CACHES_AVG"), 1);
    $COUNT_DE_BLOCKED = intval(@file_get_contents("{$GLOBALS["BASEDIR"]}/COUNT_DE_BLOCKED"));
    $SquidDebugAcls = intval($sock->GET_INFO("SquidDebugAcls"));
    $AsTransparent = intval(@file_get_contents("{$GLOBALS["BASEDIR"]}/COUNT_DE_TRANSPARENT"));
    $WATCHDOG_COUNT_EVENTS = intval(@file_get_contents("{$GLOBALS["BASEDIR"]}/WATCHDOG_COUNT_EVENTS"));
    $COUNT_DE_CACHES = intval(@file_get_contents("{$GLOBALS["BASEDIR"]}/COUNT_DE_CACHES"));
    $SUM_FAMILYSITES = intval(@file_get_contents("{$GLOBALS["BASEDIR"]}/SUM_FAMILYSITES"));
    $WindowsUpdateCaching = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/WindowsUpdateCaching"));
    $TOP_WEBSITE = unserialize(@file_get_contents("{$GLOBALS["BASEDIR"]}/TOP_WEBSITE"));
    $NOT_CATEGORIZED = intval(@file_get_contents("{$GLOBALS["BASEDIR"]}/NOT_CATEGORIZED"));
    $CACHES_RATES = unserialize(@file_get_contents("{$GLOBALS["BASEDIR"]}/TOTAL_CACHED_ARRAY"));
    $TOTALS_NOT_CACHED = intval($CACHES_RATES["TOTALS_NOT_CACHED"]);
    $TOTALS_CACHED = intval($CACHES_RATES["TOTALS_CACHED"]);
    if ($users->AsProxyMonitor) {
        if ($EnableKerbAuth == 1) {
            $ntmlauthenticators = _ntmlauthenticators();
            while (list($cpu, $purc) = each($ntmlauthenticators)) {
                $color = "black";
                if ($purc > 95) {
                    $color = "#d32d2d";
                }
                $ntmlauthenticators_array[] = "\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td style='font-size:18px'>\n\t\t\t\t\t<a href=\"javascript:blur();\"\n\t\t\t\t\tOnClick=\"javscript:Loadjs('squid.ntmlauthenticators.php?cpu={$cpu}')\"\n\t\t\t\t\tstyle='text-decoration:underline;color:{$color}'>{ntlm_processes}: CPU#{$cpu} {$purc}%</a></td>\n\t\t\t\t\t</tr>";
            }
        }
    }
    $SERVICES_STATUS = SERVICES_STATUS();
    if (!is_array($SERVICES_STATUS)) {
        $CountDeServices = $SERVICES_STATUS;
    } else {
        $icon = "disks-128-warn.png";
        $err = $SERVICES_STATUS;
    }
    $scriptEnd = "LoadAjaxTiny('active-directory-dash-infos','{$page}?active-directory-dash-infos=yes');";
    $EnableUfdbGuard = $sock->EnableUfdbGuard();
    $realsquidversion = @file_get_contents("/etc/artica-postfix/settings/Daemons/SquidRealVersion");
    $sql = "SELECT COUNT(*) as tcount FROM proxy_ports WHERE enabled=1";
    $results = $q->QUERY_SQL($sql);
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
    if (!$q->ok) {
        $err[] = proxy_status_warning("MySQL error", $q->mysql_error_html(), "blur()");
    }
    $COUNTDePorts = $ligne["tcount"];
    $js_icon_stats = null;
    $icon_stats = "<div style='float:left;margin-right:10px;margin-top:5px'><img src='img/statistics-24-grey.png'></div>";
    $GotoNotCategorized = "GotoNotCategorized()";
    $ActiveRequests_js = "Loadjs('squid.active.requests.php')";
    $GotoNotCategorized_underline = "underline";
    $ActiveRequests_underline = "underline";
    $GotoMysQLAllWebsites_underline = "underline";
    $GoToCachedStatistics = "GoToCachedStatistics()";
    $GotoMysQLAllWebsites = "GotoMysQLAllWebsites()";
    $LoadProxyUpdate = "LoadProxyUpdate();";
    $LOadUfdbUpdate = "GoToWebfilteringDBstatus();";
    if (!$users->AllowViewStatistics) {
        $GotoNotCategorized = "blur();";
        $ActiveRequests_js = "blur()";
        $GotoNotCategorized_underline = "none";
        $ActiveRequests_underline = "none";
        $GoToCachedStatistics = "blur()";
        $GotoMysQLAllWebsites = "blur()";
        $GotoMysQLAllWebsites_underline = "none";
    }
    if (!$users->AsSquidAdministrator) {
        $LoadProxyUpdate = "blur()";
        $LOadUfdbUpdate = "blur()";
    }
    $SquidPerformance = intval($sock->GET_INFO("SquidPerformance"));
    if ($SquidPerformance < 2) {
        $prec = round(@file_get_contents("{$GLOBALS["BASEDIR"]}/CACHED_AVG"), 1);
        $PROXY_REQUESTS_NUMBER = @file_get_contents("{$GLOBALS["BASEDIR"]}/PROXY_REQUESTS_NUMBER");
        $PROXY_REQUESTS_NUMBER = FormatNumber($PROXY_REQUESTS_NUMBER);
        if ($COUNT_DE_CACHES > 0) {
            $COUNT_DE_CACHES_KB = $COUNT_DE_CACHES * 1024;
            $COUNT_DE_CACHES_TEXT = FormatBytes($COUNT_DE_CACHES_KB);
        }
        $js_icon_stats = "OnMouseOver=\"this.style.cursor='pointer';\"\n\t\tOnMouseOut=\"this.style.cursor='auto'\"\n\t\tOnClick=\"javascript:{$GoToCachedStatistics};\"";
        if (is_file("{$GLOBALS["BASEDIR"]}/CACHED_ROW_DAY")) {
            $icon_stats = "<div style='float:left;margin-right:10px;margin-top:5px'>\n\t\t\t\t\t<img src='img/statistics-24.png'></div>";
        }
        if ($SUM_FAMILYSITES > 0) {
            $SUM_FAMILYSITES = FormatNumber($SUM_FAMILYSITES);
            $SUM_FAMILYSITES_TEXT = "\n\t\t\t<tr>\n\t\t\t<td style='font-size:20px'>{websites}:\n\t\t\t<a href=\"javascript:blur();\" OnClick=\"javascript:{$GotoMysQLAllWebsites};\"\n\t\t\tstyle='text-decoration:{$GotoMysQLAllWebsites_underline}'>{$SUM_FAMILYSITES}</a></td>\n\t\t\t</tr>";
        }
    }
    $ActiveRequestsR = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/active_requests.inc"));
    $ActiveRequestsNumber = count($ActiveRequestsR["CON"]);
    $ActiveRequestsIpaddr = count($ActiveRequestsR["IPS"]);
    $ActiveRequestsMembers = count($ActiveRequestsR["USERS"]);
    if ($NOT_CATEGORIZED > 0) {
        $NOT_CATEGORIZED = FormatNumber($NOT_CATEGORIZED);
        $NOT_CATEGORIZED_ROW = "<tr>\n\t\t\t<td style='font-size:20px'>\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"{$GotoNotCategorized}\"\n\t\tstyle='text-decoration:{$GotoNotCategorized_underline}'>{websites}: {$NOT_CATEGORIZED} {not_categorized}</a></td>\n\t\t</tr>";
    }
    $TITLE_REQUESTS = "\n\t\t<tr>\n\t\t\t<td style='font-size:20px'>\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"{$ActiveRequests_js}\"\n\t\tstyle='text-decoration:{$ActiveRequests_underline}'>{$ActiveRequestsNumber} {active_requests}</a></td>\n\t\t</tr>";
    if ($COUNTDePorts == 0) {
        $err[] = proxy_status_warning("{no_listening_port_defined}", "{no_listening_port_proxydefined_explain}", "GotoSquidPorts()");
    }
    if ($SquidDebugAcls == 1) {
        $err[] = proxy_status_warning("{debug_acls}", "{debug_acls_explain}", "Loadjs('squid.acls.options.php')");
    }
    if ($SNMP_WALK["ERROR"]) {
        $err[] = proxy_status_warning("SNMP:{need_to_restart_webconsole}", "{click_to_install}", "Loadjs('php-snmp.progress.php'");
    }
    preg_match("#^([0-9]+)\\.([0-9]+)#", $realsquidversion, $re);
    $MAJOR = intval($re[1]);
    $MINOR = intval($re[2]);
    $INCOMPATIBLE = true;
    $REV = 0;
    $BUILD = 0;
    if ($MAJOR > 2) {
        if ($MINOR > 4) {
            $INCOMPATIBLE = false;
        }
    }
    if ($MAJOR == 0) {
        $INCOMPATIBLE = false;
    }
    if ($MAJOR == 4) {
        $INCOMPATIBLE = false;
    }
    if (preg_match("#^([0-9]+)\\.([0-9]+)\\.([0-9]+)#", $realsquidversion, $re)) {
        $REV = intval($re[3]);
    }
    if (preg_match("#^([0-9]+)\\.([0-9]+)\\.([0-9]+)-([0-9]+)-r([0-9]+)#", $realsquidversion, $re)) {
        $BUILD = intval($re[4] . $re[5]);
    }
    if ($SQUIDEnable == 1) {
        if ($INCOMPATIBLE) {
            $incompatible_proxy_version = $tpl->_ENGINE_parse_body("{incompatible_proxy_version}");
            $incompatible_proxy_version = str_replace("%s", $realsquidversion, $incompatible_proxy_version);
            $err[] = proxy_status_warning($incompatible_proxy_version, $incompatible_proxy_version, $LoadProxyUpdate);
        }
        $ArticaTechNetSquidRepo = unserialize(base64_decode($sock->GET_INFO("ArticaTechNetSquidRepo")));
        $NEWVER = null;
        while (list($key, $array) = each($ArticaTechNetSquidRepo)) {
            $AVVERSION = $array["VERSION"];
            $XREV = 0;
            $XBUILD = 0;
            preg_match("#^([0-9]+)\\.([0-9]+)#", $AVVERSION, $re);
            $XMAJOR = intval($re[1]);
            $XMINOR = intval($re[2]);
            if (preg_match("#^([0-9]+)\\.([0-9]+)\\.([0-9]+)#", $AVVERSION, $re)) {
                $XREV = intval($re[3]);
            }
            if (preg_match("#^([0-9]+)\\.([0-9]+)\\.([0-9]+)-([0-9]+)-r([0-9]+)#", $AVVERSION, $re)) {
                $XBUILD = intval($re[4] . $re[5]);
            }
            $KEY = intval("{$XMAJOR}{$XMINOR}{$XREV}{$XBUILD}");
            if ($MAJOR > $XMAJOR) {
                continue;
            }
            if ($GLOBALS["VERBOSE"]) {
                echo "<strong> squidver check {$XMAJOR}/{$XMINOR}/{$XREV}/{$XBUILD} - {$MAJOR}/{$MINOR}/{$REV}/{$BUILD}</strong>\n<br>";
            }
            if ($XMAJOR > $MAJOR) {
                if ($GLOBALS["VERBOSE"]) {
                    echo "<strong> squidver check {$XMAJOR}>{$MAJOR}</strong>\n<br>";
                }
                $NEWVER = $AVVERSION;
                break;
            }
            if ($XMAJOR == $MAJOR) {
                if ($XMINOR > $MINOR) {
                    $NEWVER = $AVVERSION;
                    break;
                }
            }
            if ($XMAJOR == $MAJOR) {
                if ($XMINOR == $MINOR) {
                    if ($XREV > $REV) {
                        $NEWVER = $AVVERSION;
                        break;
                    }
                }
            }
            if ($XMAJOR == $MAJOR) {
                if ($XMINOR == $MINOR) {
                    if ($XREV == $REV) {
                        if ($XBUILD > $BUILD) {
                            $NEWVER = $AVVERSION;
                            break;
                        }
                    }
                }
            }
        }
        if ($users->AsSquidAdministrator) {
            if ($NEWVER != null) {
                $INFOS[] = status_info_event("{SQUID_NEWVERSION} {$NEWVER}", "{SQUID_NEWVERSION_TEXT}", $LoadProxyUpdate);
            }
        }
    }
    if ($SquidUrgency == 1) {
        $jsOn = "Loadjs('squid.urgency.php?justbutton=yes')";
        if (!$users->AsSquidAdministrator) {
            $jsOn = "blur()";
        }
        $err[] = proxy_status_warning("{proxy_in_emergency_mode}", "{proxy_in_emergency_mode_explain}", $jsOn);
        $icon = "disks-128-red.png";
        //proxy_in_emergency_mode
        //proxy_in_emergency_mode_explain
    }
    if ($SquidSSLUrgency == 1) {
        $jsOn = "Loadjs('squid.urgency.php?ssl=yes');";
        if (!$users->AsSquidAdministrator) {
            $jsOn = "blur()";
        }
        $icon = "disks-128-red.png";
        $err[] = proxy_status_warning("{proxy_in_ssl_emergency_mode}", "{proxy_in_ssl_emergency_mode_explain}", $jsOn);
    }
    if ($MacToUidUrgency == 1) {
        $jsOn = "Loadjs('squid.urgency.php?justbutton=yes');";
        if (!$users->AsSquidAdministrator) {
            $jsOn = "blur()";
        }
        $icon = "disks-128-red.png";
        $err[] = proxy_status_warning("{proxy_in_MacToUid_emergency_mode}", "{proxy_in_MacToUid_emergency_mode_explain}", $jsOn);
    }
    if ($SQUIDEnable == 1) {
        if ($SquidUFDBUrgency == 1) {
            $jsOn = "Loadjs('squid.urgency.php?ufdb=yes');";
            if (!$users->AsSquidAdministrator) {
                $jsOn = "blur()";
            }
            $icon = "disks-128-red.png";
            $err[] = proxy_status_warning("{proxy_in_webfiltering_emergency_mode}", "{proxy_in_webfiltering_emergency_mode_explain}", $jsOn);
        }
        if ($EnableUfdbGuard == 1) {
            if ($users->CORP_LICENSE) {
                $ufdbguard_artica_cloud_version = ufdbguard_artica_cloud_version();
                if ($ufdbguard_artica_cloud_version == 0) {
                    $jsOn = "Loadjs('dansguardian2.articadb-progress.php')";
                    if (!$users->AsSquidAdministrator) {
                        $jsOn = "blur()";
                    }
                    $important_events[] = status_important_event("{update_webfiltering_artica_databases}", "{update_webfiltering_artica_databases_not_updated}", $jsOn);
                }
                if ($ufdbguard_artica_cloud_version > 1) {
                    $jsOn = "Loadjs('dansguardian2.articadb-progress.php')";
                    if (!$users->AsSquidAdministrator) {
                        $jsOn = "blur()";
                    }
                    $important_events[] = status_important_event("{webfiltering_artica_databases_available}", "{webfiltering_artica_databases_available_explain}", $jsOn);
                }
            }
            $ufdbguard_toulouse_cloud_version = ufdbguard_toulouse_cloud_version();
            if ($ufdbguard_toulouse_cloud_version == 0) {
                $jsOn = "Loadjs('dansguardian2.articadb-progress.php')";
                if (!$users->AsSquidAdministrator) {
                    $jsOn = "blur()";
                }
                $important_events[] = status_important_event("{update_webfiltering_toulouse_databases}", "{update_webfiltering_toulouse_databases_not_updated}", $jsOn);
            }
            if ($ufdbguard_toulouse_cloud_version > 1) {
                $jsOn = "Loadjs('dansguardian2.articadb-progress.php')";
                if (!$users->AsSquidAdministrator) {
                    $jsOn = "blur()";
                }
                $important_events[] = status_important_event("{webfiltering_toulouse_databases_available}", "{webfiltering_artica_databases_available_explain}", $jsOn);
            }
        }
    }
    if ($SQUIDEnable == 1) {
        if ($LogsWarninStop == 1) {
            $jsOn = "Loadjs('system.log.emergency.php');";
            if (!$users->AsSquidAdministrator) {
                $jsOn = "blur()";
            }
            $help = help_icon("{squid_logs_urgency}");
            $text = texttooltip("{squid_logs_urgency_section}", "{squid_logs_urgency}", $jsOn);
            $icon = "disks-128-red.png";
            $err[] = proxy_status_warning("{squid_logs_urgency_section}", "{squid_logs_urgency}", $jsOn);
        }
    }
    if ($SQUIDEnable == 1) {
        if ($IsPortsConverted == 0) {
            $jsOn = "Loadjs('squid.compile.progress.php');";
            if (!$users->AsSquidAdministrator) {
                $jsOn = "blur()";
            }
            $icon = "disks-128-warn.png";
            $err[] = proxy_status_warning("{IsPortsConverted_requested}", "{squid_IsPortsConverted_explain}", $jsOn);
        } else {
            if ($AsTransparent > 0) {
                $FireHolConfigured = intval($sock->GET_INFO("FireHolConfigured"));
                if ($FireHolConfigured == 0) {
                    $icon = "disks-128-warn.png";
                    $err[] = proxy_status_warning("{transparent_mode_issue}", "{squid_transparent_no_firewall}", $jsOn);
                }
            }
        }
    }
    $GoToCategoriesServiceA = "GoToCategoriesServiceA()";
    $GotoAdConnection = "GotoAdConnection()";
    $LoadMainDashProxy = "LoadMainDashProxy()";
    $GoToServices = "GoToServices()";
    $GoToUfdb = "GoToUfdb()";
    $GoToCaches = "GoToCaches()";
    $GoToCaches_underline = "underline";
    if (!$users->AsDansGuardianAdministrator) {
        $GoToCategoriesServiceA = "blur()";
        $GoToUfdb = "blur()";
    }
    if (!$users->AsSquidAdministrator) {
        $GotoAdConnection = "blur()";
        $LoadMainDashProxy = "blur()";
        $GoToServices = "blur()";
        $GoToCaches = "blur()";
        $GoToCaches_underline = "none";
    }
    if ($SQUIDEnable == 1) {
        $catz = new mysql_catz();
        if ($catz->UfdbCatEnabled == 1) {
            $categories = $catz->ufdbcat("google.com");
            if (!$catz->ok) {
                $icon = "disks-128-warn.png";
                $err[] = proxy_status_warning("{APP_UFDBCAT}: {connection_error}", $catz->mysql_error, $GoToCategoriesServiceA);
            }
        }
    }
    if ($SQUIDEnable == 1) {
        if ($sock->SQUID_IS_EXTERNAL_LDAP()) {
            $tests = CHECK_SQUID_EXTERNAL_LDAP();
            if ($tests != null) {
                $err[] = proxy_status_warning("{$tests}", "{$tests}", "GotoOpenldap()");
            }
        }
    }
    if ($BasicAuthenticatorEmergency == 1) {
        $jsOn = "Loadjs('squid.urgency.php?justbutton=yes');";
        if (!$users->AsSquidAdministrator) {
            $jsOn = "blur()";
        }
        $icon = "disks-128-warn.png";
        $err[] = proxy_status_warning("{authentication_emergency_mode}", "{authentication_emergency_mode_explain}", $jsOn);
    }
    if ($SQUIDEnable == 1) {
        if ($EnableKerbAuth == 1) {
            if ($ActiveDirectoryEmergency == 1) {
                $jsOn = "Loadjs('squid.urgency.php?activedirectory=yes');";
                if (!$users->AsSquidAdministrator) {
                    $jsOn = "blur()";
                }
                $icon = "disks-128-warn.png";
                $err[] = proxy_status_warning("{activedirectory_emergency_mode}", "{activedirectory_emergency_mode_explain}", $jsOn);
            }
            if (!$users->CORP_LICENSE) {
                $Days = 86400 * 30;
                $DayToLeft = 30;
                if (is_file("/usr/share/artica-postfix/ressources/class.pinglic.inc")) {
                    include_once "/usr/share/artica-postfix/ressources/class.pinglic.inc";
                    $EndTime = $GLOBALS['ADLINK_TIME'] + $Days;
                    $seconds_diff = $EndTime - time();
                    $DayToLeft = floor($seconds_diff / 3600 / 24);
                }
                $MAIN_ERROR = $tpl->_ENGINE_parse_body("{warn_no_license_activedirectory_30days}");
                $MAIN_ERROR = str_replace("%s", $DayToLeft, $MAIN_ERROR);
                $important_events[] = status_important_event($MAIN_ERROR, $MAIN_ERROR, $jsOn);
            }
            if ($ActiveDirectoryEmergency == 0) {
                $IsConnected = IsKerconnected();
                if ($IsConnected != "TRUE") {
                    $err[] = proxy_status_warning("{proxy_is_not_configured_ad}", null, $GotoAdConnection);
                }
            }
            $TestLDAPAD = TestLDAPAD();
            if ($TestLDAPAD != null) {
                $err[] = $TestLDAPAD;
            }
            $AdminAsSeenNTLMPerfs = intval($sock->GET_INFO("AdminAsSeenNTLMPerfs"));
            if ($AdminAsSeenNTLMPerfs == 0) {
                $err[] = proxy_status_warning("{NTLM_PERFORMANCES_NOT_DEFINED}", null, $GotoAdConnection);
            }
        }
    }
    if ($EnableeCapClamav == 1) {
        if ($eCAPClamavEmergency == 1) {
            $jsOn = "Loadjs('squid.urgency.php?eCAPClamavEmergency=yes');";
            if (!$users->AsSquidAdministrator) {
                $jsOn = "blur()";
            }
            $icon = "disks-128-warn.png";
            $err[] = proxy_status_warning("{eCAPClamav_emergency_mode}", "{activedirectory_emergency_mode_explain}", $jsOn);
        }
    }
    if ($ParanoidBlockerEmergency == 1) {
        $jsOn = "Loadjs('squid.urgency.php?ParanoidBlockerEmergency=yes');";
        if (!$users->AsSquidAdministrator) {
            $jsOn = "blur()";
        }
        $icon = "disks-128-warn.png";
        $err[] = proxy_status_warning("{paranoid_emergency_mode}", "{paranoid_emergency_mode_explain}", $jsOn);
    }
    if ($SquidCacheFullHideWarn == 0) {
        if ($COUNT_DE_CACHES > 0) {
            if ($CACHES_AVG > 85) {
                $err[] = proxy_status_warning("{caches_are_full}", "{caches_are_full_explain}", $GoToCaches);
            }
        }
    }
    if ($COUNT_DE_CACHES > 0) {
        $COUNT_DE_MEMBERS = intval(@file_get_contents("{$GLOBALS["BASEDIR"]}/MEMBERS_COUNT"));
        if ($COUNT_DE_MEMBERS > 15) {
            if ($COUNT_DE_CACHES < 20000) {
                $undersized_proxy_caches_explain = $tpl->_ENGINE_parse_body("{undersized_proxy_caches_explain}");
                $COUNT_DE_CACHES_KB = $COUNT_DE_CACHES * 1024;
                $COUNT_DE_CACHES_TEXT = FormatBytes($COUNT_DE_CACHES_KB);
                $undersized_proxy_caches_explain = str_replace("%S", $COUNT_DE_CACHES_TEXT, $undersized_proxy_caches_explain);
                $undersized_proxy_caches_explain = str_replace("%U", $COUNT_DE_MEMBERS, $undersized_proxy_caches_explain);
                if ($SquidCacheLevel > 0) {
                    $err[] = proxy_status_warning("{undersized_proxy_caches}", $undersized_proxy_caches_explain, $GoToCaches);
                }
            }
        }
    }
    if (!$users->AsSquidAdministrator) {
        $err = array();
    }
    if (count($err) > 0) {
        $errT[] = "<tr><td style='font-size:32px;color:#d32d2d;vertical-align:middle'>" . count($err) . " {issues}</td></tr>\n\t\t<tr><td colspan=2>&nbsp;</td></tr>\t\n\t\t\t\t";
    }
    $ActiveRequestsR = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/active_requests.inc"));
    $ActiveRequestsNumber = count($ActiveRequestsR["CON"]);
    $ActiveRequestsIpaddr = count($ActiveRequestsR["IPS"]);
    $ActiveRequestsMembers = count($ActiveRequestsR["USERS"]);
    $GotoParanoidMode = "GotoParanoidMode()";
    $GotoParanoidMode_underline = "underline";
    $GoToUfdb_underline = "underline";
    if (!$users->AsDansGuardianAdministrator) {
        $GotoParanoidMode = "blur()";
        $GoToUfdb = "blur()";
        $GotoParanoidMode_underline = "none";
        $GoToUfdb_underline = "none";
    }
    $UfdbEnableParanoidMode = intval($sock->GET_INFO("UfdbEnableParanoidMode"));
    if ($UfdbEnableParanoidMode == 1) {
        $q = new mysql_squid_builder();
        $webfilters_paranoid = $q->COUNT_ROWS("webfilters_paranoid");
        if ($webfilters_paranoid > 0) {
            $webfilters_paranoid_text = "\n\t\t<tr>\n\t\t<td style='font-size:20px'>\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:{$GotoParanoidMode}\"\n\t\tstyle='text-decoration:{$GotoParanoidMode_underline}'>{paranoid_mode}: " . FormatNumber($webfilters_paranoid) . " {rules}</a></td>\n\t\t</tr>";
        }
    }
    if ($EnableUfdbGuard == 1) {
        if ($COUNT_DE_BLOCKED > 0) {
            $WebFiltering_blocked = "\n\t\t<tr>\n\t\t<td style='font-size:20px'>\n\t\t<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:{$GoToUfdb}\"\n\t\tstyle='text-decoration:{$GoToUfdb_underline}'>{blocked_events}: " . FormatNumber($COUNT_DE_BLOCKED) . "</a></td>\n\t\t</tr>";
        }
    }
    if (intval($ini->_params["SQUID"]["service_disabled"]) == 1) {
        if ($ini->_params["SQUID"]["running"] == 0) {
            $icon = "disks-128-red.png";
        }
    }
    $mgr_client_list_TR = "\n\t\t<tr>\n\t\t\t<td style='font-size:20px'>\n\t\t\t<a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:GotoMgrClientList()\"\n\t\t\tstyle='text-decoration:underline'>{active_clients}: " . FormatNumber($SNMP_WALK["CLIENTS_NUMBER"]) . "</a></td>\n\t\t</tr>";
    $active_resquests_js = "Loadjs('squid.active.requests.php')";
    $active_resquests_underline = "underline";
    if (!$users->AsSquidAdministrator) {
        $active_resquests_js = "blur()";
        $active_resquests_underline = "none";
    }
    if ($ActiveRequestsNumber > 1) {
        $active_resquests = "\n\t\t<tr>\n\t\t\t<td style='font-size:20px'>\n\t\t\t<a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:{$active_resquests_js}\"\n\t\t\tstyle='text-decoration:underline'>{active_requests}: {$ActiveRequestsNumber}</a></td>\n\t\t</tr>";
    }
    if (intval($WATCHDOG_COUNT_EVENTS) > 0) {
        $important_events[] = status_important_event("{$WATCHDOG_COUNT_EVENTS} {important_events_48h}", null, "GotoWatchdog()");
    }
    $CACHES_AVG_COLOR = "black";
    if ($CACHES_AVG > 85) {
        if ($SquidCacheFullHideWarn == 0) {
            $CACHES_AVG_COLOR = "#d32d2d";
        }
    }
    if (count($important_events) > 0) {
        $important_events_text = "<tr><td colspan=2>&nbsp;</td></tr>" . @implode("\n", $important_events);
    }
    if ($SQUIDEnable == 0) {
        $icon = "disks-128-ok-grey.png";
    }
    if (count($INFOS) > 0) {
        $INFOS[] = "<tr><td><br></td></tr>";
    }
    if ($SquidCacheLevel == 0) {
        $SNMP_WALK["PERC_CACHE"] = 0;
        $SNMP_WALK["STORED_OBJECTS"] = 0;
    }
    $prec = intval($SNMP_WALK["PERC_CACHE"]);
    if ($prec > 0) {
        $perc_cache = "\n\t\t<tr>\n\t\t\t<td style='font-size:18px;vertical-align:middle'>{$prec}% {cache} ({currently})</td>\n\t\t</tr>";
    }
    $REQUESTS = intval($SNMP_WALK["REQUESTS"]);
    if ($REQUESTS > 0) {
        $current_req = "<tr>\n\t\t<td style='font-size:18px;vertical-align:middle'>" . FormatNumber($REQUESTS) . " {requests}</td>\n\t\t</tr>";
    }
    if ($SNMP_WALK["CPU"] > 0) {
        $current_cpu_use = "<tr>\n\t\t<td style='font-size:18px;vertical-align:middle'>{$SNMP_WALK["CPU"]}% {cpu_use}</td>\n\t\t</tr>";
    }
    $windowsUpdate = null;
    if ($WindowsUpdateCaching == 1) {
        $cacheFile = "/usr/share/artica-postfix/ressources/logs/web/WindowsUpdate.state";
        $ARRAY = unserialize(@file_get_contents($cacheFile));
        if (intval($ARRAY["SIZEKB"]) > 4) {
            $windowsUpdate = "\n\t\t\t<tr>\n\t\t\t<td style='font-size:18px;vertical-align:middle'> \n\t\t\t<a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:GotoWindowsUpdate()\"\n\t\t\tstyle='text-decoration:underline'>Windows Update:</a> " . FormatBytes($ARRAY["SIZEKB"]) . "</td>\n\t\t\t</tr>";
        }
    }
    $HTTrack = null;
    if ($HTTrackInSquid == 1) {
        $HTTRackSize = $sock->GET_INFO("HTTRackSize");
        if ($HTTRackSize > 0) {
            $HTTrack = "\n\t\t\t<tr>\n\t\t\t<td style='font-size:18px;vertical-align:middle'>\n\t\t\t<a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:GotoWebCopy()\"\n\t\t\tstyle='text-decoration:underline'>WebCopy:</a> " . FormatBytes($HTTRackSize / 1024) . "</td>\n\t\t\t</tr>";
        }
    }
    if ($SNMP_WALK["STORED_OBJECTS"] > 0) {
        $current_stored_objects = "<tr>\n\t\t<td style='font-size:18px;vertical-align:middle'>" . FormatNumber($SNMP_WALK["STORED_OBJECTS"]) . " {stored_objects}</td>\n\t\t</tr>";
    }
    if ($SquidCacheLevel > 0) {
        if ($COUNT_DE_CACHES_TEXT != null) {
            $INFO_STORAGE_CACHE = "\n\t\t\t<tr>\n\t\t\t<td style='font-size:20px'>\n\t\t\t\t\t<a href=\"javascript:blur();\"\n\t\t\t\t\tOnClick=\"{$GoToCaches}\"\n\t\t\t\t\tstyle='text-decoration:{$GoToCaches_underline};color:{$CACHES_AVG_COLOR}'>\n\t\t\t\t\t\t{storage}: {$CACHES_AVG}%&nbsp;/&nbsp;{$COUNT_DE_CACHES_TEXT}</a>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>";
        }
    }
    $CACHED_DETAILS_TOTAL = null;
    $NOT_CACHED_DETAILS_TOTAL = null;
    if ($TOTALS_CACHED > 0) {
        $CACHED_DETAILS_TOTAL = "\n\t\t<tr>\n\t\t\t<td style='font-size:18px'>\n\t\t\t\t\t<a href=\"javascript:blur();\"\n\t\t\t\t\tOnClick=\"{$GoToCaches}\"\n\t\t\t\t\tstyle='text-decoration:{$GoToCaches_underline};color:black'>\n\t\t\t\t\t\t{cached}: " . FormatBytes($TOTALS_CACHED / 1024) . "</a>\n\t\t\t</td>\n\t\t</tr>\n\t";
    }
    if ($TOTALS_NOT_CACHED > 0) {
        $NOT_CACHED_DETAILS_TOTAL = "\n\t\t<tr>\n\t\t\t<td style='font-size:18px'>\n\t\t\t\t\t<a href=\"javascript:blur();\"\n\t\t\t\t\tOnClick=\"{$GoToCaches}\"\n\t\t\t\t\tstyle='text-decoration:{$GoToCaches_underline};color:black'>\n\t\t\t\t\t\t{not_cached}: " . FormatBytes($TOTALS_NOT_CACHED / 1024) . "</a>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t";
    }
    if (!$users->AsSquidAdministrator) {
        $important_events_text = null;
        $errT = array();
        $windowsUpdate = null;
        $mgr_client_list_TR = null;
    }
    $icon = imgtootltip($icon, "position:right:{configure_your_proxy}", "{$LoadMainDashProxy}");
    $html = "\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top' style='width:128px' >\n\t\t\t{$icon}\n\t\t\t<div id='active-directory-dash-infos'>" . active_directory_infos() . "</div>\t\n\t\t</td>\n\t\t<td>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td style='font-size:30px'>\n\t\t\t\t" . texttooltip("{your_proxy}", "{configure_your_proxy}", "{$LoadMainDashProxy}") . "\n\t\t\t\t&nbsp;<span style='font-size:22px'>[&nbsp;<a href=\"javascript:blur();\" \n\t\t\t\tOnClick=\"javascript:Loadjs('squid.infos.php');\"\n\t\t\t\tstyle='text-decoration:underline'>Infos.</a>&nbsp;]</span>\t\t\n\t\t\t\t\t\t\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<!-- perc_cache -->\n\t\t\t{$perc_cache}\n\t\t\t<!-- TOTALS_CACHED:{$TOTALS_CACHED} -->\n\t\t\t{$CACHED_DETAILS_TOTAL}\n\t\t\t<!-- TOTALS NOT CACHED:{$TOTALS_NOT_CACHED} -->\n\t\t\t{$NOT_CACHED_DETAILS_TOTAL}\n\t\t\t<!-- windowsUpdate -->\n\t\t\t{$windowsUpdate}\n\t\t\t<!-- HTTrack -->\n\t\t\t{$HTTrack}\n\t\t\t<!-- current_req -->\n\t\t\t{$current_req}\n\t\t\t<!-- SUM_FAMILYSITES_TEXT -->\n\t\t\t{$SUM_FAMILYSITES_TEXT}\n\t\t\n\t\t\t{$active_resquests}\n\t\t\t{$mgr_client_list_TR}\n\t\t\t{$rqs}\n\t\t\t\t" . @implode("", $ntmlauthenticators_array) . "\n\t\t\t\n\t\t\t\n\t\t<!-- WebFiltering_blocked -->\n\t\t{$WebFiltering_blocked}\n\t\t<!-- webfilters_paranoid -->\n\t\t{$webfilters_paranoid_text}\t\n\t\t<!-- INFO_STORAGE_CACHE -->\n\t\t{$INFO_STORAGE_CACHE}\n\t\t\n\t\t\n\t\t\n\t<!-- current_stored_objects -->\n\t\t\t{$current_stored_objects}\n\t<!-- TITLE_REQUESTS -->\n\t\t\t{$TITLE_REQUESTS}\n\t<!-- TOP_GRAPHS -->\n\t\t\t" . TOP_GRAPHS() . "\n\t\t\t{$CountDeServices}\n\t\t\t" . @implode("", $INFOS) . "\n\t\t\t" . @implode("", $errT) . "\n\t\t\t" . @implode("", $err) . "\n\t\t\t{$important_events_text}\n\t\t\t\n\t\t\t</table>\n\t\t</td>\n\t</tr>\n\t</table>\n\t<script>\n\t\tLoadAjaxSilent('proxy_dashboard_counters','{$page}?proxy_dashboard_counters=yes');\n\t</script>\n\t";
    $html = $tpl->_ENGINE_parse_body($html);
    if (!is_dir("/usr/share/artica-postfix/ressources/interface-cache")) {
        @mkdir("/usr/share/artica-postfix/ressources/interface-cache");
    }
    @file_put_contents($cachefile, $html);
    return $html;
}
Ejemplo n.º 17
0
function parseTemplate_sendemail_perform($smtp_sender = null, $ARRAY, $ticket = false, $SquidGuardIPWeb = null)
{
    ini_set('html_errors', 0);
    ini_set('display_errors', 1);
    ini_set('error_reporting', E_ALL);
    ini_set('error_prepend_string', '');
    ini_set('error_append_string', '');
    include_once dirname(__FILE__) . '/ressources/class.templates.inc';
    include_once dirname(__FILE__) . '/ressources/class.ldap.inc';
    include_once dirname(__FILE__) . '/ressources/class.users.menus.inc';
    include_once dirname(__FILE__) . "/ressources/class.sockets.inc";
    include_once dirname(__FILE__) . "/ressources/class.mysql.inc";
    include_once dirname(__FILE__) . "/ressources/class.mysql.squid.builder.php";
    if (!$ticket) {
        if ($smtp_sender == null) {
            $tpl = new templates();
            return $tpl->_ENGINE_parse_body("{give_your_email_address}");
        }
    }
    $main_array = base64_encode(serialize($ARRAY));
    $tpl = new templates();
    $HOST = $ARRAY["HOST"];
    $clientname = $ARRAY["clientname"];
    if ($clientname != null) {
        $clientname = "/{$clientname}";
    }
    $Subject = "Web filter request from an user: {$HOST}{$clientname}";
    $zDate = date('Y-m-d H:i:s');
    $q = new mysql_squid_builder();
    $URL = $ARRAY["URL"];
    $REASONGIVEN = $ARRAY["REASONGIVEN"];
    unset($ARRAY["SquidGuardIPWeb"]);
    unset($ARRAY["URL"]);
    unset($ARRAY["REASONGIVEN"]);
    while (list($a, $b) = each($ARRAY)) {
        $body[] = "{$a}\t:{$b}";
    }
    $text = mysql_escape_string2(@implode($body, "\r\n"));
    $Subject = mysql_escape_string2($Subject);
    $URL = mysql_escape_string2($URL);
    $REASONGIVEN = mysql_escape_string2($REASONGIVEN);
    $md5 = md5(serialize($ARRAY) . "{$Subject} {$smtp_sender}");
    $ticket_val = 0;
    if ($ticket) {
        $ticket_val = 1;
    }
    $tablename = "ufdb_smtp";
    if ($q->COUNT_ROWS("ufdb_smtp") == 0) {
        $q->QUERY_SQL("DROP TABLE ufdb_smtp");
    }
    $sql = "CREATE TABLE IF NOT EXISTS `ufdb_smtp` (\n\t`zmd5` varchar(90) NOT NULL,\n\t`zDate` datetime NOT NULL,\n\t`Subject` varchar(255) NOT NULL,\n\t`content` varchar(255) NOT NULL,\n\t`main_array` TEXT,\n\t`URL` varchar(255) NOT NULL,\n\t`REASONGIVEN` varchar(255) NOT NULL,\n\t`sender` varchar(128) NOT NULL,\n\t`retrytime` smallint(1) NOT NULL,\n\t`ticket` smallint(1) NOT NULL,\n\t`SquidGuardIPWeb` varchar(255),\n\tPRIMARY KEY (`zmd5`),\n\tKEY `zDate` (`zDate`),\n\tKEY `Subject` (`Subject`),\n\tKEY `sender` (`sender`),\n\tKEY `ticket` (`ticket`),\n\tKEY `retrytime` (`retrytime`)\n\t\n\t) ENGINE=MYISAM;";
    $q->QUERY_SQL($sql);
    if (!$q->ok) {
        writelogs("{$q->mysql_error}", __FUNCTION__, __FILE__, __LINE__);
        echo $q->mysql_error;
        return;
    }
    if (!$q->FIELD_EXISTS("ufdb_smtp", "SquidGuardIPWeb")) {
        $q->QUERY_SQL("ALTER TABLE `ufdb_smtp` ADD `SquidGuardIPWeb` varchar(255)");
    }
    if (!$q->FIELD_EXISTS("ufdb_smtp", "ticket")) {
        $q->QUERY_SQL("ALTER TABLE `ufdb_smtp` ADD `ticket` smallint(1) NOT NULL");
    }
    if (!$q->FIELD_EXISTS("ufdb_smtp", "main_array")) {
        $q->QUERY_SQL("ALTER TABLE `ufdb_smtp` ADD `main_array` TEXT");
    }
    $q->QUERY_SQL("INSERT IGNORE INTO ufdb_smtp (`zmd5`,`zDate`,`Subject`,`content`,`sender`,`URL`,\n\t\t\t`REASONGIVEN`,`retrytime`,`SquidGuardIPWeb`,`ticket`,`main_array`) VALUES\n\t\t\t('{$md5}',NOW(),'{$Subject}','{$text}','{$smtp_sender}','{$URL}','{$REASONGIVEN}','0','{$SquidGuardIPWeb}','{$ticket_val}','{$main_array}')");
    if (!$q->ok) {
        writelogs("{$q->mysql_error}", __FUNCTION__, __FILE__, __LINE__);
        return $q->mysql_error_html();
        return false;
    }
    $sock = new sockets();
    $sock->getFrameWork("squidguardweb.php?smtp-notifs=yes");
    $tpl = new templates();
    return $tpl->_ENGINE_parse_body("{your_query_was_sent_to_administrator}");
    return true;
}
Ejemplo n.º 18
0
function page()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $t = time();
    $title = null;
    echo "<div style='float:right;margin:5px;margin-top:5px'>" . button($tpl->_ENGINE_parse_body("{build_the_query}"), "Loadjs('{$page}?requeteur-js=yes&t={$t}')", 16) . "</div>";
    $content = "<center style='margin:50px'>" . button("{build_the_query}", "Loadjs('{$page}?requeteur-js=yes&t={$t}')", 42) . "</center>";
    $q = new mysql_squid_builder();
    $q->CheckReportTable();
    if ($_GET["zmd5"] == null) {
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT title,zmd5 FROM reports_cache WHERE report_type='MEMBERS' ORDER BY zDate DESC LIMIT 0,1"));
        if (!$q->ok) {
            echo $q->mysql_error_html();
        }
    } else {
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT title,zmd5 FROM reports_cache WHERE zmd5='{$_GET["zmd5"]}'"));
    }
    if ($ligne["zmd5"] != null) {
        $nextFunction = "LoadAjax('table-{$t}','{$page}?table1=yes&zmd5={$ligne["zmd5"]}');";
        $title = "<div style='font-size:30px;margin-bottom:20px'>" . $tpl->javascript_parse_text($ligne["title"]) . "</div>";
        $content = "<center><img src=img/loader-big.gif></center>";
    }
    $html = "{$title}<div style='width:99%;margin-bottom:10px' id='table-{$t}'>{$content}</div>\t\n\n\t\n\t\n<script>\n\tLoadAjaxTiny('stats-requeteur','{$page}?stats-requeteur=yes&t={$t}');\n\t{$nextFunction}\n</script>";
    echo $tpl->_ENGINE_parse_body($html);
}
function flow_day(){
	$page=CurrentPageName();
	$q=new mysql_squid_builder();
	$date=date("Ym",$_GET["time"]);
	$sql="SELECT SUM(hits) as hits,SUM(size) as size,{$_GET["field"]},DAY(zDate) as tday 
	FROM {$date}_maccess GROUP BY {$_GET["field"]},tday HAVING {$_GET["field"]}='{$_GET["value"]}' ORDER BY tday";
	$time=time();
	
	$results = $q->QUERY_SQL($sql,"artica_events");
	
	if(!$q->ok){
		echo FATAL_ERROR_SHOW_128($q->mysql_error_html());
		return;
		
	}
	
	
	if(mysql_num_rows($results)<2){
		echo FATAL_ERROR_SHOW_128("{request_is_less_2}");
		return;
		
	}
	
	while ($ligne = mysql_fetch_assoc($results)) {
		$value1[$ligne["tday"]]=round($ligne["size"]/1024);
		$value2[$ligne["tday"]]=$ligne["hits"];
	}
	
	$value1_enc=urlencode(base64_encode(serialize($value1)));
	$value2_enc=urlencode(base64_encode(serialize($value2)));
	
	$f1[]="<div style='width:955px;height:340px' id='$time-2'></div>";
	$f1[]="<div style='width:955px;height:340px' id='$time-3'></div>";
	
	
	$f2[]="function FDeux$time(){
		LoadjsSilent('$page?container=$time-2&flow-month-graph1=yes&serialize=$value1_enc',false);
	}
	setTimeout(\"FDeux$time()\",500);";
	

	$f2[]="function F3$time(){
	LoadjsSilent('$page?container=$time-3&flow-month-graph2=yes&serialize=$value2_enc',false);
	}
	setTimeout(\"F3$time()\",500);";
	
	
	echo @implode("\n", $f1);
	echo "<script>".@implode("\n", $f2)."</script>";
}
function flow_day(){
	$page=CurrentPageName();
	$q=new mysql_squid_builder();
	$tpl=new templates();
	
	
	$time_text=$tpl->_ENGINE_parse_body($q->time_to_date($_GET["time"]));
	
	$date=date("Ym",$_GET["time"]);
	$zdate=date("Y-m-d",$_GET["time"]);
	$sql="SELECT SUM(hits) as hits,SUM(size) as size,{$_GET["field"]},`hour` as hour,zDate 
	FROM {$date}_maccess GROUP BY {$_GET["field"]},zDate,`hour` 
	HAVING {$_GET["field"]}='{$_GET["value"]}' AND `zDate`='$zdate' ORDER BY `hour`";
	$time=time();
	
	$results = $q->QUERY_SQL($sql,"artica_events");
	
	echo $tpl->_ENGINE_parse_body("<div style='font-size:22px;margin-bottom:20px'>$time_text</div>");
	
	if(!$q->ok){
		echo FATAL_ERROR_SHOW_128($q->mysql_error_html()."<hr>$sql");
		return;
		
	}
	
	
	if(mysql_num_rows($results)<2){
		echo FATAL_ERROR_SHOW_128("{request_is_less_2}");
		return;
		
	}
	
	while ($ligne = mysql_fetch_assoc($results)) {
		$value1[$ligne["hour"]]=round($ligne["size"]/1024);
		$value2[$ligne["hour"]]=$ligne["hits"];
	}
	
	$value1_enc=urlencode(base64_encode(serialize($value1)));
	$value2_enc=urlencode(base64_encode(serialize($value2)));
	
	$f1[]="
	
	<div style='width:955px;height:340px' id='$time-2'></div>";
	$f1[]="<div style='width:955px;height:340px' id='$time-3'></div>";
	
	
	$f2[]="function FDeux$time(){
		LoadjsSilent('$page?container=$time-2&flow-month-graph1=yes&serialize=$value1_enc',false);
	}
	setTimeout(\"FDeux$time()\",500);";
	

	$f2[]="function F3$time(){
	LoadjsSilent('$page?container=$time-3&flow-month-graph2=yes&serialize=$value2_enc',false);
	}
	setTimeout(\"F3$time()\",500);";
	
	
	echo @implode("\n", $f1);
	echo "<script>".@implode("\n", $f2)."</script>";
}
Ejemplo n.º 21
0
function websites_script_DenyConfSave()
{
    $q = new mysql_squid_builder();
    if (!$q->FIELD_EXISTS("reverse_www", "DenyConf")) {
        $q->QUERY_SQL("ALTER TABLE `reverse_www` ADD `DenyConf` smallint(1) NOT NULL DEFAULT 0");
        if (!$q->ok) {
            echo $q->mysql_error_html();
        }
    }
    $q->QUERY_SQL("UPDATE reverse_www SET `DenyConf`='{$_POST["DenyConfSave"]}' WHERE `servername`='{$_POST["servername"]}'");
    if (!$q->ok) {
        echo $q->mysql_error;
    }
}
function topmembers_table_search()
{
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $boot = new boostrap_form();
    $q = new mysql_squid_builder();
    $sock = new sockets();
    $fontsize = "14px";
    $page = 1;
    $t = time();
    $ORDER = $boot->TableOrder(array("size" => "DESC"));
    $searchstring = string_to_flexquery("topmembers-search");
    $year = $_GET["year"];
    $month = $_GET["month"];
    $familysite = mysql_escape_string2($_GET["familysite"]);
    $table = "quotamonth_{$year}{$month}";
    $table = "(SELECT `uid`,familysite,SUM(size) as `size` FROM {$table} GROUP BY `uid`,familysite \n\tHAVING familysite='{$familysite}' ORDER BY `size` DESC LIMIT 0,50) as t";
    $size_text = $tpl->_ENGINE_parse_body("{size}");
    $members_text = $tpl->_ENGINE_parse_body("{members}");
    $websites_text = $tpl->_ENGINE_parse_body("{websites}");
    $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} ORDER BY {$ORDER} LIMIT 0,20";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo $q->mysql_error_html();
    }
    $suffix = suffix();
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        $color = "black";
        $size = FormatBytes($ligne["size"] / 1024);
        $websiteenc = urlencode($ligne["familysite"]);
        $js = $boot->trswitch("Loadjs('miniadm.webstats.popup.ByMonthByUserByFamilysite.php?uid={$ligne["uid"]}{$suffix}')");
        $tr[] = "\n\t\t<tr>\n\t\t<td style='font-size:18px;color:{$color}' nowrap  width=99% nowrap {$js}>{$ligne["uid"]}</td>\n\t\t<td style='font-size:18px;color:{$color}' nowrap  width=1% nowrap {$js}>{$size}</td>\n\t\t</tr>";
    }
    echo $boot->TableCompile(array("uid" => "{$members_text}", "size" => "{$size_text}"), $tr);
}
function page()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $t = time();
    $title = null;
    $q = new mysql_squid_builder();
    $q->CheckReportTable();
    if ($_GET["zmd5"] == null) {
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT title,zmd5 FROM reports_cache WHERE report_type='MEMBERS' ORDER BY zDate DESC LIMIT 0,1"));
        if (!$q->ok) {
            echo $q->mysql_error_html();
        }
        $_GET["zmd5"] = $ligne["zmd5"];
    }
    $nextFunction = "LoadAjax('table-{$t}','{$page}?table1=yes&zmd5={$_GET["zmd5"]}');";
    $content = "<center><img src=img/loader-big.gif></center>";
    $html = "{$title}<div style='width:99%;margin-bottom:10px' id='table-{$t}'>{$content}</div>\t\n\n\t\n\t\n<script>\n\t{$nextFunction}\n</script>";
    echo $tpl->_ENGINE_parse_body($html);
}
Ejemplo n.º 24
0
function items_list()
{
    //ini_set('html_errors',0);ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string','');ini_set('error_append_string','');
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $q = new mysql();
    $q2 = new mysql_squid_builder();
    $ID = $_GET["aclid"];
    $t0 = $_GET["t"];
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT dscp FROM `qos_containers` WHERE ID='{$ID}'", "artica_backup"));
    $dscp = unserialize($ligne["dscp"]);
    $page = 1;
    $ayDscp = array(0 => '0x00', 8 => '0x20', 10 => '0x28', 12 => '0x30', 14 => '0x38', 16 => '0x40', 18 => '0x48', 20 => '0x50', 22 => '0x58', 24 => '0x60', 26 => '0x68', 28 => '0x70', 30 => '0x78', 32 => '0x80', 34 => '0x88', 36 => '0x90', 38 => '0x98', 40 => '0xA0', 46 => '0xB8', 48 => '0xC0', 56 => '0xE0');
    $data = array();
    $data['page'] = 1;
    $data['total'] = count($ayDscp);
    $data['rows'] = array();
    while (list($num, $ligne) = each($ayDscp)) {
        $acls = array();
        $results = $q2->QUERY_SQL("SELECT aclid FROM webfilters_sqaclaccess WHERE httpaccess='tcp_outgoing_tos' AND httpaccess_value='1' and httpaccess_data='{$num}'");
        if (!$q2->ok) {
            $acls[] = $q2->mysql_error_html();
        }
        while ($ligneZ = mysql_fetch_assoc($results)) {
            $aclid = $ligneZ["aclid"];
            $ligneZZ = mysql_fetch_array($q2->QUERY_SQL("SELECT aclname FROM webfilters_sqacls WHERE ID='{$aclid}'"));
            if (!$q2->ok) {
                $acls[] = $q2->mysql_error_html();
                continue;
            }
            $acls[] = "<i style='font-size:16px'>Proxy: [{$aclid}] {$ligneZZ["aclname"]}</i>";
        }
        $value = 0;
        if (isset($dscp[$num])) {
            $value = 1;
        }
        $negation = Field_checkbox("enable-{$num}", 1, $value, "ChangeDCSP('{$num}')");
        $data['rows'][] = array('id' => "{$num}", 'cell' => array("<span style='font-size:22px;font-weight:bold'>{$num} ({$ligne})</span>&nbsp;" . @implode("<br>", $acls), $negation));
    }
    echo json_encode($data);
}
function items_search()
{
    $page = CurrentPageName();
    $boot = new boostrap_form();
    $tpl = new templates();
    $searchstring = string_to_flexquery("items-search");
    $ORDER = $boot->TableOrder(array("token" => "ASC"));
    $limitSql = "LIMIT 0,150";
    $sql = "SELECT *  FROM nginx_exploits_items WHERE groupid={$_GET["groupid"]} {$searchstring}  ORDER BY {$ORDER} {$limitSql}";
    $q = new mysql_squid_builder();
    $results = $q->QUERY_SQL($sql);
    $sock = new sockets();
    $not = $tpl->_ENGINE_parse_body("{is_not}");
    if (!$q->ok) {
        echo $q->mysql_error_html();
    }
    while ($ligne = mysql_fetch_assoc($results)) {
        $reverse = null;
        if ($ligne["reverse"] == 1) {
            $reverse = "<strong>{$not}</strong>&nbsp;";
        }
        $linkipaddr = $boot->trswitch("Loadjs('{$page}?js-item=yes&ID={$ligne["ID"]}&groupid={$ligne["groupid"]}&servername={$_GET["servername"]}')");
        $ligne["token"] = $tpl->_ENGINE_parse_body("{{$ligne["token"]}}");
        $delete = imgsimple("delete-24.png", null, "Loadjs('{$page}?delete-item-js={$ligne["ID"]}&ID={$ligne["ID"]}')");
        $tr[] = "\n\t<tr id='{$ligne["ID"]}'>\n\t<td {$linkipaddr} width='30%' nowrap><i class='icon-list-alt'></i> {$ligne["token"]}</a></td>\n\t<td {$linkipaddr} width='70%' nowrap><i class='icon-list-alt'></i> {$reverse}{$ligne["pattern"]}</a></td>\n\t<td style='text-align:center' width='24px' nowrap>{$delete}</td>\n\t</tr>";
    }
    $html = $boot->TableCompile(array("token" => "{token}", "pattern" => "{pattern}", "delete" => "{delete}"), $tr);
    echo $tpl->_ENGINE_parse_body($html);
}
Ejemplo n.º 26
0
function table()
{
    $sock = new sockets();
    $EnableSquidGuardHTTPService = $sock->GET_INFO("EnableSquidGuardHTTPService");
    if (!is_numeric($EnableSquidGuardHTTPService)) {
        $EnableSquidGuardHTTPService = 1;
    }
    if ($EnableSquidGuardHTTPService == 0) {
        echo FATAL_ERROR_SHOW_128("{web_page_service_is_disabled}");
        die;
    }
    $q = new mysql_squid_builder();
    if (!$q->TABLE_EXISTS("ufdb_page_rules")) {
        $sql = "CREATE TABLE IF NOT EXISTS `ufdb_page_rules` (\n\t\t\t`zmd5` varchar(90) NOT NULL,\n\t\t\t`category` varchar(90) NOT NULL,\n\t\t\t`deny` smallint(1) NOT NULL,\n\t\t\t`allow` smallint(1) NOT NULL,\n\t\t\t`adgroup` varchar(255) NOT NULL,\n\t\t\t`noauth` smallint(1) NOT NULL,\n\t\t\t`maxtime` smallint(3) NOT NULL,\n\t\t\t`infinite` smallint(1) NOT NULL,\n\t\t\t`addTocat` varchar(255) NOT NULL,\n\t\t\t`username` varchar(255) NOT NULL,\n\t\t\t`webruleid` INT(10) NOT NULL,\n\t\t\tPRIMARY KEY (`zmd5`),\n\t\t\tKEY `category` (`category`),\n\t\t\tKEY `deny` (`deny`),\n\t\t\tKEY `allow` (`allow`),\n\t\t\tKEY `webruleid`(`webruleid`),\n\t\t\tKEY `infinite` (`infinite`)\n\t\t\t) ENGINE=MYISAM;";
        $q->QUERY_SQL($sql);
        if (!$q->ok) {
            FATAL_ERROR_SHOW_128($q->mysql_error_html());
        }
        return;
    }
    $page = CurrentPageName();
    $tpl = new templates();
    $new_rule = $tpl->_ENGINE_parse_body("{new_rule}");
    $description = $tpl->_ENGINE_parse_body("{description}");
    $context = $tpl->_ENGINE_parse_body("{context}");
    $events = $tpl->_ENGINE_parse_body("{events}");
    $destination = $tpl->_ENGINE_parse_body("{destination}");
    $website = $tpl->_ENGINE_parse_body("{website}");
    $settings = $tpl->javascript_parse_text("{watchdog_squid_settings}");
    $empty_events_text_ask = $tpl->javascript_parse_text("{empty_events_text_ask}");
    $members = $tpl->javascript_parse_text("{members}");
    $allow = $tpl->javascript_parse_text("{allow}");
    $category = $tpl->javascript_parse_text("{category}");
    $deny = $tpl->javascript_parse_text("{deny}");
    $banned_page_webservice = $tpl->javascript_parse_text("{banned_page_webservice}");
    $rules = $tpl->javascript_parse_text("{rules}");
    $apply = $tpl->javascript_parse_text("{apply}");
    $ticket = $tpl->javascript_parse_text("{ticket}");
    $clean_cache = $tpl->javascript_parse_text("{clean_cache}");
    $smtp_parameters = $tpl->javascript_parse_text("{smtp_parameters}");
    $t = time();
    if (isset($_GET["dashboard"])) {
        $WEBFILTERING_TOP_MENU = WEBFILTERING_TOP_MENU();
        $DASHBOARD = $tpl->_ENGINE_parse_body("<div style='font-size:30px;margin-bottom:20px'>{$WEBFILTERING_TOP_MENU}</div>");
    }
    $buttons = "\n\tbuttons : [\n\t\t{name: '<strong style=font-size:22px>{$new_rule}</strong>', bclass: 'add', onpress :  newrule{$t}},\n\t\t{name: '<strong style=font-size:22px>{$apply}</strong>', bclass: 'apply', onpress :  apply{$t}},\n\t\t{name: '<strong style=font-size:22px>{$clean_cache}</strong>', bclass: 'apply', onpress :  CleanCache{$t}},\n\t\t{name: '<strong style=font-size:22px>{$smtp_parameters}</strong>', bclass: 'Settings', onpress :  smtp_parameters{$t}},\n\t],";
    $html = "{$DASHBOARD}\n\t<table class='UFDB_PAGE_RULE' style='display: none' id='UFDB_PAGE_RULE' style='width:99%'></table>\n\t<script>\n\tfunction BuildTable{$t}(){\n\t\$('#UFDB_PAGE_RULE').flexigrid({\n\turl: '{$page}?list=yes',\n\tdataType: 'json',\n\tcolModel : [\n\t{display: '<span style=font-size:18px>{$category}</span>', name : 'category', width :595, sortable : false, align: 'left'},\n\t{display: '<span style=font-size:18px>{$deny}</span>', name : 'deny', width :70, sortable : true, align: 'center'},\n\t{display: '<span style=font-size:18px>{$allow}</span>', name : 'allow', width :70, sortable : true, align: 'center'},\n\t{display: '<span style=font-size:18px>{$ticket}</span>', name : 'ticket', width :70, sortable : true, align: 'center'},\n\t{display: '<span style=font-size:18px>{$members}</span>', name : 'members', width :433, sortable : false, align: 'left'},\n\t{display: '&nbsp;', name : 'delete', width :70, sortable : false, align: 'center'},\n\t],\n\t{$buttons}\n\n\tsearchitems : [\n\t\t{display: '{$category}', name : 'category'},\n\t],\n\tsortname: 'category',\n\tsortorder: 'asc',\n\tusepager: true,\n\ttitle: '<strong style=font-size:30px>{$banned_page_webservice} > > {$rules}</strong>',\n\tuseRp: true,\n\trp: 50,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: 550,\n\tsingleSelect: true,\n\trpOptions: [10, 20, 30, 50,100,200,500]\n\n});\n}\n\nfunction apply{$t}(){\n\tLoadjs('squid.compile.progress.php');\n}\n\nfunction newrule{$t}(){\n\tLoadjs('{$page}?rule-js=')\n}\nfunction purge_caches{$t}(){\nLoadjs('system.services.cmd.php?APPNAME=APP_NGINX&action=purge&cmd=%2Fetc%2Finit.d%2Fnginx&appcode=APP_NGINX');\n}\nfunction smtp_parameters{$t}(){\n\tLoadjs('squidguardweb.php?smtp-parameters-js=yes')\n}\n\nfunction New{$t}(){\n\tLoadjs('nginx.new.php?peer-id={$_GET["ID"]}');\n}\n\nvar xCleanCache{$t}=function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>0){alert(results);}\n}\n\nfunction CleanCache{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('clean-cache','yes');\n\tXHR.sendAndLoad('{$page}', 'POST',xCleanCache{$t});\n\t\n}\n\n\n\tBuildTable{$t}();\n\t</script>";
    echo $html;
}
Ejemplo n.º 27
0
function infra_section()
{
    include_once dirname(__FILE__) . "/ressources/class.squid.inc";
    $users = new usersMenus();
    $sock = new sockets();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $icon = "arrow-right-24.png";
    $SSLColor = "#000000";
    $icon_ssl = "arrow-right-24.png";
    $icon_ssl_enc = "arrow-right-24.png";
    $ssl_enc_color = "#000000";
    $GotoSSLEncrypt = "GotoSSLEncrypt()";
    $squid = new squidbee();
    $EnableArticaHotSpot = intval($sock->GET_INFO("EnableArticaHotSpot"));
    $EnableIntelCeleron = intval($sock->GET_INFO("EnableIntelCeleron"));
    $COUNT_DE_CACHES = intval(@file_get_contents("{$GLOBALS["BASEDIR"]}/COUNT_DE_CACHES"));
    $COUNT_DE_MEMBERS = intval(@file_get_contents("{$GLOBALS["BASEDIR"]}/MEMBERS_COUNT"));
    $SquidBoosterEnable = intval($sock->GET_INFO("SquidBoosterEnable"));
    $SquidCacheLevel = $sock->GET_INFO("SquidCacheLevel");
    if (!is_numeric($SquidCacheLevel)) {
        $SquidCacheLevel = 4;
    }
    $HyperCacheStoreID = intval($sock->GET_INFO("HyperCacheStoreID"));
    $EnableSS5 = intval($sock->GET_INFO("EnableSS5"));
    $EnableRDPProxy = intval($sock->GET_INFO("EnableRDPProxy"));
    $PrivoxyEnabled = intval($sock->GET_INFO("PrivoxyEnabled"));
    $EnableParentProxy = intval($sock->GET_INFO("EnableParentProxy"));
    if (!$q->FIELD_EXISTS("proxy_ports", "UseSSL")) {
        $q->QUERY_SQL("ALTER TABLE `proxy_ports` ADD `UseSSL` smallint(1) NOT NULL DEFAULT '0'");
        if (!$q->ok) {
            echo $q->mysql_error_html();
        }
    }
    $sql = "SELECT COUNT(*) as tcount FROM proxy_ports WHERE UseSSL=1 AND enabled=1";
    $ligne = @mysql_fetch_array($q->QUERY_SQL($sql));
    if (!$q->ok) {
        echo $q->mysql_error_html();
    }
    $CountOfSSL = intval($ligne["tcount"]);
    $ssl_rules_js = "GotoSSLRules()";
    $WHY_SSL_RULES_DISABLED = null;
    if ($CountOfSSL == 0) {
        $icon_ssl = "arrow-right-24-grey.png";
        $icon_ssl_enc = $icon_ssl;
        $SSLColor = "#898989";
        $ssl_enc_color = $SSLColor;
        $GotoSSLEncrypt = "blur()";
        $ssl_rules_js = "blur()";
        $WHY_SSL_RULES_DISABLED = "<hr>{WHY_SSL_RULES_DISABLED}";
        $decrypted_ssl_websites = "<tr>\n\t\t<td valign='middle' style='width:25px'>\n\t\t<img src='img/arrow-right-24-grey.png'>\n\t\t</td>\n\t\t<td valign='middle' style='font-size:18px;width:99%;color:{$SSLColor}'>{decrypted_ssl_websites}</td>\n\t\t</tr>";
        $ssl_rules = "<tr>\n\t\t<td valign='middle' style='width:25px'>\n\t\t<img src='img/arrow-right-24-grey.png'>\n\t\t</td>\n\t\t<td valign='middle' style='font-size:18px;width:99%;color:{$SSLColor}'>{ssl_rules}</td>\n\t\t</tr>";
    } else {
        if ($squid->SSL_BUMP_WHITE_LIST == 1) {
            $decrypted_ssl_websites = "<tr>\n\t\t\t<td valign='middle' style='width:25px'>\n\t\t\t\t<img src='img/{$icon_ssl}'>\n\t\t\t</td>\n\t\t\t<td valign='middle' style='font-size:18px;width:99%;color:{$SSLColor}'>" . texttooltip("{decrypted_ssl_websites}", null, "GotoSSLEncrypt()") . "</td>\n\t\t\t</tr>";
        } else {
            $decrypted_ssl_websites = "<tr>\n\t\t\t<td valign='middle' style='width:25px'>\n\t\t\t<img src='img/arrow-right-24-grey.png'>\n\t\t\t</td>\n\t\t\t<td valign='middle' style='font-size:18px;width:99%;color:{$SSLColor}'>{decrypted_ssl_websites}</td>\n\t\t\t</tr>";
        }
    }
    $sslshitelist = "<tr>\n\t<td valign='middle' style='width:25px'>\n\t<img src='img/{$icon_ssl}'>\n\t</td>\n\t<td valign='middle' style='font-size:18px;width:99%;color:{$SSLColor}'>" . texttooltip("{ssl_whitelist}", "position:left:{SSL_BUMP_WL}", "GotoSquidSSLWL()") . "</td>\n\t</tr>";
    $ssl_rules = "<tr>\n\t<td valign='middle' style='width:25px'>\n\t<img src='img/{$icon_ssl}'>\n\t</td>\n\t<td valign='middle' style='font-size:18px;width:99%;color:{$SSLColor}'>" . texttooltip("{ssl_rules}", "{ssl_rules}{$WHY_SSL_RULES_DISABLED}", $ssl_rules_js) . "</td>\n\t</tr>";
    $tr[] = "<table style='width:100%'>\n\t<tr>\n\t<td valign='middle' colspan=2 style='font-size:22px;font-weight:bold'>{infrastructure}:</td>\n\t</tr>";
    $icon_ports = "arrow-right-24.png";
    $explain_ports = "{dashboard_listen_ports_explain}<br>{dashboard_listen_ports_explain2}";
    $js_ports = "GotoSquidPorts()";
    $color_port = "black";
    if ($EnableArticaHotSpot == 1) {
        $icon_ports = "arrow-right-24-grey.png";
        $explain_ports = "{section_disabled_hotsport}";
        $js_ports = "blur();";
        $color_port = "#898989";
    }
    $tr[] = "<tr>\n\t<td valign='middle' style='width:25px'>\n\t<img src='img/{$icon_ports}'>\n\t</td>\n\t<td valign='middle' style='font-size:18px;width:99%;color:{$color_port}'>" . texttooltip("{listen_ports}", "position:left:{$explain_ports}", $js_ports) . "</td>\n\t</tr>";
    $ssl_options = "<tr>\n\t<td valign='middle' style='width:25px'>\n\t<img src='img/{$icon_ssl}'>\n\t</td>\n\t<td valign='middle' style='font-size:18px;width:99%;color:{$SSLColor}'>" . texttooltip("{ssl_options}", null, "Loadjs('squid.ssl.center.php?js=yes')") . "</td>\n\t</tr>";
    if (!$squid->IS_35) {
        $tr[] = $decrypted_ssl_websites;
        $tr[] = $sslshitelist;
        $tr[] = $ssl_options;
    } else {
        $tr[] = $ssl_rules;
    }
    $tr[] = "<tr>\n\t<td valign='middle' style='width:25px'>\n\t<img src='img/arrow-right-24.png'></td>\n\t<td valign='middle' style='font-size:18px;width:99%;color:black'>" . texttooltip("{squid_templates_error}", "{squid_templates_error_explain}", "GotoSquidTemplatesErrors()") . "</td>\n\t</tr>";
    $tr[] = "<tr>\n\t<td valign='middle' style='width:25px'>&nbsp;</td>\n\t<td valign='middle' style='font-size:18px;width:99%;color:black'>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t<td valign='middle' style='width:16px'>\n\t\t\t<img src='img/arrow-right-16.png'></td>\n\t\t\t<td valign='middle' style='font-size:16px;width:99%;color:black'>" . texttooltip("{ftp_template}", "{ftp_template_error_explain}", "GotoSquidTemplateFTP()") . "</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t\n\t\t\t</td>\n\t</tr>";
    $tr[] = "<tr>\n\t<td valign='middle' style='width:25px'>\n\t<img src='img/arrow-right-24.png'></td>\n\t<td valign='middle' style='font-size:18px;width:99%;color:black'>" . texttooltip("{timeouts}", null, "GotoSquidTimeOuts()") . "</td>\n\t</tr>";
    $tr[] = "<tr>\n\t<td valign='middle' style='width:25px'>\n\t<img src='img/arrow-right-24.png'></td>\n\t<td valign='middle' style='font-size:18px;width:99%;color:black'>" . texttooltip("{dns_settings}", null, "GotoSquidDNSsettings()") . "</td>\n\t</tr>";
    $tr[] = "<tr><td colspan=2>&nbsp;</td></tr>";
    $squid_parent_proxy_color = "black";
    $squid_parent_proxy_icon = "arrow-right-24.png";
    $squid_parent_proxy_js = "GotoSquidParentProxy()";
    if ($EnableParentProxy == 0) {
        $squid_parent_proxy_icon = "arrow-right-24-grey.png";
        $squid_parent_proxy_color = "#898989";
        $squid_parent_proxy_text = " <span style='font-size:14px'>({disabled})</span>";
    }
    if ($PrivoxyEnabled == 1) {
        $squid_parent_proxy_icon = "arrow-right-24-grey.png";
        $squid_parent_proxy_color = "#898989";
        $squid_parent_proxy_text = " <span style='font-size:14px'>({disabled} - {APP_PRIVOXY})</span>";
        $squid_parent_proxy_js = "blur()";
    }
    $tr[] = "<tr>\n\t<td valign='middle' style='width:25px'>\n\t<img src='img/{$squid_parent_proxy_icon}'></td>\n\t<td valign='middle' style='font-size:18px;width:99%;color:{$squid_parent_proxy_color}'>" . texttooltip("{squid_parent_proxy}{$squid_parent_proxy_text}", "{squid_parent_proxy_explain}", $squid_parent_proxy_js) . "</td>\n\t</tr>";
    $tr[] = "<tr>\n\t<td valign='middle' style='width:25px'>\n\t<img src='img/arrow-right-24.png'></td>\n\t<td valign='middle' style='font-size:18px;width:99%;color:black'>" . texttooltip("X-Forwarded-For", "{follow_x_forwarded_for_explain}", "GotoFollowXforwardedFor()") . "</td>\n\t</tr>";
    $ecap_gzip_icon = "arrow-right-24.png";
    $ecap_gzip_color = "#000000";
    $ecap_gzip_explain = null;
    $EnableeCapGzip = intval($sock->GET_INFO("EnableeCapGzip"));
    if ($EnableeCapGzip == 0) {
        $ecap_gzip_color = "#898989";
        $ecap_gzip_icon = "arrow-right-24-grey.png";
        $ecap_gzip_explain = " <span style='font-size:12px'>({disabled})</span>";
    }
    $tr[] = "\n\t<tr>\n\t\t<td valign='middle' style='width:25px'>\n\t\t\t<img src='img/{$ecap_gzip_icon}'>\n\t\t</td>\n\t\t<td valign='middle' style='font-size:18px;width:99%;color:{$ecap_gzip_color}'>" . texttooltip("{http_compression}{$ecap_gzip_explain}", "{http_compression_explain}", "GoToeCapGzip()") . "</td>\n\t</tr>";
    $SLAVE_IP = null;
    $icon_failover = "arrow-right-24.png";
    $js_failover = "GotoFailover()";
    $color_failover = "black";
    $MAIN = unserialize(base64_decode($sock->GET_INFO("HASettings")));
    if (isset($MAIN["SLAVE"])) {
        $SLAVE_IP = $MAIN["SLAVE"];
    }
    if ($SLAVE_IP == null) {
        $icon_failover = "arrow-right-24-grey.png";
        $color_failover = "#898989";
        $text_failover = " <span style='font-size:12px'>({disabled})</span>";
    } else {
        $text_failover = " <span style='font-size:12px'>({slave_ip} {$SLAVE_IP})</span>";
    }
    if (!$users->CORP_LICENSE) {
        $icon_failover = "arrow-right-24-grey.png";
        $js_failover = "blur()";
        $color_failover = "#898989";
        $text_failover = " <span style='font-size:12px'>({no_license})</span>";
    }
    $tr[] = "<tr>\n\t<td valign='middle' style='width:25px'>\n\t<img src='img/{$icon_failover}'></td>\n\t<td valign='middle' style='font-size:18px;width:99%;color:{$color_failover}'>" . texttooltip("{failover}{$text_failover}", "{failover_explain}", "{$js_failover}") . "</td>\n\t</tr>";
    $img_hostpot = "arrow-right-24.png";
    $explain_hostpot = "{dashboard_hotspot}";
    $js_hostpot = "GotoHostpotv3()";
    $color_hotspot = "black";
    $TCP_LIST_NICS = TCP_LIST_NICS();
    if ($TCP_LIST_NICS < 2) {
        $img_hostpot = "arrow-right-24-grey.png";
        $explain_hostpot = "<div style='background-color:white;color:#d32d2d;margin:10px;padding:10px'>{dashboard_hotspot_nonic}</div>";
        $js_hostpot = "blur();";
        $color_hotspot = "#898989";
    }
    if ($EnableArticaHotSpot == 0) {
        $img_hostpot = "arrow-right-24-grey.png";
        $color_hotspot = "#898989";
    }
    $tr[] = "\n<tr>\n\t<td valign='middle' style='width:25px'>\n\t<img src='img/{$img_hostpot}'></td>\n\t<td valign='middle' style='font-size:18px;width:99%;color:{$color_hotspot}'>" . texttooltip("HotSpot", $explain_hostpot, $js_hostpot) . "</td>\n</tr>";
    $tr[] = "</table>";
    // ***************************************************************************************************
    $tr2[] = "<table style='width:100%'>";
    $tr2[] = "\n\t<table style='width:100%'>\n\t<tr>\n\t<td valign='middle' colspan=2 style='font-size:22px;font-weight:bold'>{system_pcaches}:</td>\n\t</tr>";
    $Color = "black";
    $icon = "Database24.png";
    $hypercache_mirror_Color = "black";
    $icon_center_cache_explain = null;
    $hypercache_mirror_icon = "arrow-right-24.png";
    $js_cache_status = "GoToCaches()";
    $icon_cache_status = "Database24.png";
    $icon_cache_explain = null;
    $color_cache_status = "black";
    $js = "GoToCachesCenter()";
    if (!$users->CORP_LICENSE) {
        $icon_center_cache_explain = "<span style='font-size:12px'> ({no_license})</span>";
        $icon = "Database24-grey.png";
        $Color = "#898989";
        $js = "blur();";
    }
    if ($COUNT_DE_CACHES > 0) {
        if ($COUNT_DE_MEMBERS > 15) {
            if ($COUNT_DE_CACHES < 20000) {
                $icon = "alert-24.png";
            }
        }
    }
    if ($SquidCacheLevel == 0) {
        $icon = "Database24-grey.png";
        $icon_cache_status = $icon;
        $hypercache_mirror_icon = "arrow-right-24-grey.png";
        $icon_cache_explain = "<span style='font-size:12px'> ({disabled})</span>";
        $icon_center_cache_explain = "<span style='font-size:12px'> ({disabled})</span>";
        $js_cache_status = "blur();";
        $Color = "#898989";
        $color_cache_status = $Color;
        $hypercache_mirror_Color = $Color;
        $js = "blur();";
        $SquidBoosterEnable = 0;
        $EnableRockCache = 0;
        $HyperCacheStoreID = 0;
    }
    $tr2[] = "<tr>\n\t<td valign='middle' style='width:25px'>\n\t<img src='img/{$icon_cache_status}'>\n\t</td>\n\t<td valign='middle' style='font-size:18px;width:99%;color:{$color_cache_status}'>" . texttooltip("{caches_status}{$icon_cache_explain}", "{your_proxy_caches_explain}", $js_cache_status) . "</td>\n\t</tr>";
    $tr2[] = "<tr>\n\t\t<td valign='middle' style='width:25px'>\n\t\t<img src='img/{$icon}'>\n\t\t</td>\n\t\t<td valign='middle' style='font-size:18px;width:99%;color:{$Color}'>" . texttooltip("{caches_center}{$icon_center_cache_explain}", "{caches_center_explain}", "{$js}") . "</td>\n\t</tr>";
    $icon_booster_explain = null;
    $EnableRockCache = intval($sock->GET_INFO("EnableRockCache"));
    $icon_booster = "Database24.png";
    $icon_rock = "Database24.png";
    $js_booster = "GotoProxyBooster()";
    $Color_booster = "black";
    $Color_rock = "black";
    $js_rock = "GoToRock()";
    if ($SquidBoosterEnable == 0) {
        $icon_booster = "Database24-grey.png";
        $icon_booster_explain = "<span style='font-size:12px'> ({disabled})</span>";
    }
    if (!$users->CORP_LICENSE) {
        $icon_booster = "Database24-grey.png";
        $icon_rock = "Database24-grey.png";
        $js_booster = "blur();";
        $Color_booster = "#898989";
        $Color_rock = "#898989";
        $EnableRockCache = 0;
        $js_rock = "blur()";
        $icon_booster_explain = "<span style='font-size:12px'> ({no_license})</span>";
        $icon_rock_explain = "<span style='font-size:12px'> ({no_license})</span>";
        $icon_caches_rules_explain = "<span style='font-size:12px'> ({no_license})</span>";
    }
    $tr2[] = "\n\t<tr>\n\t<td valign='middle' style='width:25px'>\n\t<img src='img/{$icon_booster}'>\n\t</td>\n\t<td valign='middle' style='font-size:18px;width:99%;color:{$Color_booster}'>" . texttooltip("{squid_booster}{$icon_booster_explain}", null, "GotoProxyBooster()") . "</td>\n\t</tr>";
    if ($users->CORP_LICENSE) {
        if ($EnableRockCache == 0 or $SquidCacheLevel == 0) {
            $icon_rock = "Database24-grey.png";
            $Color_rock = "#898989";
            $icon_rock_explain = "<span style='font-size:12px'> ({disabled})</span>";
        }
    }
    if ($SquidCacheLevel == 0) {
        $icon_rock = "Database24-grey.png";
        $Color_rock = "#898989";
        $icon_rock_explain = "<span style='font-size:12px'> ({disabled})</span>";
        $icon_caches_rules_explain = "<span style='font-size:12px'> ({disabled})</span>";
        $icon_caches_rules = "arrow-right-24-grey.png";
        $Color_caches_rules = "#898989";
    }
    $tr2[] = "\n\t<tr>\n\t<td valign='middle' style='width:25px'>\n\t\t<img src='img/{$icon_rock}'>\n\t</td>\n\t<td valign='middle' style='font-size:18px;width:99%;color:{$Color_rock}'>" . texttooltip("{rock_store}{$icon_rock_explain}", null, $js_rock) . "</td>\n\t</tr>";
    $tr2[] = "<tR><td colspan=2>&nbsp;</td></tr>";
    $icon = "arrow-right-24.png";
    $Color = "black";
    $icon = "arrow-right-24.png";
    $SquidVersion = @file_get_contents("/etc/artica-postfix/settings/Daemons/SquidVersion");
    if (preg_match("#^3\\.5#", $SquidVersion)) {
        $HyperCacheCompatible = true;
    }
    if (preg_match("#^4\\.#", $SquidVersion)) {
        $HyperCacheCompatible = true;
    }
    if ($HyperCacheStoreID == 0) {
        $icon = "arrow-right-24-grey.png";
        $Color = "#898989";
    }
    $explain = "{HyperCache_explain}";
    $js_hypercache = "GoToHyperCache()";
    if (!$HyperCacheCompatible) {
        $icon = "arrow-right-24-grey.png";
        $js_hypercache = "blur()";
        $Color = "#898989";
        $hypercache_explain = "{ERROR_SQUID_MUST_35}";
    }
    if ($EnableIntelCeleron == 1) {
        $icon = "arrow-right-24-grey.png";
        $js_hypercache = "blur()";
        $Color = "#898989";
        $hypercache_explain = "{ERROR_FEATURE_CELERON}";
    }
    $tr2[] = "<tr>\n\t<td valign='middle' style='width:25px'>\n\t<img src='img/arrow-right-24.png'>\n\t</td>\n\t<td valign='middle' style='font-size:18px;width:99%'>" . texttooltip("{cache_level}", null, "GoToCachesLevel()") . "</td>\n\t</tr>";
    $js_caches_rules = "GotoSquidCachesRules()";
    $Color_caches_rules = "black";
    $icon_caches_rules = "arrow-right-24.png";
    if (!$users->CORP_LICENSE) {
        $icon_caches_rules = "arrow-right-24-grey.png";
        $Color_caches_rules = "#898989";
        $js_caches_rules = null;
    }
    $tr2[] = "<tr>\n\t<td valign='middle' style='width:25px'>\n\t<img src='img/{$icon_caches_rules}'>\n\t</td>\n\t<td valign='middle' style='font-size:18px;width:99%;color:{$Color_caches_rules}'>" . texttooltip("{caches_rules}{$icon_caches_rules_explain}", "{refresh_pattern_intro}", "{$js_caches_rules}") . "</td>\n\t</tr>";
    $WindowsUpdateCacher_icon = "arrow-right-24.png";
    $WindowsUpdateCacher_explain = null;
    $WindowsUpdateCacher_color = "black";
    $EnableUfdbGuard = intval($sock->GET_INFO("EnableUfdbGuard"));
    $WindowsUpdateCaching = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/WindowsUpdateCaching"));
    if ($EnableUfdbGuard == 0) {
        $WindowsUpdateCaching = 0;
    }
    if ($WindowsUpdateCaching == 0) {
        $WindowsUpdateCacher_icon = "arrow-right-24-grey.png";
        $WindowsUpdateCacher_color = "#898989";
        $WindowsUpdateCacher_explain = "&nbsp;<span style='font-size:12px'> ({disabled})</span>";
    }
    $webcopy_color = "black";
    $webcopy_icon = "arrow-right-24.png";
    $webcopy_explain = null;
    $webcopy_js = "GotoWebCopy()";
    $HTTrackInSquid = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/HTTrackInSquid"));
    if ($HTTrackInSquid == 0) {
        $webcopy_icon = "arrow-right-24-grey.png";
        $webcopy_color = "#898989";
        $webcopy_explain = "&nbsp;<span style='font-size:12px'> ({disabled})</span>";
    }
    if (!is_file("/usr/bin/httrack")) {
        $webcopy_icon = "arrow-right-24-grey.png";
        $webcopy_color = "#898989";
        $webcopy_explain = "&nbsp;<span style='font-size:12px'> ({not_installed})</span>";
    }
    $tr2[] = "<tr>\n\t<td valign='middle' style='width:25px'>\n\t<img src='img/{$webcopy_icon}'>\n\t</td>\n\t<td valign='middle' style='font-size:18px;width:99%;color:{$webcopy_color}'>" . texttooltip("WebCopy{$webcopy_explain}", "{WebCopy_task_explain}", $webcopy_js) . "</td>\n\t</tr>";
    $tr2[] = "<tr>\n\t<td valign='middle' style='width:25px'>\n\t<img src='img/{$WindowsUpdateCacher_icon}'>\n\t</td>\n\t<td valign='middle' style='font-size:18px;width:99%;color:{$WindowsUpdateCacher_color}'>" . texttooltip("Windows Updates{$WindowsUpdateCacher_explain}", "{enable_windows_updates_cache_enforcement_explain}", "GotoWindowsUpdate()") . "</td>\n\t</tr>";
    $tr2[] = "\n\t<tr>\n\t<td valign='middle' style='width:25px'>\n\t<img src='img/{$icon}'>\n\t</td>\n\t<td valign='middle' style='font-size:18px;width:99%;color:{$Color}'>" . texttooltip("HyperCache{$icon_cache_explain}", "{$hypercache_explain}", $js_hypercache) . "</td>\n\t</tr>";
    $tr2[] = "\n\t<tr>\n\t<td valign='middle' style='width:25px'>\n\t<img src='img/{$hypercache_mirror_icon}'>\n\t</td>\n\t<td valign='middle' style='font-size:18px;width:99%;color:{$hypercache_mirror_Color}'>" . texttooltip("HyperCache mirror{$icon_cache_explain}", "{HyperCache_mirror_explain}", "GoToHyperCacheMirror()") . "</td>\n\t</tr>";
    $tr2[] = "<tR><td colspan=2>&nbsp;</td></tr>\n\t<tr>\n\t<td valign='middle' colspan=2 style='font-size:22px;font-weight:bold'>{gateway_services}:</td>\n\t</tr>";
    $img_ss5 = "arrow-right-24.png";
    $explain_ss5 = "{APP_SS5_ABOUT}";
    $js_ss5 = "GoToSS5()";
    $color_ss5 = "black";
    $img_rdp = "arrow-right-24.png";
    $explain_rdp = "{APP_RDPPROXY}";
    $js_rdp = "GotToRDPPROX()";
    $color_rdp = "black";
    if ($EnableSS5 == 0) {
        $img_ss5 = "arrow-right-24-grey.png";
        $explain_ss5 = "{APP_SS5_ABOUT}";
        $error_ss5 = "&nbsp;<span style='font-size:12px'>{disabled}</span>";
        $js_ss5 = "GoToSS5()";
        $color_ss5 = "#898989";
    }
    if (!is_file("/usr/sbin/ss5")) {
        $img_ss5 = "arrow-right-24-grey.png";
        $explain_ss5 = "{APP_SS5_ABOUT}";
        $error_ss5 = "&nbsp;<span style='font-size:12px'>{not_installed}</span>";
        $js_ss5 = null;
        $color_ss5 = "#898989";
    }
    if (!is_file("/var/lib/ss5/ss5/mod_socks4.so")) {
        $img_ss5 = "arrow-right-24-grey.png";
        $explain_ss5 = "{APP_SS5_ABOUT}";
        $error_ss5 = "&nbsp;<span style='font-size:12px'>{not_installed}</span>";
        $js_ss5 = null;
        $color_ss5 = "#898989";
    }
    if ($EnableRDPProxy == 0) {
        $img_rdp = "arrow-right-24-grey.png";
        $explain_rdp = "{APP_SS5_ABOUT}";
        $error_rdp = "&nbsp;<span style='font-size:12px'>{disabled}</span>";
        $js_rdp = "GotToRDPPROX()";
        $color_rdp = "#898989";
    }
    if (!$users->RDPPROXY_INSTALLED) {
        $img_rdp = "arrow-right-24-grey.png";
        $explain_rdp = "{APP_SS5_ABOUT}";
        $error_rdp = "&nbsp;<span style='font-size:12px'>{not_installed}</span>";
        $js_rdp = null;
        $color_rdp = "#898989";
    }
    $tr2[] = "\n\t<tr>\n\t<td valign='middle' style='width:25px'><img src='img/{$img_ss5}'></td>\n\t<td valign='middle' style='font-size:18px;width:99%;color:{$color_ss5}'>" . texttooltip("{APP_SS5}{$error_ss5}", $explain_ss5, $js_ss5) . "</td>\n\t</tr>";
    $tr2[] = "<tr>\n\t<td valign='middle' style='width:25px'><img src='img/{$img_rdp}'></td>\n\t<td valign='middle' style='font-size:18px;width:99%;color:{$color_rdp}'>" . texttooltip("{APP_RDPPROXY}{$error_rdp}", "position:right:{APP_RDPPROXY}", $js_rdp) . "</td>\n\t</tr>";
    $EnableSecureGateway = intval($sock->GET_INFO("EnableSecureGateway"));
    $icon_secure_gateway = "arrow-right-24.png";
    $color_secure_gateway = "black";
    $text_secure_gateway = null;
    if ($EnableSecureGateway == 0) {
        $icon_secure_gateway = "arrow-right-24-grey.png";
        $color_secure_gateway = "#898989";
        $text_secure_gateway = " <span style='font-size:12px'>({disabled})</span>";
    }
    "arrow-right-24-grey.png";
    $tr2[] = "<tr>\n\t<td valign='middle' style='width:25px'>\n\t<img src='img/{$icon_secure_gateway}'></td>\n\t<td valign='middle' style='font-size:18px;width:99%;color:{$color_secure_gateway}'>" . texttooltip("{secure_gateway}{$text_secure_gateway}", "{secure_gateway_explain}", "GotoGatewaySecure()") . "</td>\n\t</tr>";
    $Transmission_icon = "arrow-right-24.png";
    $Transmission_Color = "black";
    $Transmission_js = "GoToTransmissionDaemon()";
    $EnableTransMissionDaemon = intval($sock->GET_INFO("EnableTransMissionDaemon"));
    $UpdateUtilityWizard = intval($sock->GET_INFO("UpdateUtilityWizard"));
    if (!is_file("/usr/bin/transmission-daemon")) {
        $Transmission_icon = "arrow-right-24-grey.png";
        $Transmission_Color = "#898989";
        $Transmission_js = "blur();";
    } else {
        if ($EnableTransMissionDaemon == 0) {
            $Transmission_icon = "arrow-right-24-grey.png";
            $Transmission_Color = "#898989";
        }
    }
    $UpdateUtilityIcon = "arrow-right-24.png";
    $UpdateUtilityColor = "black";
    if ($UpdateUtilityWizard == 0) {
        $UpdateUtilityIcon = "arrow-right-24-grey.png";
        $UpdateUtilityColor = "#898989";
    }
    if (!is_file("/etc/UpdateUtility/UpdateUtility-Console")) {
        $UpdateUtilityIcon = "arrow-right-24-grey.png";
        $UpdateUtilityColor = "#898989";
    }
    $tr2[] = "\n\t<tr>\n\t<td valign='middle' style='width:25px'>\n\t<img src='img/{$Transmission_icon}'>\n\t</td>\n\t<td valign='middle' style='font-size:18px;width:99%;color:{$Transmission_Color}'>" . texttooltip("{bittorrent_service}", "{bittorrent_service_explain}", "GoToTransmissionDaemon()") . "</td>\n\t</tr>";
    $tr2[] = "\n\t<tr>\n\t<td valign='middle' style='width:25px'>\n\t<img src='img/{$UpdateUtilityIcon}'>\n\t</td>\n\t<td valign='middle' style='font-size:18px;width:99%;color:{$UpdateUtilityColor}'>" . texttooltip("{APP_KASPERSKY_UPDATE_UTILITY}", "{APP_KASPERSKY_UPDATE_UTILITY}", "GoToUpdateUtility()") . "</td>\n\t</tr>";
    $tr2[] = "</table>";
    $final = "\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td style='width:50%' valign='top'>" . $tpl->_ENGINE_parse_body(@implode("\n", $tr)) . "</td>\n\t\t<td style='width:50%' valign='top'>" . $tpl->_ENGINE_parse_body(@implode("\n", $tr2)) . "</td>\n\t</tr>\n\t</table>\n\t";
    $filename = "/usr/share/artica-postfix/ressources/logs/web/cache/" . md5("INFRASECTION" . $tpl->language . $_SESSION["uid"]);
    @file_put_contents($filename, $final);
    echo $final;
}
function add_ntlm_popup()
{
    //ini_set('html_errors',0);ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string','');ini_set('error_append_string','');
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $sock = new sockets();
    $sql = "CREATE TABLE IF NOT EXISTS `deny_ntlm_domains` (\n\t\t\t\t`items` VARCHAR(256) NOT NULL PRIMARY KEY\n\t\t\t\t) ENGINE=MYISAM;";
    $q->QUERY_SQL($sql);
    $t = time();
    $sql = "SELECT items  FROM deny_ntlm_domains ORDER BY items";
    if (!$q->ok) {
        echo $q->mysql_error_html();
    }
    $results = $q->QUERY_SQL($sql, "artica_backup");
    while ($ligne = mysql_fetch_assoc($results)) {
        $tr[] = $ligne["items"];
    }
    $html = "\n\t<div style='font-size:22px'>{authentication_whitelist}</div>\n\t<div class=explain style='font-size:18px'>{squid_ask_domain}<br></div>\n\t<textarea style='margin-top:5px;font-family:Courier New;\n\tfont-weight:bold;width:95%;height:350px;border:5px solid #8E8E8E;overflow:auto;font-size:16px !important'\n\tid='form{$t}'>" . @implode("\n", $tr) . "</textarea>\n\t<div style='text-align:right;margin-top:20px;font-size:28px'>\n\t\t\t<hr>\n\t\t\t" . button("{compile2}", "Save2{$t}()", 28) . "&nbsp;|&nbsp;" . button("{apply}", "Save{$t}()", 28) . "</div>\n\n\t\t\t<script>\n\t\t\tvar xSave{$t}=function(obj){\n\t\t\tvar tempvalue=obj.responseText;\n\t\t\tif(tempvalue.length>3){alert(tempvalue);return;}\n\n}\nvar xSave2{$t}=function(obj){\nvar tempvalue=obj.responseText;\nif(tempvalue.length>3){alert(tempvalue);return;}\nLoadjs('squid.compile.whiteblack.progress.php');\n}\n\nfunction Save{$t}(){\nvar XHR = new XHRConnection();\nXHR.appendData('ntlmwhite',document.getElementById('form{$t}').value);\nXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\n}\n\nfunction Save2{$t}(){\nvar XHR = new XHRConnection();\nXHR.appendData('ntlmwhite',document.getElementById('form{$t}').value);\nXHR.sendAndLoad('{$page}', 'POST',xSave2{$t});\n}\n\n</script>\n";
    echo $tpl->_ENGINE_parse_body($html);
}
Ejemplo n.º 29
0
function list_items()
{
    $STATUS = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/web/nginx.status.acl"));
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $all_text = $tpl->_ENGINE_parse_body("{all}");
    $GLOBALS["CLASS_TPL"] = $tpl;
    $q = new mysql_squid_builder();
    $OrgPage = "miniadmin.proxy.reverse.php";
    $sock = new sockets();
    $EnableFreeWeb = intval($sock->GET_INFO("EnableFreeWeb"));
    if (!$q->FIELD_EXISTS("reverse_www", "zOrder")) {
        $q->QUERY_SQL("ALTER TABLE `reverse_www` ADD `zOrder` smallint(100) NOT NULL default '0'");
        if (!$q->ok) {
            echo $q->mysql_error_html();
        }
    }
    $up = imgsimple("arrow-up-32.png", null, "Loadjs('{$MyPage}?move-item-js=yes&ID={$ligne["ID"]}&dir=0&t={$_GET["t"]}')");
    $down = imgsimple("arrow-down-32.png", null, "Loadjs('{$MyPage}?move-item-js=yes&ID={$ligne["ID"]}&dir=1&t={$_GET["t"]}')");
    $FORCE = "cache_peer_id={$_GET["ID"]}";
    $search = '%';
    $table = "reverse_www";
    $page = 1;
    $freeweb_compile_background = $tpl->javascript_parse_text("{freeweb_compile_background}");
    $reset_admin_password = $tpl->javascript_parse_text("{reset_admin_password}");
    $delete_freeweb_text = $tpl->javascript_parse_text("{delete_freeweb_text}");
    $delete_freeweb_nginx_text = $tpl->javascript_parse_text("{delete_freeweb_nginx_text}");
    $delete_freeweb_dnstext = $tpl->javascript_parse_text("{delete_freeweb_dnstext}");
    $total = 0;
    if ($q->COUNT_ROWS($table, "artica_backup") == 0) {
        json_error_show("no data", 1);
    }
    if (isset($_POST["sortname"])) {
        if ($_POST["sortname"] != null) {
            $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";
        }
    }
    if (isset($_POST['page'])) {
        $page = $_POST['page'];
    }
    $searchstring = string_to_flexquery();
    if ($searchstring != null) {
        $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE {$FORCE} {$searchstring}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_events"));
        $total = $ligne["TCOUNT"];
    } else {
        if (strlen($FORCE) > 2) {
            $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE {$FORCE}";
            $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_events"));
            $total = $ligne["TCOUNT"];
        } else {
            $total = $q->COUNT_ROWS($table, "artica_events");
        }
    }
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    if (!is_numeric($rp)) {
        $rp = 50;
    }
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $sql = "SELECT *  FROM `{$table}` WHERE {$FORCE} {$searchstring} {$ORDER} {$limitSql}";
    writelogs($sql, __FUNCTION__, __FILE__, __LINE__);
    $results = $q->QUERY_SQL($sql, "artica_events");
    if (!$q->ok) {
        json_error_show($q->mysql_error . "<br>{$sql}", 1);
    }
    $data = array();
    $data['page'] = $page;
    $data['total'] = $total;
    $data['rows'] = array();
    $CurrentPage = CurrentPageName();
    if (mysql_num_rows($results) == 0) {
        json_error_show("no data");
    }
    $searchstring = string_to_flexquery();
    if (!AdminPrivs()) {
        $sql = "SELECT reverse_www.* FROM reverse_www,reverse_privs\n\t\tWHERE reverse_privs.servername=reverse_www.servername\n\t\tAND reverse_privs.uid='{$_SESSION["uid"]}' {$searchstring} ORDER BY servername LIMIT 0,250";
    }
    $results = $q->QUERY_SQL($sql, 'artica_backup');
    if (!$q->ok) {
        json_error_show($q->mysql_error . "<br>{$sql}");
    }
    $q1 = new mysql();
    $t = time();
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $servername = $ligne["servername"];
        $explain_text = NGINX_EXPLAIN_REVERSE($ligne["servername"]);
        $icon = "clound-in-64.png";
        $freewebicon = "64-firewall-search.png";
        $color = "black";
        $status = array();
        $portText = null;
        $md = md5(serialize($ligne));
        $RedirectQueries = $ligne["RedirectQueries"];
        $default_server = $ligne["default_server"];
        $SiteEnabled = $ligne["enabled"];
        $servername_enc = urlencode($servername);
        $Compile = imgsimple("apply-48.png", null, "Loadjs('nginx.single.progress.php?servername={$servername_enc}')");
        $limit_rate = $ligne["limit_rate"];
        $limit_rate_after = $ligne["limit_rate_after"];
        $DeleteFreeWeb = "Loadjs('{$MyPage}?unlink-websites-js=yes&servername={$servername_enc}&md={$md}')";
        $icon2 = imgsimple("reconfigure-48.png", null, "Loadjs('miniadmin.proxy.reverse.reconfigure.php?servername={$servername_enc}')");
        $up = imgsimple("arrow-up-32.png", null, "Loadjs('{$MyPage}?move-item-js=yes&servername={$servername_enc}&dir=0&t={$_GET["t"]}')");
        $down = imgsimple("arrow-down-32.png", null, "Loadjs('{$MyPage}?move-item-js=yes&servername={$servername_enc}&dir=1&t={$_GET["t"]}')");
        if ($ligne["DenyConf"] == 1) {
            $icon = "hearth-blocked-64.png";
        }
        if ($SiteEnabled == 0) {
            $icon = "domain-main-64-grey.png";
            $color = "#8a8a8a";
            $icon2 = "&nbsp;";
        }
        $delete = imgsimple("delete-48.png", null, $DeleteFreeWeb);
        $jsedit = imgsimple($icon, null, "Loadjs('nginx.site.php?servername={$servername_enc}')");
        $jsEditWW = $jsedit;
        $jseditA = $jsedit;
        $jseditC = imgsimple("script-48.png", null, "Loadjs('nginx.script.php?website-script-js=yes&servername={$servername_enc}')");
        if ($limit_rate > 0) {
            $limit_rate_after_caption = $tpl->_ENGINE_parse_body("{limit_rate_after_caption}");
            $limit_rate_after_caption = str_replace("%s", "{$limit_rate}MB/s", $limit_rate_after_caption);
            $limit_rate_after_caption = str_replace("%f", "{$limit_rate_after}MB", $limit_rate_after_caption);
            $status[] = "<br><span style='font-size:12px;font-weight:bold;color:#EEB853'>{$limit_rate_after_caption}</span>";
        }
        if (count($status) > 0) {
            $status_text = $tpl->_ENGINE_parse_body("<div style='font-size:12px'>" . @implode("", $status) . "</div>");
        }
        $FreeWebText = null;
        if ($EnableFreeWeb == 0) {
            if ($ligne["ipaddr"] == "127.0.0.1") {
                $ligne["ipaddr"] = "{error}";
            }
            if ($ligne["cache_peer_id"] == 0) {
                $ligne["cache_peer_id"] = -1;
            }
        }
        if ($ligne["owa"] == 1) {
            $freewebicon = "exchange-2010-64.png";
        }
        if ($ligne["poolid"] > 0) {
            $freewebicon = "64-cluster.png";
            $ligne2 = mysql_fetch_array($q->QUERY_SQL("SELECT poolname FROM nginx_pools WHERE ID='{$ligne["poolid"]}'"));
            $ligne["ipaddr"] = $ligne2["poolname"];
        }
        $stats = null;
        $FinalDestination = "{$ligne["ipaddr"]}{$FreeWebText}";
        if ($default_server == 1) {
            $servername = "{$servername} ({$all_text} * )";
            $icon = "free-web-64.png";
            if ($SiteEnabled == 0) {
                $icon = "free-web-64-grey.png";
            }
        }
        $data['rows'][] = array('id' => $ligne['categorykey'], 'cell' => array("{$jseditC}", "<a href=\"javascript:blur();\"\n\t\t\t\t\t\t\tstyle='font-size:18px;font-weight:bold;text-decoration:underline'\n\t\t\t\t\t\t\tOnClick=\"javascript:Loadjs('nginx.site.php?servername={$servername_enc}')\">{$servername}{$portText}</a>\n\t\t\t\t\t\t\t<br>{$status_text}\n\t\t\t\t\t\t\t{$explain_text}", $Compile, $delete));
    }
    echo json_encode($data);
}
function save()
{
    $zmd5 = $_POST["zmd5"];
    while (list($key, $val) = each($_POST)) {
        $_POST[$key] = mysql_escape_string2(url_decode_special_tool($val));
    }
    $q = new mysql_squid_builder();
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT params FROM reports_cache WHERE `zmd5`='{$zmd5}'"));
    if (!$q->ok) {
        echo $q->mysql_error_html();
    }
    $params = unserialize($ligne["params"]);
    $params["FROM"] = strtotime($_POST["date1"]);
    $params["TO"] = strtotime($_POST["date2"]);
    $params["USER"] = $_POST["USER"];
    $params["searchsites"] = $_POST["searchsites"];
    $params["searchuser"] = $_POST["searchuser"];
    $paramsS = mysql_escape_string2(serialize($params));
    $sql = "UPDATE reports_cache SET `title`='{$_POST["title"]}',`params`='{$paramsS}'\n\tWHERE `zmd5`='{$zmd5}'";
    $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo $q->mysql_error;
    }
}