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=text-info 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_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);}\n\t\$('#flexRT{$_GET["t"]}').flexReload();\n\tYahooWin6Hide();\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\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n}\n</script>\n\t\t\n\t"; echo $tpl->_ENGINE_parse_body(@implode("\n", $html)); }
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"]} «{$servername}»{$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)); }
function page() { $sock = new sockets(); $page = CurrentPageName(); $tpl = new templates(); $MikrotikTransparent = intval($sock->GET_INFO('MikrotikTransparent')); $MikrotikHTTPSquidPort = intval($sock->GET_INFO('MikrotikHTTPSquidPort')); $MikrotikVirtualIP = $sock->GET_INFO('MikrotikVirtualIP'); $MikrotikLocalInterface = $sock->GET_INFO('MikrotikLocalInterface'); $MikrotikNetMask = $sock->GET_INFO('MikrotikNetMask'); $MikrotikIPAddr = $sock->GET_INFO('MikrotikIPAddr'); $MikrotikLAN = $sock->GET_INFO('MikrotikLAN'); $MikrotikSSLTransparent = intval($sock->GET_INFO("MikrotikSSLTransparent")); $MikrotikHTTPSSquidPort = intval($sock->GET_INFO("MikrotikHTTPSSquidPort")); $ip = new networking(); $ipsH = $ip->Local_interfaces(); $t = time(); if ($MikrotikHTTPSquidPort == 0) { $MikrotikHTTPSquidPort = rand(9090, 63000); } if ($MikrotikHTTPSSquidPort == 0) { $MikrotikHTTPSSquidPort = rand(9190, 63000); } if ($MikrotikVirtualIP == null) { $MikrotikVirtualIP = "172.16.24.2"; } if ($MikrotikNetMask == null) { $MikrotikNetMask = "255.255.255.252"; } if ($MikrotikIPAddr == null) { $MikrotikIPAddr = "172.16.24.1"; } if ($MikrotikLAN == null) { $MikrotikLAN = "192.168.1.0/24"; } if ($MikrotikLocalInterface == null) { $MikrotikLocalInterface = "eth0"; } $ARRAYBT["{apply}"] = "Apply{$t}"; $ARRAYBT["{save}"] = "Save{$t}"; $p = Paragraphe_switch_img("{mikrotik_compliance}", "{mikrotik_compliance_explain}", "MikrotikTransparent", $MikrotikTransparent, null, 760); $p2 = Paragraphe_switch_img("{mikrotik_ssl_compliance}", "{mikrotik_ssl_compliance_explain}", "MikrotikSSLTransparent", $MikrotikSSLTransparent, null, 760); $html = "\n\t<div style='text-align:right'><img src='img/mikrotik-150.png'></div>\n\t<div style='width:95%;padding:30px' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td style='vertical-align:top;width:220px'><div id='mikrotik-ipface'></div></td>\n\t\t<td style='vertical-align:top;width:99%;padding-left:30px'>\n\t\n\t\t\t{$p}{$p2}\n\t\t</td>\n\t</table>\n\t<table style='width:100%'>\n\t" . Field_text_table("MikrotikHTTPSquidPort", "{proxy_listen_port}", $MikrotikHTTPSquidPort, 22, null) . Field_text_table("MikrotikHTTPSSquidPort", "{proxy_listen_port} (SSL)", $MikrotikHTTPSSquidPort, 22, null) . Field_list_table("MikrotikLocalInterface", "{local_interface}", $MikrotikLocalInterface, 22, $ipsH) . Field_ipv4_table("MikrotikVirtualIP", "{local_ip_address}", $MikrotikVirtualIP, 22, "{MikrotikVirtualIP}", null) . Field_text_table("MikrotikNetMask", "{netmask}", $MikrotikNetMask, 22) . Field_ipv4_table("MikrotikIPAddr", "{mikrotik_address}", $MikrotikIPAddr, 22, "{mikrotik_address_explain}") . Field_area_table("MikrotikLAN", "{your_network}", $MikrotikLAN, 22, null) . Field_buttons_table_autonome($ARRAYBT, 32) . "\n\t</table>\n\t<div id='mikrotik-config'></div>\n</div>\n\n\n<script>\n\n\tvar xSave{$t}= function (obj) {\n\t\tvar res=obj.responseText;\n\t\t\n\t\tdocument.getElementById('mikrotik-config').innerHTML=res;\n\n\t}\t\n\t\n\t\n\t\n\t\n\n\n\tfunction Save{$t}(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('MikrotikSSLTransparent',document.getElementById('MikrotikSSLTransparent').value);\n\t\tXHR.appendData('MikrotikLocalInterface',document.getElementById('MikrotikLocalInterface').value);\n\t\tXHR.appendData('MikrotikTransparent',document.getElementById('MikrotikTransparent').value);\n\t\tXHR.appendData('MikrotikHTTPSquidPort',document.getElementById('MikrotikHTTPSquidPort').value);\n\t\tXHR.appendData('MikrotikHTTPSSquidPort',document.getElementById('MikrotikHTTPSSquidPort').value);\n\t\tXHR.appendData('MikrotikVirtualIP',document.getElementById('MikrotikVirtualIP').value);\n\t\tXHR.appendData('MikrotikNetMask',document.getElementById('MikrotikNetMask').value);\n\t\tXHR.appendData('MikrotikIPAddr',document.getElementById('MikrotikIPAddr').value);\n\t\tXHR.appendData('MikrotikLAN',document.getElementById('MikrotikLAN').value);\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\t\n\t}\n\t\nfunction Apply{$t}(){\t\n\tSave{$t}();\n\tLoadjs('squid.compile.progress.php?restart=yes&ask=yes');\n}\n\t\nSave{$t}();\nLoadAjax('mikrotik-ipface','{$page}?mikrotik-ipface=yes');\n</script>\t\t\t\t\t\n\t\n"; echo $tpl->_ENGINE_parse_body($html); }
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"]} «{$servername}»"); $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 «{$servername}»"); } 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 parameters_client() { $sock = new sockets(); $tpl = new templates(); $page = CurrentPageName(); $RemoteUfdbCat = intval($sock->GET_INFO("RemoteUfdbCat")); $ufdbCatPort = intval($sock->GET_INFO("ufdbCatPort")); $ufdbCatInterface = $sock->GET_INFO("ufdbCatInterface"); $EnableLocalUfdbCatService = intval($sock->GET_INFO("EnableLocalUfdbCatService")); $SquidPerformance = intval($sock->GET_INFO("SquidPerformance")); $EnableIntelCeleron = intval(file_get_contents("/etc/artica-postfix/settings/Daemons/EnableIntelCeleron")); if ($SquidPerformance == 0) { if ($EnableLocalUfdbCatService == 0) { $p00 = Paragraphe_switch_img("{local_categories_services_activated}", "{use_local_categories_services_perf}</strong>", "none", 1, null, 800, "blur()") . "<hr><p> </p>"; } } if ($ufdbCatPort == 0) { $ufdbCatPort = 3978; } $p0 = Paragraphe_switch_img("{use_local_categories_services}", "{use_remote_categories_services_explain}<br><strong>{use_local_categories_services_explain_warn}</strong>", "EnableLocalUfdbCatService", $EnableLocalUfdbCatService, null, 800, "EnableLocalUfdbCatServiceCheck()"); if ($SquidPerformance > 2) { $EnableLocalUfdbCatService = 0; $p0 = Paragraphe_switch_disable("{use_local_categories_services}", "{use_remote_categories_services_explain}<br><strong>{use_local_categories_services_explain_warn}</strong>", "EnableLocalUfdbCatService", $EnableLocalUfdbCatService, null, 800, "EnableLocalUfdbCatServiceCheck()"); } if ($EnableIntelCeleron == 1) { $EnableLocalUfdbCatService = 0; $p0 = Paragraphe_switch_disable("{use_local_categories_services}", "{use_remote_categories_services_explain}<br><strong>{CELERON_METHOD_EXPLAIN}</strong>", "EnableLocalUfdbCatService", $EnableLocalUfdbCatService, null, 800, "EnableLocalUfdbCatServiceCheck()"); } $p1 = Paragraphe_switch_img("{use_remote_categories_services}", "{use_remote_categories_services_explain}", "RemoteUfdbCat", $RemoteUfdbCat, null, 800); $ip = new networking(); $ips = $ip->ALL_IPS_GET_ARRAY(); $ufdbCatInterface = $sock->GET_INFO("ufdbCatInterface"); $ufdbCatPort = intval($sock->GET_INFO("ufdbCatPort")); $UfdbCatThreads = intval($sock->GET_INFO("UfdbCatThreads")); unset($ips["127.0.0.1"]); for ($i = 1; $i < 65; $i++) { $threads[$i] = $i; } if ($UfdbCatThreads == 0) { $UfdbCatThreads = 4; } if ($ufdbCatPort == 0) { $ufdbCatPort = 3978; } $ips[null] = "{none}"; reset($ips); $t = time(); $html = "\n<div style='width:98%' class=form>\n\t\t\t{$p00}{$p0}\n\t\t\t<table style='width:100%'>" . Field_list_table("ufdbCatInterface1", "{listen_address}", $ufdbCatInterface, 22, $ips) . Field_text_table("ufdbCatPort1", "{listen_port}", $ufdbCatPort, 22, null, 120) . Field_list_table("UfdbCatThreads1", "{threads}", $UfdbCatThreads, 22, $threads) . "</table>\n\t\t\t<div id='design1-{$t}'>{$p1}\n\t<table style='width:100%'>\n\t " . Field_text_table("ufdbCatInterface", "{remote_address}", $ufdbCatInterface, 22, null, 230) . Field_text_table("ufdbCatPort", "{listen_port}", $ufdbCatPort, 22, null, 120) . "</table>\n\t</div>" . "\n\t\t\t\n\t\t\t\n<table style='width:100%'>" . Field_button_table_autonome("{apply}", "Save{$t}()", 32) . "\n\t\t</table>\n\t\t</div>\n\t\t<script>\nvar xSave{$t}=function (obj) {\n\tRefreshTab('main_ufdbguard_config');\n\tLoadjs('squid.reconfigure.simple.php');\n}\n\t\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tvar EnableLocalUfdbCatService=document.getElementById('EnableLocalUfdbCatService').value;\n\t\n\tif(EnableLocalUfdbCatService==0){\n\t\tXHR.appendData('ufdbCatInterface',document.getElementById('ufdbCatInterface').value);\n\t\tXHR.appendData('ufdbCatPort',document.getElementById('ufdbCatPort').value);\n\t\tXHR.appendData('RemoteUfdbCat',document.getElementById('RemoteUfdbCat').value);\n\t}else{\n\t\tXHR.appendData('ufdbCatInterface',document.getElementById('ufdbCatInterface1').value);\n\t\tXHR.appendData('ufdbCatPort',document.getElementById('ufdbCatPort1').value);\n\t\tXHR.appendData('UfdbCatThreads',document.getElementById('UfdbCatThreads1').value);\n\t\n\t}\n\tXHR.appendData('EnableLocalUfdbCatService',document.getElementById('EnableLocalUfdbCatService').value);\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\n}\n\t\n\t\n\tfunction EnableLocalUfdbCatServiceCheck(){\n\tvar EnableLocalUfdbCatService=document.getElementById('EnableLocalUfdbCatService').value;\n\t\t\tdocument.getElementById('ufdbCatInterface').disabled=false;\n\t\t\tdocument.getElementById('ufdbCatPort').disabled=false;\n\t\t\tdocument.getElementById('RemoteUfdbCat').disabled=false;\n\t\t\tdocument.getElementById('ufdbCatInterface1').disabled=true;\n\t\t\tdocument.getElementById('ufdbCatPort1').disabled=true;\n\t\t\tdocument.getElementById('UfdbCatThreads1').disabled=true;\n\t\t\t\n\t\t\tdocument.getElementById('design1-{$t}').style.visibility='visible';\n\t\t\t\n\t\t\n\t\tif(EnableLocalUfdbCatService==1){\n\t\t\tdocument.getElementById('RemoteUfdbCat').disabled=true;\n\t\t\tdocument.getElementById('ufdbCatInterface').disabled=true;\n\t\t\tdocument.getElementById('ufdbCatPort').disabled=true;\n\t\t\tdocument.getElementById('RemoteUfdbCat').disabled=true;\n\t\t\tdocument.getElementById('ufdbCatInterface1').disabled=false;\n\t\t\tdocument.getElementById('ufdbCatPort1').disabled=false;\n\t\t\tdocument.getElementById('UfdbCatThreads1').disabled=false;\n\t\t\t\n\t\t\tdocument.getElementById('design1-{$t}').style.visibility='hidden';\n\t\t}\n\t\t\n\t\tCheckBoxDesignHidden();\n\t}\n\tEnableLocalUfdbCatServiceCheck();\n\t</script>\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function page() { $page = CurrentPageName(); $tpl = new templates(); $sock = new sockets(); $tpl = new templates(); $db = file_get_contents(dirname(__FILE__) . '/ressources/databases/ISO-3166-Codes-Countries.txt'); $tbl = explode("\n", $db); while (list($num, $ligne) = each($tbl)) { if (preg_match('#(.+?);\\s+([A-Z]{1,2})#', $ligne, $regs)) { $regs[2] = trim($regs[2]); $regs[1] = trim($regs[1]); $array_country_codes["{$regs[1]}_{$regs[2]}"] = $regs[1]; } } $ENC[1024] = 1024; $ENC[2048] = 2048; $ENC[4096] = 4096; $ligne = unserialize($sock->GET_INFO("OpenVPNCertificateSettings")); if ($ligne["CountryName"] == null) { $ligne["CountryName"] = "UNITED STATES_US"; } if ($ligne["stateOrProvinceName"] == null) { $ligne["stateOrProvinceName"] = "New York"; } if ($ligne["localityName"] == null) { $ligne["localityName"] = "Brooklyn"; } if ($ligne["emailAddress"] == null) { $ligne["emailAddress"] = "*****@*****.**"; } if ($ligne["OrganizationName"] == null) { $ligne["OrganizationName"] = "MyCompany Ltd"; } if ($ligne["OrganizationalUnit"] == null) { $ligne["OrganizationalUnit"] = "IT service"; } if (!is_numeric($ligne["CertificateMaxDays"])) { $ligne["CertificateMaxDays"] = 730; } if (!is_numeric($ligne["levelenc"])) { $ligne["levelenc"] = 2048; } $hostname = $sock->GET_INFO("myhostname"); $t = time(); $ENC[1024] = 1024; $ENC[2048] = 2048; $ENC[4096] = 4096; $bt_name = "{apply}"; $html[] = "<div style='font-size:42px;margin-bottom:15px'>{$hostname}</div>"; $html[] = "<div style='width:98%' class=form>"; $html[] = "<table style='width:100%'>"; $html[] = Field_list_table("CountryName-{$t}", "{countryName}", $ligne["CountryName"], 22, $array_country_codes); $html[] = Field_text_table("stateOrProvinceName", "{stateOrProvinceName}", $ligne["stateOrProvinceName"], 22, null, 400); $html[] = Field_text_table("localityName", "{localityName}", $ligne["localityName"], 22, null, 400); $html[] = Field_text_table("OrganizationName", "{organizationName}", $ligne["OrganizationName"], 22, null, 400); $html[] = Field_text_table("OrganizationalUnit", "{organizationalUnitName}", $ligne["OrganizationalUnit"], 22, null, 400); $html[] = Field_text_table("emailAddress", "{emailAddress}", $ligne["emailAddress"], 22, null, 400); $html[] = Field_text_table("CertificateMaxDays", "{CertificateMaxDays} ({days})", $ligne["CertificateMaxDays"], 22, null, 150); $html[] = Field_list_table("levelenc", "{level_encryption}", $ligne["levelenc"], 22, $ENC); $html[] = Field_password_table("password-{$t}", "{password}", $ligne["password"], 22, null, 300); $html[] = Field_button_table_autonome($bt_name, "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\tLoadjs('index.openvpn.client.progress.php?uid=OpenVPN-MASTER');\n}\n\t\n\t\nfunction Submit{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('CommonName',encodeURIComponent('{$hostname}'));\n\tXHR.appendData('CountryName',document.getElementById('CountryName-{$t}').value);\n\tXHR.appendData('CertificateMaxDays',document.getElementById('CertificateMaxDays').value);\n\tXHR.appendData('stateOrProvinceName',document.getElementById('stateOrProvinceName').value);\n\tXHR.appendData('localityName',document.getElementById('localityName').value);\n\tXHR.appendData('OrganizationName',document.getElementById('OrganizationName').value);\n\tXHR.appendData('OrganizationalUnit',document.getElementById('OrganizationalUnit').value);\n\tXHR.appendData('emailAddress',document.getElementById('emailAddress').value);\n\tXHR.appendData('levelenc',document.getElementById('levelenc').value);\n\tXHR.appendData('password',encodeURIComponent(document.getElementById('password-{$t}').value));\n\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n}\n</script>\n"; echo $tpl->_ENGINE_parse_body(@implode("\n", $html)); }
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); }
function general_settings() { $ID = $_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_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\n\t}\n\t\n\t\n\tfunction Submit{$t}(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('general-settings','{$ID}');\n\t\tXHR.appendData('servername',document.getElementById('servername-{$t}').value);\n\t\tXHR.appendData('ipaddr',document.getElementById('ipaddr-{$t}').value);\n\t\tXHR.appendData('port',document.getElementById('port-{$t}').value);\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)); }
function params() { $sock = new sockets(); $page = CurrentPageName(); $tpl = new templates(); $t = time(); $arrayConf = unserialize(base64_decode($sock->GET_INFO("ntopng"))); $EnableBandwidthd = intval($sock->GET_INFO("EnableBandwidthd")); $BandwidthdInstalled = intval($sock->GET_INFO("BandwidthdInstalled")); $Enablentopng = $sock->GET_INFO("Enablentopng"); if (!is_numeric($Enablentopng)) { $Enablentopng = 0; } if (!is_numeric($arrayConf["HTTP_PORT"])) { $arrayConf["HTTP_PORT"] = 3000; } if (!is_numeric($arrayConf["ENABLE_LOGIN"])) { $arrayConf["ENABLE_LOGIN"] = 0; } if (!is_numeric($arrayConf["MAX_DAYS"])) { $arrayConf["MAX_DAYS"] = 30; } if (!is_numeric($arrayConf["MAX_SIZE"])) { $arrayConf["MAX_SIZE"] = 5000; } $DisableNetDiscover = intval($sock->GET_INFO("DisableNetDiscover")); if ($DisableNetDiscover == 0) { $DisableNetDiscover = 1; } else { $DisableNetDiscover = 0; } $NetDiscoverSaved = $sock->GET_INFO("NetDiscoverSaved"); if (!is_numeric($NetDiscoverSaved)) { $DisableNetDiscover = 1; } $days[1] = "1 {day}"; $days[2] = "2 {days}"; $days[5] = "5 {days}"; $days[10] = "10 {days}"; $days[15] = "15 {days}"; $days[30] = "1 {month}"; $maxsizes[500] = "500MB"; $maxsizes[1000] = "1GB"; $maxsizes[5000] = "5GB"; $maxsizes[10000] = "10GB"; $maxsizes[50000] = "50GB"; if ($Enablentopng == 1) { $button = "<div style='margin-top:20px;text-align:right;width:100%'>" . button("{disable_service}", "Loadjs('system.ntopng.disable.php')", 28) . "</div>"; } $enable = Paragraphe_switch_img("{enable_ntopng}", "{enable_ntopng_text}", "Enablentopng", $Enablentopng, null, 850); $EnableBandwidthd_par = Paragraphe_switch_img("{EnableBandwidthd}", "{EnableBandwidthd_explain}", "EnableBandwidthd", $EnableBandwidthd, null, 850); if ($BandwidthdInstalled == 0) { $EnableBandwidthd_par = Paragraphe_switch_disable("{EnableBandwidthd}", "{EnableBandwidthd_explain}", "EnableBandwidthd", 0, null, 850); } $DisableBWMng = intval($sock->GET_INFO("DisableBWMng")); $INSTALLED = $sock->getFrameWork("system.php?ntopng-installed=yes"); if ($INSTALLED != "TRUE") { $error = $tpl->_ENGINE_parse_body(FATAL_ERROR_SHOW_128("{software_is_not_installed}")); $enable = null; } $xDisableBWMng = 1; if ($DisableBWMng == 1) { $xDisableBWMng = 0; } $html = "{$error}\n\t{$EnableBandwidthd_par}\n\t{$enable} \n\t<div style='margin-top:5px;width:100%;text-align:right'>{$button}</div>\t\t\n\t<br>" . Paragraphe_switch_img("{enable_login}", "{enable_login_ntopng_explain}", "ENABLE_LOGIN", $arrayConf["ENABLE_LOGIN"], null, 850) . "<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td valign='middle' class=legend style='font-size:22px'>{listen_port}:</td>\n\t\t\t<td>" . Field_text("HTTP_PORT", $arrayConf["HTTP_PORT"], "font-size:22px;width:110px") . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td valign='middle' class=legend style='font-size:22px'>{webconsole}:</td>\n\t\t\t<td><a href=\"http://{$_SERVER["SERVER_ADDR"]}:{$arrayConf["HTTP_PORT"]}/\" \n\t\t\tstyle='font-size:22px;text-decoration:underline'\n\t\t\ttarget=_new>http://{$_SERVER["SERVER_ADDR"]}:{$arrayConf["HTTP_PORT"]}</a></td>\n\t\t</tr>\n\t\t" . Field_list_table("MAX_SIZE", "{max_size}", $arrayConf["MAX_SIZE"], 22, $maxsizes) . "\t\t\t\t\n\t\t<tr>\n\t\t\t<td colspan=2 align='right'><hr>" . button("{apply}", "Save{$t}()", 42) . "</td>\n\t\t</tr>\n\t</table>\n<script>\nvar xSave{$t}= function (obj) {\n\tvar tempvalue=obj.responseText;\n\tif(tempvalue.length>3){alert(tempvalue);}\n\tRefreshTab('tabs_networktrack');\n}\n\t\n\tfunction Save{$t}(){\n\t\tvar XHR = new XHRConnection();\n\t\tif(document.getElementById('Enablentopng')){XHR.appendData('Enablentopng',document.getElementById('Enablentopng').value);}\n\t\tif(document.getElementById('Enablentopng')){XHR.appendData('EnableBandwidthd',document.getElementById('EnableBandwidthd').value);}\n\t\t\n\t\t\n\t\tXHR.appendData('ENABLE_LOGIN',document.getElementById('ENABLE_LOGIN').value);\n\t\tXHR.appendData('MAX_SIZE',document.getElementById('MAX_SIZE').value);\n\t\tXHR.appendData('HTTP_PORT',document.getElementById('HTTP_PORT').value);\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\t\n\t\n\t}\t\n\nLoadAjax('APP_NTOPNG_STATUS','{$page}?status=yes',false);\n</script>"; echo $tpl->_ENGINE_parse_body($html); }
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)); }
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 params(){ $sock=new sockets(); $page=CurrentPageName(); $tpl=new templates(); $t=time(); $arrayConf=unserialize(base64_decode($sock->GET_INFO("ntopng"))); $Enablentopng=$sock->GET_INFO("Enablentopng"); if(!is_numeric($Enablentopng)){$Enablentopng=0;} if(!is_numeric($arrayConf["HTTP_PORT"])){$arrayConf["HTTP_PORT"]=3000;} if(!is_numeric($arrayConf["ENABLE_LOGIN"])){$arrayConf["ENABLE_LOGIN"]=0;} if(!is_numeric($arrayConf["MAX_DAYS"])){$arrayConf["MAX_DAYS"]=30;} $DisableNetDiscover=intval($sock->GET_INFO("DisableNetDiscover")); if($DisableNetDiscover==0){$DisableNetDiscover=1;}else{$DisableNetDiscover=0;} $NetDiscoverSaved=$sock->GET_INFO("NetDiscoverSaved"); if(!is_numeric($NetDiscoverSaved)){$DisableNetDiscover=1;} $days[1]="1 {day}"; $days[2]="2 {days}"; $days[5]="5 {days}"; $days[10]="10 {days}"; $days[15]="15 {days}"; $days[30]="1 {month}"; if($Enablentopng==1){ $button=button("{disable_service}","Loadjs('system.ntopng.disable.php')",28); } $enable=Paragraphe_switch_img("{enable_ntopng}", "{enable_ntopng_text}","Enablentopng",$Enablentopng,null,490); $DisableBWMng=intval($sock->GET_INFO("DisableBWMng")); $INSTALLED=$sock->getFrameWork("system.php?ntopng-installed=yes"); if($INSTALLED<>"TRUE"){ $error=$tpl->_ENGINE_parse_body(FATAL_ERROR_SHOW_128("{software_is_not_installed}")); $enable=null; } $xDisableBWMng=1; if($DisableBWMng==1){$xDisableBWMng=0;} $enable2=Paragraphe_switch_img("{enable_BWMng}", "{enable_BWMng_text}","DisableBWMng",$xDisableBWMng,null,490); $enable3=Paragraphe_switch_img("{enable_NetDiscover}", "{enable_NetDiscover_text}","DisableNetDiscover",$DisableNetDiscover,null,490); $html="$error $enable3 $enable2 $enable <div style='margin-top:5px;width:100%;text-align:right'>$button</div> <br>". Paragraphe_switch_img("{enable_login}", "{enable_login_ntopng_explain}","ENABLE_LOGIN",$arrayConf["ENABLE_LOGIN"],null,490). "<table style='width:100%'> <tr> <td valign='middle' class=legend style='font-size:22px'>{listen_port}:</td> <td>". Field_text("HTTP_PORT",$arrayConf["HTTP_PORT"],"font-size:22px;width:110px")."</td> </tr> <tr> <td valign='middle' class=legend style='font-size:22px'>{webconsole}:</td> <td><a href=\"http://{$_SERVER["SERVER_ADDR"]}:{$arrayConf["HTTP_PORT"]}/\" style='font-size:22px;text-decoration:underline' target=_new>http://{$_SERVER["SERVER_ADDR"]}:{$arrayConf["HTTP_PORT"]}</a></td> </tr> ".Field_list_table("MAX_DAYS", "{retention_days}", $arrayConf["MAX_DAYS"],22,$days)." <tr> <td colspan=2 align='right'><hr>". button("{apply}","Save$t()",28)."</td> </tr> </table> <script> var xSave$t= function (obj) { var tempvalue=obj.responseText; if(tempvalue.length>3){alert(tempvalue);} RefreshTab('tabs_networktrack'); } function Save$t(){ var XHR = new XHRConnection(); XHR.appendData('DisableNetDiscover',document.getElementById('DisableNetDiscover').value); XHR.appendData('DisableBWMng',document.getElementById('DisableBWMng').value); if(document.getElementById('Enablentopng')){XHR.appendData('Enablentopng',document.getElementById('Enablentopng').value);} XHR.appendData('ENABLE_LOGIN',document.getElementById('ENABLE_LOGIN').value); XHR.appendData('MAX_DAYS',document.getElementById('MAX_DAYS').value); XHR.appendData('HTTP_PORT',document.getElementById('HTTP_PORT').value); XHR.sendAndLoad('$page', 'POST',xSave$t); } LoadAjax('APP_NTOPNG_STATUS','$page?status=yes',false); </script>"; echo $tpl->_ENGINE_parse_body($html); }
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); }
function rule_popup() { $md5 = $_GET["md5-id"]; $tpl = new templates(); $page = CurrentPageName(); $fields_size = 22; $rv = new squid_reverse(); $q = new mysql_squid_builder(); $sock = new sockets(); $t = time(); $protcols["imap"] = "IMAP"; $protcols["pop3"] = "POP3"; $protcols["smtp"] = "SMTP"; $title = "{new_rule}"; $bt = "{add}"; if ($md5 != null) { $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM reverse_mailauth WHERE zmd5='{$md5}'")); if (!$q->ok) { echo FATAL_ERROR_SHOW_128($q->mysql_error); return; } $title = "{rule} {$ligne["username"]} {$ligne["protocol"]}:{$ligne["backend"]}:{$ligne["port"]}"; $bt = "{apply}"; } if (!is_numeric($ligne["enabled"])) { $ligne["enabled"] = 1; } if (!is_numeric($ligne["backend_port"])) { $ligne["backend_port"] = 143; } if ($ligne["protocol"] == null) { $ligne["protocol"] = "imap"; } $html[] = "<div style='width:98%' class=form>"; $html[] = "<table style='width:100%'>"; $html[] = "<tr><td colspan=2 style='font-size:28px;padding-bottom:20px'>{rule} {$ligne["ipaddr"]}:{$ligne["port"]}</td></tr>"; $html[] = "<tr><td colspan=2>" . Paragraphe_switch_img("{enable_rule}", "{enable_rule_text}", "enabled-{$t}", $ligne["enabled"], null, 820) . "</td></tr>"; $html[] = Field_text_table("username-{$t}", "{username}", $ligne["username"], $fields_size, null, 450); $html[] = Field_ipv4_table("ipsrc-{$t}", "{src}", $ligne["ipsrc"], $fields_size, null, 110); $html[] = Field_text_table("destination-{$t}", "{recipient} SMTP", $ligne["destination"], $fields_size, null, 450); $html[] = Field_list_table("protocol-{$t}", "{protocol}", $ligne["protocol"], $fields_size, $protcols, "Check{$t}()"); $html[] = Field_text_table("backend-{$t}", "{mail_server}", $ligne["backend"], $fields_size, null, 450); $html[] = Field_text_table("backend_port-{$t}", "{port}", $ligne["backend_port"], $fields_size, null, 110); $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\$('#NGINX_MAIN_MAIL').flexReload();\n\t\tvar md5='{$md5}';\n\t\tif(md5==''){ YahooWinHide();}\n\t\n\t}\n\t\n\t\n\tfunction Submit{$t}(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('zmd5','{$md5}');\n\t\tXHR.appendData('username',encodeURIComponent(document.getElementById('username-{$t}').value));\n\t\tXHR.appendData('ipsrc',encodeURIComponent(document.getElementById('ipsrc-{$t}').value));\n\t\tXHR.appendData('protocol',document.getElementById('protocol-{$t}').value);\n\t\tXHR.appendData('backend',document.getElementById('backend-{$t}').value);\n\t\tXHR.appendData('backend_port',document.getElementById('backend_port-{$t}').value);\n\t\tXHR.appendData('enabled',document.getElementById('enabled-{$t}').value);\n\t\tXHR.appendData('destination',encodeURIComponent(document.getElementById('destination-{$t}').value));\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n\t}\n\t\n\tfunction Check{$t}(){\n\t\tvar protocol=document.getElementById('protocol-{$t}').value;\n\t\tif(protocol!=='smtp'){\n\t\t\tdocument.getElementById('destination-{$t}').disabled=true;\n\t\t}else{\n\t\tdocument.getElementById('destination-{$t}').disabled=false;\n\t\t}\n\t\n\t}\n\tCheck{$t}();\n\t</script>\n\t\n\t"; echo $tpl->_ENGINE_parse_body(@implode("\n", $html)); }
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)); }
function item_popup() { $ID = $_GET["ID"]; $q = new mysql_squid_builder(); $title = "{new_item}"; $bt = "{add}"; $t = time(); $tpl = new templates(); $page = CurrentPageName(); $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM nginx_exploits_groups WHERE ID='{$_GET["groupid"]}'")); $groupname = $ligne["groupname"]; $ligne["enabled"] = 1; if ($ID > 0) { $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM nginx_exploits_items WHERE ID='{$ID}'")); $bt = "{apply}"; $title = "{$groupname}::{{$ligne["token"]}}"; } $array["http_user_agent"] = "{http_user_agent}"; $array["query_string"] = "{query_string}"; $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("enabled-{$t}", "{enabled}", $ligne["enabled"], 26); $html[] = Field_checkbox_table("reverse-{$t}", "{reverse}", $ligne["reverse"], 26); $html[] = Field_list_table("token-{$t}", "{token}", $ligne["token"], 26, $array); $html[] = Field_area_table("pattern-{$t}", "{pattern}", $ligne["pattern"], 26, null, 200); $html[] = Field_button_table_autonome($bt, "ItemSubmit{$t}", 30); $html[] = "</table>"; $html[] = "</div>\n\t<script>\nvar xItemSubmit{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>3){alert(results);return;}\n\t\$('#NGINX_ANTI_EXPLOITS').flexReload();\n\t\$('#NGINX_ITEMS_SECTION_{$_GET["groupid"]}').flexReload();\n\tvar ID={$ID};\n\tif(ID==0){ YahooWin6Hide();}\n}\n\t\n\t\nfunction ItemSubmit{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('edititem','{$ID}');\n\tXHR.appendData('groupid','{$_GET["groupid"]}');\n\tXHR.appendData('pattern',encodeURIComponent(document.getElementById('pattern-{$t}').value));\n\tXHR.appendData('token',document.getElementById('token-{$t}').value);\n\tif(document.getElementById('reverse-{$t}').checked){ XHR.appendData('reverse',1); }else{ XHR.appendData('reverse',0); }\n\tXHR.sendAndLoad('{$page}', 'POST',xItemSubmit{$t});\n}\n</script>"; echo $tpl->_ENGINE_parse_body(@implode("\n", $html)); }
function certificate_edit_settings() { $commonName = $_GET["CommonName"]; $commonNameADD = null; $q = new mysql(); $db = file_get_contents(dirname(__FILE__) . '/ressources/databases/ISO-3166-Codes-Countries.txt'); $tbl = explode("\n", $db); while (list($num, $ligne) = each($tbl)) { if (preg_match('#(.+?);\\s+([A-Z]{1,2})#', $ligne, $regs)) { $regs[2] = trim($regs[2]); $regs[1] = trim($regs[1]); $array_country_codes["{$regs[1]}_{$regs[2]}"] = $regs[1]; } } $ENC[1024] = 1024; $ENC[2048] = 2048; $ENC[4096] = 4096; if (!$q->FIELD_EXISTS("sslcertificates", "UsePrivKeyCrt", "artica_backup")) { $sql = "ALTER TABLE `sslcertificates` ADD `UsePrivKeyCrt` smallint(1) DEFAULT 0"; $q->QUERY_SQL($sql, 'artica_backup'); } $tpl = new templates(); $choose_UsePrivKeyCrt = $tpl->javascript_parse_text("{choose_UsePrivKeyCrt}"); $sql = "SELECT * FROM sslcertificates WHERE CommonName='{$commonName}'"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); if ($ligne["UseGodaddy"] == 1) { $ligne["UsePrivKeyCrt"] = 1; $commonNameADD = " (Godaddy)"; } if ($ligne["UsePrivKeyCrt"] == 0) { if ($ligne["CountryName"] == null) { $ligne["CountryName"] = "UNITED STATES_US"; } if ($ligne["stateOrProvinceName"] == null) { $ligne["stateOrProvinceName"] = "New York"; } if ($ligne["localityName"] == null) { $ligne["localityName"] = "Brooklyn"; } if ($ligne["emailAddress"] == null) { $ligne["emailAddress"] = "*****@*****.**"; } if ($ligne["OrganizationName"] == null) { $ligne["OrganizationName"] = "MyCompany Ltd"; } if ($ligne["OrganizationalUnit"] == null) { $ligne["OrganizationalUnit"] = "IT service"; } if (!is_numeric($ligne["CertificateMaxDays"])) { $ligne["CertificateMaxDays"] = 730; } if (!is_numeric($ligne["levelenc"])) { $ligne["levelenc"] = 1024; } } $page = CurrentPageName(); $tpl = new templates(); $sock = new sockets(); $hostname = $sock->GET_INFO("myhostname"); $choose_UsePrivKeyCrt = $tpl->javascript_parse_text("{choose_UsePrivKeyCrt}"); $t = time(); $ENC[1024] = 1024; $ENC[2048] = 2048; $ENC[4096] = 4096; $commonNameEnc = urlencode($commonName); $bt_name = "{apply}"; if (strlen($ligne["pkcs12"]) > 50) { $cleint_certificate = "<div style='float:right;width:30%;text-align:right;margin:5px'>\n\t\t\t<center>\n\t\t\t<a href=\"{$page}?pkcs12=yes&CommonName=" . urlencode($_GET["CommonName"]) . "\">\n\t\t\t\t<img src='img/certificate-128.png'>\n\t\t\t</a><br>\n\t\t\t<span style='font-size:18px'>PKCS12 {client_certificate}</span> \n\t\t\t</center>\n\t\t\t</div>"; } if ($ligne["UsePrivKeyCrt"] == 0) { $bt_name = "{generate_x509}"; } $html[] = "<div style='font-size:42px;margin-bottom:15px'>{$commonName}{$commonNameADD}</div>"; $html[] = "<div style='width:98%' class=form>"; $html[] = "<table style='width:100%'>"; if ($ligne["UsePrivKeyCrt"] == 0) { $html[] = "<tr><td colspan=2>{$cleint_certificate}" . Paragraphe_switch_img("{UsePrivKeyCrt}", "{UsePrivKeyCrt_text}", "UsePrivKeyCrt", $ligne["UsePrivKeyCrt"], null, 820) . "</td></tr>"; $html[] = Field_list_table("CountryName-{$t}", "{countryName}", $ligne["CountryName"], 22, $array_country_codes); $html[] = Field_text_table("stateOrProvinceName", "{stateOrProvinceName}", $ligne["stateOrProvinceName"], 22, null, 400); $html[] = Field_text_table("localityName", "{localityName}", $ligne["localityName"], 22, null, 400); $html[] = Field_text_table("OrganizationName", "{organizationName}", $ligne["OrganizationName"], 22, null, 400); $html[] = Field_text_table("OrganizationalUnit", "{organizationalUnitName}", $ligne["OrganizationalUnit"], 22, null, 400); $html[] = Field_text_table("emailAddress", "{emailAddress}", $ligne["emailAddress"], 22, null, 400); $html[] = Field_text_table("CertificateMaxDays", "{CertificateMaxDays} ({days})", $ligne["CertificateMaxDays"], 22, null, 150); $html[] = Field_list_table("levelenc", "{level_encryption}", $ligne["levelenc"], 22, $ENC); $html[] = Field_password_table("password-{$t}", "{password}", $ligne["password"], 22, null, 300); $html[] = Field_button_table_autonome($bt_name, "Submit{$t}", 30); } else { $html[] = "<tr>\n\t\t<td class=legend style='font-size:22px'>{countryName}:</td>\n\t\t<td style='font-size:22px;font-weight:bold'>{$ligne["CountryName"]}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t<td class=legend style='font-size:22px'>{stateOrProvinceName}:</td>\n\t\t<td style='font-size:22px;font-weight:bold'>{$ligne["stateOrProvinceName"]}</td>\n\t\t</tr>\t\t\n\t\t<tr>\n\t\t<td class=legend style='font-size:22px'>{localityName}:</td>\n\t\t<td style='font-size:22px;font-weight:bold'>{$ligne["localityName"]}</td>\n\t\t</tr>\t\t\t\n\t\t<tr>\n\t\t<td class=legend style='font-size:22px'>{organizationName}:</td>\n\t\t<td style='font-size:22px;font-weight:bold'>{$ligne["OrganizationName"]}</td>\n\t\t</tr>\t\n\t\t<tr>\n\t\t<td class=legend style='font-size:22px'>{organizationalUnitName}:</td>\n\t\t<td style='font-size:22px;font-weight:bold'>{$ligne["OrganizationalUnit"]}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t<td class=legend style='font-size:22px'>{emailAddress}:</td>\n\t\t<td style='font-size:22px;font-weight:bold'>{$ligne["emailAddress"]}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t<td class=legend style='font-size:22px'>{level_encryption}:</td>\n\t\t<td style='font-size:22px;font-weight:bold'>{$ligne["levelenc"]}</td>\n\t\t</tr>\t\t"; } $html[] = "</table>"; $html[] = "</div>\n\t<script>\n\t\tvar xSubmit{$t}= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>3){alert(results);return;}\n\t\t\$('#TABLE_CERTIFICATE_CENTER_MAIN').flexReload();\n\t\tvar UsePrivKeyCrt=document.getElementById('UsePrivKeyCrt').value;\n\t\tif(UsePrivKeyCrt==1){\n\t\t\tLoadjs('openssl.x509.progress.php?generate-x509={$commonNameEnc}');\n\t\t}else{\n\t\t\tLoadjs('openssl.CSR.progress.php?generate-csr={$commonNameEnc}');\n\t\t}\n\t\tYahooWin6Hide();\n\t}\n\t\n\t\n\tfunction Submit{$t}(){\n\tvar XHR = new XHRConnection();\n\t\n\tXHR.appendData('CommonName',encodeURIComponent('{$_GET["CommonName"]}'));\n\tXHR.appendData('UsePrivKeyCrt',document.getElementById('UsePrivKeyCrt').value);\n\tXHR.appendData('CountryName',document.getElementById('CountryName-{$t}').value);\n\t\n\tXHR.appendData('CertificateMaxDays',document.getElementById('CertificateMaxDays').value);\n\tXHR.appendData('stateOrProvinceName',document.getElementById('stateOrProvinceName').value);\n\tXHR.appendData('localityName',document.getElementById('localityName').value);\n\tXHR.appendData('OrganizationName',document.getElementById('OrganizationName').value);\n\tXHR.appendData('OrganizationalUnit',document.getElementById('OrganizationalUnit').value);\n\tXHR.appendData('emailAddress',document.getElementById('emailAddress').value);\n\tXHR.appendData('levelenc',document.getElementById('levelenc').value);\n\tXHR.appendData('password',encodeURIComponent(document.getElementById('password-{$t}').value));\n\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n\t}\n\n\n\t</script>\n\t\n\t"; echo $tpl->_ENGINE_parse_body(@implode("\n", $html)); }
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)); }
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 popup_ad(){ $tpl=new templates(); $page=CurrentPageName(); $md5=$_GET["md5"]; $title=$tpl->javascript_parse_text("{new_connection}"); $btname="{add}"; $close=1; 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"]; $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> <table style='width:100%'>". Field_text_table("hostname-$t", "{hostname}",$ligne["hostname"],22,null,350). Field_list_table("ttl-$t", "{ttl}", $ligne["ttl"],22,$Timez). Field_checkbox_table("enabled-$t","{enabled}",$ligne["enabled"],$fontsize=22,null). "<tr> <td colspan=2 align='right'><hr>".button($btname,"Save$t()",36)."</td> </tr> </table> </div> <script> var xSave$t= function (obj) { var results=obj.responseText; if(results.length>3){alert(results);return;} var close=$close; if(close==1){YahooWin4Hide();} $('#flexRT{$_GET["t"]}').flexReload(); ExecuteByClassName('SearchFunction'); } function Save$t(){ var XHR = new XHRConnection(); XHR.appendData('hostname',document.getElementById('hostname-$t').value); XHR.appendData('ttl',document.getElementById('ttl-$t').value); XHR.appendData('md5','$md5'); if(document.getElementById('enabled-$t').checked){XHR.appendData('enabled',1); }else{XHR.appendData('enabled',0);} XHR.sendAndLoad('$page', 'POST',xSave$t); } </script>"; echo $tpl->_ENGINE_parse_body($html); }
function parameters_client(){ $sock=new sockets(); $tpl=new templates(); $page=CurrentPageName(); $RemoteUfdbCat=intval($sock->GET_INFO("RemoteUfdbCat")); $ufdbCatPort=intval($sock->GET_INFO("ufdbCatPort")); $ufdbCatInterface=$sock->GET_INFO("ufdbCatInterface"); $EnableLocalUfdbCatService=intval($sock->GET_INFO("EnableLocalUfdbCatService")); if($ufdbCatPort==0){$ufdbCatPort=3978;} $p0=Paragraphe_switch_img("{use_local_categories_services}", "{use_remote_categories_services_explain}<br><strong>{use_local_categories_services_explain_warn}</strong>", "EnableLocalUfdbCatService",$EnableLocalUfdbCatService,null,800,"EnableLocalUfdbCatServiceCheck()" ); $p1=Paragraphe_switch_img("{use_remote_categories_services}", "{use_remote_categories_services_explain}", "RemoteUfdbCat",$RemoteUfdbCat,null,800 ); $ip=new networking(); $ips=$ip->ALL_IPS_GET_ARRAY(); $ufdbCatInterface=$sock->GET_INFO("ufdbCatInterface"); $ufdbCatPort=intval($sock->GET_INFO("ufdbCatPort")); $UfdbCatThreads=intval($sock->GET_INFO("UfdbCatThreads")); unset($ips["127.0.0.1"]); for($i=1;$i<65;$i++){ $threads[$i]=$i; } if($UfdbCatThreads==0){$UfdbCatThreads=4;} if($ufdbCatPort==0){$ufdbCatPort=3978;} $ips[null]="{none}"; reset($ips); $t=time(); $html=" <div style='width:98%' class=form> $p0 <table style='width:100%'>". Field_list_table("ufdbCatInterface1", "{listen_address}", $ufdbCatInterface,22,$ips). Field_text_table("ufdbCatPort1", "{listen_port}", $ufdbCatPort,22,null,120). Field_list_table("UfdbCatThreads1", "{threads}", $UfdbCatThreads,22,$threads)."</table> <div id='design1-$t'>$p1 <table style='width:100%'> ". Field_text_table("ufdbCatInterface", "{remote_address}", $ufdbCatInterface,22,null,230). Field_text_table("ufdbCatPort", "{listen_port}", $ufdbCatPort,22,null,120). "</table> </div>"." <table style='width:100%'>". Field_button_table_autonome("{apply}","Save$t()",32)." </table> </div> <script> var xSave$t=function (obj) { RefreshTab('main_ufdbguard_config'); Loadjs('squid.reconfigure.simple.php'); } function Save$t(){ var XHR = new XHRConnection(); var EnableLocalUfdbCatService=document.getElementById('EnableLocalUfdbCatService').value; if(EnableLocalUfdbCatService==0){ XHR.appendData('ufdbCatInterface',document.getElementById('ufdbCatInterface').value); XHR.appendData('ufdbCatPort',document.getElementById('ufdbCatPort').value); XHR.appendData('RemoteUfdbCat',document.getElementById('RemoteUfdbCat').value); }else{ XHR.appendData('ufdbCatInterface',document.getElementById('ufdbCatInterface1').value); XHR.appendData('ufdbCatPort',document.getElementById('ufdbCatPort1').value); XHR.appendData('UfdbCatThreads',document.getElementById('UfdbCatThreads1').value); } XHR.appendData('EnableLocalUfdbCatService',document.getElementById('EnableLocalUfdbCatService').value); XHR.sendAndLoad('$page', 'POST',xSave$t); } function EnableLocalUfdbCatServiceCheck(){ var EnableLocalUfdbCatService=document.getElementById('EnableLocalUfdbCatService').value; document.getElementById('ufdbCatInterface').disabled=false; document.getElementById('ufdbCatPort').disabled=false; document.getElementById('RemoteUfdbCat').disabled=false; document.getElementById('ufdbCatInterface1').disabled=true; document.getElementById('ufdbCatPort1').disabled=true; document.getElementById('UfdbCatThreads1').disabled=true; document.getElementById('design1-$t').style.visibility='visible'; if(EnableLocalUfdbCatService==1){ document.getElementById('RemoteUfdbCat').disabled=true; document.getElementById('ufdbCatInterface').disabled=true; document.getElementById('ufdbCatPort').disabled=true; document.getElementById('RemoteUfdbCat').disabled=true; document.getElementById('ufdbCatInterface1').disabled=false; document.getElementById('ufdbCatPort1').disabled=false; document.getElementById('UfdbCatThreads1').disabled=false; document.getElementById('design1-$t').style.visibility='hidden'; } CheckBoxDesignHidden(); } EnableLocalUfdbCatServiceCheck(); </script> "; echo $tpl->_ENGINE_parse_body($html); }
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=explain style=font-size:22px>\n\t\t{reverse_proxy_use_destination_server_certificate}</div>"; } if ($ligne["ssl_protocols"] == null) { $ligne["ssl_protocols"] = "TLSv1 TLSv1.1 TLSv1.2"; } if ($ligne["ssl_ciphers"] == null) { $ligne["ssl_ciphers"] = "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK"; } $html[] = "<div style='width:98%' class=form>{$AS_PEER_CERTIFICATE_EXPLAIN}"; $html[] = "<table style='width:100%'>"; $html[] = "<tr><td colspan=2 style='font-size:40px;padding-bottom:20px'>{port}:{$ligne["port"]} «{$servername}»{$to}</td></tr>"; $html[] = "<tr><td colspan=2>" . Paragraphe_switch_img("{reverse_proxy_ssl}", "{NGINX_USE_SSL_EXPLAIN}", "ssl-{$t}", $ligne["ssl"], null, 1400, "SwitchOffCertificate{$t}") . "</td></tr>"; $html[] = Field_list_table("certificate-{$t}", "{certificate}", $ligne["certificate"], 28, $sslcertificates, null, 450); $html[] = Field_text_table("ssl_protocols-{$t}", "{ssl_protocols}", $ligne["ssl_protocols"], 28, '{ssl_protocols_text}', 600); $html[] = Field_text_table("ssl_ciphers-{$t}", "{ssl_ciphers}", $ligne["ssl_ciphers"], 28, null, 900); $html[] = "<tr><td colspan=2><p> </p></td></tr>"; 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, 1400) . "</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, 1400) . "</td></tr>"; } //javascript: $html[] = "\n\t<tr>\n\t\t<td colspan=2 align='right' style='font-size:40px'>\n\t\t\t" . button("{apply_parameters}", "Submit{$t}(1);", 40) . " | " . button("{apply}", "Submit{$t}()", 40) . "</td>\n\t\t</tr>\n\t\t\t\n\t"; $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}\nvar xSubmitCompile{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>3){alert(results);return;}\n\t\$('#NGINX_MAIN_TABLE').flexReload();\n\tLoadjs('nginx.single.progress.php?servername={$servername}');\n}\n\n\n\n\n\t\n\t\nfunction Submit{$t}(Compile){\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\tXHR.appendData('ssl_protocols',document.getElementById('ssl_protocols-{$t}').value);\n\tXHR.appendData('certificate',document.getElementById('certificate-{$t}').value);\n\tXHR.appendData('ssl_ciphers',document.getElementById('ssl_ciphers-{$t}').value);\n\t\n\tif(!Compile){\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n\t}else{\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSubmitCompile{$t});\n\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)); }