Ejemplo n.º 1
0
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 category_settings()
{
    $q = new mysql_squid_builder();
    $dans = new dansguardian_rules();
    $lock = false;
    if ($_GET["cat"] != null) {
        $lock = true;
        $sql = "SELECT category_description,master_category FROM personal_categories WHERE category='{$_GET["cat"]}'";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
    }
    $groups = $dans->LoadBlackListesGroups();
    $groups[null] = "{select}";
    $boot = new boostrap_form();
    if (!$lock) {
        $boot->set_field("category-to-add", "{category}", null, array("ENCODE" => true));
        $boot->set_button("{add}");
        $boot->set_CloseYahoo("YahooWin5");
    } else {
        $boot->set_formtitle("{$_GET["cat"]}");
        $boot->set_hidden("category-to-add", $_GET["cat"]);
        $boot->set_button("{apply}");
    }
    $boot->set_textarea("category_text", "{description}", $ligne["category_description"], array("ENCODE" => true));
    $boot->set_list("group", "{group}", $groups, $ligne["master_category"]);
    $boot->set_field("CatzByGroupA", "{group} ({add})", null);
    $boot->set_RefreshSearchs();
    echo $boot->Compile();
}
Ejemplo n.º 3
0
function websites_popup_webserver_replace_popup()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $servername = $_GET["servername"];
    $q = new mysql_squid_builder();
    $title = "{new_rule}";
    $bt = "{add}";
    $ID = $_GET["replaceid"];
    $boot = new boostrap_form();
    $sock = new sockets();
    $servername = $_GET["servername"];
    if ($ID > 0) {
        $q = new mysql_squid_builder();
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM nginx_replace_www WHERE ID='{$ID}'"));
        $bt = "{apply}";
        $title = "{$ligne["rulename"]}";
        $ligne["stringtosearch"] = stripslashes($ligne["stringtosearch"]);
        $ligne["replaceby"] = stripslashes($ligne["replaceby"]);
        $servername = $ligne["servername"];
    }
    if ($ligne["tokens"] == null) {
        $ligne["tokens"] = "g";
    }
    if ($ligne["rulename"] == null) {
        $ligne["rulename"] = time();
    }
    $boot->set_hidden("replaceid", $ID);
    $boot->set_hidden("servername", $servername);
    $boot->set_formtitle($title);
    $boot->set_field("rulename", "{name}", $ligne["rulename"]);
    $boot->set_field("zorder", "{order}", $ligne["zorder"]);
    $boot->set_spacertitle("{search}");
    $boot->set_textarea("stringtosearch", "{search}", $ligne["stringtosearch"], array("MANDATORY" => true, "ENCODE" => true));
    $boot->set_checkbox("AsRegex", "{regex}", $ligne["AsRegex"], array("TOOLTIP" => "{replace_regex_explain}"));
    $boot->set_spacertitle("{replace}");
    $boot->set_textarea("replaceby", "{replace}", $ligne["replaceby"], array("MANDATORY" => true, "ENCODE" => true));
    $boot->set_field("tokens", "{flags}", $ligne["tokens"], array("MANDATORY" => true));
    $boot->set_button($bt);
    if ($ID == 0) {
        $boot->set_CloseYahoo("YahooWin3");
    }
    $boot->set_RefreshSearchs();
    $boot->set_formdescription("{nginx_subst_explain}");
    echo $boot->Compile();
}
Ejemplo n.º 4
0
function charter_settings()
{
    $ID = $_GET["ID"];
    $users = new usersMenus();
    $page = CurrentPageName();
    $sock = new sockets();
    $boot = new boostrap_form();
    $users = new usersMenus();
    $title = "Acceptable Use Policy";
    $btname = "{add}";
    if ($ID > 0) {
        $q = new mysql_squid_builder();
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT TextIntro,TextButton,title FROM itcharters WHERE ID='{$ID}'"));
        if (!$q->ok) {
            echo "<p class=text-error>{$q->mysql_error}</p>";
        }
        $title = $ligne["title"];
        $btname = "{apply}";
    }
    if ($ligne["TextIntro"] == null) {
        $ligne["TextIntro"] = "<p style='font-size:18px'>Please read the IT chart before accessing trough Internet</p>";
    }
    if ($ligne["TextButton"] == null) {
        $ligne["TextButton"] = "I accept the terms and conditions of this agreement";
    }
    $boot->set_formtitle($title);
    $boot->set_hidden("ID", $ID);
    $boot->set_field("title", "{page_title}", $title);
    $boot->set_textarea("TextIntro", "{introduction_text}", $ligne["TextIntro"], array("ENCODE" => true));
    $boot->set_field("TextButton", "{text_button}", $ligne["TextButton"], array("ENCODE" => true));
    if (!$users->AsDansGuardianAdministrator) {
        $boot->set_form_locked();
    }
    $boot->set_button($btname);
    if ($ID == 0) {
        $boot->set_CloseYahoo("YahooWin2");
    }
    $boot->set_RefreshSearchs();
    echo $boot->Compile();
}
Ejemplo n.º 5
0
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);
}
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();
}
Ejemplo n.º 7
0
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;
}
function tune()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $q = new mysql_squid_builder();
    $users = new usersMenus();
    $sock = new sockets();
    $SquidDBTuningParameters = unserialize(base64_decode($sock->GET_INFO("MySQLSyslogParams")));
    $query_cache_size = $SquidDBTuningParameters["query_cache_size"];
    $max_allowed_packet = $SquidDBTuningParameters["max_allowed_packet"];
    $max_connections = $SquidDBTuningParameters["max_connections"];
    $connect_timeout = $SquidDBTuningParameters["connect_timeout"];
    $interactive_timeout = $SquidDBTuningParameters["interactive_timeout"];
    $key_buffer_size = $SquidDBTuningParameters["key_buffer_size"];
    $table_open_cache = $SquidDBTuningParameters["table_open_cache"];
    $myisam_sort_buffer_size = $SquidDBTuningParameters["myisam_sort_buffer_size"];
    $ListenPort = $SquidDBTuningParameters["ListenPort"];
    $tmpdir = $SquidDBTuningParameters["tmpdir"];
    $serverMem = round(($users->MEM_TOTAL_INSTALLEE - 300) / 1024);
    if (!isset($SquidDBTuningParameters["net_read_timeout"])) {
        $SquidDBTuningParameters["net_read_timeout"] = 120;
    }
    $VARIABLES = $q->SHOW_VARIABLES();
    while (list($key, $value) = each($SquidDBTuningParameters)) {
        if (isset($SquidDBTuningParameters[$key])) {
            if ($GLOBALS["VERBOSE"]) {
                echo "VARIABLES[{$key}]={$VARIABLES[$key]} SquidDBTuningParameters[{$key}]={$SquidDBTuningParameters[$key]}<br>\n";
            }
            if ($VARIABLES[$key] == null) {
                $VARIABLES[$key] = $SquidDBTuningParameters[$key];
            }
        }
    }
    $read_buffer_size = round($VARIABLES["read_buffer_size"] / 1024 / 1000, 2);
    $read_rnd_buffer_size = round($VARIABLES["read_rnd_buffer_size"] / 1024 / 1000, 2);
    $sort_buffer_size = round($VARIABLES["sort_buffer_size"] / 1024 / 1000, 2);
    $thread_stack = round($VARIABLES["thread_stack"] / 1024 / 1000, 2);
    $join_buffer_size = round($VARIABLES["join_buffer_size"] / 1024 / 1000, 2);
    $max_tmp_table_size = round($VARIABLES["max_tmp_table_size"] / 1024 / 1000, 2);
    $innodb_log_buffer_size = round($VARIABLES["innodb_log_buffer_size"] / 1024 / 1000, 2);
    $innodb_additional_mem_pool_size = round($VARIABLES["innodb_additional_mem_pool_size"] / 1024 / 1000, 2);
    $innodb_log_buffer_size = round($VARIABLES["innodb_log_buffer_size"] / 1024 / 1000, 2);
    $innodb_buffer_pool_size = round($VARIABLES["innodb_buffer_pool_size"] / 1024 / 1000, 2);
    $max_connections = $VARIABLES["max_connections"];
    $per_thread_buffers = $sort_buffer_size + $read_rnd_buffer_size + $sort_buffer_size + $thread_stack + $join_buffer_size;
    $total_per_thread_buffers = $per_thread_buffers * $max_connections;
    if ($total_per_thread_buffers > $serverMem) {
        $color = "#EB0000";
    }
    $query_cache_size = round($VARIABLES["query_cache_size"] / 1024 / 1000, 2);
    $key_buffer_size = round($VARIABLES["key_buffer_size"] / 1024 / 1000, 2);
    if ($tmpdir == null) {
        $tmpdir = "/tmp";
    }
    $server_buffers = $key_buffer_size + $max_tmp_table_size + $innodb_buffer_pool_size + $innodb_additional_mem_pool_size + $innodb_log_buffer_size + $query_cache_size;
    if ($server_buffers > $serverMem) {
        $color = "#EB0000";
    }
    $max_used_memory = $server_buffers + $total_per_thread_buffers;
    if ($max_used_memory > $serverMem) {
        $color = "#EB0000";
    }
    $UNIT = "M";
    if ($max_used_memory > 1000) {
        $max_used_memory = round($max_used_memory / 1000, 2);
        $UNIT = "G";
    }
    if (!is_numeric($ListenPort)) {
        $ListenPort = 0;
    }
    $boot = new boostrap_form();
    $boot->set_hidden("innodb_buffer_pool_size", $innodb_buffer_pool_size);
    $boot->set_hidden("innodb_additional_mem_pool_size", $innodb_additional_mem_pool_size);
    $boot->set_hidden("innodb_log_buffer_size", $innodb_log_buffer_size);
    $boot->set_spacertitle("{threads}:");
    $boot->set_field("read_buffer_size", "{read_buffer_size} (MB)", $read_buffer_size);
    $boot->set_field("read_rnd_buffer_size", "{read_rnd_buffer_size} (MB)", $read_rnd_buffer_size);
    $boot->set_field("sort_buffer_size", "{sort_buffer_size} (MB)", $sort_buffer_size);
    $boot->set_field("thread_stack", "Thread Stack", $thread_stack);
    $boot->set_spacertitle("{server}:");
    $boot->set_field("ListenPort", "{listen_port}", $ListenPort);
    $boot->set_field("tmpdir", "{working_directory}", $tmpdir, array("BUTTON" => array("LABEL" => "{browse}", "JS" => "Loadjs('SambaBrowse.php?no-shares=yes&field=%f&no-hidden=yes')")));
    $boot->set_field("net_read_timeout", "{net_read_timeout} ({seconds})", $SquidDBTuningParameters["net_read_timeout"]);
    $boot->set_field("max_connections", "{max_connections}", $max_connections);
    $boot->set_field("key_buffer_size", "{key_buffer_size} (MB)", $key_buffer_size);
    $boot->set_field("max_tmp_table_size", "MAX TMP Table size (MB)", $max_tmp_table_size);
    $boot->set_field("query_cache_size", "{query_cache_size} (MB)", $query_cache_size);
    $boot->set_button("{apply}");
    $boot->set_formdescription("{$server_buffers}M + {$total_per_thread_buffers}M = {$max_used_memory}{$UNIT}");
    $boot->set_formtitle("{mysql_parameters}");
    $html = $boot->Compile();
    echo $tpl->_ENGINE_parse_body($html);
}
Ejemplo n.º 9
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();
}
Ejemplo n.º 10
0
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 rules_params()
{
    $boot = new boostrap_form();
    $sock = new sockets();
    $users = new usersMenus();
    $ldap = new clladp();
    $ID = $_GET["rules-params"];
    $title_button = "{add}";
    $title = "{new_authenticator_rule}";
    if ($ID > 0) {
        $sql = "SELECT * FROM authenticator_rules WHERE ID='{$ID}'";
        $q = new mysql_squid_builder();
        $ligne = @mysql_fetch_array($q->QUERY_SQL($sql));
        $title_button = "{apply}";
        $title = $ligne["rulename"];
    }
    $boot->set_formtitle($title);
    $boot->set_hidden("ruleid", $ID);
    $boot->set_field("rulename", "{rulename}", $ligne["rulename"], array("ENCODE" => true));
    $boot->set_field("cachetime", "{cachetime} ({minutes})", $ligne["cachetime"], array("TOOLTIP" => "{authenticator_cache_time_explain}"));
    $boot->set_textarea("explain", "{explain}", $ligne["explain"], array("ENCODE" => true));
    $boot->set_button($title_button);
    $AdminPrivs = AdminPrivs();
    if (!$AdminPrivs) {
        $boot->set_form_locked();
    }
    if ($ID == 0) {
        $boot->set_CloseYahoo("YahooWin2");
    }
    $boot->set_RefreshSearchs();
    echo $boot->Compile();
}
Ejemplo n.º 12
0
function wizard_popup()
{
    $boot = new boostrap_form();
    $tpl = new templates();
    $ID = $_GET["ID"];
    $sock = new sockets();
    $ApacheDisableModDavFS = $sock->GET_INFO("ApacheDisableModDavFS");
    if (!is_numeric($ApacheDisableModDavFS)) {
        $ApacheDisableModDavFS = 0;
    }
    $users = new usersMenus();
    $q = new mysql();
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT maxsize FROM storage_containers WHERE `groupid`='" . mysql_escape_string2($_GET["gpid"]) . "'", "artica_backup"));
    $maxsize = $ligne["maxsize"];
    if ($maxsize == 0) {
        $maxsizeText = $tpl->_ENGINE_parse_body("{unlimited} ");
    } else {
        $maxsizeText = $maxsize;
    }
    if ($maxsize > 0) {
        if ($ID == 0) {
            $uidenc = mysql_escape_string2($_SESSION["uid"]);
            $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(container_size) as tSize FROM users_containers WHERE `uid`='{$uidenc}'", "artica_backup"));
            $tSize = $ligne["tSize"];
            if ($tSize >= $maxsize) {
                senderror("{error_quota_exceed}");
            }
        }
    }
    $ligne = array();
    if ($ID > 0) {
        $q = new mysql();
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM users_containers WHERE `container_id`='{$ID}'", "artica_backup"));
        $boot->set_formtitle("{$ligne["container_name"]} ({$ligne["container_size"]}MB)");
    }
    if ($ligne["container_name"] == null) {
        $ligne["container_name"] = $tpl->_ENGINE_parse_body("{new_container}");
    }
    if ($maxsize > 0) {
        if (!is_numeric($ligne["container_size"])) {
            $ligne["container_size"] = $maxsize;
        }
    }
    $new_container_user_explain = $tpl->_ENGINE_parse_body("{new_container_user_explain}");
    $new_container_user_explain = str_replace("%S", $maxsize, $new_container_user_explain);
    if ($ID == 0) {
        $boot->set_formdescription($new_container_user_explain);
    }
    $boot->set_hidden("gpid", $_GET["gpid"]);
    $boot->set_hidden("ID", $_GET["ID"]);
    $boot->set_field("container_name", "{container_name}", $ligne["container_name"], array("ENCODE" => true));
    if ($ID == 0) {
        $boot->set_field("container_size", "{container_size}", $ligne["container_size"], array("TOOLTIP" => "{container_size_explain}"));
    } else {
        $boot->set_hidden("container_size", $ligne["container_size"]);
    }
    $webdav_creds = unserialize(base64_decode($ligne["webdav_creds"]));
    if ($webdav_creds["username"] == null) {
        $webdav_creds["username"] = $_SESSION["uid"];
    }
    if ($ApacheDisableModDavFS == 0) {
        $boot->set_checkbox("webdav", "{http_sharing}", $ligne["webdav"], array("TOOLTIP" => "{container_http_sharing_explain}"));
    }
    if ($users->ISCSI_INSTALLED) {
        if (!is_numeric($ligne["iscsid"])) {
            $ligne["iscsid"] = 0;
        }
        $boot->set_checkbox("iscsid", "{network_disk}", $ligne["iscsid"], array("TOOLTIP" => "{container_iscsid_sharing_explain}"));
    }
    $lengthpass = strlen($webdav_creds["password"]);
    $boot->set_field("webdav_username", "{username}", $webdav_creds["username"], array("ENCODED" => true));
    $boot->set_fieldpassword("webdav_password", "{password} ({$lengthpass} chars)", $webdav_creds["password"], array("ENCODED" => true));
    if ($ID == 0) {
        $boot->set_button("{create}");
    } else {
        $boot->set_button("{apply}");
    }
    $boot->set_RefreshSearchs();
    $boot->set_RefreshSearchsForced();
    echo $boot->Compile();
}
Ejemplo n.º 13
0
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 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();
}
Ejemplo n.º 15
0
function firewall_popup()
{
    $ID = $_GET["ID"];
    $q = new mysql_squid_builder();
    $bt = "{apply}";
    $servername = $_GET["servername"];
    if (!$q->TABLE_EXISTS("nginx_exploits_fw")) {
        $sql = "CREATE TABLE IF NOT EXISTS `nginx_exploits_fw` (\n\t\t`servername` CHAR(255) NOT NULL  PRIMARY KEY,\n\t\t`maxaccess` smallint(1)  NOT NULL DEFAULT 0,\n\t\t`sendlogs` smallint(1)  NOT NULL DEFAULT 0,\n\t\tKEY `maxaccess` (`maxaccess`),\n\t\tKEY `sendlogs` (`sendlogs`)\n\t\t)  ENGINE = MYISAM;";
        if (!$q->QUERY_SQL($sql)) {
            echo $q->mysql_error_html();
        }
    }
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM nginx_exploits_fw WHERE servername='{$servername}'"));
    if (!is_numeric($ligne["maxaccess"])) {
        $ligne["maxaccess"] = 0;
    }
    $boot = new boostrap_form();
    $sock = new sockets();
    $boot->set_hidden("servername", $_GET["servername"]);
    $boot->set_hidden("firewall", $_GET["servername"]);
    $boot->set_formtitle("{firewall}");
    $boot->set_formdescription("{NGINX_FW_EXPLAIN}");
    $boot->set_field("maxaccess", "{MAX_EVENTS}", $ligne["maxaccess"], array("TOOLTIP" => "{NGINX_MAXACCESS_FW_EXPLAIN}"));
    $boot->set_checkbox("sendlogs", "{write_logs}", $ligne["sendlogs"]);
    $boot->set_button($bt);
    if ($ID == 0) {
        $boot->set_CloseYahoo("YahooWin4");
    }
    $boot->set_RefreshSearchs();
    echo $boot->Compile();
}
Ejemplo n.º 16
0
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();
}
Ejemplo n.º 17
0
function replace_group_popup()
{
    $ID = $_GET["ID"];
    $q = new mysql_squid_builder();
    $title = "{new_group}";
    $bt = "{add}";
    $boot = new boostrap_form();
    $sock = new sockets();
    if ($ID > 0) {
        $q = new mysql_squid_builder();
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM nginx_replace_group WHERE ID='{$ID}'"));
        $bt = "{apply}";
        $title = "{$ligne["groupname"]}";
    }
    if ($ligne["groupname"] == null) {
        $ligne["groupname"] = "New Group";
    }
    $boot->set_hidden("editgroupid", $ID);
    $boot->set_formtitle($title);
    $boot->set_field("groupname", "{groupname}", $ligne["groupname"]);
    $boot->set_button($bt);
    if ($ID == 0) {
        $boot->set_CloseYahoo("YahooWin");
    }
    $boot->set_RefreshSearchs();
    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();
}
Ejemplo n.º 19
0
function subrules_popup()
{
    $ruleid = $_GET["rule-id"];
    $ID = $_GET["subrule"];
    $users = new usersMenus();
    $page = CurrentPageName();
    $tpl = new templates();
    $t = time();
    $buttonname = "{add}";
    $boot = new boostrap_form();
    if ($ID > 0) {
        $q = new mysql();
        $sql = "SELECT *  FROM iproute_rules WHERE ID={$ID}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
        $title = $tpl->_ENGINE_parse_body("{$ID}::{$ligne["src"]} - {$ligne["destination"]}");
        $buttonname = "{apply}";
    } else {
        $boot->set_CloseYahoo("YahooWin3");
    }
    if (!is_numeric($ligne["enable"])) {
        $ligne["enable"] = 1;
    }
    $boot->set_formtitle($title);
    $boot->set_formdescription("{iprules_explain}");
    $boot->set_hidden("subruleid", $ID);
    $boot->set_hidden("ruleid", $ruleid);
    $boot->set_field("src", "{source}", $ligne["source"]);
    $boot->set_field("destination", "{destination}", $ligne["destination"]);
    $boot->set_field("priority", "{priority}", $ligne["priority"]);
    $boot->set_checkbox("enable", "{enabled}", $ligne["enable"]);
    $users = new usersMenus();
    if (!$users->AsSystemAdministrator) {
        $boot->set_form_locked();
    }
    $boot->set_button($buttonname);
    $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();
}
Ejemplo n.º 21
0
function cache_popup()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $servername = $_GET["servername"];
    $q = new mysql_squid_builder();
    $title = "{new_cache}";
    $bt = "{add}";
    $ID = $_GET["ID"];
    $boot = new boostrap_form();
    $sock = new sockets();
    $NginxProxyStorePath = $sock->GET_INFO("NginxProxyStorePath");
    if ($NginxProxyStorePath == null) {
        $NginxProxyStorePath = "/home/nginx";
    }
    if ($ID > 0) {
        $q = new mysql_squid_builder();
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM nginx_caches WHERE ID='{$ID}'"));
        $bt = "{apply}";
        $title = "{$ligne["keys_zone"]}";
    }
    if ($ligne["keys_zone"] == null) {
        $ligne["keys_zone"] = time();
    }
    if (trim($ligne["directory"]) == null) {
        $ligne["directory"] = $NginxProxyStorePath . "/{$ligne["keys_zone"]}";
    }
    if ($ligne["levels"] == null) {
        $ligne["levels"] = "1:2";
    }
    if (!is_numeric($ligne["keys_zone_size"])) {
        $ligne["keys_zone_size"] = 1;
    }
    if (!is_numeric($ligne["max_size"])) {
        $ligne["max_size"] = 2;
    }
    if (!is_numeric($ligne["inactive"])) {
        $ligne["inactive"] = 10;
    }
    if (!is_numeric($ligne["loader_files"])) {
        $ligne["loader_files"] = 100;
    }
    if (!is_numeric($ligne["loader_sleep"])) {
        $ligne["loader_sleep"] = 10;
    }
    if (!is_numeric($ligne["loader_threshold"])) {
        $ligne["loader_threshold"] = 100;
    }
    $boot->set_hidden("ID", $ID);
    $boot->set_formtitle($title);
    $boot->set_field("keys_zone", "{name}", $ligne["keys_zone"]);
    $boot->set_field("directory", "{directory}", $ligne["directory"], array("BROWSE" => true, "MANDATORY" => true, "ENCODE" => true));
    $boot->set_field("levels", "{levels}", $ligne["levels"]);
    $boot->set_field("keys_zone_size", "{memory_size} (MB)", $ligne["keys_zone_size"]);
    $boot->set_field("max_size", "{max_size} (GB)", $ligne["max_size"]);
    $boot->set_field("inactive", "{inactive} ({minutes})", $ligne["inactive"], array("TOOLTIP" => "{nginx_inactive_explain}"));
    $boot->set_field("loader_files", "{loader_files}", $ligne["loader_files"]);
    $boot->set_field("loader_sleep", "{loader_sleep} {milliseconds}", $ligne["loader_sleep"]);
    $boot->set_field("loader_threshold", "{loader_threshold} {milliseconds}", $ligne["loader_threshold"]);
    $boot->set_button($bt);
    if ($servername == null) {
        $boot->set_CloseYahoo("YahooWin");
    }
    $boot->set_RefreshSearchs();
    if (!AdminPrivs()) {
        $boot->set_form_locked();
    }
    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()
{
    $users = new usersMenus();
    $sock = new sockets();
    $boot = new boostrap_form();
    $boot->set_formtitle("{logs_retention}");
    $boot->set_formdescription("{squid_logs_retention_explain}");
    $BackupMaxDays = $sock->GET_INFO("BackupMaxDays");
    $BackupMaxDaysDir = $sock->GET_INFO("BackupMaxDaysDir");
    if ($BackupMaxDaysDir == null) {
        $BackupMaxDaysDir = "/home/logrotate_backup";
    }
    $BackupSquidLogsUseNas = $sock->GET_INFO("BackupSquidLogsUseNas");
    $BackupSquidLogsNASIpaddr = $sock->GET_INFO("BackupSquidLogsNASIpaddr");
    $BackupSquidLogsNASFolder = $sock->GET_INFO("BackupSquidLogsNASFolder");
    $BackupSquidLogsNASUser = $sock->GET_INFO("BackupSquidLogsNASUser");
    $BackupSquidLogsNASPassword = $sock->GET_INFO("BackupSquidLogsNASPassword");
    if (!is_numeric($BackupSquidLogsUseNas)) {
        $BackupSquidLogsUseNas = 0;
    }
    if (!is_numeric($BackupMaxDays)) {
        $BackupMaxDays = 30;
    }
    $MySQLSyslogType = $sock->GET_INFO("MySQLSyslogType");
    if (!is_numeric($MySQLSyslogType)) {
        $MySQLSyslogType = 1;
    }
    $boot->set_field("BackupMaxDays", "{max_day_in_database}", $BackupMaxDays, array("TOOLTIP" => "{syslog_max_day_in_database_explain}"));
    $boot->set_field("BackupMaxDaysDir", "{backup_folder}", $BackupMaxDaysDir, array("BROWSE" => true, "TOOLTIP" => "{syslog_backup_folder_explain}"));
    $boot->set_spacertitle("{NAS_storage}");
    $boot->set_checkbox("BackupSquidLogsUseNas", "{use_remote_nas}", $BackupSquidLogsUseNas, array("TOOLTIP" => "{BackupSquidLogsUseNas_explain}", "LINK" => "BackupSquidLogsNASIpaddr,BackupSquidLogsNASFolder,BackupSquidLogsNASUser,BackupSquidLogsNASPassword"));
    $boot->set_field("BackupSquidLogsNASIpaddr", "{hostname}", $BackupSquidLogsNASIpaddr);
    $boot->set_field("BackupSquidLogsNASFolder", "{shared_folder}", $BackupSquidLogsNASFolder, array("ENCODE" => true));
    $boot->set_field("BackupSquidLogsNASUser", "{username}", $BackupSquidLogsNASUser, array("ENCODE" => true));
    $boot->set_fieldpassword("BackupSquidLogsNASPassword", "{password}", $BackupSquidLogsNASPassword, array("ENCODE" => true));
    $boot->set_button("{apply}");
    if ($MySQLSyslogType != 1) {
        $boot->set_spacerexplain("{MySQLSyslogTypediff_explain}");
        $boot->set_form_locked();
    }
    if (!$users->AsSquidAdministrator) {
        $boot->set_form_locked();
    }
    $t = time();
    $page = CurrentPageName();
    echo $boot->Compile() . "<hr>\n\t<div id='{$t}'></div>\n\t<script>\n\t\tLoadAjax('{$t}','{$page}?mysql-syslogs-status=yes');\n\t</script>\t\t\n\t";
}
Ejemplo n.º 24
0
function item_config()
{
    $ldap = new clladp();
    $tpl = new templates();
    $id = $_GET["item-id"];
    if (!is_numeric($id)) {
        $id = 0;
    }
    $t = $_GET["t"];
    if (!is_numeric($t)) {
        $t = time();
    }
    $bname = "{add}";
    $page = CurrentPageName();
    $explian = "<div class=text-info style='font-size:14px'>{ADD_DNS_ENTRY_TEXT}</div>";
    $q = new mysql();
    if ($id > 0) {
        $bname = "{apply}";
        $sql = "SELECT * FROM records WHERE id={$id}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "powerdns"));
        $hostname = $ligne["name"];
        $tr = explode(".", $hostname);
        $computername = $tr[0];
        unset($tr[0]);
        $DnsZoneNameV = @implode(".", $tr);
        $DnsType = $ligne["type"];
        $ComputerIP = $ligne["content"];
        $ttl = $ligne["ttl"];
        $prio = $ligne["prio"];
        $explainthis = $ligne["explainthis"];
        $domain_id = $ligne["domain_id"];
        $ligneZ = mysql_fetch_array($q->QUERY_SQL("SELECT name FROM domains WHERE id={$domain_id}", "powerdns"));
        $DnsZoneName = $ligneZ["name"];
    }
    if (!is_numeric($domain_id)) {
        $domain_id = 0;
    }
    $dnstypeTable = array("" => "{select}", "MX" => "{mail_exchanger}", "A" => "{dnstypea}");
    $DnsType = Field_array_Hash($dnstypeTable, "DnsType", $DnsType, null, null, 0, null);
    $ERROR_VALUE_MISSING_PLEASE_FILL_THE_FORM = $tpl->javascript_parse_text('{ERROR_VALUE_MISSING_PLEASE_FILL_THE_FORM}');
    $addDomain = imgtootltip("plus-24.png", "{new_dnsdomain}", "Loadjs('postfix.transport.table.php?localdomain-js=yes&domain=&t={$t}&callback=RefreshFieldDomain{$t}')");
    if (!$users->AsSystemAdministrator) {
        if (!$users->AsDnsAdministrator) {
            $ldap = new clladp();
            $addDomain = null;
        }
    }
    if ($ttl == null) {
        $ttl = 8600;
    }
    if (!is_numeric($prio)) {
        $prio = 0;
    }
    $boot = new boostrap_form();
    $boot->set_field("ComputerIP", "{computer_ip}", $ComputerIP);
    if ($domain_id > 0) {
        $boot->set_field("DnsZoneName", "{DnsZoneName}", $DnsZoneName, array("DISABLED" => true));
    } else {
        $boot->set_field("DnsZoneName", "{DnsZoneName}", $DnsZoneName);
    }
    $boot->set_field("computername", "{computer_name}", $computername);
    $boot->set_field("TTL", "TTL", $ttl);
    $boot->set_field("PRIO", "PRIO", $prio);
    $boot->set_field("explainthis", "{explain}", $explainthis, array("ENCODE" => true));
    $boot->set_button($bname);
    $boot->set_hidden("id", $id);
    $boot->set_RefreshSearchs();
    $boot->set_formtitle("{record}");
    $form = $boot->Compile();
    echo $tpl->_ENGINE_parse_body($form);
}
function NewipaddrLink_popup()
{
    $tpl = new templates();
    $_GET["ipaddr"] = trim($_GET["ipaddr"]);
    $q = new mysql_squid_builder();
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM webfilters_ipaddr WHERE ipaddr='{$_GET["ipaddr"]}'"));
    $boot = new boostrap_form();
    if ($_GET["ipaddr"] == null) {
        $boot->set_field("ipaddr", "{ipaddr}", null, array("MANDATORY" => true, "IPV4" => true));
    } else {
        $boot->set_formtitle("{ipaddr}:{$_GET["ipaddr"]}");
        $boot->set_hidden("ipaddr", $_GET["ipaddr"]);
        $ips = array();
        $linkstats = "<div style='width:100%'>\n\t\t\t\t<a href=\"javascript:blur();\" \n\t\t\t\tOnClick=\"javascript:miniadm.squid.ipaddrbrowser.php?visits-day-js={$_GET["ipaddr"]}');>{statistics}</a></div>";
    }
    $linkstats = null;
    $boot->set_hidden("save-ipaddr", 'yes');
    $boot->set_field("uid", "{member}", $ligne["uid"], array("MANDATORY" => true));
    $boot->set_field("hostname", "{hostname}", $ligne["hostname"]);
    $boot->set_button("{add}");
    $boot->set_RefreshSearchs();
    echo $boot->Compile();
}
function settings()
{
    $schedules = new system_tasks();
    $q = new mysql_squid_builder();
    $tpl = new templates();
    $buttontext = "{apply}";
    $ID = $_GET["ID"];
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM webfilters_schedules WHERE ID={$ID}"));
    $ligne["TimeDescription"] = utf8_encode($ligne["TimeDescription"]);
    $TimeText = $tpl->_ENGINE_parse_body($schedules->PatternToHuman($ligne["TimeText"]));
    $TimeText = str_replace("<br>", "", $TimeText);
    $explain = $tpl->_ENGINE_parse_body($q->tasks_explain_array[$ligne["TaskType"]]);
    $boot = new boostrap_form();
    $boot->set_hidden("ID", $ID);
    $boot->set_checkbox("enabled", "{enabled}", $ligne["enabled"]);
    $boot->set_field("TimeDescription", "{description}", $ligne["TimeDescription"], array("ENCODE" => TRUE));
    $boot->set_button("{apply}");
    $boot->set_formtitle("{task} {$ligne["ID"]}");
    $runtask = $tpl->_ENGINE_parse_body("<div style='text-align:right'><i class='icon-play'></i> <a href=\"javascript:Blurz();\" OnClick=\"javascript:Loadjs('miniadm.ajax.squid.schedules.php?schedule-run-js=yes&ID={$ID}');\">{run} {task}</div>");
    $boot->set_formdescription("{$explain}<br>{$TimeText}{$runtask}");
    $boot->set_RefreshSearchs();
    echo $boot->Compile();
}
Ejemplo n.º 27
0
function proxy_behavior()
{
    $boot = new boostrap_form();
    $boot->set_formtitle("{proxy_behavior}");
    $boot->set_formdescription("{proxy_behavior_explain}");
    $sock = new sockets();
    $exclusive_internet_proxy = 1;
    $exclusive_reverse_proxy = 0;
    $mixed_mode = 0;
    $SquidActHasReverse = $sock->GET_INFO("SquidActHasReverse");
    $SquidActHasReverseOnly = $sock->GET_INFO("SquidActHasReverseOnly");
    if (!is_numeric($SquidActHasReverse)) {
        $SquidActHasReverse = 0;
    }
    if (!is_numeric($SquidActHasReverseOnly)) {
        $SquidActHasReverseOnly = 0;
    }
    if ($SquidActHasReverseOnly == 1) {
        $exclusive_internet_proxy = 0;
        $exclusive_reverse_proxy = 1;
        $mixed_mode = 0;
    }
    if ($SquidActHasReverseOnly == 0) {
        if ($SquidActHasReverse == 1) {
            $exclusive_internet_proxy = 0;
            $exclusive_reverse_proxy = 0;
            $mixed_mode = 1;
        }
    }
    $boot->set_checkbox("exclusive_reverse_proxy", "{exclusive_reverse_proxy}", $exclusive_reverse_proxy);
    $boot->set_checkbox("exclusive_internet_proxy", "{exclusive_internet_proxy}", $exclusive_internet_proxy);
    $boot->set_checkbox("mixed_mode", "{mixed_mode}", $mixed_mode);
    $boot->set_button("{apply}");
    echo $boot->Compile();
}
function NewMacLink_popup()
{
    $tpl = new templates();
    $_GET["MAC"] = trim($_GET["MAC"]);
    if ($_GET["MAC"] != null) {
        if (!IsPhysicalAddress($_GET["MAC"])) {
            unset($_GET["MAC"]);
        }
    } else {
        unset($_GET["MAC"]);
    }
    $q = new mysql_squid_builder();
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM webfilters_nodes WHERE MAC='{$_GET["MAC"]}'"));
    $boot = new boostrap_form();
    if ($_GET["MAC"] == null) {
        $boot->set_field("MAC", "{MAC}", null, array("MANDATORY" => true, "BUTTON" => array("JS" => "Loadjs('miniadm.squid.macbrowser.php?field=%f')", "LABEL" => $tpl->_ENGINE_parse_body("{browse}"))));
    } else {
        $boot->set_formtitle("{MAC}:{$_GET["MAC"]}");
        $boot->set_hidden("MAC", $_GET["MAC"]);
        $ips = array();
        $results2 = $q->QUERY_SQL("SELECT ipaddr FROM members_macip WHERE MAC='{$_GET["MAC"]}' ORDER BY ipaddr");
        while ($ligne2 = mysql_fetch_assoc($results2)) {
            $ips[] = $ligne2["ipaddr"];
        }
        if (count($ips) > 0) {
            $boot->set_formdescription(@implode(", ", $ips));
        }
        $linkstats = "<div style='width:100%'>\n\t\t\t\t<a href=\"javascript:blur();\" \n\t\t\t\tOnClick=\"javascript:miniadm.squid.macbrowser.php?visits-day-js={$_GET["MAC"]}');>{statistics}</a></div>";
    }
    $boot->set_hidden("save-mac", 'yes');
    $boot->set_field("hostname", "{hostname}", $ligne["hostname"]);
    $boot->set_field("uid", "{member}", $ligne["uid"], array("MANDATORY" => true));
    $boot->set_button("{add}");
    $boot->set_RefreshSearchs();
    echo $boot->Compile();
}
function group_popup()
{
    $ID = $_GET["ID"];
    $q = new mysql_squid_builder();
    $title = "{new_group}";
    $bt = "{add}";
    $q = new mysql_squid_builder();
    if (!$q->TABLE_EXISTS("nginx_exploits_groups")) {
        $sql = "CREATE TABLE IF NOT EXISTS `nginx_exploits_groups` (\n\t\t\t  `ID` INT NOT NULL AUTO_INCREMENT,\n\t\t\t  `groupname` CHAR(255)  NOT NULL,\n\t\t\t  PRIMARY KEY (`ID`),\n\t\t\t  KEY `groupname` (`groupname`)\n\t\t\t)  ENGINE = MYISAM;";
        if (!$q->QUERY_SQL($sql)) {
            echo $q->mysql_error_html();
        }
    }
    $boot = new boostrap_form();
    $sock = new sockets();
    if ($ID > 0) {
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM nginx_exploits_groups WHERE ID='{$ID}'"));
        $bt = "{apply}";
        $title = "{$ligne["groupname"]}";
    }
    $boot->set_hidden("editgroupid", $ID);
    $boot->set_hidden("servername", $_GET["servername"]);
    $boot->set_formtitle($title);
    $boot->set_field("groupname", "{groupname}", $ligne["groupname"]);
    if ($ID == 0) {
        $boot->set_checkbox("addef", "{add_defaults}", 0);
    }
    $boot->set_button($bt);
    if ($ID == 0) {
        $boot->set_CloseYahoo("YahooWin5");
    }
    $boot->set_RefreshSearchs();
    echo $boot->Compile();
}
Ejemplo n.º 30
0
function settings_retention()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $users = new usersMenus();
    if ($users->CORP_LICENSE) {
        $LICENSE = 1;
    } else {
        $LICENSE = 0;
    }
    $ArticaProxyStatisticsBackupFolder = $sock->GET_INFO("ArticaProxyStatisticsBackupFolder");
    $ArticaProxyStatisticsBackupDays = $sock->GET_INFO("ArticaProxyStatisticsBackupDays");
    $ArticaProxyStatisticsBackHourTables = $sock->GET_INFO("ArticaProxyStatisticsBackHourTables");
    if (!is_numeric($ArticaProxyStatisticsBackHourTables)) {
        $ArticaProxyStatisticsBackHourTables = 1;
    }
    if ($ArticaProxyStatisticsBackupFolder == null) {
        $ArticaProxyStatisticsBackupFolder = "/home/artica/squid/backup-statistics";
    }
    $q = new mysql_squid_builder();
    if (!is_numeric($ArticaProxyStatisticsBackupDays)) {
        $ArticaProxyStatisticsBackupDays = 90;
    }
    if (!$users->CORP_LICENSE) {
        $error = "<p class=text-error>{this_feature_is_disabled_corp_license}</p>";
        $ArticaProxyStatisticsBackupDays = 5;
    }
    $t = time();
    $new_schedule = $tpl->javascript_parse_text("{new_schedule}");
    $EnableSquidRemoteMySQL = $sock->GET_INFO("EnableSquidRemoteMySQL");
    if (!is_numeric($EnableSquidRemoteMySQL)) {
        $EnableSquidRemoteMySQL = 0;
    }
    if ($EnableSquidRemoteMySQL == 1) {
        $EnableSquidRemoteMySQL_text = "{EnableSquidRemoteMySQL_text}";
    }
    $lock = false;
    $boot = new boostrap_form();
    $boot->set_formdescription($EnableSquidRemoteMySQL_text . "<br>{purge_statistics_database_explain2}");
    $boot->set_checkbox("ArticaProxyStatisticsBackHourTables", "{backup_hourly_tables}", $ArticaProxyStatisticsBackHourTables, array("TOOLTIP" => "{backup_hourly_tables_explain}"));
    $boot->set_field("ArticaProxyStatisticsBackupFolder", "{backup_folder}", $ArticaProxyStatisticsBackupFolder, array("BROWSE" => true));
    $boot->set_field("ArticaProxyStatisticsBackupDays", "{max_days}", $ArticaProxyStatisticsBackupDays);
    $BackupSquidStatsUseNas = $sock->GET_INFO("BackupSquidStatsUseNas");
    $BackupSquidStatsNASIpaddr = $sock->GET_INFO("BackupSquidStatsNASIpaddr");
    $BackupSquidStatsNASFolder = $sock->GET_INFO("BackupSquidStatsNASFolder");
    $BackupSquidStatsNASUser = $sock->GET_INFO("BackupSquidStatsNASUser");
    $BackupSquidStatsNASPassword = $sock->GET_INFO("BackupSquidStatsNASPassword");
    $BackupSquidStatsNASRetry = $sock->GET_INFO("BackupSquidStatsNASRetry");
    if (!is_numeric($BackupSquidStatsUseNas)) {
        $BackupSquidStatsUseNas = 0;
    }
    if (!is_numeric($BackupSquidStatsNASRetry)) {
        $BackupSquidStatsNASRetry = 0;
    }
    $boot->set_spacertitle("{NAS_storage}");
    $boot->set_checkbox("BackupSquidStatsUseNas", "{use_remote_nas}", $BackupSquidStatsUseNas, array("TOOLTIP" => "{BackupSquidStatsUseNas_explain}", "LINK" => "BackupSquidStatsNASIpaddr,BackupSquidStatsNASFolder,BackupSquidStatsNASUser,BackupSquidStatsNASPassword"));
    $boot->set_field("BackupSquidStatsNASIpaddr", "{hostname}", $BackupSquidStatsNASIpaddr);
    $boot->set_field("BackupSquidStatsNASFolder", "{shared_folder}", $BackupSquidStatsNASFolder, array("ENCODE" => true));
    $boot->set_field("BackupSquidStatsNASUser", "{username}", $BackupSquidStatsNASUser, array("ENCODE" => true));
    $boot->set_fieldpassword("BackupSquidStatsNASPassword", "{password}", $BackupSquidStatsNASPassword, array("ENCODE" => true));
    $boot->set_checkbox("BackupSquidStatsNASRetry", "{retry}", $BackupSquidStatsNASRetry, array("TOOLTIP" => "{BackupSquidLogsNASRetry_explain}"));
    $boot->set_button("{apply}");
    $boot->set_formtitle("{purge_statistics_database}");
    if (!$users->CORP_LICENSE) {
        $boot->set_form_locked();
        $lock = true;
    }
    if ($EnableSquidRemoteMySQL == 1) {
        $boot->set_form_locked();
        $lock = true;
    }
    $new_schedule = $tpl->javascript_parse_text("{new_schedule}");
    if (!$lock) {
        $boot->set_Newbutton("{new_schedule}", "YahooWin3('650','squid.databases.schedules.php?AddNewSchedule-popup=yes&ID=0&t={$t}&ForceType=47&YahooWin=3&jsback=ReloadSchedules{$t}','{$new_schedule}')");
        $ReloadSchedules = "ReloadSchedules{$t}()";
    }
    $boot->set_Newbutton("{test_connection}", "Loadjs('{$page}?test-nas-js=yes')");
    $form = $boot->Compile();
    $html = "\n\n\t\t<div id='title-{$t}'></div>\n\t\t{$error}\n\t\t{$form}\n\t\t<div id='schedules-{$t}'></div>\n\n\t\t<script>\n\t\tfunction ReloadSchedules{$t}(){\n\t\tLoadAjax('schedules-{$t}','squid.artica.statistics.purge.php?schedules=yes');\n}\n\nfunction RefreshTableTitle{$t}(){\nLoadAjaxTiny('title-{$t}','squid.artica.statistics.purge.php?title=yes&t={$t}');\n}\nRefreshTableTitle{$t}();\n{$ReloadSchedules};\n</script>\n\n";
    echo $tpl->_ENGINE_parse_body($html);
}