Application version string * @var string $setGITVersion from prepend_adm.php -> Application version string - GIT version * @var array $SETS Settings array */ /* Path settings */ $strPattern = '(admin/[^/]*.php)'; $preRelPath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'PHP_SELF')); $preBasePath = preg_replace($strPattern, '', filter_input(INPUT_SERVER, 'SCRIPT_FILENAME')); /* Define common variables */ $preNoMain = 1; $chkShow = filter_input(INPUT_GET, 'show', FILTER_VALIDATE_INT, array('options' => array('default' => 0))); /* Include preprocessing file */ require $preBasePath . 'functions/prepend_adm.php'; $strCommandLine = ' '; $intCount = 0; /* Get database values */ if ($chkShow === 1) { $strInstallHash = $SETS['install']['hash'] ?? 'nohash'; if (isset($setFileVersion) && ($setFileVersion !== '') && ($setFileVersion !== null)) { $strVersion = $setFileVersion; } else { $strVersion = '0.0.0'; } if (isset($setGITVersion) && ($setGITVersion !== '') && ($setGITVersion !== null)) { $strGITVersion = $setGITVersion; } else { $strGITVersion = '0000-00-00'; } /** @noinspection HttpUrlsUsage */ $versionfeed = 'http://api.wizonet.ch/nagiosql/versioncheck.php?myversion=' . urlencode($strVersion) . '&mygit=' . urlencode($strGITVersion) . '&myhash=' . urlencode($strInstallHash); $strError = ''; if (isset($SETS['network']['proxy'], $SETS['network']['proxyserver']) && ($SETS['network']['proxy'] === '1') && ($SETS['network']['proxyserver'] !== '')) { if (isset($SETS['network']['proxyuser'], $SETS['network']['proxypasswd']) && ($SETS['network']['proxyuser'] !== '') && ($SETS['network']['proxypasswd'] !== '')) { $strProxyAuth = base64_encode($SETS['network']['proxyuser'] . ':' . $SETS['network']['proxypasswd']); $aContext = array( 'http' => array( 'proxy' => 'tcp://' . $SETS['network']['proxyserver'], 'request_fulluri' => true, 'header' => "Proxy-Authorization: Basic $strProxyAuth", 'timeout' => 1, ), ); } else { $aContext = array( 'http' => array( 'proxy' => 'tcp://' . $SETS['network']['proxyserver'], 'request_fulluri' => true, 'timeout' => 1, ), ); } $intErrorReporting = error_reporting(); error_reporting(0); $cxContext = stream_context_create($aContext); } else { $intErrorReporting = error_reporting(); error_reporting(0); $cxContext = stream_context_create(array('http' => array('timeout' => 1))); } $arrFile = file($versionfeed, false, $cxContext); $arrError = error_get_last(); error_reporting($intErrorReporting); if (isset($arrError['message']) && $arrError['message'] !== '') { $strError .= utf8_encode($arrError['message']) . ' (' . translate('check proxy settings') . ')'; } $strInstalled = translate('Installed'); $strAvailable = translate('Available'); $strInformation = translate('Information'); $strVersion = ''; $strRelease = ''; $strRelInfo = ''; $strGIT = ''; if (is_array($arrFile) && count($arrFile) !== 0) { foreach ($arrFile as $elem) { if (substr_count($elem, 'version') !== 0) { $strVersion = trim(strip_tags($elem)); } if (substr_count($elem, 'git') !== 0) { $strGIT = trim(strip_tags($elem)); } if (substr_count($elem, 'release_date') !== 0) { $strRelease = trim(strip_tags($elem)); } if (substr_count($elem, 'error') !== 0) { $strError = trim(strip_tags($elem)); } if (substr_count($elem, 'information') !== 0) { $strRelInfo = trim(strip_tags($elem)); } } } $setFileAvailable = $strVersion; $setFileInformation = ''; if (version_compare($strVersion, $setFileVersion, '==')) { if ($strGIT === $setGITVersion) { $setFileInformation = "" . translate('You already have the latest version installed') . ''; } else { $setFileInformation = "" . translate('You already have the latest version installed') . ' (' . translate('new GIT hotfix version available:') . ' ' . $strVersion . '-' . $strGIT . ')'; } } elseif (version_compare($strVersion, $setFileVersion, '>=')) { $setFileInformation = "" . translate('You are using an old NagiosQL version. Please ' . 'update to the latest stable version') . ': '; $setFileInformation .= '' . 'NagiosQL on Sourceforge'; } elseif (version_compare($strVersion, $setFileVersion, '<=')) { $setFileInformation = "" . translate('You are using a newer development version ' . 'without official support') . ''; } if (($strError !== 'none') && ($strError !== '')) { $setFileInformation = "" . $strError . ''; } ?> Version check
Commandline


Loading...