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 websites_popup_webserver_auth_form_ldap() { $tpl = new templates(); $page = CurrentPageName(); $servername = $_GET["servername"]; $rv = new squid_reverse(); $q = new mysql_squid_builder(); $ldap = new clladp(); if (!$q->FIELD_EXISTS("reverse_www", "webauth")) { $q->QUERY_SQL("ALTER TABLE `reverse_www` ADD webauth TEXT"); } $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT `webauth` FROM reverse_www WHERE servername='{$servername}'")); $array = unserialize(base64_decode($ligne["webauth"])); if (!is_numeric($array["LDAP_PORT"])) { $array["LDAP_PORT"] = $ldap->ldap_port; } if (!isset($array["LDAP_DN"])) { $array["LDAP_DN"] = "cn={$ldap->ldap_admin},{$ldap->suffix}"; } if (!isset($array["LDAP_SUFFIX"])) { $array["LDAP_SUFFIX"] = "{$ldap->suffix}"; } if (!isset($array["LDAP_PASSWORD"])) { $array["LDAP_PASSWORD"] = "******"; } if ($array["LDAP_SERVER"] == null) { $array["LDAP_SERVER"] = $ldap->ldap_host; } if ($array["LDAP_GROUP_ATTR"] == null) { $array["LDAP_GROUP_ATTR"] = "member"; } if ($array["LDAP_USER_ATTR"] == null) { $array["LDAP_USER_ATTR"] = "uid"; } if ($array["LDAP_OBJCLASS_ATTR"] == null) { $array["LDAP_OBJCLASS_ATTR"] = "userAccount"; } if (!is_numeric($array["LDAP_REQUIRE_VALID"])) { $array["LDAP_REQUIRE_VALID"] = 1; } if (!is_numeric($array["LDAP_GROUP_ATTR_ISDN"])) { $array["LDAP_GROUP_ATTR_ISDN"] = 0; } if ($array["LDAP_BANNER"] == null) { $array["LDAP_BANNER"] = "Please login"; } $boot = new boostrap_form(); $boot->set_formtitle("{ldap_authentication}"); $boot->set_hidden("www-server", $servername); $boot->set_checkbox("ENABLE_LDAP_AUTH", "{enable}", $array["ENABLE_LDAP_AUTH"], array("DISABLEALL" => true)); $boot->set_field("LDAP_SERVER", "{ldap_server}", $array["LDAP_SERVER"]); $boot->set_field("LDAP_PORT", "{ldap_port}", $array["LDAP_PORT"]); $boot->set_field("LDAP_SUFFIX", "{ldap_suffix}", $array["LDAP_SUFFIX"]); $boot->set_field("LDAP_DN", "{bind_dn}", $array["LDAP_DN"], array("ENCODE" => true)); $boot->set_fieldpassword("LDAP_PASSWORD", "{password}", $array["LDAP_PASSWORD"], array("ENCODE" => true)); $boot->set_field("LDAP_GROUP_ATTR", "{ldap_group_attribute}", $array["LDAP_GROUP_ATTR"]); $boot->set_field("LDAP_GROUP_ATTR_ISDN", "{ldap_group_attribute}", $array["LDAP_GROUP_ATTR_ISDN"]); $boot->set_checkbox("LDAP_GROUP_ATTR_ISDN", "{LDAP_GROUP_ATTR_ISDN}", $array["LDAP_GROUP_ATTR_ISDN"], array("TOOLTIP" => "{LDAP_GROUP_ATTR_ISDN_EXPLAIN}")); $boot->set_field("LDAP_USER_ATTR", "{ldap_user_attribute}", $array["LDAP_USER_ATTR"]); $boot->set_field("LDAP_OBJCLASS_ATTR", "{ldap_objectclass}", $array["LDAP_OBJCLASS_ATTR"]); $boot->set_field("LDAP_BANNER", "{banner}", $array["LDAP_BANNER"], array("ENCODE" => true)); $boot->set_checkbox("LDAP_REQUIRE_VALID", "{LDAP_REQUIRE_VALID}", $array["LDAP_REQUIRE_VALID"], array("TOOLTIP" => "{LDAP_REQUIRE_VALID_EXPLAIN}")); $boot->set_button("{apply}"); 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(); }
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> | \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 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(); }
function mysqlparams() { $tpl = new templates(); $page = CurrentPageName(); $q = new mysql_squid_builder(); $users = new usersMenus(); $sock = new sockets(); $boot = new boostrap_form(); $sock = new sockets(); $TuningParameters = unserialize(base64_decode($sock->GET_INFO("MySQLSyslogParams"))); $username = $TuningParameters["username"]; $password = $TuningParameters["password"]; $mysqlserver = $TuningParameters["mysqlserver"]; $ListenPort = $TuningParameters["RemotePort"]; $boot->set_field("mysqlserver", "{mysqlserver}", $mysqlserver); $boot->set_field("RemotePort", "{remote_port}", $ListenPort); $boot->set_field("username", "{username}", $username); $boot->set_fieldpassword("password", "{password}", $password); $boot->set_button("{apply}"); $boot->set_formtitle("{mysql_parameters}"); echo $tpl->_ENGINE_parse_body(engine_params() . $boot->Compile()); }
function activedirectory() { $page = CurrentPageName(); $tpl = new templates(); echo "<p class=text-error>Under Construction</p>"; $page = CurrentPageName(); $tpl = new templates(); $users = new usersMenus(); $active = new ActiveDirectory(); $sock = new sockets(); $severtype["WIN_2003"] = "Windows 2003"; $severtype["WIN_2008AES"] = "Windows 2008 with AES"; $samba_version = $sock->getFrameWork("samba.php?fullversion=yes"); $ldap_parameters = $tpl->_ENGINE_parse_body("{ldap_parameters2}"); $about_this_section = $tpl->_ENGINE_parse_body("{about_this_section}"); $schedule_parameters = $tpl->javascript_parse_text("{schedule_parameters}"); $disconnect = $tpl->_ENGINE_parse_body("{disconnect}"); $samba36 = 0; if (preg_match("#^3\\.6\\.#", $samba_version)) { $samba36 = 1; } $array = unserialize(base64_decode($sock->GET_INFO("KerbAuthInfos"))); $configADSamba = unserialize(base64_decode($sock->GET_INFO("SambaAdInfos"))); $EnableKerbAuth = $sock->GET_INFO("EnableKerbAuth"); $EnableKerberosAuthentication = $sock->GET_INFO("EnableKerberosAuthentication"); $LockKerberosAuthentication = $sock->GET_INFO("LockKerberosAuthentication"); $KerbAuthDisableNsswitch = $sock->GET_INFO("KerbAuthDisableNsswitch"); $KerbAuthDisableGroupListing = $sock->GET_INFO("KerbAuthDisableGroupListing"); $KerbAuthDisableNormalizeName = $sock->GET_INFO("KerbAuthDisableNormalizeName"); $KerbAuthMapUntrustedDomain = $sock->GET_INFO("KerbAuthMapUntrustedDomain"); $KerbAuthMethod = $sock->GET_INFO("KerbAuthMethod"); $NtpdateAD = $sock->GET_INFO("NtpdateAD"); $arrayAuth[0] = "{all_methods}"; $arrayAuth[1] = "{only_ntlm}"; $arrayAuth[2] = "{only_basic_authentication}"; $NTPDATE_INSTALLED = 0; if ($users->NTPDATE) { $NTPDATE_INSTALLED = 1; } $KerbAuthTrusted = $sock->GET_INFO("KerbAuthTrusted"); $EnableWebProxyStatsAppliance = $sock->GET_INFO("EnableWebProxyStatsAppliance"); $EnableRemoteStatisticsAppliance = $sock->GET_INFO("EnableRemoteStatisticsAppliance"); if (!is_numeric($EnableWebProxyStatsAppliance)) { $EnableWebProxyStatsAppliance = 0; } if ($users->WEBSTATS_APPLIANCE) { $EnableWebProxyStatsAppliance = 1; } if (!is_numeric($KerbAuthMethod)) { $KerbAuthMethod = 0; } if (!is_numeric($KerbAuthTrusted)) { $KerbAuthTrusted = 1; } if (!is_numeric($KerbAuthDisableNsswitch)) { $KerbAuthDisableNsswitch = 0; } if (!is_numeric($KerbAuthDisableGroupListing)) { $KerbAuthDisableGroupListing = 0; } if (!is_numeric($KerbAuthDisableNormalizeName)) { $KerbAuthDisableNormalizeName = 1; } if (!is_numeric($KerbAuthMapUntrustedDomain)) { $KerbAuthMapUntrustedDomain = 1; } if (!is_numeric($NtpdateAD)) { $NtpdateAD = 0; } if (!is_numeric("{$EnableKerbAuth}")) { $EnableKerbAuth = 0; } if (!is_numeric("{$EnableKerberosAuthentication}")) { $EnableKerberosAuthentication = 0; } if (!is_numeric("{$LockKerberosAuthentication}")) { $LockKerberosAuthentication = 1; } if (!is_numeric($EnableRemoteStatisticsAppliance)) { $EnableRemoteStatisticsAppliance = 0; } $samba_installed = 1; if (!$users->SAMBA_INSTALLED) { $samba_installed = 0; } if (!isset($array["SAMBA_BACKEND"])) { $array["SAMBA_BACKEND"] = "tdb"; } if (!isset($array["COMPUTER_BRANCH"])) { $array["COMPUTER_BRANCH"] = "CN=Computers"; } if ($array["COMPUTER_BRANCH"] == null) { $array["COMPUTER_BRANCH"] = "CN=Computers"; } if ($samba36 == 1) { $arrayBCK["autorid"] = "autorid"; } $arrayBCK["ad"] = "ad"; $arrayBCK["rid"] = "rid"; $arrayBCK["tdb"] = "tdb"; if ($LockKerberosAuthentication == 1) { $EnableKerberosAuthentication = 0; } $char_alert_error = $tpl->javascript_parse_text("{char_alert_error}"); $UseDynamicGroupsAcls = $sock->GET_INFO("UseDynamicGroupsAcls"); if (!is_numeric($UseDynamicGroupsAcls)) { $UseDynamicGroupsAcls = 0; } $DynamicGroupsAclsTTL = $sock->GET_INFO("DynamicGroupsAclsTTL"); if (!is_numeric($UseDynamicGroupsAcls)) { $UseDynamicGroupsAcls = 0; } if (!is_numeric($DynamicGroupsAclsTTL)) { $DynamicGroupsAclsTTL = 3600; } if ($DynamicGroupsAclsTTL < 5) { $DynamicGroupsAclsTTL = 5; } $arrayLDAP = unserialize(base64_decode($sock->GET_INFO("KerbAuthInfos"))); $t = time(); if ($arrayLDAP["LDAP_DN"] == null) { $arrayLDAP["LDAP_DN"] = $active->ldap_dn_user; } if ($arrayLDAP["LDAP_SUFFIX"] == null) { $arrayLDAP["LDAP_SUFFIX"] = $active->suffix; } if ($arrayLDAP["LDAP_SERVER"] == null) { $arrayLDAP["LDAP_SERVER"] = $active->ldap_host; } if ($arrayLDAP["LDAP_PORT"] == null) { $arrayLDAP["LDAP_PORT"] = $active->ldap_port; } if ($arrayLDAP["LDAP_PASSWORD"] == null) { $arrayLDAP["LDAP_PASSWORD"] = $active->ldap_password; } if (!is_numeric($array["LDAP_RECURSIVE"])) { $arrayLDAP["LDAP_RECURSIVE"] = 0; } if (!is_numeric($array["LDAP_PORT"])) { $array["LDAP_PORT"] = 389; } $boot = new boostrap_form(); $boot->set_checkbox("EnableKerbAuth", "{EnableWindowsAuthentication}", $EnableKerbAuth, array("DISABLEALL" => true)); $boot->set_checkbox("KerbAuthDisableNsswitch", "{KerbAuthDisableNsswitch}", $KerbAuthDisableNsswitch); $boot->set_checkbox("KerbAuthTrusted", "{KerbAuthTrusted}", $KerbAuthTrusted); $boot->set_checkbox("KerbAuthDisableGroupListing", "{KerbAuthDisableGroupListing}", $KerbAuthDisableGroupListing); $boot->set_checkbox("KerbAuthDisableNormalizeName", "{KerbAuthDisableNormalizeName}", $KerbAuthDisableNormalizeName); $boot->set_checkbox("KerbAuthMapUntrustedDomain", "{map_untrusted_to_domain}", $KerbAuthMapUntrustedDomain); $boot->set_checkbox("NtpdateAD", "{synchronize_time_with_ad}", $NtpdateAD); //$boot->set_checkbox("EnableKerberosAuthentication", "{authenticate_from_kerberos}",$EnableKerberosAuthentication); $boot->set_field("WINDOWS_DNS_SUFFIX", "{WINDOWS_DNS_SUFFIX}", $array["WINDOWS_DNS_SUFFIX"]); $boot->set_field("WINDOWS_SERVER_NETBIOSNAME", "{WINDOWS_SERVER_NETBIOSNAME}", $array["WINDOWS_SERVER_NETBIOSNAME"]); $boot->set_field("ADNETBIOSDOMAIN", "{ADNETBIOSDOMAIN}", $array["ADNETBIOSDOMAIN"], array("TOOLTIP" => "{howto_ADNETBIOSDOMAIN}")); $boot->set_field("ADNETIPADDR", "{ADNETIPADDR}", $array["ADNETIPADDR"], array("TOOLTIP" => "{howto_ADNETIPADDR}")); $boot->set_field("LDAP_PORT", "{ldap_port}", $array["LDAP_PORT"]); $boot->set_list("WINDOWS_SERVER_TYPE", "{WINDOWS_SERVER_TYPE}", $severtype, $array["WINDOWS_SERVER_TYPE"]); $boot->set_field("COMPUTER_BRANCH", "{COMPUTERS_BRANCH}", $array["COMPUTER_BRANCH"]); $boot->set_list("SAMBA_BACKEND", "{database_backend}", $arrayBCK, $array["SAMBA_BACKEND"]); $boot->set_field("WINDOWS_SERVER_ADMIN", "{administrator}", $array["WINDOWS_SERVER_ADMIN"]); $boot->set_fieldpassword("WINDOWS_SERVER_PASS", "{password}", $array["WINDOWS_SERVER_PASS"], array("ENCODE" => true, "SPECIALSCHARS" => true)); echo $boot->Compile(); }
function settings() { $tpl = new templates(); $page = CurrentPageName(); $sock = new sockets(); $t = time(); $EnablePDNS = $sock->GET_INFO("EnablePDNS"); $PDNSRestartIfUpToMB = $sock->GET_INFO("PDNSRestartIfUpToMB"); $DisablePowerDnsManagement = $sock->GET_INFO("DisablePowerDnsManagement"); $EnablePDNS = $sock->GET_INFO("EnablePDNS"); $PowerUseGreenSQL = $sock->GET_INFO("PowerUseGreenSQL"); $PowerDisableDisplayVersion = $sock->GET_INFO("PowerDisableDisplayVersion"); $PowerActHasMaster = $sock->GET_INFO("PowerActHasMaster"); $PowerDNSDNSSEC = $sock->GET_INFO("PowerDNSDNSSEC"); $PowerDNSDisableLDAP = $sock->GET_INFO("PowerDNSDisableLDAP"); $PowerChroot = $sock->GET_INFO("PowerChroot"); $PowerActAsSlave = $sock->GET_INFO("PowerActAsSlave"); $PowerDNSLogLevel = $sock->GET_INFO("PowerDNSLogLevel"); $PowerSkipCname = $sock->GET_INFO("PowerSkipCname"); if (!is_numeric($EnablePDNS)) { $EnablePDNS = 0; } $PowerDNSMySQLEngine = 1; if (!is_numeric($PowerActHasMaster)) { $PowerActHasMaster = 0; } if (!is_numeric($PDNSRestartIfUpToMB)) { $PDNSRestartIfUpToMB = 700; } if (!is_numeric($DisablePowerDnsManagement)) { $DisablePowerDnsManagement = 0; } if (!is_numeric($PowerUseGreenSQL)) { $PowerUseGreenSQL = 0; } if (!is_numeric($PowerDisableDisplayVersion)) { $PowerDisableDisplayVersion = 0; } if (!is_numeric($PowerDNSDNSSEC)) { $PowerDNSDNSSEC = 0; } if (!is_numeric($PowerDNSDisableLDAP)) { $PowerDNSDisableLDAP = 1; } if (!is_numeric($PowerChroot)) { $PowerChroot = 0; } if (!is_numeric($PowerActAsSlave)) { $PowerActAsSlave = 0; } if (!is_numeric($PowerDNSLogLevel)) { $PowerDNSLogLevel = 1; } if (!is_numeric($PowerSkipCname)) { $PowerSkipCname = 0; } $PowerDNSMySQLType = $sock->GET_INFO("PowerDNSMySQLType"); $PowerDNSMySQLRemoteServer = $sock->GET_INFO("PowerDNSMySQLRemoteServer"); $PowerDNSMySQLRemotePort = $sock->GET_INFO("PowerDNSMySQLRemotePort"); $PowerDNSMySQLRemoteAdmin = $sock->GET_INFO("PowerDNSMySQLRemoteAdmin"); $PowerDNSMySQLRemotePassw = $sock->GET_INFO("PowerDNSMySQLRemotePassw"); if (!is_numeric($PowerDNSMySQLType)) { $PowerDNSMySQLType = 1; } if (!is_numeric($PowerDNSMySQLRemotePort)) { $PowerDNSMySQLRemotePort = 3306; } $PowerDNSMySQLTypeA[1] = "{main_mysql_server_2}"; $PowerDNSMySQLTypeA[2] = "{main_mysql_server_4}"; $PowerDNSMySQLTypeA[3] = "{main_mysql_server_5}"; for ($i = 0; $i < 10; $i++) { $loglevels[$i] = $i; } $boot = new boostrap_form(); $boot->set_checkbox("EnablePDNS", "{EnablePDNS}", $EnablePDNS, array("ONDISABLE" => "{EnablePDNS_disable_text}")); $boot->set_checkbox("DisablePowerDnsManagement", "{DisablePowerDnsManagement}", $DisablePowerDnsManagement); $boot->set_checkbox("PowerActHasMaster", "{ActHasMaster}", $PowerActHasMaster); $boot->set_checkbox("PowerActAsSlave", "{ActHasSlave}", $PowerActAsSlave); $boot->set_checkbox("PowerDNSDNSSEC", "DNSSEC", $PowerDNSDNSSEC); $boot->set_checkbox("PowerUseGreenSQL", "{useGreenSQL}", $PowerUseGreenSQL); $boot->set_checkbox("PowerDisableDisplayVersion", "{DisableDisplayVersion}", $PowerDisableDisplayVersion); $boot->set_checkbox("PowerChroot", "{chroot}", $PowerChroot); $boot->set_list("PowerDNSLogLevel", "{log level}", $loglevels, $PowerDNSLogLevel); $boot->set_field("PDNSRestartIfUpToMB", "{RestartServiceifReachMb}", $PDNSRestartIfUpToMB); $boot->set_list("PowerDNSMySQLType", "{mysql_database}", $PowerDNSMySQLTypeA, $PowerDNSMySQLType); $boot->set_field("PowerDNSMySQLRemoteServer", "{remote_mysql_server}", $PowerDNSMySQLRemoteServer); $boot->set_field("PowerDNSMySQLRemotePort", "{mysql_server_port}", $PowerDNSMySQLRemotePort); $boot->set_field("PowerDNSMySQLRemoteAdmin", "{mysql_admin}", $PowerDNSMySQLRemoteAdmin); $boot->set_fieldpassword("PowerDNSMySQLRemotePassw", "{password}", $PowerDNSMySQLRemotePassw); $boot->set_button("{apply}"); $boot->setAjaxPage("pdns.php"); $boot->set_PROTO("GET"); echo $tpl->_ENGINE_parse_body("<div class=text-info>{pdns_explain}</div>") . $boot->Compile(); }
function wizard_popup() { $boot = new boostrap_form(); $tpl = new templates(); $ID = $_GET["ID"]; $sock = new sockets(); $ApacheDisableModDavFS = $sock->GET_INFO("ApacheDisableModDavFS"); if (!is_numeric($ApacheDisableModDavFS)) { $ApacheDisableModDavFS = 0; } $users = new usersMenus(); $q = new mysql(); $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT maxsize FROM storage_containers WHERE `groupid`='" . mysql_escape_string2($_GET["gpid"]) . "'", "artica_backup")); $maxsize = $ligne["maxsize"]; if ($maxsize == 0) { $maxsizeText = $tpl->_ENGINE_parse_body("{unlimited} "); } else { $maxsizeText = $maxsize; } if ($maxsize > 0) { if ($ID == 0) { $uidenc = mysql_escape_string2($_SESSION["uid"]); $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(container_size) as tSize FROM users_containers WHERE `uid`='{$uidenc}'", "artica_backup")); $tSize = $ligne["tSize"]; if ($tSize >= $maxsize) { senderror("{error_quota_exceed}"); } } } $ligne = array(); if ($ID > 0) { $q = new mysql(); $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM users_containers WHERE `container_id`='{$ID}'", "artica_backup")); $boot->set_formtitle("{$ligne["container_name"]} ({$ligne["container_size"]}MB)"); } if ($ligne["container_name"] == null) { $ligne["container_name"] = $tpl->_ENGINE_parse_body("{new_container}"); } if ($maxsize > 0) { if (!is_numeric($ligne["container_size"])) { $ligne["container_size"] = $maxsize; } } $new_container_user_explain = $tpl->_ENGINE_parse_body("{new_container_user_explain}"); $new_container_user_explain = str_replace("%S", $maxsize, $new_container_user_explain); if ($ID == 0) { $boot->set_formdescription($new_container_user_explain); } $boot->set_hidden("gpid", $_GET["gpid"]); $boot->set_hidden("ID", $_GET["ID"]); $boot->set_field("container_name", "{container_name}", $ligne["container_name"], array("ENCODE" => true)); if ($ID == 0) { $boot->set_field("container_size", "{container_size}", $ligne["container_size"], array("TOOLTIP" => "{container_size_explain}")); } else { $boot->set_hidden("container_size", $ligne["container_size"]); } $webdav_creds = unserialize(base64_decode($ligne["webdav_creds"])); if ($webdav_creds["username"] == null) { $webdav_creds["username"] = $_SESSION["uid"]; } if ($ApacheDisableModDavFS == 0) { $boot->set_checkbox("webdav", "{http_sharing}", $ligne["webdav"], array("TOOLTIP" => "{container_http_sharing_explain}")); } if ($users->ISCSI_INSTALLED) { if (!is_numeric($ligne["iscsid"])) { $ligne["iscsid"] = 0; } $boot->set_checkbox("iscsid", "{network_disk}", $ligne["iscsid"], array("TOOLTIP" => "{container_iscsid_sharing_explain}")); } $lengthpass = strlen($webdav_creds["password"]); $boot->set_field("webdav_username", "{username}", $webdav_creds["username"], array("ENCODED" => true)); $boot->set_fieldpassword("webdav_password", "{password} ({$lengthpass} chars)", $webdav_creds["password"], array("ENCODED" => true)); if ($ID == 0) { $boot->set_button("{create}"); } else { $boot->set_button("{apply}"); } $boot->set_RefreshSearchs(); $boot->set_RefreshSearchsForced(); echo $boot->Compile(); }
function certificate_edit_settings() { $commonName = $_GET["CommonName"]; $q = new mysql(); $db = file_get_contents(dirname(__FILE__) . '/ressources/databases/ISO-3166-Codes-Countries.txt'); $tbl = explode("\n", $db); while (list($num, $ligne) = each($tbl)) { if (preg_match('#(.+?);\\s+([A-Z]{1,2})#', $ligne, $regs)) { $regs[2] = trim($regs[2]); $regs[1] = trim($regs[1]); $array_country_codes["{$regs[1]}_{$regs[2]}"] = $regs[1]; } } $ENC[1024] = 1024; $ENC[2048] = 2048; $ENC[4096] = 4096; if (!$q->FIELD_EXISTS("sslcertificates", "UsePrivKeyCrt", "artica_backup")) { $sql = "ALTER TABLE `sslcertificates` ADD `UsePrivKeyCrt` smallint(1) DEFAULT 0"; $q->QUERY_SQL($sql, 'artica_backup'); } $sql = "SELECT * FROM sslcertificates WHERE CommonName='{$commonName}'"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); if ($ligne["CountryName"] == null) { $ligne["CountryName"] = "UNITED STATES_US"; } if ($ligne["stateOrProvinceName"] == null) { $ligne["stateOrProvinceName"] = "New York"; } if ($ligne["localityName"] == null) { $ligne["localityName"] = "Brooklyn"; } if ($ligne["emailAddress"] == null) { $ligne["emailAddress"] = "*****@*****.**"; } if ($ligne["OrganizationName"] == null) { $ligne["OrganizationName"] = "MyCompany Ltd"; } if ($ligne["OrganizationalUnit"] == null) { $ligne["OrganizationalUnit"] = "IT service"; } if (!is_numeric($ligne["CertificateMaxDays"])) { $ligne["CertificateMaxDays"] = 730; } if (!is_numeric($ligne["levelenc"])) { $ligne["levelenc"] = 1024; } $boot = new boostrap_form(); $boot->set_formtitle($commonName); $boot->set_hidden("CommonName", $commonName); $boot->set_checkbox("UsePrivKeyCrt", "{UsePrivKeyCrt}", $ligne["UsePrivKeyCrt"]); $boot->set_list("CountryName", "{countryName}", $array_country_codes, $ligne["CountryName"]); $boot->set_field("stateOrProvinceName", "{stateOrProvinceName}", $ligne["stateOrProvinceName"]); $boot->set_field("localityName", "{localityName}", $ligne["localityName"]); $boot->set_field("OrganizationName", "{organizationName}", $ligne["OrganizationName"]); $boot->set_field("OrganizationalUnit", "{organizationalUnitName}", $ligne["OrganizationalUnit"]); $boot->set_field("emailAddress", "{emailAddress}", $ligne["emailAddress"]); $boot->set_field("CertificateMaxDays", "{CertificateMaxDays} ({days})", $ligne["CertificateMaxDays"]); $boot->set_list("levelenc", "{level_encryption}", $ENC, $ligne["levelenc"]); $boot->set_fieldpassword("password", "{password}", "secret"); $boot->set_button("{apply}"); $boot->set_RefreshFlex("flexRT{$_GET["t"]}"); $boot->set_RefreshSearchs(); echo $boot->Compile(); }
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 rule() { $page = CurrentPageName(); $tpl = new templates(); $boot = new boostrap_form(); $t = time(); $q = new mysql(); $users = new usersMenus(); if (!$q->TABLE_EXISTS("mailarchives", "artica_backup")) { $q->BuildTables(); } $zmd5 = $_GET["zmd5"]; $btname = "{apply}"; if ($zmd5 == null) { $btname = "{add}"; $boot->set_CloseYahoo("YahooWin"); } $sql = "SELECT * FROM mailarchives WHERE zmd5='{$zmd5}'"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); if (!$q->ok) { $error = "<p class='text-error'>{$q->mysql_error}.</p>"; } $directions["in"] = "{inbound}"; $directions["out"] = "{outbound}"; $directions["all"] = "{all}"; $boot->set_checkbox("enable", "{enabled_rule}", $ligne["enable"]); $boot->set_field("email", "{member}", $ligne["email"], array("MANDATORY" => true, "DISABLED" => true, "BUTTON" => array("JS" => "Loadjs('MembersBrowse.php?field-user=%f&OnlyUsers=1&OnlyGUID=0');", "LABEL" => "{browse}..."))); $boot->set_list("direction", "{direction}", $directions, $ligne["direction"]); if ($users->AsPostfixAdministrator) { $ldap = new clladp(); $hash = $ldap->hash_get_ou(true); $boot->set_list("ou", "{organization}", $hash, $ligne["ou"]); } $boot->set_field("next", "{destination}", $ligne["next"], array("MANDATORY" => true, "BUTTON" => array("JS" => "Loadjs('MembersBrowse.php?field-user=%f&OnlyUsers=1&OnlyGUID=0');", "LABEL" => "{browse}..."))); $boot->set_button($btname); $boot->set_hidden("zmd5", $zmd5); $params = unserialize(base64_decode($ligne["params"])); $boot->set_checkbox("USE_SMTP_SRV", "{external_smtp_server}", $params["USE_SMTP_SRV"], array("LINK" => "SMTP_SRV,USE_AUTH")); $boot->set_field("SMTP_SRV", "{smtp_server}", $params["SMTP_SRV"]); $boot->set_checkbox("USE_AUTH", "{smtp_authentication}", $params["USE_AUTH"], array("LINK" => "SMTP_USERNAME,SMTP_PASSWORD")); $boot->set_field("SMTP_USERNAME", "{username}", $params["SMTP_USERNAME"]); $boot->set_fieldpassword("SMTP_PASSWORD", "{password}", $params["SMTP_PASSWORD"]); $boot->set_RefreshSearchs(); $form = $boot->Compile(); $title = $tpl->_ENGINE_parse_body("{archive_rule}"); $html = $error . "<H2>{$title}</H2><hr>" . $form; echo $tpl->_ENGINE_parse_body($html); }
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(); }