function page() { $sock = new sockets(); $tpl = new templates(); $page = CurrentPageName(); $ArticaAutoUpateOfficial = $sock->GET_INFO("ArticaAutoUpateOfficial"); $ArticaAutoUpateNightly = intval($sock->GET_INFO("ArticaAutoUpateNightly")); $ArticaUpdateIntervalAllways = intval($sock->GET_INFO("ArticaUpdateIntervalAllways")); if (!is_numeric($ArticaAutoUpateOfficial)) { $ArticaAutoUpateOfficial = 1; } $ArticaUpdateRepos = unserialize($sock->GET_INFO("ArticaUpdateRepos")); $EnableArticaMetaClient = intval($sock->GET_INFO("EnableArticaMetaClient")); $WgetBindIpAddress = $sock->GET_INFO("WgetBindIpAddress"); $CurlBandwith = $sock->GET_INFO("CurlBandwith"); $CurlTimeOut = $sock->GET_INFO("CurlTimeOut"); if (!is_numeric($CurlBandwith)) { $CurlBandwith = 0; } if (!is_numeric($CurlTimeOut)) { $CurlTimeOut = 3600; } if ($CurlTimeOut < 720) { $CurlTimeOut = 3600; } $t = time(); $latest_release = null; $info = null; $ip = new networking(); while (list($eth, $cip) = each($ip->array_TCP)) { if ($cip == null) { continue; } $arrcp[$cip] = $cip; } $arrcp[null] = "{default}"; $key_offical = update_find_latest($ArticaUpdateRepos); $CURVER = @file_get_contents("VERSION"); $CURVER_KEY = str_replace(".", "", $CURVER); $OFFICIALS = $ArticaUpdateRepos["OFF"]; $NIGHTLYS = $ArticaUpdateRepos["NIGHT"]; $Lastest = $OFFICIALS[$key_offical]["VERSION"]; $MAIN_URI = $OFFICIALS[$key_offical]["URL"]; $MAIN_MD5 = $OFFICIALS[$key_offical]["MD5"]; $MAIN_FILENAME = $OFFICIALS[$key_offical]["FILENAME"]; $ZINFO = false; if ($key_offical > $CURVER_KEY) { $you_can_update_release = $tpl->_ENGINE_parse_body("{NEW_RELEASE_TEXT}"); $ZINFO = true; $info = "\n\t\t<div style='width:98%;margin-bottom:30px;background-color:white;padding:5px;border:1px solid #CCCCCC'>\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td valign='top' style='width:65px'><img src=img/download-64.png></td>\n\t\t\t<td valign='top' style='width:99%;padding-left:20px'>\n\t\t\t\t<div style='font-size:20px'>{$you_can_update_release}</div>\n\t\t\t\t<div style='font-size:20px;text-align:right;margin-top:30px;text-align:right'>\n\t\t\t\t\n\t\t\t\t" . button("{update_now}: {$Lastest}", "Loadjs('artica.update.progress.php',true)", 20) . "\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t</div>\n\t\t\t</td>\n\t\t</tr>\n\t\t</table>\n\t\t</div>\n\t\t"; } if (!$ZINFO) { if ($ArticaAutoUpateNightly == 1) { $key_nightly = update_find_latest_nightly($ArticaUpdateRepos); if ($key_nightly > $CURVER_KEY) { $you_can_update_release = $tpl->_ENGINE_parse_body("{NEW_RELEASE_TEXT}"); $Lastest = $NIGHTLYS[$key_nightly]["VERSION"]; $info = "\n\t\t\t\t\t<div style='width:98%;margin-bottom:30px;background-color:white;padding:5px;border:1px solid #CCCCCC'>\n\t\t\t\t\t<table style='width:100%'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td valign='top' style='width:65px'><img src=img/download-64.png></td>\n\t\t\t\t\t<td valign='top' style='width:99%;padding-left:20px'>\n\t\t\t\t\t<div style='font-size:20px'>{$you_can_update_release}</div>\n\t\t\t\t\t<div style='font-size:20px;text-align:right;margin-top:30px;text-align:right'>\n\t\t\t\t\t" . button("{update_now}: {$Lastest}", "Loadjs('artica.update.progress.php',true)", 20) . "\n\t\t\t\t\t\n\t\t\t\t\t</div>\n\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t\t</div>\n\t\t\t\t\t"; } } } if ($EnableArticaMetaClient == 1) { $info = "\n\t\t<div style='width:98%;margin-bottom:30px;background-color:white;padding:5px;border:1px solid #CCCCCC'>\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t<td valign='top' style='width:65px'><img src=img/64-info.png></td>\n\t\t<td valign='top' style='width:99%;padding-left:20px'>\n\t\t<div style='font-size:20px'>{update_use_meta_text}</div>\n\t\t\n\t\t</div>\n\t\t</td>\n\t\t</tr>\n\t\t</table>\n\t\t</div>\n\t\t"; } if ($MAIN_MD5 != null) { $latest_release = "\n\t\t<tr>\n\t\t<td style='font-size:22px' class=legend>{official}:</td>\n\t\t<td style='font-size:22px'><a href=\"{$MAIN_URI}\"style='text-decoration:underline'>{$Lastest}</a></td>\n\t\t</tr>"; } if ($ArticaAutoUpateNightly == 1) { $key_nightly = update_find_latest_nightly($ArticaUpdateRepos); $NIGHTLY = $ArticaUpdateRepos["NIGHT"]; $Lastest = $NIGHTLY[$key_nightly]["VERSION"]; $MAIN_URI = $NIGHTLY[$key_nightly]["URL"]; $MAIN_MD5 = $NIGHTLY[$key_nightly]["MD5"]; $MAIN_FILENAME = $NIGHTLY[$key_nightly]["FILENAME"]; if ($MAIN_MD5 != null) { $latest_nightly = "\n\t\t\t<tr>\n\t\t\t\t<td style='font-size:22px' class=legend>{nightly}:</td>\n\t\t\t\t<td style='font-size:22px'><a href=\"{$MAIN_URI}\"style='text-decoration:underline'>{$Lastest}</a></td> \n\t\t\t</tr>"; } } if (preg_match("#^2\\.#", $CURVER)) { $UpgradeTov10 = intval($sock->GET_INFO("UpgradeTov10")); if ($UpgradeTov10 == 0) { $html = FATAL_ERROR_SHOW_128("{need_to_upgrade_to_v10}") . "<center style='margin:50px'>" . button("{perform_upgrade}", "Loadjs('squid.upgradev10.progress.php')", 42) . "</center>"; echo $tpl->_ENGINE_parse_body($html); return; } } $p1 = Paragraphe_switch_img("{update_artica_official}", "{update_artica_official_explain}", "ArticaAutoUpateOfficial-{$t}", $ArticaAutoUpateOfficial, null, 890); $p2 = Paragraphe_switch_img("{update_artica_nightly}", "{update_artica_nightly_explain}", "ArticaAutoUpateNightly-{$t}", $ArticaAutoUpateNightly, null, 890); $p3 = Paragraphe_switch_img("{free_update_during_the_day}", "{free_update_during_the_day_explain2}", "ArticaUpdateIntervalAllways-{$t}", $ArticaUpdateIntervalAllways, null, 890); $WgetBindIpAddress = Field_array_Hash($arrcp, "WgetBindIpAddress", $WgetBindIpAddress, null, null, 0, "font-size:26px;padding:3px;"); if (is_file("/usr/share/artica-postfix/ressources/logs/web/{$CURVER}.txt")) { $whatsnew = "\n\t\t<tr>\n\t\t<td style='font-size:18px;text-align:right' colspan=2 ><i>«<a href=\"javascript:blur();\" \n\t\t\t\tOnClick=\"javascript:Loadjs('artica.whatsnew.php')\" \n\t\t\t\tstyle='text-decoration:underline'>WhatsNew</a>»</i></td>\n\t\t</tr>"; } $html = "<div style='width:99%' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top' style='width:400px'>\n\t\t\t<center style='font-size:22px;margin-bottom:20px'>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td style='font-size:22px' class=legend>{current}:</td>\n\t\t\t\t<td style='font-size:22px'>{$CURVER}</td> \n\t\t\t</tr>\n\t\t\t\n\t\t\t{$latest_release}{$latest_nightly}{$whatsnew}\n\t\t\t</table>\n\t\t\t</center>\n\t\t\t\n\t\t\t<center style='margin-bottom:15px'>" . button("{http_proxy}", "Loadjs('artica.settings.php?js=yes&func-ProxyInterface=yes');", 22, 250) . "</center>\n\t\t\t<center style='margin-bottom:15px'>" . button("{manual_update}", "Loadjs('artica.update-manu.php');", 22, 250) . "</center>\n\t\t\t<center style='margin-bottom:15px'>" . button("{verify}", "Loadjs('artica.verify.updates.php');", 22, 250) . "</center>\n\t\t\n\t\t\t\n\t\t</td>\n\t\t<td valign='top' style='width:1050px;padding-left:50px'>{$info}\n\t{$p1}{$p2}{$p3}\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td width=1% nowrap align='right' class=legend style='font-size:26px'>{WgetBindIpAddress}:</strong></td>\n\t\t<td align='left'>{$WgetBindIpAddress}</td>\n\t</tr>\t\t\t\n\t<tr>\n\t\t<td width=1% nowrap align='right' class=legend style='font-size:26px'>{HTTP_TIMEOUT}:</strong></td>\n\t\t<td align='left' style='font-size:26px'>" . Field_text('CurlTimeOut', $CurlTimeOut, 'font-size:26px;padding:3px;width:90px') . " {seconds}</td>\n\t</tr>\n\t<tr>\n\t\t<td width=1% nowrap align='right' class=legend style='font-size:26px'>{limit_bandwidth}:</strong></td>\n\t\t<td align='left' style='font-size:26px'>" . Field_text('CurlBandwith', $CurlBandwith, 'font-size:26px;padding:3px;width:90px') . " kb/s</td>\n\t</tr>\t\n</table>\t\n\t<hr>\n\t<div style='text-align:right'>" . button("{apply}", "Save{$t}()", 40) . "</div>\n\t</div>\t\t\t\t\n\t</td>\n\t</tr>\n\t</table>\t\n<script>\n\nvar xSave{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>3){alert(results);return;}\n\tRefreshTab('main_config_artica_update');\n}\n\nfunction Save{$t}(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('ArticaAutoUpateOfficial',document.getElementById('ArticaAutoUpateOfficial-{$t}').value);\n\t\tXHR.appendData('ArticaAutoUpateNightly',document.getElementById('ArticaAutoUpateNightly-{$t}').value);\n\t\tXHR.appendData('ArticaUpdateIntervalAllways',document.getElementById('ArticaUpdateIntervalAllways-{$t}').value);\n\t\t\n\t\tif(document.getElementById('WgetBindIpAddress')){\n\t\t\tXHR.appendData('WgetBindIpAddress',document.getElementById('WgetBindIpAddress').value);\n\t\t}\n\t\tif(document.getElementById('CurlBandwith')){\n \t\tXHR.appendData('CurlBandwith',document.getElementById('CurlBandwith').value);\n \t}\n\t\tif(document.getElementById('CurlTimeOut')){\n \t\tXHR.appendData('CurlTimeOut',document.getElementById('CurlTimeOut').value);\n \t} \t\t\n\t\t\n\t\t\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\n}\n</script>"; echo $tpl->_ENGINE_parse_body($html); }
function update_release() { $sock = new sockets(); $unix = new unix(); $autoinstall = true; $tmpdir = $unix->TEMP_DIR(); if (!master_index()) { return false; } $RebootAfterArticaUpgrade = $sock->GET_INFO("RebootAfterArticaUpgrade"); if (!is_numeric($RebootAfterArticaUpgrade)) { $RebootAfterArticaUpgrade = 0; } $EnableScheduleUpdates = $sock->GET_INFO("EnableScheduleUpdates"); $ArticaUpdateIntervalAllways = intval($sock->GET_INFO("EnableScheduleUpdates")); if (!is_numeric($EnableScheduleUpdates)) { $EnableScheduleUpdates = 0; } $ArticaAutoUpateOfficial = $sock->GET_INFO("ArticaAutoUpateOfficial"); $ArticaAutoUpateNightly = intval($sock->GET_INFO("ArticaAutoUpateNightly")); $ArticaUpdateIntervalAllways = intval($sock->GET_INFO("ArticaUpdateIntervalAllways")); $OfficialArticaUri = $sock->GET_INFO("OfficialArticaUri"); if (!is_numeric($ArticaAutoUpateOfficial)) { $ArticaAutoUpateOfficial = 1; } if ($OfficialArticaUri == null) { $OfficialArticaUri = "http://articatech.net/artica.update.php"; } $CheckEveryMinutes = 60; $uri = $OfficialArticaUri; $MyCurrentVersion = GetCurrentVersion(); echo "Starting......: " . date("H:i:s") . " Retreve Index file from cloud...\n"; if (!RefreshIndex()) { echo "Starting......: " . date("H:i:s") . " index file failed\n"; updater_events("Index file failed"); @file_put_contents("/usr/share/artica-postfix/ressources/logs/web/download_progress", 100); die; } if ($RebootAfterArticaUpgrade == 1) { echo "Starting......: " . date("H:i:s") . " Reboot after upgrade is enabled\n"; } $key = update_find_latest(); $MyNextVersion = $key; $array = unserialize(@file_get_contents("/etc/artica-postfix/settings/Daemons/ArticaUpdateRepos")); $OFFICIALS = $array["OFF"]; $Lastest = $OFFICIALS[$key]["VERSION"]; $MAIN_URI = $OFFICIALS[$key]["URL"]; $MAIN_MD5 = $OFFICIALS[$key]["MD5"]; $MAIN_FILENAME = $OFFICIALS[$key]["FILENAME"]; $uri = $MAIN_URI; $nightly = trim(strtolower($ini->_params["NEXT"]["artica-nightly"])); $GLOBALS["lastest-nightly"] = $nightly; echo "Starting......: " . date("H:i:s") . " Last Official release: \"{$Lastest}\"\n"; echo "Starting......: " . date("H:i:s") . " Last Official release: \"{$MAIN_URI}\"\n"; echo "Starting......: " . date("H:i:s") . " Last Official release: \"{$MAIN_MD5}\"\n"; echo "Starting......: " . date("H:i:s") . " Last Nightly release:. \"{$nightly}\"\n"; echo "Starting......: " . date("H:i:s") . " Official release Cur:{$MyCurrentVersion}, Next:{$MyNextVersion}\n"; if ($MyNextVersion == $MyCurrentVersion) { echo "Starting......: " . date("H:i:s") . " Official release {$MyCurrentVersion}/{$MyNextVersion} \"Up to date\"\n"; updater_events("Official release {$MyCurrentVersion}/{$MyNextVersion} UP TO DATE"); return; } if ($MyCurrentVersion > $MyNextVersion) { echo "Starting......: " . date("H:i:s") . " Official release {$MyCurrentVersion}/{$MyNextVersion} \"Up to date\"\n"; updater_events("Official release {$MyCurrentVersion}/{$MyNextVersion} UP TO DATE"); return; } $t1 = time(); _artica_update_event(1, "New official release available version {$Lastest}", null, __FILE__, __LINE__); echo "Starting......: " . date("H:i:s") . " Official release Downloading new version {$Lastest}, please wait\n"; updater_events("Downloading new version {$Lastest}"); $ArticaFileTemp = "{$tmpdir}/{$Lastest}/{$MAIN_FILENAME}"; @mkdir("{$tmpdir}/{$Lastest}", 0755, true); $curl = new ccurl($uri); $curl->Timeout = 2400; $curl->WriteProgress = true; $curl->ProgressFunction = "nightly_progress"; $t = time(); echo "Starting......: " . date("H:i:s") . " Official release Downloading {$uri}\n"; if (!$curl->GetFile($ArticaFileTemp)) { _artica_update_event(0, "Error: Official release Unable to download latest build with error {$curl->error}", null, __FILE__, __LINE__); updater_events("Unable to download latest build with error {$curl->error}"); system_admin_events("Unable to download latest build with error {$curl->error}", __FUNCTION__, __FILE__, __LINE__, "artica-update"); @unlink($ArticaFileTemp); return; } $size = @filesize($ArticaFileTemp) / 1024; $md5_file = md5_file($ArticaFileTemp); if ($md5_file != $MAIN_MD5) { events("Corrupted file {$md5_file} <> {$MAIN_MD5}"); @file_put_contents("/usr/share/artica-postfix/ressources/logs/web/download_progress", 100); die; } echo "Starting......: " . date("H:i:s") . " Official release size:{$size}KB\n"; $took = $unix->distanceOfTimeInWords($t, time(), true); _artica_update_event(2, "{$MAIN_FILENAME} downloaded, took {$took}", null, __FILE__, __LINE__); system_admin_events("{$MAIN_FILENAME} downloaded, took {$took}", __FUNCTION__, __FILE__, __LINE__, "artica-update"); ArticaMeta_release($ArticaFileTemp); events("{$MAIN_FILENAME} downloaded, took {$took}"); echo "Starting......: " . date("H:i:s") . " Checking Artica-meta repository\n"; ArticaMeta_release($ArticaFileTemp); echo "Starting......: " . date("H:i:s") . " Official release took {$took}\n"; $size = @filesize($ArticaFileTemp); $size = FormatBytes($size / 1024, true); if (install_package($ArticaFileTemp, $Lastest)) { return; } events("New Artica update v.{$Lastest}"); _artica_update_event(1, "Nightly build: Artica v.{$Lastest} ({$size})", null, __FILE__, __LINE__); system_admin_events("New Artica update v.{$Lastest}", __FUNCTION__, __FILE__, __LINE__, "artica-update"); }
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} » {$MAXOVER2}"; } $SWAPERR = false; if ($ORG_LOAD > $MAXOVER) { $HyperWarn = true; $LOAD_COLOR = "#D32D2D"; $icon = "server-128-critic.png"; $microerror_text = "{overloaded} {$ORG_LOAD} » {$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}: {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}: {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> </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> </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> | \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> </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; }
function menu() { $sock = new sockets(); $ARTICAVERSION = @file_get_contents("/usr/share/artica-postfix/VERSION"); $unix = new unix(); $HOSTNAME = $unix->hostname_g(); $DIALOG = $unix->find_program("dialog"); $php = $unix->LOCATE_PHP5_BIN(); $FILENAME = "/tmp/bash_update_menu.sh"; $unix = new unix(); $freshclam = $unix->find_program("freshclam"); $nohup = $unix->find_program("nohup"); $EnableArticaMetaServer = intval($sock->GET_INFO("EnableArticaMetaServer")); $ArticaAutoUpateOfficial = $sock->GET_INFO("ArticaAutoUpateOfficial"); $ArticaAutoUpateNightly = intval($sock->GET_INFO("ArticaAutoUpateNightly")); $INFOSMETA = null; if ($EnableArticaMetaServer == 1) { $INFOSMETA = "\\nThis server is connected to the Meta server\\nPlease refer to the meta server to update firmware."; } $diag[] = "{$DIALOG} --clear --nocancel --backtitle \"Software version {$ARTICAVERSION} on {$HOSTNAME}\""; $diag[] = "--title \"[ S N A P S H O T S M E N U ]\""; $diag[] = "--menu \"{$INFOSMETA}You can use the UP/DOWN arrow keys\nChoose the TASK\" 20 100 10"; if (is_file($freshclam)) { $diag[] = "ClamAV \"Update Clamav pattern databases\""; $diag[] = "ClamStat \"Clamav pattern databases status\""; } if ($EnableArticaMetaServer == 0) { $array = unserialize(@file_get_contents("/etc/artica-postfix/settings/Daemons/ArticaUpdateRepos")); $OFFICIALS = $array["OFF"]; $key = update_find_latest(); $Lastest = $OFFICIALS[$key]["VERSION"]; $MAIN_URI = $OFFICIALS[$key]["URL"]; $MAIN_MD5 = $OFFICIALS[$key]["MD5"]; $MAIN_FILENAME = $OFFICIALS[$key]["FILENAME"]; $diag[] = "FirmOFF \"Update to Official version {$Lastest}\""; if ($ArticaAutoUpateNightly == 1) { $array = unserialize(@file_get_contents("/etc/artica-postfix/settings/Daemons/ArticaUpdateRepos")); $OFFICIALS = $array["NIGHT"]; $key = update_find_latest_nightly(); $MyNextVersion = $key; $Lastest = $OFFICIALS[$key]["VERSION"]; $MAIN_URI = $OFFICIALS[$key]["URL"]; $MAIN_MD5 = $OFFICIALS[$key]["MD5"]; $MAIN_FILENAME = $OFFICIALS[$key]["FILENAME"]; $uri = $MAIN_URI; $Lastest = trim(strtolower($Lastest)); $diag[] = "FirmNIGHT \"Update to Intermediate version {$Lastest}\""; } } $diag[] = "Quit \"Return to main menu\" 2>\"\${INPUT}\""; $f[] = "#!/bin/bash"; $f[] = "INPUT=/tmp/menu.sh.\$\$"; $f[] = "OUTPUT=/tmp/output.sh.\$\$"; $f[] = "trap \"rm \$OUTPUT; rm \$INPUT; exit\" SIGHUP SIGINT SIGTERM"; $f[] = "DIALOG=\${DIALOG=dialog}"; $f[] = "function ClamAV(){"; $f[] = "\t/usr/bin/nohup {$php} /usr/share/artica-postfix/exec.freshclam.php --execute --force --progress --cli >/tmp/dns.log 2>&1 &"; $f[] = "\t{$DIALOG} --tailbox /tmp/dns.log 25 150"; $f[] = "}"; $f[] = ""; $f[] = "function ClamStatp(){"; $f[] = "\tTEXT_CLAM=`{$php} /usr/share/artica-postfix/exec.freshclam.php --sigtool-ouput 2>&1`"; $f[] = "\techo \$TEXT_CLAM"; $f[] = "\t{$DIALOG} --title \"ClamAV Pattern Databases status\" --msgbox \"\$TEXT_CLAM\" 30 70"; $f[] = "}"; $f[] = "function FirmOFF(){"; $f[] = "\t/usr/bin/nohup {$php} /usr/share/artica-postfix/exec.nightly.php --force --progress --cli >/tmp/dns.log 2>&1 &"; $f[] = "\t{$DIALOG} --tailbox /tmp/dns.log 25 150"; $f[] = "}"; $f[] = "while true"; $f[] = "do"; $f[] = @implode(" ", $diag); $f[] = "menuitem=\$(<\"\${INPUT}\")"; $f[] = "case \$menuitem in"; $f[] = "ClamAV) ClamAV;;"; $f[] = "ClamStat) ClamStatp;;"; $f[] = "FirmOFF) FirmOFF;;"; $f[] = "FirmNIGHT) FirmOFF;;"; $f[] = "Quit) break;;"; $f[] = "esac"; $f[] = "done\n"; if ($GLOBALS["VERBOSE"]) { echo "Writing {$FILENAME}\n"; } @file_put_contents("{$FILENAME}", @implode("\n", $f)); @chmod("{$FILENAME}", 0755); }