function bridge_popup()
{
    $boot = new boostrap_form();
    $sock = new sockets();
    $users = new usersMenus();
    $ldap = new clladp();
    $ID = $_GET["ID"];
    $title_button = "{add}";
    $nics = unserialize(base64_decode($sock->getFrameWork("cmd.php?list-nics=yes")));
    $IP = new networking();
    while (list($key, $value) = each($nics)) {
        $array = $IP->GetNicInfos($value);
        $NICZ[$value] = $value . " [{$array["IPADDR"]}]";
    }
    $boot->set_list("nic_inbound", "{from}", $NICZ, null);
    $boot->set_list("nic_linked", "{to}", $NICZ, null);
    $boot->set_hidden("ID", $_GET["ID"]);
    if (!$users->AsSystemAdministrator) {
        $boot->set_form_locked();
    }
    if ($ID == 0) {
        $boot->set_CloseYahoo("YahooWin2");
    }
    $boot->set_RefreshSearchs();
    echo $boot->Compile();
}
function popup()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $ID = $_GET["ID"];
    $title = "{new_page}";
    $buttonname = "{add}";
    if ($ID > 0) {
        $q = new mysql_squid_builder();
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM reverse_pages_content WHERE ID='{$ID}'"));
        $title = $ligne["subject"];
        $buttonname = "{apply}";
    }
    if ($ligne["content"] == null) {
        $ligne["content"] = "<html>\n<head>\n<title>It's works</title>\n</head>\n<body>\n\t<H1>It works!</H1>\n</body>\n</html>";
    }
    $boot = new boostrap_form();
    $boot->set_hidden("ID", $ID);
    $boot->set_formtitle($title);
    if (!is_numeric($ligne["cachemin"])) {
        $ligne["cachemin"] = 5;
    }
    $boot->set_list("cachemin", "{cache}", $ligne["cachemin"], $q->CACHE_AGES);
    $boot->set_field("subject", "{subject}", $ligne["subject"]);
    $boot->set_textarea("content", "{content}", $ligne["content"], array("ENCODE" => true, "HEIGHT" => 350));
    $boot->set_button($buttonname);
    $boot->set_RefreshSearchs();
    if ($ID == 0) {
        $boot->set_CloseYahoo("YahooWin6");
    }
    echo $boot->Compile();
}
function policy_domain()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $t = time();
    $q = new amavisdb();
    $boot = new boostrap_form();
    $email = $_GET["policy-domain"];
    $sql = "SELECT id,policy_name FROM policy WHERE ou='{$_SESSION["ou"]}' ORDER BY policy_name";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo "<p class=text-error>{$q->mysql_error}<br>{$sql}<hr></p>";
    }
    $policies[0] = "{default}";
    while ($ligne = mysql_fetch_assoc($results)) {
        $policies[$ligne["id"]] = $ligne["policy_name"];
    }
    $email_id = $q->emailid_from_email("@{$email}");
    $policy_id = $q->policyid_from_mail("@{$email}");
    $boot->set_hidden("policy_domain", $email);
    $boot->set_hidden("email_id", $email_id);
    $boot->set_list("policy_id", "{policy}", $policies, $policy_id);
    $boot->set_button("{apply}");
    $boot->set_CallBack("YahooWin2Hide");
    $boot->set_RefreshSearchs();
    echo $boot->Compile();
}
function virtip_popup()
{
    $boot = new boostrap_form();
    $sock = new sockets();
    $users = new usersMenus();
    $ldap = new clladp();
    $ID = $_GET["ID"];
    $title_button = "{add}";
    $nics = unserialize(base64_decode($sock->getFrameWork("cmd.php?list-nics=yes")));
    if ($_GET["ID"] > 0) {
        $sql = "SELECT * FROM nics_virtuals WHERE ID='{$ID}'";
        $q = new mysql();
        $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
        $title_button = "{apply}";
    }
    $ous = $ldap->hash_get_ou(true);
    $ous["openvpn_service"] = "{APP_OPENVPN}";
    while (list($num, $val) = each($nics)) {
        $nics_array[$val] = $val;
    }
    $nics_array[null] = "{select}";
    $ous[null] = "{select}";
    $boot->set_list("nic", "{nic}", $nics_array, $ligne["nic"]);
    $boot->set_list("org", "{organization}", $ous, $ligne["org"]);
    $boot->set_field("ipaddr", "{tcp_address}", $ligne["ipaddr"], array("IPV4" => true));
    $boot->set_field("netmask", "{netmask}", $ligne["netmask"], array("IPV4" => true));
    $boot->set_field("cdir", "CDIR", $ligne["cdir"], array("CDIR" => "ipaddr,netmask"));
    $boot->set_field("gateway", "{gateway}", $ligne["gateway"], array("IPV4" => true));
    $boot->set_field("metric", "{metric}", $ligne["metric"]);
    $boot->set_hidden("ID", $_GET["ID"]);
    $boot->set_checkbox("ForceGateway", "{ForceGateway}", $ligne["ForceGateway"]);
    if (!$users->AsSystemAdministrator) {
        $boot->set_form_locked();
    }
    if ($ID == 0) {
        $boot->set_CloseYahoo("YahooWin2");
    }
    $boot->set_RefreshSearchs();
    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 item_popup()
{
    $ID = $_GET["ID"];
    $q = new mysql_squid_builder();
    $title = "{new_group}";
    $bt = "{add}";
    $q = new mysql_squid_builder();
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM nginx_exploits_groups WHERE ID='{$_GET["groupid"]}'"));
    $groupname = $ligne["groupname"];
    $ligne["enabled"] = 1;
    if ($ID > 0) {
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM nginx_exploits_items WHERE ID='{$ID}'"));
        $bt = "{apply}";
        $title = "{$groupname}::{{$ligne["token"]}}";
    }
    $array["http_user_agent"] = "{http_user_agent}";
    $array["query_string"] = "{query_string}";
    $boot = new boostrap_form();
    $boot->set_hidden("edititem", $ID);
    $boot->set_hidden("groupid", $_GET["groupid"]);
    $boot->set_formtitle($title);
    $boot->set_list("token", "{token}", $array, $ligne["token"]);
    $boot->set_textarea("pattern", "{pattern}", $ligne["pattern"], array("ENCODE" => true));
    $boot->set_checkbox("reverse", "{reverse}", $ligne["reverse"]);
    $boot->set_checkbox("enabled", "{enabled}", $ligne["enabled"]);
    $boot->set_button($bt);
    if ($ID == 0) {
        $boot->set_CloseYahoo("YahooWin6");
    }
    $boot->set_RefreshSearchs();
    echo $boot->Compile();
}
function settings()
{
    $page = CurrentPageName();
    $sock = new sockets();
    $boot = new boostrap_form();
    $sock = new sockets();
    $tpl = new templates();
    $EnableITChart = $sock->GET_INFO("EnableITChart");
    $ItChartFreeWeb = $sock->GET_INFO("ItChartFreeWeb");
    if (!is_numeric($EnableITChart)) {
        $EnableITChart = 0;
    }
    $q = new mysql_squid_builder();
    $q->CheckTables();
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT COUNT(*) as tcount FROM itcharters"));
    if ($ligne["tcount"] == 0) {
        echo "<p class=text-error>" . $tpl->_ENGINE_parse_body("{ERROR_NO_ITCHART_CREATED}") . "</p>";
    }
    $boot->set_formtitle("{IT_charter}");
    $boot->set_formdescription("{IT_charter_explain}<br>{IT_charter_explain2}");
    $boot->set_checkbox("EnableITChart", "{enable_it_charter}", $EnableITChart);
    $sql = "SELECT servername,UseSSL FROM freeweb WHERE groupware='ERRSQUID'";
    $me = $_SERVER["SERVER_ADDR"] . ":" . $_SERVER["SERVER_PORT"];
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        echo "<p class=text-error>{$q->mysql_error}</p>";
    }
    $hash[$me] = $me;
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        $servername = $ligne["servername"];
        if ($ligne["UseSSL"] == 1) {
            $servername = $servername . ":443";
        }
        $hash[$servername] = $servername;
    }
    if ($ItChartFreeWeb == null) {
        $sock->SET_INFO("ItChartFreeWeb", $me);
    }
    $boot->set_list("ItChartFreeWeb", "{webserver}", $hash, $ItChartFreeWeb);
    $users = new usersMenus();
    if (!$users->AsDansGuardianAdministrator) {
        $boot->set_form_locked();
    }
    echo $boot->Compile();
}
function new_port()
{
    $t = $_GET["t"];
    include_once dirname(__FILE__) . "/ressources/class.system.network.inc";
    $page = CurrentPageName();
    $tpl = new templates();
    $boot = new boostrap_form();
    $ip = new networking();
    $ips = $ip->ALL_IPS_GET_ARRAY();
    $ipz["0.0.0.0"] = "{all}";
    while (list($ip, $line) = each($ips)) {
        $ipz[$ip] = $ip;
    }
    $boot->set_field("portname", "{rulename}", "MyNew port", array("ENCODE" => true));
    $boot->set_field("aclport", "{listen_port}", "9090");
    $boot->set_list("interface", "{listen_address}", $ipz, "0.0.0.0");
    $boot->set_button("{add}");
    $boot->set_hidden("bubble-add", "yes");
    $boot->set_formtitle("{new_port}");
    $boot->set_CallBack("LoadAjax('center-{$t}','{$page}?tabs=yes&t={$t}');");
    $form = $boot->Compile();
    echo $tpl->_ENGINE_parse_body($form);
}
示例#9
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 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;
}
示例#11
0
function add_user_popup()
{
    $ldap = new clladp();
    if ($_GET["ou"] == null) {
        senderror("{ERROR_NO_ORGANISATION_SELECTED}");
    }
    $hash = $ldap->hash_groups($_GET["ou"], 1);
    $domains = $ldap->hash_get_domains_ou($_GET["ou"]);
    $boot = new boostrap_form();
    $boot->set_hidden("ou", $_GET["ou"]);
    $boot->set_hidden("encpass", 1);
    $boot->set_field("new_userid", "{name_the_new_account_title}", null, array("MANDATORY" => true));
    $boot->set_field("password", "{password}", null, array("MANDATORY" => true));
    $boot->set_field("email", "{email}", null, array("MANDATORY" => true));
    $boot->set_field("password", "{password}", null, array("MANDATORY" => true, "ENCODE" => true));
    $boot->set_list("group_id", "{group}", $hash);
    $boot->set_button("{add}");
    $boot->set_CloseYahoo("YahooWin2");
    $boot->set_RefreshSearchs();
    $boot->setAjaxPage("domains.edit.user.php");
    $boot->set_formtitle("{$_GET["ou"]}:: {new_member}");
    echo $boot->Compile();
}
示例#12
0
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 failover()
{
    //this_feature_is_disabled_corp_license
    $users = new usersMenus();
    $boot = new boostrap_form();
    $tpl = new templates();
    $t = time();
    $page = CurrentPageName();
    $sock = new sockets();
    $eth = $_GET["nic"];
    $nic = new system_nic($eth);
    for ($i = 1; $i < 256; $i++) {
        $ucarp_vids[$i] = $i;
    }
    $boot->set_hidden("save_nic", $eth);
    $array = unserialize(base64_decode($sock->getFrameWork("system.php?ucarp-status={$eth}")));
    if (!isset($array["PID"])) {
        $boot->set_formdescription("{status}:{stopped}");
        $boot->set_Newbutton("{start}", "Start{$t}()");
    } else {
        $boot->set_Newbutton("{stop}", "Stop{$t}()");
        $boot->set_formdescription("{status}:{running} PID:{$array["PID"]} {since} {$array["TIME"]}Mn");
    }
    $XHR = array();
    $XHR["start-vip"] = "yes";
    $boot->set_AddScript("Start{$t}", array("XHR" => $XHR));
    $XHR = array();
    $XHR["stop-vip"] = "yes";
    $boot->set_AddScript("Stop{$t}", array("XHR" => $XHR));
    $boot->set_checkbox("ucarp_enabled", "{enabled}", $nic->ucarp_enabled, array("DISABLEALL" => true));
    $boot->set_checkbox("ucarp_master", "{isamaster}", $nic->ucarp_master, array("TOOLTIP" => "{ucarp_master_explain}"));
    $boot->set_list("ucarp_vid", "{ucarp-vid}", $ucarp_vids, $nic->ucarp_vid);
    $boot->set_field("ucarp_vip", "{ucarp-vip}", $nic->ucarp_vip, array("MANDATORY" => true, "IPV4" => true, "TOOLTIP" => "{ucarp_vip_explain}"));
    $boot->set_list("ucarp_advskew", "{ucarp-advskew}", $ucarp_vids, $nic->ucarp_advskew);
    $boot->set_field("ucarp_advbase", "{interval} ({seconds})", $nic->ucarp_advbase, array("MANDATORY" => true));
    $boot->set_button("{apply}");
    $boot->set_RefreshSearchs();
    if (!$users->AsSystemAdministrator) {
        $boot->set_form_locked();
    }
    if (!$users->CORP_LICENSE) {
        $error = "<p class=text-error>{this_feature_is_disabled_corp_license}</p>";
        $boot->set_form_locked();
    }
    $form = $boot->Compile();
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($error . $form);
}
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 page_popup()
{
    $boot = new boostrap_form();
    $sock = new sockets();
    $users = new usersMenus();
    $ldap = new clladp();
    $ID = $_GET["ID"];
    $title_button = "{add}";
    $title = "{new_error_page}";
    $f = new squid_reverse();
    if ($ID > 0) {
        $sql = "SELECT * FROM nginx_error_pages WHERE ID='{$ID}'";
        $q = new mysql_squid_builder();
        $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
        if (!$q->ok) {
            echo "<p class=text-error>{$q->mysql_error}</p>";
        }
        $title_button = "{apply}";
        $title = $ligne["pagename"] . "&nbsp;&raquo;&raquo;&nbsp;" . $ligne["error_code"];
    }
    while (list($key, $value) = each($f->errors_page)) {
        $errors_code[$value] = $value;
    }
    $boot->set_formtitle($title);
    $boot->set_hidden("page-save", "yes");
    $boot->set_hidden("ID", $ID);
    $boot->set_field("pagename", "{pagename}", $ligne["pagename"], array("ENCODE" => true));
    $boot->set_list("error_code", "{error_code}", $errors_code, $ligne["error_code"]);
    $boot->set_field("title", "{page_title}", $ligne["title"], array("ENCODE" => true));
    $boot->set_button($title_button);
    $AdminPrivs = AdminPrivs();
    if (!$AdminPrivs) {
        $boot->set_form_locked();
    }
    if ($ID == 0) {
        $boot->set_CloseYahoo("YahooWin3");
    }
    $boot->set_RefreshSearchs();
    echo $boot->Compile();
}
function remotedomain_add()
{
    $ldap = new clladp();
    $ou = $_SESSION["ou"];
    $btname = "{add}";
    $domain = $_GET["domain"];
    if ($domain != null) {
        $btname = "{apply}";
    }
    if ($ou == null) {
        $ou = $ldap->ou_by_smtp_domain($domain);
    }
    $HashDomains = $ldap->Hash_relay_domains();
    $tools = new DomainsTools();
    $arr = $tools->transport_maps_explode($HashDomains[$domain]);
    $dn = "cn=@{$domain},cn=relay_recipient_maps,ou={$ou},dc=organizations,{$ldap->suffix}";
    $trusted_smtp_domain = 0;
    if ($ldap->ExistsDN($dn)) {
        $trusted_smtp_domain = 1;
    }
    if (!is_numeric($arr[2])) {
        $arr[2] = 25;
    }
    if ($arr[3] == null) {
        $arr[3] = 0;
    } else {
        if ($arr[3] == "no") {
            $arr[3] = 0;
        } else {
            $arr[3] = 1;
        }
    }
    $boot = new boostrap_form();
    $ldap = new clladp();
    if ($domain != null) {
        $boot->set_field("remotedomain", "{domain}", $domain, array("MANDATORY" => true, "DISABLED" => true));
    } else {
        $boot->set_field("remotedomain", "{domain}", $domain, array("MANDATORY" => true));
    }
    $users = new usersMenus();
    if ($users->AsPostfixAdministrator) {
        $ous = $ldap->hash_get_ou(true);
        $boot->set_list("ou", "{ou}", $ous, $ou);
    } else {
        $boot->set_hidden("ou", $ou);
    }
    $boot->set_field("destination", "{destination}", $arr[1], null, array("MANDATORY" => true));
    $boot->set_field("destination_port", "{port}", $arr[2], null, array("MANDATORY" => true));
    $boot->set_checkbox("MX", "{MX_lookups}", $arr[3], array('TOOLTIP' => "{mx_look}"));
    $boot->set_checkbox("trusted_smtp_domain", "{trusted_smtp_domain}", $trusted_smtp_domain, array('TOOLTIP' => "{trusted_smtp_domain_text}"));
    $boot->set_button($btname);
    $boot->set_RefreshSearchs();
    $boot->set_CloseYahoo("YahooWin");
    echo $boot->Compile();
}
function mainroutes_popup()
{
    $zmd5 = $_GET["zmd5"];
    $users = new usersMenus();
    $page = CurrentPageName();
    $tpl = new templates();
    $t = time();
    $buttonname = "{add}";
    $boot = new boostrap_form();
    if ($zmd5 != null) {
        $q = new mysql();
        $sql = "SELECT *  FROM nic_routes WHERE zmd5='{$zmd5}'";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
        $title = $tpl->_ENGINE_parse_body("{$ligne["pattern"]}");
        $buttonname = "{apply}";
    } else {
        $boot->set_CloseYahoo("YahooWin2");
    }
    $nics[null] = "{select}";
    $types[1] = "{network_nic}";
    $types[2] = "{host}";
    $ip = new networking();
    $Interfaces = $ip->Local_interfaces();
    unset($Interfaces["lo"]);
    $Interfaces[null] = "{select}";
    if (!is_numeric($ligne["enable"])) {
        $ligne["enable"] = 1;
    }
    $boot->set_formtitle($title);
    $boot->set_hidden("zmd5", $zmd5);
    //$boot->set_checkbox("enable", "{enabled}", $ligne["enable"],array("DISABLEALL"=>true));
    $boot->set_list("type", "{type}", $types, $ligne["type"]);
    $boot->set_field("pattern", "{destination}", $ligne["pattern"]);
    $boot->set_field("gateway", "{gateway}", $ligne["gateway"]);
    $boot->set_list("nic", "{interface}", $Interfaces, $ligne["interface"]);
    $users = new usersMenus();
    if (!$users->AsSystemAdministrator) {
        $boot->set_form_locked();
    }
    $boot->set_button($buttonname);
    $boot->set_RefreshSearchs();
    echo $boot->Compile();
}
function ruleid_popup()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $id = $_GET["ruleid"];
    if (!is_numeric($id)) {
        $id = 0;
    }
    $gpid = $_GET["gpid"];
    $buttonname = "{add}";
    if ($id > 0) {
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM webfilter_aclsdynamic WHERE `ID`='{$id}'"));
        $buttonname = "{apply}";
        $gpid = $ligne["gpid"];
    }
    $ligne2 = mysql_fetch_array($q->QUERY_SQL("SELECT params FROM webfilters_sqgroups WHERE ID='{$gpid}'"));
    $params = unserialize(base64_decode($ligne2["params"]));
    if ($id == 0) {
        $ligne["duration"] = $params["duration"];
    }
    $t = time();
    if (!is_numeric($gpid)) {
        $gpid = 0;
    }
    $ligne["description"] = stripslashes($ligne["description"]);
    if ($id > 0) {
        $buttonname = "{apply}";
    }
    $durations[0] = "{unlimited}";
    $durations[5] = "05 {minutes}";
    $durations[10] = "10 {minutes}";
    $durations[15] = "15 {minutes}";
    $durations[30] = "30 {minutes}";
    $durations[60] = "1 {hour}";
    $durations[120] = "2 {hours}";
    $durations[240] = "4 {hours}";
    $durations[480] = "8 {hours}";
    $durations[720] = "12 {hours}";
    $durations[960] = "16 {hours}";
    $durations[1440] = "1 {day}";
    $durations[2880] = "2 {days}";
    $durations[5760] = "4 {days}";
    $durations[10080] = "1 {week}";
    $durations[20160] = "2 {weeks}";
    $durations[43200] = "1 {month}";
    $boot = new boostrap_form();
    $boot->set_hidden("SaveRule", "yes");
    $boot->set_hidden("gpid", $gpid);
    $boot->set_hidden("ruleid", $id);
    $boot->set_formdescription("{dynaacl_howto}");
    $boot->set_list("type", "{type}", $q->acl_GroupTypeDynamic, $ligne["type"]);
    $boot->set_field("value", "{value}", $ligne["value"], array("MANDATORY" => true));
    if ($params["allow_duration"] == 1) {
        $boot->set_list("duration", "{time_duration}", $durations, $ligne["duration"]);
    }
    $boot->set_field("description", "{description}", utf8_encode($ligne["description"]));
    $boot->set_button($buttonname);
    $boot->set_RefreshSearchs();
    $html = $boot->Compile();
    echo $tpl->_ENGINE_parse_body($html);
}
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 parameters()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $sock = new sockets();
    $CacheReplacementPolicy = $sock->GET_INFO("CacheReplacementPolicy");
    $DisableAnyCache = $sock->GET_INFO("DisableAnyCache");
    if ($CacheReplacementPolicy == null) {
        $CacheReplacementPolicy = "heap_LFUDA";
    }
    $SquidDebugCacheProc = $sock->GET_INFO("SquidDebugCacheProc");
    $ForceWindowsUpdateCaching = $sock->GET_INFO("ForceWindowsUpdateCaching");
    $ProxyDedicateMicrosoftRules = $sock->GET_INFO("ProxyDedicateMicrosoftRules");
    if (!is_numeric($SquidDebugCacheProc)) {
        $SquidDebugCacheProc = 0;
    }
    if (!is_numeric($DisableAnyCache)) {
        $DisableAnyCache = 0;
    }
    if (!is_numeric($ForceWindowsUpdateCaching)) {
        $ForceWindowsUpdateCaching = 0;
    }
    $squid = new squidbee();
    $t = time();
    $array["lru"] = "{cache_lru}";
    $array["heap_GDSF"] = "{heap_GDSF}";
    $array["heap_LFUDA"] = "{heap_LFUDA}";
    $array["heap_LRU"] = "{heap_LRU}";
    if (preg_match("#([0-9]+)#", $squid->global_conf_array["maximum_object_size"], $re)) {
        $maximum_object_size = $re[1];
        if (preg_match("#([A-Z]+)#", $squid->global_conf_array["maximum_object_size"], $re)) {
            $unit = $re[1];
        }
        if ($unit == "KB") {
            $maximum_object_size_in_memory = round($maximum_object_size_in_memory / 1024);
        }
    }
    if (preg_match("#([0-9]+)#", $squid->global_conf_array["maximum_object_size_in_memory"], $re)) {
        $maximum_object_size_in_memory = $re[1];
        if (preg_match("#([A-Z]+)#", $squid->global_conf_array["maximum_object_size_in_memory"], $re)) {
            $unit = $re[1];
        }
        if ($unit == "KB") {
            $maximum_object_size_in_memory = round($maximum_object_size_in_memory / 1024);
        }
    }
    $boot = new boostrap_form();
    $boot->set_formtitle("{caches}::{parameters}");
    $boot->set_checkbox("DisableAnyCache", "{DisableAnyCache}", $DisableAnyCache);
    $boot->set_checkbox("ForceWindowsUpdateCaching", "{ForceWindowsUpdateCaching}", $ForceWindowsUpdateCaching);
    $boot->set_checkbox("ProxyDedicateMicrosoftRules", "{ProxyDedicateMicrosoftRules}", $ProxyDedicateMicrosoftRules);
    $boot->set_checkbox("SquidDebugCacheProc", "{debug_cache_processing}", $SquidDebugCacheProc);
    $boot->set_list("CacheReplacementPolicy", "{cache_replacement_policy}", $array, $CacheReplacementPolicy, array("TOOLTIP" => "{cache_replacement_policy_explain}"));
    $boot->set_field("maximum_object_size", "{maximum_object_size_in_memory} (MB)", $maximum_object_size_in_memory, array("TOOLTIP" => "{maximum_object_size_text}"));
    $boot->set_field("maximum_object_size", "{maximum_object_size_in_memory} (MB)", $maximum_object_size, array("TOOLTIP" => "{maximum_object_size_in_memory_text}"));
    $boot->set_button("{apply}");
    echo $boot->Compile();
}
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 parameters()
{
    $users = new usersMenus();
    $page = CurrentPageName();
    $boot = new boostrap_form();
    $squid = new squidbee();
    $squid_reverse = new squid_reverse();
    if (!$users->AsSquidAdministrator) {
        senderror("{ERROR_NO_PRIVS}");
        return;
    }
    $sock = new sockets();
    $SquidReverseDefaultWebSite = $sock->GET_INFO("SquidReverseDefaultWebSite");
    $SquidReverseDefaultCert = $sock->GET_INFO("SquidReverseDefaultWebSite");
    if ($SquidReverseDefaultWebSite == null) {
        $SquidReverseDefaultWebSite = $squid->visible_hostnameF();
    }
    $boot->set_formtitle("{global_parameters}");
    $boot->set_field("SquidReverseDefaultWebSite", "{default_website}", "{$SquidReverseDefaultWebSite}");
    $squid_reverse = new squid_reverse();
    $sslcertificates = $squid_reverse->ssl_certificates_list();
    $q = new mysql();
    $boot->set_list("certificate_center", "{default_certificate}", $sslcertificates, $squid->certificate_center);
    $boot->set_button("{apply}");
    echo $boot->Compile();
}
function search_database_popup()
{
    $boot = new boostrap_form();
    $q = new mysql_storelogs();
    if (!isset($_SESSION["QUERY_SYSLOG_HOST_DAY_FIELDY"])) {
        $sql = "SELECT DATE_FORMAT(filetime,'%Y-%m-%d') as filetime FROM files_info GROUP BY filetime ORDER BY filetime DESC";
        $results = $q->QUERY_SQL($sql);
        $dayz[null] = "{select}";
        while ($ligne = mysql_fetch_assoc($results)) {
            $time = time_to_date(strtotime($ligne["filetime"] . " 00:00:00"));
            $dayz[$ligne["filetime"]] = $time;
        }
        $_SESSION["QUERY_SYSLOG_HOST_DAY_FIELDY"] = serialize($dayz);
    }
    if (!isset($_SESSION["QUERY_SYSLOG_HOST_FIELDZ"])) {
        $sql = "SELECT hostname FROM files_info GROUP BY hostname ORDER BY hostname ASC";
        $results = $q->QUERY_SQL($sql);
        $hostz[null] = "{select}";
        while ($ligne = mysql_fetch_assoc($results)) {
            $hostz[$ligne["hostname"]] = $ligne["hostname"];
        }
        $_SESSION["QUERY_SYSLOG_HOST_FIELDZ"] = serialize($hostz);
    }
    $LIMITS[50] = 50;
    $LIMITS[250] = 250;
    $LIMITS[500] = 250;
    $LIMITS[1000] = 1000;
    $LIMITS[2000] = 2000;
    if (!isset($_SESSION["QUERY_SYSLOG_LIMIT"])) {
        $_SESSION["QUERY_SYSLOG_LIMIT"] = 250;
    }
    if (!is_numeric($_GET["xtime"])) {
        $boot->set_list("QUERY_SYSLOG_DATE", "{date}", unserialize($_SESSION["QUERY_SYSLOG_HOST_DAY_FIELDY"]), $_SESSION["QUERY_SYSLOG_DATE"]);
    }
    $boot->set_list("QUERY_SYSLOG_HOST", "{hostname}", unserialize($_SESSION["QUERY_SYSLOG_HOST_FIELDZ"]), $_SESSION["QUERY_SYSLOG_HOST"]);
    $boot->set_field("QUERY_SYSLOG_FILE", "{filename}", $_SESSION["QUERY_SYSLOG_FILE"]);
    $boot->set_list("QUERY_SYSLOG_LIMIT", "{rows}", $LIMITS, $_SESSION["QUERY_SYSLOG_LIMIT"]);
    $boot->set_button("{search}");
    $boot->set_CloseYahoo("YahooWin2");
    $boot->set_formdescription("{advanced_search_explain}");
    $boot->set_RefreshSearchs();
    echo $boot->Compile();
}
function sources_add_group_popup()
{
    $boot = new boostrap_form();
    $sock = new sockets();
    $users = new usersMenus();
    $ldap = new clladp();
    $ID = $_GET["groupid"];
    $title_button = "{add}";
    $title = "{new_group}";
    if ($ID > 0) {
        $sql = "SELECT * FROM authenticator_auth WHERE ID='{$ID}'";
        $q = new mysql_squid_builder();
        $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
        if (!$q->ok) {
            echo "<p class=text-error>{$q->mysql_error}</p>";
        }
        $title_button = "{apply}";
        $title = $ligne["groupname"] . "&nbsp;&raquo;&raquo;&nbsp;" . $GLOBALS["TYPES"][$ligne["group_type"]];
    }
    $mainrule = $_GET["mainrule"];
    if (!is_numeric($mainrule)) {
        $mainrule = 0;
    }
    $boot->set_formtitle($title);
    $boot->set_hidden("rules-sources-add-group-save", "yes");
    $boot->set_hidden("mainrule", $mainrule);
    $boot->set_hidden("groupid", $ID);
    $boot->set_field("groupname", "{groupname}", $ligne["groupname"], array("ENCODE" => true));
    $boot->set_checkbox("enabled", "{enabled}", $ligne["enabled"]);
    if ($ID == 0) {
        $boot->set_list("group_type", "{groupe_type}", $GLOBALS["TYPES"], $ligne["group_type"]);
    } else {
        $boot->set_hidden("group_type", $ligne["group_type"]);
    }
    $boot->set_button($title_button);
    $AdminPrivs = AdminPrivs();
    if (!$AdminPrivs) {
        $boot->set_form_locked();
    }
    if ($ID == 0) {
        $boot->set_CloseYahoo("YahooWin3");
    }
    $boot->set_RefreshSearchs();
    echo $boot->Compile();
}
function section_blocked_form()
{
    $boot = new boostrap_form();
    $q = new mysql_squid_builder();
    $ARRAYTABLES = $q->LIST_TABLES_BLOCKED();
    while (list($tablename, $none) = each($ARRAYTABLES)) {
        $time = $q->TIME_FROM_DAY_TABLE($tablename);
        $days[$time] = time_to_date($time);
    }
    $BLOCKED_CATEGORY_LIMITS[50] = 50;
    $BLOCKED_CATEGORY_LIMITS[250] = 250;
    $BLOCKED_CATEGORY_LIMITS[500] = 250;
    $BLOCKED_CATEGORY_LIMITS[1000] = 1000;
    $BLOCKED_CATEGORY_LIMITS[2000] = 2000;
    krsort($days);
    $boot->set_list("QUERY_BLOCKED_DATE", "{date}", $days, $_SESSION["QUERY_BLOCKED_DATE"]);
    $boot->set_field("QUERY_BLOCKED_UID", "{member}", $_SESSION["QUERY_BLOCKED_UID"]);
    $boot->set_field("QUERY_BLOCKED_CATEGORY", "{category}", $_SESSION["QUERY_BLOCKED_CATEGORY"]);
    $boot->set_list("BLOCKED_CATEGORY_LIMIT", "{rows}", $BLOCKED_CATEGORY_LIMITS, $_SESSION["BLOCKED_CATEGORY_LIMIT"]);
    $boot->set_button("{search}");
    $boot->set_CloseYahoo("YahooWin2");
    $boot->set_formdescription("{advanced_search_explain}");
    $boot->set_RefreshSearchs();
    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;
}
function parameters_section()
{
    $users = new usersMenus();
    $page = CurrentPageName();
    $boot = new boostrap_form();
    $squid = new squidbee();
    if (!$users->AsSquidAdministrator) {
        senderror("{ERROR_NO_PRIVS}");
        return;
    }
    $sock = new sockets();
    $SquidReverseDefaultWebSite = $sock->GET_INFO("SquidReverseDefaultWebSite");
    $SquidReverseDefaultCert = $sock->GET_INFO("SquidReverseDefaultWebSite");
    $EnableFreeWeb = $sock->GET_INFO("EnableFreeWeb");
    if ($SquidReverseDefaultWebSite == null) {
        $SquidReverseDefaultWebSite = $squid->visible_hostnameF();
    }
    if (!is_numeric($EnableFreeWeb)) {
        $EnableFreeWeb = 0;
    }
    $MySQLNgnixType = $sock->GET_INFO("MySQLNgnixType");
    if (!is_numeric($MySQLNgnixType)) {
        $MySQLNgnixType = 1;
    }
    $EnableNginxStats = $sock->GET_INFO("EnableNginxStats");
    if (!is_numeric($EnableNginxStats)) {
        $EnableNginxStats = 0;
    }
    $TuningParameters = unserialize(base64_decode($sock->GET_INFO("MySQLNginxParams")));
    $ListenPort = $TuningParameters["ListenPort"];
    $MySQLNginxWorkDir = $sock->GET_INFO("MySQLNginxWorkDir");
    if ($MySQLNginxWorkDir == null) {
        $MySQLNginxWorkDir = "/home/nginxdb";
    }
    $EnableNginx = $sock->GET_INFO("EnableNginx");
    if (!is_numeric($EnableNginx)) {
        $EnableNginx = 1;
    }
    $boot->set_formtitle("{global_parameters}");
    $boot->set_checkbox("EnableNginx", "{enable_nginx}", "{$EnableNginx}", array("TOOLTIP" => "{enable_nginx_text}"));
    $boot->set_checkbox("EnableFreeWeb", "{enable_freeweb}", $EnableFreeWeb, array("TOOLTIP" => "{enable_freeweb_text}"));
    $boot->set_checkbox("EnableArticaInNGINX", "{ArticaWebConsoleAsFrontEnd}", "{$EnableArticaInNGINX}");
    $boot->set_field("SquidReverseDefaultWebSite", "{default_website}", "{$SquidReverseDefaultWebSite}");
    $sql = "SELECT CommonName FROM sslcertificates ORDER BY CommonName";
    $q = new mysql();
    $sslcertificates[null] = "{default}";
    $results = $q->QUERY_SQL($sql, 'artica_backup');
    while ($ligneZ = mysql_fetch_array($results, MYSQL_ASSOC)) {
        $sslcertificates[$ligneZ["CommonName"]] = $ligneZ["CommonName"];
    }
    $boot->set_list("certificate_center", "{default_certificate}", $sslcertificates, $squid->certificate_center);
    $boot->set_button("{apply}");
    $form = $boot->Compile();
    $tpl = new templates();
    $button = button($tpl->_ENGINE_parse_body("{database_statistics_wizard}"), "Loadjs('MySQLNginx.wizard.php')");
    $array[1] = "{server}";
    $array[2] = "{client}";
    $DB[] = "\n\t<H3>{statistics_database}</H3>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td style='font-size:16px' width=1% nowrap>{type}:</td>\n\t\t<td style='font-size:16px;font-weight:bold'>{$array[$MySQLNgnixType]}</td>\n\t</tr>";
    if ($MySQLNgnixType == 1) {
        $DB[] = "\n\t<tr>\n\t\t<td style='font-size:16px' width=1% nowrap>{directory}:</td>\n\t\t<td style='font-size:16px;font-weight:bold'>{$MySQLNginxWorkDir}</td>\n\t</tr>\t\n\t<tr>\n\t\t<td style='font-size:16px' width=1% nowrap>{listen_port}:</td>\n\t\t<td style='font-size:16px;font-weight:bold'>{$ListenPort}</td>\n\t</tr>";
    } else {
        $DB[] = "\n\t\t<tr>\n\t\t<td style='font-size:16px' width=1% nowrap>{mysqlserver}:</td>\n\t\t<td style='font-size:16px;font-weight:bold'>{$TuningParameters["username"]}@{$TuningParameters["mysqlserver"]}:{$TuningParameters["RemotePort"]}</td>\n\t\t</tr>";
    }
    $DB[] = "<tr><td colspan=2 align='right'>{$button}</td></tr>";
    $DB[] = "</table>";
    $html = "<div class=form style='width:95%'>{$form}</div><div class=form style='width:95%'>" . $tpl->_ENGINE_parse_body(@implode("\n", $DB)) . "</div>";
    echo $html;
}
function active_directory_parameters()
{
    $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");
    $SquidNTLMKeepAlive = $sock->GET_INFO("SquidNTLMKeepAlive");
    $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($SquidNTLMKeepAlive)) {
        $SquidNTLMKeepAlive = 1;
    }
    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;
    }
    $boot = new boostrap_form();
    $boot->set_spacertitle("Active Directory");
    $boot->set_checkbox("EnableKerbAuth", "{EnableWindowsAuthentication}", $EnableKerbAuth, array("DISABLEALL" => true));
    $boot->set_list("KerbAuthMethod", "{authentication_method}", $arrayAuth, $KerbAuthMethod);
    $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("SquidNTLMKeepAlive", "{keep_alive}", $SquidNTLMKeepAlive, array("TOOLTIP" => "{SquidNTLMKeepAlive_explain}"));
    //$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_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));
    $boot->set_spacertitle("LDAP");
    $boot->set_spacerexplain("{ldap_ntlm_parameters_explain}");
    $boot->set_checkbox("UseDynamicGroupsAcls", "{use_dynamic_groups_acls}", $UseDynamicGroupsAcls);
    $boot->set_field("DynamicGroupsAclsTTL", "{TTL_CACHE}", $DynamicGroupsAclsTTL);
    $boot->set_field("LDAP_NONTLM_DOMAIN", "{non_ntlm_domain}", $arrayLDAP["LDAP_NONTLM_DOMAIN"]);
    $boot->set_field("LDAP_SERVER", "{hostname}", $arrayLDAP["LDAP_SERVER"]);
    $boot->set_field("LDAP_PORT", "{ldap_port}", $arrayLDAP["LDAP_PORT"]);
    $boot->set_field("LDAP_SUFFIX", "{suffix}", $arrayLDAP["LDAP_SUFFIX"]);
    $boot->set_field("LDAP_DN", "{bind_dn}", $arrayLDAP["LDAP_DN"]);
    $boot->set_fieldpassword("LDAP_PASSWORD", "{password}", $arrayLDAP["LDAP_PASSWORD"]);
    $boot->set_field("LDAP_RECURSIVE", "{recursive}", $arrayLDAP["LDAP_RECURSIVE"]);
    $cntlm_error = null;
    $EnableCNTLM = $sock->GET_INFO("EnableCNTLM");
    $CNTLMPort = $sock->GET_INFO("CnTLMPORT");
    if (!is_numeric($EnableCNTLM)) {
        $EnableCNTLM = 0;
    }
    if (!is_numeric($CNTLMPort)) {
        $CNTLMPort = 3155;
    }
    $boot->set_spacertitle("{APP_CNTLM}");
    if (!$users->CNTLM_INSTALLED) {
        $cntlm_error = "<p class=text-error>{CNTLM_NOT_INSTALLED}</p>";
    }
    $boot->set_spacerexplain("{APP_CNTLM_EXPLAIN}{$cntlm_error}");
    $boot->set_checkbox("EnableCNTLM", "{activate_CNTLM_service}", $EnableCNTLM);
    $boot->set_field("CnTLMPORT", "{listen_port}", $CNTLMPort, array("TOOLTIP" => "{CnTLMPORT_explain2}"));
    $boot->set_button("{apply}");
    if (!$users->AsSquidAdministrator or !$users->AsPostfixAdministrator) {
        $boot->set_form_locked();
    } else {
        $boot->set_Newbutton("{disconnect}", "Loadjs('squid.adker.php?diconnect-js=yes')");
        $boot->set_Newbutton("{restart_connection}", "Loadjs('squid.adker.php?join-js=yes')");
    }
    echo $boot->Compile();
}
function table_all_videos_search_popup()
{
    $boot = new boostrap_form();
    $q = new mysql_squid_builder();
    if (isset($_SESSION["QUERY_YOUTUBE_CATZ"])) {
        $testCatz = unserialize($_SESSION["QUERY_YOUTUBE_CATZ"]);
        if (!is_array($testCatz)) {
            unset($_SESSION["QUERY_YOUTUBE_CATZ"]);
        }
    }
    if (!isset($_SESSION["QUERY_YOUTUBE_CATZ"])) {
        $sql = "SELECT category  FROM youtube_objects GROUP BY category";
        $results = $q->QUERY_SQL($sql);
        $dayz[null] = "{select}";
        while ($ligne = mysql_fetch_assoc($results)) {
            $time = time_to_date(strtotime($ligne["filetime"] . " 00:00:00"));
            $dayz[$ligne["category"]] = $ligne["category"];
        }
        $_SESSION["QUERY_YOUTUBE_CATZ"] = serialize($dayz);
    }
    $LIMITS[50] = 50;
    $LIMITS[250] = 250;
    $LIMITS[500] = 250;
    $LIMITS[1000] = 1000;
    $LIMITS[2000] = 2000;
    if (!isset($_SESSION["QUERY_YOUTUBE_LIMIT"])) {
        $_SESSION["QUERY_YOUTUBE_LIMIT"] = 250;
    }
    $boot->set_list("QUERY_YOUTUBE_CATE", "{category}", unserialize($_SESSION["QUERY_YOUTUBE_CATZ"]), $_SESSION["QUERY_YOUTUBE_CATE"]);
    $boot->set_list("QUERY_YOUTUBE_LIMIT", "{rows}", $LIMITS, $_SESSION["QUERY_YOUTUBE_LIMIT"]);
    $boot->set_button("{search}");
    $boot->set_CloseYahoo("YahooWin2");
    $boot->set_formdescription("{advanced_search_explain}");
    $boot->set_RefreshSearchs();
    echo $boot->Compile();
}
function tasks_popup()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $users = new usersMenus();
    $tasks = new system_tasks();
    $PatternToHuman = null;
    $boot = new boostrap_form();
    $q = new mysql();
    $no_schedule_set = $tpl->javascript_parse_text("{no_schedule_set}");
    $buttontext = "{add}";
    $ID = $_GET["ID"];
    $t = $_GET["t"];
    $title = "{new_schedule}";
    $task_type = $tasks->tasks_array;
    if ($ID > 0) {
        $buttontext = "{apply}";
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM system_schedules WHERE ID={$ID}", "artica_backup"));
        $ligne["TimeDescription"] = utf8_encode($ligne["TimeDescription"]);
        $title = $task_type[$ligne["TaskType"]];
        $PatternToHuman = "<br>" . $tasks->PatternToHuman($ligne["TimeText"], true);
    }
    if (!is_numeric($ligne["TaskType"])) {
        $ligne["TaskType"] = 0;
    }
    if (!is_numeric($ID)) {
        $ID = 0;
    }
    if (!$users->KAV4PROXY_INSTALLED) {
        unset($task_type[5]);
        unset($task_type[12]);
    }
    if (!$users->UPDATE_UTILITYV2_INSTALLED) {
        unset($task_type[13]);
    }
    $task_type = $tasks->tasks_array;
    while (list($TaskType, $content) = each($task_type)) {
        $taskz[$TaskType] = "[{$TaskType}] " . $tpl->_ENGINE_parse_body($content);
    }
    $YahooWinHide = "YahooWin{$_GET["YahooWin"]}";
    $boot->set_formtitle($title);
    $boot->set_hidden("ID", $ID);
    if ($ID == 0) {
        if ($_GET["task-section"] > 0) {
            $boot->set_hidden("TaskType", $_GET["task-section"]);
            $boot->set_formdescription($tasks->tasks_explain_array[$_GET["task-section"]] . $PatternToHuman);
            $ligne["TimeDescription"] = $tpl->javascript_parse_text($tasks->tasks_array[$_GET["task-section"]]);
        } else {
            $boot->set_list("TaskType", "{type}", $taskz, null);
        }
        $ligne["enabled"] = 1;
    } else {
        $boot->set_hidden("TaskType", $ligne["TaskType"]);
        $boot->set_formdescription($tasks->tasks_explain_array[$ligne["TaskType"]]);
    }
    $boot->set_checkbox("enabled", "{enabled}", $ligne["enabled"]);
    $boot->set_textarea("TimeDescription", "{description}", $ligne["TimeDescription"], array("ENCODE" => true));
    $boot->set_field("TimeText", "{schedule}", $ligne["TimeText"], array("SCHEDULE" => true, "MANDATORY" => true, "DISABLED" => true));
    if ($ID == 0) {
        $boot->set_CloseYahoo($YahooWinHide);
    }
    //
    $boot->set_button($buttontext);
    $boot->set_RefreshSearchs();
    echo $boot->Compile();
}