Exemplo n.º 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 settings()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $q = new mysql_catz();
    $users = new usersMenus();
    $sock = new sockets();
    $SquidDBTuningParameters = unserialize(base64_decode($sock->GET_INFO("MySQLCatzParams")));
    $query_cache_size = $SquidDBTuningParameters["query_cache_size"];
    $max_allowed_packet = $SquidDBTuningParameters["max_allowed_packet"];
    $max_connections = $SquidDBTuningParameters["max_connections"];
    $connect_timeout = $SquidDBTuningParameters["connect_timeout"];
    $interactive_timeout = $SquidDBTuningParameters["interactive_timeout"];
    $key_buffer_size = $SquidDBTuningParameters["key_buffer_size"];
    $table_open_cache = $SquidDBTuningParameters["table_open_cache"];
    $myisam_sort_buffer_size = $SquidDBTuningParameters["myisam_sort_buffer_size"];
    $ListenPort = $SquidDBTuningParameters["ListenPort"];
    $tmpdir = $SquidDBTuningParameters["tmpdir"];
    if (!isset($SquidDBTuningParameters["net_read_timeout"])) {
        $SquidDBTuningParameters["net_read_timeout"] = 120;
    }
    $serverMem = round(($users->MEM_TOTAL_INSTALLEE - 300) / 1024);
    $VARIABLES = $q->SHOW_VARIABLES();
    if (is_array($SquidDBTuningParameters)) {
        while (list($key, $value) = each($SquidDBTuningParameters)) {
            if (isset($SquidDBTuningParameters[$key])) {
                if ($GLOBALS["VERBOSE"]) {
                    echo "VARIABLES[{$key}]={$VARIABLES[$key]} MySQLCatzParams[{$key}]={$SquidDBTuningParameters[$key]}<br>\n";
                }
                if ($VARIABLES[$key] == null) {
                    $VARIABLES[$key] = $SquidDBTuningParameters[$key];
                }
            }
        }
    }
    $read_buffer_size = round($VARIABLES["read_buffer_size"] / 1024 / 1000, 2);
    $read_rnd_buffer_size = round($VARIABLES["read_rnd_buffer_size"] / 1024 / 1000, 2);
    $sort_buffer_size = round($VARIABLES["sort_buffer_size"] / 1024 / 1000, 2);
    $thread_stack = round($VARIABLES["thread_stack"] / 1024 / 1000, 2);
    $join_buffer_size = round($VARIABLES["join_buffer_size"] / 1024 / 1000, 2);
    $max_tmp_table_size = round($VARIABLES["max_tmp_table_size"] / 1024 / 1000, 2);
    $innodb_log_buffer_size = round($VARIABLES["innodb_log_buffer_size"] / 1024 / 1000, 2);
    $innodb_additional_mem_pool_size = round($VARIABLES["innodb_additional_mem_pool_size"] / 1024 / 1000, 2);
    $innodb_log_buffer_size = round($VARIABLES["innodb_log_buffer_size"] / 1024 / 1000, 2);
    $innodb_buffer_pool_size = round($VARIABLES["innodb_buffer_pool_size"] / 1024 / 1000, 2);
    $max_connections = $VARIABLES["max_connections"];
    $per_thread_buffers = $sort_buffer_size + $read_rnd_buffer_size + $sort_buffer_size + $thread_stack + $join_buffer_size;
    $total_per_thread_buffers = $per_thread_buffers * $max_connections;
    if ($total_per_thread_buffers > $serverMem) {
        $color = "#EB0000";
    }
    $query_cache_size = round($VARIABLES["query_cache_size"] / 1024 / 1000, 2);
    $key_buffer_size = round($VARIABLES["key_buffer_size"] / 1024 / 1000, 2);
    if ($tmpdir == null) {
        $tmpdir = "/tmp";
    }
    $server_buffers = $key_buffer_size + $max_tmp_table_size + $innodb_buffer_pool_size + $innodb_additional_mem_pool_size + $innodb_log_buffer_size + $query_cache_size;
    if ($server_buffers > $serverMem) {
        $color = "#EB0000";
    }
    $max_used_memory = $server_buffers + $total_per_thread_buffers;
    if ($max_used_memory > $serverMem) {
        $color = "#EB0000";
    }
    $UNIT = "M";
    if ($max_used_memory > 1000) {
        $max_used_memory = round($max_used_memory / 1000, 2);
        $UNIT = "G";
    }
    if (!is_numeric($ListenPort)) {
        $ListenPort = 0;
    }
    $boot = new boostrap_form();
    $boot->set_hidden("innodb_buffer_pool_size", $innodb_buffer_pool_size);
    $boot->set_hidden("innodb_additional_mem_pool_size", $innodb_additional_mem_pool_size);
    $boot->set_hidden("innodb_log_buffer_size", $innodb_log_buffer_size);
    $boot->set_spacertitle("{threads}:");
    $boot->set_field("read_buffer_size", "{read_buffer_size} (MB)", $read_buffer_size, array("TOOLTIP" => "{read_buffer_size_text}"));
    $boot->set_field("read_rnd_buffer_size", "{read_rnd_buffer_size} (MB)", $read_rnd_buffer_size, array("TOOLTIP" => "{read_rnd_buffer_size_text}"));
    $boot->set_field("sort_buffer_size", "{sort_buffer_size} (MB)", $sort_buffer_size, array("TOOLTIP" => "{sort_buffer_size_text}"));
    $boot->set_field("thread_stack", "Thread Stack", $thread_stack, array("TOOLTIP" => "{thread_stack_text}"));
    $boot->set_spacertitle("{server}:");
    $boot->set_field("ListenPort", "{listen_port}", $ListenPort);
    $boot->set_field("tmpdir", "{working_directory}", $tmpdir, array("BUTTON" => array("LABEL" => "{browse}", "JS" => "Loadjs('SambaBrowse.php?no-shares=yes&field=%f&no-hidden=yes')")));
    $boot->set_field("net_read_timeout", "{net_read_timeout} ({seconds})", $SquidDBTuningParameters["net_read_timeout"]);
    $boot->set_field("max_connections", "{max_connections}", $max_connections);
    $boot->set_field("key_buffer_size", "{key_buffer_size} (MB)", $key_buffer_size);
    $boot->set_field("max_tmp_table_size", "MAX TMP Table size (MB)", $max_tmp_table_size);
    $boot->set_field("query_cache_size", "{query_cache_size} (MB)", $query_cache_size, array("TOOLTIP" => "{thread_stack_text}"));
    $boot->set_button("{apply}");
    $boot->set_formdescription("{$server_buffers}M + {$total_per_thread_buffers}M = {$max_used_memory}{$UNIT}");
    $html = $boot->Compile();
    echo $tpl->_ENGINE_parse_body($html);
}
Exemplo n.º 3
0
function websites_popup_webserver_replace_popup()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $servername = $_GET["servername"];
    $q = new mysql_squid_builder();
    $title = "{new_rule}";
    $bt = "{add}";
    $ID = $_GET["replaceid"];
    $boot = new boostrap_form();
    $sock = new sockets();
    $servername = $_GET["servername"];
    if ($ID > 0) {
        $q = new mysql_squid_builder();
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM nginx_replace_www WHERE ID='{$ID}'"));
        $bt = "{apply}";
        $title = "{$ligne["rulename"]}";
        $ligne["stringtosearch"] = stripslashes($ligne["stringtosearch"]);
        $ligne["replaceby"] = stripslashes($ligne["replaceby"]);
        $servername = $ligne["servername"];
    }
    if ($ligne["tokens"] == null) {
        $ligne["tokens"] = "g";
    }
    if ($ligne["rulename"] == null) {
        $ligne["rulename"] = time();
    }
    $boot->set_hidden("replaceid", $ID);
    $boot->set_hidden("servername", $servername);
    $boot->set_formtitle($title);
    $boot->set_field("rulename", "{name}", $ligne["rulename"]);
    $boot->set_field("zorder", "{order}", $ligne["zorder"]);
    $boot->set_spacertitle("{search}");
    $boot->set_textarea("stringtosearch", "{search}", $ligne["stringtosearch"], array("MANDATORY" => true, "ENCODE" => true));
    $boot->set_checkbox("AsRegex", "{regex}", $ligne["AsRegex"], array("TOOLTIP" => "{replace_regex_explain}"));
    $boot->set_spacertitle("{replace}");
    $boot->set_textarea("replaceby", "{replace}", $ligne["replaceby"], array("MANDATORY" => true, "ENCODE" => true));
    $boot->set_field("tokens", "{flags}", $ligne["tokens"], array("MANDATORY" => true));
    $boot->set_button($bt);
    if ($ID == 0) {
        $boot->set_CloseYahoo("YahooWin3");
    }
    $boot->set_RefreshSearchs();
    $boot->set_formdescription("{nginx_subst_explain}");
    echo $boot->Compile();
}
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 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 watchdog_params()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $tcp = new networking();
    $ALL_IPS_GET_ARRAY = $tcp->ALL_IPS_GET_ARRAY();
    unset($ALL_IPS_GET_ARRAY["127.0.0.1"]);
    $ALL_IPS_GET_ARRAY[null] = "{none}";
    //echo base64_decode($sock->GET_INFO("SquidWatchdogMonitConfig"));
    $MonitConfig = unserialize(base64_decode($sock->GET_INFO("SquidWatchdogMonitConfig")));
    if (!isset($MonitConfig["SWAP_MONITOR"])) {
        $MonitConfig["SWAP_MONITOR"] = 1;
    }
    if (!isset($MonitConfig["SWAP_MIN"])) {
        $MonitConfig["SWAP_MIN"] = 5;
    }
    if (!isset($MonitConfig["SWAP_MAX"])) {
        $MonitConfig["SWAP_MAX"] = 75;
    }
    if (!isset($MonitConfig["MAX_RESTART"])) {
        $MonitConfig["MAX_RESTART"] = 2;
    }
    if (!isset($MonitConfig["MaxLoad"])) {
        $MonitConfig["MaxLoad"] = 30;
    }
    if (!isset($MonitConfig["MaxLoadReboot"])) {
        $MonitConfig["MaxLoadReboot"] = 0;
    }
    if (!isset($MonitConfig["MaxLoadFailOver"])) {
        $MonitConfig["MaxLoadFailOver"] = 0;
    }
    if (!isset($MonitConfig["MinTimeFailOverSwitch"])) {
        $MonitConfig["MinTimeFailOverSwitch"] = 15;
    }
    if (!isset($MonitConfig["REBOOT_INTERVAL"])) {
        $MonitConfig["REBOOT_INTERVAL"] = 30;
    }
    if (!isset($MonitConfig["RestartWhenCrashes"])) {
        $MonitConfig["RestartWhenCrashes"] = 1;
    }
    if (!isset($MonitConfig["DisableWebFilteringNetFailed"])) {
        $MonitConfig["DisableWebFilteringNetFailed"] = 1;
    }
    if (!isset($MonitConfig["watchdog"])) {
        $MonitConfig["watchdog"] = 1;
    }
    if (!isset($MonitConfig["watchdogCPU"])) {
        $MonitConfig["watchdogCPU"] = 95;
    }
    if (!isset($MonitConfig["watchdogMEM"])) {
        $MonitConfig["watchdogMEM"] = 1500;
    }
    if (!isset($MonitConfig["MgrInfosMaxTimeOut"])) {
        $MonitConfig["MgrInfosMaxTimeOut"] = 10;
    }
    if (!isset($MonitConfig["ExternalPageToCheck"])) {
        $MonitConfig["ExternalPageToCheck"] = "http://www.google.fr/search?q=%T";
    }
    if (!is_numeric($MonitConfig["SWAP_MIN"])) {
        $MonitConfig["SWAP_MIN"] = 5;
    }
    if (!is_numeric($MonitConfig["SWAP_MAX"])) {
        $MonitConfig["SWAP_MAX"] = 75;
    }
    if (!is_numeric($MonitConfig["MinTimeFailOverSwitch"])) {
        $MonitConfig["MinTimeFailOverSwitch"] = 15;
    }
    if (!is_numeric($MonitConfig["watchdog"])) {
        $MonitConfig["watchdog"] = 1;
    }
    if (!is_numeric($MonitConfig["watchdogCPU"])) {
        $MonitConfig["watchdogCPU"] = 95;
    }
    if (!is_numeric($MonitConfig["watchdogMEM"])) {
        $MonitConfig["watchdogMEM"] = 1500;
    }
    if (!is_numeric($MonitConfig["REBOOT_INTERVAL"])) {
        $MonitConfig["REBOOT_INTERVAL"] = 30;
    }
    if (!is_numeric($MonitConfig["WEBPROCISSUE"])) {
        $MonitConfig["WEBPROCISSUE"] = 3;
    }
    if (!is_numeric($MonitConfig["DisableWebFilteringNetFailed"])) {
        $MonitConfig["DisableWebFilteringNetFailed"] = 1;
    }
    if (!is_numeric($MonitConfig["MgrInfosMaxTimeOut"])) {
        $MonitConfig["MgrInfosMaxTimeOut"] = 10;
    }
    if ($MonitConfig["MgrInfosMaxTimeOut"] < 5) {
        $MonitConfig["MgrInfosMaxTimeOut"] = 5;
    }
    if ($MonitConfig["ExternalPageToCheck"] == null) {
        $MonitConfig["ExternalPageToCheck"] = "http://www.google.fr/search?q=%T";
    }
    if (!is_numeric($MonitConfig["MAX_RESTART"])) {
        $MonitConfig["MAX_RESTART"] = 2;
    }
    if (!is_numeric($MonitConfig["TestExternalWebPage"])) {
        $MonitConfig["TestExternalWebPage"] = 1;
    }
    if (!is_numeric($MonitConfig["NotifyDNSIssues"])) {
        $MonitConfig["NotifyDNSIssues"] = 0;
    }
    if (!is_numeric($MonitConfig["DNSIssuesMAX"])) {
        $MonitConfig["DNSIssuesMAX"] = 1;
    }
    if ($MonitConfig["DNSIssuesMAX"] == 0) {
        $MonitConfig["DNSIssuesMAX"] = 1;
    }
    if (!is_numeric($MonitConfig["MaxSwapPourc"])) {
        $MonitConfig["MaxSwapPourc"] = 10;
    }
    if (!is_numeric($MonitConfig["MaxLoad"])) {
        $MonitConfig["MaxLoad"] = 30;
    }
    if (!is_numeric($MonitConfig["MaxLoadReboot"])) {
        $MonitConfig["MaxLoadReboot"] = 0;
    }
    if (!is_numeric($MonitConfig["MaxLoadFailOver"])) {
        $MonitConfig["MaxLoadFailOver"] = 0;
    }
    if (!is_numeric($MonitConfig["MinFreeMem"])) {
        $MonitConfig["MinFreeMem"] = 50;
    }
    if (!is_numeric($MonitConfig["RestartWhenCrashes"])) {
        $MonitConfig["RestartWhenCrashes"] = 1;
    }
    if (!isset($MonitConfig["ENABLE_PING_GATEWAY"])) {
        $MonitConfig["ENABLE_PING_GATEWAY"] = 1;
    }
    if (!isset($MonitConfig["MAX_PING_GATEWAY"])) {
        $MonitConfig["MAX_PING_GATEWAY"] = 10;
    }
    if (!isset($MonitConfig["PING_FAILED_REPORT"])) {
        $MonitConfig["PING_FAILED_REPORT"] = 1;
    }
    if (!isset($MonitConfig["PING_FAILED_REBOOT"])) {
        $MonitConfig["PING_FAILED_REBOOT"] = 0;
    }
    if (!isset($MonitConfig["PING_FAILED_RELOAD_NET"])) {
        $MonitConfig["PING_FAILED_RELOAD_NET"] = 0;
    }
    if (!is_numeric($MonitConfig["ENABLE_PING_GATEWAY"])) {
        $MonitConfig["ENABLE_PING_GATEWAY"] = 1;
    }
    if (!is_numeric($MonitConfig["MAX_PING_GATEWAY"])) {
        $MonitConfig["MAX_PING_GATEWAY"] = 10;
    }
    if (!is_numeric($MonitConfig["PING_FAILED_REPORT"])) {
        $MonitConfig["PING_FAILED_REPORT"] = 1;
    }
    if (!is_numeric($MonitConfig["PING_FAILED_REBOOT"])) {
        $MonitConfig["PING_FAILED_REBOOT"] = 0;
    }
    if (!is_numeric($MonitConfig["PING_FAILED_FAILOVER"])) {
        $MonitConfig["PING_FAILED_FAILOVER"] = 0;
    }
    if (!is_numeric($MonitConfig["PING_FAILED_RELOAD_NET"])) {
        $MonitConfig["PING_FAILED_RELOAD_NET"] = 0;
    }
    $ExternalPageToCheck = $MonitConfig["ExternalPageToCheck"];
    $MgrInfosMaxTimeOut = $MonitConfig["MgrInfosMaxTimeOut"];
    $EnableFailover = $sock->GET_INFO("EnableFailover");
    if (!is_numeric($EnableFailover)) {
        $EnableFailover = 1;
    }
    if ($MonitConfig["REBOOT_INTERVAL"] < 10) {
        $MonitConfig["REBOOT_INTERVAL"] = 10;
    }
    if ($MonitConfig["MinTimeFailOverSwitch"] < 5) {
        $MonitConfig["MinTimeFailOverSwitch"] = 5;
    }
    if ($MonitConfig["PING_GATEWAY"] == null) {
        $PING_GATEWAY = null;
        $TCP_NICS_STATUS_ARRAY = unserialize(base64_decode($sock->getFrameWork("cmd.php?TCP_NICS_STATUS_ARRAY=yes")));
        if (isset($TCP_NICS_STATUS_ARRAY["eth0"])) {
            $PING_GATEWAY = $TCP_NICS_STATUS_ARRAY["eth0"]["GATEWAY"];
        }
        if ($PING_GATEWAY == null) {
            if (isset($TCP_NICS_STATUS_ARRAY["eth1"])) {
                $PING_GATEWAY = $TCP_NICS_STATUS_ARRAY["eth1"]["GATEWAY"];
            }
        }
        $MonitConfig["PING_GATEWAY"] = $PING_GATEWAY;
    }
    //FATAL: kid3 registration timed out
    $MONIT_INSTALLED = 0;
    $users = new usersMenus();
    if ($users->MONIT_INSTALLED) {
        $MONIT_INSTALLED = 1;
    }
    $SquidCacheReloadTTL = $sock->GET_INFO("SquidCacheReloadTTL");
    if (!is_numeric($SquidCacheReloadTTL)) {
        $SquidCacheReloadTTL = 10;
    }
    $sock = new sockets();
    $ini = new Bs_IniHandler();
    $ini->loadString($sock->getFrameWork("cmd.php?SmtpNotificationConfigRead=yes"));
    if ($ini->_params["SMTP"]["smtp_server_port"] == null) {
        $ini->_params["SMTP"]["smtp_server_port"] = 25;
    }
    if ($ini->_params["SMTP"]["smtp_sender"] == null) {
        $users = new usersMenus();
        $ini->_params["SMTP"]["smtp_sender"] = "artica@{$users->fqdn}";
    }
    $t = time();
    $UfdbguardSMTPNotifs = unserialize(base64_decode($sock->GET_INFO("UfdbguardSMTPNotifs")));
    if (!isset($UfdbguardSMTPNotifs["ENABLED_SQUID_WATCHDOG"])) {
        $UfdbguardSMTPNotifs["ENABLED_SQUID_WATCHDOG"] = 0;
    }
    if (!is_numeric($UfdbguardSMTPNotifs["ENABLED_SQUID_WATCHDOG"])) {
        $UfdbguardSMTPNotifs["ENABLED_SQUID_WATCHDOG"] = 0;
    }
    if (!isset($UfdbguardSMTPNotifs["smtp_server_name"])) {
        $UfdbguardSMTPNotifs["smtp_server_name"] = $ini->_params["SMTP"]["smtp_server_name"];
    }
    if (!isset($UfdbguardSMTPNotifs["smtp_server_port"])) {
        $UfdbguardSMTPNotifs["smtp_server_port"] = $ini->_params["SMTP"]["smtp_server_port"];
    }
    if (!isset($UfdbguardSMTPNotifs["smtp_sender"])) {
        $UfdbguardSMTPNotifs["smtp_server_port"] = $ini->_params["SMTP"]["smtp_sender"];
    }
    if (!isset($UfdbguardSMTPNotifs["smtp_dest"])) {
        $UfdbguardSMTPNotifs["smtp_dest"] = $ini->_params["SMTP"]["smtp_dest"];
    }
    if (!isset($UfdbguardSMTPNotifs["smtp_auth_user"])) {
        $UfdbguardSMTPNotifs["smtp_dest"] = $ini->_params["SMTP"]["smtp_auth_user"];
    }
    if (!isset($UfdbguardSMTPNotifs["smtp_auth_passwd"])) {
        $UfdbguardSMTPNotifs["smtp_auth_passwd"] = $ini->_params["SMTP"]["smtp_auth_passwd"];
    }
    if (!isset($UfdbguardSMTPNotifs["tls_enabled"])) {
        $UfdbguardSMTPNotifs["tls_enabled"] = $ini->_params["SMTP"]["tls_enabled"];
    }
    if (!isset($UfdbguardSMTPNotifs["ssl_enabled"])) {
        $UfdbguardSMTPNotifs["ssl_enabled"] = $ini->_params["SMTP"]["ssl_enabled"];
    }
    if (!is_numeric($UfdbguardSMTPNotifs["smtp_server_port"])) {
        $UfdbguardSMTPNotifs["smtp_server_port"] = 25;
    }
    if (!isset($MonitConfig["ALLOW_RETURN_1CPU"])) {
        $MonitConfig["ALLOW_RETURN_1CPU"] = 1;
    }
    if (!is_numeric($MonitConfig["ALLOW_RETURN_1CPU"])) {
        $MonitConfig["ALLOW_RETURN_1CPU"] = 1;
    }
    $boot = new boostrap_form();
    $boot->set_checkbox("watchdog", "{enable}", $MonitConfig["watchdog"], array("DISABLEALL" => true));
    $boot->set_checkbox("EnableFailover", "{enable} {failover}", $EnableFailover, array("TOOLTIP" => "{EnableFailover_explain}"));
    $boot->set_field("MinTimeFailOverSwitch", "{failover_ttl} ({minutes})", $MonitConfig["MinTimeFailOverSwitch"], array("TOOLTIP" => "{failover_ttl_explain}"));
    $boot->set_checkbox("ALLOW_RETURN_1CPU", "{ALLOW_RETURN_1CPU}", $MonitConfig["ALLOW_RETURN_1CPU"], array("TOOLTIP" => "{ALLOW_RETURN_1CPU_EXPLAIN}"));
    $boot->set_field("WEBPROCISSUE", "{max_attempts}", $MonitConfig["WEBPROCISSUE"]);
    $boot->set_checkbox("DisableWebFilteringNetFailed", "{DisableWebFilteringNetFailed}", $MonitConfig["DisableWebFilteringNetFailed"], array("TOOLTIP" => "{DisableWebFilteringNetFailed_explain}"));
    $boot->set_field("SquidCacheReloadTTL", "{minimum_reload_interval} ({minutes})", $SquidCacheReloadTTL, array("TOOLTIP" => "{SquidCacheReloadTTL_explain}"));
    $boot->set_field("REBOOT_INTERVAL", "{minimum_reboot_interval} ({minutes})", $MonitConfig["REBOOT_INTERVAL"], array("TOOLTIP" => "{minimum_reboot_interval_explain}"));
    $boot->set_field("MAX_RESTART", "{SQUID_MAX_RESTART}", $MonitConfig["MAX_RESTART"], array("TOOLTIP" => "{SQUID_MAX_RESTART_EXPLAIN}"));
    $boot->set_field("MgrInfosMaxTimeOut", "{tests_timeout}  ({seconds})", $MonitConfig["MgrInfosMaxTimeOut"]);
    $boot->set_spacertitle("{performance}");
    $boot->set_field("watchdogCPU", "{notify_when_cpu_exceed} %", $MonitConfig["watchdogCPU"]);
    $boot->set_field("watchdogMEM", "{notify_when_memory_exceed} (MB)", $MonitConfig["watchdogMEM"]);
    $boot->set_field("MaxSwapPourc", "{MaxSwapPourc}  (%)", $MonitConfig["MaxSwapPourc"], array("TOOLTIP" => "{MaxSwapPourc_explain}"));
    $boot->set_field("MaxLoad", "{max_system_load}", $MonitConfig["MaxLoad"], array("TOOLTIP" => "{max_system_load_squid_explain}"));
    $boot->set_field("MinFreeMem", "{MinFreeMem} MB", $MonitConfig["MinFreeMem"], array("TOOLTIP" => "{MinFreeMem_squid_explain}"));
    $boot->set_checkbox("MaxLoadFailOver", "{max_system_load_failover}", $MonitConfig["MaxLoadFailOver"], array("TOOLTIP" => "{max_system_load_failover_explain}"));
    $boot->set_checkbox("MaxLoadReboot", "{max_system_load_reboot}", $MonitConfig["MaxLoadReboot"], array("TOOLTIP" => "{max_system_load_reboot_explain}"));
    $boot->set_checkbox("RestartWhenCrashes", "{RestartWhenCrashes}", $MonitConfig["RestartWhenCrashes"], array("TOOLTIP" => "{RestartWhenCrashes_explain}"));
    $boot->set_spacertitle("SWAP");
    $boot->set_checkbox("SWAP_MONITOR", "{enable}", $MonitConfig["SWAP_MONITOR"], array("TOOLTIP" => "{SWAP_MONITOR_EXPLAIN}"));
    $boot->set_field("SWAP_MIN", "{SWAP_MIN} %", $MonitConfig["SWAP_MIN"], array("TOOLTIP" => "{SWAP_MIN_EXPLAIN}"));
    $boot->set_field("SWAP_MAX", "{SWAP_MAX} %", $MonitConfig["SWAP_MAX"], array("TOOLTIP" => "{SWAP_MAX_EXPLAIN}"));
    $boot->set_spacertitle("PING");
    $boot->set_checkbox("ENABLE_PING_GATEWAY", "{enable}", $MonitConfig["ENABLE_PING_GATEWAY"], array("TOOLTIP" => "{ENABLE_PING_GATEWAY_EXPLAIN}"));
    $boot->set_field("MAX_PING_GATEWAY", "{MAX_PING_GATEWAY}", $MonitConfig["MAX_PING_GATEWAY"], array("TOOLTIP" => "{MAX_PING_GATEWAY_EXPLAIN}"));
    $boot->set_field("PING_GATEWAY", "{ipaddr}", $MonitConfig["PING_GATEWAY"], array("IPV4" => true));
    $boot->set_checkbox("PING_FAILED_RELOAD_NET", "{reload_network}", $MonitConfig["PING_FAILED_RELOAD_NET"], array("TOOLTIP" => "{PING_FAILED_RELOAD_NET_EXPLAIN}"));
    $boot->set_checkbox("PING_FAILED_REPORT", "{send_report}", $MonitConfig["PING_FAILED_REPORT"], array("TOOLTIP" => "{PING_FAILED_REPORT_EXPLAIN}"));
    $boot->set_checkbox("PING_FAILED_FAILOVER", "{switch_to_failover}", $MonitConfig["PING_FAILED_FAILOVER"], array("TOOLTIP" => "{PING_FAILED_FAILOVER_EXPLAIN}"));
    $boot->set_checkbox("PING_FAILED_REBOOT", "{reboot_system}", $MonitConfig["PING_FAILED_REBOOT"], array("TOOLTIP" => "{reboot_system_explain}"));
    $boot->set_spacertitle("DNS");
    $boot->set_checkbox("NotifyDNSIssues", "{NotifyDNSIssues}", $MonitConfig["NotifyDNSIssues"], array("TOOLTIP" => "{NotifyDNSIssues_explain}"));
    $boot->set_field("DNSIssuesMAX", "{DNSIssuesMAX}", $MonitConfig["DNSIssuesMAX"]);
    $boot->set_spacertitle("{external_page}");
    $boot->set_checkbox("TestExternalWebPage", "{TestExternalWebPage}", $MonitConfig["TestExternalWebPage"], array("TOOLTIP" => "{squid_TestExternalWebPage_explain}"));
    $boot->set_field("ExternalPageToCheck", "{page_to_check}", $MonitConfig["ExternalPageToCheck"], array("TOOLTIP" => "{ExternalPageToCheck_explain}"));
    $boot->set_field("ExternalPageUsername", "{username}", $MonitConfig["ExternalPageUsername"], array("TOOLTIP" => "{ExternalPageUsername_EXPLAIN}"));
    $boot->set_fieldpassword("ExternalPagePassword", "{password}", $MonitConfig["ExternalPagePassword"], array("TOOLTIP" => "{ExternalPageUsername_EXPLAIN}", "ENCODE" => TRUE));
    $boot->set_list("ExternalPageListen", "{addr}", $ALL_IPS_GET_ARRAY, $MonitConfig["ExternalPageListen"], array("TOOLTIP" => "{ExternalPageListen_explain}"));
    $boot->set_spacertitle("{smtp_notifications}");
    $boot->set_checkbox("ENABLED_SQUID_WATCHDOG", "{smtp_enabled}", $UfdbguardSMTPNotifs["ENABLED_SQUID_WATCHDOG"]);
    $boot->set_field("smtp_server_name", "{smtp_server_name}", $UfdbguardSMTPNotifs["smtp_server_name"]);
    $boot->set_field("smtp_server_port", "{smtp_server_port}", $UfdbguardSMTPNotifs["smtp_server_port"]);
    $boot->set_field("smtp_sender", "{smtp_sender}", $UfdbguardSMTPNotifs["smtp_sender"]);
    $boot->set_field("smtp_dest", "{smtp_dest}", $UfdbguardSMTPNotifs["smtp_dest"]);
    $boot->set_field("smtp_auth_user", "{smtp_auth_user}", $UfdbguardSMTPNotifs["smtp_auth_user"]);
    $boot->set_fieldpassword("smtp_auth_passwd", "{smtp_auth_passwd}", $UfdbguardSMTPNotifs["smtp_auth_passwd"], array("ENCODE" => true));
    $boot->set_checkbox("tls_enabled", "{tls_enabled}", $UfdbguardSMTPNotifs["tls_enabled"]);
    echo $boot->Compile();
}
Exemplo n.º 7
0
function daemon_settings()
{
    $t = time();
    $sock = new sockets();
    $ci = new cicap();
    $page = CurrentPageName();
    $CicapEnabled = $sock->GET_INFO("CicapEnabled");
    $EnableClamavInCiCap2 = $sock->GET_INFO("EnableClamavInCiCap2");
    if (!is_numeric($CicapEnabled)) {
        $CicapEnabled = 0;
    }
    $notifyVirHTTPServer = false;
    if ($ci->main_array["CONF"]["ViralatorMode"] == 1) {
        if (preg_match('#https://(.*?)/exec#', $ci->main_array["CONF"]["VirHTTPServer"], $re)) {
            if (trim($re[1]) == null) {
                $notifyVirHTTPServer = true;
            }
            if (trim($re[1]) == "127.0.0.1") {
                $notifyVirHTTPServer = true;
            }
            if (trim($re[1]) == "localhost") {
                $notifyVirHTTPServer = true;
            }
        }
    }
    if ($notifyVirHTTPServer == true) {
        $color = "color:red;font-weight:bolder";
    }
    for ($i = 1; $i < 13; $i++) {
        $f[$i] = $i;
    }
    $boot = new boostrap_form();
    $boot->set_spacertitle("{daemon_settings}");
    $boot->set_checkbox("CicapEnabled", "{enable}", $CicapEnabled, array("DISABLEALL" => true));
    //set_field($field_name,$caption,$value,$params=array()){
    $boot->set_field("Timeout", "{Timeout} ({seconds})", $ci->main_array["CONF"]["Timeout"], array("TOOLTIP" => "{Timeout_text}"));
    $boot->set_field("MaxKeepAliveRequests", "{MaxKeepAliveRequests}", $ci->main_array["CONF"]["Timeout"], array("TOOLTIP" => "{Timeout_text}"));
    $boot->set_field("KeepAliveTimeout", "{KeepAliveTimeout}", $ci->main_array["CONF"]["KeepAliveTimeout"], array("TOOLTIP" => "{KeepAliveTimeout_text}"));
    $boot->set_field("MaxServers", "{MaxServers}", $ci->main_array["CONF"]["MaxServers"], array("TOOLTIP" => "{MaxServers_text}"));
    $boot->set_field("MaxServers", "{MinSpareThreads}", $ci->main_array["CONF"]["MinSpareThreads"], array("TOOLTIP" => "{MinSpareThreads_text}"));
    $boot->set_field("MaxSpareThreads", "{MaxSpareThreads}", $ci->main_array["CONF"]["MaxSpareThreads"], array("TOOLTIP" => "{MaxSpareThreads_text}"));
    $boot->set_field("ThreadsPerChild", "{ThreadsPerChild}", $ci->main_array["CONF"]["ThreadsPerChild"], array("TOOLTIP" => "{ThreadsPerChild_text}"));
    $boot->set_field("MaxRequestsPerChild", "{MaxRequestsPerChild}", $ci->main_array["CONF"]["MaxRequestsPerChild"], array("TOOLTIP" => "{MaxRequestsPerChild_text}"));
    $boot->set_list("DebugLevel", "{debug_mode}", $f, $ci->main_array["CONF"]["DebugLevel"], array("TOOLTIP" => "{MaxRequestsPerChild_text}"));
    $boot->set_checkbox("ViralatorMode", "{ViralatorMode}", $ci->main_array["CONF"]["ViralatorMode"], array("TOOLTIP" => "{ViralatorMode_text}"));
    $boot->set_field("VirSaveDir", "{VirSaveDir}", $ci->main_array["CONF"]["VirSaveDir"], array("TOOLTIP" => "{VirSaveDir_text}"));
    $boot->set_field("VirHTTPServer", "{VirHTTPServer}", $ci->main_array["CONF"]["VirHTTPServer"], array("TOOLTIP" => "{VirHTTPServer_text}"));
    $boot->set_spacertitle("{cicap_title}");
    $boot->set_field("srv_clamav.SendPercentData", "{srv_clamav.SendPercentData} (MB)", $ci->main_array["CONF"]["srv_clamav.SendPercentData"], array("TOOLTIP" => "{srv_clamav.SendPercentData_text}"));
    $boot->set_field("srv_clamav.StartSendPercentDataAfter", "{srv_clamav.StartSendPercentDataAfter} (MB)", $ci->main_array["CONF"]["srv_clamav.StartSendPercentDataAfter"], array("TOOLTIP" => "{srv_clamav.StartSendPercentDataAfter_text}"));
    $boot->set_field("srv_clamav.MaxObjectSize", "{srv_clamav.MaxObjectSize} (MB)", $ci->main_array["CONF"]["srv_clamav.MaxObjectSize"], array("TOOLTIP" => "{srv_clamav.MaxObjectSize_text}"));
    $boot->set_field("srv_clamav.ClamAvMaxFilesInArchive", "{srv_clamav.ClamAvMaxFilesInArchive} {files}", $ci->main_array["CONF"]["srv_clamav.ClamAvMaxFilesInArchive"], array("TOOLTIP" => "{srv_clamav.ClamAvMaxFilesInArchive}"));
    $boot->set_field("srv_clamav.ClamAvMaxFileSizeInArchive", "{srv_clamav.ClamAvMaxFileSizeInArchive} (MB)", $ci->main_array["CONF"]["srv_clamav.ClamAvMaxFileSizeInArchive"], array("TOOLTIP" => "{srv_clamav.ClamAvMaxFileSizeInArchive}"));
    $boot->set_field("srv_clamav.ClamAvMaxRecLevel", "{srv_clamav.ClamAvMaxRecLevel} (MB)", $ci->main_array["CONF"]["srv_clamav.ClamAvMaxRecLevel"], array("TOOLTIP" => "{srv_clamav.ClamAvMaxRecLevel}"));
    $boot->set_formtitle("Antivirus");
    $boot->set_button("{apply}");
    $form = $boot->Compile();
    $html = "<table style=width:100%'>\n\t<tr>\n\t\t<td style='vertical-align:top;width:300px'>\n\t\t\t<div id='status-{$t}'></div>\n\t\t\t\n\t\t\t<div style='margin:10px;text-align:right'>" . imgtootltip("refresh-32.png", "{refresh}", "LoadAjax('status-{$t}','{$page}?status=yes')") . "</div>\n\t\t\t\n\t\t<td style='vertical-align:top;padding-left:10px'>{$form}</td>\n\t</tr>\n\t</table>\t\n\t<script>\n\t\tLoadAjax('status-{$t}','{$page}?status=yes')\n\t</script>\n\t\t";
    echo $html;
}
function policy3()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $boot = new boostrap_form();
    $t = time();
    $q = new amavisdb();
    $users = new usersMenus();
    $policy_id = $_GET["policy-id"];
    $btname = "{apply}";
    $sql = "SELECT * FROM policy WHERE id='{$policy_id}'";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
    if (!$q->ok) {
        $error = "<p class='text-error'>{$q->mysql_error}.</p>";
    }
    $boot->set_hidden("policy_id", $policy_id);
    $boot->set_spacertitle("{warnrecip}");
    $boot->set_checkboxYN("warnvirusrecip", "{warnvirusrecip}", $ligne["warnvirusrecip"]);
    $boot->set_checkboxYN("warnbannedrecip", "{warnbannedrecip}", $ligne["warnbannedrecip"]);
    $boot->set_checkboxYN("warnbadhrecip", "{warnbadhrecip}", $ligne["warnbadhrecip"]);
    $boot->set_spacertitle("{sendreportto}");
    $boot->set_field("newvirus_admin", "{virus_detected}", $ligne["newvirus_admin"]);
    $boot->set_field("banned_admin", "{banned_files}", $ligne["banned_admin"]);
    $boot->set_field("bad_header_admin", "{bad_headers}", $ligne["bad_header_admin"]);
    $boot->set_field("spam_admin", "{spam_messages}", $ligne["spam_admin"]);
    $boot->set_spacertitle("{subjects_tags}");
    $boot->set_field("spam_subject_tag", "{non_spam_messages}", $ligne["spam_subject_tag"]);
    $boot->set_field("spam_subject_tag2", "{spam_messages}", $ligne["spam_subject_tag2"]);
    $boot->set_field("spam_subject_tag3", "{blatant_spam}", $ligne["spam_subject_tag3"]);
    $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();
}
Exemplo n.º 10
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 parameters()
{
    $sock = new sockets();
    $EnableChilli = $sock->GET_INFO("EnableChilli");
    if (!is_numeric($EnableChilli)) {
        $EnableChilli = 0;
    }
    $NICS = unserialize(base64_decode($sock->getFrameWork("cmd.php?list-nics=yes")));
    if (count($NICS) == 1) {
        $tpl = new templates();
        $COOVA_ERROR_NO_2_INTERFACES = $tpl->_ENGINE_parse_body("{COOVA_ERROR_NO_2_INTERFACES}");
        echo "<p class=text-error>{$COOVA_ERROR_NO_2_INTERFACES}</p>";
        return;
    }
    $ChilliConf = unserialize(base64_decode($sock->GET_INFO("ChilliConf")));
    $ip = new networking();
    $Interfaces = $ip->Local_interfaces();
    $Interfaces[null] = "{none}";
    unset($Interfaces["lo"]);
    if (!isset($ChilliConf["HS_WANIF"])) {
        $ChilliConf["HS_WANIF"] = null;
    }
    if (!isset($ChilliConf["HS_LANIF"])) {
        $arrayTCP = unserialize(base64_decode($sock->getFrameWork("cmd.php?TCP_NICS_STATUS_ARRAY=yes")));
        $ALLARRAY = $arrayTCP["eth0"];
        $PR = explode(".", $ALLARRAY["IPADDR"]);
        $ChilliConf["HS_NETWORK"] = "{$PR[0]}.{$PR[2]}.{$PR[3]}.0";
        $ChilliConf["HS_DYNIP"] = "{$PR[0]}.{$PR[2]}.{$PR[3]}.50";
        $ChilliConf["HS_DYNIP_MASK"] = $ALLARRAY["NETMASK"];
        $ChilliConf["HS_UAMLISTEN"] = $ALLARRAY["IPADDR"];
        $ChilliConf["HS_NETMASK"] = $ALLARRAY["NETMASK"];
        $ChilliConf["HS_LANIF"] = "eth0";
        $ChilliConf["HS_DYNIP_START"] = 50;
    }
    $boot = new boostrap_form();
    $boot->set_spacertitle("{service_parameters}");
    $boot->set_checkbox("EnableChilli", "{enable}", $EnableChilli, array("DISABLEALL" => true));
    $boot->set_checkbox("HS_DEBUG", "{debug}", $ChilliConf["HS_DEBUG"]);
    if (!isset($ChilliConf["HS_DNS_DOMAIN"])) {
        $ChilliConf["HS_DNS_DOMAIN"] = "hotspot.domain.tld";
    }
    if (!isset($ChilliConf["HS_PROVIDER"])) {
        $ChilliConf["HS_PROVIDER"] = "Artica";
    }
    if (!isset($ChilliConf["HS_PROVIDER_LINK"])) {
        $ChilliConf["HS_PROVIDER_LINK"] = "http://www.articatech.net";
    }
    if (!isset($ChilliConf["HS_LOC_NAME"])) {
        $ChilliConf["HS_LOC_NAME"] = "Artica HotSpot";
    }
    if ($ChilliConf["HS_LOC_NETWORK"] == null) {
        $ChilliConf["HS_LOC_NETWORK"] = "HotSpot Network";
    }
    if (!isset($ChilliConf["HS_DNS1"])) {
        $ChilliConf["HS_DNS1"] = null;
    }
    if (!isset($ChilliConf["HS_DNS2"])) {
        $ChilliConf["HS_DNS2"] = null;
    }
    if (!isset($ChilliConf["SQUID_HTTP_PORT"])) {
        $ChilliConf["SQUID_HTTP_PORT"] = rand(45000, 65400);
    }
    if (!is_numeric($ChilliConf["SQUID_HTTP_PORT"])) {
        $ChilliConf["SQUID_HTTP_PORT"] = rand(45000, 65400);
    }
    if (!isset($ChilliConf["SQUID_HTTPS_PORT"])) {
        $ChilliConf["SQUID_HTTPS_PORT"] = rand(45000, 65400);
    }
    if (!is_numeric($ChilliConf["SQUID_HTTPS_PORT"])) {
        $ChilliConf["SQUID_HTTPS_PORT"] = rand(45000, 65400);
    }
    if (!is_numeric($ChilliConf["ENABLE_DHCP_RELAY"])) {
        $ChilliConf["ENABLE_DHCP_RELAY"] = 0;
    }
    if ($ChilliConf["HS_DNS1"] == null) {
        $ChilliConf["HS_DNS1"] = "8.8.8.8";
    }
    if ($ChilliConf["HS_DNS2"] == null) {
        $ChilliConf["HS_DNS2"] = "8.8.4.4";
    }
    $boot->set_spacertitle("{hotspot_network}");
    $boot->set_list("HS_LANIF", "{HS_LANIF}", $Interfaces, $ChilliConf["HS_LANIF"]);
    $boot->set_field("HS_UAMLISTEN", "{ipaddr}", $ChilliConf["HS_UAMLISTEN"]);
    $boot->set_field("HS_NETMASK", "{mask}", $ChilliConf["HS_NETMASK"]);
    $boot->set_field("HS_DNS1", "DNS 1", $ChilliConf["HS_DNS1"]);
    $boot->set_field("HS_DNS2", "DNS 2", $ChilliConf["HS_DNS2"]);
    $boot->set_checkbox("HS_LAN_ACCESS", "{HS_LAN_ACCESS}", $ChilliConf["HS_LAN_ACCESS"]);
    $boot->set_subtitle("{dhcp_parameters}");
    $boot->set_field("HS_DYNIP_START", "{dhcp_start_ip}", $ChilliConf["HS_DYNIP_START"]);
    $boot->set_field("HS_DNS_DOMAIN", "{domain}", $ChilliConf["HS_DNS_DOMAIN"]);
    $boot->set_checkbox("ENABLE_DHCP_RELAY", "{use_remote_dhcp_server}", $ChilliConf["ENABLE_DHCP_RELAY"], array("LINK" => "DHCP_IF,HS_DHCPGATEWAY", "TOOLTIP" => "{coova_ssl_splash_explain}"));
    $boot->set_field("HS_DHCPGATEWAY", "{dhcp_server_ip}", $ChilliConf["HS_DHCPGATEWAY"]);
    $boot->set_list("DHCP_IF", "{nic}", $Interfaces, $ChilliConf["DHCP_IF"]);
    $boot->set_spacertitle("{internet_network}");
    $boot->set_list("HS_WANIF", "{HS_WANIF}", $Interfaces, $ChilliConf["HS_WANIF"]);
    $boot->set_spacertitle("{proxy_parameters}");
    $boot->set_field("SQUID_HTTP_PORT", "{proxy_http_port} (local)", $ChilliConf["SQUID_HTTP_PORT"], array("TOOLTIP" => "{coova_proxy_port}"));
    $boot->set_field("SQUID_HTTPS_PORT", "{proxy_https_port} (local)", $ChilliConf["SQUID_HTTPS_PORT"], array("TOOLTIP" => "{coova_proxy_sslport}"));
    $boot->set_checkbox("CoovaUFDBEnabled", "{webfiltering}", $ChilliConf["CoovaUFDBEnabled"], array("TOOLTIP" => "{coova_CoovaUFDBEnabled_explain}"));
    $q = new mysql();
    $sql = "SELECT servername FROM freeweb WHERE groupware='CHILLI'";
    $results = $q->QUERY_SQL($sql, 'artica_backup');
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        $FREEWEBS[$ligne["servername"]] = $ligne["servername"];
    }
    $boot->set_spacertitle("{design}");
    $q = new mysql();
    $sslcertificates[null] = "{default}";
    $results = $q->QUERY_SQL("SELECT * FROM sslcertificates", 'artica_backup');
    while ($ligneZ = mysql_fetch_array($results, MYSQL_ASSOC)) {
        $sslcertificates[$ligneZ["CommonName"]] = $ligneZ["CommonName"];
    }
    $boot->set_checkbox("EnableSSLRedirection", "{UseSSL}", $ChilliConf["EnableSSLRedirection"], array("LINK" => "certificate_center", "TOOLTIP" => "{coova_ssl_splash_explain}"));
    $boot->set_list("certificate_center", "{default_certificate}", $sslcertificates, $ChilliConf["certificate_center"]);
    $boot->set_list("HS_UAMFREEWEB", "FreeWeb", $FREEWEBS, $ChilliConf["HS_UAMFREEWEB"]);
    $boot->set_field("HS_PROVIDER", "{company}", $ChilliConf["HS_PROVIDER"]);
    $boot->set_field("HS_PROVIDER_LINK", "{website}", $ChilliConf["HS_PROVIDER_LINK"]);
    $boot->set_field("HS_LOC_NAME", "{servicename}", $ChilliConf["HS_LOC_NAME"]);
    $boot->set_field("HS_LOC_NETWORK", "{network_name}", $ChilliConf["HS_LOC_NETWORK"]);
    $page = CurrentPageName();
    $boot->set_AjaxFinal("LoadAjax('chilli-status','{$page}?srv-status=yes');");
    $boot->set_formtitle("HotSpot");
    $form = $boot->Compile();
    $html = "\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top' style='vertical-align:top;width:30%'><div id='chilli-status'></div>\n\t\t\n\t\t<div style='width:100%;text-align:right'>" . imgtootltip("refresh-32.png", null, "LoadAjax('chilli-status','{$page}?srv-status=yes');") . "</div>\n\t\t</td>\n\t\t<td valign='top' style='vertical-align:top;padding-left:15px;width:70%'>{$form}</td>\n\t</tr>\n\t</table>\n\t<script>\n\t\tLoadAjax('chilli-status','{$page}?srv-status=yes');\t\t\n\t\t\t\n\t</script>";
    echo $html;
}
function settings()
{
    $page = CurrentPageName();
    $sock = new sockets();
    $MirrorEnableDebian = $sock->GET_INFO("MirrorEnableDebian");
    $MirrorDebianDirSizeText = null;
    $MirrorDebianBW = $sock->GET_INFO("MirrorDebianBW");
    if (!is_numeric($MirrorEnableDebian)) {
        $MirrorEnableDebian = 0;
    }
    if (!is_numeric($MirrorDebianBW)) {
        $MirrorDebianBW = 500;
    }
    $MirrorDebianDir = $sock->GET_INFO("MirrorDebianDir");
    if ($MirrorDebianDir == null) {
        $MirrorDebianDir = "/home/mirrors/Debian";
    }
    $MirrorDebianDirSize = $sock->GET_INFO("MirrorDebianDirSize");
    if (!is_numeric($MirrorDebianDirSize)) {
        $MirrorDebianDirSize = 0;
    }
    $MirrorDebianMaxExecTime = $sock->GET_INFO("MirrorDebianMaxExecTime");
    $MirrorDebianEachMn = $sock->GET_INFO("MirrorDebianEachMn");
    if (!is_numeric($MirrorDebianEachMn)) {
        $MirrorDebianEachMn = 2880;
    }
    $MirrorDebianExclude = unserialize(base64_decode($sock->GET_INFO("MirrorDebianExclude")));
    $MirrorDebianExcludeOS = unserialize(base64_decode($sock->GET_INFO("MirrorDebianExcludeOS")));
    if (!is_numeric($MirrorDebianMaxExecTime)) {
        $MirrorDebianMaxExecTime = 0;
    }
    $MirrorEnableDebianSchedule = $sock->GET_INFO("MirrorEnableDebianSchedule");
    if (!is_numeric($MirrorEnableDebianSchedule)) {
        $MirrorEnableDebianSchedule = 0;
    }
    $boot = new boostrap_form();
    $timeZ[60] = "1 {hour}";
    $timeZ[120] = "2 {hours}";
    $timeZ[300] = "5 {hours}";
    $timeZ[720] = "12 {hours}";
    $timeZ[1440] = "1 {day}";
    $timeZ[2880] = "2 {days}";
    $timeZ[10080] = "1 {week}";
    if ($MirrorDebianDirSize > 0) {
        $MirrorDebianDirSizeText = " (" . FormatBytes($MirrorDebianDirSize / 1024) . " )";
    }
    $boot->set_formdescription("{debian_mirror_howto}<br>{rsync_out_port_explain}");
    $boot->set_spacertitle("Debian{$MirrorDebianDirSizeText}");
    $boot->set_checkbox("MirrorEnableDebian", "{enable_debian_systems}", $MirrorEnableDebian);
    $boot->set_field("MirrorDebianDir", "{directory}{$MirrorDebianDirSizeText}", $MirrorDebianDir, array("ENCODE" => true));
    $boot->set_field("MirrorDebianBW", "{max_bandwidth} KB/s", $MirrorDebianBW);
    $boot->set_list("MirrorDebianEachMn", "{execute_each}", $timeZ, $MirrorDebianEachMn);
    $boot->set_checkbox("MirrorEnableDebianSchedule", "{use_schedule}", $MirrorEnableDebianSchedule, array("TOOLTIP" => "{MirrorEnableDebianSchedule_explain}"));
    $boot->set_field("MirrorDebianMaxExecTime", "{max_execution_time} ({minutes})", $MirrorDebianMaxExecTime, array("TOOLTIP" => "{MirrorDebianMaxExecTime_explain}"));
    //$boot->set_subtitle("{linux_distribution}");
    if (!is_array($MirrorDebianExcludeOS)) {
        $MirrorDebianExcludeOS["sid"] = true;
        $MirrorDebianExcludeOS["jessie"] = true;
        $MirrorDebianExcludeOS["wheezy"] = true;
        $MirrorDebianExcludeOS["oldstable"] = true;
        $MirrorDebianExcludeOS["stable"] = true;
        $MirrorDebianExcludeOS["oldstable"] = true;
        $MirrorDebianExcludeOS["unstable"] = true;
    }
    $DEBVERS[] = "sid";
    $DEBVERS[] = "testing";
    $DEBVERS[] = "jessie";
    $DEBVERS[] = "squeeze";
    $DEBVERS[] = "wheezy";
    $DEBVERS[] = "oldstable";
    $DEBVERS[] = "stable";
    $DEBVERS[] = "unstable";
    /*	while (list ($none, $pattern) = each ($DEBVERS) ){
    		$enabled=0;
    		if($MirrorDebianExclude["$pattern"]==1){$enabled=1;}
    		$boot->set_checkbox("debian-exclude-$pattern","{exclude}:&nbsp;&laquo;$pattern&raquo;",$enabled);
    	}	
    	
    */
    $boot->set_subtitle("{architecture}");
    $f = array();
    $f[] = "source";
    $f[] = "alpha";
    $f[] = "amd64";
    $f[] = "arm";
    $f[] = "armel";
    $f[] = "armhf";
    $f[] = "hppa";
    $f[] = "hurd-i386";
    $f[] = "i386";
    $f[] = "ia64";
    $f[] = "mips";
    $f[] = "mipsel";
    $f[] = "powerpc";
    $f[] = "s390";
    $f[] = "s390x";
    $f[] = "sparc";
    $f[] = "kfreebsd-i386";
    $f[] = "kfreebsd-amd64";
    if (!is_array($MirrorDebianExclude)) {
        while (list($none, $pattern) = each($f)) {
            if ($pattern == "i386") {
                continue;
            }
            if ($pattern == "amd64") {
                continue;
            }
            $MirrorDebianExclude[$pattern] = 1;
        }
        reset($f);
    }
    while (list($none, $pattern) = each($f)) {
        $enabled = 0;
        if ($MirrorDebianExclude["{$pattern}"] == 1) {
            $enabled = 1;
        }
        $boot->set_checkbox("debian-exclude-{$pattern}", "{exclude}:&nbsp;&laquo;{$pattern}&raquo;", $enabled);
    }
    $t = time();
    $boot->set_button("{apply}");
    $boot->set_Newbutton("{execute}", "Loadjs('{$page}?execute-debian-js=yes&t={$t}')");
    $form = $boot->Compile();
    $html = "<table style='width:100%'>\n\t<tr>\n\t\t<td style='vertical-align:top;width:350px'>\n\t\t\n\t\t<div id='{$t}'>\n\t\t\n\t\t</div>\n\t\t<div style='text-align:right'>" . imgtootltip("refresh-32.png", null, "LoadAjax('{$t}','{$page}?rsync-debian-status=yes')") . "</div>\n\t</td>\n\t<td style='vertical-align:top;padding-left:20px'>\t\t\n\t\t{$form}\n\t</td>\n\t</tr>\n\t</table>\n\t<script>\n\t\tLoadAjax('{$t}','{$page}?rsync-debian-status=yes');\n\t</script>\t\n\t";
    echo $html;
}
Exemplo n.º 13
0
function parameters()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $boot = new boostrap_form();
    $amavis = new amavis();
    $AmavisMemoryInRAM = $sock->GET_INFO("AmavisMemoryInRAM");
    if (!is_numeric($AmavisMemoryInRAM)) {
        $AmavisMemoryInRAM = 0;
    }
    $AmavisDebugSpamassassin = $sock->GET_INFO("AmavisDebugSpamassassin");
    if (!is_numeric($AmavisDebugSpamassassin)) {
        $AmavisDebugSpamassassin = 0;
    }
    $BuildNetworks = $amavis->BuildNetworks();
    $BuildNetworks = str_replace(" ", "\\n", $BuildNetworks);
    $trust_my_net = $tpl->javascript_parse_text("{trust_my_net}");
    $bt = "{apply}";
    for ($i = 0; $i < 6; $i++) {
        $hash[$i] = "{log_level} 0{$i}";
    }
    $array = array(null => "{select}", "D_PASS" => "{D_PASS}", "D_DISCARD" => '{D_DISCARD}', "D_BOUNCE" => '{D_BOUNCE}', "D_REJECT" => '{D_REJECT}');
    $boot->set_hidden("INI_SAVE", "BEHAVIORS");
    $boot->set_checkbox("AmavisDebugSpamassassin", "{sa_debug}", $AmavisDebugSpamassassin);
    $boot->set_list("log_level", "{log_level}", $hash, $amavis->main_array["BEHAVIORS"]["log_level"]);
    $boot->set_list("final_virus_destiny", "{final_virus_destiny}", $array, $amavis->main_array["BEHAVIORS"]["final_virus_destiny"]);
    $boot->set_list("final_banned_destiny", "{final_virus_destiny}", $array, $amavis->main_array["BEHAVIORS"]["final_banned_destiny"]);
    $boot->set_list("final_spam_destiny", "{final_spam_destiny}", $array, $amavis->main_array["BEHAVIORS"]["final_spam_destiny"]);
    $boot->set_list("final_bad_header_destiny", "{final_bad_header_destiny}", $array, $amavis->main_array["BEHAVIORS"]["final_bad_header_destiny"]);
    $boot->set_checkbox("always_clean", "{transfert_messages_if_av_failed}", $amavis->main_array["BEHAVIORS"]["always_clean"]);
    $boot->set_checkbox("trust_my_net", "{trust_my_net}", $amavis->main_array["BEHAVIORS"]["trust_my_net"]);
    $boot->set_checkbox("enable_db", "{amavis_enable_db}", $amavis->main_array["BEHAVIORS"]["enable_db"]);
    $boot->set_checkbox("enable_global_cache", "{amavis_enable_global_cache}", $amavis->main_array["BEHAVIORS"]["enable_global_cache"]);
    $boot->set_spacertitle("{performances}");
    $boot->set_field("AmavisMemoryInRAM", "{AmavisMemoryInRAM} (MB)", $AmavisMemoryInRAM);
    $boot->set_field("max_servers", "{max_servers}", $amavis->main_array["BEHAVIORS"]["max_servers"]);
    $boot->set_field("max_requests", "{max_requests}", $amavis->main_array["BEHAVIORS"]["max_requests"]);
    $boot->set_field("child_timeout", "{child_timeout}", $amavis->main_array["BEHAVIORS"]["child_timeout"]);
    echo $boot->Compile();
}
Exemplo n.º 14
0
function settings()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $sock = new sockets();
    $t = time();
    $MailArchiverEnabled = $sock->GET_INFO("MailArchiverEnabled");
    $MailArchiverToMySQL = $sock->GET_INFO("MailArchiverToMySQL");
    $MailArchiverToMailBox = $sock->GET_INFO("MailArchiverToMailBox");
    $MailArchiverMailBox = $sock->GET_INFO("MailArchiverMailBox");
    $MailArchiverUsePerl = $sock->GET_INFO("MailArchiverUsePerl");
    $MailArchiverToSMTP = $sock->GET_INFO("MailArchiverToSMTP");
    $MailArchiverSMTP = $sock->GET_INFO("MailArchiverSMTP");
    $MailArchiverSMTPINcoming = $sock->GET_INFO("MailArchiverSMTPINcoming");
    $MailArchiverToMySQLMaxDays = $sock->GET_INFO("MailArchiverToMySQLMaxDays");
    $MailArchiverToMySQLBackupPath = $sock->GET_INFO("MailArchiverToMySQLBackupPath");
    if (!is_numeric($MailArchiverToMySQLMaxDays)) {
        $MailArchiverToMySQLMaxDays = 60;
    }
    if ($MailArchiverToMySQLBackupPath == null) {
        $MailArchiverToMySQLBackupPath = "/home/artica/backup/mailsarchives";
    }
    if (!is_numeric($MailArchiverEnabled)) {
        $MailArchiverEnabled = 0;
    }
    if (!is_numeric($MailArchiverToMySQL)) {
        $MailArchiverToMySQL = 1;
    }
    if (!is_numeric($MailArchiverUsePerl)) {
        $MailArchiverUsePerl = 0;
    }
    if (!is_numeric($MailArchiverToSMTP)) {
        $MailArchiverToSMTP = 0;
    }
    if (!is_numeric($MailArchiverSMTPINcoming)) {
        $MailArchiverSMTPINcoming = 1;
    }
    $boot = new boostrap_form();
    $boot->set_checkbox("MailArchiverEnabled", "{enable_APP_MAILARCHIVER}", $MailArchiverEnabled, array("ONDISABLE" => "{enable_APP_MAILARCHIVER_disable_text}"));
    $boot->set_checkbox("MailArchiverUsePerl", "{us_v2}", $MailArchiverUsePerl, array("ONDISABLE" => "{MailArchiverUsePerl_disable_text}"));
    $boot->set_checkbox("MailArchiverToMySQL", "{save_to_mysqldb}", $MailArchiverToMySQL);
    $boot->set_checkbox("MailArchiverToMailBox", "{send_to_mailbox}", $MailArchiverToMailBox, array("LINK" => "MailArchiverMailBox"));
    $boot->set_field("MailArchiverMailBox", "{mailbox}", $MailArchiverMailBox);
    $boot->set_checkbox("MailArchiverToSMTP", "{send_to_smtp_server}", $MailArchiverToSMTP, array("LINK" => "MailArchiverSMTP"));
    $boot->set_field("MailArchiverSMTP", "{smtp_server}", $MailArchiverSMTP);
    $boot->set_spacertitle("{retention_time}");
    $boot->set_field("MailArchiverToMySQLMaxDays", "{max_days}", $MailArchiverToMySQLMaxDays);
    $boot->set_field("MailArchiverToMySQLBackupPath", "{backup_directory}", $MailArchiverToMySQLBackupPath, array("BROWSE" => true));
    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;
}
Exemplo n.º 16
0
function parameters_backup()
{
    $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();
    $boot = new boostrap_form();
    $EnableSargGenerator = $sock->GET_INFO("EnableSargGenerator");
    if (!is_numeric($EnableSargGenerator)) {
        $EnableSargGenerator = 0;
    }
    $boot->set_formdescription("{sarg_backup_nfs_explain}");
    $BackupSargUseNas = $sock->GET_INFO("BackupSargUseNas");
    $BackupSargNASIpaddr = $sock->GET_INFO("BackupSargNASIpaddr");
    $BackupSargNASFolder = $sock->GET_INFO("BackupSargNASFolder");
    $BackupSargNASUser = $sock->GET_INFO("BackupSargNASUser");
    $BackupSargNASPassword = $sock->GET_INFO("BackupSargNASPassword");
    if (!is_numeric($BackupSargUseNas)) {
        $BackupSargUseNas = 0;
    }
    $boot->set_spacertitle("{NAS_storage}");
    $boot->set_checkbox("BackupSargUseNas", "{use_remote_nas}", $BackupSargUseNas, array("DISABLEALL" => true));
    $boot->set_field("BackupSargNASIpaddr", "{hostname}", $BackupSargNASIpaddr);
    $boot->set_field("BackupSargNASFolder", "{shared_folder}", $BackupSargNASFolder, array("ENCODE" => true));
    $boot->set_field("BackupSargNASUser", "{username}", $BackupSargNASUser, array("ENCODE" => true));
    $boot->set_fieldpassword("BackupSargNASPassword", "{password}", $BackupSargNASPassword, array("ENCODE" => true));
    $boot->set_button("{apply}");
    if (!$users->AsWebStatisticsAdministrator) {
        $boot->set_form_locked();
    }
    if ($EnableSargGenerator == 0) {
        $boot->set_form_locked();
    }
    echo $boot->Compile();
}