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 engine_params() { $page = CurrentPageName(); $tpl = new templates(); $sock = new sockets(); $LogRotatePath = $sock->GET_INFO("LogRotatePath"); $SystemLogsPath = $sock->GET_INFO("SystemLogsPath"); $BackupMaxDays = $sock->GET_INFO("BackupMaxDays"); $BackupMaxDaysDir = $sock->GET_INFO("BackupMaxDaysDir"); $LogsRotateDeleteSize = $sock->GET_INFO("LogsRotateDeleteSize"); $LogsRotateDefaultSizeRotation = $sock->GET_INFO("LogsRotateDefaultSizeRotation"); if (!is_numeric($LogsRotateDefaultSizeRotation)) { $LogsRotateDefaultSizeRotation = 100; } $MySQLSyslogType = $sock->GET_INFO("MySQLSyslogType"); if (!is_numeric($MySQLSyslogType)) { $MySQLSyslogType = 1; } if ($SystemLogsPath == null) { $SystemLogsPath = "/var/log"; } if (!is_numeric($BackupMaxDays)) { $BackupMaxDays = 30; } $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; } $BackupSquidLogsNASRetry = $sock->GET_INFO("BackupSquidLogsNASRetry"); if (!is_numeric($BackupSquidLogsNASRetry)) { $BackupSquidLogsNASRetry = 0; } if ($LogRotatePath == null) { $LogRotatePath = "/home/logrotate"; } if ($BackupMaxDaysDir == null) { $BackupMaxDaysDir = "/home/logrotate_backup"; } if (!is_numeric($LogsRotateDeleteSize)) { $LogsRotateDeleteSize = 5000; } $boot = new boostrap_form(); $boot->set_field("LogsRotateDeleteSize", "{delete_if_file_exceed} (MB)", $LogsRotateDeleteSize); $boot->set_field("LogsRotateDefaultSizeRotation", "{default_size_for_rotation} (MB)", $LogsRotateDefaultSizeRotation); $boot->set_field("SystemLogsPath", "{system_logs_path}", $SystemLogsPath, array("BROWSE" => true)); $boot->set_spacertitle("{storage}"); if ($MySQLSyslogType == 1) { $boot->set_field("storage_files_path", "{storage_files_path}", $LogRotatePath, array("BROWSE" => true, "TOOLTIP" => "{LogRotatePath_explain}")); $boot->set_field("BackupMaxDays", "{max_day_in_database}", $BackupMaxDays); $boot->set_field("BackupMaxDaysDir", "{backup_folder}", $BackupMaxDaysDir, array("BROWSE" => true, "TOOLTIP" => "{BackupMaxDaysDir_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_checkbox("BackupSquidLogsNASRetry", "{retry}", $BackupSquidLogsNASRetry, array("TOOLTIP" => "{BackupSquidLogsNASRetry_explain}")); $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)); } else { $boot->set_spacerexplain("{syslogs_store_use_remote}"); } $boot->set_Newbutton("{test_connection}", "Loadjs('miniadm.system.syslogstore.php?test-nas-js=yes')"); echo $boot->Compile() . "<hr style='margin-bottom:10px'>"; }
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 nic_config() { $sock = new sockets(); $tpl = new templates(); $t = time(); $page = CurrentPageName(); $EnableipV6 = $sock->GET_INFO("EnableipV6"); if (!is_numeric($EnableipV6)) { $EnableipV6 = 0; } $ERROR_NO_PRIVS = $tpl->javascript_parse_text("{ERROR_NO_PRIVS}"); $DisableNetworksManagement = $sock->GET_INFO("DisableNetworksManagement"); if (!is_numeric($DisableNetworksManagement)) { $DisableNetworksManagement = 0; } $eth = $_GET["nic"]; $BUTTON = true; if (preg_match("#^tun#", $eth)) { $BUTTON = false; } if (preg_match("#([a-z0-9]+)\\.[0-9]+#", $eth)) { $BUTTON = false; } $nic = new system_nic($eth); $users = new usersMenus(); if ($users->SNORT_INSTALLED) { $EnableSnort = $sock->GET_INFO("EnableSnort"); if ($EnableSnort != 1) { $jsSnort = "DisableSnortInterface();"; } $snortInterfaces = unserialize(base64_decode($sock->GET_INFO("SnortNics"))); } if (!$users->SNORT_INSTALLED) { $jsSnort = "DisableSnortInterface();"; } $button = "{apply}"; if ($_GET["button"] == "confirm") { $button = "{button_i_confirm_nic}"; } $q = new mysql(); if (!$q->FIELD_EXISTS("nics", "defaultroute", "artica_backup")) { $q->QUERY_SQL("ALTER TABLE `nics` ADD `defaultroute` smallint(1) NOT NULL,ADD INDEX (`defaultroute`)", "artica_backup"); } $results = $q->QUERY_SQL("SELECT ID,name FROM nics_bridge ORDER BY name", "artica_backup"); $bridges[null] = "{select}"; while ($ligne = mysql_fetch_assoc($results)) { $bridges["br{$ligne["ID"]}"] = $ligne["name"]; } $defaultroute_interface = null; $defaultroute_field = false; $sql = "SELECT Interface FROM `nics` WHERE defaultroute=1"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); if (!$q->ok) { if (strpos("Unknown column", $q->mysql_error) > 1) { $q->QUERY_SQL("ALTER TABLE `nics` ADD `defaultroute` smallint(1) NOT NULL,ADD INDEX (`defaultroute`)", "artica_backup"); if (!$q->ok) { echo "<p class=text-error>Alter: {$q->mysql_error}</p>"; } $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup")); } } if (!$q->ok) { echo "<p class=text-error>{$q->mysql_error}</p>"; } if ($ligne["Interface"] == null) { $defaultroute_field = true; } else { if (trim($ligne["Interface"]) == $eth) { $defaultroute_field = true; } $defaultroute_interface = $ligne["Interface"]; } $boot = new boostrap_form(); if ($defaultroute_interface != null) { $defaultroute_interface_explain = $tpl->_ENGINE_parse_body("{defaultroute_interface_explain}"); $defaultroute_interface_explain = str_replace("%s", $defaultroute_interface, $defaultroute_interface_explain); $boot->set_spacerexplain($defaultroute_interface_explain); } $boot->set_hidden("UseSnort", $snortInterfaces[$eth]); $boot->set_hidden("noreboot", $_GET["noreboot"]); $boot->set_hidden("save_nic", $eth); $boot->set_checkbox("enabled", "{enabled}", $nic->enabled, array("DISABLEALL" => true)); $boot->set_checkbox("dhcp", "{use_dhcp}", $nic->dhcp); $boot->set_field("IPADDR", "{tcp_address}", $nic->IPADDR, array("IPV4" => true)); $boot->set_field("NETMASK", "{netmask}", $nic->NETMASK, array("IPV4" => true)); $boot->set_field("GATEWAY", "{gateway}", $nic->GATEWAY, array("IPV4" => true)); $boot->set_field("DNS_1", "{primary_dns}", $nic->DNS1); $boot->set_field("DNS_2", "{secondary_dns}", $nic->DNS2); $boot->set_field("metric", "{metric}", $nic->metric); if ($defaultroute_field) { $boot->set_checkbox("defaultroute", "{default_route}", $nic->defaultroute); } else { $boot->set_hidden("defaultroute", 0); } $boot->set_checkbox("Bridged", "{attach_to_bridge}", $nic->Bridged, array("LINK" => "BridgedTo")); $boot->set_list("BridgedTo", "{network_bridge}", $bridges, $nic->BridgedTo); $boot->setAjaxPage("system.nic.edit.php"); $boot->set_RefreshSearchs(); if ($BUTTON) { $boot->set_button("{apply}"); } else { $boot->set_form_locked(); } $boot->set_PROTO("GET"); if ($DisableNetworksManagement == 1) { $boot->set_form_locked(); } if (!$users->AsSystemAdministrator) { $boot->set_form_locked(); } $form = $boot->Compile(); $tpl = new templates(); echo $tpl->_ENGINE_parse_body($form); }
function rules_sources_group_items_popup() { $boot = new boostrap_form(); $sock = new sockets(); $users = new usersMenus(); $ldap = new clladp(); $groupid = $_GET["groupid"]; $title_button = "{add}"; $title = "{new_item}"; $q = new mysql_squid_builder(); $ligne = @mysql_fetch_array($q->QUERY_SQL("SELECT * FROM authenticator_groups WHERE ID='{$groupid}'")); $explain[1] = "{authenticator_explain_network_text}"; $explain[3] = "{authenticator_explain_cookie_text}"; $title = $title . "::" . $ligne["groupname"]; $boot->set_formtitle($title); $boot->set_spacerexplain("<i>{group2} ID:{$groupid} {group2} {type}:{$ligne["group_type"]} ({$GLOBALS["SOURCE_TYPE"][$ligne["group_type"]]})</i>"); $boot->set_formdescription($explain[$ligne["group_type"]]); $boot->set_hidden("rules-sources-group-items-add", "yes"); $boot->set_hidden("groupid", $groupid); $boot->set_textarea("items", "{items}", null, array("ENCODE" => true)); $boot->set_button($title_button); $AdminPrivs = AdminPrivs(); if (!$AdminPrivs) { $boot->set_form_locked(); } if ($ligne["group_type"] == 0) { $boot->set_form_locked(); } $boot->set_CloseYahoo("YahooWin3"); $boot->set_RefreshSearchs(); echo $boot->Compile(); }