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}: «$pattern»",$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}: «{$pattern}»", $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; }