Esempio n. 1
0
function page()
{
    $ID = intval($_GET["ID"]);
    $tpl = new templates();
    $page = CurrentPageName();
    $fields_size = 22;
    $rv = new squid_reverse();
    $q = new mysql_squid_builder();
    $sock = new sockets();
    $t = time();
    $servername = $_GET["servername"];
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM reverse_www WHERE servername='{$servername}'"));
    $cache_peer_id = $ligne["cache_peer_id"];
    $ligne2 = mysql_fetch_array($q->QUERY_SQL("SELECT cacheid FROM reverse_sources WHERE ID='{$cache_peer_id}'"));
    if (intval($ligne2) == 0) {
        echo FATAL_ERROR_SHOW_128("{nginx_error_no_cache_defined}");
        return;
    }
    $html[] = "<div style='width:98%' class=form>";
    $html[] = "<table style='width:100%'>";
    $html[] = "<tr><td colspan=2 style='font-size:40px;padding-bottom:20px'>{caching}</td></tr>";
    $html[] = Field_checkbox_table("proxy_buffering-{$t}", "{proxy_buffering}", $ligne["proxy_buffering"], $fields_size, "{proxy_buffering_text}");
    $html[] = Field_text_table("proxy_cache_min_uses-{$t}", "{proxy_cache_min_uses}", $ligne["proxy_cache_min_uses"], $fields_size, "{proxy_cache_min_uses_text}", 120);
    $html[] = Field_text_table("proxy_cache_valid-{$t}", "{proxy_cache_valid} ({minutes})", $ligne["proxy_cache_valid"], $fields_size, "{proxy_cache_valid_text}", 120);
    $html[] = Field_ipv4_table("proxy_buffers-{$t}", "{proxy_buffers}", $ligne["proxy_buffers"], $fields_size, "{proxy_buffers_text}", 120);
    $html[] = Field_text_table("proxy_buffer_size-{$t}", "{proxy_buffer_size} (k)", $ligne["proxy_buffer_size"], $fields_size, "{proxy_buffer_size_text}", 110);
    $html[] = Field_text_table("proxy_temp_file_write_size-{$t}", "{proxy_temp_file_write_size} (k)", $ligne["proxy_temp_file_write_size"], $fields_size, "{proxy_temp_file_write_size_text}", 110);
    $html[] = Field_text_table("proxy_max_temp_file_size-{$t}", "{proxy_max_temp_file_size} (MB)", $ligne["proxy_max_temp_file_size"], $fields_size, "{proxy_max_temp_file_size_text}", 110);
    $html[] = Field_button_table_autonome("{apply}", "Submit{$t}", 40);
    $html[] = "</table>";
    $html[] = "</div>\n\t<script>\n\tvar xSubmit{$t}= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>3){alert(results);}\n\t\tRefreshTab('main_nginx_server');\n\t\t\$('#NGINX_MAIN_TABLE').flexReload();\n\t\t\$('#NGINX_DESTINATION_MAIN_TABLE').flexReload();\n\t\tvar ID={$ID}\n\t\tif(ID==0){ YahooWin2Hide();}\n\t\n\t}\n\t\n\t\n\tfunction Submit{$t}(){\n\t\tvar proxy_buffering=0\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('general-settings','{$servername}');\n\t\tif(document.getElementById('proxy_buffering-{$t}').checked){proxy_buffering=1;}\n\t\tXHR.appendData('proxy_cache_min_uses',document.getElementById('proxy_cache_min_uses-{$t}').value);\n\t\tXHR.appendData('proxy_buffering',proxy_buffering);\n\t\tXHR.appendData('proxy_cache_valid',document.getElementById('proxy_cache_valid-{$t}').value);\n\t\tXHR.appendData('proxy_buffers',document.getElementById('proxy_buffers-{$t}').value);\n\t\tXHR.appendData('proxy_buffer_size',document.getElementById('proxy_buffer_size-{$t}').value);\n\t\t\n\t\tXHR.appendData('proxy_max_temp_file_size',document.getElementById('proxy_max_temp_file_size-{$t}').value);\n\t\tXHR.appendData('proxy_temp_file_write_size',document.getElementById('proxy_temp_file_write_size-{$t}').value);\n\t\t\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n\t}\n\t</script>\n\t\t\n\t";
    echo $tpl->_ENGINE_parse_body(@implode("\n", $html));
}
function policy_edit()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_meta();
    $t = time();
    $ID = $_GET["policy-id"];
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM policies WHERE ID='{$ID}'"));
    $html = "\n\t<div style='width:95%' class=form>\n\t<table style='width:100%'>\n\t" . Field_checkbox_table("enabled-{$t}", "{enabled}", $ligne["enabled"]) . "\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{name}:</td>\n\t\t<td>" . Field_text("policy_name-{$t}", utf8_encode($ligne["policy_name"]), "font-size:18px") . "</td>\n\t</tr>\n\t\t\t\t\n\t\n\t<tr>\n\t<td colspan=2 align='right'>" . button("{apply}", "Save{$t}()", 26) . "</td>\n\t</tr>\n\t</table>\n<script>\n\tvar xSave{$t}= function (obj) {\n\tvar res=obj.responseText;\n\tif (res.length>3){alert(res);return;}\n\t\$('#ARTICA_META_POLICY_TABLE').flexReload();\n}\n\t\t\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('ID','{$ID}');\n\tvar enabled=0;\n\tXHR.appendData('policy_name',document.getElementById('policy_name-{$t}').value);\n\tif(document.getElementById('enabled-{$t}').checked){enabled=1;}\n\tXHR.appendData('enabled',enabled);\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\n}\n</script>\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Esempio n. 3
