Ejemplo n.º 1
0
function popup()
{
    $artica_meta = new mysql_meta();
    $LicenseInfos = $artica_meta->LicenseInfos($_GET["uuid"]);
    $page = CurrentPageName();
    $tpl = new templates();
    $FINAL_TIME = 0;
    if (isset($LicenseInfos["FINAL_TIME"])) {
        $FINAL_TIME = intval($LicenseInfos["FINAL_TIME"]);
    }
    $LICT = "Community Edition";
    if ($LicenseInfos["CORP_LICENSE"]) {
        $LICT = "Entreprise Edition";
    }
    if ($LicenseInfos["ExpiresSoon"] > 0) {
        if ($LicenseInfos["ExpiresSoon"] < 31) {
            $LICT = "<span style='color:red'>{trial_mode}</span>";
        }
    }
    if ($FINAL_TIME > 0) {
        $ExpiresSoon = intval(time_between_day_Web($FINAL_TIME));
        if ($ExpiresSoon < 7) {
            $ExpiresSoon_text = "<strong style='color:red;font-size:16px'>&nbsp;{ExpiresSoon}</strong>";
        }
        $licenseTime = "\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:24px'>{expiredate}:</td>\n\t\t\t\t<td style='font-size:24px'>" . $tpl->time_to_date($FINAL_TIME) . " (" . distanceOfTimeInWords(time(), $FINAL_TIME) . "{$ExpiresSoon_text})</td>\n\t\t\t\t\t</tr>";
    }
    if (is_numeric($LicenseInfos["TIME"])) {
        $tt = distanceOfTimeInWords($LicenseInfos["TIME"], time());
        $last_access = "\n\t\t<tr>\n\t\t<td class=legend style='font-size:24px'>{last_update}:</td>\n\t\t<td style='font-size:24px'>{since} {$tt}</td>\n\t\t</tr>";
    }
    $html = "<div style='font-size:30px'>{$LICT}</div><div style='width:98%' class=form>\n<table style='width:100%'>\n\t</tr>\n\t{$last_access}\n\t<tr>\n\t\t<td class=legend style='font-size:24px'>{company}:</td>\n\t\t<td><span style='font-size:24px;font-weight:bold'>{$LicenseInfos["COMPANY"]}</span></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:24px'>{your_email_address}:</td>\n\t\t\t\t<td><span style='font-size:24px;font-weight:bold'>{$LicenseInfos["EMAIL"]}</span></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:24px'>{nb_employees}:</td>\n\t\t\t\t<td><span style='font-size:24px;font-weight:bold'>" . FormatNumber($LicenseInfos["EMPLOYEES"]) . "</span></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:24px'>{license_number}:</td>\n\t\t\t\t<td style='font-size:24px'>{$LicenseInfos["license_number"]}</td>\n\t\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:24px'>{license_status}:</td>\n\t\t\t<td style='font-size:24px;'>{$LicenseInfos["license_status"]}</td>\n\t\t</tr>\n\t\t{$licenseTime}\n\t</table>\n</td>\n</table></div>";
    echo $tpl->_ENGINE_parse_body($html);
}
Ejemplo n.º 2
0
function server_status()
{
    $PHP5_CURRENT_MEMORY = null;
    if (!$GLOBALS["VERBOSE"]) {
        if (!isset($_GET["without-cache"])) {
            unset($_GET["_"]);
            $md5CacheF = md5("server_status{$_SESSION["uid"]}{$tpl->language}" . serialize($_GET));
            $cachefile = "/usr/share/artica-postfix/ressources/interface-cache/{$md5CacheF}";
            if (file_time_sec_Web($cachefile) < 10) {
                return @file_get_contents($cachefile);
            }
        }
    }
    $BOGOMIPS = 0;
    if (is_file("/usr/share/artica-postfix/ressources/interface-cache/processor_type")) {
        $processor_type = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/interface-cache/processor_type"));
        $BOGOMIPS = intval($processor_type["BOGOMIPS"]);
    }
    $icon = "server-128-ok.png";
    $os = new os_system();
    $sock = new sockets();
    $users = new usersMenus();
    $Warn = false;
    $HyperWarn = true;
    $tpl = new templates();
    $EnableMsftncsi = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableMsftncsi"));
    $EnableIntelCeleron = intval($sock->GET_INFO("EnableIntelCeleron"));
    $ArticaAutoUpateOfficial = $sock->GET_INFO("ArticaAutoUpateOfficial");
    $ArticaAutoUpateNightly = intval($sock->GET_INFO("ArticaAutoUpateNightly"));
    $ArticaUpdateIntervalAllways = intval($sock->GET_INFO("ArticaUpdateIntervalAllways"));
    if (!is_numeric($ArticaAutoUpateOfficial)) {
        $ArticaAutoUpateOfficial = 1;
    }
    $RootPasswordChanged = intval($sock->GET_INFO("RootPasswordChanged"));
    $influxdb_version = @file_get_contents("{$GLOBALS["BASEDIR"]}/influxdb_version");
    $influxdbversionBin = $influxdb_version;
    $RegisterCloudBadEmail = intval($sock->GET_INFO("RegisterCloudBadEmail"));
    $InfluxUseRemote = intval($sock->GET_INFO("InfluxUseRemote"));
    $InfluxUseRemoteInfo = intval($sock->GET_INFO("InfluxUseRemoteInfo"));
    $SessionPathInMemory = intval($sock->GET_INFO("SessionPathInMemory"));
    $EnableBandwithCalculation = intval($sock->GET_INFO("EnableBandwithCalculation"));
    $DashBoardDNSPerfsStats = $sock->GET_INFO("DashBoardDNSPerfsStats");
    $BigDatav3Read = intval($sock->GET_INFO("BigDatav3Read"));
    $EnableArticaMetaClient = intval($sock->GET_INFO("EnableArticaMetaClient"));
    $SquidPerformance = intval($sock->GET_INFO("SquidPerformance"));
    $ArticaTechNetInfluxRepo = unserialize(base64_decode($sock->GET_INFO("ArticaTechNetInfluxRepo")));
    $LicenseInfos = unserialize(base64_decode($sock->GET_INFO("LicenseInfos")));
    $EnableArticaMetaServer = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableArticaMetaServer"));
    if ($EnableArticaMetaServer == 1) {
        $EnableArticaMetaClient = 0;
    }
    if ($EnableArticaMetaClient == 1) {
        $ArticaMetaHost = $sock->GET_INFO("ArticaMetaHost");
        if ($ArticaMetaHost == null) {
            $err[] = proxy_status_warning("{incorrect_meta_server_address}", "{click_to_edit}", "GotoArticaMeta()");
        }
    }
    if ($SessionPathInMemory > 0) {
        exec("/bin/df -h /var/lib/php5 2>&1", $results);
        while (list($num, $ligne) = each($results)) {
            if (!preg_match("#tmpfs\\s+(.+?)\\s+(.+?)\\s+(.+?)\\s+(.+?)%\\s+#", $ligne, $re)) {
                continue;
            }
            $PHP5_CURRENT_MEMORY = $re[4];
            $PHP5_CURRENT_MEMORY_SIZE = $re[1];
        }
    }
    if (!is_file("/usr/share/artica-postfix/ressources/interface-cache/CPU_NUMBER")) {
        $sock = new sockets();
        $CPU_NUMBER = intval($sock->getFrameWork("services.php?CPU-NUMBER=yes"));
    } else {
        $CPU_NUMBER = intval(@file_get_contents("/usr/share/artica-postfix/ressources/interface-cache/CPU_NUMBER"));
    }
    if ($CPU_NUMBER < 2) {
        if ($EnableIntelCeleron == 0) {
            $warn[] = status_important_event("{performance_issue_cpu_number_text}", "{click_to_fix}", "GotoOptimizeSystem()");
        }
    }
    if ($EnableMsftncsi == 1) {
        $msftncsiStatus = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/msftncsiStatus"));
        if ($msftncsiStatus == 3) {
            $warn[] = status_important_event("{network_awareness} !!", "", "GotoWatchdog()");
        }
    }
    $results = array();
    exec("/usr/bin/pgrep -l -f \"philesight --db\" 2>&1", $results);
    while (list($num, $ligne) = each($results)) {
        $ligne = trim($ligne);
        if ($ligne == null) {
            continue;
        }
        if (preg_match("#pgrep#", $ligne)) {
            continue;
        }
        if (!preg_match("#^([0-9]+)\\s+#", $ligne)) {
            $warn[] = status_important_event("{APP_PHILESIGHT_INDEXING}", null, "blur()");
            break;
        }
    }
    $curs = "OnMouseOver=\"this.style.cursor='pointer';\"\n\tOnMouseOut=\"this.style.cursor='auto'\"";
    $os->html_Memory_usage();
    $EnableKerbAuth = intval($sock->GET_INFO("EnableKerbAuth"));
    $MAIN = $os->meta_array;
    $PHP5_CURRENT_MEMORY_COLOR = "black";
    $LOAD_COLOR = "black";
    $ORG_LOAD = $MAIN["LOAD"]["ORG_LOAD"];
    $CPU_NUMBER = $MAIN["LOAD"]["CPU_NUMBER"];
    $MAXOVER = $MAIN["LOAD"]["MAXOVER"];
    $MEM_USED_POURC = $MAIN["MEM"]["MEM_USED_POURC"];
    $MEM_USED_COLOR = "black";
    $SWAP_POURC = $MAIN["SWAP_POURC"];
    $DISKY = array();
    $MAXOVER2 = $CPU_NUMBER - 1;
    if ($MAXOVER2 == 0) {
        $MAXOVER2 = 1.5;
    }
    $EnableIntelCeleronText = null;
    $CURVER = @file_get_contents("VERSION");
    $CURVER_KEY = str_replace(".", "", $CURVER);
    if ($EnableIntelCeleron == 1) {
        $EnableIntelCeleronText = "{intel_celeron_support}";
        $MAXOVER2 = 2;
    }
    $INFO_WORKING_TASK = INFO_WORKING_TASK();
    if (is_array($INFO_WORKING_TASK)) {
        $INFOS = $INFO_WORKING_TASK;
    }
    if (!$users->STATS_APPLIANCE) {
        if ($InfluxUseRemote == 0) {
            if ($EnableIntelCeleron == 0) {
                if ($InfluxUseRemoteInfo == 0) {
                    if ($SquidPerformance < 2) {
                        $INFOS[] = status_info_event("{suggest_remote_statistics_appliance}", "{suggest_remote_statistics_appliance}<br>{click_here}", "Loadjs('influx.remote.suggest.php')");
                    }
                }
            }
        }
    }
    if ($ORG_LOAD > $MAXOVER2) {
        $LOAD_COLOR = "#F59C44";
        $Warn = true;
        $icon = "server-128-warn.png";
        $microerror_text = "{overloaded} {$ORG_LOAD} &raquo; {$MAXOVER2}";
    }
    $SWAPERR = false;
    if ($ORG_LOAD > $MAXOVER) {
        $HyperWarn = true;
        $LOAD_COLOR = "#D32D2D";
        $icon = "server-128-critic.png";
        $microerror_text = "{overloaded} {$ORG_LOAD} &raquo; {$MAXOVER}";
    }
    if ($MEM_USED_POURC > 79) {
        $microerror_text = "{memory_warning}";
        if (!$HyperWarn) {
            $icon = "server-128-warn.png";
        }
        $MEM_USED_COLOR = "#F59C44";
        $jsOn = "GotoSystemMemory()";
        if (!$users->AsArticaAdministrator) {
            $jsOn = "blur()";
        }
        $err[] = "<tr><td style='font-size:18px;color:#d32d2d;vertical-align:middle'>\n\t\t<img src='img/warn-red-32.png' style='float:left;margin-right:10px'>\n\t\t<span style='text-decoration:underline' {$curs} OnClick=\"javascript:{$jsOn}\">{overloaded_memory}</span>\n\t\t</td></tr>";
        $SWAPERR = true;
    }
    if ($MEM_USED_POURC > 90) {
        $microerror_text = "{memory_alert}";
        $icon = "server-128-critic.png";
        $MEM_USED_COLOR = "#D32D2D";
        if (!$SWAPERR) {
            $jsOn = "GotoSystemMemory()";
            if (!$users->AsArticaAdministrator) {
                $jsOn = "blur()";
            }
            $icon = "disks-128-warn.png";
            $err[] = "<tr><td style='font-size:18px;color:#d32d2d;vertical-align:middle'>\n\t\t\t<img src='img/warn-red-32.png' style='float:left;margin-right:10px'>\n\t\t\t<span style='text-decoration:underline' {$curs} OnClick=\"javascript:{$jsOn}\">{overloaded_memory}</span>\n\t\t\t</td></tr>";
            $SWAPERR = true;
        }
    }
    if ($SWAP_POURC > 20) {
        if (!$HyperWarn) {
            $microerror_text = "{swap_warning}";
            $icon = "server-128-warn.png";
        }
        $SWAP_COLOR = "#F59C44";
    }
    if ($PHP5_CURRENT_MEMORY > 80) {
        if (!$HyperWarn) {
            $microerror_text = "{swap_warning}";
            $icon = "server-128-warn.png";
        }
        $PHP5_CURRENT_MEMORY_COLOR = "#F59C44";
    }
    if ($SWAP_POURC > 30) {
        if (!$HyperWarn) {
            $microerror_text = "{swap_warning}";
            $icon = "server-128-warn.png";
        }
        $SWAP_COLOR = "#D32D2D";
    }
    if ($SWAP_POURC > 50) {
        $microerror_text = "{swap_alert}";
        $icon = "server-128-critic.png";
        $SWAP_COLOR = "#D32D2D";
        $jsOn = "GotoSystemMemory()";
        if (!$users->AsArticaAdministrator) {
            $jsOn = "blur()";
        }
        $err[] = proxy_status_warning("{high_swap_value}", "{high_swap_value}", $jsOn);
    }
    if ($PHP5_CURRENT_MEMORY > 95) {
        if (!$HyperWarn) {
            $microerror_text = "{session_memory_warning}";
            $icon = "server-128-warn.png";
        }
        $PHP5_CURRENT_MEMORY_COLOR = "#D32D2D";
    }
    if ($EnableIntelCeleron == 0) {
        $sock->getFrameWork("postgres.php?is-installed=yes");
        $PostgresInstalled = intval($sock->GET_INFO("PostgresInstalled"));
        if ($PostgresInstalled == 0) {
            $jsOn = "Loadjs('influxdb.install.progress.php');";
            if (!$users->AsArticaAdministrator) {
                $jsOn = "blur()";
            }
            $err[] = proxy_status_warning("{influx_not_installed}", "{click_to_install}", $jsOn);
        } else {
            $influxdb_tests = influxdb_tests();
            if ($influxdb_tests != null) {
                $err[] = $influxdb_tests;
            }
        }
    }
    if (isset($LicenseInfos["FINAL_TIME"])) {
        if (is_numeric($LicenseInfos["FINAL_TIME"])) {
            $FINAL_TIME = intval($LicenseInfos["FINAL_TIME"]);
            $ExpiresSoon = intval(time_between_day_Web($FINAL_TIME));
            $jsOn = "GoToArticaLicense()";
            $distanceOfTimeInWords = distanceOfTimeInWords(time(), $FINAL_TIME);
            if (!$users->AsSystemAdministrator) {
                $jsOn = null;
            }
            $corporate_licence_will_expire_explain = $tpl->_ENGINE_parse_body("{corporate_licence_will_expire_explain}");
            $corporate_licence_will_expire_explain = str_replace("%d", $ExpiresSoon, $corporate_licence_will_expire_explain);
            if (time() > $FINAL_TIME) {
                $err[] = proxy_status_warning("{license2}:&nbsp;{license_expired} !!", "{license_expired_explain}", $jsOn);
            }
            if ($FINAL_TIME > time()) {
                if ($ExpiresSoon < 10) {
                    $err[] = proxy_status_warning("{corporate_licence_will_expire} ({$ExpiresSoon} {days})", "{$corporate_licence_will_expire_explain}", $jsOn);
                }
                if ($ExpiresSoon < 31) {
                    $ExpiresSoon = $ExpiresSoon + 1;
                    $warn[] = status_important_event("{license2}:&nbsp;{trial_period} - {$ExpiresSoon} {days} -", "{expiredate}:" . $tpl->time_to_date($FINAL_TIME) . " ({$distanceOfTimeInWords})", $jsOn);
                }
            }
        }
    }
    if (!$users->CGROUPS_INSTALLED) {
        $jsOn = "Loadjs('cgroups.install.progress.php');";
        if (!$users->AsArticaAdministrator) {
            $jsOn = "blur()";
        }
        $warn[] = status_important_event("{cgroups_not_installed}", "{click_to_install}", $jsOn);
    }
    if ($RegisterCloudBadEmail == 1) {
        $warn[] = status_important_event("{incorrect_email_address}", "{incorrect_email_address_cloud}", "GoToArticaLicense()");
    }
    if (!extension_loaded('pgsql')) {
        $warn[] = status_important_event("{missing_postgres_library}", "{missing_postgres_library_explain}", "Loadjs('admin.pgsql.php')");
    } else {
        if (!function_exists("pg_connect")) {
            $warn[] = status_important_event("{missing_postgres_library}", "{missing_postgres_library_explain}", "Loadjs('admin.pgsql.php')");
        }
    }
    if ($BOGOMIPS > 0) {
        if ($users->CGROUPS_INSTALLED) {
            if ($BOGOMIPS < 3500) {
                if ($EnableIntelCeleron == 0) {
                    $jsOn = "Loadjs('system.optimize.celeron.wizard.php');";
                    $err[] = status_important_event("{low_performance}", "{low_performance_link_explain}", $jsOn);
                }
            }
        }
    }
    $q = new mysql();
    $perfs_queue = $q->COUNT_ROWS("perfs_queue", "artica_events");
    if ($perfs_queue > 0) {
        $dashboard_perfs_queue = $tpl->_ENGINE_parse_body("{dashboard_perfs_queue}");
        $dashboard_perfs_queue = str_replace("%s", $perfs_queue, $dashboard_perfs_queue);
        $warn[] = status_important_event($dashboard_perfs_queue, "{$dashboard_perfs_queue}", "GotoDashBoardPerfQueue()");
    }
    $HostType = null;
    if ($users->VMWARE_HOST) {
        $HostType = "VMWare Edition";
        $HostTypejs = "GotoVMWareClient();";
        if (trim($sock->getFrameWork("services.php?vmtools_installed=yes")) != "TRUE") {
            $jsOn = "Loadjs('vmware.install.progress.php');";
            if (!$users->AsArticaAdministrator) {
                $jsOn = "blur()";
            }
            $warn[] = status_important_event("{APP_VMWARE_TOOLS_NOT_INSTALLED}", "{click_to_install}", $jsOn);
        }
    }
    if (is_array($MAIN["DISKS"])) {
        while (list($disk, $array) = each($MAIN["DISKS"])) {
            $POURC = $array["POURC"];
            $LABEL = $array["LABEL"];
            if ($LABEL == null) {
                $LABEL = $disk;
            }
            if ($POURC < 80) {
                continue;
            }
            $DISK_COLOR = "#F59C44";
            $icon = "server-128-warn.png";
            $microerror_text = "{partition_warning}";
            $diskZ = "\t\n\t\t\t<tr>\n\t\t\t<td style='font-size:20px;color:{$DISK_COLOR}'>{$LABEL} {$POURC}% {used}</td>\n\t\t\t</tr>";
            if ($POURC > 95) {
                $DISK_COLOR = "#D32D2D";
                $icon = "server-128-critic.png";
                $diskZ = "\t<tr>\n\t\t\t<td style='font-size:20px;color:{$DISK_COLOR}'>{$LABEL} {$POURC}% {used}</td>\n\t\t\t</tr>";
            }
            $DISKY[] = $diskZ;
        }
    }
    if ($RootPasswordChanged == 0) {
        $jsOn = "Loadjs('system.root.pwd.php')";
        if (!$users->AsSystemAdministrator) {
            $jsOn = null;
        }
        $err[] = status_important_event("{root_password_not_changed}", "{root_password_not_changed_text}", $jsOn);
    }
    if (count($err) > 0) {
        $errT[] = "<tr><td style='font-size:32px;color:#d32d2d;vertical-align:middle'>" . count($err) . " {issues}</td></tr>\n\t\t<tr><td colspan=2>&nbsp;</td></tr>\n\t\t";
    }
    $GotoSpeedTests = "GotoSpeedTests()";
    $GotoBandwidthdStats = "GotoBandwidthdStats()";
    $GoToSystem = "GoToSystem()";
    $GotToArticaUpdate = "GotToArticaUpdate()";
    $GotoOptimizeSystem = "GotoOptimizeSystem()";
    $GotoDNSPerfs = "GotoDNSPerfs()";
    $GotoSystemMemory = "GotoSystemMemory()";
    $GotoStatsSystem = "GotoStatsSystem()";
    $GotoStatsSystem_underline = "underline";
    $HostTypejs_underline = "underline";
    if (!$users->AsSystemAdministrator) {
        $microerror_text = null;
        $HostTypejs_underline = "none";
        $GotoStatsSystem_underline = "none";
        $HostTypejs = "blur();";
        $GoToSystem = "blur()";
        $GotoStatsSystem = "blur()";
        $GotoSystemMemory = "blur()";
        $GotoDNSPerfs = "blur()";
        $GotoOptimizeSystem = "blur()";
        $GotToArticaUpdate = "blur()";
        $GotoBandwidthdStats = "blur()";
        $GotoSpeedTests = "blur()";
    }
    if ($EnableBandwithCalculation == 1) {
        $q = new mysql();
        $sql = "SELECT * FROM speedtests ORDER BY zDate DESC LIMIT 0,1";
        $speedtests = null;
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_events"));
        $download = $ligne["download"];
        $upload = $ligne["upload"];
        $ISP = $ligne["ISP"];
        //Kbi/s upload 51.2 Kbi/s
        if ($download > 0) {
            $speedtests = "\n\t\t\t\t<tr>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t<td style='font-size:16px;'>\n\t\t\t\t<span style='color:black'><a href=\"javascript:blur();\"\n\t\t\t\tOnClick=\"javascript:{$GotoSpeedTests};\" style='text-decoration:{$GotoStatsSystem_underline}'>\n\t\t\t\t{bandwidth}: <i style='font-size:16px'>{$download}Kbit/sec {download2}</i></td>\n\t\t\t\t</tr><tr>\n\t\t\t\t<td style='font-size:16px;'>\n\t\t\t\t<span style='color:black'><a href=\"javascript:blur();\"\n\t\t\t\tOnClick=\"javascript:{$GotoSpeedTests};\" style='text-decoration:{$GotoStatsSystem_underline}'>\n\t\t\t\t{bandwidth}: <i style='font-size:16px'>{$upload}Kbit/sec {upload}</a> ({$ISP})</span></i></td>\n\t\t\t\t</tr>";
        }
    }
    if ($sock->Bandwidthd_enabled() == 1) {
        $q = new mysql_squid_builder();
        $bandwidthd_today = $q->COUNT_ROWS("bandwidthd_today");
        if ($bandwidthd_today > 0) {
            $speedtests = $speedtests . "\n\t\t\t<tr>\n\t\t\t<td style='font-size:18px;'>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t<td valign='middle' style='width:25px'><img src='img/graph-24.png'></td>\n\t\t\t<td valign='middle'>\n\t\t\t<span style='color:black'><a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:{$GotoBandwidthdStats};\" style='text-decoration:{$GotoStatsSystem_underline}'>\n\t\t\t<span style='font-size:18px;font-weight:bold'>{$bandwidthd_today}</span> <span style='font-size:18px;'>{nodes}</span></td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t</td>\n\t\t\t</tr>";
        }
    }
    if ($users->AsSystemAdministrator) {
        if ($EnableArticaMetaClient == 0) {
            if ($ArticaAutoUpateOfficial == 1) {
                $ArticaUpdateRepos = unserialize($sock->GET_INFO("ArticaUpdateRepos"));
                $key_nightly = update_find_latest_nightly($ArticaUpdateRepos);
                $key_offical = update_find_latest($ArticaUpdateRepos);
                $OFFICIALS = $ArticaUpdateRepos["OFF"];
                $Lastest = $OFFICIALS[$key_offical]["VERSION"];
                $MAIN_URI = $OFFICIALS[$key_offical]["URL"];
                $MAIN_MD5 = $OFFICIALS[$key_offical]["MD5"];
                $MAIN_FILENAME = $OFFICIALS[$key_offical]["FILENAME"];
                if ($key_offical > $CURVER_KEY) {
                    $err[] = "<tr><td style='font-size:18px;color:#46a346;vertical-align:middle' nowrap>\n\t\t\t\t<img src='img/32-install-soft.png' style='float:left;margin-right:10px'>\n\t\t\t\t" . texttooltip("{new_version}: {$Lastest}", "{NEW_RELEASE_TEXT}", "{$GotToArticaUpdate}") . "\n\t\t\t\t</td></tr>";
                }
            }
        }
    }
    if ($EnableIntelCeleron == 1) {
        $EnableIntelCeleron_explain = "<tr><td style='font-size:16px;color:#000000;vertical-align:middle' nowrap>\n\t\t\t\t<i>" . texttooltip("{CELERON_METHOD}", "{CELERON_METHOD_EXPLAIN}", $GotoOptimizeSystem) . "</i>\n\t\t\t\t</td></tr>";
    }
    $EnableDNSPerfs = intval(@file_get_contents("/etc/artica-postfix/settings/Daemons/EnableDNSPerfs"));
    if ($EnableDNSPerfs == 1) {
        if ($EnableIntelCeleron == 0) {
            $DNS_COLOR = "black;";
            if ($DashBoardDNSPerfsStats != null) {
                $DashBoardDNSPerfsStats = round($DashBoardDNSPerfsStats, 2);
                if ($DashBoardDNSPerfsStats < 30) {
                    $DNS_COLOR = "#D32D2D";
                }
                $DashBoardDNSPerfsStats_text = "\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td style='font-size:20px;color:{$DNS_COLOR}'>" . texttooltip("{dns_performance}", "{dnsperf_explain}", "{$GotoDNSPerfs}") . ": {$DashBoardDNSPerfsStats}%</td>\n\t\t\t\t\t</tr>";
            }
        }
    }
    if ($microerror_text != null) {
        $microerror_text = "<center style='margin-top:10px;font-weight:bold;font-size:14px'>{$microerror_text}</center>";
    }
    if ($HostType != null) {
        $HostType = "<center style='font-size:14px;margin-top:10px;'>\n\t<a href=\"javascript:blur();\" OnClick=\"javascript:{$HostTypejs}\" style='text-decoration:{$HostTypejs_underline}'>\n\t\t{$HostType}</a></center>";
    }
    $html[] = "\n\t<table style='width:100%'>\n\t<tr>\n\t<td valign='top' style='width:128px'  {$curs} OnClick=\"javascript:{$GoToSystem}\">\n\t\t<img src='img/{$icon}'>{$HostType}{$microerror_text}\n\t</td>\n\t<td>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td style='font-size:30px'  {$curs} OnClick=\"javascript:{$GoToSystem}\">{system}</td>\n\t</tr>\t\n\t<tr>\n\t<td style='font-size:30px;color:{$LOAD_COLOR};text-decoration:{$GotoStatsSystem_underline}' {$curs} OnClick=\"javascript:{$GotoStatsSystem};\">{$ORG_LOAD} {load2}</td>\n\t</tr>\n\t{$EnableIntelCeleron_explain}\n\t<tr>\n\t\t<td style='font-size:20px;'>\n\t\t<span style='color:{$MEM_USED_COLOR}'><a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:{$GotoSystemMemory};\" style='text-decoration:{$GotoStatsSystem_underline}'>\t\t\n\t\t{$MEM_USED_POURC}% {memory}</a></span>&nbsp;|&nbsp;\n\t\t<span style='color:{$SWAP_COLOR}'>{$SWAP_POURC}% SWAP</span></td>\n\t</tr>\n\t";
    if ($users->AsSystemAdministrator) {
        if ($PHP5_CURRENT_MEMORY != null) {
            $html[] = "<tr>\n\t\t\t<td style='font-size:18px;'>\n\t\t\t<span style='color:{$PHP5_CURRENT_MEMORY_COLOR}'><a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:{$GotoSystemMemory};\" style='text-decoration:{$GotoStatsSystem_underline}'>\n\t\t\t{session_memory}: {$PHP5_CURRENT_MEMORY}%/{$PHP5_CURRENT_MEMORY_SIZE}</a></span></td>\n\t\t\t</tr>";
        }
    }
    if ($users->AsSystemAdministrator) {
        if (is_file("/usr/share/artica-postfix/ressources/logs/web/monit.status.all")) {
            $dataMonit = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/web/monit.status.all"));
            $dataMonitCount = count($dataMonit);
            $html[] = "<tr>\n\t\t\t<td style='font-size:18px;'>\n\t\t\t<span style='color:black'><a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:Loadjs('monit.php');\" style='text-decoration:underline'>\n\t\t\t{monitored_processes}: {$dataMonitCount}</a></span></td>\n\t\t\t</tr>";
        }
    }
    if (!$users->AsSystemAdministrator) {
        $INFOS = array();
        $errT = array();
        $err = array();
        $warn = array();
    }
    $html[] = $DashBoardDNSPerfsStats_text;
    if ($speedtests != null) {
        $html[] = $speedtests;
    }
    if (count($INFOS) > 0) {
        $html[] = @implode("", $INFOS);
        $html[] = "<tr><td colspan=2>&nbsp;</td></tr>";
    }
    if (count($DISKY) > 0) {
        $html[] = @implode("", $DISKY);
    }
    $page = CurrentPageName();
    $seqfw = "LoadAjaxRound('sequence-firewall','{$page}?sequence-firewall=yes');";
    if (isset($_GET["nofw"])) {
        $seqfw = null;
    }
    $html[] = "" . @implode("", $errT) . "\n\t" . @implode("", $err) . @implode("", $warn) . "\n\t\t\t\n\t</table>\n\t</td>\n\t</tr>\n\t</table>\n\t<script>\n\t\n\tfunction LoadseQuenceProxy(){\n\t\tLoadAjaxSilent('sequence-proxy','{$page}?sequence-proxy=yes&nofw=yes&sequence=yes');\n\t\n\t}\n\t\n\n\tfunction LoadSequenceServer(){\n\t\t\tif( !document.getElementById('sequence-server')){return;}\n\t\t\t\n\t\t\tvar DASHBOARD_SEQUENCE_SERVER=parseInt(document.getElementById('DASHBOARD_SEQUENCE_SERVER').value);\n\t\t\tif(DASHBOARD_SEQUENCE_SERVER<10){\n\t\t\t\tDASHBOARD_SEQUENCE_SERVER=DASHBOARD_SEQUENCE_SERVER+1;\n\t\t\t\tdocument.getElementById('DASHBOARD_SEQUENCE_SERVER').value=DASHBOARD_SEQUENCE_SERVER;\n\t\t\t\tsetTimeout('LoadSequenceServer()',1000);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\tdocument.getElementById('DASHBOARD_SEQUENCE_SERVER').value=0;\n\t\t\tLoadAjaxSilent('sequence-server','{$page}?sequence-server=yes&nofw=yes&sequence=yes');\n\t\t\tsetTimeout('LoadseQuenceProxy()',20000);\n\t\t}\n\tsetTimeout('LoadSequenceServer()',5000);\n\t</script>\t\t\n\t";
    $html = $tpl->_ENGINE_parse_body(@implode("", $html));
    @file_put_contents($cachefile, $html);
    return $html;
}
Ejemplo n.º 3
0
function license_status()
{
    $sock = new sockets();
    $page = CurrentPageName();
    $tpl = new templates();
    $users = new usersMenus();
    $license_number = null;
    $uuid = base64_decode($sock->getFrameWork("cmd.php?system-unique-id=yes"));
    $RegisterCloudBadEmail = intval($sock->GET_INFO("RegisterCloudBadEmail"));
    $LicenseInfos = unserialize(base64_decode($sock->GET_INFO("LicenseInfos")));
    $WizardSavedSettings = unserialize(base64_decode($sock->GET_INFO("WizardSavedSettings")));
    if ($LicenseInfos["COMPANY"] == null) {
        $LicenseInfos["COMPANY"] = $WizardSavedSettings["company_name"];
    }
    if ($LicenseInfos["EMAIL"] == null) {
        $LicenseInfos["EMAIL"] = $WizardSavedSettings["mail"];
    }
    if (!is_numeric($LicenseInfos["EMPLOYEES"])) {
        $LicenseInfos["EMPLOYEES"] = $WizardSavedSettings["employees"];
    }
    $licenseTime = null;
    $t = time();
    $ASWEB = false;
    if ($users->SQUID_INSTALLED) {
        $ASWEB = true;
    }
    if ($users->WEBSTATS_APPLIANCE) {
        $ASWEB = true;
    }
    if ($users->KASPERSKY_WEB_APPLIANCE) {
        $ASWEB = true;
    }
    $unlocklick_hidden = null;
    $your_email_address_color = null;
    $RegisterCloudBadEmail_text = null;
    if ($RegisterCloudBadEmail == 1) {
        $RegisterCloudBadEmail_text = "<p class=text-error style='font-size:18px'>{incorrect_email_address_cloud}</p>";
        $your_email_address_color = ";color:#d32d2d !important";
    }
    $License_explain = "<div class=explain style='font-size:20px;margin:20px'>" . $tpl->_ENGINE_parse_body("{artica_license_explain}") . "</div>";
    $WhichLicense[null] = "{select}";
    $WhichLicense["evaluation"] = "{request_an_evaluation_license}";
    $WhichLicense["cotation"] = "{request_an_corporate_license}";
    $LICENCE_REQUEST_ERROR = $tpl->javascript_parse_text("{LICENCE_REQUEST_ERROR}");
    if (!isset($LicenseInfos["LICENCE_REQUEST"])) {
        $LicenseInfos["LICENCE_REQUEST"] = null;
    }
    $WhichLicense_field = "<tr>\n\t\t\t\t<td class=legend style='font-size:24px'>{license_request}:</td>\n\t\t\t\t<td style='font-size:24px;font-weight:bold'>\n\t\t\t\t<input type='hidden' id='LICENCE_REQUEST-{$t}' value='evaluation'>\n\t\t\t{request_an_evaluation_license}</td>\n\t\t\t</tr>";
    $unlocklick = "<td>" . Field_text("UNLOCKLIC-{$t}", $LicenseInfos["UNLOCKLIC"], "font-size:24px;width:240px") . "</td>";
    if ($LicenseInfos["license_status"] == null) {
        $step = 1;
        $LicenseInfos["license_status"] = "{waiting_registration}";
        $star = "{explain_license_free}";
        $button_text = "{request_an_evaluation_license}";
    } else {
        $step = 2;
        $step_text = "{waiting_order}";
        $button_text = "{update_the_request}";
        $star = "{explain_license_order}";
        if ($LicenseInfos["LICENCE_REQUEST"] == "evaluation") {
            $step_text = "{request_an_evaluation_license}";
        }
    }
    if ($LicenseInfos["license_status"] == "{license_active}") {
        $users->CORP_LICENSE = true;
        $WhichLicense_field = null;
        $titleprice = null;
        $License_explain = null;
        if ($LicenseInfos["UNLOCKLIC"] != null) {
            $unlocklick = "\n\t\t<td style='font-size:24px;font-weight:bold'>\n\t\t\t<input type='hidden' id='UNLOCKLIC-{$t}' value='{$LicenseInfos["UNLOCKLIC"]}'>\n\t\t\t<div style='float:right'>" . imgtootltip("delete-32.png", "{delete}:{unlock_license}", "Loadjs('{$page}?remove-lock-lic-js=yes')") . "</div>\n\t\t\t<span style='font-size:24px'>{$LicenseInfos["UNLOCKLIC"]}</span>\n\t\t</td>";
        } else {
            $unlocklick = null;
        }
    }
    if ($users->CORP_LICENSE) {
        $star = null;
        $titleprice = null;
        $WhichLicense_field = null;
        $step = 3;
        $step_text = "{license_active}";
    }
    if (is_numeric($LicenseInfos["TIME"])) {
        $tt = distanceOfTimeInWords($LicenseInfos["TIME"], time());
        $last_access = "\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:24px'>{last_update}:</td>\n\t\t\t\t<td style='font-size:24px'>{since} {$tt}</td>\n\t\t\t</tr>";
    }
    if ($LicenseInfos["GoldKey"] != null) {
        $LicenseInfos["license_number"] = $LicenseInfos["GoldKey"];
    }
    if (trim($LicenseInfos["license_number"]) != null) {
        $explain = "{explain_license_order}";
    }
    $CORP_LICENSE = 0;
    $textcolor = "black";
    $bt = "<hr>" . button($button_text, "RegisterSave{$t}()", 26);
    if ($unlocklick != null) {
        $unlock_license = "<tr>\n\t\t\t\t<td class=legend style='font-size:24px'>{unlock_license}:</td>\n\t\t\t\t{$unlocklick}\n\t\t\t</tr>";
    }
    if ($users->CORP_LICENSE) {
        $CORP_LICENSE = 1;
        $textcolor = "#23A83E";
        $paypal = null;
        $explain = null;
        $LicenseInfos["license_status"] = "{license_active}";
    }
    if ($explain != null) {
        $explain = "<div style='font-size:16px' class=explain>{$titleprice}<br>{$explain}</div>";
    }
    $FINAL_TIME = 0;
    if (isset($LicenseInfos["FINAL_TIME"])) {
        $FINAL_TIME = intval($LicenseInfos["FINAL_TIME"]);
    }
    if ($FINAL_TIME > 0) {
        $ExpiresSoon = intval(time_between_day_Web($FINAL_TIME));
        $distanceOfTimeInWords = distanceOfTimeInWords(time(), $FINAL_TIME);
        if ($ExpiresSoon < 7) {
            $ExpiresSoon_text = "<strong style='color:red;font-size:16px'>&nbsp;{ExpiresSoon}</strong>";
        }
        if ($FINAL_TIME < time()) {
            $ExpiresSoon_text = "<strong style='color:red;font-size:16px'>&nbsp;{expired} <i>{license_expired_explain}</i></strong>";
            $distanceOfTimeInWords = null;
        }
        $licenseTime = "\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:24px'>{expiredate}:</td>\n\t\t\t\t<td style='font-size:24px'>" . $tpl->time_to_date($FINAL_TIME) . " ({$distanceOfTimeInWords}{$ExpiresSoon_text})</td>\n\t\t\t</tr>";
    }
    if ($LicenseInfos["license_number"] != null) {
        $license_number = "<tr>\n\t<td class=legend style='font-size:24px'>{license_number}:</td>\n\t<td style='font-size:24px'>{$LicenseInfos["license_number"]}</td>\n\t</tr>";
    }
    $html = "\n{$License_explain}\n<div  style='width:98%;min-height:620px' class=form>\n{$RegisterCloudBadEmail_text}\n<table style='width:100%'>\n<tr>\n\t<td valign='top'>\n\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:24px;vertical-align:middle;'>{step}:</td>\n\t\t\t\t<td style='font-size:28px;font-weight:bold;color:{$textcolor}'>{$step}: {$step_text}<br>\n\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td colspan=2 align=right'>\n\t\t\t\t\t\t\t\t\t<div style='text-align:right'><a href=\"javascript:blur();\" \n\t\t\t\t\t\t\tOnClick=\"javascript:Loadjs('artica.settings.php?js=yes&func-ProxyInterface=yes');\"\n\t\t\t\tstyle='text-decoration:underline;font-size:16px'>{http_proxy}</a>\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t{$last_access}\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:24px'>{uuid}:</td>\n\t\t\t\t<td style='font-size:24px'>{$uuid}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:24px'>{company}:</td>\n\t\t\t\t<td>" . Field_text("COMPANY-{$t}", $LicenseInfos["COMPANY"], "font-size:24px;width:450px") . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:24px{$your_email_address_color}'>{your_email_address}:</td>\n\t\t\t\t<td>" . Field_text("EMAIL-{$t}", $LicenseInfos["EMAIL"], "font-size:24px;width:450px{$your_email_address_color}") . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:24px'>{nb_employees}:</td>\n\t\t\t\t<td>" . Field_text("EMPLOYEES-{$t}", FormatNumber($LicenseInfos["EMPLOYEES"]), "font-size:24px;width:80px") . "</td>\n\t\t\t</tr>\n\t\t\t\n\t\t\t{$WhichLicense_field}\n\n\t\t\t{$unlock_license}\n\t\t\t{$unlocklick_hidden}\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:24px'>{license_status}:</td>\n\t\t\t<td style='font-size:28px;color:{$textcolor}'>{$LicenseInfos["license_status"]}</td>\n\t\t</tr>\n\t\t{$licenseTime}\n\t\t<tr>\n\t\t\t<td colspan=2 align='right'>{$bt}</td>\n\t\t</tr>\n\t</table>\n</td>\n</table>\n\n\t\n<script>\nvar x_RegisterSave{$t}= function (obj) {\n\tvar tempvalue=obj.responseText;\n\tif(tempvalue.length>3){alert(tempvalue);return;}\n\tLoadjs('artica.license.progress.php');\n}\n\t\nfunction RegisterSave{$t}(){\n\tvar XHR = new XHRConnection();\n\t\n\tif(document.getElementById('LICENCE_REQUEST-{$t}')){\n\t\tvar LICENCE_REQUEST=document.getElementById('LICENCE_REQUEST-{$t}').value;\n\t\tif(LICENCE_REQUEST==''){alert('{$LICENCE_REQUEST_ERROR}'); return;}\n\t\tXHR.appendData('LICENCE_REQUEST',LICENCE_REQUEST);\n\t}\n\t\n\tXHR.appendData('COMPANY',document.getElementById('COMPANY-{$t}').value);\n\tXHR.appendData('EMAIL',document.getElementById('EMAIL-{$t}').value);\n\tXHR.appendData('EMPLOYEES',document.getElementById('EMPLOYEES-{$t}').value);\n\t\n\tif( document.getElementById('UNLOCKLIC-{$t}') ){\n\t\tXHR.appendData('UNLOCKLIC',document.getElementById('UNLOCKLIC-{$t}').value);\n\t}\n\tXHR.appendData('REGISTER','1');\n\tXHR.sendAndLoad('{$page}', 'POST',x_RegisterSave{$t});\n}\n\t\nfunction CheckCorpLic(){\n\tvar lic={$CORP_LICENSE};\n}\nCheckCorpLic();\n</script>\n";
    echo $tpl->_ENGINE_parse_body($html);
}