Beispiel #1
0
function parameters()
{
    $users = new usersMenus();
    $sock = new sockets();
    $FailOverArtica = $sock->GET_INFO("FailOverArtica");
    if (!is_numeric($FailOverArtica)) {
        $FailOverArtica = 1;
    }
    $FailOverArticaParams = unserialize(base64_decode($sock->GET_INFO("FailOverArticaParams")));
    if (!is_numeric($FailOverArticaParams["squid-internal-mgr-info"])) {
        $FailOverArticaParams["squid-internal-mgr-info"] = 1;
    }
    if (!is_numeric($FailOverArticaParams["ExternalPageToCheck"])) {
        $FailOverArticaParams["ExternalPageToCheck"] = 1;
    }
    $boot = new boostrap_form();
    $boot->set_checkbox("FailOverArtica", "{FailOverArtica}", $FailOverArtica, array("TOOLTIP" => "{FailOverArtica_explain}", "DISABLEALL" => true));
    $boot->set_spacertitle("{APP_PROXY}");
    $boot->set_checkbox("squid-internal-mgr-info", "{failover_mgrinfo}", $FailOverArticaParams["squid-internal-mgr-info"], array("TOOLTIP" => "{failover_mgrinfo_explain}"));
    $boot->set_checkbox("ExternalPageToCheck", "{failover_ExternalPageToCheck}", $FailOverArticaParams["ExternalPageToCheck"], array("TOOLTIP" => "{failover_ExternalPageToCheck_explain}"));
    if (!$users->CORP_LICENSE) {
        $boot->set_form_locked();
    }
    echo $boot->Compile();
}
function bridge_popup()
{
    $boot = new boostrap_form();
    $sock = new sockets();
    $users = new usersMenus();
    $ldap = new clladp();
    $ID = $_GET["ID"];
    $title_button = "{add}";
    $nics = unserialize(base64_decode($sock->getFrameWork("cmd.php?list-nics=yes")));
    $IP = new networking();
    while (list($key, $value) = each($nics)) {
        $array = $IP->GetNicInfos($value);
        $NICZ[$value] = $value . " [{$array["IPADDR"]}]";
    }
    $boot->set_list("nic_inbound", "{from}", $NICZ, null);
    $boot->set_list("nic_linked", "{to}", $NICZ, null);
    $boot->set_hidden("ID", $_GET["ID"]);
    if (!$users->AsSystemAdministrator) {
        $boot->set_form_locked();
    }
    if ($ID == 0) {
        $boot->set_CloseYahoo("YahooWin2");
    }
    $boot->set_RefreshSearchs();
    echo $boot->Compile();
}
function etchosts_popup()
{
    $boot = new boostrap_form();
    $sock = new sockets();
    $users = new usersMenus();
    $ldap = new clladp();
    $ID = $_GET["ID"];
    $title_button = "{add_new_entry}";
    $boot->set_field("hostname", "{hostname}", $ligne["name"]);
    $boot->set_field("ipaddr", "{tcp_address}", $ligne["ipaddr"], array("IPV4" => true));
    $boot->set_field("alias", "{alias}", null);
    if (!$users->AsSystemAdministrator) {
        $boot->set_form_locked();
    }
    if ($ID == 0) {
        $boot->set_CloseYahoo("YahooWin2");
    }
    $boot->set_button("{add}");
    $boot->set_RefreshSearchs();
    echo $boot->Compile();
}
function ldap_auth_parameters()
{
    $boot = new boostrap_form();
    $squid = new squidbee();
    $users = new usersMenus();
    $sock = new sockets();
    $SquidLdapAuthEnableGroups = $sock->GET_INFO("SquidLdapAuthEnableGroups");
    $EnableKerbAuth = $sock->GET_INFO("EnableKerbAuth");
    $SquidLdapAuthBanner = $sock->GET_INFO("SquidLdapAuthBanner");
    if ($SquidLdapAuthBanner == null) {
        $SquidLdapAuthBanner = "Basic credentials, Please logon...";
    }
    if ($EnableKerbAuth == 1) {
        $error = "<p class=text-error>{ldap_with_ad_explain}</p>";
    }
    $boot->set_spacertitle("{local_ldap}");
    $boot->set_spacerexplain("{authenticate_users_explain}");
    $boot->set_checkbox("ldap_auth", "{local_ldap}", $squid->LDAP_AUTH);
    //$boot->set_checkbox("SquidLdapAuthEnableGroups", "{enable_group_checking}",$SquidLdapAuthEnableGroups);
    $boot->set_field("SquidLdapAuthBanner", "{auth_banner}", $SquidLdapAuthBanner, array("ENCODE" => true));
    $boot->set_spacertitle("{remote_database}");
    $boot->set_spacerexplain("{SQUID_LDAP_AUTH_EXT}");
    $ldap_server = $squid->EXTERNAL_LDAP_AUTH_PARAMS["ldap_server"];
    $ldap_port = $squid->EXTERNAL_LDAP_AUTH_PARAMS["ldap_port"];
    $userdn = $squid->EXTERNAL_LDAP_AUTH_PARAMS["ldap_user"];
    $ldap_password = $squid->EXTERNAL_LDAP_AUTH_PARAMS["ldap_password"];
    $ldap_suffix = $squid->EXTERNAL_LDAP_AUTH_PARAMS["ldap_suffix"];
    $ldap_filter_users = $squid->EXTERNAL_LDAP_AUTH_PARAMS["ldap_filter_users"];
    $ldap_filter_group = $squid->EXTERNAL_LDAP_AUTH_PARAMS["ldap_filter_group"];
    $ldap_server = $squid->EXTERNAL_LDAP_AUTH_PARAMS["ldap_server"];
    $auth_banner = $squid->EXTERNAL_LDAP_AUTH_PARAMS["auth_banner"];
    $EnableSquidExternalLDAP = $squid->LDAP_EXTERNAL_AUTH;
    if ($auth_banner == null) {
        $auth_banner = $SquidLdapAuthBanner;
    }
    if ($ldap_filter_users == null) {
        $ldap_filter_users = "sAMAccountName=%s";
    }
    if ($ldap_filter_group == null) {
        $ldap_filter_group = "(&(objectclass=person)(sAMAccountName=%u)(memberof=*))";
    }
    if ($ldap_port == null) {
        $ldap_port = 389;
    }
    $boot->set_checkbox("EnableSquidExternalLDAP", "{activate}", $EnableSquidExternalLDAP);
    $boot->set_field("ldap_server", "{hostname}", $ldap_server);
    $boot->set_field("ldap_port", "{listen_port}", $ldap_port);
    $boot->set_field("auth_banner", "{auth_banner}", $auth_banner);
    $boot->set_field("ldap_user", "{userdn}", $userdn);
    $boot->set_fieldpassword("ldap_password", "{ldap_password}", $ldap_password, array("ENCODE" => true));
    $boot->set_field("ldap_suffix", "{ldap_suffix}", $ldap_suffix);
    $boot->set_field("ldap_filter_users", "{ldap_filter_users}", $ldap_filter_users);
    $boot->set_field("ldap_filter_group", "{ldap_filter_group}", $ldap_filter_group);
    $boot->set_button("{apply}");
    if (!$users->AsSquidAdministrator) {
        $boot->set_form_locked();
    }
    $boot->set_Newbutton("{restart_onlysquid}", "Loadjs('squid.restart.php?onlySquid=yes&ask=yes');");
    echo $error . $boot->Compile();
}
Beispiel #5
0
function content()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $users = new usersMenus();
    $VirtualUser = $_SESSION["VirtAclUser"];
    if (isset($_SESSION["RADIUS_ID"])) {
        if ($_SESSION["RADIUS_ID"] > 0) {
            $VirtualUser = true;
        }
    }
    if (!$VirtualUser) {
        $ct = new user($_SESSION["uid"]);
    } else {
        $ct = new user();
    }
    $t = time();
    $ActiveDirectory = 0;
    if ($ct->AsActiveDirectoryMember) {
        $ActiveDirectory = 1;
    }
    $boot = new boostrap_form();
    if ($VirtualUser) {
        $ct->DisplayName = $_SESSION["uid"];
    }
    if ($_SESSION["uid"] == -100) {
        include "ressources/settings.inc";
        $ct->DisplayName = $_GLOBAL["ldap_admin"];
        $ct->sn = $ct->DisplayName;
        $ct->givenName = $ct->DisplayName;
        $VirtualUser = true;
    }
    $boot->set_field("DisplayName", "{displayName}", $ct->DisplayName);
    $boot->set_field("sn", "{sn}", $ct->sn);
    $boot->set_field("givenName", "{givenName}", $ct->givenName);
    if ($users->AllowChangeUserPassword) {
        $boot->set_fieldpassword("password", "{password}", $ct->password);
    }
    $boot->set_field("telephoneNumber", "{telephoneNumber}", $ct->telephoneNumber);
    $boot->set_field("mobile", "{mobile}", $ct->mobile);
    $boot->set_button("{apply}");
    $boot->set_CallBack("AjaxTopMenu('headNav','miniadm.index.php?headNav=yes');");
    if ($VirtualUser) {
        $boot->set_form_locked();
    } else {
        if ($ActiveDirectory == 1) {
            $boot->set_form_locked();
        }
    }
    $picture = "ressources/{$ct->ThumbnailPath}";
    if (is_file("{$picture}")) {
        $picture = "<a href=\"javascript:blur();\" \n\t\tOnClick=\"javascript:Loadjs('miniadm.profile.php?upload-pic-js=yes');\">\n\t\t<img src='ressources/{$ct->ThumbnailPath}' style='margin:10px'></a>";
    } else {
        $picture = null;
    }
    $form = $boot->Compile();
    $language = $tpl->javascript_parse_text("{language}");
    $html = "\n\t<div class=BodyContent>\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t<td valign='top'>{$picture}</td>\n\t\t<td valign='top'>\n\t\t<H1>{myaccount}</H1>\n\t\t<p>{myaccount_text}</p>\n\t\t<div style='text-align:right'>\n\t\t<a href=\"javascript:blur();\" OnClick=\"YahooWin3(500,'{$page}?lang=yes','{$language}');\">\n\t\t{$language}</a>&nbsp;|&nbsp;\n\t\t<a href=\"javascript:blur();\" OnClick=\"YahooWin3(500,'{$page}?privileges=yes','{my_privileges}');\">\n\t\t{my_privileges}</a></div>\n\t\t</td>\n\t\t</tr>\n\t\t</table>\n\t</div>\n\t<div class=BodyContent>\n\t\t{$form}\n\t\t\n\t</div>\n\n\t\n\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
