function mysql_squid_builder($local = false)
 {
     $LDAP_EXTERNAL_AUTH = 0;
     if (function_exists("getLocalTimezone")) {
         @date_default_timezone_set(getLocalTimezone());
     }
     if (!class_exists("Bs_IniHandler")) {
         include_once dirname(__FILE__) . "/class.ini.inc";
     }
     if (!class_exists("sockets")) {
         include_once dirname(__FILE__) . "/class.sockets.inc";
     }
     $ini = new Bs_IniHandler();
     if (!isset($GLOBALS["SQUID_MEMORYCONF"]["INI_ARRAY"])) {
         $sock = new sockets();
         $ini->loadString($sock->GET_INFO('ArticaSquidParameters'));
         if (isset($ini->_params)) {
             $GLOBALS["SQUID_MEMORYCONF"]["INI_ARRAY"] = $ini->_params;
         }
     } else {
         $ini->_params = $GLOBALS["SQUID_MEMORYCONF"]["INI_ARRAY"];
     }
     if (isset($ini->_params)) {
         $LDAP_EXTERNAL_AUTH = intval($ini->_params["NETWORK"]["LDAP_EXTERNAL_AUTH"]);
     }
     if (!isset($GLOBALS["DEBUG_SQL"])) {
         $GLOBALS["DEBUG_SQL"] = false;
     }
     $EnableArticaMetaServer = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableArticaMetaServer"));
     if ($EnableArticaMetaServer == 1) {
         $LDAP_EXTERNAL_AUTH = 1;
     }
     $this->report_types[1] = "{by_categories}";
     $this->report_types[2] = "{by_websites}";
     $this->acl_NTLM["src"] = "{src_addr}";
     $this->acl_NTLM["arp"] = "{ComputerMacAddress}";
     $this->acl_NTLM["dstdomain"] = "{dstdomain}";
     $this->acl_NTLM["dst"] = "{dst_addr}";
     $this->acl_NTLM["port"] = "{destination_port}";
     $this->acl_GroupType["all"] = "{all}";
     $this->acl_GroupType["src"] = "{src_addr}";
     $this->acl_GroupType["srcdomain"] = "{srcdomain}";
     $this->acl_GroupType["arp"] = "{ComputerMacAddress}";
     $this->acl_GroupType["dstdomain"] = "{dstdomain}";
     $this->acl_GroupType["dstdom_regex"] = "{dstdomain_regex}";
     $this->acl_GroupType["url_regex_extensions"] = "{url_regex_extensions}";
     $this->acl_GroupType["dst"] = "{dst_addr}";
     $this->acl_GroupType["maxconn"] = "{acl_maxconn}";
     $this->acl_GroupType["max_user_ip"] = "{acl_max_user_ip}";
     $this->acl_GroupType["proxy_auth"] = "{members}";
     $this->acl_GroupType["proxy_auth_ads"] = "{dynamic_activedirectory_group}";
     $this->acl_GroupType["proxy_auth_statad"] = "{static_activedirectory_group}";
     $this->acl_GroupType["proxy_auth_tagad"] = "{acl_tag_adgroup}";
     $this->acl_GroupType["proxy_auth_multiad"] = "{multiple_active_directory_groups}";
     $this->acl_GroupType["tag_categories"] = "{acl_tag_categories}";
     if ($LDAP_EXTERNAL_AUTH == 1) {
         $this->acl_GroupType["proxy_auth_ldap"] = "{dynamic_ldap_group}";
     }
     $this->acl_GroupType["Smartphones"] = "{smartphones}";
     $this->acl_GroupType["browser"] = "{browser}";
     $this->acl_GroupType["NudityScan"] = "{nudityScan}";
     $this->acl_GroupType["ssl_sni"] = "{acl_ssl_sni}";
     $this->acl_GroupType["time"] = "{DateTime}";
     $this->acl_GroupType["ext_user"] = "******";
     $this->acl_GroupType["method"] = "{connection_method}";
     $this->acl_GroupType["FTP"] = "FTP {protocol}";
     $this->acl_GroupType["dynamic_acls"] = "{dynamic_acls}";
     $this->acl_GroupType["req_mime_type"] = "{req_mime_type}";
     $this->acl_GroupType["rep_mime_type"] = "{rep_mime_type}";
     $this->acl_GroupType["rep_header_filename"] = "{rep_header_filename}";
     $this->acl_GroupType["url_regex"] = "{url_regex_acl2}";
     $this->acl_GroupType["urlpath_regex"] = "{url_regex_acl3}";
     $this->acl_GroupType["referer_regex"] = "{referer_regex}";
     $this->acl_GroupType["radius_auth"] = "{radius_auth}";
     $this->acl_GroupType["ad_auth"] = "{basic_ad_auth}";
     $this->acl_GroupType["ldap_auth"] = "{basic_ldap_auth}";
     $this->acl_GroupType["hotspot_auth"] = "{hotspot_auth}";
     $this->acl_GroupType["port"] = "{destination_port}";
     $this->acl_GroupType["myportname"] = "{local_proxy_port}";
     $this->acl_GroupType["clt_conn_tag"] = "{statistics_virtual_group}";
     $this->acl_GroupType["categories"] = "{artica_categories}";
     $this->acl_GroupType["teamviewer"] = "{macro}: TeamViewer";
     $this->acl_GroupType["whatsapp"] = "{macro}: whatsapp";
     $this->acl_GroupType["skype"] = "{macro}: Skype";
     $this->acl_GroupType["youtube"] = "{macro}: Youtube";
     $this->acl_GroupType["office365"] = "{macro}: Office 365";
     $this->acl_GroupType["quota_time"] = "{quota_time}";
     $this->acl_GroupType["quota_size"] = "{quota_size}";
     $this->acl_GroupType["google"] = "{macro}: Google {websites}";
     $this->acl_GroupType["google_ssl"] = "{macro}: Google SSL {websites}";
     $this->acl_GroupType["AntiTrack"] = "{macro}: {ads_and_trackers}";
     $this->acl_GroupType["dropbox"] = "{macro}: DropBox networks";
     $this->acl_ARRAY_NO_ITEM["clt_conn_tag"] = true;
     $this->acl_ARRAY_NO_ITEM["FTP"] = true;
     $this->acl_ARRAY_NO_ITEM["proxy_auth_ads"] = true;
     $this->acl_ARRAY_NO_ITEM["proxy_auth_tagad"] = true;
     $this->acl_ARRAY_NO_ITEM["proxy_auth_statad"] = true;
     $this->acl_ARRAY_NO_ITEM["NudityScan"] = true;
     $this->acl_ARRAY_NO_ITEM["all"] = true;
     $this->acl_ARRAY_NO_ITEM["dynamic_acls"] = true;
     $this->acl_ARRAY_NO_ITEM["categories"] = true;
     $this->acl_ARRAY_NO_ITEM["radius_auth"] = true;
     $this->acl_ARRAY_NO_ITEM["ad_auth"] = true;
     $this->acl_ARRAY_NO_ITEM["ldap_auth"] = true;
     $this->acl_ARRAY_NO_ITEM["hotspot_auth"] = true;
     $this->acl_ARRAY_NO_ITEM["AntiTrack"] = true;
     $this->acl_ARRAY_NO_ITEM["teamviewer"] = true;
     $this->acl_ARRAY_NO_ITEM["whatsapp"] = true;
     $this->acl_ARRAY_NO_ITEM["office365"] = true;
     $this->acl_ARRAY_NO_ITEM["skype"] = true;
     $this->acl_ARRAY_NO_ITEM["youtube"] = true;
     $this->acl_ARRAY_NO_ITEM["google"] = true;
     $this->acl_ARRAY_NO_ITEM["dropbox"] = true;
     $this->acl_ARRAY_NO_ITEM["google_ssl"] = true;
     $this->acl_ARRAY_NO_ITEM["proxy_auth_ldap"] = true;
     $this->acl_ARRAY_NO_ITEM["Smartphones"] = true;
     $this->acl_GroupType_WPAD["all"] = "{all}";
     $this->acl_GroupType_WPAD["src"] = "{ipsrc}";
     $this->acl_GroupType_WPAD["srcdomain"] = "{srcdomain}";
     $this->acl_GroupType_WPAD["dstdomain"] = "{dstdomain}";
     $this->acl_GroupType_WPAD["dst"] = "{dst}";
     $this->acl_GroupType_WPAD["browser"] = "{browser}";
     $this->acl_GroupType_WPAD["time"] = "{DateTime}";
     $this->acl_GroupType_WPAD["port"] = "{destination_port}";
     $this->acl_GroupType_iptables["src"] = "{addr}";
     $this->acl_GroupType_iptables["dst"] = "{dst}";
     $this->acl_GroupType_iptables["arp"] = "{ComputerMacAddress}";
     $this->acl_GroupType_iptables["port"] = "{destination_port}";
     $this->acl_GroupType_iptables["teamviewer"] = "{macro}: TeamViewer {networks}";
     $this->acl_GroupType_iptables["whatsapp"] = "{macro}: whatsapp {networks}";
     $this->acl_GroupType_iptables["office365"] = "{macro}: Office365 {networks}";
     $this->acl_GroupType_iptables["skype"] = "{macro}: Skype {networks}";
     $this->acl_GroupType_iptables["youtube"] = "{macro}: YouTube {networks}";
     $this->acl_GroupType_iptables["google"] = "{macro}: Google {networks}";
     $this->acl_GroupType_iptables["google_ssl"] = "{macro}: Google SSL {networks}";
     $this->acl_GroupType_iptables["dropbox"] = "{macro}: DropBox {networks}";
     $this->acl_GroupType_Firewall_in["src"] = "{addr}";
     $this->acl_GroupType_Firewall_in["arp"] = "{ComputerMacAddress}";
     $this->acl_GroupType_Firewall_out["dst"] = "{dst}";
     $this->acl_GroupType_Firewall_out["teamviewer"] = "TeamViewer - {macro}";
     $this->acl_GroupType_Firewall_out["whatsapp"] = "whatsapp - {macro}";
     $this->acl_GroupType_Firewall_out["office365"] = "office 365 - {macro}";
     $this->acl_GroupType_Firewall_out["skype"] = "Skype - {macro}";
     $this->acl_GroupType_Firewall_out["youtube"] = "YouTube - {macro}";
     $this->acl_GroupType_Firewall_out["google"] = "Google - {macro}";
     $this->acl_GroupType_Firewall_port["port"] = "{destination_port}";
     $this->acl_GroupTypeDynamic[0] = "{mac}";
     $this->acl_GroupTypeDynamic[1] = "{ipaddr}";
     $this->acl_GroupTypeDynamic[3] = "{hostname}";
     $this->acl_GroupTypeDynamic[2] = "{member}";
     $this->acl_GroupTypeDynamic[4] = "{webserver}";
     $this->AVAILABLE_METHOD["GET"] = true;
     $this->AVAILABLE_METHOD["PUT"] = true;
     $this->AVAILABLE_METHOD["POST"] = true;
     $this->AVAILABLE_METHOD["HEAD"] = true;
     $this->AVAILABLE_METHOD["CONNECT"] = true;
     $this->AVAILABLE_METHOD["TRACE"] = true;
     $this->AVAILABLE_METHOD["OPTIONS"] = true;
     $this->AVAILABLE_METHOD["DELETE"] = true;
     $this->AVAILABLE_METHOD["PROPFIND"] = true;
     $this->AVAILABLE_METHOD["PROPPATCH"] = true;
     $this->AVAILABLE_METHOD["MKCOL"] = true;
     $this->AVAILABLE_METHOD["COPY"] = true;
     $this->AVAILABLE_METHOD["MOVE"] = true;
     $this->AVAILABLE_METHOD["LOCK"] = true;
     $this->AVAILABLE_METHOD["UNLOCK"] = true;
     $this->AVAILABLE_METHOD["BMOVE"] = true;
     $this->AVAILABLE_METHOD["BDELETE"] = true;
     $this->AVAILABLE_METHOD["BPROFIND"] = true;
     $this->AVAILABLE_METHOD["PUT"] = true;
     $this->AVAILABLE_METHOD["REPORT"] = true;
     $this->AVAILABLE_METHOD["OPTIONS"] = true;
     $this->AVAILABLE_METHOD["PROPFIND"] = true;
     $this->AVAILABLE_METHOD["TUNNEL"] = true;
     $this->AVAILABLE_METHOD["PROPFIND"] = true;
     $this->AVAILABLE_METHOD["PROPPATCH"] = true;
     $this->AVAILABLE_METHOD["MKCOL"] = true;
     $this->AVAILABLE_METHOD["COPY"] = true;
     $this->AVAILABLE_METHOD["MOVE"] = true;
     $this->AVAILABLE_METHOD["LOCK"] = true;
     $this->AVAILABLE_METHOD["UNLOCK"] = true;
     $this->AVAILABLE_METHOD["MKDIR"] = true;
     $this->AVAILABLE_METHOD["INDEX"] = true;
     $this->AVAILABLE_METHOD["RMDIR"] = true;
     $this->AVAILABLE_METHOD["LINK"] = true;
     $this->AVAILABLE_METHOD["UNLINK"] = true;
     $this->AVAILABLE_METHOD["PATCH"] = true;
     $this->AVAILABLE_METHOD["BCOPY"] = true;
     $this->AVAILABLE_METHOD["BDELETE"] = true;
     $this->AVAILABLE_METHOD["BMOVE"] = true;
     $this->AVAILABLE_METHOD["BPROPPATCH"] = true;
     $this->AVAILABLE_METHOD["MKCO"] = true;
     $this->AVAILABLE_METHOD["POLL"] = true;
     $this->AVAILABLE_METHOD["SEARCH"] = true;
     $this->AVAILABLE_METHOD["SUBSCRIBE"] = true;
     $this->PROXY_PAC_TYPES[null] = "{select}";
     $this->PROXY_PAC_TYPES["shExpMatch"] = "{shExpMatch2}";
     $this->PROXY_PAC_TYPES["shExpMatchRegex"] = "{shExpMatchRegex}";
     $this->PROXY_PAC_TYPES["isInNetMyIP"] = "{isInNetMyIP}";
     $this->PROXY_PAC_TYPES["isInNet"] = "{isInNet2}";
     $this->PROXY_PAC_TYPES_EXPLAIN["shExpMatch"] = "{shExpMatch2_explain}";
     $this->PROXY_PAC_TYPES_EXPLAIN["shExpMatchRegex"] = "{shExpMatchRegex_explain}";
     $this->PROXY_PAC_TYPES_EXPLAIN["isInNetMyIP"] = "{isInNetMyIP_explain}";
     $this->PROXY_PAC_TYPES_EXPLAIN["isInNet"] = "{isInNet2_explain}";
     $this->CACHE_AGES[0] = "{none}";
     $this->CACHE_AGES[30] = "30 {minutes}";
     $this->CACHE_AGES[60] = "1 {hour}";
     $this->CACHE_AGES[120] = "2 {hours}";
     $this->CACHE_AGES[360] = "6 {hours}";
     $this->CACHE_AGES[720] = "12 {hours}";
     $this->CACHE_AGES[1440] = "1 {day}";
     $this->CACHE_AGES[2880] = "2 {days}";
     $this->CACHE_AGES[4320] = "3 {days}";
     $this->CACHE_AGES[10080] = "1 {week}";
     $this->CACHE_AGES[20160] = "2 {weeks}";
     $this->CACHE_AGES[43200] = "1 {month}";
     $this->CACHE_AGES[525600] = "1 {year}";
     $this->CACHES_RULES_TYPES[1] = "{domains}";
     $this->CACHES_RULES_TYPES[2] = "{extensions}";
     $this->CACHES_RULES_TYPES[3] = "{shExpMatchRegex}";
     if ($local == true) {
         $this->squidEnableRemoteStatistics = 0;
         $this->EnableSquidRemoteMySQL = 0;
     }
     $this->PrepareMySQLClass();
     if (!$this->DATABASE_EXISTS("squidlogs")) {
         if ($GLOBALS["VERBOSE"]) {
             echo __FUNCTION__ . "::" . __LINE__ . ":: Patching tables -> squidlogs...\n";
         }
         $this->CREATE_DATABASE("squidlogs");
         $this->CheckTables();
     }
     $this->fill_task_array();
     $this->fill_tasks_disabled();
     if (!$this->TestingConnection()) {
         if ($GLOBALS["VERBOSE"]) {
             echo __FUNCTION__ . "::" . __LINE__ . ":: TestingConnection -> FAILED Stamp MySQL to FAILED\n";
         }
         $this->MysqlFailed = true;
     }
 }
 function Save($_config, $_resolution, $_color, $_timezone, $_lat, $_long, $_countryiso2, $_city, $_region, $_geotimezone, $_isp, $_geosspan, $_grid, $_js = true, $_fromCookie = false)
 {
     global $STATS, $COUNTRIES, $COUNTRY_ALIASES;
     if (!$this->FirstCall) {
         $this->KeepAlive();
     } else {
         if (!isnull(getCookieValue("visits")) && $this->Visits == 1) {
             $this->Visits = getCookieValue("visits") + 1;
         }
         setCookieValue("visits", $this->Visits);
         if (!isnull(getCookieValue("last_visit"))) {
             $this->VisitLast = getCookieValue("last_visit");
         }
         setCookieValue("last_visit", time());
         $this->IP = getIP();
         $this->SystemInfo = !empty($_SERVER["HTTP_USER_AGENT"]) ? $_SERVER["HTTP_USER_AGENT"] : "";
         $localization = getBrowserLocalization();
         $this->Language = $localization[0];
         $this->GeoCountryISO2 = $localization[1];
         $this->Resolution = !empty($_resolution) && count($_resolution) == 2 && !empty($_resolution[0]) && !empty($_resolution[1]) ? $_resolution[0] . " x " . $_resolution[1] : "";
         $this->Resolution .= !empty($_color) ? " (" . $_color . " Bit)" : "";
         $this->GeoTimezoneOffset = getLocalTimezone($_timezone);
         $this->GeoResult = 0;
         if (!empty($_geosspan)) {
             createSSpanFile($_geosspan);
         }
         if (!empty($_config["gl_pr_ngl"]) && $_js) {
             if (!empty($_lat) && base64_decode($_lat) > -180) {
                 setCookieValue(GEO_LATITUDE, $this->GeoLatitude = base64_decode($_lat));
                 setCookieValue(GEO_LONGITUDE, $this->GeoLongitude = base64_decode($_long));
                 setCookieValue(GEO_COUNTRY_ISO_2, $this->GeoCountryISO2 = base64_decode($_countryiso2));
                 setCookieValue(GEO_CITY, $this->GeoCity = base64_decode($_city));
                 setCookieValue(GEO_REGION, $this->GeoRegion = base64_decode($_region));
                 setCookieValue(GEO_TIMEZONE, $this->GeoTimezoneOffset = base64_decode($_geotimezone));
                 setCookieValue(GEO_ISP, $this->GeoISP = utf8_decode(base64_decode($_isp)));
                 setCookieValue("geo_data", time());
             } else {
                 if (isset($_lat) && !empty($_lat)) {
                     $this->GeoLatitude = base64_decode($_lat);
                     $this->GeoLongitude = base64_decode($_long);
                 } else {
                     if (!isnull(getCookieValue("geo_data")) && !isnull(getCookieValue(GEO_LATITUDE))) {
                         $this->GeoLatitude = getCookieValue(GEO_LATITUDE);
                         $this->GeoLongitude = getCookieValue(GEO_LONGITUDE);
                         $this->GeoCountryISO2 = getCookieValue(GEO_COUNTRY_ISO_2);
                         $this->GeoCity = getCookieValue(GEO_CITY);
                         $this->GeoRegion = getCookieValue(GEO_REGION);
                         $this->GeoTimezoneOffset = getCookieValue(GEO_TIMEZONE);
                         $this->GeoISP = getCookieValue(GEO_ISP);
                         $_fromCookie = true;
                     }
                 }
             }
             removeSSpanFile(false);
             if ($_fromCookie) {
                 $this->GeoResultId = 6;
             } else {
                 if (!isnull($span = getSpanValue())) {
                     if ($span > time() + CONNECTION_ERROR_SPAN) {
                         $this->GeoResultId = 5;
                     } else {
                         $this->GeoResultId = 4;
                     }
                 } else {
                     if (base64_decode($_lat) == -777) {
                         $this->GeoResultId = 5;
                     } else {
                         if (base64_decode($_lat) == -522) {
                             $this->GeoResultId = 2;
                         } else {
                             if ($_grid != 4) {
                                 $this->GeoResultId = 3;
                             } else {
                                 $this->GeoResultId = $_grid;
                             }
                         }
                     }
                 }
             }
         } else {
             $this->GeoResultId = 7;
         }
         initData(false, false, false, false, false, false, true);
         if (isset($COUNTRY_ALIASES[$this->GeoCountryISO2])) {
             $this->GeoCountryISO2 = $COUNTRY_ALIASES[$this->GeoCountryISO2];
         } else {
             if (!isset($COUNTRIES[$this->GeoCountryISO2]) && DEBUG_MODE) {
                 logit($this->GeoCountryISO2, LIVEZILLA_PATH . "_log/unknown_countries.txt");
             }
         }
         $detector = new DeviceDetector();
         $detector->DetectBrowser();
         if ($detector->AgentType == AGENT_TYPE_BROWSER || $detector->AgentType == AGENT_TYPE_UNKNOWN) {
             $detector->DetectOperatingSystem();
             if (DEBUG_MODE && !empty($_SERVER["HTTP_USER_AGENT"])) {
                 if ($detector->OperatingSystemUnknown) {
                     logit("OS UNKNOWN: " . $_SERVER["HTTP_USER_AGENT"], LIVEZILLA_PATH . "_log/unknown_os.txt");
                 } else {
                     if ($detector->AgentType == AGENT_TYPE_UNKNOWN) {
                         logit("AGENT UNKNOWN: " . $_SERVER["HTTP_USER_AGENT"], LIVEZILLA_PATH . "_log/unknown_ag.txt");
                     }
                 }
             }
             $bid = $this->GetBrowserId($detector->Browser, $detector->AgentType);
             $oid = $this->GetOSId($detector->OperatingSystem);
             $row = $this->CreateSignature();
             if (is_array($row) && $row["id"] != $this->UserId) {
                 $this->UserId = $row["id"];
                 $this->SignatureMismatch = true;
             } else {
                 queryDB(true, "INSERT INTO `" . DB_PREFIX . DATABASE_VISITORS . "` (`id`, `entrance`,`last_active`, `host`,`ip`,`system`,`browser`, `visits`,`visit_id`,`visit_last`,`resolution`, `language`, `country`, `city`, `region`, `isp`, `timezone`, `latitude`, `longitude`, `geo_result`, `js`, `signature`) VALUES ('" . @mysql_real_escape_string($this->UserId) . "', '" . @mysql_real_escape_string(time()) . "','" . @mysql_real_escape_string(time()) . "', '" . @mysql_real_escape_string($this->Host) . "', '" . @mysql_real_escape_string($this->IP) . "', '" . @mysql_real_escape_string($oid) . "','" . @mysql_real_escape_string($bid) . "', '" . @mysql_real_escape_string($this->Visits) . "', '" . @mysql_real_escape_string($this->VisitId) . "','" . @mysql_real_escape_string($this->VisitLast) . "', '" . @mysql_real_escape_string(getValueId(DATABASE_VISITOR_DATA_RESOLUTIONS, "resolution", $this->Resolution, false, 32)) . "', '" . @mysql_real_escape_string(substr(strtoupper($this->Language), 0, 5)) . "','" . @mysql_real_escape_string($this->GeoCountryISO2) . "', '" . @mysql_real_escape_string(getValueId(DATABASE_VISITOR_DATA_CITIES, "city", $this->GeoCity, false)) . "', '" . @mysql_real_escape_string(getValueId(DATABASE_VISITOR_DATA_REGIONS, "region", $this->GeoRegion, false)) . "', '" . @mysql_real_escape_string(getValueId(DATABASE_VISITOR_DATA_ISPS, "isp", utf8_encode($this->GeoISP), false)) . "', '" . @mysql_real_escape_string($this->GeoTimezoneOffset) . "', '" . @mysql_real_escape_string($this->GeoLatitude) . "', '" . @mysql_real_escape_string($this->GeoLongitude) . "', '" . @mysql_real_escape_string($this->GeoResultId) . "', '" . @mysql_real_escape_string($_js ? 1 : 0) . "', '" . @mysql_real_escape_string($this->Signature) . "');");
                 if (mysql_affected_rows() == 1) {
                     queryDB(true, "UPDATE `" . DB_PREFIX . DATABASE_VISITORS . "` SET `visit_latest`=0 WHERE `id`='" . @mysql_real_escape_string($this->UserId) . "' AND `visit_id`!='" . @mysql_real_escape_string($this->VisitId) . "';");
                 }
             }
         } else {
             if (STATS_ACTIVE) {
                 $this->IsCrawler = true;
                 $STATS->ProcessAction(ST_ACTION_LOG_CRAWLER_ACCESS, array($this->GetCrawlerId($detector->Browser), null));
             }
         }
     }
 }
