diff --git a/application/controllers/AboutController.php b/application/controllers/AboutController.php new file mode 100644 index 000000000..6572d7e8b --- /dev/null +++ b/application/controllers/AboutController.php @@ -0,0 +1,91 @@ +view->appVersion = null; + $this->view->gitCommitID = null; + $this->view->gitCommitDate = null; + + if (false !== ($appVersion = @file( + Icinga::app()->getApplicationDir() . DIRECTORY_SEPARATOR . 'VERSION', + FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES + ))) { + foreach ($appVersion as $av) { + $matches = array(); + if (false === ($res = preg_match( + '/(?view->gitCommitID !== null) { + break; + } + + $matches2 = array(); + if (false === ($res = preg_match( + '/(?view->gitCommitID = $matches2[1]; + if (! isset($matches2[2])) { + break; + } + + foreach (preg_split( + '/\s*,\s*/', $matches2[2], -1, PREG_SPLIT_NO_EMPTY + ) as $refName) { + $matches3 = array(); + if (false === ($res = preg_match( + '/(?view->appVersion = $matches3[1]; + break; + } + } + break; + case 'GitCommitDate': + if ($this->view->gitCommitDate !== null) { + break; + } + + $matches2 = array(); + if (false === ($res = preg_match( + '/(?view->gitCommitDate = $matches2[1]; + } + } + } + } + } +} diff --git a/application/views/scripts/about/index.phtml b/application/views/scripts/about/index.phtml new file mode 100644 index 000000000..0429a5374 --- /dev/null +++ b/application/views/scripts/about/index.phtml @@ -0,0 +1,20 @@ +
+

Icinga Web 2

+ translate('Version: %s'), $appVersion), + array($this->translate('Git commit ID: %s'), $gitCommitID), + array($this->translate('Git commit date: %s'), $gitCommitDate) + ) as $version) { + list($label, $value) = $version; + if ($value !== null) { + $versionInfo[] = sprintf($label, htmlspecialchars($value)); + } + } + ?> +

translate('unknown version') + : nl2br(implode("\n", $versionInfo), false) + ?>

+