Example #1
0
function lang_popup()
{
    $htmlT = new htmltools_inc();
    $page = CurrentPageName();
    $lang = $htmlT->LanguageArray();
    $tpl = new templates();
    $boot = new boostrap_form();
    $boot->set_list("lang", "{language}", $lang, $tpl->language, array("COOKIE" => "artica-language"));
    $boot->set_AjaxFinal("window.location.href='{$page}';");
    $boot->set_button("{apply}");
    $boot->set_CloseYahoo("YahooWin3");
    echo $boot->Compile();
}
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;
}