Пример #3
0
function setup_2()
{
    if ($GLOBALS["VERBOSE"]) {
        echo "<span style='color:#d32d2d'>[" . __LINE__ . "] setup_2()</span><br>\n";
    }
    $GLOBALS["DEBUG_TEMPLATE"] = true;
    include_once dirname(__FILE__) . "/ressources/class.langages.inc";
    if ($GLOBALS["VERBOSE"]) {
        echo "<span style='color:#d32d2d'>[" . __LINE__ . "] articaLang()</span><br>\n";
    }
    $langAutodetect = new articaLang();
    $DetectedLanguage = $langAutodetect->get_languages();
    $GLOBALS["FIXED_LANGUAGE"] = $DetectedLanguage;
    $savedsettings = unserialize(base64_decode($_GET["savedsettings"]));
    $setup_proxy = 0;
    $tpl = new templates();
    $page = CurrentPageName();
    $sock = new sockets();
    $users = new usersMenus();
    if ($GLOBALS["VERBOSE"]) {
        echo "<span style='color:#d32d2d'>[" . __LINE__ . "] OK</span><br>\n";
    }
    $netbiosname_field = $tpl->javascript_parse_text("{netbiosname}");
    $domain_field = $tpl->javascript_parse_text("{domain}");
    if (count($savedsettings) < 3) {
        if ($GLOBALS["VERBOSE"]) {
            echo "<span style='color:#d32d2d'>[" . __LINE__ . "] network.php?fqdn=yes</span><br>\n";
        }
        $hostname = base64_decode($sock->getFrameWork("network.php?fqdn=yes"));
        if ($hostname == null) {
            $users = new usersMenus();
            $hostname = $users->fqdn;
        }
        $arrayNameServers = GetNamesServers();
        if (strpos($hostname, '.') > 0) {
            $Thostname = explode(".", $hostname);
            $netbiosname = $Thostname[0];
            unset($Thostname[0]);
            $domainname = @implode(".", $Thostname);
        } else {
            $netbiosname = $hostname;
        }
        if (preg_match("#[A-Za-z]+\\s+[A-Za-z]+#", $netbiosname)) {
            $netbiosname = null;
        }
    } else {
        $netbiosname = $savedsettings["netbiosname"];
        $domainname = $savedsettings["domain"];
        $arrayNameServers[0] = $savedsettings["DNS1"];
        $arrayNameServers[1] = $savedsettings["DNS2"];
    }
    if ($netbiosname == null) {
        $hostname = base64_decode($sock->getFrameWork("network.php?fqdn=yes"));
        if ($hostname == null) {
            $users = new usersMenus();
            $hostname = $users->fqdn;
        }
        if (strpos($hostname, '.') > 0) {
            $Thostname = explode(".", $hostname);
            $netbiosname = $Thostname[0];
            unset($Thostname[0]);
            $domainname = @implode(".", $Thostname);
        } else {
            $netbiosname = $hostname;
        }
    }
    if ($arrayNameServers[0] == null) {
        $arrayNameServers = GetNamesServers();
    }
    $SetupAD = 0;
    if ($users->SQUID_INSTALLED) {
        if ($users->SAMBA_INSTALLED) {
            $SetupAD = 1;
        }
    }
    if ($users->SQUID_INSTALLED) {
        $setup_proxy = 1;
        if ($users->SQUID_REVERSE_APPLIANCE) {
            $setup_proxy = 0;
            $proxy = "<input type='hidden' id='proxy_listen_port' value='80' name='proxy_listen_port'>";
        }
    }
    $dhcpd = null;
    $SERVICES_TITLE = null;
    //FIRST_WIZARD_NIC2 -> fini -> demande de reboot
    $t = time();
    $IPADDR = $savedsettings["IPADDR"];
    $NETMASK = $savedsettings["NETMASK"];
    $GATEWAY = $savedsettings["GATEWAY"];
    $metric = $savedsettings["metric"];
    $BROADCAST = $savedsettings["BROADCAST"];
    $KEEPNET = $savedsettings["KEEPNET"];
    $NIC = $savedsettings["NIC"];
    $VPS_COMPATIBLE = $savedsettings["VPS_COMPATIBLE"];
    $nic = new system_nic("eth0");
    if ($IPADDR == null) {
        $IPADDR = $nic->IPADDR;
    }
    if ($NETMASK == null) {
        $NETMASK = $nic->NETMASK;
    }
    if ($GATEWAY == null) {
        $GATEWAY = $nic->GATEWAY;
    }
    if ($BROADCAST == null) {
        $BROADCAST = $nic->BROADCAST;
    }
    if ($metric == null) {
        $metric = $nic->metric;
    }
    if (!is_numeric($metric)) {
        $metric = 100;
    }
    if ($metric < 2) {
        $metric = 100;
    }
    $DISABLED = false;
    if (trim($arrayNameServers[1]) == null) {
        $arrayNameServers[1] = "8.8.8.8";
    }
    if (!is_numeric($KEEPNET)) {
        $KEEPNET = 0;
    }
    $NICS = new networking();
    $Local_interfaces = $NICS->Local_interfaces(true);
    if (count($Local_interfaces) == 0) {
        $error = FATAL_ERROR_SHOW_128("{unable_to_retreive_network_information_refresh}");
    }
    $timezone = timezonearray();
    for ($i = 0; $i < count($timezone); $i++) {
        $arrayTime[$timezone[$i]] = $timezone[$i];
    }
    $timezone_def = getLocalTimezone();
    $FORM = "{$error}\n\t<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td colspan=2 style='font-size:50px;'><div style='margin-bottom:35px'>{serveretdom}</div></td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:25px;vertical-align:top' nowrap>{timezone}:</td>\n\t\t<td valign='top'>" . Field_array_Hash($arrayTime, "timezones", $timezone_def, null, null, "style:font-size:25px;padding:3px") . "</td>\n\t</tr>\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:25px' nowrap>{netbiosname}:</td>\n\t\t<td>" . Field_text("hostname_netbios", $netbiosname, "font-size:25px;width:220px", null, null, null, false, "ChangeQuickHostnameCheck(event)") . "</td>\n\t</tr>\n\t</tr>\n\t\t<td class=legend style='font-size:25px' nowrap>{DomainOfThisserver}:</td>\n\t\t<td>" . Field_text("hostname_domain", $domainname, "font-size:25px;width:220px", null, null, null, false, "ChangeQuickHostnameCheck(event)") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=2 style='font-size:50px;padding-top:50px'>{network}</td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td colspan=2 style='font-size:18px;font-weight:bolder'><div style='margin-bottom:35px'>{network_settings_will_be_applied_after_reboot}</div></td>\n\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:25px' nowrap>{keep_current_settings}:</td>\n\t\t\t<td>" . Field_checkbox("KEEPNET", 1, $KEEPNET, 'KeepNetCheck()') . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:25px' nowrap>{VPS_COMPATIBLE}:</td>\n\t\t\t<td>" . Field_checkbox("VPS_COMPATIBLE", 1, $VPS_COMPATIBLE, '') . "</td>\n\t\t</tr>\n\t\t\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:25px' nowrap>{network_interface}:</td>\n\t\t\t<td>" . Field_array_Hash($Local_interfaces, "NIC", "{$NIC}", "ChangeWizardNetInterfaces()", null, 0, "padding:3px;font-size:25px") . "</td>\n\t\t</tr>\n\t</table>\n\t<br>\n\t<span id='INTERFACES_OBJECTS'>\t\n\t<table style='width:100%'>\t\t\t\t\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:25px' nowrap>{tcp_address}:</td>\n\t\t\t<td>" . field_ipv4("IPADDR", $IPADDR, 'padding:3px;font-size:25px', null, null, null, false, null, $DISABLED) . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:25px'>{netmask}:</td>\n\t\t\t<td>" . field_ipv4("NETMASK", $NETMASK, 'padding:3px;font-size:25px', null, null, null, false, null, $DISABLED) . "</td>\n\t\t</tr>\n\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:25px'>{gateway}:</td>\n\t\t\t<td>" . field_ipv4("GATEWAY", $GATEWAY, 'padding:3px;font-size:25px', null, null, null, false, null, $DISABLED) . "</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:25px'>{metric}:</td>\n\t\t\t<td>" . field_text("metric-{$t}", $metric, 'padding:3px;font-size:25px;width:90px', null, null, null, false, null, $DISABLED) . "</td>\n\t\t</tr>\t\t\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:25px'>{broadcast}:</td>\n\t\t\t<td>" . field_ipv4("BROADCAST", $BROADCAST, 'padding:3px;font-size:25px', null, null, null, false, null, $DISABLED) . "</td>\n\t\t</tr>\n\t\t</TABLE>\n\t</SPAN>\n\t<br>\n\t<table style='width:100%'>\t\n\t<tr>\n\t\t<td colspan=2 style='font-size:50px;'><div style='margin-bottom:35px'>DNS</div></td>\n\t</tr>\t\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:25px' nowrap>{primary_dns}:</td>\n\t\t<td>" . field_ipv4("DNS1", $arrayNameServers[0], "padding:3px;font-size:25px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:25px' nowrap>{secondary_dns}:</td>\n\t\t<td>" . field_ipv4("DNS2", $arrayNameServers[1], "padding:3px;font-size:25px") . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td colspan=2 style='font-size:16px;font-weight:bolder'>&nbsp;</td>\n\t</tr>\t\n\t<tr>\n\t\t<td colspan=2 style='font-size:25px;font-weight:bolder'><div style='text-align:right'><hr>" . button("{next}", "ChangeQuickHostname()", "30px") . "</div></td>\n\t</tr>\n\t</table>\n\t</div>\n\t\n\t<script>\n\t\tvar X_ChangeQuickHostname= function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tUnlockPage();\n\t\t\tvar setup_proxy={$setup_proxy};\n\t\t\tif(setup_proxy==1){\n\t\t\t\tLoadAjax('setup-content','{$page}?setup-proxy-type=yes&savedsettings='+results)\n\t\t\t\treturn;\n\t\t\t}\t\t\t\n\t\t\t\n\t\t\tvar SetupAD={$SetupAD};\n\t\t\tif(SetupAD==1){\n\t\t\t\tLoadAjax('setup-content','{$page}?setup-active-directory=yes&savedsettings='+results)\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\tLoadAjax('setup-content','{$page}?setup-3=yes&savedsettings='+results)\n\t\t\t}\n\t\t\t\n\t\tfunction ChangeQuickHostnameCheck(e){\n\t\t\tif(checkEnter(e)){ChangeQuickHostname();}\n\t\t}\n\t\t\n\t\tfunction ChangeWizardNetInterfaces(){\n\t\t\tvar nic=document.getElementById('NIC').value;\n\t\t\tLoadAjax('INTERFACES_OBJECTS','{$page}?setup-nic=yes&t={$t}&NIC='+nic)\n\t\t\n\t\t}\n\t\t\n\t\tfunction KeepNetCheck(){\n\t\t\tdocument.getElementById('NIC').disabled=false;\n\t\t\tdocument.getElementById('hostname_netbios').disabled=false;\n\t\t\tdocument.getElementById('hostname_domain').disabled=false;\n\t\t\tdocument.getElementById('IPADDR').disabled=false;\n\t\t\tdocument.getElementById('NETMASK').disabled=false;\n\t\t\tdocument.getElementById('GATEWAY').disabled=false;\n\t\t\tdocument.getElementById('BROADCAST').disabled=false;\n\t\t\tdocument.getElementById('metric-{$t}').disabled=false;\t\n\t\t\tdocument.getElementById('DNS1').disabled=false;\n\t\t\tdocument.getElementById('DNS2').disabled=false;\n\t\t\tdocument.getElementById('VPS_COMPATIBLE').disabled=false;\n\t\t\t\n\t\t\t\n\t\t\tif(document.getElementById('KEEPNET').checked){\n\t\t\t\tdocument.getElementById('NIC').disabled=true;\n\t\t\t\tdocument.getElementById('VPS_COMPATIBLE').disabled=true;\n\t\t\t\tdocument.getElementById('IPADDR').disabled=true;\n\t\t\t\tdocument.getElementById('NETMASK').disabled=true;\n\t\t\t\tdocument.getElementById('GATEWAY').disabled=true;\n\t\t\t\tdocument.getElementById('BROADCAST').disabled=true;\n\t\t\t\tdocument.getElementById('metric-{$t}').disabled=true;\t\n\t\t\t\tdocument.getElementById('DNS1').disabled=true;\n\t\t\t\tdocument.getElementById('DNS2').disabled=true;\n\t\t\t\tdocument.getElementById('hostname_netbios').disabled=true;\n\t\t\t\tdocument.getElementById('hostname_domain').disabled=true;\t\t\t\t\n\t\t\t\n\t\t\t}\n\t\t\n\t\t}\n\n\t\t\n\t\tfunction ChangeQuickHostname(){\n\t\t\tKEEPNET=0;\n\t\t\tVPS_COMPATIBLE=0;\n\t\t\tif(document.getElementById('KEEPNET').checked){KEEPNET=1;}\n\t\t\tif(document.getElementById('VPS_COMPATIBLE').checked){VPS_COMPATIBLE=1;}\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tvar netbios=document.getElementById('hostname_netbios').value;\n\t\t\tvar dom=document.getElementById('hostname_domain').value;\n\t\t\tif(KEEPNET==0){\n\t\t\t\tif(netbios.length==0){alert('{$netbiosname_field} (Null!)');return;}\n\t\t\t\tif(dom.length==0){alert('{$domain_field} (Null!)');return;}\n\t\t\t\tif(dom=='localhost.localdomain'){alert('localhost.localdomain wrong domain...');return;}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tif(document.getElementById('proxy_listen_port')){\n\t\t\t\tXHR.appendData('proxy_listen_port',document.getElementById('proxy_listen_port').value);\n\t\t\t}\n\t\t\tif(document.getElementById('EnablePDNS')){\n\t\t\t\tvar EnablePDNS=0;\n\t\t\t\tif(document.getElementById('EnablePDNS').checked){EnablePDNS=1;}\n\t\t\t\tXHR.appendData('EnablePDNS',EnablePDNS);\n\t\t\t}\n\n\t\t\tif(document.getElementById('EnableFreeRadius')){\n\t\t\t\tvar EnableFreeRadius=0;\n\t\t\t\tif(document.getElementById('EnableFreeRadius').checked){EnableFreeRadius=1;}\n\t\t\t\tXHR.appendData('EnableFreeRadius',EnableFreeRadius);\n\t\t\t}\n\n\t\t\tif(document.getElementById('EnableDHCPServer')){\n\t\t\t\tXHR.appendData('EnableDHCPServer',document.getElementById('EnableDHCPServer').value);\n\t\t\t}\n\t\t\t\n\n\n\t\t\tif(document.getElementById('EnableWebFiltering')){\n\t\t\t\tXHR.appendData('EnableWebFiltering',document.getElementById('EnableWebFiltering').value);\n\t\t\t}\n\n\t\t\tif(document.getElementById('AsCategoriesAppliance')){\n\t\t\t\tXHR.appendData('AsCategoriesAppliance',document.getElementById('AsCategoriesAppliance').value);\n\t\t\t}\t\t\t\n\t\t\t\n\n\t\t\tif(document.getElementById('timezones')){\n\t\t\t\tXHR.appendData('timezones',document.getElementById('timezones').value);\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t \n\t\t\tXHR.appendData('KEEPNET',KEEPNET);\n\t\t\t\n\t\t\tif(KEEPNET==0){ \n\t\t\t\tXHR.appendData('VPS_COMPATIBLE',VPS_COMPATIBLE);\n\t\t\t\tXHR.appendData('NIC',document.getElementById('NIC').value);\n\t\t\t\tXHR.appendData('IPADDR',document.getElementById('IPADDR').value);\n\t\t\t\tXHR.appendData('NETMASK',document.getElementById('NETMASK').value);  \n\t\t\t\tXHR.appendData('GATEWAY',document.getElementById('GATEWAY').value);\n\t\t\t\tXHR.appendData('BROADCAST',document.getElementById('BROADCAST').value);\n\t\t\t\tXHR.appendData('metric',document.getElementById('metric-{$t}').value);          \n\t\t\t\tXHR.appendData('DNS1',document.getElementById('DNS1').value);\n\t\t\t\tXHR.appendData('DNS2',document.getElementById('DNS2').value);\n\t\t\t\tXHR.appendData('netbiosname',netbios);\n\t\t\t\tXHR.appendData('domain',dom);\n\t\t\t}\n\t\t\t\n\t\t\tXHR.appendData('savedsettings','{$_GET["savedsettings"]}');\n\t\t\tAnimateDiv('setup-content');\n\t\t\tLockPage();\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',X_ChangeQuickHostname);\n\t\t\t\n\t\t}\n\t\tKeepNetCheck();\n\t\tdocument.getElementById('content').style.height='1250px';\n\t</script>\n\t\n\t";
    $html = "\n\t<div style='font-size:35px;font-weight:bolder;margin-bottom:10px'>{squid_net_simple}</div>\n\t{$FORM}\n\t\n\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Пример #4
0
<?php

/*
script:	Ajax availability calendar
author: Chris Bolson

file: 	functions.inc.php
use: 	common functions for all pages
mod:	2012-03-08
*/
// set local time for newer php installations that require it (function at bottom of page)
date_default_timezone_set(getLocalTimezone());
//	 create calendar for given month
function draw_cal($id_item, $month, $year, $manage_type = "avail")
{
    global $lang;
    $month = sprintf("%02s", $month);
    //	define vars
    $today_timestamp = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
    # 	current timestamp - used to check if date is in past
    $this_month = getDate(mktime(0, 0, 0, $month, 1, $year));
    # 	convert month to timestamp
    $first_week_day = $this_month["wday"];
    # 	define first weekday (0-6)
    $days_in_this_month = cal_days_in_month(CAL_GREGORIAN, $month, $year);
    #	define number of days in week
    $day_counter_tot = 0;
    #	count total number of days showin INCLUDING previous and next months - use to get 6th row of dates
    //	get num days in previous month - used to add dates to "empty" cells
    $month_last = $month - 1;
    $year_last = $year;
 function mysql_squid_builder($local = false)
 {
     if (function_exists("getLocalTimezone")) {
         @date_default_timezone_set(getLocalTimezone());
     }
     if (!isset($GLOBALS["DEBUG_SQL"])) {
         $GLOBALS["DEBUG_SQL"] = false;
     }
     $this->report_types[1] = "{by_categories}";
     $this->report_types[2] = "{by_websites}";
     $this->acl_GroupType["all"] = "{all}";
     $this->acl_GroupType["src"] = "{src_addr}";
     $this->acl_GroupType["srcdomain"] = "{srcdomain}";
     $this->acl_GroupType["arp"] = "{ComputerMacAddress}";
     $this->acl_GroupType["dstdomain"] = "{dstdomain}";
     $this->acl_GroupType["dstdom_regex"] = "{dstdomain_regex}";
     $this->acl_GroupType["url_regex_extensions"] = "{url_regex_extensions}";
     $this->acl_GroupType["dst"] = "{dst_addr}";
     $this->acl_GroupType["maxconn"] = "{acl_maxconn}";
     $this->acl_GroupType["max_user_ip"] = "{acl_max_user_ip}";
     $this->acl_GroupType["proxy_auth"] = "{members}";
     $this->acl_GroupType["proxy_auth_ads"] = "{dynamic_activedirectory_group}";
     $this->acl_GroupType["proxy_auth_statad"] = "{static_activedirectory_group}";
     $this->acl_GroupType["browser"] = "{browser}";
     $this->acl_GroupType["NudityScan"] = "{nudityScan}";
     $this->acl_GroupType["time"] = "{DateTime}";
     $this->acl_GroupType["ext_user"] = "******";
     $this->acl_GroupType["method"] = "{connection_method}";
     $this->acl_GroupType["dynamic_acls"] = "{dynamic_acls}";
     $this->acl_GroupType["req_mime_type"] = "{req_mime_type}";
     $this->acl_GroupType["rep_mime_type"] = "{rep_mime_type}";
     $this->acl_GroupType["url_regex"] = "{url_regex_acl2}";
     $this->acl_GroupType["urlpath_regex"] = "{url_regex_acl3}";
     $this->acl_GroupType["referer_regex"] = "{referer_regex}";
     $this->acl_GroupType["radius_auth"] = "{radius_auth}";
     $this->acl_GroupType["ad_auth"] = "{basic_ad_auth}";
     $this->acl_GroupType["ldap_auth"] = "{basic_ldap_auth}";
     $this->acl_GroupType["hotspot_auth"] = "{hotspot_auth}";
     $this->acl_GroupType["port"] = "{destination_port}";
     $this->acl_GroupType["categories"] = "{artica_categories}";
     $this->acl_GroupType["teamviewer"] = "{macro}: TeamViewer";
     $this->acl_GroupType["quota_time"] = "{quota_time}";
     $this->acl_GroupType["quota_size"] = "{quota_size}";
     $this->acl_GroupType["google"] = "{macro}: Google {websites}";
     $this->acl_GroupType["google_ssl"] = "{macro}: Google SSL {websites}";
     $this->acl_ARRAY_NO_ITEM["proxy_auth_ads"] = true;
     $this->acl_ARRAY_NO_ITEM["proxy_auth_statad"] = true;
     $this->acl_ARRAY_NO_ITEM["NudityScan"] = true;
     $this->acl_ARRAY_NO_ITEM["all"] = true;
     $this->acl_ARRAY_NO_ITEM["dynamic_acls"] = true;
     $this->acl_ARRAY_NO_ITEM["categories"] = true;
     $this->acl_ARRAY_NO_ITEM["radius_auth"] = true;
     $this->acl_ARRAY_NO_ITEM["ad_auth"] = true;
     $this->acl_ARRAY_NO_ITEM["ldap_auth"] = true;
     $this->acl_ARRAY_NO_ITEM["hotspot_auth"] = true;
     $this->acl_ARRAY_NO_ITEM["teamviewer"] = true;
     $this->acl_ARRAY_NO_ITEM["google"] = true;
     $this->acl_ARRAY_NO_ITEM["google_ssl"] = true;
     $this->acl_GroupType_WPAD["all"] = "{all}";
     $this->acl_GroupType_WPAD["src"] = "{ipsrc}";
     $this->acl_GroupType_WPAD["srcdomain"] = "{srcdomain}";
     $this->acl_GroupType_WPAD["dstdomain"] = "{dstdomain}";
     $this->acl_GroupType_WPAD["dst"] = "{dst}";
     $this->acl_GroupType_WPAD["browser"] = "{browser}";
     $this->acl_GroupType_WPAD["time"] = "{DateTime}";
     $this->acl_GroupType_WPAD["port"] = "{destination_port}";
     $this->acl_GroupType_iptables["src"] = "{addr}";
     $this->acl_GroupType_iptables["dst"] = "{dst}";
     $this->acl_GroupType_iptables["arp"] = "{ComputerMacAddress}";
     $this->acl_GroupType_iptables["port"] = "{destination_port}";
     $this->acl_GroupType_Firewall_in["src"] = "{addr}";
     $this->acl_GroupType_Firewall_in["arp"] = "{ComputerMacAddress}";
     $this->acl_GroupType_Firewall_out["dst"] = "{dst}";
     $this->acl_GroupType_Firewall_out["teamviewer"] = "TeamViewer - {macro}";
     $this->acl_GroupType_Firewall_out["google"] = "Google - {macro}";
     $this->acl_GroupType_Firewall_port["port"] = "{destination_port}";
     $this->acl_GroupTypeDynamic[0] = "{mac}";
     $this->acl_GroupTypeDynamic[1] = "{ipaddr}";
     $this->acl_GroupTypeDynamic[3] = "{hostname}";
     $this->acl_GroupTypeDynamic[2] = "{member}";
     $this->acl_GroupTypeDynamic[4] = "{webserver}";
     $this->AVAILABLE_METHOD["GET"] = true;
     $this->AVAILABLE_METHOD["PUT"] = true;
     $this->AVAILABLE_METHOD["POST"] = true;
     $this->AVAILABLE_METHOD["HEAD"] = true;
     $this->AVAILABLE_METHOD["CONNECT"] = true;
     $this->AVAILABLE_METHOD["TRACE"] = true;
     $this->AVAILABLE_METHOD["OPTIONS"] = true;
     $this->AVAILABLE_METHOD["DELETE"] = true;
     $this->AVAILABLE_METHOD["PROPFIND"] = true;
     $this->AVAILABLE_METHOD["PROPPATCH"] = true;
     $this->AVAILABLE_METHOD["MKCOL"] = true;
     $this->AVAILABLE_METHOD["COPY"] = true;
     $this->AVAILABLE_METHOD["MOVE"] = true;
     $this->AVAILABLE_METHOD["LOCK"] = true;
     $this->AVAILABLE_METHOD["UNLOCK"] = true;
     $this->AVAILABLE_METHOD["BMOVE"] = true;
     $this->AVAILABLE_METHOD["BDELETE"] = true;
     $this->AVAILABLE_METHOD["BPROFIND"] = true;
     $this->PROXY_PAC_TYPES[null] = "{select}";
     $this->PROXY_PAC_TYPES["shExpMatch"] = "{shExpMatch2}";
     $this->PROXY_PAC_TYPES["shExpMatchRegex"] = "{shExpMatchRegex}";
     $this->PROXY_PAC_TYPES["isInNetMyIP"] = "{isInNetMyIP}";
     $this->PROXY_PAC_TYPES["isInNet"] = "{isInNet2}";
     $this->PROXY_PAC_TYPES_EXPLAIN["shExpMatch"] = "{shExpMatch2_explain}";
     $this->PROXY_PAC_TYPES_EXPLAIN["shExpMatchRegex"] = "{shExpMatchRegex_explain}";
     $this->PROXY_PAC_TYPES_EXPLAIN["isInNetMyIP"] = "{isInNetMyIP_explain}";
     $this->PROXY_PAC_TYPES_EXPLAIN["isInNet"] = "{isInNet2_explain}";
     $this->CACHE_AGES[0] = "{none}";
     $this->CACHE_AGES[30] = "30 {minutes}";
     $this->CACHE_AGES[60] = "1 {hour}";
     $this->CACHE_AGES[120] = "2 {hours}";
     $this->CACHE_AGES[360] = "6 {hours}";
     $this->CACHE_AGES[720] = "12 {hours}";
     $this->CACHE_AGES[1440] = "1 {day}";
     $this->CACHE_AGES[2880] = "2 {days}";
     $this->CACHE_AGES[4320] = "3 {days}";
     $this->CACHE_AGES[10080] = "1 {week}";
     $this->CACHE_AGES[20160] = "2 {weeks}";
     $this->CACHE_AGES[43200] = "1 {month}";
     $this->CACHE_AGES[525600] = "1 {year}";
     $this->CACHES_RULES_TYPES[1] = "{domains}";
     $this->CACHES_RULES_TYPES[2] = "{extensions}";
     $this->CACHES_RULES_TYPES[3] = "{shExpMatchRegex}";
     if ($local == true) {
         $this->squidEnableRemoteStatistics = 0;
         $this->EnableSquidRemoteMySQL = 0;
     }
     $this->PrepareMySQLClass();
     if (!$this->DATABASE_EXISTS("squidlogs")) {
         if ($GLOBALS["VERBOSE"]) {
             echo __FUNCTION__ . "::" . __LINE__ . ":: Patching tables -> squidlogs...\n";
         }
         $this->CREATE_DATABASE("squidlogs");
         $this->CheckTables();
     }
     $this->fill_task_array();
     $this->fill_tasks_disabled();
     if (!$this->TestingConnection()) {
         if ($GLOBALS["VERBOSE"]) {
             echo __FUNCTION__ . "::" . __LINE__ . ":: TestingConnection -> FAILED Stamp MySQL to FAILED\n";
         }
         $this->MysqlFailed = true;
     }
 }
Пример #6
0
function createStaticFile($_externalUser, $_resolution, $_color, $_timezone, $_lat, $_long, $_countryiso2, $_city, $_region, $_geotimezone, $_isp, $_geosspan, $_grid, $_fromCookie = false)
{
    global $CONFIG;
    if (isnull(getCookieValue("userid"))) {
        setCookieValue("visits", $_externalUser->ExternalStatic->Visits = 1);
    } else {
        if (!isnull(getCookieValue("userid"))) {
            setCookieValue("visits", $_externalUser->ExternalStatic->Visits = getCookieValue("visits") + 1);
        }
    }
    $_externalUser->ExternalStatic->IP = getIP();
    $_externalUser->ExternalStatic->Host = getHost();
    $_externalUser->ExternalStatic->SystemInfo = !isnull($userAgent = getServerParam("HTTP_USER_AGENT")) ? $userAgent : "";
    $_externalUser->ExternalStatic->Language = !isnull($acceptLanguage = getServerParam("HTTP_ACCEPT_LANGUAGE")) ? $acceptLanguage : "";
    if (strlen($_externalUser->ExternalStatic->Language) > 8 || strpos($_externalUser->ExternalStatic->Language, ";") !== false) {
        $parts = explode(";", $_externalUser->ExternalStatic->Language);
        if (count($parts) > 0) {
            $_externalUser->ExternalStatic->Language = $parts[0];
        } else {
            $_externalUser->ExternalStatic->Language = substr($_externalUser->ExternalStatic->Language, 0, 8);
        }
    }
    $_externalUser->ExternalStatic->Resolution = is_array($_resolution) && count($_resolution) == 2 ? $_resolution[0] . " x " . $_resolution[1] : "";
    $_externalUser->ExternalStatic->Resolution .= !isnull($_color) ? " (" . $_color . " Bit)" : "";
    $_externalUser->ExternalStatic->GeoTimezoneOffset = getLocalTimezone($_timezone);
    if (!isnull($_geosspan)) {
        createSSpanFile($_geosspan);
    }
    if (!isnull($CONFIG["wcl_geo_tracking"])) {
        if (!isnull($_lat) && base64_decode($_lat) > -180) {
            setCookieValue(GEO_LATITUDE, $_externalUser->ExternalStatic->GeoLatitude = base64_decode($_lat));
            setCookieValue(GEO_LONGITUDE, $_externalUser->ExternalStatic->GeoLongitude = base64_decode($_long));
            setCookieValue(GEO_COUNTRY_ISO_2, $_externalUser->ExternalStatic->GeoCountryISO2 = base64_decode($_countryiso2));
            setCookieValue(GEO_CITY, $_externalUser->ExternalStatic->GeoCity = base64_decode($_city));
            setCookieValue(GEO_REGION, $_externalUser->ExternalStatic->GeoRegion = base64_decode($_region));
            setCookieValue(GEO_TIMEZONE, $_externalUser->ExternalStatic->GeoTimezoneOffset = base64_decode($_geotimezone));
            setCookieValue(GEO_ISP, $_externalUser->ExternalStatic->GeoISP = base64_decode($_isp));
            setCookieValue("geo_data", time());
        } else {
            if (isset($_lat)) {
                $_externalUser->ExternalStatic->GeoLatitude = base64_decode($_lat);
                $_externalUser->ExternalStatic->GeoLongitude = base64_decode($_long);
            } else {
                if (!isnull(getCookieValue("geo_data"))) {
                    $_externalUser->ExternalStatic->GeoLatitude = getCookieValue(GEO_LATITUDE);
                    $_externalUser->ExternalStatic->GeoLongitude = getCookieValue(GEO_LONGITUDE);
                    $_externalUser->ExternalStatic->GeoCountryISO2 = getCookieValue(GEO_COUNTRY_ISO_2);
                    $_externalUser->ExternalStatic->GeoCity = getCookieValue(GEO_CITY);
                    $_externalUser->ExternalStatic->GeoRegion = getCookieValue(GEO_REGION);
                    $_externalUser->ExternalStatic->GeoTimezoneOffset = getCookieValue(GEO_TIMEZONE);
                    $_externalUser->ExternalStatic->GeoISP = getCookieValue(GEO_ISP);
                    $_fromCookie = true;
                }
            }
        }
        removeSSpanFile(false);
        if ($_fromCookie) {
            $_externalUser->ExternalStatic->GeoResultId = 6;
        } else {
            if (isSSpanFile()) {
                if (@filemtime(FILE_SERVER_GEO_SSPAN) > time() + CONNECTION_ERROR_SPAN) {
                    $_externalUser->ExternalStatic->GeoResultId = 5;
                } else {
                    $_externalUser->ExternalStatic->GeoResultId = 4;
                }
            } else {
                if (base64_decode($_lat) == -777) {
                    $_externalUser->ExternalStatic->GeoResultId = 5;
                } else {
                    if (base64_decode($_lat) == -522) {
                        $_externalUser->ExternalStatic->GeoResultId = 2;
                    } else {
                        if ($_grid != 4) {
                            $_externalUser->ExternalStatic->GeoResultId = 3;
                        } else {
                            $_externalUser->ExternalStatic->GeoResultId = $_grid;
                        }
                    }
                }
            }
        }
        if (strlen($_externalUser->ExternalStatic->Language) == 2 && !isnull(GEO_COUNTRY_ISO_2)) {
            $_externalUser->ExternalStatic->Language .= "-" . $_externalUser->ExternalStatic->GeoCountryISO2;
        }
    }
    $_externalUser->ExternalStatic->Save();
}