0
function rule_popup()
{
    $dans = new dansguardian_rules();
    $md5 = $_GET["rule-popup"];
    $tpl = new templates();
    $page = CurrentPageName();
    $fields_size = 22;
    $q = new mysql_squid_builder();
    $sock = new sockets();
    $t = time();
    $bt = "{add}";
    if ($md5 != null) {
        $bt = "{apply}";
    }
    $Timez[0] = "{default}";
    $Timez[5] = "5 {minutes}";
    $Timez[10] = "10 {minutes}";
    $Timez[15] = "15 {minutes}";
    $Timez[30] = "30 {minutes}";
    $Timez[60] = "1 {hour}";
    $Timez[120] = "2 {hours}";
    $Timez[240] = "4 {hours}";
    $Timez[720] = "12 {hours}";
    $Timez[2880] = "2 {days}";
    $cats = $dans->LoadBlackListes();
    while (list($num, $ligne) = each($cats)) {
        $newcat[$num] = $num;
    }
    $newcat[null] = "{all_categories}";
    $newcat["safebrowsing"] = "Google Safe Browsing";
    $newcat["blacklist"] = "{blacklist}";
    $newcat["generic"] = "{generic}";
    if (!$q->FIELD_EXISTS("ufdb_page_rules", "ticket")) {
        $q->QUERY_SQL("ALTER TABLE `ufdb_page_rules` ADD `ticket` smallint(1) NOT NULL DEFAULT 0, ADD INDEX ( `ticket` )");
    }
    if (!$q->FIELD_EXISTS("ufdb_page_rules", "ticket")) {
        $q->QUERY_SQL("ALTER TABLE `ufdb_page_rules` ADD `ticket` smallint(1) NOT NULL DEFAULT 0, ADD INDEX ( `ticket` )");
    }
    if (!$q->FIELD_EXISTS("ufdb_page_rules", "webruleid")) {
        $q->QUERY_SQL("ALTER TABLE `ufdb_page_rules` ADD `webruleid` INT(10) NOT NULL NOT NULL DEFAULT 0, ADD INDEX ( `webruleid` )");
    }
    $sql = "SELECT ID,groupname FROM webfilter_rules WHERE enabled=1";
    $results = $q->QUERY_SQL($sql);
    $RULES["0"] = "{all_rules}";
    $btname = "{add}";
    $t = time();
    while ($ligne = mysql_fetch_assoc($results)) {
        $RULES[$ligne["ID"]] = "{$ligne["groupname"]}";
    }
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM ufdb_page_rules WHERE zmd5='{$md5}'"));
    $group_legend = "{active_directory_group}";
    if ($sock->SQUID_IS_EXTERNAL_LDAP()) {
        $group_legend = "{ldap_group}";
    }
    if (!$q->ok) {
        echo FATAL_ERROR_SHOW_128($q->mysql_error);
        return;
    }
    $html[] = "<div style='width:98%' class=form>";
    $html[] = "<table style='width:100%'>";
    $html[] = Field_list_table("webruleid-{$t}", "{rule}", $ligne["webruleid"], $fields_size, $RULES, null, 450);
    $html[] = Field_list_table("category-{$t}", "{category}", $ligne["category"], $fields_size, $newcat, null, 450);
    $html[] = Field_list_table("maxtime-{$t}", "{unlock_during}", $ligne["maxtime"], $fields_size, $Timez, null, 450);
    $html[] = Field_text_table("adgroup-{$t}", "{$group_legend}", $ligne["adgroup"], $fields_size, null, 450);
    if ($sock->SQUID_IS_EXTERNAL_LDAP()) {
        $html[] = Field_button_table_autonome("{browse}", "Loadjs('browse-extldap-groups.php?MainFunction=FdapGroup{$t}')");
    }
    $html[] = Field_text_table("username-{$t}", "{username}", $ligne["username"], $fields_size, null, 450);
    $html[] = Field_checkbox_table("deny-{$t}", "{deny_unlock}", $ligne["deny"], $fields_size, null, "UnCheckAllow{$t}()");
    $html[] = Field_checkbox_table("allow-{$t}", "{allow_unlock}", $ligne["allow"], $fields_size, null, "UnCheckDeny{$t}()");
    $html[] = Field_checkbox_table("ticket-{$t}", "{submit_ticket}", $ligne["ticket"], $fields_size, null, "UnTicket{$t}()");
    $html[] = Field_checkbox_table("noauth-{$t}", "{not_authenticate}", $ligne["noauth"], $fields_size);
    $html[] = Field_list_table("addTocat-{$t}", "{automatically_add_to}", $ligne["addTocat"], $fields_size, $newcat, null, 450);
    $html[] = Field_button_table_autonome($bt, "Submit{$t}", 30);
    $html[] = "</table>";
    $html[] = "</div>\n\t<script>\n\tvar xSubmit{$t}= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>3){alert(results);}\n\t\t\$('#UFDB_PAGE_RULE').flexReload();\n\t\n\t}\n\t\n\tfunction UnCheckAllow{$t}(){\n\t\tif(document.getElementById('deny-{$t}').checked){\n\t\t\tdocument.getElementById('allow-{$t}').checked=false;\n\t\t}else{\n\t\t\tdocument.getElementById('allow-{$t}').checked=true;\n\t\t\n\t\t}\n\t\n\t}\n\t\n\tfunction UnCheckDeny{$t}(){\n\t\tif(document.getElementById('allow-{$t}').checked){\n\t\t\tdocument.getElementById('deny-{$t}').checked=false;\n\t\t}else{\n\t\t\tdocument.getElementById('deny-{$t}').checked=true;\n\t\t}\n\t}\n\t\n\tfunction UnTicket{$t}(){\n\t\tif(document.getElementById('ticket-{$t}').checked){\n\t\t\tdocument.getElementById('deny-{$t}').checked=true;\n\t\t\tdocument.getElementById('allow-{$t}').checked=false;\n\t\t\tdocument.getElementById('noauth-{$t}').checked=true;\n\t\t\tdocument.getElementById('deny-{$t}').disabled=true;\n\t\t\tdocument.getElementById('allow-{$t}').disabled=true;\n\t\t\tdocument.getElementById('noauth-{$t}').disabled=true;\n\t\t\tdocument.getElementById('maxtime-{$t}').disabled=true;\n\t\t\tdocument.getElementById('addTocat-{$t}').disabled=true;\n\t\t}else{\n\t\t\tdocument.getElementById('deny-{$t}').disabled=false;\n\t\t\tdocument.getElementById('allow-{$t}').disabled=false;\n\t\t\tdocument.getElementById('noauth-{$t}').disabled=false;\n\t\t\tdocument.getElementById('maxtime-{$t}').disabled=false;\n\t\t\tdocument.getElementById('addTocat-{$t}').disabled=false;\n\t\t\t}\n\t\t\n\t}\n\t\n\tfunction FdapGroup{$t}(DN){\n\t\tdocument.getElementById('adgroup-{$t}').value='EXTLDAP:'+DN;\n\t}\n\t\n\t\n\tfunction Submit{$t}(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('rule','{$md5}');\n\t\tXHR.appendData('category',document.getElementById('category-{$t}').value);\n\t\tXHR.appendData('adgroup',document.getElementById('adgroup-{$t}').value);\n\t\tXHR.appendData('username',document.getElementById('username-{$t}').value);\n\t\tXHR.appendData('addTocat',document.getElementById('addTocat-{$t}').value);\n\t\tXHR.appendData('maxtime',document.getElementById('maxtime-{$t}').value);\n\t\tXHR.appendData('webruleid',document.getElementById('webruleid-{$t}').value);\n\t\t\n\t\t\n\t\t\n\t\t\n\t\tif(document.getElementById('deny-{$t}').checked){\n\t\t\tXHR.appendData('deny','1');\t\n\t\t}else{\n\t\t\tXHR.appendData('deny','0');\t\n\t\t\n\t\t}\n\t\tif(document.getElementById('allow-{$t}').checked){\n\t\t\tXHR.appendData('allow','1');\t\n\t\t}else{\n\t\t\tXHR.appendData('allow','0');\t\n\t\t\n\t\t}\t\n\n\t\tif(document.getElementById('noauth-{$t}').checked){\n\t\t\tXHR.appendData('noauth','1');\t\n\t\t}else{\n\t\t\tXHR.appendData('noauth','0');\t\n\t\t\n\t\t}\n\n\t\tif(document.getElementById('ticket-{$t}').checked){\n\t\t\tXHR.appendData('ticket','1');\t\n\t\t}else{\n\t\t\tXHR.appendData('ticket','0');\t\n\t\t\n\t\t}\t\t\t\n\t\t\n\t\t\n\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n\t}\n\t\n\tUnCheckAllow{$t}();\n\tUnTicket{$t}();\n\t</script>\n\t\t\n\t";
    echo $tpl->_ENGINE_parse_body(@implode("\n", $html));
}
Esempio n. 4
0
function main()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $servername = $_GET["servername"];
    $rv = new squid_reverse();
    $q = new mysql_squid_builder();
    $sock = new sockets();
    $title = "{new_webserver}";
    $bt = "{add}";
    $t = time();
    FORM_START();
    $q = new mysql_squid_builder();
    $squid_reverse = new squid_reverse();
    $tpl = new templates();
    $sslcertificates = $squid_reverse->ssl_certificates_list();
    $sources_list = $squid_reverse->sources_list();
    $array = $sources_list[0];
    $array2 = $sources_list[1];
    $CountDeSources = $sources_list[2];
    $nginx_caches = $squid_reverse->caches_list();
    $nginx_pools = $squid_reverse->pool_list();
    $nginx_replaces = $squid_reverse->replace_list();
    $AsFReeWeb = false;
    $EnableFreeWeb = $sock->GET_INFO("EnableFreeWeb");
    if ($servername != null) {
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM reverse_www WHERE servername='{$servername}'"));
        $title = $tpl->_ENGINE_parse_body("{port}:{$ligne["port"]} &laquo;{$servername}&raquo;");
        $bt = "{apply}";
        $Hidden = Field_hidden("servername-edit-{$t}", $servername) . $servername;
    } else {
        $ligne["enabled"] = 1;
        $Hidden = Field_text("servername-edit-{$t}", null, "font-size:18px;width:300px");
        FORM_CLOSE("YahooWin");
    }
    if (!is_numeric($ligne["port"])) {
        $ligne["port"] = 80;
    }
    if (!is_numeric($ligne["ArticaErrors"])) {
        $ligne["ArticaErrors"] = 1;
    }
    if ($servername == null) {
        $ligne["cache_peer_id"] = -1;
    }
    if (!is_numeric($EnableFreeWeb)) {
        $EnableFreeWeb = 0;
    }
    if ($ligne["cache_peer_id"] == 0) {
        if ($EnableFreeWeb == 1) {
            $q2 = new mysql();
            $ligne2 = mysql_fetch_array($q2->QUERY_SQL("SELECT `useSSL`,`sslcertificate` FROM `freeweb` WHERE `servername`='{$servername}'", "artica_backup"));
            $ligne["certificate"] = $ligne2["sslcertificate"];
            $AsFReeWeb = true;
            $title = $tpl->_ENGINE_parse_body("FreeWeb &laquo;{$servername}&raquo;");
        } else {
            $ligne["cache_peer_id"] = -1;
        }
    }
    $html[] = "<div style='width:98%' class=form>";
    $html[] = "<table style='width:100%'>";
    $html[] = "<tr><td colspan=2 style='font-size:22px'>{reverse_proxy}:</td></tr>";
    $html[] = "<tr><td class=legend style='font-size:18px'>{webserver}:</td>";
    $html[] = "<td style='font-size:18px'>{$Hidden}</td></tr>";
    $html[] = Field_checkbox_table("owa-{$t}", "{protect_owa}", $ligne["owa"], 18);
    $html[] = Field_checkbox_table("debug-{$t}", "{debug}", $ligne["debug"], 18);
    $html[] = Field_list_table("cacheid-{$t}", "{cache}", $ligne["cacheid"], 18, $nginx_caches);
    $html[] = Field_list_table("replaceid-{$t}", "{replace_rule}", $ligne["replaceid"], 18, $nginx_replaces);
    if ($ligne["cache_peer_id"] == 0) {
        $html[] = Field_hidden("cache_peer_id-{$t}", 0);
        $html[] = Field_hidden("enabled-{$t}", 1);
        $html[] = Field_hidden("certificate-{$t}", $ligne["certificate"]);
    } else {
        if (!AdminPrivs()) {
            $html[] = Field_hidden("cache_peer_id-{$t}", $ligne["cache_peer_id"]);
            $html[] = Field_hidden("start_directory-{$t}", $ligne["start_directory"]);
        } else {
            $html[] = Field_list_table("cache_peer_id-{$t}", "{destination}", $ligne["cache_peer_id"], 18, $array);
            $html[] = Field_text_table("start_directory-{$t}", "{start_path}", $ligne["start_directory"], 18, null, 300);
        }
        $html[] = Field_list_table("poolid-{$t}", "{pool}", $ligne["poolid"], 18, $nginx_pools);
        $html[] = Field_text_table("RedirectQueries-{$t}", "{RedirectQueries}", $ligne["RedirectQueries"], 18, null, 300);
        $html[] = Field_checkbox_table("ArticaErrors-{$t}", "{enable_template_errors}", $ligne["ArticaErrors"], 18);
        if ($CountDeSources == 0) {
            $html[] = "<tr><td colspan=2><p class=text-error>{you_need_to_define_sources_first}</p></td></tr>";
            FORM_LOCK();
        }
    }
    $html[] = Field_button_table($bt);
    echo $tpl->_ENGINE_parse_body(FORM_END(CurrentPageName(), $html));
}
function popup_ad()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $md5 = $_GET["md5"];
    $title = $tpl->javascript_parse_text("{new_connection}");
    $btname = "{add}";
    $close = 1;
    $ruleid = $_GET["ruleid"];
    if ($md5 != null) {
        $q = new mysql_squid_builder();
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM hotspot_activedirectory WHERE zmd5='{$md5}'"));
        $title = $ligne["hostname"];
        $ruleid = $ligne["ruleid"];
        $btname = "{apply}";
        $close = 0;
    }
    $Timez[0] = "{unlimited}";
    $Timez[30] = "30 {minutes}";
    $Timez[60] = "1 {hour}";
    $Timez[120] = "2 {hours}";
    $Timez[180] = "3 {hours}";
    $Timez[360] = "6 {hours}";
    $Timez[720] = "12 {hours}";
    $Timez[1440] = "1 {day}";
    $Timez[2880] = "2 {days}";
    $Timez[10080] = "1 {week}";
    $Timez[20160] = "2 {weeks}";
    $Timez[40320] = "1 {month}";
    if (!is_numeric($ligne["enabled"])) {
        $ligne["enabled"] = 1;
    }
    $t = time();
    $html = "<div style='width:98%' class=form>\n\t<table style='width:100%'>" . Field_text_table("hostname-{$t}", "{hostname}", $ligne["hostname"], 22, null, 350) . Field_checkbox_table("enabled-{$t}", "{enabled}", $ligne["enabled"], $fontsize = 22, null) . "<tr>\n\t\t<td colspan=2 align='right'><hr>" . button($btname, "Save{$t}()", 36) . "</td>\n\t</tr>\n\t</table>\n\t</div>\t\t\t\n<script>\n\t\t\t\t\nvar xSave{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>3){alert(results);return;}\n\tvar close={$close};\n\tif(close==1){YahooWin4Hide();}\n\t\$('#flexRT{$_GET["t"]}').flexReload();\n\tExecuteByClassName('SearchFunction');\n}\n\n\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('hostname',document.getElementById('hostname-{$t}').value);\n\tXHR.appendData('ruleid','{$ruleid}');\n\tXHR.appendData('md5','{$md5}');\n\tif(document.getElementById('enabled-{$t}').checked){XHR.appendData('enabled',1); }else{XHR.appendData('enabled',0);}\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\n\t}\n</script>";
    echo $tpl->_ENGINE_parse_body($html);
}
function rule_parameters()
{
    $ID = $_GET["ID"];
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM artica_caches WHERE ID='{$ID}'", "artica_backup"));
    $t = time();
    if ($ligne["MaxSizeBytes"] == 0) {
        $ligne["MaxSizeBytes"] = 3145728000;
    }
    $ligne["MaxSizeBytes"] = $ligne["MaxSizeBytes"] / 1024;
    $ligne["MaxSizeBytes"] = $ligne["MaxSizeBytes"] / 1024;
    $html = "<div style='width:98%' class=form>\n\t<table style='width:100%'>" . Field_checkbox_table("enabled-{$t}", "{enabled}", $ligne["enabled"]) . Field_text_table("rulename-{$t}", "{rulename}", $ligne["rulename"], 18, null, 250) . Field_text_table("sitename-{$t}", "{sitename}", $ligne["sitename"], 18, null, 250) . Field_text_table("MaxSizeBytes-{$t}", "{max_size} MB", $ligne["MaxSizeBytes"], 18, null, 250) . Field_button_table_autonome("{apply}", "Save{$t}", 26) . "\n\t</table>\n</div>\t\t\n<script>\nvar xSave{$t}=function (obj) {\n\tvar tempvalue=obj.responseText;\n\tif(tempvalue.length>3){alert(tempvalue);}\n\t\$('#squid_enforce_rules_table').flexReload();\n}\n\t\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tvar EnableSquidCacheBoosters=0;\n\tif(document.getElementById('enabled-{$t}').checked){\n\tXHR.appendData('enabled',1);\n\t}else{XHR.appendData('enabled',0);}\n\t\n\tXHR.appendData('ID','{$_GET["ID"]}');\n\tXHR.appendData('MaxSizeBytes',document.getElementById('MaxSizeBytes-{$t}').value)\n\tXHR.appendData('rulename',encodeURIComponent(document.getElementById('rulename-{$t}').value));\n\tXHR.appendData('sitename',encodeURIComponent(document.getElementById('rulename-{$t}').value));\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\t\t\t\t\t\t\n}\n</script>\t\t\n";
    echo $tpl->_ENGINE_parse_body($html);
}
Esempio n. 7
0
function general_settings()
{
    $ID = intval($_GET["ID"]);
    $tpl = new templates();
    $page = CurrentPageName();
    $fields_size = 22;
    $rv = new squid_reverse();
    $q = new mysql_squid_builder();
    $sock = new sockets();
    $t = time();
    $sslcertificates = $rv->ssl_certificates_list();
    $sslcertificates[null] = "{none}";
    $results = $q->QUERY_SQL("SELECT ID,keys_zone FROM nginx_caches ORDER BY keys_zone LIMIT 0,250");
    $nginx_caches[0] = "{none}";
    while ($ligne2 = mysql_fetch_array($results, MYSQL_ASSOC)) {
        $nginx_caches[$ligne2["ID"]] = $ligne2["keys_zone"];
    }
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM reverse_sources WHERE ID='{$ID}'"));
    if (!$q->ok) {
        echo FATAL_ERROR_SHOW_128($q->mysql_error);
        return;
    }
    $html[] = "<div style='width:98%' class=form>";
    $html[] = "<table style='width:100%'>";
    $html[] = "<tr><td colspan=2 style='font-size:28px;padding-bottom:20px'>{main_parameters} {$ligne["ipaddr"]}:{$ligne["port"]}</td></tr>";
    $html[] = Field_text_table("servername-{$t}", "{name}", $ligne["servername"], $fields_size, null, 450);
    $html[] = Field_ipv4_table("ipaddr-{$t}", "{ipaddr}", $ligne["ipaddr"], $fields_size, null, 110);
    $html[] = Field_text_table("port-{$t}", "{inbound_port}", $ligne["port"], $fields_size, null, 110);
    $html[] = Field_checkbox_table("ssl-{$t}", "{UseSSL}", $ligne["ssl"], $fields_size);
    $html[] = Field_text_table("forceddomain-{$t}", "{forceddomain}", $ligne["forceddomain"], $fields_size, null, 450);
    $html[] = Field_text_table("remote_path-{$t}", "{root_directory}", $ligne["remote_path"], $fields_size, null, 450);
    $html[] = Field_list_table("cacheid-{$t}", "{cache_directory}", $ligne["cacheid"], $fields_size, $nginx_caches, null, 450);
    $html[] = Field_list_table("certificate-{$t}", "{certificate}", $ligne["certificate"], $fields_size, $sslcertificates, null, 450);
    $html[] = Field_button_table_autonome("{apply}", "Submit{$t}", 30);
    $html[] = "</table>";
    $html[] = "</div>\n\t<script>\n\tvar xSubmit{$t}= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>3){alert(results);}\n\t\t\$('#NGINX_MAIN_TABLE').flexReload();\n\t\t\$('#NGINX_DESTINATION_MAIN_TABLE').flexReload();\n\t\tvar ID={$ID}\n\t\tif(ID==0){ YahooWin2Hide();}\n\t\n\t}\n\t\n\t\n\tfunction Submit{$t}(){\n\t\tvar ssl=0\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('general-settings','{$ID}');\n\t\tif(document.getElementById('ssl-{$t}').checked){ss=1;}\n\t\tXHR.appendData('servername',document.getElementById('servername-{$t}').value);\n\t\tXHR.appendData('ipaddr',document.getElementById('ipaddr-{$t}').value);\n\t\tXHR.appendData('ssl',ssl);\n\t\tXHR.appendData('port',document.getElementById('port-{$t}').value);\n\t\t\n\t\tXHR.appendData('forceddomain',document.getElementById('forceddomain-{$t}').value);\n\t\tvar pp=encodeURIComponent(document.getElementById('remote_path-{$t}').value);\n\t\tXHR.appendData('remote_path',document.getElementById('remote_path-{$t}').value);\n\t\tXHR.appendData('cacheid',document.getElementById('cacheid-{$t}').value);\n\t\tXHR.appendData('certificate',document.getElementById('certificate-{$t}').value);\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n\t}\n\t</script>\n\t\t\n\t";
    echo $tpl->_ENGINE_parse_body(@implode("\n", $html));
}
Esempio n. 8
0
function SETTINGS()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $t = time();
    $ligne["enabled"] = 1;
    $btname = "{add}";
    if ($_GET["ID"] > 0) {
        $sql = "SELECT * FROM webauth_rules WHERE ID={$_GET["ID"]}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
        if (!$q->ok) {
            echo $q->mysql_error_html();
        }
        $btname = "{apply}";
    }
    $html = "\n<div style='width:98%' class=form>\n<table style='width:100%'>\n\t\t" . Field_text_table("rulename-{$t}", "{rulename}", utf8_encode($ligne["rulename"]), 26, null, 450) . Field_checkbox_table("enabled-{$t}", "{enabled}", $ligne["enabled"], 26) . Field_spacer_table(50) . Field_button_table_autonome("{$btname}", "Save{$t}", 34) . "</table>\n</div>\n<script>\n\tvar xSave{$t}= function (obj) {\n\t\tvar ID='{$_GET["ID"]}';\n\t\tvar res=obj.responseText;\n\t\tif(res.length>3){alert(res);return;}\n\t\t\$('#HOSTPOT_RULES').flexReload();\n\t\tif(ID==0){YahooWin3Hide(); }\n\t}\t\n\n\t\n\tfunction Save{$t}(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('ID','{$_GET["ID"]}');\n\t\tXHR.appendData('rulename',document.getElementById('rulename-{$t}').value);\n\t\tif(document.getElementById('enabled-{$t}').checked){XHR.appendData('enabled',1);}else{XHR.appendData('enabled',0);}\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\t\n\t}\n</script>\t\t\t\t\n";
    echo $tpl->_ENGINE_parse_body($html);
}
Esempio n. 9
0
function group_popup()
{
    $ID = $_GET["ID"];
    $q = new mysql_squid_builder();
    $page = CurrentPageName();
    $tpl = new templates();
    $title = "{new_group}";
    $bt = "{add}";
    $t = time();
    if (!$q->TABLE_EXISTS("nginx_exploits_groups")) {
        $sql = "CREATE TABLE IF NOT EXISTS `nginx_exploits_groups` (\n\t\t\t  `ID` INT NOT NULL AUTO_INCREMENT,\n\t\t\t  `groupname` CHAR(255)  NOT NULL,\n\t\t\t  PRIMARY KEY (`ID`),\n\t\t\t  KEY `groupname` (`groupname`)\n\t\t\t)  ENGINE = MYISAM;";
        if (!$q->QUERY_SQL($sql)) {
            echo $q->mysql_error_html();
        }
    }
    $sock = new sockets();
    if ($ID > 0) {
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM nginx_exploits_groups WHERE ID='{$ID}'"));
        $bt = "{apply}";
        $title = utf8_encode("{$ligne["groupname"]}");
    }
    $html[] = "<div style='width:98%' class=form>";
    $html[] = "<table style='width:100%'>";
    $html[] = "<tr style='height:75px'><td colspan=2 style='font-size:36px;margin-bottom:40px'>{$title}</td></tr>";
    $html[] = Field_checkbox_table("addef-{$t}", "{add_defaults}", 0, 26);
    $html[] = Field_text_table("groupname-{$t}", "{groupname}", $ligne["groupname"], 26, null, 450);
    $html[] = Field_button_table_autonome($bt, "Submit{$t}", 30);
    $html[] = "</table>";
    $html[] = "</div>\n<script>\n\tvar xSubmit{$t}= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>3){alert(results);}\n\t\t\$('#NGINX_ANTI_EXPLOITS').flexReload();\n\t\tvar ID={$ID};\n\t\tif(ID==0){ YahooWin5Hide();}\n\t\t\n\t}\n\n\n\tfunction Submit{$t}(){\n\t\tvar XHR = new XHRConnection();\t\n\t\tXHR.appendData('editgroupid','{$ID}');\n\t\tXHR.appendData('servername','{$_GET["servername"]}');\n\t\tXHR.appendData('groupname',encodeURIComponent(document.getElementById('groupname-{$t}').value));\n\t\tif(document.getElementById('addef-{$t}').checked){ XHR.appendData('addef',1); }else{ XHR.appendData('addef',0); }\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\t\n\t}\n</script>";
    echo $tpl->_ENGINE_parse_body(@implode("\n", $html));
}
Esempio n. 10
0
function rule_popup(){
	$dans=new dansguardian_rules();
	$md5=$_GET["rule-popup"];
	$tpl=new templates();
	$page=CurrentPageName();
	$fields_size=22;
	$q=new mysql_squid_builder();
	$sock=new sockets();
	$t=time();
	$bt="{add}";
	if($md5<>null){$bt="{apply}";}
	
	$Timez[0]="{default}";
	$Timez[5]="5 {minutes}";
	$Timez[10]="10 {minutes}";
	$Timez[15]="15 {minutes}";
	$Timez[30]="30 {minutes}";
	$Timez[60]="1 {hour}";
	$Timez[120]="2 {hours}";
	$Timez[240]="4 {hours}";
	$Timez[720]="12 {hours}";
	$Timez[2880]="2 {days}";
	
	$cats=$dans->LoadBlackListes();
	while (list ($num, $ligne) = each ($cats) ){$newcat[$num]=$num;}
	$newcat[null]="{none}";
	$newcat["safebrowsing"]="Google Safe Browsing";
	$newcat["blacklist"]="{blacklist}";
	
	
	$ligne=mysql_fetch_array($q->QUERY_SQL("SELECT * FROM ufdb_page_rules WHERE zmd5='$md5'"));
	if(!$q->ok){echo FATAL_ERROR_SHOW_128($q->mysql_error);return;}
	
	$html[]="<div style='width:98%' class=form>";
	$html[]="<table style='width:100%'>";
	$html[]=Field_list_table("category-$t","{category}",$ligne["category"],$fields_size,$newcat,null,450);
	$html[]=Field_list_table("maxtime-$t","{unlock_during}",$ligne["maxtime"],$fields_size,$Timez,null,450);
	$html[]=Field_text_table("adgroup-$t","{active_directory_group}",$ligne["adgroup"],$fields_size,null,450);
	$html[]=Field_text_table("username-$t","{username}",$ligne["username"],$fields_size,null,450);
	$html[]=Field_checkbox_table("deny-$t", "{deny_unlock}",$ligne["deny"],$fields_size,null,"UnCheckAllow$t()");
	$html[]=Field_checkbox_table("allow-$t", "{allow_unlock}",$ligne["allow"],$fields_size,null,"UnCheckDeny$t()");
	$html[]=Field_checkbox_table("noauth-$t", "{not_authenticate}",$ligne["noauth"],$fields_size);
	$html[]=Field_list_table("addTocat-$t","{automatically_add_to}",$ligne["addTocat"],$fields_size,$newcat,null,450);
	
	
	$html[]=Field_button_table_autonome($bt,"Submit$t",30);
	$html[]="</table>";
	$html[]="</div>
	<script>
	var xSubmit$t= function (obj) {
		var results=obj.responseText;
		if(results.length>3){alert(results);}
		$('#UFDB_PAGE_RULE').flexReload();
	
	}
	
	function UnCheckAllow$t(){
		if(document.getElementById('deny-$t').checked){
			document.getElementById('allow-$t').checked=false;
		}else{
			document.getElementById('allow-$t').checked=true;
		
		}
	
	}
	
	function UnCheckDeny$t(){
		if(document.getElementById('allow-$t').checked){
			document.getElementById('deny-$t').checked=false;
		}else{
			document.getElementById('deny-$t').checked=true;
		}
	}
	
	
	function Submit$t(){
		var XHR = new XHRConnection();
		XHR.appendData('rule','$md5');
		XHR.appendData('category',document.getElementById('category-$t').value);
		XHR.appendData('adgroup',document.getElementById('adgroup-$t').value);
		XHR.appendData('username',document.getElementById('username-$t').value);
		XHR.appendData('addTocat',document.getElementById('addTocat-$t').value);
		XHR.appendData('maxtime',document.getElementById('maxtime-$t').value);
		
		
		
		
		if(document.getElementById('deny-$t').checked){
			XHR.appendData('deny','1');	
		}else{
			XHR.appendData('deny','0');	
		
		}
		if(document.getElementById('allow-$t').checked){
			XHR.appendData('allow','1');	
		}else{
			XHR.appendData('allow','0');	
		
		}	

		if(document.getElementById('noauth-$t').checked){
			XHR.appendData('noauth','1');	
		}else{
			XHR.appendData('noauth','0');	
		
		}		

		XHR.sendAndLoad('$page', 'POST',xSubmit$t);
	}
	
	UnCheckAllow$t();
	</script>
		
	";
	echo $tpl->_ENGINE_parse_body(@implode("\n", $html));
}
Esempio n. 11
0
function rule_popup()
{
    $ID = intval($_GET["ID"]);
    $tpl = new templates();
    $page = CurrentPageName();
    $fields_size = 22;
    $q = new mysql_squid_builder();
    $sock = new sockets();
    $t = time();
    $bt = "{add}";
    if ($ID > 0) {
        $bt = "{apply}";
    }
    $Timez[1] = "{by_hour}";
    $Timez[2] = "{by_day}";
    $Timez[3] = "{by_week}";
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM webfilter_quotas WHERE ID='{$ID}'"));
    if (!$q->ok) {
        echo FATAL_ERROR_SHOW_128($q->mysql_error);
        return;
    }
    $Timez[0] = "{by_hour}";
    if (!is_numeric($ligne["quotasize"])) {
        $ligne["quotasize"] = 250;
    }
    if (!is_numeric($ligne["quotaPeriod"])) {
        $ligne["quotaPeriod"] = 1;
    }
    if ($ligne["groupname"] == null) {
        $ligne["groupname"] = $tpl->javascript_parse_text("{new_rule}");
        $ligne["enabled"] = 1;
        $ligne["zOrder"] = 0;
    }
    $html[] = "<div style='width:98%;font-size:28px;margin-bottom:20px'>{rule}: ({$ID}) {$ligne["groupname"]}</div>";
    $html[] = "<div style='width:98%' class=form>";
    $html[] = "<table style='width:100%'>";
    $html[] = Field_text_table("groupname-{$t}", "{rulename}", $ligne["groupname"], $fields_size, null, 450);
    $html[] = Field_checkbox_table("enabled-{$t}", "{enabled}", $ligne["enabled"], $fields_size, null, "CheckEnabled{$t}()");
    $html[] = Field_text_table("zorder-{$t}", "{order}", $ligne["zOrder"], $fields_size, null, 110);
    $html[] = Field_text_table("quotasize-{$t}", "{max_size} MB", $ligne["quotasize"], $fields_size, null, 110);
    $html[] = Field_list_table("quotaPeriod-{$t}", "{period}", $ligne["quotaPeriod"], $fields_size, $Timez, null, 450);
    $html[] = Field_checkbox_table("AllSystems-{$t}", "{AllSystems}", $ligne["AllSystems"], $fields_size, null, "blur()");
    $html[] = Field_checkbox_table("UseExternalWebPage-{$t}", "{UseExternalWebPage}", $ligne["UseExternalWebPage"], $fields_size, null, "UnCheckUseExternalWebPage{$t}()");
    $html[] = Field_text_table("ExternalWebPage-{$t}", "{ExternalWebPage}", $ligne["ExternalWebPage"], $fields_size, null, 450);
    $html[] = Field_button_table_autonome($bt, "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\$('#SQUID_ARTICA_QUOTA_RULES').flexReload();\n\tvar ID='{$ID}';\n\tif(ID==0){ YahooWin3Hide();return;}\n\tRefreshTab('main_quota_rule_{$ID}');\n}\n\t\n\n\t\nfunction UnCheckUseExternalWebPage{$t}(){\n\tif(!document.getElementById('enabled-{$t}').checked){return;}\n\tif(document.getElementById('UseExternalWebPage-{$t}').checked){\n\t\tdocument.getElementById('ExternalWebPage-{$t}').disabled=false;\n\t}else{\n\t\tdocument.getElementById('ExternalWebPage-{$t}').disabled=true;\n\t}\n}\n\nfunction CheckEnabled{$t}(){\n\tdocument.getElementById('ExternalWebPage-{$t}').disabled=true;\n\tdocument.getElementById('UseExternalWebPage-{$t}').disabled=true;\n\tdocument.getElementById('groupname-{$t}').disabled=true;\n\tdocument.getElementById('zorder-{$t}').disabled=true;\n\tdocument.getElementById('quotasize-{$t}').disabled=true;\n\tdocument.getElementById('quotaPeriod-{$t}').disabled=true;\n\tdocument.getElementById('AllSystems-{$t}').disabled=true;\n\tif(document.getElementById('enabled-{$t}').checked){\n\t\tdocument.getElementById('ExternalWebPage-{$t}').disabled=false;\n\t\tdocument.getElementById('UseExternalWebPage-{$t}').disabled=false;\n\t\tdocument.getElementById('groupname-{$t}').disabled=false;\n\t\tdocument.getElementById('quotasize-{$t}').disabled=false;\n\t\tdocument.getElementById('quotaPeriod-{$t}').disabled=false;\n\t\tdocument.getElementById('AllSystems-{$t}').disabled=false;\n\t\tdocument.getElementById('zorder-{$t}').disabled=false;\n\t}\n}\n\t\n\t\nfunction Submit{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('ID','{$ID}');\n\tXHR.appendData('groupname',encodeURIComponent(document.getElementById('groupname-{$t}').value));\n\tXHR.appendData('quotasize',document.getElementById('quotasize-{$t}').value);\n\tXHR.appendData('quotaPeriod',document.getElementById('quotaPeriod-{$t}').value);\n\tXHR.appendData('ExternalWebPage',encodeURIComponent(document.getElementById('ExternalWebPage-{$t}').value));\n\tXHR.appendData('zorder',document.getElementById('zorder-{$t}').value);\n\tif(document.getElementById('AllSystems-{$t}').checked){XHR.appendData('AllSystems','1');}else{XHR.appendData('AllSystems','0');}\n\tif(document.getElementById('enabled-{$t}').checked){XHR.appendData('enabled','1');}else{XHR.appendData('enabled','0');}\n\tif(document.getElementById('UseExternalWebPage-{$t}').checked){XHR.appendData('UseExternalWebPage','1');}else{XHR.appendData('UseExternalWebPage','0');}\n\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n\t}\n\t\n\t\n\tUnCheckUseExternalWebPage{$t}();\n\tCheckEnabled{$t}();\n</script>\n\t\n\t";
    echo $tpl->_ENGINE_parse_body(@implode("\n", $html));
}
Esempio n. 12
0
function websites_popup_webserver_replace_popup()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $servername = $_GET["servername"];
    $q = new mysql_squid_builder();
    $title = "{new_rule}";
    $bt = "{add}";
    $ID = intval($_GET["replaceid"]);
    $boot = new boostrap_form();
    $sock = new sockets();
    $servername = $_GET["servername"];
    $t = time();
    $fields_size = 22;
    if ($ID > 0) {
        $q = new mysql_squid_builder();
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM nginx_replace_www WHERE ID='{$ID}'"));
        $bt = "{apply}";
        $title = "{$ligne["rulename"]}";
        $ligne["stringtosearch"] = stripslashes($ligne["stringtosearch"]);
        $ligne["replaceby"] = stripslashes($ligne["replaceby"]);
        $servername = $ligne["servername"];
    }
    if ($ligne["tokens"] == null) {
        $ligne["tokens"] = "gir";
    }
    if ($ligne["rulename"] == null) {
        $ligne["rulename"] = time();
    }
    $html[] = "<div style='width:98%' class=form><div style='font-size:30px;margin-bottom:20px'>{$title}</div>\n\t<div class=explain style='font-size:18px'>{nginx_subst_explain}</div>";
    $html[] = "<table style='width:100%'>";
    $html[] = Field_text_table("rulename-{$t}", "{rulename}", $ligne["rulename"], $fields_size, null, 450);
    $html[] = Field_text_table("zorder-{$t}", "{order}", intval($ligne["zorder"]), $fields_size, null, 110);
    $html[] = Field_area_table("stringtosearch-{$t}", "{search}", $ligne["stringtosearch"], $fields_size, null, 145);
    $html[] = Field_checkbox_table("AsRegex-{$t}", "{regex}", $ligne["AsRegex"], $fields_size, "{replace_regex_explain}");
    $html[] = Field_area_table("replaceby-{$t}", "{replace}", $ligne["replaceby"], $fields_size, null, 145);
    $html[] = Field_text_table("tokens-{$t}", "{flags}", $ligne["tokens"], $fields_size, null);
    $html[] = Field_button_table_autonome($bt, "Submit{$t}", 30);
    $html[] = "</table>";
    $html[] = "</div>\n<script>\n\tvar xSubmit{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>3){alert(results);}\n\t\$('#NGINX_MAIN_TABLE').flexReload();\n\t\$('#NGINX_REPLACE_RULES').flexReload();\n\tvar ID={$ID}\n\tif(ID==0){ YahooWin3Hide();}\n\t\n}\n\t\n\t\nfunction Submit{$t}(){\n\tvar AsRegex=0\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('replaceid','{$ID}');\n\tif(document.getElementById('AsRegex-{$t}').checked){AsRegex=1;}\n\tXHR.appendData('servername','{$servername}');\n\tXHR.appendData('rulename',encodeURIComponent(document.getElementById('rulename-{$t}').value));\n\tXHR.appendData('zorder',document.getElementById('zorder-{$t}').value);\n\tXHR.appendData('stringtosearch',encodeURIComponent(document.getElementById('stringtosearch-{$t}').value));\n\tXHR.appendData('replaceby',encodeURIComponent(document.getElementById('replaceby-{$t}').value));\n\tXHR.appendData('AsRegex',AsRegex);\n\tXHR.appendData('tokens',document.getElementById('tokens-{$t}').value);\n\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n}\n</script>\n\t\n\t";
    echo $tpl->_ENGINE_parse_body(@implode("\n", $html));
}
Esempio n. 13
0
function rule_popup()
{
    $ID = intval($_GET["ID"]);
    $tpl = new templates();
    $page = CurrentPageName();
    $fields_size = 22;
    $q = new mysql_squid_builder();
    $sock = new sockets();
    $t = time();
    $bt = "{add}";
    if ($ID > 0) {
        $bt = "{apply}";
    }
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM acls_ntlm WHERE ID='{$ID}'"));
    if (!$q->ok) {
        echo FATAL_ERROR_SHOW_128($q->mysql_error);
        return;
    }
    $title = "{rule}: ({$ID}) {$ligne["item"]}";
    $Timez[0] = "{by_hour}";
    if (!is_numeric($ligne["quotasize"])) {
        $ligne["quotasize"] = 250;
    }
    if (!is_numeric($ligne["quotaPeriod"])) {
        $ligne["quotaPeriod"] = 1;
    }
    if ($ID == 0) {
        $title = $tpl->javascript_parse_text("{new_rule}");
        $ligne["enabled"] = 1;
    }
    $q->acl_NTLM[null] = "{select}";
    $html[] = "<div style='width:98%;font-size:28px;margin-bottom:20px'>{$title}</div>\n\t<div style='margin-top:5px;margin-bottom:20px;font-size:18px'>{whitelist_ntlm_explain}</div>\n\t";
    $html[] = "<div style='width:98%' class=form>";
    $html[] = "<table style='width:100%'>";
    $html[] = Field_list_table("type-{$t}", "{type}", $ligne["Type"], $fields_size, $q->acl_NTLM, "ShowHelp{$t}()", 450);
    $html[] = Field_text_table("item-{$t}", "{item}", $ligne["item"], $fields_size, null, 450);
    $html[] = Field_checkbox_table("enabled-{$t}", "{enabled}", $ligne["enabled"], $fields_size, null, "CheckEnabled{$t}()");
    $html[] = "<tr><td colspan=2><div id='help-{$t}'></div></td></tr>";
    $html[] = Field_button_table_autonome($bt, "Submit{$t}", 30);
    $html[] = "</table>";
    $html[] = "</div>\n\t<script>\n\tvar xSubmit{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>3){alert(results);return;}\n\t\$('#SQUID_NTLM_WHITE').flexReload();\n\tvar ID='{$ID}';\n\tif(ID==0){ YahooWin3Hide();return;}\n\t\n}\nfunction CheckEnabled{$t}(){\n\tdocument.getElementById('type-{$t}').disabled=true;\n\tdocument.getElementById('item-{$t}').disabled=true;\n\tif(document.getElementById('enabled-{$t}').checked){\n\t\tdocument.getElementById('type-{$t}').disabled=false;\n\t\tdocument.getElementById('item-{$t}').disabled=false;\n\t}\n}\n\n\nfunction Submit{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('ID','{$ID}');\n\tXHR.appendData('item',encodeURIComponent(document.getElementById('item-{$t}').value));\n\tXHR.appendData('type',document.getElementById('type-{$t}').value);\n\tif(document.getElementById('enabled-{$t}').checked){XHR.appendData('enabled','1');}else{XHR.appendData('enabled','0');}\n\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n}\n\nfunction ShowHelp{$t}(){\n\tLoadAjaxTiny('help-{$t}','{$page}?help=yes&type='+document.getElementById('type-{$t}').value+'&t={$t}');\n}\n\nCheckEnabled{$t}();\nShowHelp{$t}();\n</script>\n\n";
    echo $tpl->_ENGINE_parse_body(@implode("\n", $html));
}
function wizard_certificate_1()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $hostname = $sock->GET_INFO("myhostname");
    $t = time();
    $ENC[1024] = 1024;
    $ENC[2048] = 2048;
    $ENC[4096] = 4096;
    if ($hostname == null) {
        $hostname = $sock->getFrameWork("system.php?hostname-g=yes");
        $sock->SET_INFO($hostname, "myhostname");
    }
    $title = $tpl->_ENGINE_parse_body("{new_certificate}");
    $html[] = "<div class=explain style='font-size:18px'>{wizard_certificate_1}<br><i>{CSR_MULTIPLE_EXPLAIN}</i></div>";
    $html[] = "<div style='width:98%' class=form>";
    $html[] = "<table style='width:100%'>";
    $html[] = Field_text_table("wizard-certificate-commonname", "{CommonName}", $hostname, 22, null, 400);
    $html[] = Field_checkbox_table("AsSquidCertificate", "{proxy_certificate}", 0, 22, "{proxy_gen_certificate_explain}");
    $html[] = Field_list_table("wizard-certificate-levelenc", "{level_encryption}", 2048, 22, $ENC);
    $html[] = Field_password_table("wizard-certificate-password", "{password}", "secret", 22, null, 300);
    $html[] = Field_button_table_autonome("{add}", "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\n\tif(document.getElementById('squid_ports_popup_certificates')){\n\t\tif(document.getElementById('squid_ports_popup_certificates_num')){\n\t\t\tvar id=document.getElementById('squid_ports_popup_certificates_num').value;\n\t\t\tvar Common=document.getElementById('wizard-certificate-commonname').value;\n\t\t\tLoadAjaxSilent('squid_ports_popup_certificates','squid.ports.php?certificate-refresh=yes&default='+Common+'&t='+id);\n\t\t}\n\t}\t\n\t\n\t\n\t\$('#TABLE_CERTIFICATE_CENTER_MAIN').flexReload();\n\t\n\tvar commonName=document.getElementById('wizard-certificate-commonname').value;\n\tLoadjs('openssl.CSR.progress.php?generate-csr='+commonName);\n\tYahooWin6Hide();\n\t\n}\n\t\n\t\nfunction Submit{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('wizard-certificate-commonname',encodeURIComponent(document.getElementById('wizard-certificate-commonname').value));\n\tXHR.appendData('wizard-certificate-levelenc',document.getElementById('wizard-certificate-levelenc').value);\n\tXHR.appendData('wizard-certificate-password',encodeURIComponent(document.getElementById('wizard-certificate-password').value));\n\tif(document.getElementById('AsSquidCertificate').checked){\n\t\tXHR.appendData('wizard-certificate-proxy',1);\n\t}else{\n\t\tXHR.appendData('wizard-certificate-proxy',0);\n\t}\n\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n}\n</script>\n\t\t\n\t";
    echo $tpl->_ENGINE_parse_body(@implode("\n", $html));
}
function rule_files_types()
{
    $MimeArray = MimeArray();
    $ID = $_GET["ID"];
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $t = time();
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT `FileTypes` FROM artica_caches WHERE ID='{$ID}'", "artica_backup"));
    $FileTypes = unserialize($ligne["FileTypes"]);
    while (list($mime, $ligne) = each($MimeArray)) {
        $FT = explode("/", $mime);
        $FT[0] = trim($FT[0]);
        if ($FT[0] == null) {
            continue;
        }
        $MIMETT[$FT[0]] = true;
        $FTMIME[$FT[0]][] = $mime;
    }
    krsort($MIMETT);
    while (list($mimeF, $ligne) = each($MIMETT)) {
        if (trim($mimeF) == null) {
            continue;
        }
        if (count($FTMIME[$mimeF]) == 0) {
            continue;
        }
        $mainid = md5($mimeF . $t);
        ksort($FTMIME[$mimeF]);
        $htmlez = array();
        $c = 0;
        while (list($mimeF2, $mime) = each($FTMIME[$mimeF])) {
            $mimeEnc = md5("{$mime}-{$t}");
            if (!isset($FileTypes[$mime])) {
                $FileTypes[$mime] = 0;
            }
            $htmlez[] = "\t" . Field_checkbox_table($mimeEnc, $mime, $FileTypes[$mime]) . "\n";
            $scripts[] = "if(document.getElementById('{$mimeEnc}').checked){XHR.appendData('{$mime}',1);}else{XHR.appendData('{$mime}',0);}";
            $c++;
        }
        if (count($htmlez) == 0) {
            continue;
        }
        $INVIS[] = "document.getElementById('{$mainid}').style.display='none';";
        $htmle[] = "\n\t\t<div>\n\t\t\t<a href=\"javascript:blur();\" \n\t\t\tOnClick=\"javascript:Switch{$t}('{$mainid}');\" \n\t\t\tstyle='font-size:30px;text-decoration:underline'>{$mimeF}</a>\n\t\t</div>\n\t\t<div id='{$mainid}' style='display:none'>\n\t\t\t<table style='width:100%'>" . @implode("\n", $htmlez) . "</table>\n\t\t</div>";
    }
    $html = "\n<div style='width:98%' class=form>\n\t" . @implode("\n", $htmle) . "<table style='width:100%'>" . Field_button_table_autonome("{apply}", "Save{$t}()", 26) . "\n\t\t</table>\n</div>\n<script>\nvar xSave{$t}=function (obj) {\n\tvar tempvalue=obj.responseText;\n\tif(tempvalue.length>3){alert(tempvalue);}\n\t\$('#squid_enforce_rules_table').flexReload();\n}\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('MIME-ID','{$_GET["ID"]}');\n\t" . @implode("\n", $scripts) . "\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\n\t}\n\n\nfunction Switch{$t}(mainid){\n\t" . @implode("\n", $INVIS) . "\n\tdocument.getElementById(mainid).style.display='block';\n}\n\t\n\n</script>\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Esempio n. 16
0
function report_main()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $dans = new dansguardian_rules();
    $cats = $dans->LoadBlackListes();
    while (list($num, $ligne) = each($cats)) {
        $newcat[$num] = $num;
    }
    $newcat[null] = "{none}";
    $sql = "SELECT DATE_FORMAT(zDate,'%Y-%m-%d') as tdate FROM tables_day ORDER BY zDate LIMIT 0,1";
    $ligne2 = mysql_fetch_array($q->QUERY_SQL($sql));
    $mindate = $ligne2["tdate"];
    $sql = "SELECT DATE_FORMAT(zDate,'%Y-%m-%d') as tdate FROM tables_day ORDER BY zDate DESC LIMIT 0,1";
    $ligne2 = mysql_fetch_array($q->QUERY_SQL($sql));
    $maxdate = $ligne2["tdate"];
    $ID = $_GET["ID"];
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM `squid_reports` WHERE ID='{$ID}'"));
    $t = time();
    $report_days[0] = "{date_range}";
    $report_days[2] = "2 {days}";
    $report_days[7] = "1 {week}";
    $report_days[15] = "2 {weeks}";
    $report_days[-1] = "{current_month}";
    $report_days[30] = "1 {month}";
    $report_days[60] = "2 {months}";
    $report_days[90] = "3 {months}";
    $report_days[180] = "6 {months}";
    $report_days[365] = "1 {year}";
    $report_build_time_start = $ligne["report_build_time_start"];
    $report_build_time_end = $ligne["report_build_time_end"];
    if ($report_build_time_start == 0) {
        $report_build_time_start = $mindate;
    } else {
        $report_build_time_start = date("Y-m-d", $report_build_time_start);
    }
    if ($report_build_time_end == 0) {
        $report_build_time_end = $maxdate;
    } else {
        $report_build_time_end = date("Y-m-d", $report_build_time_end);
    }
    if ($ligne["report_name"] == null) {
        $ligne["report_name"] = "New report";
    }
    $html = "<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t" . Field_text_table("report_name-{$t}", "{report}", utf8_encode($ligne["report_name"]), 18, null, 350) . Field_text_table("description-{$t}", "{description}", utf8_encode($ligne["description"]), 18, null, 350) . Field_list_table("report_type-{$t}", "{type}", $ligne["report_type"], 18, $q->report_types) . Field_list_table("report_days-{$t}", "{from_the_last_time}", $ligne["report_days"], 18, $report_days, "ReportDaysCheck()") . "<tr>\n\t\t<td style='font-size:18px' class=legend>{from_date}:</td>\n\t\t<td>" . field_date("report_build_time_start-{$t}", $report_build_time_start, "font-size:18px;padding:3px;width:120px", "mindate:{$mindate};maxdate:{$maxdate}") . "</td>\n\t</tr>\n<tr>\n\t\t<td style='font-size:18px' class=legend>{to_date}:</td>\n\t\t<td>" . field_date("report_build_time_end-{$t}", $report_build_time_end, "font-size:18px;padding:3px;width:120px", "mindate:{$mindate};maxdate:{$maxdate}") . "</td>\n\t</tr>\t\t" . Field_checkbox_table("recategorize-{$t}", "{recategorize}", $ligne["recategorize"], 18) . Field_checkbox_table("categorize-{$t}", "{categorize}", $ligne["categorize"], 18) . Field_checkbox_table("report_not_categorized-{$t}", "{report_not_categorized}", $ligne["report_not_categorized"], 18) . Field_button_table_autonome("{apply}", "Save{$t}", 26) . "</table>\n\t</div>\t\n<script>\n\n\tvar xSave{$t}= function (obj) {\n\t\tvar res=obj.responseText;\n\t\t\n\t\tif (res.length>3){\n\t\t\talert(res);\n\t\t\treturn;\n\t\t}\n\t\t\$('#SQUID_MAIN_REPORTS').flexReload();\n\t\tRefreshTab('report_single_tab');\n\t}\t\n\t\n\tfunction ReportDaysCheck(){\n\t\tdocument.getElementById('report_build_time_start-{$t}').disabled=true;\n\t\tdocument.getElementById('report_build_time_end-{$t}').disabled=true;\n\t\tvar report_days=document.getElementById('report_days-{$t}').value;\n\t\tif(report_days==0){\n\t\t\tdocument.getElementById('report_build_time_start-{$t}').disabled=false;\n\t\t\tdocument.getElementById('report_build_time_end-{$t}').disabled=false;\t\t\n\t\t}\n\t}\n\n\tfunction Save{$t}(){\n\t\tvar XHR = new XHRConnection();\n\t\t\n\t\tXHR.appendData('ID',{$ID});\n\t\tXHR.appendData('report_name',encodeURIComponent(document.getElementById('report_name-{$t}').value));\n\t\tXHR.appendData('description',encodeURIComponent(document.getElementById('description-{$t}').value));\n\t\t\n\t\tXHR.appendData('report_build_time_start',document.getElementById('report_build_time_start-{$t}').value);\n\t\tXHR.appendData('report_build_time_end',document.getElementById('report_build_time_end-{$t}').value);\n\t\t\n\t\tXHR.appendData('report_type',document.getElementById('report_type-{$t}').value);\n\t\tXHR.appendData('report_days',document.getElementById('report_days-{$t}').value);\n\t\tif(document.getElementById('recategorize-{$t}').checked){XHR.appendData('recategorize',1);}else{XHR.appendData('recategorize',0);}\n\t\tif(document.getElementById('categorize-{$t}').checked){XHR.appendData('categorize',1);}else{XHR.appendData('categorize',0);}\n\t\tif(document.getElementById('report_not_categorized-{$t}').checked){XHR.appendData('report_not_categorized',1);}else{XHR.appendData('report_not_categorized',0);}\n\t\t\n\t\t\n\t\t\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\t\n\t}\n\t\nReportDaysCheck();\n</script>\n\t\t\t\n\t\t\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Esempio n. 17
0
function skin_parameters()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $sql = "SELECT ID,groupname FROM webfilter_rules WHERE enabled=1";
    $results = $q->QUERY_SQL($sql);
    $RULES["0"] = "{default}";
    $btname = "{add}";
    $t = time();
    while ($ligne = mysql_fetch_assoc($results)) {
        $RULES[$ligne["ID"]] = "{$ligne["groupname"]}";
    }
    $dans = new dansguardian_rules();
    $cats = $dans->LoadBlackListes();
    $newcat["*"] = "{all}";
    while (list($num, $ligne) = each($cats)) {
        $newcat[$num] = $num;
    }
    $newcat["safebrowsing"] = "Google Safe Browsing";
    $newcat["blacklist"] = "{blacklist}";
    $newcat["restricted_time"] = "{restricted_access}";
    $newcat["generic"] = "{generic}";
    $ligne["enabled"] = 1;
    if ($_GET["zmd5"] != null) {
        $sql = "SELECT * FROM ufdb_design WHERE zmd5='{$_GET["zmd5"]}'";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
        if (!$q->ok) {
            echo $q->mysql_error_html();
        }
        $btname = "{apply}";
    }
    $html = "\n\t<div style='width:98%' class=form>\n\t\t\t<table style='width:100%'>\n\t\t" . Field_list_table("category-{$t}", "{category}", $ligne["category"], 26, $newcat) . Field_list_table("ruleid-{$t}", "{rule}", $ligne["ruleid"], 26, $RULES) . Field_checkbox_table("enabled-{$t}", "{enabled}", $ligne["enabled"], 26) . Field_spacer_table(50) . Field_button_table_autonome("{$btname}", "Save{$t}", 34) . "</table>\n\t</div>\n<script>\n\tvar xSave{$t}= function (obj) {\n\t\tvar zmd5='{$_GET["zmd5"]}';\n\t\tvar res=obj.responseText;\n\t\tif(res.length>3){alert(res);return;}\n\t\t\$('#UFDB_SKIN_RULES').flexReload();\n\t\tif(zmd5.length==0){YahooWin3Hide(); }\n\t}\t\n\n\t\n\tfunction Save{$t}(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('zmd5-params','{$_GET["zmd5"]}');\n\t\tXHR.appendData('category',document.getElementById('category-{$t}').value);\n\t\tXHR.appendData('ruleid',document.getElementById('ruleid-{$t}').value);\n\t\tif(document.getElementById('enabled-{$t}').checked){XHR.appendData('enabled',1);}else{XHR.appendData('enabled',0);}\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\t\n\t}\n\n\tfunction check{$t}(){\n\t\tvar zmd5='{$_GET["zmd5"]}';\n\t\tif(zmd5.length>5){\n\t\t\tdocument.getElementById('category-{$t}').disabled=true;\n\t\t\tdocument.getElementById('ruleid-{$t}').disabled=true;\n\t\t\n\t\t}\n\t\n\t}\ncheck{$t}();\t\t\t\t\n</script>\t\t\t\t\n";
    echo $tpl->_ENGINE_parse_body($html);
}