function parameters()
{
    $users = new usersMenus();
    $sock = new sockets();
    $boot = new boostrap_form();
    $boot->set_formtitle("{logs_retention}");
    $boot->set_formdescription("{squid_logs_retention_explain}");
    $BackupMaxDays = $sock->GET_INFO("BackupMaxDays");
    $BackupMaxDaysDir = $sock->GET_INFO("BackupMaxDaysDir");
    if ($BackupMaxDaysDir == null) {
        $BackupMaxDaysDir = "/home/logrotate_backup";
    }
    $BackupSquidLogsUseNas = $sock->GET_INFO("BackupSquidLogsUseNas");
    $BackupSquidLogsNASIpaddr = $sock->GET_INFO("BackupSquidLogsNASIpaddr");
    $BackupSquidLogsNASFolder = $sock->GET_INFO("BackupSquidLogsNASFolder");
    $BackupSquidLogsNASUser = $sock->GET_INFO("BackupSquidLogsNASUser");
    $BackupSquidLogsNASPassword = $sock->GET_INFO("BackupSquidLogsNASPassword");
    if (!is_numeric($BackupSquidLogsUseNas)) {
        $BackupSquidLogsUseNas = 0;
    }
    if (!is_numeric($BackupMaxDays)) {
        $BackupMaxDays = 30;
    }
    $MySQLSyslogType = $sock->GET_INFO("MySQLSyslogType");
    if (!is_numeric($MySQLSyslogType)) {
        $MySQLSyslogType = 1;
    }
    $boot->set_field("BackupMaxDays", "{max_day_in_database}", $BackupMaxDays, array("TOOLTIP" => "{syslog_max_day_in_database_explain}"));
    $boot->set_field("BackupMaxDaysDir", "{backup_folder}", $BackupMaxDaysDir, array("BROWSE" => true, "TOOLTIP" => "{syslog_backup_folder_explain}"));
    $boot->set_spacertitle("{NAS_storage}");
    $boot->set_checkbox("BackupSquidLogsUseNas", "{use_remote_nas}", $BackupSquidLogsUseNas, array("TOOLTIP" => "{BackupSquidLogsUseNas_explain}", "LINK" => "BackupSquidLogsNASIpaddr,BackupSquidLogsNASFolder,BackupSquidLogsNASUser,BackupSquidLogsNASPassword"));
    $boot->set_field("BackupSquidLogsNASIpaddr", "{hostname}", $BackupSquidLogsNASIpaddr);
    $boot->set_field("BackupSquidLogsNASFolder", "{shared_folder}", $BackupSquidLogsNASFolder, array("ENCODE" => true));
    $boot->set_field("BackupSquidLogsNASUser", "{username}", $BackupSquidLogsNASUser, array("ENCODE" => true));
    $boot->set_fieldpassword("BackupSquidLogsNASPassword", "{password}", $BackupSquidLogsNASPassword, array("ENCODE" => true));
    $boot->set_button("{apply}");
    if ($MySQLSyslogType != 1) {
        $boot->set_spacerexplain("{MySQLSyslogTypediff_explain}");
        $boot->set_form_locked();
    }
    if (!$users->AsSquidAdministrator) {
        $boot->set_form_locked();
    }
    $t = time();
    $page = CurrentPageName();
    echo $boot->Compile() . "<hr>\n\t<div id='{$t}'></div>\n\t<script>\n\t\tLoadAjax('{$t}','{$page}?mysql-syslogs-status=yes');\n\t</script>\t\t\n\t";
}
function virtip_popup()
{
    $boot = new boostrap_form();
    $sock = new sockets();
    $users = new usersMenus();
    $ldap = new clladp();
    $ID = $_GET["ID"];
    $title_button = "{add}";
    $nics = unserialize(base64_decode($sock->getFrameWork("cmd.php?list-nics=yes")));
    if ($_GET["ID"] > 0) {
        $sql = "SELECT * FROM nics_virtuals WHERE ID='{$ID}'";
        $q = new mysql();
        $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
        $title_button = "{apply}";
    }
    $ous = $ldap->hash_get_ou(true);
    $ous["openvpn_service"] = "{APP_OPENVPN}";
    while (list($num, $val) = each($nics)) {
        $nics_array[$val] = $val;
    }
    $nics_array[null] = "{select}";
    $ous[null] = "{select}";
    $boot->set_list("nic", "{nic}", $nics_array, $ligne["nic"]);
    $boot->set_list("org", "{organization}", $ous, $ligne["org"]);
    $boot->set_field("ipaddr", "{tcp_address}", $ligne["ipaddr"], array("IPV4" => true));
    $boot->set_field("netmask", "{netmask}", $ligne["netmask"], array("IPV4" => true));
    $boot->set_field("cdir", "CDIR", $ligne["cdir"], array("CDIR" => "ipaddr,netmask"));
    $boot->set_field("gateway", "{gateway}", $ligne["gateway"], array("IPV4" => true));
    $boot->set_field("metric", "{metric}", $ligne["metric"]);
    $boot->set_hidden("ID", $_GET["ID"]);
    $boot->set_checkbox("ForceGateway", "{ForceGateway}", $ligne["ForceGateway"]);
    if (!$users->AsSystemAdministrator) {
        $boot->set_form_locked();
    }
    if ($ID == 0) {
        $boot->set_CloseYahoo("YahooWin2");
    }
    $boot->set_RefreshSearchs();
    echo $boot->Compile();
}
function section_ports()
{
    $boot = new boostrap_form();
    $sock = new sockets();
    $squid = new squidbee();
    $tpl = new templates();
    $sock = new sockets();
    $arrayParams = unserialize(base64_decode($sock->getFrameWork("squid.php?compile-list=yes")));
    $SSL = 1;
    if (!isset($arrayParams["--enable-ssl"])) {
        echo $tpl->_ENGINE_parse_body("<p class=text-error>{SSL_NOT_COMPILED}</p>");
    }
    $KernelSendRedirects = $sock->GET_INFO("KernelSendRedirects");
    $SquidTransparentMixed = $sock->GET_INFO("SquidTransparentMixed");
    $SQUIDEnable = $sock->GET_INFO("SQUIDEnable");
    if (!is_numeric($KernelSendRedirects)) {
        $KernelSendRedirects = 1;
    }
    if (!is_numeric($SquidTransparentMixed)) {
        $SquidTransparentMixed = 0;
    }
    if (!is_numeric($SQUIDEnable)) {
        $SQUIDEnable = 1;
    }
    $sql = "SELECT CommonName FROM sslcertificates ORDER BY CommonName";
    $q = new mysql();
    $sslcertificates[null] = "{select}";
    $results = $q->QUERY_SQL($sql, 'artica_backup');
    while ($ligneZ = mysql_fetch_array($results, MYSQL_ASSOC)) {
        $sslcertificates[$ligneZ["CommonName"]] = $ligneZ["CommonName"];
    }
    $boot->set_formtitle("{behavior}");
    $boot->set_checkbox("SQUIDEnable", "{enable_squid_service}", $SQUIDEnable, array("TOOLIP" => "{enable_squid_service_explain}", "DISABLEALL" => true));
    $boot->set_field("visible_hostname", "{visible_hostname}", $squid->visible_hostname, array("TOOLIP" => "{visible_hostname_text}"));
    $boot->set_checkbox("hasProxyTransparent", "{transparent_mode}", $squid->hasProxyTransparent, array("TOOLIP" => "{transparent_mode_text}", "LINK" => "SquidTransparentMixed,KernelSendRedirects"));
    $boot->set_checkbox("SquidTransparentMixed", "{SquidTransparentMixed}", $SquidTransparentMixed, array("TOOLIP" => "{SquidTransparentMixed_text}"));
    $boot->set_checkbox("KernelSendRedirects", "{KernelSendRedirects}", $KernelSendRedirects, array("TOOLIP" => "{KernelSendRedirects_explain}"));
    $boot->set_spacertitle("{listen_ports}");
    $boot->set_spacerexplain("{listen_port_text}");
    $boot->set_field("listen_port", "HTTP", $squid->listen_port);
    $boot->set_field("second_listen_port", "HTTP (2)", $squid->second_listen_port, array("TOOLTIP" => "{squid_second_port_explain}"));
    $boot->set_field("ssl_port", "HTTPS", $squid->ssl_port, array("TOOLTIP" => "{squid_ssl_port_explain}"));
    $boot->set_list("certificate_center", "{certificate}", $sslcertificates, $squid->certificate_center);
    $boot->set_field("icp_port", "{icp_port}", $squid->ICP_PORT, array("TOOLTIP" => "{icp_port_explain}"));
    $boot->set_field("htcp_port", "{htcp_port}", $squid->HTCP_PORT, array("TOOLTIP" => "{htcp_port_explain}"));
    $boot->set_button("{apply}");
    $users = new usersMenus();
    if (!$users->AsSquidAdministrator) {
        $boot->set_form_locked();
    }
    echo $boot->Compile();
}
function subrules_popup()
{
    $ruleid = $_GET["rule-id"];
    $ID = $_GET["subrule"];
    $users = new usersMenus();
    $page = CurrentPageName();
    $tpl = new templates();
    $t = time();
    $buttonname = "{add}";
    $boot = new boostrap_form();
    if ($ID > 0) {
        $q = new mysql();
        $sql = "SELECT *  FROM iproute_rules WHERE ID={$ID}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
        $title = $tpl->_ENGINE_parse_body("{$ID}::{$ligne["src"]} - {$ligne["destination"]}");
        $buttonname = "{apply}";
    } else {
        $boot->set_CloseYahoo("YahooWin3");
    }
    if (!is_numeric($ligne["enable"])) {
        $ligne["enable"] = 1;
    }
    $boot->set_formtitle($title);
    $boot->set_formdescription("{iprules_explain}");
    $boot->set_hidden("subruleid", $ID);
    $boot->set_hidden("ruleid", $ruleid);
    $boot->set_field("src", "{source}", $ligne["source"]);
    $boot->set_field("destination", "{destination}", $ligne["destination"]);
    $boot->set_field("priority", "{priority}", $ligne["priority"]);
    $boot->set_checkbox("enable", "{enabled}", $ligne["enable"]);
    $users = new usersMenus();
    if (!$users->AsSystemAdministrator) {
        $boot->set_form_locked();
    }
    $boot->set_button($buttonname);
    $boot->set_RefreshSearchs();
    echo $boot->Compile();
}
function cache_popup()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $servername = $_GET["servername"];
    $q = new mysql_squid_builder();
    $title = "{new_cache}";
    $bt = "{add}";
    $ID = $_GET["ID"];
    $boot = new boostrap_form();
    $sock = new sockets();
    $NginxProxyStorePath = $sock->GET_INFO("NginxProxyStorePath");
    if ($NginxProxyStorePath == null) {
        $NginxProxyStorePath = "/home/nginx";
    }
    if ($ID > 0) {
        $q = new mysql_squid_builder();
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM nginx_caches WHERE ID='{$ID}'"));
        $bt = "{apply}";
        $title = "{$ligne["keys_zone"]}";
    }
    if ($ligne["keys_zone"] == null) {
        $ligne["keys_zone"] = time();
    }
    if (trim($ligne["directory"]) == null) {
        $ligne["directory"] = $NginxProxyStorePath . "/{$ligne["keys_zone"]}";
    }
    if ($ligne["levels"] == null) {
        $ligne["levels"] = "1:2";
    }
    if (!is_numeric($ligne["keys_zone_size"])) {
        $ligne["keys_zone_size"] = 1;
    }
    if (!is_numeric($ligne["max_size"])) {
        $ligne["max_size"] = 2;
    }
    if (!is_numeric($ligne["inactive"])) {
        $ligne["inactive"] = 10;
    }
    if (!is_numeric($ligne["loader_files"])) {
        $ligne["loader_files"] = 100;
    }
    if (!is_numeric($ligne["loader_sleep"])) {
        $ligne["loader_sleep"] = 10;
    }
    if (!is_numeric($ligne["loader_threshold"])) {
        $ligne["loader_threshold"] = 100;
    }
    $boot->set_hidden("ID", $ID);
    $boot->set_formtitle($title);
    $boot->set_field("keys_zone", "{name}", $ligne["keys_zone"]);
    $boot->set_field("directory", "{directory}", $ligne["directory"], array("BROWSE" => true, "MANDATORY" => true, "ENCODE" => true));
    $boot->set_field("levels", "{levels}", $ligne["levels"]);
    $boot->set_field("keys_zone_size", "{memory_size} (MB)", $ligne["keys_zone_size"]);
    $boot->set_field("max_size", "{max_size} (GB)", $ligne["max_size"]);
    $boot->set_field("inactive", "{inactive} ({minutes})", $ligne["inactive"], array("TOOLTIP" => "{nginx_inactive_explain}"));
    $boot->set_field("loader_files", "{loader_files}", $ligne["loader_files"]);
    $boot->set_field("loader_sleep", "{loader_sleep} {milliseconds}", $ligne["loader_sleep"]);
    $boot->set_field("loader_threshold", "{loader_threshold} {milliseconds}", $ligne["loader_threshold"]);
    $boot->set_button($bt);
    if ($servername == null) {
        $boot->set_CloseYahoo("YahooWin");
    }
    $boot->set_RefreshSearchs();
    if (!AdminPrivs()) {
        $boot->set_form_locked();
    }
    echo $boot->Compile();
}
function service()
{
    $page = CurrentPageName();
    $t = time();
    $tpl = new templates();
    $sock = new sockets();
    $datas = unserialize(base64_decode($sock->GET_INFO("ufdbguardConfig")));
    $squid = new squidbee();
    $users = new usersMenus();
    $url_rewrite_bypass = $squid->url_rewrite_bypass;
    $ufdbguardReloadTTL = $sock->GET_INFO("ufdbguardReloadTTL");
    $EnableGoogleSafeSearch = $sock->GET_INFO("EnableGoogleSafeSearch");
    $UfdbDatabasesInMemory = $sock->GET_INFO("UfdbDatabasesInMemory");
    $EnableUfdbGuard = $sock->EnableUfdbGuard();
    if ($datas["enforce-https-with-hostname"] == null) {
        $datas["enforce-https-with-hostname"] = 0;
    }
    if ($datas["enforce-https-official-certificate"] == null) {
        $datas["enforce-https-official-certificate"] = 0;
    }
    if ($datas["https-prohibit-insecure-sslv2"] == null) {
        $datas["https-prohibit-insecure-sslv2"] = 0;
    }
    if (!is_numeric($datas["url-lookup-result-during-database-reload"])) {
        $datas["url-lookup-result-during-database-reload"] = 1;
    }
    if (!is_numeric($datas["url-lookup-result-when-fatal-error"])) {
        $datas["url-lookup-result-when-fatal-error"] = 1;
    }
    if (!is_numeric($datas["check-proxy-tunnel"])) {
        $datas["check-proxy-tunnel"] = 1;
    }
    if (!is_numeric($datas["strip-domain-from-username"])) {
        $datas["strip-domain-from-username"] = 0;
    }
    if (!is_numeric($datas["refreshuserlist"])) {
        $datas["refreshuserlist"] = 15;
    }
    if (!is_numeric($datas["refreshdomainlist"])) {
        $datas["refreshdomainlist"] = 15;
    }
    if (!is_numeric($EnableUfdbGuard)) {
        $EnableUfdbGuard = 0;
    }
    if (!is_numeric($UfdbDatabasesInMemory)) {
        $UfdbDatabasesInMemory = 0;
    }
    if (!is_numeric($datas["allow-unknown-protocol-over-https"])) {
        $datas["allow-unknown-protocol-over-https"] = 1;
    }
    if (!isset($datas["tcpsockets"])) {
        $datas["tcpsockets"] = 0;
    }
    if (!isset($datas["listen_addr"])) {
        $datas["listen_addr"] = "all";
    }
    if (!isset($datas["listen_port"])) {
        $datas["listen_port"] = "3977";
    }
    if ($datas["listen_addr"] == null) {
        $datas["listen_addr"] = "all";
    }
    if (!is_numeric($datas["listen_port"])) {
        $datas["listen_port"] = "3977";
    }
    if (!is_numeric($datas["tcpsockets"])) {
        $datas["tcpsockets"] = 0;
    }
    if (!is_numeric($datas["DebugAll"])) {
        $datas["DebugAll"] = 0;
    }
    if (!is_numeric($ufdbguardReloadTTL)) {
        $ufdbguardReloadTTL = 10;
    }
    if (!is_numeric($EnableGoogleSafeSearch)) {
        $EnableGoogleSafeSearch = 1;
    }
    $WEBSTATS_APPLIANCE = 0;
    if ($users->WEBSTATS_APPLIANCE) {
        $WEBSTATS_APPLIANCE = 1;
        $datas["tcpsockets"] = 1;
    }
    $sys = new networking();
    $ips = $sys->ALL_IPS_GET_ARRAY();
    if ($users->WEBSTATS_APPLIANCE) {
        unset($ips["127.0.0.1"]);
    }
    $as27 = 0;
    if ($squid->IS_27) {
        senderrors("{not_supported} SQUID v2.7");
    }
    $ips["all"] = "{all}";
    $boot = new boostrap_form();
    $boot->set_spacertitle("{feature}");
    $boot->set_checkbox("EnableUfdbGuard", "{EnableUfdbGuard}", "{$EnableUfdbGuard}", array("DISABLEALL" => true));
    $boot->set_spacertitle("SSL");
    $boot->set_checkbox("enforce-https-with-hostname", "{enforce-https-with-hostname}", $datas["enforce-https-with-hostname"], array("TOOLTIP" => "{UFDBGUARD_SSL_OPTS}"));
    $boot->set_checkbox("enforce-https-official-certificate", "{enforce-https-official-certificate}", $datas["enforce-https-official-certificate"]);
    $boot->set_checkbox("https-prohibit-insecure-sslv2", "{https-prohibit-insecure-sslv2}", $datas["https-prohibit-insecure-sslv2"]);
    $boot->set_checkbox("allow-unknown-protocol-over-https", "{allow-unknown-protocol-over-https}", $datas["allow-unknown-protocol-over-https"]);
    $boot->set_checkbox("check-proxy-tunnel", "{check-proxy-tunnel}", $datas["check-proxy-tunnel"]);
    $boot->set_spacertitle("{UFDBGUARD_SERVICE_OPTS}");
    $boot->set_checkbox("DebugAll", "{verbose_mode}", $datas["DebugAll"]);
    $boot->set_checkbox("UfdbDatabasesInMemory", "{UfdbDatabasesInMemory}", $UfdbDatabasesInMemory, array("TOOLTIP" => "{UfdbDatabasesInMemory_explain}"));
    $boot->set_field("ufdbguardReloadTTL", "{minimum_reload_interval} {minutes}", $ufdbguardReloadTTL);
    $boot->set_checkbox("tcpsockets", "{enable_tcpsockets}", $datas["tcpsockets"], array("LINK" => "listen_addr,listen_port"));
    $boot->set_list("listen_addr", "{listen_address}", $ips, $datas["listen_addr"]);
    $boot->set_field("listen_port", "{listen_port}", $datas["listen_port"]);
    $boot->set_checkbox("EnableGoogleSafeSearch", "{EnableGoogleSafeSearch}", $EnableGoogleSafeSearch);
    $boot->set_checkbox("strip-domain-from-username", "{strip-domain-from-username}", $datas["strip-domain-from-username"]);
    $boot->set_checkbox("refreshuserlist", "{refreshuserlist} ({minutes})", $datas["refreshuserlist"]);
    $boot->set_checkbox("refreshdomainlist", "{refreshdomainlist} ({minutes})", $datas["refreshdomainlist"]);
    $boot->set_spacertitle("{ON_ERRORS}");
    $boot->set_checkbox("url_rewrite_bypass", "{bypass_iffailed}", $url_rewrite_bypass, array("TOOLTIP" => "{url_rewrite_bypass_explain}"));
    $boot->set_checkbox("url-lookup-result-during-database-reload", "{url-lookup-result-during-database-reload}", $datas["url-lookup-result-during-database-reload"]);
    $boot->set_checkbox("url-lookup-result-when-fatal-error", "{url-lookup-result-when-fatal-error}", $datas["url-lookup-result-when-fatal-error"]);
    $boot->set_button("{apply}");
    $users = new usersMenus();
    if (!$users->AsDansGuardianAdministrator) {
        $boot->set_form_locked();
    }
    $form = $boot->Compile();
    $html = "<table style='width:100%'>\n\t<tr>\n\t\t<td style='vertical-align:top;width:400px'>\n\t\t\t<div id='{$t}'></div>\n\t\t\t<div style='text-aling:right'>" . imgtootltip("refresh-32.png", null, "LoadAjax('{$t}','{$page}?ufdbguard-status=yes');") . "</div>\n\t\t\t</td>\n\t\t<td style='vertical-align:top;padding-left:20px'>{$form}</td>\n\t</tr>\n\t</table>\n\t<script>\n\t\tLoadAjax('{$t}','{$page}?ufdbguard-status=yes');\n\t</script>\n\t\t\t\n\t";
    echo $html;
}
function license()
{
    $boot = new boostrap_form();
    $sock = new sockets();
    $page = CurrentPageName();
    $tpl = new templates();
    $users = new usersMenus();
    $uuid = base64_decode($sock->getFrameWork("cmd.php?system-unique-id=yes"));
    $LicenseInfos = unserialize(base64_decode($sock->GET_INFO("LicenseInfos")));
    $WizardSavedSettings = unserialize(base64_decode($sock->GET_INFO("WizardSavedSettings")));
    if ($LicenseInfos["COMPANY"] == null) {
        $LicenseInfos["COMPANY"] = $WizardSavedSettings["company_name"];
    }
    if ($LicenseInfos["EMAIL"] == null) {
        $LicenseInfos["EMAIL"] = $WizardSavedSettings["mail"];
    }
    if (!is_numeric($LicenseInfos["EMPLOYEES"])) {
        $LicenseInfos["EMPLOYEES"] = $WizardSavedSettings["employees"];
    }
    $t = time();
    $ASWEB = false;
    if ($users->SQUID_INSTALLED) {
        $ASWEB = true;
    }
    if ($users->WEBSTATS_APPLIANCE) {
        $ASWEB = true;
    }
    $lastupdate = "<p><strong>{license_status}:</strong> {$LicenseInfos["license_status"]}</p>\n\t<p><strong>{uuid}:</strong> {$uuid}</p>\n\t<p><strong>{license_number}:</strong> {$LicenseInfos["license_number"]}</p>\n\t\n\t";
    if (!$users->CORP_LICENSE) {
        $exp1 = "{CORP_LICENSE_EXPLAIN}\n\t\t<div style='font-size:16px;font-weight:bold'>{price_quote}:</div>\n\t\t\t<div>\n\t\t\t<a href=\"javascript:blur();\"\n\t\t\t\tOnClick=\"javascript:s_PopUpFull('http://www.proxy-appliance.org/index.php?cID=292','1024','900');\"\n\t\t\t\tstyle=\"font-size:14px;font-weight;bold;text-decoration:underline\">{click_here_price_quote}</a>\n\t\t\t</div>";
    }
    $boot->set_formtitle("{artica_license} - {$LicenseInfos["license_status"]}");
    if ($LicenseInfos["license_status"] == null) {
        $exp2 = "<br>{explain_license_free}{$lastupdate}";
        $boot->set_formtitle("{artica_license} ({waiting_registration})");
        $button_text = "{request_a_quote}/{refresh}";
    } else {
        $button_text = "{update_the_request}";
        $exp2 = "<br>{explain_license_order}{$lastupdate}";
    }
    if ($users->CORP_LICENSE) {
        $exp2 = "{$lastupdate}";
    }
    $boot->set_formdescription("{$exp1}{$exp2}");
    if ($users->CORP_LICENSE) {
        $boot->set_form_locked();
    }
    $boot->set_hidden("REGISTER", 1);
    $boot->set_field("COMPANY", "{company}", $LicenseInfos["COMPANY"]);
    $boot->set_field("EMAIL", "{your_email_address}", $LicenseInfos["EMAIL"]);
    $boot->set_field("EMPLOYEES", "{nb_employees}", $LicenseInfos["EMPLOYEES"]);
    $boot->set_field("license_number", "{license_number}", $LicenseInfos["license_number"], array("DISABLED" => true));
    if ($LicenseInfos["license_status"] == "{license_active}") {
        $users->CORP_LICENSE = true;
        $boot->set_hidden("UNLOCKLIC", $LicenseInfos["UNLOCKLIC"]);
    } else {
        $boot->set_field("UNLOCKLIC", "{unlock_license}", $LicenseInfos["UNLOCKLIC"]);
    }
    $boot->set_button($button_text);
    echo $boot->Compile();
}
function sources_add_group_popup()
{
    $boot = new boostrap_form();
    $sock = new sockets();
    $users = new usersMenus();
    $ldap = new clladp();
    $ID = $_GET["groupid"];
    $title_button = "{add}";
    $title = "{new_group}";
    if ($ID > 0) {
        $sql = "SELECT * FROM authenticator_auth WHERE ID='{$ID}'";
        $q = new mysql_squid_builder();
        $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
        if (!$q->ok) {
            echo "<p class=text-error>{$q->mysql_error}</p>";
        }
        $title_button = "{apply}";
        $title = $ligne["groupname"] . "&nbsp;&raquo;&raquo;&nbsp;" . $GLOBALS["TYPES"][$ligne["group_type"]];
    }
    $mainrule = $_GET["mainrule"];
    if (!is_numeric($mainrule)) {
        $mainrule = 0;
    }
    $boot->set_formtitle($title);
    $boot->set_hidden("rules-sources-add-group-save", "yes");
    $boot->set_hidden("mainrule", $mainrule);
    $boot->set_hidden("groupid", $ID);
    $boot->set_field("groupname", "{groupname}", $ligne["groupname"], array("ENCODE" => true));
    $boot->set_checkbox("enabled", "{enabled}", $ligne["enabled"]);
    if ($ID == 0) {
        $boot->set_list("group_type", "{groupe_type}", $GLOBALS["TYPES"], $ligne["group_type"]);
    } else {
        $boot->set_hidden("group_type", $ligne["group_type"]);
    }
    $boot->set_button($title_button);
    $AdminPrivs = AdminPrivs();
    if (!$AdminPrivs) {
        $boot->set_form_locked();
    }
    if ($ID == 0) {
        $boot->set_CloseYahoo("YahooWin3");
    }
    $boot->set_RefreshSearchs();
    echo $boot->Compile();
}
function charter_settings()
{
    $ID = $_GET["ID"];
    $users = new usersMenus();
    $page = CurrentPageName();
    $sock = new sockets();
    $boot = new boostrap_form();
    $users = new usersMenus();
    $title = "Acceptable Use Policy";
    $btname = "{add}";
    if ($ID > 0) {
        $q = new mysql_squid_builder();
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT TextIntro,TextButton,title FROM itcharters WHERE ID='{$ID}'"));
        if (!$q->ok) {
            echo "<p class=text-error>{$q->mysql_error}</p>";
        }
        $title = $ligne["title"];
        $btname = "{apply}";
    }
    if ($ligne["TextIntro"] == null) {
        $ligne["TextIntro"] = "<p style='font-size:18px'>Please read the IT chart before accessing trough Internet</p>";
    }
    if ($ligne["TextButton"] == null) {
        $ligne["TextButton"] = "I accept the terms and conditions of this agreement";
    }
    $boot->set_formtitle($title);
    $boot->set_hidden("ID", $ID);
    $boot->set_field("title", "{page_title}", $title);
    $boot->set_textarea("TextIntro", "{introduction_text}", $ligne["TextIntro"], array("ENCODE" => true));
    $boot->set_field("TextButton", "{text_button}", $ligne["TextButton"], array("ENCODE" => true));
    if (!$users->AsDansGuardianAdministrator) {
        $boot->set_form_locked();
    }
    $boot->set_button($btname);
    if ($ID == 0) {
        $boot->set_CloseYahoo("YahooWin2");
    }
    $boot->set_RefreshSearchs();
    echo $boot->Compile();
}
function bridge_popup()
{
    $boot = new boostrap_form();
    $sock = new sockets();
    $users = new usersMenus();
    $ldap = new clladp();
    $ID = $_GET["ID"];
    $title_button = "{add}";
    $nics = unserialize(base64_decode($sock->getFrameWork("cmd.php?list-nics=yes")));
    if ($_GET["ID"] > 0) {
        $sql = "SELECT * FROM nics_bridge WHERE ID='{$ID}'";
        $q = new mysql();
        $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
        $title_button = "{apply}";
    }
    $nics_array[null] = "{select}";
    $ous[null] = "{select}";
    $boot->set_field("name", "{name}", $ligne["name"]);
    $boot->set_field("ipaddr", "{tcp_address}", $ligne["ipaddr"], array("IPV4" => true));
    $boot->set_field("netmask", "{netmask}", $ligne["netmask"], array("IPV4" => true));
    $boot->set_field("cdir", "CDIR", $ligne["cdir"], array("CDIR" => "ipaddr,netmask"));
    $boot->set_field("broadcast", "{broadcast}", $ligne["broadcast"], array("IPV4" => true));
    $boot->set_field("gateway", "{gateway}", $ligne["gateway"], array("IPV4" => true));
    $boot->set_hidden("ID", $_GET["ID"]);
    if (!$users->AsSystemAdministrator) {
        $boot->set_form_locked();
    }
    if ($ID == 0) {
        $boot->set_CloseYahoo("YahooWin2");
    }
    $boot->set_RefreshSearchs();
    echo $boot->Compile();
}
function failover()
{
    //this_feature_is_disabled_corp_license
    $users = new usersMenus();
    $boot = new boostrap_form();
    $tpl = new templates();
    $t = time();
    $page = CurrentPageName();
    $sock = new sockets();
    $eth = $_GET["nic"];
    $nic = new system_nic($eth);
    for ($i = 1; $i < 256; $i++) {
        $ucarp_vids[$i] = $i;
    }
    $boot->set_hidden("save_nic", $eth);
    $array = unserialize(base64_decode($sock->getFrameWork("system.php?ucarp-status={$eth}")));
    if (!isset($array["PID"])) {
        $boot->set_formdescription("{status}:{stopped}");
        $boot->set_Newbutton("{start}", "Start{$t}()");
    } else {
        $boot->set_Newbutton("{stop}", "Stop{$t}()");
        $boot->set_formdescription("{status}:{running} PID:{$array["PID"]} {since} {$array["TIME"]}Mn");
    }
    $XHR = array();
    $XHR["start-vip"] = "yes";
    $boot->set_AddScript("Start{$t}", array("XHR" => $XHR));
    $XHR = array();
    $XHR["stop-vip"] = "yes";
    $boot->set_AddScript("Stop{$t}", array("XHR" => $XHR));
    $boot->set_checkbox("ucarp_enabled", "{enabled}", $nic->ucarp_enabled, array("DISABLEALL" => true));
    $boot->set_checkbox("ucarp_master", "{isamaster}", $nic->ucarp_master, array("TOOLTIP" => "{ucarp_master_explain}"));
    $boot->set_list("ucarp_vid", "{ucarp-vid}", $ucarp_vids, $nic->ucarp_vid);
    $boot->set_field("ucarp_vip", "{ucarp-vip}", $nic->ucarp_vip, array("MANDATORY" => true, "IPV4" => true, "TOOLTIP" => "{ucarp_vip_explain}"));
    $boot->set_list("ucarp_advskew", "{ucarp-advskew}", $ucarp_vids, $nic->ucarp_advskew);
    $boot->set_field("ucarp_advbase", "{interval} ({seconds})", $nic->ucarp_advbase, array("MANDATORY" => true));
    $boot->set_button("{apply}");
    $boot->set_RefreshSearchs();
    if (!$users->AsSystemAdministrator) {
        $boot->set_form_locked();
    }
    if (!$users->CORP_LICENSE) {
        $error = "<p class=text-error>{this_feature_is_disabled_corp_license}</p>";
        $boot->set_form_locked();
    }
    $form = $boot->Compile();
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($error . $form);
}
function rules_params()
{
    $boot = new boostrap_form();
    $sock = new sockets();
    $users = new usersMenus();
    $ldap = new clladp();
    $ID = $_GET["rules-params"];
    $title_button = "{add}";
    $title = "{new_authenticator_rule}";
    if ($ID > 0) {
        $sql = "SELECT * FROM authenticator_rules WHERE ID='{$ID}'";
        $q = new mysql_squid_builder();
        $ligne = @mysql_fetch_array($q->QUERY_SQL($sql));
        $title_button = "{apply}";
        $title = $ligne["rulename"];
    }
    $boot->set_formtitle($title);
    $boot->set_hidden("ruleid", $ID);
    $boot->set_field("rulename", "{rulename}", $ligne["rulename"], array("ENCODE" => true));
    $boot->set_field("cachetime", "{cachetime} ({minutes})", $ligne["cachetime"], array("TOOLTIP" => "{authenticator_cache_time_explain}"));
    $boot->set_textarea("explain", "{explain}", $ligne["explain"], array("ENCODE" => true));
    $boot->set_button($title_button);
    $AdminPrivs = AdminPrivs();
    if (!$AdminPrivs) {
        $boot->set_form_locked();
    }
    if ($ID == 0) {
        $boot->set_CloseYahoo("YahooWin2");
    }
    $boot->set_RefreshSearchs();
    echo $boot->Compile();
}
function page_popup()
{
    $boot = new boostrap_form();
    $sock = new sockets();
    $users = new usersMenus();
    $ldap = new clladp();
    $ID = $_GET["ID"];
    $title_button = "{add}";
    $title = "{new_error_page}";
    $f = new squid_reverse();
    if ($ID > 0) {
        $sql = "SELECT * FROM nginx_error_pages WHERE ID='{$ID}'";
        $q = new mysql_squid_builder();
        $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
        if (!$q->ok) {
            echo "<p class=text-error>{$q->mysql_error}</p>";
        }
        $title_button = "{apply}";
        $title = $ligne["pagename"] . "&nbsp;&raquo;&raquo;&nbsp;" . $ligne["error_code"];
    }
    while (list($key, $value) = each($f->errors_page)) {
        $errors_code[$value] = $value;
    }
    $boot->set_formtitle($title);
    $boot->set_hidden("page-save", "yes");
    $boot->set_hidden("ID", $ID);
    $boot->set_field("pagename", "{pagename}", $ligne["pagename"], array("ENCODE" => true));
    $boot->set_list("error_code", "{error_code}", $errors_code, $ligne["error_code"]);
    $boot->set_field("title", "{page_title}", $ligne["title"], array("ENCODE" => true));
    $boot->set_button($title_button);
    $AdminPrivs = AdminPrivs();
    if (!$AdminPrivs) {
        $boot->set_form_locked();
    }
    if ($ID == 0) {
        $boot->set_CloseYahoo("YahooWin3");
    }
    $boot->set_RefreshSearchs();
    echo $boot->Compile();
}
Beispiel #19
0
function settings_retention()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $users = new usersMenus();
    if ($users->CORP_LICENSE) {
        $LICENSE = 1;
    } else {
        $LICENSE = 0;
    }
    $ArticaProxyStatisticsBackupFolder = $sock->GET_INFO("ArticaProxyStatisticsBackupFolder");
    $ArticaProxyStatisticsBackupDays = $sock->GET_INFO("ArticaProxyStatisticsBackupDays");
    $ArticaProxyStatisticsBackHourTables = $sock->GET_INFO("ArticaProxyStatisticsBackHourTables");
    if (!is_numeric($ArticaProxyStatisticsBackHourTables)) {
        $ArticaProxyStatisticsBackHourTables = 1;
    }
    if ($ArticaProxyStatisticsBackupFolder == null) {
        $ArticaProxyStatisticsBackupFolder = "/home/artica/squid/backup-statistics";
    }
    $q = new mysql_squid_builder();
    if (!is_numeric($ArticaProxyStatisticsBackupDays)) {
        $ArticaProxyStatisticsBackupDays = 90;
    }
    if (!$users->CORP_LICENSE) {
        $error = "<p class=text-error>{this_feature_is_disabled_corp_license}</p>";
        $ArticaProxyStatisticsBackupDays = 5;
    }
    $t = time();
    $new_schedule = $tpl->javascript_parse_text("{new_schedule}");
    $EnableSquidRemoteMySQL = $sock->GET_INFO("EnableSquidRemoteMySQL");
    if (!is_numeric($EnableSquidRemoteMySQL)) {
        $EnableSquidRemoteMySQL = 0;
    }
    if ($EnableSquidRemoteMySQL == 1) {
        $EnableSquidRemoteMySQL_text = "{EnableSquidRemoteMySQL_text}";
    }
    $lock = false;
    $boot = new boostrap_form();
    $boot->set_formdescription($EnableSquidRemoteMySQL_text . "<br>{purge_statistics_database_explain2}");
    $boot->set_checkbox("ArticaProxyStatisticsBackHourTables", "{backup_hourly_tables}", $ArticaProxyStatisticsBackHourTables, array("TOOLTIP" => "{backup_hourly_tables_explain}"));
    $boot->set_field("ArticaProxyStatisticsBackupFolder", "{backup_folder}", $ArticaProxyStatisticsBackupFolder, array("BROWSE" => true));
    $boot->set_field("ArticaProxyStatisticsBackupDays", "{max_days}", $ArticaProxyStatisticsBackupDays);
    $BackupSquidStatsUseNas = $sock->GET_INFO("BackupSquidStatsUseNas");
    $BackupSquidStatsNASIpaddr = $sock->GET_INFO("BackupSquidStatsNASIpaddr");
    $BackupSquidStatsNASFolder = $sock->GET_INFO("BackupSquidStatsNASFolder");
    $BackupSquidStatsNASUser = $sock->GET_INFO("BackupSquidStatsNASUser");
    $BackupSquidStatsNASPassword = $sock->GET_INFO("BackupSquidStatsNASPassword");
    $BackupSquidStatsNASRetry = $sock->GET_INFO("BackupSquidStatsNASRetry");
    if (!is_numeric($BackupSquidStatsUseNas)) {
        $BackupSquidStatsUseNas = 0;
    }
    if (!is_numeric($BackupSquidStatsNASRetry)) {
        $BackupSquidStatsNASRetry = 0;
    }
    $boot->set_spacertitle("{NAS_storage}");
    $boot->set_checkbox("BackupSquidStatsUseNas", "{use_remote_nas}", $BackupSquidStatsUseNas, array("TOOLTIP" => "{BackupSquidStatsUseNas_explain}", "LINK" => "BackupSquidStatsNASIpaddr,BackupSquidStatsNASFolder,BackupSquidStatsNASUser,BackupSquidStatsNASPassword"));
    $boot->set_field("BackupSquidStatsNASIpaddr", "{hostname}", $BackupSquidStatsNASIpaddr);
    $boot->set_field("BackupSquidStatsNASFolder", "{shared_folder}", $BackupSquidStatsNASFolder, array("ENCODE" => true));
    $boot->set_field("BackupSquidStatsNASUser", "{username}", $BackupSquidStatsNASUser, array("ENCODE" => true));
    $boot->set_fieldpassword("BackupSquidStatsNASPassword", "{password}", $BackupSquidStatsNASPassword, array("ENCODE" => true));
    $boot->set_checkbox("BackupSquidStatsNASRetry", "{retry}", $BackupSquidStatsNASRetry, array("TOOLTIP" => "{BackupSquidLogsNASRetry_explain}"));
    $boot->set_button("{apply}");
    $boot->set_formtitle("{purge_statistics_database}");
    if (!$users->CORP_LICENSE) {
        $boot->set_form_locked();
        $lock = true;
    }
    if ($EnableSquidRemoteMySQL == 1) {
        $boot->set_form_locked();
        $lock = true;
    }
    $new_schedule = $tpl->javascript_parse_text("{new_schedule}");
    if (!$lock) {
        $boot->set_Newbutton("{new_schedule}", "YahooWin3('650','squid.databases.schedules.php?AddNewSchedule-popup=yes&ID=0&t={$t}&ForceType=47&YahooWin=3&jsback=ReloadSchedules{$t}','{$new_schedule}')");
        $ReloadSchedules = "ReloadSchedules{$t}()";
    }
    $boot->set_Newbutton("{test_connection}", "Loadjs('{$page}?test-nas-js=yes')");
    $form = $boot->Compile();
    $html = "\n\n\t\t<div id='title-{$t}'></div>\n\t\t{$error}\n\t\t{$form}\n\t\t<div id='schedules-{$t}'></div>\n\n\t\t<script>\n\t\tfunction ReloadSchedules{$t}(){\n\t\tLoadAjax('schedules-{$t}','squid.artica.statistics.purge.php?schedules=yes');\n}\n\nfunction RefreshTableTitle{$t}(){\nLoadAjaxTiny('title-{$t}','squid.artica.statistics.purge.php?title=yes&t={$t}');\n}\nRefreshTableTitle{$t}();\n{$ReloadSchedules};\n</script>\n\n";
    echo $tpl->_ENGINE_parse_body($html);
}
function source_popup_main()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $source_id = $_GET["source-id"];
    if (!is_numeric($source_id)) {
        $source_id = 0;
    }
    $q = new mysql_squid_builder();
    $title = "{new_source}";
    $bt = "{add}";
    if ($source_id > 0) {
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM reverse_sources WHERE ID='{$source_id}'"));
        $title = $ligne["servername"];
        $bt = "{apply}";
    }
    if (!$q->FIELD_EXISTS("reverse_sources", "OnlyTCP")) {
        $q->QUERY_SQL("ALTER TABLE `reverse_sources` ADD `OnlyTCP` smallint(1) NOT NULL DEFAULT '0'");
    }
    if (!is_numeric($ligne["port"])) {
        $ligne["port"] = 80;
    }
    if (!is_numeric($ligne["sslport"])) {
        $ligne["sslport"] = 443;
    }
    if (!is_numeric($ligne["OnlyTCP"])) {
        $ligne["OnlyTCP"] = 0;
    }
    if (!is_numeric($ligne["enabled"])) {
        $ligne["enabled"] = 1;
    }
    if (!is_numeric($ligne["ForceRedirect"])) {
        $ligne["ForceRedirect"] = 1;
    }
    if (!is_numeric($ligne["proxy_read_timeout"])) {
        $ligne["proxy_read_timeout"] = 300;
    }
    if ($source_id == 0) {
        $ligne["enabled"] = 1;
    }
    $boot = new boostrap_form();
    $boot->set_hidden("source-id", $source_id);
    $boot->set_formtitle($title);
    $boot->set_hidden("OnlyTCP", "0");
    $boot->set_field("servername", "{servername2}", $ligne["servername"], array("TOOLTIP" => "{nginx_servername2}"));
    $boot->set_field("ipaddr", "{destination}", $ligne["ipaddr"], array("TOOLTIP" => "{nginx_destination}"));
    //$boot->set_checkbox("OnlyTCP", "{OnlyTCP}", $ligne["OnlyTCP"],array("TOOLTIP"=>"{nginx_OnlyTCP}"));
    $boot->set_field("port", "{port}", $ligne["port"]);
    $boot->set_field("forceddomain", "{forceddomain}", $ligne["forceddomain"], array("TOOLTIP" => "{nginx_forceddomain}"));
    $boot->set_checkbox("proxy_cookie_domain", "{proxy_cookie_domain}", $ligne["proxy_cookie_domain"], array("TOOLTIP" => "{nginx_proxy_cookie_domain}"));
    $boot->set_field("proxy_read_timeout", "{read_timeout} ({seconds})", $ligne["proxy_read_timeout"], array("TOOLTIP" => "{nginx_proxy_read_timeout}"));
    $boot->set_checkbox("ForceRedirect", "{ForceRedirect}", $ligne["ForceRedirect"], array("TOOLTIP" => "{nginx_ForceRedirect}"));
    $boot->set_checkbox("ssl", "{generate_ssl}", $ligne["ssl"]);
    $boot->set_checkbox("enabled", "{enabled}", $ligne["enabled"], array("DISABLEALL" => true));
    $boot->set_button($bt);
    if ($source_id == 0) {
        $boot->set_CloseYahoo("YahooWin");
    }
    $boot->set_RefreshSearchs();
    $AdminPrivs = AdminPrivs();
    if (!$AdminPrivs) {
        $boot->set_form_locked();
    }
    echo $boot->Compile();
}
function parameters()
{
    $users = new usersMenus();
    $tpl = new templates();
    if (!$users->SARG_INSTALLED) {
        echo $tpl->_ENGINE_parse_body("<p class=text-error>{SARG_NOT_INSTALLED}</p>");
    }
    $sock = new sockets();
    $tpl = new templates();
    $EnableSargGenerator = $sock->GET_INFO("EnableSargGenerator");
    $DisableArticaProxyStatistics = $sock->GET_INFO("DisableArticaProxyStatistics");
    $SargConfig = unserialize(base64_decode($sock->GET_INFO("SargConfig")));
    $SargConfig = SargDefault($SargConfig);
    if (!is_numeric($EnableSargGenerator)) {
        $EnableSargGenerator = 0;
    }
    $SargOutputDir = $sock->GET_INFO("SargOutputDir");
    if ($SargOutputDir == null) {
        $SargOutputDir = "/var/www/html/squid-reports";
    }
    $warn_squid_restart = $tpl->javascript_parse_text("{warn_squid_restart}");
    $page = CurrentPageName();
    $array[] = "Bulgarian_windows1251";
    $array[] = "Catalan";
    $array[] = "Czech";
    $array[] = "Dutch";
    $array[] = "English";
    $array[] = "French";
    $array[] = "German";
    $array[] = "Greek";
    $array[] = "Hungarian";
    $array[] = "Indonesian";
    $array[] = "Italian";
    $array[] = "Japanese";
    $array[] = "Latvian";
    $array[] = "Polish";
    $array[] = "Portuguese";
    $array[] = "Romanian";
    $array[] = "Russian_koi8";
    $array[] = "Russian_UFT-8";
    $array[] = "Russian_windows1251";
    $array[] = "Serbian";
    $array[] = "Slovak";
    $array[] = "Spanish";
    $array[] = "Turkish";
    while (list($key, $line) = each($array)) {
        $langs[$line] = $line;
    }
    $overwrite_report = array("ignore" => "{sarg_ignore}", "ip" => "{sarg_ip}", "everybody" => "{sarg_everybody}");
    $sort_order = array("A" => "{ascendent}", "D" => "{descendent}");
    $sarg_date_format = array("e" => "European=dd/mm/yy", "u" => "American=mm/dd/yy", "w" => "Weekly=yy.ww");
    $boot = new boostrap_form();
    $boot->set_checkbox("EnableSargGenerator", "{EnableSargGenerator}", $EnableSargGenerator, array("DISABLEALL" => true, "TOOLTIP" => "{EnableSargGenerator_explain}"));
    if (!$users->PROXYTINY_APPLIANCE) {
        $boot->set_checkbox("DisableArticaProxyStatistics", "{DisableArticaProxyStatistics}", $DisableArticaProxyStatistics);
    } else {
        $boot->set_hidden("DisableArticaProxyStatistics", 1);
    }
    $LASTLOGS[30] = "1 {month}";
    $LASTLOGS[60] = "2 {months}";
    $LASTLOGS[90] = "3 {months}";
    $LASTLOGS[120] = "4 {months}";
    $LASTLOGS[150] = "5 {months}";
    $LASTLOGS[360] = "1 {year}";
    $boot->set_field("SargOutputDir", "{directory}", $SargOutputDir, array("TOOLTIP" => "{SargOutputDir_explain}", "BROWSE" => true));
    $boot->set_list("language", "{language}", $langs, $SargConfig["language"]);
    $boot->set_field("title", "{sarg_title}", $SargConfig["title"]);
    $boot->set_checkbox("graphs", "{enable_graphs}", $SargConfig["graphs"]);
    $boot->set_checkbox("user_ip", "{sarg_user_ip}", $SargConfig["user_ip"]);
    $boot->set_checkbox("resolve_ip", "{sarg_resolve_ip}", $SargConfig["resolve_ip"]);
    $boot->set_checkbox("long_url", "{sarg_long_url}", $SargConfig["long_url"]);
    $boot->set_list("records_without_userid", "{sarg_records_without_userid}", $overwrite_report, $SargConfig["records_without_userid"]);
    $boot->set_field("topsites_num", "{sarg_topsites_num}", $SargConfig["topsites_num"]);
    $boot->set_field("topuser_num", "{sarg_topuser_num}", $SargConfig["topuser_num"], array("TOOLTIP" => "{sarg_topuser_exp}"));
    $boot->set_list("topsites_sort_order", "{topsites_sort_order}", $sort_order, $SargConfig["topsites_sort_order"]);
    $boot->set_list("index_sort_order", "{index_sort_order}", $sort_order, $SargConfig["index_sort_order"]);
    $boot->set_list("date_format", "{sarg_date_format}", $sarg_date_format, $SargConfig["date_format"]);
    $boot->set_list("lastlog", "{sarg_lastlog}", $LASTLOGS, $SargConfig["lastlog"]);
    $boot->set_button("{apply}");
    if (!$users->AsWebStatisticsAdministrator) {
        $boot->set_form_locked();
    }
    echo $boot->Compile();
}