diff --git a/.vagrant-puppet/files/var/www/html/icingaweb/index.php b/.vagrant-puppet/files/var/www/html/icingaweb/index.php index 86f99f056..9e452ac70 100644 --- a/.vagrant-puppet/files/var/www/html/icingaweb/index.php +++ b/.vagrant-puppet/files/var/www/html/icingaweb/index.php @@ -1,3 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} # namespace Icinga\Application\Controllers; diff --git a/application/controllers/ConfigController.php b/application/controllers/ConfigController.php index ce87f4bf7..31739c30e 100644 --- a/application/controllers/ConfigController.php +++ b/application/controllers/ConfigController.php @@ -1,29 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} use Icinga\Web\Controller\BaseConfigController; diff --git a/application/controllers/DashboardController.php b/application/controllers/DashboardController.php index c44fbfa1f..1f45eacde 100644 --- a/application/controllers/DashboardController.php +++ b/application/controllers/DashboardController.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} use \Zend_Config; diff --git a/application/controllers/ErrorController.php b/application/controllers/ErrorController.php index b4007bb6d..7d30d62e5 100644 --- a/application/controllers/ErrorController.php +++ b/application/controllers/ErrorController.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} // namespace Icinga\Application\Controllers; diff --git a/application/controllers/FilterController.php b/application/controllers/FilterController.php index 149dc14fe..2ffa869db 100644 --- a/application/controllers/FilterController.php +++ b/application/controllers/FilterController.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} use Icinga\Web\Controller\ActionController; diff --git a/application/controllers/IndexController.php b/application/controllers/IndexController.php index 6d042eb64..83ec0dd1d 100644 --- a/application/controllers/IndexController.php +++ b/application/controllers/IndexController.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} # namespace Icinga\Application\Controllers; diff --git a/application/controllers/ListController.php b/application/controllers/ListController.php index cc0255d2c..b790418f7 100644 --- a/application/controllers/ListController.php +++ b/application/controllers/ListController.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} use Icinga\Module\Monitoring\Controller; diff --git a/application/controllers/PreferenceController.php b/application/controllers/PreferenceController.php index 1055451db..cc2ea4e95 100644 --- a/application/controllers/PreferenceController.php +++ b/application/controllers/PreferenceController.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} use Icinga\Web\Controller\BasePreferenceController; diff --git a/application/controllers/SearchController.php b/application/controllers/SearchController.php index 0707aa564..f2bf1ceac 100644 --- a/application/controllers/SearchController.php +++ b/application/controllers/SearchController.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} use \Zend_Controller_Action_Exception as ActionException; diff --git a/application/forms/Authentication/LoginForm.php b/application/forms/Authentication/LoginForm.php index b9eb2f27d..cbe25b623 100644 --- a/application/forms/Authentication/LoginForm.php +++ b/application/forms/Authentication/LoginForm.php @@ -1,4 +1,6 @@ true )); // TODO: We need a place to intercept filled forms before rendering - if (isset($_POST['username'])) { + if ($this->getRequest()->getPost('username') !== null) { $this->getElement('password')->setAttrib('class', 'autofocus'); } else { $this->getElement('username')->setAttrib('class', 'autofocus'); diff --git a/application/forms/Config/Authentication/BaseBackendForm.php b/application/forms/Config/Authentication/BaseBackendForm.php index 13a30957c..7a34f236a 100644 --- a/application/forms/Config/Authentication/BaseBackendForm.php +++ b/application/forms/Config/Authentication/BaseBackendForm.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Form\Config\Authentication; diff --git a/application/forms/Config/Authentication/DbBackendForm.php b/application/forms/Config/Authentication/DbBackendForm.php index 7aa417cea..2c57b82e2 100644 --- a/application/forms/Config/Authentication/DbBackendForm.php +++ b/application/forms/Config/Authentication/DbBackendForm.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Form\Config\Authentication; diff --git a/application/forms/Config/Authentication/LdapBackendForm.php b/application/forms/Config/Authentication/LdapBackendForm.php index 9112f8324..ee90fa95c 100644 --- a/application/forms/Config/Authentication/LdapBackendForm.php +++ b/application/forms/Config/Authentication/LdapBackendForm.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Form\Config\Authentication; diff --git a/application/forms/Config/Authentication/ReorderForm.php b/application/forms/Config/Authentication/ReorderForm.php index b6a3b81f0..a074febea 100644 --- a/application/forms/Config/Authentication/ReorderForm.php +++ b/application/forms/Config/Authentication/ReorderForm.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Form\Config\Authentication; diff --git a/application/forms/Config/ConfirmRemovalForm.php b/application/forms/Config/ConfirmRemovalForm.php index 337fad991..65624c7b5 100644 --- a/application/forms/Config/ConfirmRemovalForm.php +++ b/application/forms/Config/ConfirmRemovalForm.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Form\Config; diff --git a/application/forms/Config/GeneralForm.php b/application/forms/Config/GeneralForm.php index d626be5e8..ced24401c 100644 --- a/application/forms/Config/GeneralForm.php +++ b/application/forms/Config/GeneralForm.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Form\Config; diff --git a/application/forms/Config/LoggingForm.php b/application/forms/Config/LoggingForm.php index 0a343a7c0..b3b4089c8 100644 --- a/application/forms/Config/LoggingForm.php +++ b/application/forms/Config/LoggingForm.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Form\Config; diff --git a/application/forms/Config/ResourceForm.php b/application/forms/Config/ResourceForm.php index 52650411f..9a48c1f56 100644 --- a/application/forms/Config/ResourceForm.php +++ b/application/forms/Config/ResourceForm.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Form\Config; diff --git a/application/forms/Dashboard/AddUrlForm.php b/application/forms/Dashboard/AddUrlForm.php index 84c7791e0..09759a265 100644 --- a/application/forms/Dashboard/AddUrlForm.php +++ b/application/forms/Dashboard/AddUrlForm.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Form\Dashboard; diff --git a/application/forms/Preference/GeneralForm.php b/application/forms/Preference/GeneralForm.php index 03383a708..fbc8f8d74 100644 --- a/application/forms/Preference/GeneralForm.php +++ b/application/forms/Preference/GeneralForm.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Form\Preference; diff --git a/application/views/helpers/DateFormat.php b/application/views/helpers/DateFormat.php index 80c6bc50a..a03316f25 100644 --- a/application/views/helpers/DateFormat.php +++ b/application/views/helpers/DateFormat.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} use Icinga\Application\Icinga; diff --git a/application/views/helpers/FormDateTime.php b/application/views/helpers/FormDateTime.php index 959675afa..07d5fb930 100644 --- a/application/views/helpers/FormDateTime.php +++ b/application/views/helpers/FormDateTime.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} use \Zend_View_Helper_FormElement; diff --git a/application/views/helpers/FormNumber.php b/application/views/helpers/FormNumber.php index 11d25679f..a8768f0b7 100644 --- a/application/views/helpers/FormNumber.php +++ b/application/views/helpers/FormNumber.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} /** diff --git a/application/views/helpers/FormTriStateCheckbox.php b/application/views/helpers/FormTriStateCheckbox.php index df32f8e60..695c9af56 100644 --- a/application/views/helpers/FormTriStateCheckbox.php +++ b/application/views/helpers/FormTriStateCheckbox.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} use \Zend_View_Helper_FormElement; diff --git a/application/views/helpers/Util.php b/application/views/helpers/Util.php index 2ab111fcb..25b209a36 100644 --- a/application/views/helpers/Util.php +++ b/application/views/helpers/Util.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} /** diff --git a/bin/license_writer.py b/bin/license_writer.py index 5357961bb..532839e2e 100755 --- a/bin/license_writer.py +++ b/bin/license_writer.py @@ -1,29 +1,6 @@ #!/usr/bin/python # {{{ICINGA_LICENSE_HEADER}}} -# This file is part of Icinga Web 2. -# -# Icinga Web 2 - Head for multiple monitoring backends. -# Copyright (C) 2013 Icinga Development Team -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# @copyright 2013 Icinga Development Team -# @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 -# @author Icinga Development Team -# # {{{ICINGA_LICENSE_HEADER}}} import sys @@ -191,6 +168,9 @@ def get_license(type): try: return __LICENSE_STORE[type] except(KeyError): + if not LICENSE_DATA: + __LICENSE_STORE[type] = '' + return '' config = FILE_TYPE_CONFIG[type] license_data = [] license_data.extend([''] * config['linesBefore']) @@ -239,8 +219,9 @@ def replace_text(org_data, license_data): test = True elif SECTION_MARKER.search(line) and test == True: test = False - out += license_data - out += '\n' + if license_data: + out += license_data + out += '\n' elif test == True: continue diff --git a/config/authentication.ini.in b/config/authentication.ini.in index 554356492..71d9e4402 100644 --- a/config/authentication.ini.in +++ b/config/authentication.ini.in @@ -1,7 +1,7 @@ ; authentication.ini ; ; Each section listed in this configuration represents a backend used to authenticate users. The backend configurations -: must define a resource referring to a configured database or LDAP connection in the INI file resources.ini. +; must define a resource referring to a configured database or LDAP connection in the INI file resources.ini. ; ; The backends will be processed from top to bottom using the first backend for authentication which reports that ; the user trying to log in is available. diff --git a/config/dashboard/dashboard.ini b/config/dashboard/dashboard.ini index 50e5a6373..8d500f341 100644 --- a/config/dashboard/dashboard.ini +++ b/config/dashboard/dashboard.ini @@ -23,13 +23,21 @@ sort = host_severity title = "Landing page" [Landing.Hostgroups] -url = "monitoring/chart/hostgroup?height=400&width=500" +url = "monitoring/chart/hostgroup" +height = 540 +width = 540 [Landing.Servicegroups] -url = "monitoring/chart/servicegroup?height=360&width=450" +url = "monitoring/chart/servicegroup" +height = 540 +width = 540 [Landing.Unhandled Problem Services] -url = "monitoring/list/services?service_handled=0&service_problem=1" +url = "monitoring/list/services" +service_handled = 0 +service_problem = 1 [Landing.Unhandled Problem Hosts] -url = "monitoring/list/hosts?host_handled=0&host_problem=1" +url = "monitoring/list/hosts" +host_handled = 0 +host_problem = 1 diff --git a/etc/apache/icingaweb.conf.in b/etc/apache/icingaweb.conf.in index 69335368e..0451abf5b 100644 --- a/etc/apache/icingaweb.conf.in +++ b/etc/apache/icingaweb.conf.in @@ -5,6 +5,8 @@ Alias @web_path@ "@prefix@/public" AllowOverride None Order allow,deny Allow from all + # new directive needed in Apache 2.4.3+ + #Require all granted SetEnv ICINGAWEB_CONFIGDIR @icingaweb_config_path@ diff --git a/etc/license_header.txt b/etc/license_header.txt new file mode 100644 index 000000000..db19a8436 --- /dev/null +++ b/etc/license_header.txt @@ -0,0 +1,5 @@ +Icinga Web 2 + +@link https://www.icinga.org/icingaweb2/ +@copyright Copyright (c) 2013-%(YEAR)s Icinga Development Team (https://www.icinga.org) +@license http://www.gnu.org/licenses/gpl-2.0.txt, or any later version \ No newline at end of file diff --git a/library/Icinga/Application/ApplicationBootstrap.php b/library/Icinga/Application/ApplicationBootstrap.php index 428f4c3ef..19fb48b58 100644 --- a/library/Icinga/Application/ApplicationBootstrap.php +++ b/library/Icinga/Application/ApplicationBootstrap.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Application; diff --git a/library/Icinga/Application/Benchmark.php b/library/Icinga/Application/Benchmark.php index fbe967391..c510c61bf 100644 --- a/library/Icinga/Application/Benchmark.php +++ b/library/Icinga/Application/Benchmark.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} /** diff --git a/library/Icinga/Application/Cli.php b/library/Icinga/Application/Cli.php index 31e89f3c9..58daf5f2f 100644 --- a/library/Icinga/Application/Cli.php +++ b/library/Icinga/Application/Cli.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Application; diff --git a/library/Icinga/Application/Config.php b/library/Icinga/Application/Config.php index 8771faa10..e81e8062f 100644 --- a/library/Icinga/Application/Config.php +++ b/library/Icinga/Application/Config.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Application; diff --git a/library/Icinga/Application/EmbeddedWeb.php b/library/Icinga/Application/EmbeddedWeb.php index 4a4620b8e..6a160017c 100644 --- a/library/Icinga/Application/EmbeddedWeb.php +++ b/library/Icinga/Application/EmbeddedWeb.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Application; diff --git a/library/Icinga/Application/Icinga.php b/library/Icinga/Application/Icinga.php index a3a0d3b96..1ab9c36f0 100644 --- a/library/Icinga/Application/Icinga.php +++ b/library/Icinga/Application/Icinga.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Application; diff --git a/library/Icinga/Application/LegacyWeb.php b/library/Icinga/Application/LegacyWeb.php index bf1ff3a45..a5b5beed9 100644 --- a/library/Icinga/Application/LegacyWeb.php +++ b/library/Icinga/Application/LegacyWeb.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Application; diff --git a/library/Icinga/Application/Modules/Manager.php b/library/Icinga/Application/Modules/Manager.php index e38383188..28241adc3 100644 --- a/library/Icinga/Application/Modules/Manager.php +++ b/library/Icinga/Application/Modules/Manager.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Application\Modules; diff --git a/library/Icinga/Application/Modules/Module.php b/library/Icinga/Application/Modules/Module.php index becabdeea..3d5e3752e 100644 --- a/library/Icinga/Application/Modules/Module.php +++ b/library/Icinga/Application/Modules/Module.php @@ -1,12 +1,7 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Application; diff --git a/library/Icinga/Application/Web.php b/library/Icinga/Application/Web.php index 8c2ce1efb..2b45ad683 100644 --- a/library/Icinga/Application/Web.php +++ b/library/Icinga/Application/Web.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Application; @@ -347,7 +322,7 @@ class Web extends ApplicationBootstrap { parent::setupInternationalization(); if ($this->user !== null && $this->user->getPreferences() !== null - && ($locale = $this->user->getPreferences()->get('app.language') !== null) + && (($locale = $this->user->getPreferences()->get('app.language')) !== null) ) { try { Translator::setupLocale($locale); diff --git a/library/Icinga/Application/functions.php b/library/Icinga/Application/functions.php index 0530b6af2..cfa5620ba 100644 --- a/library/Icinga/Application/functions.php +++ b/library/Icinga/Application/functions.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} use \Icinga\Util\Translator; diff --git a/library/Icinga/Application/webrouter.php b/library/Icinga/Application/webrouter.php index 82c630056..71b48b2c7 100644 --- a/library/Icinga/Application/webrouter.php +++ b/library/Icinga/Application/webrouter.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}}} namespace Icinga\Authentication; diff --git a/library/Icinga/Authentication/AuthChain.php b/library/Icinga/Authentication/AuthChain.php index 8f34ed84b..216344735 100644 --- a/library/Icinga/Authentication/AuthChain.php +++ b/library/Icinga/Authentication/AuthChain.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Authentication\Backend; diff --git a/library/Icinga/Authentication/Backend/LdapUserBackend.php b/library/Icinga/Authentication/Backend/LdapUserBackend.php index 22995c708..fe80e900a 100644 --- a/library/Icinga/Authentication/Backend/LdapUserBackend.php +++ b/library/Icinga/Authentication/Backend/LdapUserBackend.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Authentication\Backend; diff --git a/library/Icinga/Authentication/Manager.php b/library/Icinga/Authentication/Manager.php index e13526413..01964ef00 100644 --- a/library/Icinga/Authentication/Manager.php +++ b/library/Icinga/Authentication/Manager.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Authentication; @@ -52,7 +27,7 @@ class Manager * Authenticated user * * @var User - **/ + */ private $user; /** @@ -121,25 +96,24 @@ class Manager ); $this->user = $user; if ($persist == true) { - $session = Session::getSession(); - $session->refreshId(); $this->persistCurrentUser(); } } /** * Writes the current user to the session - **/ + */ public function persistCurrentUser() { $session = Session::getSession(); $session->set('user', $this->user); $session->write(); + $session->refreshId(); } /** * Tries to authenticate the user with the current session - **/ + */ public function authenticateFromSession() { $this->user = Session::getSession()->get('user'); @@ -202,19 +176,19 @@ class Manager } /** - * Purges the current authorization information and removes the user from the session - **/ + * Purges the current authorization information and session + */ public function removeAuthorization() { $this->user = null; - $this->persistCurrentUser(); + Session::getSession()->purge(); } /** * Returns the current user or null if no user is authenticated * * @return User - **/ + */ public function getUser() { return $this->user; @@ -225,7 +199,7 @@ class Manager * * @return array * @see User::getGroups - **/ + */ public function getGroups() { return $this->user->getGroups(); diff --git a/library/Icinga/Authentication/Membership.php b/library/Icinga/Authentication/Membership.php index 2451963d9..2f6e83710 100644 --- a/library/Icinga/Authentication/Membership.php +++ b/library/Icinga/Authentication/Membership.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}}} namespace Icinga\Authentication; diff --git a/library/Icinga/Authentication/UserBackend.php b/library/Icinga/Authentication/UserBackend.php index 9dcf9c641..f90eef1c7 100644 --- a/library/Icinga/Authentication/UserBackend.php +++ b/library/Icinga/Authentication/UserBackend.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}}} namespace Icinga\Authentication; diff --git a/library/Icinga/Chart/Axis.php b/library/Icinga/Chart/Axis.php index 83a3d08b1..00a5f5679 100644 --- a/library/Icinga/Chart/Axis.php +++ b/library/Icinga/Chart/Axis.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Chart; @@ -34,6 +9,7 @@ use Icinga\Chart\Primitive\Drawable; use Icinga\Chart\Primitive\Line; use Icinga\Chart\Primitive\Text; use Icinga\Chart\Render\RenderContext; +use Icinga\Chart\Render\Rotator; use Icinga\Chart\Unit\AxisUnit; use Icinga\Chart\Unit\CalendarUnit; use Icinga\Chart\Unit\LinearUnit; @@ -213,11 +189,11 @@ class Axis implements Drawable $labelField->setFontSize('2.5em'); } + if ($this->labelRotationStyle === self::LABEL_ROTATE_DIAGONAL) { + $labelField = new Rotator($labelField, 45); + } $labelField = $labelField->toSvg($ctx); - if ($this->labelRotationStyle === self::LABEL_ROTATE_DIAGONAL) { - $labelField = $this->rotate($ctx, $labelField, 45); - } $group->appendChild($labelField); if ($this->drawYGrid) { @@ -239,34 +215,6 @@ class Axis implements Drawable } } - /** - * Rotate the given element. - * - * @param RenderContext $ctx The rendering context - * @param DOMElement $el The element to rotate - * @param $degrees The rotation degrees - * - * @return DOMElement - */ - private function rotate(RenderContext $ctx, DOMElement $el, $degrees) - { - // Create a box containing the rotated element relative to the original text position - $container = $ctx->getDocument()->createElement('g'); - $x = $el->getAttribute('x'); - $y = $el->getAttribute('y'); - $container->setAttribute('transform', 'translate(' . $x . ',' . $y . ')'); - $el->removeAttribute('x'); - $el->removeAttribute('y'); - - // Create a rotated box containing the text - $rotate = $ctx->getDocument()->createElement('g'); - $rotate->setAttribute('transform', 'rotate(' . $degrees . ')'); - $rotate->appendChild($el); - - $container->appendChild($rotate); - return $container; - } - /** * Render the vertical axis * @@ -300,9 +248,9 @@ class Axis implements Drawable if ($this->yLabel) { $axisLabel = new Text(-8, 50, $this->yLabel); $axisLabel->setFontSize('2em') - ->setAdditionalStyle(Text::ORIENTATION_VERTICAL) ->setFontWeight('bold') ->setAlignment(Text::ALIGN_MIDDLE); + $axisLabel = new Rotator($axisLabel, 90); $group->appendChild($axisLabel->toSvg($ctx)); } diff --git a/library/Icinga/Chart/Chart.php b/library/Icinga/Chart/Chart.php index d3ce9013e..be436df2a 100644 --- a/library/Icinga/Chart/Chart.php +++ b/library/Icinga/Chart/Chart.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Chart; diff --git a/library/Icinga/Chart/Format.php b/library/Icinga/Chart/Format.php index d55d58b26..80b48ecb5 100644 --- a/library/Icinga/Chart/Format.php +++ b/library/Icinga/Chart/Format.php @@ -1,29 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Chart; diff --git a/library/Icinga/Chart/Graph/BarGraph.php b/library/Icinga/Chart/Graph/BarGraph.php index 675aa76d2..968e4c0f7 100644 --- a/library/Icinga/Chart/Graph/BarGraph.php +++ b/library/Icinga/Chart/Graph/BarGraph.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Chart\Graph; @@ -94,7 +69,7 @@ class BarGraph extends Styleable implements Drawable $group = $doc->createElement('g'); $idx = 0; foreach ($this->dataSet as $point) { - $rect = new Rect($point[0] - 1, $point[1], 2, 100 - $point[1]); + $rect = new Rect($point[0] - 2, $point[1], 4, 100 - $point[1]); $rect->setFill($this->fill); $rect->setStrokeWidth($this->strokeWidth); $rect->setStrokeColor('black'); diff --git a/library/Icinga/Chart/Graph/LineGraph.php b/library/Icinga/Chart/Graph/LineGraph.php index cf3c9bcc1..d12d4eed9 100644 --- a/library/Icinga/Chart/Graph/LineGraph.php +++ b/library/Icinga/Chart/Graph/LineGraph.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} diff --git a/library/Icinga/Chart/Graph/StackedGraph.php b/library/Icinga/Chart/Graph/StackedGraph.php index 7a2152bab..ae4f593e2 100644 --- a/library/Icinga/Chart/Graph/StackedGraph.php +++ b/library/Icinga/Chart/Graph/StackedGraph.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Chart\Graph; diff --git a/library/Icinga/Chart/GridChart.php b/library/Icinga/Chart/GridChart.php index c25cf5e65..ef1682921 100644 --- a/library/Icinga/Chart/GridChart.php +++ b/library/Icinga/Chart/GridChart.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Chart; diff --git a/library/Icinga/Chart/Inline/Inline.php b/library/Icinga/Chart/Inline/Inline.php index 475f5b13f..8faa388bf 100644 --- a/library/Icinga/Chart/Inline/Inline.php +++ b/library/Icinga/Chart/Inline/Inline.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Chart\Inline; diff --git a/library/Icinga/Chart/Inline/PieChart.php b/library/Icinga/Chart/Inline/PieChart.php index a77dd7015..573c5e05d 100644 --- a/library/Icinga/Chart/Inline/PieChart.php +++ b/library/Icinga/Chart/Inline/PieChart.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Chart\Inline; diff --git a/library/Icinga/Chart/Legend.php b/library/Icinga/Chart/Legend.php index 1ac9335c5..46ba8081c 100644 --- a/library/Icinga/Chart/Legend.php +++ b/library/Icinga/Chart/Legend.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Chart; diff --git a/library/Icinga/Chart/Palette.php b/library/Icinga/Chart/Palette.php index 8cf49f535..ef413e73e 100644 --- a/library/Icinga/Chart/Palette.php +++ b/library/Icinga/Chart/Palette.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Chart; diff --git a/library/Icinga/Chart/PieChart.php b/library/Icinga/Chart/PieChart.php index dc7066ad2..222af96bd 100644 --- a/library/Icinga/Chart/PieChart.php +++ b/library/Icinga/Chart/PieChart.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Chart; diff --git a/library/Icinga/Chart/Primitive/Animatable.php b/library/Icinga/Chart/Primitive/Animatable.php index aadb80908..3d4d24f00 100644 --- a/library/Icinga/Chart/Primitive/Animatable.php +++ b/library/Icinga/Chart/Primitive/Animatable.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Chart\Primitive; diff --git a/library/Icinga/Chart/Primitive/Animation.php b/library/Icinga/Chart/Primitive/Animation.php index 545f71da6..dbcdb1a2c 100644 --- a/library/Icinga/Chart/Primitive/Animation.php +++ b/library/Icinga/Chart/Primitive/Animation.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Chart\Primitive; diff --git a/library/Icinga/Chart/Primitive/Canvas.php b/library/Icinga/Chart/Primitive/Canvas.php index e33a2e20d..55159d975 100644 --- a/library/Icinga/Chart/Primitive/Canvas.php +++ b/library/Icinga/Chart/Primitive/Canvas.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} diff --git a/library/Icinga/Chart/Primitive/Circle.php b/library/Icinga/Chart/Primitive/Circle.php index 4d9d75a36..058211bf7 100644 --- a/library/Icinga/Chart/Primitive/Circle.php +++ b/library/Icinga/Chart/Primitive/Circle.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} diff --git a/library/Icinga/Chart/Primitive/Drawable.php b/library/Icinga/Chart/Primitive/Drawable.php index 69b937b7d..ea5dca077 100644 --- a/library/Icinga/Chart/Primitive/Drawable.php +++ b/library/Icinga/Chart/Primitive/Drawable.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Chart\Primitive; diff --git a/library/Icinga/Chart/Primitive/Line.php b/library/Icinga/Chart/Primitive/Line.php index b3a5d7f77..150013f82 100644 --- a/library/Icinga/Chart/Primitive/Line.php +++ b/library/Icinga/Chart/Primitive/Line.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Chart\Primitive; diff --git a/library/Icinga/Chart/Primitive/Path.php b/library/Icinga/Chart/Primitive/Path.php index ea42c58f7..0969e9674 100644 --- a/library/Icinga/Chart/Primitive/Path.php +++ b/library/Icinga/Chart/Primitive/Path.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Chart\Primitive; diff --git a/library/Icinga/Chart/Primitive/PieSlice.php b/library/Icinga/Chart/Primitive/PieSlice.php index e930390a1..1ded01dbd 100644 --- a/library/Icinga/Chart/Primitive/PieSlice.php +++ b/library/Icinga/Chart/Primitive/PieSlice.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Chart\Primitive; diff --git a/library/Icinga/Chart/Primitive/RawElement.php b/library/Icinga/Chart/Primitive/RawElement.php index be0f6c3ee..459a2d1ce 100644 --- a/library/Icinga/Chart/Primitive/RawElement.php +++ b/library/Icinga/Chart/Primitive/RawElement.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Chart\Primitive; diff --git a/library/Icinga/Chart/Primitive/Rect.php b/library/Icinga/Chart/Primitive/Rect.php index 8b86b35fb..36b63912f 100644 --- a/library/Icinga/Chart/Primitive/Rect.php +++ b/library/Icinga/Chart/Primitive/Rect.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Chart\Primitive; diff --git a/library/Icinga/Chart/Primitive/Styleable.php b/library/Icinga/Chart/Primitive/Styleable.php index 9b4a4f59b..248a560d3 100644 --- a/library/Icinga/Chart/Primitive/Styleable.php +++ b/library/Icinga/Chart/Primitive/Styleable.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} diff --git a/library/Icinga/Chart/Primitive/Text.php b/library/Icinga/Chart/Primitive/Text.php index 5cd47e56b..72bed552b 100644 --- a/library/Icinga/Chart/Primitive/Text.php +++ b/library/Icinga/Chart/Primitive/Text.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} @@ -55,16 +30,6 @@ class Text extends Styleable implements Drawable */ const ALIGN_MIDDLE = 'middle'; - /** - * Normal left to right orientation - */ - const ORIENTATION_HORIZONTAL = ""; - - /** - * Top down orientation (rotated by 90°) - */ - const ORIENTATION_VERTICAL = "writing-mode: tb;"; - /** * The x position of the Text * diff --git a/library/Icinga/Chart/Render/LayoutBox.php b/library/Icinga/Chart/Render/LayoutBox.php index 02d99376d..00e75f3c4 100644 --- a/library/Icinga/Chart/Render/LayoutBox.php +++ b/library/Icinga/Chart/Render/LayoutBox.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Chart\Render; diff --git a/library/Icinga/Chart/Render/RenderContext.php b/library/Icinga/Chart/Render/RenderContext.php index ea8d97332..476d36554 100644 --- a/library/Icinga/Chart/Render/RenderContext.php +++ b/library/Icinga/Chart/Render/RenderContext.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} diff --git a/library/Icinga/Chart/Render/Rotator.php b/library/Icinga/Chart/Render/Rotator.php new file mode 100644 index 000000000..934b784b6 --- /dev/null +++ b/library/Icinga/Chart/Render/Rotator.php @@ -0,0 +1,86 @@ +element = $element; + $this->degrees = $degrees; + } + + /** + * Rotate the given element. + * + * @param RenderContext $ctx The rendering context + * @param DOMElement $el The element to rotate + * @param $degrees The amount of degrees + * + * @return DOMElement The rotated DOMElement + */ + private function rotate(RenderContext $ctx, DOMElement $el, $degrees) + { + // Create a box containing the rotated element relative to the original element position + $container = $ctx->getDocument()->createElement('g'); + $x = $el->getAttribute('x'); + $y = $el->getAttribute('y'); + $container->setAttribute('transform', 'translate(' . $x . ',' . $y . ')'); + $el->removeAttribute('x'); + $el->removeAttribute('y'); + + // Put the element into a rotated group + //$rotate = $ctx->getDocument()->createElement('g'); + $el->setAttribute('transform', 'rotate(' . $degrees . ')'); + //$rotate->appendChild($el); + + $container->appendChild($el); + return $container; + } + + /** + * Create the SVG representation from this Drawable + * + * @param RenderContext $ctx The context to use for rendering + * + * @return DOMElement The SVG Element + */ + public function toSvg(RenderContext $ctx) + { + $el = $this->element->toSvg($ctx); + return $this->rotate($ctx, $el, $this->degrees); + } +} \ No newline at end of file diff --git a/library/Icinga/Chart/SVGRenderer.php b/library/Icinga/Chart/SVGRenderer.php index eca1ce99c..390e48739 100644 --- a/library/Icinga/Chart/SVGRenderer.php +++ b/library/Icinga/Chart/SVGRenderer.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Chart; diff --git a/library/Icinga/Chart/Unit/AxisUnit.php b/library/Icinga/Chart/Unit/AxisUnit.php index 9e77bb8dc..dc57f99e0 100644 --- a/library/Icinga/Chart/Unit/AxisUnit.php +++ b/library/Icinga/Chart/Unit/AxisUnit.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Chart\Unit; diff --git a/library/Icinga/Chart/Unit/CalendarUnit.php b/library/Icinga/Chart/Unit/CalendarUnit.php index 8da617ea6..2845303c4 100644 --- a/library/Icinga/Chart/Unit/CalendarUnit.php +++ b/library/Icinga/Chart/Unit/CalendarUnit.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} diff --git a/library/Icinga/Chart/Unit/LinearUnit.php b/library/Icinga/Chart/Unit/LinearUnit.php index dd8c91c8e..d776fe304 100644 --- a/library/Icinga/Chart/Unit/LinearUnit.php +++ b/library/Icinga/Chart/Unit/LinearUnit.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Chart\Unit; @@ -115,17 +90,52 @@ class LinearUnit implements AxisUnit } sort($datapoints); if (!$this->staticMax) { - $this->max = max($this->max, $datapoints[count($datapoints)-1]); + $this->max = max($this->max, $datapoints[count($datapoints) - 1]); } if (!$this->staticMin) { $this->min = min($this->min, $datapoints[0]); } - + if (!$this->staticMin || !$this->staticMax) { + $this->updateMaxValue(); + } $this->currentTick = 0; $this->currentValue = $this->min; return $this; } + /** + * Refresh the range depending on the current values of min, max and nrOfTicks + */ + private function updateMaxValue() + { + $this->max = $this->calculateTickRange($this->max - $this->min, $this->nrOfTicks) * + $this->nrOfTicks + $this->min; + } + + /** + * Determine the minimum tick range that is necessary to display the given value range + * correctly + * + * @param int range The range to display + * @param int ticks The amount of ticks to use + * + * @return int The value for each tick + */ + private function calculateTickRange($range, $ticks) + { + $factor = 1; + $steps = array(1, 2, 5); + $step = 0; + while ($range / ($factor * $steps[$step]) > $ticks) { + $step++; + if ($step === count($steps)) { + $step = 0; + $factor *= 10; + } + } + return $steps[$step] * $factor; + } + /** * Transform the absolute value to an axis relative value * @@ -139,7 +149,7 @@ class LinearUnit implements AxisUnit } elseif ($value > $this->max) { return 100; } else { - return 100 * ($value - $this->min) / ($this->max - $this->min); + return 100 * ($value - $this->min) / $this->max - $this->min; } } @@ -201,6 +211,7 @@ class LinearUnit implements AxisUnit if ($max !== null) { $this->max = $max; $this->staticMax = true; + $this->updateMaxValue(); } } @@ -214,6 +225,7 @@ class LinearUnit implements AxisUnit if ($min !== null) { $this->min = $min; $this->staticMin = true; + $this->updateMaxValue(); } } diff --git a/library/Icinga/Chart/Unit/StaticAxis.php b/library/Icinga/Chart/Unit/StaticAxis.php index 2d776f3b8..6458ae599 100644 --- a/library/Icinga/Chart/Unit/StaticAxis.php +++ b/library/Icinga/Chart/Unit/StaticAxis.php @@ -1,29 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - */ // {{{ICINGA_LICENSE_HEADER}}} diff --git a/library/Icinga/Cli/AnsiScreen.php b/library/Icinga/Cli/AnsiScreen.php index a18b9649e..d3eeed44e 100644 --- a/library/Icinga/Cli/AnsiScreen.php +++ b/library/Icinga/Cli/AnsiScreen.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Config; diff --git a/library/Icinga/Config/PreservingIniWriter.php b/library/Icinga/Config/PreservingIniWriter.php index a89cf268c..67059b6d8 100644 --- a/library/Icinga/Config/PreservingIniWriter.php +++ b/library/Icinga/Config/PreservingIniWriter.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Config; diff --git a/library/Icinga/Data/Browsable.php b/library/Icinga/Data/Browsable.php index 852808d21..4d8d2136f 100644 --- a/library/Icinga/Data/Browsable.php +++ b/library/Icinga/Data/Browsable.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Data\Db; diff --git a/library/Icinga/Data/Db/DbQuery.php b/library/Icinga/Data/Db/DbQuery.php index 266f5f816..3fb74a656 100644 --- a/library/Icinga/Data/Db/DbQuery.php +++ b/library/Icinga/Data/Db/DbQuery.php @@ -1,4 +1,6 @@ escapeForSql(date('Y-m-d H:i:s', $value)); } + /** + * Check for timestamp fields + * + * TODO: This is not here to do automagic timestamp stuff. One may + * override this function for custom voodoo, IdoQuery right now + * does. IMO we need to split whereToSql functionality, however + * I'd prefer to wait with this unless we understood how other + * backends will work. We probably should also rename this + * function to isTimestampColumn(). + * + * @param string $field Field Field name to checked + * @return bool Whether this field expects timestamps + */ + public function isTimestamp($field) + { + return $this; + } + public function whereToSql($col, $sign, $expression) { if ($this->isTimestamp($col)) { diff --git a/library/Icinga/Data/Fetchable.php b/library/Icinga/Data/Fetchable.php index 34c21752e..249a522e3 100644 --- a/library/Icinga/Data/Fetchable.php +++ b/library/Icinga/Data/Fetchable.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Data; diff --git a/library/Icinga/Data/Selectable.php b/library/Icinga/Data/Selectable.php index 2b48b206b..06aa4f93c 100644 --- a/library/Icinga/Data/Selectable.php +++ b/library/Icinga/Data/Selectable.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Exception; diff --git a/library/Icinga/Exception/MissingParameterException.php b/library/Icinga/Exception/MissingParameterException.php index 81df20de0..dda47aeab 100644 --- a/library/Icinga/Exception/MissingParameterException.php +++ b/library/Icinga/Exception/MissingParameterException.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Exception; diff --git a/library/Icinga/Exception/NotImplementedError.php b/library/Icinga/Exception/NotImplementedError.php index 598e01800..01131275d 100644 --- a/library/Icinga/Exception/NotImplementedError.php +++ b/library/Icinga/Exception/NotImplementedError.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Exception; diff --git a/library/Icinga/Exception/ProgrammingError.php b/library/Icinga/Exception/ProgrammingError.php index 809f6690b..282d80db0 100644 --- a/library/Icinga/Exception/ProgrammingError.php +++ b/library/Icinga/Exception/ProgrammingError.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Exception; diff --git a/library/Icinga/Exception/SystemPermissionException.php b/library/Icinga/Exception/SystemPermissionException.php index 77078dcfd..8202e34ac 100644 --- a/library/Icinga/Exception/SystemPermissionException.php +++ b/library/Icinga/Exception/SystemPermissionException.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Exception; diff --git a/library/Icinga/File/Pdf.php b/library/Icinga/File/Pdf.php index 304fc9bfe..2e8a97887 100644 --- a/library/Icinga/File/Pdf.php +++ b/library/Icinga/File/Pdf.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Protocol\Commandpipe; diff --git a/library/Icinga/Protocol/Commandpipe/CommandPipe.php b/library/Icinga/Protocol/Commandpipe/CommandPipe.php index 4e14ba6d9..91be222cd 100644 --- a/library/Icinga/Protocol/Commandpipe/CommandPipe.php +++ b/library/Icinga/Protocol/Commandpipe/CommandPipe.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Protocol\Commandpipe; diff --git a/library/Icinga/Protocol/Commandpipe/Comment.php b/library/Icinga/Protocol/Commandpipe/Comment.php index 5618203d2..2b8caf52b 100644 --- a/library/Icinga/Protocol/Commandpipe/Comment.php +++ b/library/Icinga/Protocol/Commandpipe/Comment.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Protocol\Commandpipe; diff --git a/library/Icinga/Protocol/Commandpipe/Exception/InvalidCommandException.php b/library/Icinga/Protocol/Commandpipe/Exception/InvalidCommandException.php index d49d87f81..662a156e9 100644 --- a/library/Icinga/Protocol/Commandpipe/Exception/InvalidCommandException.php +++ b/library/Icinga/Protocol/Commandpipe/Exception/InvalidCommandException.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Protocol\Commandpipe\Exception; diff --git a/library/Icinga/Protocol/Commandpipe/PropertyModifier.php b/library/Icinga/Protocol/Commandpipe/PropertyModifier.php index eb5a261b8..b398d73c7 100644 --- a/library/Icinga/Protocol/Commandpipe/PropertyModifier.php +++ b/library/Icinga/Protocol/Commandpipe/PropertyModifier.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Protocol\Commandpipe; diff --git a/library/Icinga/Protocol/Commandpipe/Transport/LocalPipe.php b/library/Icinga/Protocol/Commandpipe/Transport/LocalPipe.php index 65a3dab45..ecf1a981c 100644 --- a/library/Icinga/Protocol/Commandpipe/Transport/LocalPipe.php +++ b/library/Icinga/Protocol/Commandpipe/Transport/LocalPipe.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Protocol\Commandpipe\Transport; diff --git a/library/Icinga/Protocol/Commandpipe/Transport/SecureShell.php b/library/Icinga/Protocol/Commandpipe/Transport/SecureShell.php index cc51a5180..f1505c2ef 100644 --- a/library/Icinga/Protocol/Commandpipe/Transport/SecureShell.php +++ b/library/Icinga/Protocol/Commandpipe/Transport/SecureShell.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Protocol\Commandpipe\Transport; diff --git a/library/Icinga/Protocol/Commandpipe/Transport/Transport.php b/library/Icinga/Protocol/Commandpipe/Transport/Transport.php index d586cc53c..c5a5b3883 100644 --- a/library/Icinga/Protocol/Commandpipe/Transport/Transport.php +++ b/library/Icinga/Protocol/Commandpipe/Transport/Transport.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Protocol\Commandpipe\Transport; diff --git a/library/Icinga/Protocol/Dns.php b/library/Icinga/Protocol/Dns.php index cb8681080..92e8b2a4d 100644 --- a/library/Icinga/Protocol/Dns.php +++ b/library/Icinga/Protocol/Dns.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Protocol; diff --git a/library/Icinga/Protocol/File/Exception/FileReaderException.php b/library/Icinga/Protocol/File/Exception/FileReaderException.php new file mode 100644 index 000000000..3e0890a57 --- /dev/null +++ b/library/Icinga/Protocol/File/Exception/FileReaderException.php @@ -0,0 +1,10 @@ +sortDir = ($dir === null || strtoupper(trim($dir)) === 'DESC') ? self::SORT_DESC : self::SORT_ASC; + $this->sortDir = ( + $direction === null || strtoupper(trim($direction)) === 'DESC' + ) ? self::SORT_DESC : self::SORT_ASC; return $this; } @@ -80,4 +83,4 @@ class Query extends SimpleQuery { return $this->filters; } -} \ No newline at end of file +} diff --git a/library/Icinga/Protocol/File/Reader.php b/library/Icinga/Protocol/File/Reader.php index f5677e855..50842bc4a 100644 --- a/library/Icinga/Protocol/File/Reader.php +++ b/library/Icinga/Protocol/File/Reader.php @@ -4,38 +4,92 @@ namespace Icinga\Protocol\File; -use Icinga\Data\DatasourceInterface; +use FilterIterator; +use Iterator; +use Zend_Config; +use Icinga\Protocol\File\FileReaderException; +use Icinga\Util\File; /** - * Class Reader - * * Read file line by line - * - * @package Icinga\Protocol\File */ -class Reader implements DatasourceInterface +class Reader extends FilterIterator { /** - * Name of the file to read + * A PCRE string with the fields to extract from the file's lines as named subpatterns * * @var string */ - private $filename; + protected $fields; /** - * Configuration for this Datasource + * An associative array of the current line's fields ($field => $value) * - * @var \Zend_Config + * @var array */ - private $config; + protected $currentData; /** - * @param \Zend_Config $config + * Create a new reader + * + * @param Zend_Config $config + * + * @throws FileReaderException If a required $config directive (filename or fields) is missing */ - public function __construct($config) + public function __construct(Zend_Config $config) { - $this->config = $config; - $this->filename = $config->filename; + foreach (array('filename', 'fields') as $key) { + if (! isset($config->{$key})) { + throw new FileReaderException('The directive `' . $key . '\' is required'); + } + } + $this->fields = $config->fields; + $f = new File($config->filename); + $f->setFlags( + File::DROP_NEW_LINE | + File::READ_AHEAD | + File::SKIP_EMPTY + ); + parent::__construct($f); + } + + /** + * Return the current data + * + * @return array + */ + public function current() + { + return $this->currentData; + } + + /** + * Accept lines matching the given PCRE pattern + * + * @return bool + * + * @throws FileReaderException If PHP failed parsing the PCRE pattern + */ + public function accept() + { + $data = array(); + $matched = @preg_match( + $this->fields, + $this->getInnerIterator()->current(), + $data + ); + if ($matched === false) { + throw new FileReaderException('Failed parsing regular expression!'); + } else if ($matched === 1) { + foreach ($data as $key) { + if (is_int($key)) { + unset($data[$key]); + } + } + $this->currentData = $data; + return true; + } + return false; } /** @@ -48,27 +102,78 @@ class Reader implements DatasourceInterface return new Query($this); } + /** + * Return the number of available valid lines. + * + * @return int + */ + public function count() + { + return iterator_count($this); + } + /** * Fetch result as an array of objects * - * @return array + * @param Query $query + * + * @return array */ public function fetchAll(Query $query) { $all = array(); foreach ($this->fetchPairs($query) as $index => $value) { - $all[$index] = new \stdClass(); - foreach ($value as $key => $value_2) { - $all[$index]->{$key} = $value_2; - } + $all[$index] = (object) $value; } return $all; } + /** + * Fetch result as a key/value pair array + * + * @param Query $query + * + * @return array + */ + public function fetchPairs(Query $query) + { + $skipLines = $query->getOffset(); + $readLines = $query->getLimit(); + if ($skipLines === null) { + $skipLines = 0; + } + $lines = array(); + if ($query->sortDesc()) { + $count = $this->count($query); + if ($count <= $skipLines) { + return $lines; + } else if ($count < ($skipLines + $readLines)) { + $readLines = $count - $skipLines; + $skipLines = 0; + } else { + $skipLines = $count - ($skipLines + $readLines); + } + } + foreach ($this as $index => $line) { + if ($index >= $skipLines) { + if ($index >= $skipLines + $readLines) { + break; + } + $lines[] = $line; + } + } + if ($query->sortDesc()) { + $lines = array_reverse($lines); + } + return $lines; + } + /** * Fetch first result row * - * @return object + * @param Query $query + * + * @return object */ public function fetchRow(Query $query) { @@ -82,14 +187,16 @@ class Reader implements DatasourceInterface /** * Fetch first result column * - * @return array + * @param Query $query + * + * @return array */ public function fetchColumn(Query $query) { $column = array(); - foreach ($this->fetchPairs($query) as $value) { - foreach ($value as $value_2) { - $column[] = $value_2; + foreach ($this->fetchPairs($query) as $pair) { + foreach ($pair as $value) { + $column[] = $value; break; } } @@ -99,7 +206,9 @@ class Reader implements DatasourceInterface /** * Fetch first column value from first result row * - * @return mixed + * @param Query $query + * + * @return mixed */ public function fetchOne(Query $query) { @@ -111,215 +220,4 @@ class Reader implements DatasourceInterface } return null; } - - /** - * Fetch result as a key/value pair array - * - * @return array - */ - public function fetchPairs(Query $query) - { - return $this->read($query); - } - - /** - * If given $line matches the $query's PCRE pattern and contains all the strings in the $query's filters array, - * return an associative array of the matches of the PCRE pattern. - * Otherwise, return false. - * If preg_match returns false, it failed parsing the PCRE pattern. - * In that case, throw an exception. - * - * @param string $line - * @param Query $query - * - * @return array|bool - * - * @throws \Exception - */ - public function validateLine($line, Query $query) - { - $data = array(); - $PCRE_result = @preg_match($this->config->fields, $line, $data); - if ($PCRE_result === false) { - throw new \Exception('Failed parsing regular expression!'); - } else if ($PCRE_result === 1) { - foreach ($query->getFilters() as $filter) { - if (strpos($line, $filter) === false) { - return false; - } - } - foreach ($data as $key => $value) { - if (is_int($key)) { - unset($data[$key]); - } - } - return $data; - } - return false; - } - - /** - * Skip and read as many lines as needed according to given $query. - * - * @param Query $query - * - * @return array result - */ - public function read(Query $query) - { - $skip_lines = $query->getOffset(); - $read_lines = $query->getLimit(); - if ($skip_lines === null) { - $skip_lines = 0; - } - return $this->{$query->sortDesc() ? 'readFromEnd' : 'readFromStart'}($skip_lines, $read_lines, $query); - } - - /** - * Backend for $this->read - * Direction: LIFO - */ - public function readFromEnd($skip_lines, $read_lines, Query $query) - { - $PHP_EOL_len = strlen(PHP_EOL); - $lines = array(); - $s = ''; - $f = @fopen($this->filename, 'rb'); - if ($f !== false) { - $buffer = ''; - fseek($f, 0, SEEK_END); - if (ftell($f) === 0) { - return array(); - } - while ($read_lines === null || count($lines) < $read_lines) { - $c = $this->fgetc($f, $buffer); - if ($c === false) { - $l = $this->validateLine($s, $query); - if (!($l === false || $skip_lines)) { - $lines[] = $l; - } - break; - } - $s = $c . $s; - if (strpos($s, PHP_EOL) === 0) { - $l = $this->validateLine((string)substr($s, $PHP_EOL_len), $query); - if ($l !== false) { - if ($skip_lines) { - $skip_lines--; - } else { - $lines[] = $l; - } - } - $s = ''; - } - } - } - return $lines; - } - - /** - * Backend for $this->readFromEnd - */ - public function fgetc($file, &$buffer) - { - $strlen = strlen($buffer); - if ($strlen === 0) { - $pos = ftell($file); - if ($pos === 0) { - return false; - } - if ($pos < 4096) { - fseek($file, 0); - $buffer = fread($file, $pos); - fseek($file, 0); - } else { - fseek($file, -4096, SEEK_CUR); - $buffer = fread($file, 4096); - fseek($file, -4096, SEEK_CUR); - } - return $this->fgetc($file, $buffer); - } else { - $char = substr($buffer, -1); - $buffer = substr($buffer, 0, $strlen - 1); - return $char; - } - } - - /** - * Backend for $this->read - * Direction: FIFO - */ - public function readFromStart($skip_lines, $read_lines, Query $query) - { - $PHP_EOL_len = strlen(PHP_EOL); - $lines = array(); - $s = ''; - $f = @fopen($this->filename, 'rb'); - if ($f !== false) { - $buffer = ''; - while ($read_lines === null || count($lines) < $read_lines) { - if (strlen($buffer) === 0) { - $buffer = fread($f, 4096); - if (strlen($buffer) === 0) { - $l = $this->validateLine($s, $query); - if (!($l === false || $skip_lines)) { - $lines[] = $l; - } - break; - } - } - $s .= substr($buffer, 0, 1); - $buffer = substr($buffer, 1); - if (strpos($s, PHP_EOL) !== false) { - $l = $this->validateLine((string)substr($s, 0, strlen($s) - $PHP_EOL_len), $query); - if ($l !== false) { - if ($skip_lines) { - $skip_lines--; - } else { - $lines[] = $l; - } - } - $s = ''; - } - } - } - return $lines; - } - - /** - * Return the number of available valid lines. - * - * @param Query $query - * - * @return int - */ - public function count(Query $query) { - $PHP_EOL_len = strlen(PHP_EOL); - $lines = 0; - $s = ''; - $f = @fopen($this->filename, 'rb'); - if ($f !== false) { - $buffer = ''; - while (true) { - if (strlen($buffer) === 0) { - $buffer = fread($f, 4096); - if (strlen($buffer) === 0) { - if ($this->validateLine($s, $query) !== false) { - $lines++; - } - break; - } - } - $s .= substr($buffer, 0, 1); - $buffer = substr($buffer, 1); - if (strpos($s, PHP_EOL) !== false) { - if ($this->validateLine((string)substr($s, 0, strlen($s) - $PHP_EOL_len), $query) !== false) { - $lines++; - } - $s = ''; - } - } - } - return $lines; - } } diff --git a/library/Icinga/Protocol/Ldap/Connection.php b/library/Icinga/Protocol/Ldap/Connection.php index f6aaa6511..edd99d021 100644 --- a/library/Icinga/Protocol/Ldap/Connection.php +++ b/library/Icinga/Protocol/Ldap/Connection.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Protocol\Ldap; diff --git a/library/Icinga/Protocol/Ldap/Exception.php b/library/Icinga/Protocol/Ldap/Exception.php index 7d6eb7317..41a5b782b 100644 --- a/library/Icinga/Protocol/Ldap/Exception.php +++ b/library/Icinga/Protocol/Ldap/Exception.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Protocol\Ldap; diff --git a/library/Icinga/Protocol/Ldap/LdapUtils.php b/library/Icinga/Protocol/Ldap/LdapUtils.php index 1be25a2f1..8232ebf67 100644 --- a/library/Icinga/Protocol/Ldap/LdapUtils.php +++ b/library/Icinga/Protocol/Ldap/LdapUtils.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Protocol\Ldap; diff --git a/library/Icinga/Protocol/Ldap/Node.php b/library/Icinga/Protocol/Ldap/Node.php index 0332de7b3..8e9570d25 100644 --- a/library/Icinga/Protocol/Ldap/Node.php +++ b/library/Icinga/Protocol/Ldap/Node.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Protocol\Ldap; diff --git a/library/Icinga/Protocol/Ldap/Query.php b/library/Icinga/Protocol/Ldap/Query.php index 13193885e..3d380f9c7 100644 --- a/library/Icinga/Protocol/Ldap/Query.php +++ b/library/Icinga/Protocol/Ldap/Query.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Protocol\Ldap; diff --git a/library/Icinga/Protocol/Livestatus/Connection.php b/library/Icinga/Protocol/Livestatus/Connection.php index fe440c788..0b37f3fcf 100644 --- a/library/Icinga/Protocol/Livestatus/Connection.php +++ b/library/Icinga/Protocol/Livestatus/Connection.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Protocol\Statusdat\Exception; diff --git a/library/Icinga/Protocol/Statusdat/IReader.php b/library/Icinga/Protocol/Statusdat/IReader.php index adde66f80..0f9a7d73f 100644 --- a/library/Icinga/Protocol/Statusdat/IReader.php +++ b/library/Icinga/Protocol/Statusdat/IReader.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Protocol\Statusdat; diff --git a/library/Icinga/Protocol/Statusdat/ObjectContainer.php b/library/Icinga/Protocol/Statusdat/ObjectContainer.php index 42ec2f236..8fc267bf3 100644 --- a/library/Icinga/Protocol/Statusdat/ObjectContainer.php +++ b/library/Icinga/Protocol/Statusdat/ObjectContainer.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Protocol\Statusdat; diff --git a/library/Icinga/Protocol/Statusdat/Parser.php b/library/Icinga/Protocol/Statusdat/Parser.php index f53e8dd41..f2c2e7793 100644 --- a/library/Icinga/Protocol/Statusdat/Parser.php +++ b/library/Icinga/Protocol/Statusdat/Parser.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Protocol\Statusdat; diff --git a/library/Icinga/Protocol/Statusdat/PrintableObject.php b/library/Icinga/Protocol/Statusdat/PrintableObject.php index 5382fc88d..840a7aa2a 100644 --- a/library/Icinga/Protocol/Statusdat/PrintableObject.php +++ b/library/Icinga/Protocol/Statusdat/PrintableObject.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Protocol\Statusdat; diff --git a/library/Icinga/Protocol/Statusdat/Query.php b/library/Icinga/Protocol/Statusdat/Query.php index d80449a13..4ab7c3053 100644 --- a/library/Icinga/Protocol/Statusdat/Query.php +++ b/library/Icinga/Protocol/Statusdat/Query.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Protocol\Statusdat; diff --git a/library/Icinga/Protocol/Statusdat/Query/Expression.php b/library/Icinga/Protocol/Statusdat/Query/Expression.php index b3cb1c655..1a04f07ff 100644 --- a/library/Icinga/Protocol/Statusdat/Query/Expression.php +++ b/library/Icinga/Protocol/Statusdat/Query/Expression.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Protocol\Statusdat\Query; diff --git a/library/Icinga/Protocol/Statusdat/Query/Group.php b/library/Icinga/Protocol/Statusdat/Query/Group.php index cf091599a..51f4c2cf8 100644 --- a/library/Icinga/Protocol/Statusdat/Query/Group.php +++ b/library/Icinga/Protocol/Statusdat/Query/Group.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Protocol\Statusdat\Query; diff --git a/library/Icinga/Protocol/Statusdat/Query/IQueryPart.php b/library/Icinga/Protocol/Statusdat/Query/IQueryPart.php index 70c91f168..1dcd434df 100644 --- a/library/Icinga/Protocol/Statusdat/Query/IQueryPart.php +++ b/library/Icinga/Protocol/Statusdat/Query/IQueryPart.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Protocol\Statusdat\Query; diff --git a/library/Icinga/Protocol/Statusdat/Reader.php b/library/Icinga/Protocol/Statusdat/Reader.php index 342e09af1..e9b767127 100644 --- a/library/Icinga/Protocol/Statusdat/Reader.php +++ b/library/Icinga/Protocol/Statusdat/Reader.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Protocol\Statusdat; diff --git a/library/Icinga/Protocol/Statusdat/RuntimeStateContainer.php b/library/Icinga/Protocol/Statusdat/RuntimeStateContainer.php index bba702c79..b15dfe4bb 100644 --- a/library/Icinga/Protocol/Statusdat/RuntimeStateContainer.php +++ b/library/Icinga/Protocol/Statusdat/RuntimeStateContainer.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Protocol\Statusdat; diff --git a/library/Icinga/Protocol/Statusdat/View/AccessorStrategy.php b/library/Icinga/Protocol/Statusdat/View/AccessorStrategy.php index b266e3ae6..4e4bc76a1 100644 --- a/library/Icinga/Protocol/Statusdat/View/AccessorStrategy.php +++ b/library/Icinga/Protocol/Statusdat/View/AccessorStrategy.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Protocol\Statusdat\View; diff --git a/library/Icinga/Protocol/Statusdat/View/MonitoringObjectList.php b/library/Icinga/Protocol/Statusdat/View/MonitoringObjectList.php index 8cdda5351..8c6fdf0bc 100644 --- a/library/Icinga/Protocol/Statusdat/View/MonitoringObjectList.php +++ b/library/Icinga/Protocol/Statusdat/View/MonitoringObjectList.php @@ -1,4 +1,6 @@ setSessionId('1234'); $form->initCsrfToken(); $token = $form->getValue($form->getTokenElementName()); if ($token !== null) { diff --git a/library/Icinga/Test/DbTest.php b/library/Icinga/Test/DbTest.php index fcbae37f3..cf6887285 100644 --- a/library/Icinga/Test/DbTest.php +++ b/library/Icinga/Test/DbTest.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Test; diff --git a/library/Icinga/Test/FormTest.php b/library/Icinga/Test/FormTest.php index 586db1f3c..e8b070483 100644 --- a/library/Icinga/Test/FormTest.php +++ b/library/Icinga/Test/FormTest.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Test; diff --git a/library/Icinga/User.php b/library/Icinga/User.php index 9a759e529..848877850 100644 --- a/library/Icinga/User.php +++ b/library/Icinga/User.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga; diff --git a/library/Icinga/User/Message.php b/library/Icinga/User/Message.php index 79d907d81..83d780563 100644 --- a/library/Icinga/User/Message.php +++ b/library/Icinga/User/Message.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\User; diff --git a/library/Icinga/User/Preferences/Store/DbStore.php b/library/Icinga/User/Preferences/Store/DbStore.php index 54d1f9380..728637a35 100644 --- a/library/Icinga/User/Preferences/Store/DbStore.php +++ b/library/Icinga/User/Preferences/Store/DbStore.php @@ -107,14 +107,10 @@ class DbStore extends PreferencesStore $this->insert($toBeInserted); } - $current = $this->preferences; - $toBeUpdated = array(); - foreach (array_filter( - array_keys(array_intersect_key($preferences, $this->preferences)), - function ($k) use ($current, $preferences) { return $current[$k] == $preferences[$k] ? false : true; } - ) as $key) { - $toBeUpdated[$key] = $preferences[$key]; - } + $toBeUpdated = array_intersect_key( + array_diff_assoc($preferences, $this->preferences), + array_diff_assoc($this->preferences, $preferences) + ); if (!empty($toBeUpdated)) { $this->update($toBeUpdated); } diff --git a/library/Icinga/User/Preferences/Store/IniStore.php b/library/Icinga/User/Preferences/Store/IniStore.php index 7b7d58503..eb1c4cbfb 100644 --- a/library/Icinga/User/Preferences/Store/IniStore.php +++ b/library/Icinga/User/Preferences/Store/IniStore.php @@ -81,12 +81,7 @@ class IniStore extends PreferencesStore public function save(Preferences $preferences) { $preferences = $preferences->toArray(); - $this->update( - array_merge( - array_diff_key($preferences, $this->preferences), - array_intersect_key($preferences, $this->preferences) - ) - ); + $this->update(array_diff_assoc($preferences, $this->preferences)); $this->delete(array_keys(array_diff_key($this->preferences, $preferences))); $this->write(); } diff --git a/library/Icinga/Util/Color.php b/library/Icinga/Util/Color.php index 575773fca..8058f0152 100644 --- a/library/Icinga/Util/Color.php +++ b/library/Icinga/Util/Color.php @@ -1,29 +1,7 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ +// {{{ICINGA_LICENSE_HEADER}}} +// {{{ICINGA_LICENSE_HEADER}}} + namespace Icinga\Util; /** diff --git a/library/Icinga/Util/ConfigAwareFactory.php b/library/Icinga/Util/ConfigAwareFactory.php index f89c0b14e..4a40c4200 100644 --- a/library/Icinga/Util/ConfigAwareFactory.php +++ b/library/Icinga/Util/ConfigAwareFactory.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Util; diff --git a/library/Icinga/Util/DateTimeFactory.php b/library/Icinga/Util/DateTimeFactory.php index 5f6700882..724b54770 100644 --- a/library/Icinga/Util/DateTimeFactory.php +++ b/library/Icinga/Util/DateTimeFactory.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Util; diff --git a/library/Icinga/Util/Dimension.php b/library/Icinga/Util/Dimension.php index 16f617202..2f367483b 100644 --- a/library/Icinga/Util/Dimension.php +++ b/library/Icinga/Util/Dimension.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Util; diff --git a/library/Icinga/Util/Format.php b/library/Icinga/Util/Format.php index 33c7ebd83..0658b2a57 100644 --- a/library/Icinga/Util/Format.php +++ b/library/Icinga/Util/Format.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Util; diff --git a/library/Icinga/Util/String.php b/library/Icinga/Util/String.php index 434159578..b64d9e524 100644 --- a/library/Icinga/Util/String.php +++ b/library/Icinga/Util/String.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Util; diff --git a/library/Icinga/Util/Translator.php b/library/Icinga/Util/Translator.php index 59f5f61a3..111e414ad 100644 --- a/library/Icinga/Util/Translator.php +++ b/library/Icinga/Util/Translator.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Util; diff --git a/library/Icinga/Web/Controller/ActionController.php b/library/Icinga/Web/Controller/ActionController.php index 8d8345a55..b28bddc37 100644 --- a/library/Icinga/Web/Controller/ActionController.php +++ b/library/Icinga/Web/Controller/ActionController.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Controller; diff --git a/library/Icinga/Web/Controller/BaseConfigController.php b/library/Icinga/Web/Controller/BaseConfigController.php index 332bccfce..98941686e 100644 --- a/library/Icinga/Web/Controller/BaseConfigController.php +++ b/library/Icinga/Web/Controller/BaseConfigController.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Controller; diff --git a/library/Icinga/Web/Controller/BasePreferenceController.php b/library/Icinga/Web/Controller/BasePreferenceController.php index e1c330413..a83b8e6c0 100644 --- a/library/Icinga/Web/Controller/BasePreferenceController.php +++ b/library/Icinga/Web/Controller/BasePreferenceController.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Controller; diff --git a/library/Icinga/Web/Controller/ControllerTabCollector.php b/library/Icinga/Web/Controller/ControllerTabCollector.php index 50c6955b3..2078d80b2 100644 --- a/library/Icinga/Web/Controller/ControllerTabCollector.php +++ b/library/Icinga/Web/Controller/ControllerTabCollector.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Controller; diff --git a/library/Icinga/Web/Controller/ModuleActionController.php b/library/Icinga/Web/Controller/ModuleActionController.php index 89566368e..55663123b 100644 --- a/library/Icinga/Web/Controller/ModuleActionController.php +++ b/library/Icinga/Web/Controller/ModuleActionController.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web; @@ -35,6 +10,7 @@ use Zend_Config; use Zend_Form_Element_Submit; use Zend_Form_Element_Reset; use Zend_View_Interface; +use Icinga\Web\Session; use Icinga\Web\Form\Element\Note; use Icinga\Exception\ProgrammingError; use Icinga\Web\Form\Decorator\HelpText; @@ -137,7 +113,7 @@ class Form extends Zend_Form public function getSessionId() { if (!$this->sessionId) { - $this->sessionId = session_id(); + $this->sessionId = Session::getSession()->getId(); } return $this->sessionId; diff --git a/library/Icinga/Web/Form/Decorator/BootstrapForm.php b/library/Icinga/Web/Form/Decorator/BootstrapForm.php index 89ad82780..dfb60de2c 100644 --- a/library/Icinga/Web/Form/Decorator/BootstrapForm.php +++ b/library/Icinga/Web/Form/Decorator/BootstrapForm.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Form\Decorator; diff --git a/library/Icinga/Web/Form/Decorator/ConditionalHidden.php b/library/Icinga/Web/Form/Decorator/ConditionalHidden.php index 305054a88..5d29caee4 100644 --- a/library/Icinga/Web/Form/Decorator/ConditionalHidden.php +++ b/library/Icinga/Web/Form/Decorator/ConditionalHidden.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Form\Decorator; diff --git a/library/Icinga/Web/Form/Decorator/HelpText.php b/library/Icinga/Web/Form/Decorator/HelpText.php index fb89b310c..970da5cfb 100644 --- a/library/Icinga/Web/Form/Decorator/HelpText.php +++ b/library/Icinga/Web/Form/Decorator/HelpText.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Form\Decorator; diff --git a/library/Icinga/Web/Form/Element/DateTimePicker.php b/library/Icinga/Web/Form/Element/DateTimePicker.php index c9b41c6b4..911e26322 100644 --- a/library/Icinga/Web/Form/Element/DateTimePicker.php +++ b/library/Icinga/Web/Form/Element/DateTimePicker.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Form\Element; diff --git a/library/Icinga/Web/Form/Element/Note.php b/library/Icinga/Web/Form/Element/Note.php index 3ac383c1b..5788c200d 100644 --- a/library/Icinga/Web/Form/Element/Note.php +++ b/library/Icinga/Web/Form/Element/Note.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Form\Element; diff --git a/library/Icinga/Web/Form/Element/Number.php b/library/Icinga/Web/Form/Element/Number.php index 8749c07ea..d87a6d09f 100644 --- a/library/Icinga/Web/Form/Element/Number.php +++ b/library/Icinga/Web/Form/Element/Number.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Form\Element; diff --git a/library/Icinga/Web/Form/Element/TriStateCheckbox.php b/library/Icinga/Web/Form/Element/TriStateCheckbox.php index cc6d935ee..fb6ffb692 100644 --- a/library/Icinga/Web/Form/Element/TriStateCheckbox.php +++ b/library/Icinga/Web/Form/Element/TriStateCheckbox.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Form\Element; diff --git a/library/Icinga/Web/Form/InvalidCSRFTokenException.php b/library/Icinga/Web/Form/InvalidCSRFTokenException.php index fedae1faf..4e1ae8ba7 100644 --- a/library/Icinga/Web/Form/InvalidCSRFTokenException.php +++ b/library/Icinga/Web/Form/InvalidCSRFTokenException.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Form; diff --git a/library/Icinga/Web/Form/Validator/DateFormatValidator.php b/library/Icinga/Web/Form/Validator/DateFormatValidator.php index 0e5756653..2b2a413fd 100644 --- a/library/Icinga/Web/Form/Validator/DateFormatValidator.php +++ b/library/Icinga/Web/Form/Validator/DateFormatValidator.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Form\Validator; diff --git a/library/Icinga/Web/Form/Validator/DateTimeValidator.php b/library/Icinga/Web/Form/Validator/DateTimeValidator.php index 214515810..952ac6c86 100644 --- a/library/Icinga/Web/Form/Validator/DateTimeValidator.php +++ b/library/Icinga/Web/Form/Validator/DateTimeValidator.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Form\Validator; diff --git a/library/Icinga/Web/Form/Validator/TimeFormatValidator.php b/library/Icinga/Web/Form/Validator/TimeFormatValidator.php index 7dd9ac573..1715f7fdb 100644 --- a/library/Icinga/Web/Form/Validator/TimeFormatValidator.php +++ b/library/Icinga/Web/Form/Validator/TimeFormatValidator.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Form\Validator; diff --git a/library/Icinga/Web/Form/Validator/TriStateValidator.php b/library/Icinga/Web/Form/Validator/TriStateValidator.php index c20b87f3c..f05f35b27 100644 --- a/library/Icinga/Web/Form/Validator/TriStateValidator.php +++ b/library/Icinga/Web/Form/Validator/TriStateValidator.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Form\Validator; diff --git a/library/Icinga/Web/Form/Validator/WritablePathValidator.php b/library/Icinga/Web/Form/Validator/WritablePathValidator.php index a9114df9e..1381da9c7 100644 --- a/library/Icinga/Web/Form/Validator/WritablePathValidator.php +++ b/library/Icinga/Web/Form/Validator/WritablePathValidator.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Form\Validator; diff --git a/library/Icinga/Web/Hook.php b/library/Icinga/Web/Hook.php index 6f3ffc2f0..2b776daca 100644 --- a/library/Icinga/Web/Hook.php +++ b/library/Icinga/Web/Hook.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web; diff --git a/library/Icinga/Web/Hook/Configuration/ConfigurationTab.php b/library/Icinga/Web/Hook/Configuration/ConfigurationTab.php index a3493517b..28538687b 100644 --- a/library/Icinga/Web/Hook/Configuration/ConfigurationTab.php +++ b/library/Icinga/Web/Hook/Configuration/ConfigurationTab.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Hook\Configuration; diff --git a/library/Icinga/Web/Hook/Configuration/ConfigurationTabBuilder.php b/library/Icinga/Web/Hook/Configuration/ConfigurationTabBuilder.php index dad7a37f0..c84073e1e 100644 --- a/library/Icinga/Web/Hook/Configuration/ConfigurationTabBuilder.php +++ b/library/Icinga/Web/Hook/Configuration/ConfigurationTabBuilder.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Hook\Configuration; diff --git a/library/Icinga/Web/Hook/Configuration/ConfigurationTabInterface.php b/library/Icinga/Web/Hook/Configuration/ConfigurationTabInterface.php index ed2d77489..064bd8450 100644 --- a/library/Icinga/Web/Hook/Configuration/ConfigurationTabInterface.php +++ b/library/Icinga/Web/Hook/Configuration/ConfigurationTabInterface.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Hook\Configuration; diff --git a/library/Icinga/Web/Hook/Grapher.php b/library/Icinga/Web/Hook/Grapher.php index f5703ba2e..28de49604 100644 --- a/library/Icinga/Web/Hook/Grapher.php +++ b/library/Icinga/Web/Hook/Grapher.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Hook; diff --git a/library/Icinga/Web/Hook/Ticket.php b/library/Icinga/Web/Hook/Ticket.php index 1ba1192b0..f9c1b495e 100644 --- a/library/Icinga/Web/Hook/Ticket.php +++ b/library/Icinga/Web/Hook/Ticket.php @@ -1,8 +1,7 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Hook; diff --git a/library/Icinga/Web/JavaScript.php b/library/Icinga/Web/JavaScript.php index 3b468993d..2f4ef0485 100644 --- a/library/Icinga/Web/JavaScript.php +++ b/library/Icinga/Web/JavaScript.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web; diff --git a/library/Icinga/Web/Notification.php b/library/Icinga/Web/Notification.php index 941654277..3dd04c615 100644 --- a/library/Icinga/Web/Notification.php +++ b/library/Icinga/Web/Notification.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web; @@ -125,8 +100,11 @@ class Notification { $session = Session::getSession(); $msgs = $session->messages; - $session->messages = array(); - $session->write(); + if (false === empty($msgs)) { + $session->messages = array(); + $session->write(); + } + return $msgs; } diff --git a/library/Icinga/Web/Paginator/Adapter/QueryAdapter.php b/library/Icinga/Web/Paginator/Adapter/QueryAdapter.php index 6aa60c58a..03f8f1cc5 100644 --- a/library/Icinga/Web/Paginator/Adapter/QueryAdapter.php +++ b/library/Icinga/Web/Paginator/Adapter/QueryAdapter.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Paginator\Adapter; diff --git a/library/Icinga/Web/Paginator/ScrollingStyle/SlidingWithBorder.php b/library/Icinga/Web/Paginator/ScrollingStyle/SlidingWithBorder.php index 29a185299..d861dbe29 100644 --- a/library/Icinga/Web/Paginator/ScrollingStyle/SlidingWithBorder.php +++ b/library/Icinga/Web/Paginator/ScrollingStyle/SlidingWithBorder.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} /** diff --git a/library/Icinga/Web/Request.php b/library/Icinga/Web/Request.php index 95a5a2a37..8b09f68fb 100644 --- a/library/Icinga/Web/Request.php +++ b/library/Icinga/Web/Request.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web; diff --git a/library/Icinga/Web/Response.php b/library/Icinga/Web/Response.php index 962e670d3..33e0ea2a3 100644 --- a/library/Icinga/Web/Response.php +++ b/library/Icinga/Web/Response.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web; diff --git a/library/Icinga/Web/Session/PhpSession.php b/library/Icinga/Web/Session/PhpSession.php index df04183bd..65f940a13 100644 --- a/library/Icinga/Web/Session/PhpSession.php +++ b/library/Icinga/Web/Session/PhpSession.php @@ -1,36 +1,11 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Session; use Icinga\Logger\Logger; -use \Icinga\Exception\ConfigurationError; +use Icinga\Exception\ConfigurationError; /** * Session implementation in PHP @@ -49,21 +24,21 @@ class PhpSession extends Session * * @var bool */ - private $hasBeenTouched = false; + protected $hasBeenTouched = false; /** * Name of the session * * @var string */ - private $sessionName = 'Icingaweb2'; + protected $sessionName = 'Icingaweb2'; /** * Configuration for cookie options * * @var array */ - private static $defaultCookieOptions = array( + protected static $defaultCookieOptions = array( 'use_trans_sid' => false, 'use_cookies' => true, 'cookie_httponly' => true, @@ -107,13 +82,16 @@ class PhpSession extends Session throw new ConfigurationError('Can\'t save session'); } - $this->read(); + if ($this->exists()) { + // We do not want to start a new session here if there is not any + $this->read(); + } } /** * Open a PHP session */ - private function open() + protected function open() { session_name($this->sessionName); @@ -196,7 +174,7 @@ class PhpSession extends Session /** * Remove session cookies */ - private function clearCookies() + protected function clearCookies() { if (ini_get('session.use_cookies')) { Logger::debug('Clear session cookie'); @@ -213,6 +191,22 @@ class PhpSession extends Session } } + /** + * @see Session::getId() + */ + public function getId() + { + if (($id = session_id()) === '') { + // Make sure we actually get a id + $this->open(); + session_write_close(); + $this->hasBeenTouched = true; + $id = session_id(); + } + + return $id; + } + /** * Assign a new sessionId to the currently active session */ @@ -221,5 +215,14 @@ class PhpSession extends Session $this->open(); session_regenerate_id(); session_write_close(); + $this->hasBeenTouched = true; + } + + /** + * @see Session::exists() + */ + public function exists() + { + return isset($_COOKIE[$this->sessionName]); } } diff --git a/library/Icinga/Web/Session/Session.php b/library/Icinga/Web/Session/Session.php index a70ba6723..0c60d7f98 100644 --- a/library/Icinga/Web/Session/Session.php +++ b/library/Icinga/Web/Session/Session.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Session; @@ -62,6 +37,13 @@ abstract class Session extends SessionNamespace throw new NotImplementedError('You are required to implement write() in your session implementation'); } + /** + * Return whether a session exists + * + * @return bool + */ + abstract public function exists(); + /** * Purge session */ @@ -72,6 +54,13 @@ abstract class Session extends SessionNamespace */ abstract public function refreshId(); + /** + * Return the id of this session + * + * @return string + */ + abstract public function getId(); + /** * Get or create a new session namespace * diff --git a/library/Icinga/Web/Session/SessionNamespace.php b/library/Icinga/Web/Session/SessionNamespace.php index 39d14a159..8862d343f 100644 --- a/library/Icinga/Web/Session/SessionNamespace.php +++ b/library/Icinga/Web/Session/SessionNamespace.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Session; diff --git a/library/Icinga/Web/StyleSheet.php b/library/Icinga/Web/StyleSheet.php index 84df2a18f..fedd8207a 100644 --- a/library/Icinga/Web/StyleSheet.php +++ b/library/Icinga/Web/StyleSheet.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web; @@ -47,7 +22,7 @@ class Url /** * An array of all parameters stored in this Url * - * @var array + * @var UrlParams */ protected $params; @@ -356,7 +331,7 @@ class Url /** * Return all parameters that will be used in the query part * - * @return array An associative key => value array containing all parameters + * @return UrlParams An instance of UrlParam containing all parameters */ public function getParams() { diff --git a/library/Icinga/Web/UrlParams.php b/library/Icinga/Web/UrlParams.php index ecb9c5230..11fed8333 100644 --- a/library/Icinga/Web/UrlParams.php +++ b/library/Icinga/Web/UrlParams.php @@ -1,4 +1,6 @@ params; + } + public function __toString() { $parts = array(); diff --git a/library/Icinga/Web/View.php b/library/Icinga/Web/View.php index 07b9caa71..b74bca41c 100644 --- a/library/Icinga/Web/View.php +++ b/library/Icinga/Web/View.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web; diff --git a/library/Icinga/Web/View/helpers/format.php b/library/Icinga/Web/View/helpers/format.php index b229fc362..0d902acfd 100644 --- a/library/Icinga/Web/View/helpers/format.php +++ b/library/Icinga/Web/View/helpers/format.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web; diff --git a/library/Icinga/Web/Widget.php b/library/Icinga/Web/Widget.php index 32547d238..4bb177341 100644 --- a/library/Icinga/Web/Widget.php +++ b/library/Icinga/Web/Widget.php @@ -1,8 +1,7 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Widget\Chart; @@ -33,7 +8,6 @@ use Icinga\Util\DateTimeFactory; use Icinga\Util\Color; use Icinga\Web\Widget\AbstractWidget; use DateInterval; -use Zend_View_Abstract; /** * Display a colored grid that visualizes a set of values for each day @@ -45,7 +19,7 @@ class HistoryColorGrid extends AbstractWidget { const ORIENTATION_HORIZONTAL = 'horizontal'; - public $orientation = self::ORIENTATION_HORIZONTAL; + public $orientation = self::ORIENTATION_VERTICAL; private $maxValue = 1; diff --git a/library/Icinga/Web/Widget/Chart/InlinePie.php b/library/Icinga/Web/Widget/Chart/InlinePie.php index c0b8820fa..e4621ba09 100644 --- a/library/Icinga/Web/Widget/Chart/InlinePie.php +++ b/library/Icinga/Web/Widget/Chart/InlinePie.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Widget\Chart; diff --git a/library/Icinga/Web/Widget/Dashboard.php b/library/Icinga/Web/Widget/Dashboard.php index c997ada87..c87afa1ab 100644 --- a/library/Icinga/Web/Widget/Dashboard.php +++ b/library/Icinga/Web/Widget/Dashboard.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Widget; diff --git a/library/Icinga/Web/Widget/Dashboard/Component.php b/library/Icinga/Web/Widget/Dashboard/Component.php index 3c2c41edb..2d8517526 100644 --- a/library/Icinga/Web/Widget/Dashboard/Component.php +++ b/library/Icinga/Web/Widget/Dashboard/Component.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Widget\Dashboard; @@ -151,10 +126,9 @@ EOD; public function toArray() { $array = array('url' => $this->url->getPath()); - foreach ($this->url->getParams() as $key => $value) { - $array[$key] = $value; + foreach ($this->url->getParams()->toArray() as $param) { + $array[$param[0]] = $param[1]; } - return $array; } diff --git a/library/Icinga/Web/Widget/Dashboard/Pane.php b/library/Icinga/Web/Widget/Dashboard/Pane.php index 24b43040d..5e3e8ffea 100644 --- a/library/Icinga/Web/Widget/Dashboard/Pane.php +++ b/library/Icinga/Web/Widget/Dashboard/Pane.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Widget\Dashboard; diff --git a/library/Icinga/Web/Widget/FilterEditor.php b/library/Icinga/Web/Widget/FilterEditor.php index 19410c78e..4ce6ac6e6 100644 --- a/library/Icinga/Web/Widget/FilterEditor.php +++ b/library/Icinga/Web/Widget/FilterEditor.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Widget; diff --git a/library/Icinga/Web/Widget/Tab.php b/library/Icinga/Web/Widget/Tab.php index d330b6858..92a1a9954 100644 --- a/library/Icinga/Web/Widget/Tab.php +++ b/library/Icinga/Web/Widget/Tab.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Widget; diff --git a/library/Icinga/Web/Widget/Tabextension/BasketAction.php b/library/Icinga/Web/Widget/Tabextension/BasketAction.php index 1c0e617ef..34514f834 100644 --- a/library/Icinga/Web/Widget/Tabextension/BasketAction.php +++ b/library/Icinga/Web/Widget/Tabextension/BasketAction.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Widget\Tabextension; diff --git a/library/Icinga/Web/Widget/Tabextension/DashboardAction.php b/library/Icinga/Web/Widget/Tabextension/DashboardAction.php index 361d06a29..3d1c97ed0 100644 --- a/library/Icinga/Web/Widget/Tabextension/DashboardAction.php +++ b/library/Icinga/Web/Widget/Tabextension/DashboardAction.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Widget\Tabextension; diff --git a/library/Icinga/Web/Widget/Tabextension/OutputFormat.php b/library/Icinga/Web/Widget/Tabextension/OutputFormat.php index 863848aa8..46c55fad2 100644 --- a/library/Icinga/Web/Widget/Tabextension/OutputFormat.php +++ b/library/Icinga/Web/Widget/Tabextension/OutputFormat.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Widget\Tabextension; diff --git a/library/Icinga/Web/Widget/Tabextension/Tabextension.php b/library/Icinga/Web/Widget/Tabextension/Tabextension.php index 5d51379ef..881668d2e 100644 --- a/library/Icinga/Web/Widget/Tabextension/Tabextension.php +++ b/library/Icinga/Web/Widget/Tabextension/Tabextension.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Widget\Tabextension; diff --git a/library/Icinga/Web/Widget/Tabs.php b/library/Icinga/Web/Widget/Tabs.php index 13cabee2a..cd480ba32 100644 --- a/library/Icinga/Web/Widget/Tabs.php +++ b/library/Icinga/Web/Widget/Tabs.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Widget; diff --git a/library/Icinga/Web/Widget/Widget.php b/library/Icinga/Web/Widget/Widget.php index 2e61adcd1..3eda668ce 100644 --- a/library/Icinga/Web/Widget/Widget.php +++ b/library/Icinga/Web/Widget/Widget.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Web\Widget; diff --git a/library/Icinga/Web/Window.php b/library/Icinga/Web/Window.php index a2dc89eb7..3a541d3bb 100644 --- a/library/Icinga/Web/Window.php +++ b/library/Icinga/Web/Window.php @@ -1,4 +1,6 @@ service_perfdata); $perfs = array(); - foreach ($pset as $perfName => $p) { + foreach ($pset as $p) { if ($percent = $p->getPercentage()) { if ($percent < 0 || $percent > 100) { continue; } $perfs[] = ' ' - . $perfName + . $p->getLabel() . ': ' . $this->getPercentageSign($percent) . ' ' diff --git a/modules/monitoring/application/clicommands/NrpeCommand.php b/modules/monitoring/application/clicommands/NrpeCommand.php index d196d29fd..69ee50d9b 100644 --- a/modules/monitoring/application/clicommands/NrpeCommand.php +++ b/modules/monitoring/application/clicommands/NrpeCommand.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} use Icinga\Application\Icinga; @@ -119,8 +94,8 @@ class Monitoring_ChartController extends Controller 'services_pending' ) )->getQuery()->fetchAll(); - $this->view->height = intval($this->getParam('height', 220)); - $this->view->width = intval($this->getParam('width', 520)); + $this->view->height = intval($this->getParam('height', 500)); + $this->view->width = intval($this->getParam('width', 500)); if (count($query) === 1) { $this->drawGroupPie($query[0]); } else { @@ -144,8 +119,8 @@ class Monitoring_ChartController extends Controller 'services_pending' ) )->getQuery()->fetchAll(); - $this->view->height = intval($this->getParam('height', 220)); - $this->view->width = intval($this->getParam('width', 520)); + $this->view->height = intval($this->getParam('height', 500)); + $this->view->width = intval($this->getParam('width', 500)); $this->drawServiceGroupChart($query); @@ -165,7 +140,8 @@ class Monitoring_ChartController extends Controller } $this->view->chart = new GridChart(); $this->view->chart->setAxisLabel('', t('Services')) - ->setXAxis(new \Icinga\Chart\Unit\StaticAxis()); + ->setXAxis(new \Icinga\Chart\Unit\StaticAxis()) + ->setAxisMin(null, 0); $this->view->chart->drawBars( array( @@ -215,7 +191,9 @@ class Monitoring_ChartController extends Controller ); } $this->view->chart = new GridChart(); - $this->view->chart->setAxisLabel('', t('Hosts'))->setXAxis(new StaticAxis()); + $this->view->chart->setAxisLabel('', t('Hosts')) + ->setXAxis(new StaticAxis()) + ->setAxisMin(null, 0); $this->view->chart->drawBars( array( 'label' => t('Up'), diff --git a/modules/monitoring/application/controllers/CommandController.php b/modules/monitoring/application/controllers/CommandController.php index 70e9e5a25..bb1abcc74 100644 --- a/modules/monitoring/application/controllers/CommandController.php +++ b/modules/monitoring/application/controllers/CommandController.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} use Icinga\Application\Icinga; diff --git a/modules/monitoring/application/controllers/ConfigController.php b/modules/monitoring/application/controllers/ConfigController.php index e3e90bd16..c06ded57f 100644 --- a/modules/monitoring/application/controllers/ConfigController.php +++ b/modules/monitoring/application/controllers/ConfigController.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} use \Exception; diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index 3c08b5e76..f0cdb2767 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -1,4 +1,6 @@ addTitleTab('hosts'); @@ -146,7 +148,7 @@ class Monitoring_ListController extends Controller } } $this->setAutorefreshInterval(10); - + $columns = array_merge(array( 'host_name', 'host_state', @@ -516,7 +518,7 @@ class Monitoring_ListController extends Controller if ($modifyFilter) { if ($this->_request->isPost()) { - $filter = $filter->applyChanges($_POST); + $filter = $filter->applyChanges($this->_request->getPost()); $this->redirectNow($this->url->without('page')->setQueryString($filter->toQueryString())); } $this->view->filterEditor = Widget::create('filterEditor', array( @@ -528,9 +530,7 @@ class Monitoring_ListController extends Controller $query->applyFilter($filter); } $this->view->filter = $filter; - if ($sort) { - $query->order($sort, $dir); - } + $query->order($sort, $dir); $this->applyRestrictions($query); $this->handleFormatRequest($query); return $query; diff --git a/modules/monitoring/application/controllers/MonitoringCommands.php b/modules/monitoring/application/controllers/MonitoringCommands.php index 3eb065d5d..faa04114e 100644 --- a/modules/monitoring/application/controllers/MonitoringCommands.php +++ b/modules/monitoring/application/controllers/MonitoringCommands.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} use \Icinga\Module\Monitoring\Command\Meta; @@ -89,7 +64,7 @@ class Zend_View_Helper_MonitoringCommands extends Zend_View_Helper_Abstract $out .= ''; - $out .= '
'; + $out .= '
'; if ($type === Meta::TYPE_FULL) { return '
'. $out. '
'; diff --git a/modules/monitoring/application/controllers/MultiController.php b/modules/monitoring/application/controllers/MultiController.php index 28661d54b..a623dd88b 100644 --- a/modules/monitoring/application/controllers/MultiController.php +++ b/modules/monitoring/application/controllers/MultiController.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} use Icinga\Web\Form; diff --git a/modules/monitoring/application/controllers/ProcessController.php b/modules/monitoring/application/controllers/ProcessController.php index 4a606aade..49f5715b1 100644 --- a/modules/monitoring/application/controllers/ProcessController.php +++ b/modules/monitoring/application/controllers/ProcessController.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} use Icinga\Module\Monitoring\Controller as MonitoringController; diff --git a/modules/monitoring/application/controllers/ShowController.php b/modules/monitoring/application/controllers/ShowController.php index 4008ce318..d503ba512 100644 --- a/modules/monitoring/application/controllers/ShowController.php +++ b/modules/monitoring/application/controllers/ShowController.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} use Icinga\Application\Benchmark; @@ -128,6 +103,40 @@ class Monitoring_ShowController extends Controller )); } + public function contactAction() + { + $contact = $this->getParam('contact'); + if (! $contact) { + throw new Zend_Controller_Action_Exception( + $this->translate('The parameter `contact\' is required'), + 404 + ); + } + $query = $this->backend->select()->from('contact', array( + 'contact_name', + 'contact_id', + 'contact_alias', + 'contact_email', + 'contact_pager', + 'contact_notify_service_timeperiod', + 'contact_notify_service_recovery', + 'contact_notify_service_warning', + 'contact_notify_service_critical', + 'contact_notify_service_unknown', + 'contact_notify_service_flapping', + 'contact_notify_service_downtime', + 'contact_notify_host_timeperiod', + 'contact_notify_host_recovery', + 'contact_notify_host_down', + 'contact_notify_host_unreachable', + 'contact_notify_host_flapping', + 'contact_notify_host_downtime', + )); + $query->where('contact_name', $contact); + $this->view->contacts = $query->paginate(); + $this->view->contact_name = $contact; + } + /** * Creating tabs for this controller * @return Tabs diff --git a/modules/monitoring/application/forms/Command/AcknowledgeForm.php b/modules/monitoring/application/forms/Command/AcknowledgeForm.php index 31dc2a799..364c3c20a 100644 --- a/modules/monitoring/application/forms/Command/AcknowledgeForm.php +++ b/modules/monitoring/application/forms/Command/AcknowledgeForm.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Form\Command; diff --git a/modules/monitoring/application/forms/Command/CommandForm.php b/modules/monitoring/application/forms/Command/CommandForm.php index 04a1430a4..df1bed008 100644 --- a/modules/monitoring/application/forms/Command/CommandForm.php +++ b/modules/monitoring/application/forms/Command/CommandForm.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Form\Command; diff --git a/modules/monitoring/application/forms/Command/CommentForm.php b/modules/monitoring/application/forms/Command/CommentForm.php index fa3c71a36..497c276f1 100644 --- a/modules/monitoring/application/forms/Command/CommentForm.php +++ b/modules/monitoring/application/forms/Command/CommentForm.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Form\Command; diff --git a/modules/monitoring/application/forms/Command/CustomNotificationForm.php b/modules/monitoring/application/forms/Command/CustomNotificationForm.php index f1c078e33..9eb75a67b 100644 --- a/modules/monitoring/application/forms/Command/CustomNotificationForm.php +++ b/modules/monitoring/application/forms/Command/CustomNotificationForm.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Form\Command; diff --git a/modules/monitoring/application/forms/Command/DelayNotificationForm.php b/modules/monitoring/application/forms/Command/DelayNotificationForm.php index e5aecf131..efb6eae0f 100644 --- a/modules/monitoring/application/forms/Command/DelayNotificationForm.php +++ b/modules/monitoring/application/forms/Command/DelayNotificationForm.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Form\Command; diff --git a/modules/monitoring/application/forms/Command/DisableNotificationWithExpireForm.php b/modules/monitoring/application/forms/Command/DisableNotificationWithExpireForm.php index 0dbbeb4bb..d6657dd37 100644 --- a/modules/monitoring/application/forms/Command/DisableNotificationWithExpireForm.php +++ b/modules/monitoring/application/forms/Command/DisableNotificationWithExpireForm.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Form\Command; diff --git a/modules/monitoring/application/forms/Command/MultiCommandFlagForm.php b/modules/monitoring/application/forms/Command/MultiCommandFlagForm.php index 3b30574ff..6d49580a0 100644 --- a/modules/monitoring/application/forms/Command/MultiCommandFlagForm.php +++ b/modules/monitoring/application/forms/Command/MultiCommandFlagForm.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Form\Command; diff --git a/modules/monitoring/application/forms/Command/RescheduleNextCheckForm.php b/modules/monitoring/application/forms/Command/RescheduleNextCheckForm.php index c65339019..cb7ab90f1 100644 --- a/modules/monitoring/application/forms/Command/RescheduleNextCheckForm.php +++ b/modules/monitoring/application/forms/Command/RescheduleNextCheckForm.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Form\Command; diff --git a/modules/monitoring/application/forms/Command/ScheduleDowntimeForm.php b/modules/monitoring/application/forms/Command/ScheduleDowntimeForm.php index 2e2b63c55..593654c02 100644 --- a/modules/monitoring/application/forms/Command/ScheduleDowntimeForm.php +++ b/modules/monitoring/application/forms/Command/ScheduleDowntimeForm.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Form\Command; diff --git a/modules/monitoring/application/forms/Command/SingleArgumentCommandForm.php b/modules/monitoring/application/forms/Command/SingleArgumentCommandForm.php index 68b868df1..7333ccdac 100644 --- a/modules/monitoring/application/forms/Command/SingleArgumentCommandForm.php +++ b/modules/monitoring/application/forms/Command/SingleArgumentCommandForm.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Form\Command; diff --git a/modules/monitoring/application/forms/Command/SubmitPassiveCheckResultForm.php b/modules/monitoring/application/forms/Command/SubmitPassiveCheckResultForm.php index 768282ee5..de2965565 100644 --- a/modules/monitoring/application/forms/Command/SubmitPassiveCheckResultForm.php +++ b/modules/monitoring/application/forms/Command/SubmitPassiveCheckResultForm.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Form\Command; diff --git a/modules/monitoring/application/forms/Command/WithChildrenCommandForm.php b/modules/monitoring/application/forms/Command/WithChildrenCommandForm.php index cb9bd5892..5ae69173e 100644 --- a/modules/monitoring/application/forms/Command/WithChildrenCommandForm.php +++ b/modules/monitoring/application/forms/Command/WithChildrenCommandForm.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Form\Command; diff --git a/modules/monitoring/application/forms/Config/Backend/CreateBackendForm.php b/modules/monitoring/application/forms/Config/Backend/CreateBackendForm.php index 1c5bd25d4..513dea238 100644 --- a/modules/monitoring/application/forms/Config/Backend/CreateBackendForm.php +++ b/modules/monitoring/application/forms/Config/Backend/CreateBackendForm.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Form\Config\Backend; diff --git a/modules/monitoring/application/forms/Config/ConfirmRemovalForm.php b/modules/monitoring/application/forms/Config/ConfirmRemovalForm.php index 9f077bdf5..6a9e17bd5 100644 --- a/modules/monitoring/application/forms/Config/ConfirmRemovalForm.php +++ b/modules/monitoring/application/forms/Config/ConfirmRemovalForm.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Form\Config; diff --git a/modules/monitoring/application/forms/Config/Instance/CreateInstanceForm.php b/modules/monitoring/application/forms/Config/Instance/CreateInstanceForm.php index 3c8cc2520..705804bb9 100644 --- a/modules/monitoring/application/forms/Config/Instance/CreateInstanceForm.php +++ b/modules/monitoring/application/forms/Config/Instance/CreateInstanceForm.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Form\Config\Instance; diff --git a/modules/monitoring/application/forms/Config/Instance/EditInstanceForm.php b/modules/monitoring/application/forms/Config/Instance/EditInstanceForm.php index 261fbccc1..e2a091c0f 100644 --- a/modules/monitoring/application/forms/Config/Instance/EditInstanceForm.php +++ b/modules/monitoring/application/forms/Config/Instance/EditInstanceForm.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Form\Config\Instance; diff --git a/modules/monitoring/application/views/helpers/CheckPerformance.php b/modules/monitoring/application/views/helpers/CheckPerformance.php index c2e50494e..19912d3d6 100644 --- a/modules/monitoring/application/views/helpers/CheckPerformance.php +++ b/modules/monitoring/application/views/helpers/CheckPerformance.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} /** diff --git a/modules/monitoring/application/views/helpers/CommandForm.php b/modules/monitoring/application/views/helpers/CommandForm.php index a5e9557d6..fd0ffd581 100644 --- a/modules/monitoring/application/views/helpers/CommandForm.php +++ b/modules/monitoring/application/views/helpers/CommandForm.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} use Icinga\Web\Form; diff --git a/modules/monitoring/application/views/helpers/ContactFlags.php b/modules/monitoring/application/views/helpers/ContactFlags.php index 367f2d47d..da2b2823a 100644 --- a/modules/monitoring/application/views/helpers/ContactFlags.php +++ b/modules/monitoring/application/views/helpers/ContactFlags.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} /*use Icinga\Module\Monitoring\Object\AbstractObject;*/ diff --git a/modules/monitoring/application/views/helpers/MonitoringProperties.php b/modules/monitoring/application/views/helpers/MonitoringProperties.php index e89939cb2..ed52c5a04 100644 --- a/modules/monitoring/application/views/helpers/MonitoringProperties.php +++ b/modules/monitoring/application/views/helpers/MonitoringProperties.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} use Icinga\Module\Monitoring\Object\AbstractObject; diff --git a/modules/monitoring/application/views/helpers/MonitoringState.php b/modules/monitoring/application/views/helpers/MonitoringState.php index 2051975b7..935578ca5 100644 --- a/modules/monitoring/application/views/helpers/MonitoringState.php +++ b/modules/monitoring/application/views/helpers/MonitoringState.php @@ -1,4 +1,6 @@ asArray(); + $onlyPieChartData = array_filter($pset, function ($e) { return $e->getPercentage() > 0; }); + if ($compact) { + $onlyPieChartData = array_slice($onlyPieChartData, 0, 5); + } else { + $nonPieChartData = array_filter($pset, function ($e) { return $e->getPercentage() == 0; }); + } + $result = ''; $table = array(); - $pset = array_slice(PerfdataSet::fromString($perfdataStr)->asArray(), 0, ($compact ? 5 : null)); - foreach ($pset as $label => $perfdata) { - if (!$perfdata->isPercentage() && $perfdata->getMaximumValue() === null) { - continue; - } - $pieChart = $this->createInlinePie($perfdata, $label, htmlspecialchars($label)); + foreach ($onlyPieChartData as $perfdata) { + $pieChart = $this->createInlinePie($perfdata); if ($compact) { if (! $float) { $result .= $pieChart->render(); @@ -27,22 +31,23 @@ class Zend_View_Helper_Perfdata extends Zend_View_Helper_Abstract } } else { if (! $perfdata->isPercentage()) { + // TODO: Should we trust sprintf-style placeholders in perfdata titles? $pieChart->setTooltipFormat('{{label}}: {{formatted}} ({{percent}}%)'); } $pieChart->setStyle('margin: 0.2em 0.5em 0.2em 0.5em;'); $table[] = '' . $pieChart->render() - . htmlspecialchars($label) + . htmlspecialchars($perfdata->getLabel()) . ' ' . htmlspecialchars($this->formatPerfdataValue($perfdata)) . ' '; } } - // TODO: What if we have both? And should we trust sprintf-style placeholders in perfdata titles? - if (empty($table)) { - return $compact ? $result : $perfdataStr; + if ($compact) { + return $result; } else { - return '' . implode("\n", $table) . '
'; + $pieCharts = empty($table) ? '' : '' . implode("\n", $table) . '
'; + return $pieCharts . "\n" . implode("
\n", $nonPieChartData); } } @@ -81,10 +86,10 @@ class Zend_View_Helper_Perfdata extends Zend_View_Helper_Abstract return $perfdata->getValue(); } - protected function createInlinePie(Perfdata $perfdata, $title, $label = '') + protected function createInlinePie(Perfdata $perfdata) { - $pieChart = new InlinePie($this->calculatePieChartData($perfdata), $title); - $pieChart->setLabel($label); + $pieChart = new InlinePie($this->calculatePieChartData($perfdata), $perfdata->getLabel()); + $pieChart->setLabel(htmlspecialchars($perfdata->getLabel())); $pieChart->setHideEmptyLabel(); //$pieChart->setHeight(32)->setWidth(32); diff --git a/modules/monitoring/application/views/helpers/PluginOutput.php b/modules/monitoring/application/views/helpers/PluginOutput.php index 1b69b2c0e..3cd36c46f 100644 --- a/modules/monitoring/application/views/helpers/PluginOutput.php +++ b/modules/monitoring/application/views/helpers/PluginOutput.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} use \Zend_View_Helper_Abstract; diff --git a/modules/monitoring/application/views/helpers/RuntimeVariables.php b/modules/monitoring/application/views/helpers/RuntimeVariables.php index 5e95dc792..fa9b639a8 100644 --- a/modules/monitoring/application/views/helpers/RuntimeVariables.php +++ b/modules/monitoring/application/views/helpers/RuntimeVariables.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} /** diff --git a/modules/monitoring/application/views/helpers/SelectionToolbar.php b/modules/monitoring/application/views/helpers/SelectionToolbar.php index 71ffee8ff..0b4254522 100644 --- a/modules/monitoring/application/views/helpers/SelectionToolbar.php +++ b/modules/monitoring/application/views/helpers/SelectionToolbar.php @@ -1,4 +1,6 @@ width; ?>px;height:height; ?>px;margin:auto;"> +
render(); ?> diff --git a/modules/monitoring/application/views/scripts/chart/servicegroup.phtml b/modules/monitoring/application/views/scripts/chart/servicegroup.phtml index ad8a21ab0..2bdbe428c 100644 --- a/modules/monitoring/application/views/scripts/chart/servicegroup.phtml +++ b/modules/monitoring/application/views/scripts/chart/servicegroup.phtml @@ -1,5 +1,5 @@ -
+
render(); ?> diff --git a/modules/monitoring/application/views/scripts/list/contactgroups.phtml b/modules/monitoring/application/views/scripts/list/contactgroups.phtml index b29a5ab15..98661f4e6 100644 --- a/modules/monitoring/application/views/scripts/list/contactgroups.phtml +++ b/modules/monitoring/application/views/scripts/list/contactgroups.phtml @@ -10,9 +10,8 @@ if (count($groupData) === 0) { echo t('No contacts matching the filter'); } -?> - $groupInfo): ?> +foreach ($groupData as $groupName => $groupInfo): ?>

@@ -31,8 +30,8 @@ if (count($groupData) === 0) {

contact_email): ?> contact_email; ?> - -contact_pager): ?> +contact_pager): ?>
contact_pager; ?> diff --git a/modules/monitoring/application/views/scripts/list/contacts.phtml b/modules/monitoring/application/views/scripts/list/contacts.phtml index c2dfcd3ce..81a061973 100644 --- a/modules/monitoring/application/views/scripts/list/contacts.phtml +++ b/modules/monitoring/application/views/scripts/list/contacts.phtml @@ -2,53 +2,53 @@ $viewHelper = $this->getHelper('MonitoringState'); $contactHelper = $this->getHelper('ContactFlags'); ?> -

-
-

Contacts

-
-
- tabs->render($this); ?> -
-
-
- -
- -
-
- sortControl->render($this); ?> -
-
- -
- paginationControl($contacts, null, null, array('preserve' => $this->preserve)); ?> -
-
- - - - - - href('monitoring/show/contacts', array('contact' => $contact->contact_name)); ?> - - - - - - - - - - - - -
contact_name ?> contact_alias ?> contact_email ?> contact_pager ?> contactFlags($contact, 'service') ?> contactFlags($contact, 'host') ?> contact_notify_service_timeperiod ?> contact_notify_host_timeperiod ?>
- -
- paginationControl($contacts, null, null, array('preserve' => $this->preserve)); ?> +
+ tabs ?> +
+ sortControl->render($this); ?>
+ paginationControl($contacts, null, null, array('preserve' => $this->preserve)); ?> +
+ +
+ +
+ + contact_name ?> (contact_alias ?>) +
%2$s', + t('Email'), + htmlspecialchars($contact->contact_email) + ) ?>
+ contact_pager): ?> +
+ : + contact_pager) ?> +
+ +
+
+
+ : + contact_notify_service_timeperiod) ?> +
+
+ : + contact_notify_host_timeperiod) ?> +
+
+
+ +
+
diff --git a/modules/monitoring/application/views/scripts/list/downtimes.phtml b/modules/monitoring/application/views/scripts/list/downtimes.phtml index 6a6e7a3f6..995a66001 100644 --- a/modules/monitoring/application/views/scripts/list/downtimes.phtml +++ b/modules/monitoring/application/views/scripts/list/downtimes.phtml @@ -4,9 +4,9 @@ $helper = $this->getHelper('CommandForm');
tabs ?>
-sortControl->render($this); ?> +sortControl->render($this); ?>
-paginationControl($downtimes, null, null, array('preserve' => $this->preserve)); ?> +paginationControl($downtimes, null, null, array('preserve' => $this->preserve)); ?>
@@ -16,8 +16,7 @@ $helper = $this->getHelper('CommandForm'); if (count($downtimes) === 0) { echo t('No downtimes matching the filter'); } -?> -downtimes as $downtime): ?> +foreach ($this->downtimes as $downtime): ?> dateFormat()->formatDateTime($downtime->start); ?> - diff --git a/modules/monitoring/application/views/scripts/show/contact.phtml b/modules/monitoring/application/views/scripts/show/contact.phtml new file mode 100644 index 000000000..609bbbc69 --- /dev/null +++ b/modules/monitoring/application/views/scripts/show/contact.phtml @@ -0,0 +1,56 @@ +getHelper('ContactFlags'); +?> +
+ + + + + + + + + + + + + contact_pager): ?> + + + + + + + + + + + + + + + + + + + + + + +
+ contact_name) ?> (contact_alias) + ?>) +
%1$s', + htmlspecialchars($contact->contact_email) + ); ?>
contact_pager) ?>
contactFlags($contact, 'service')) ?>
contactFlags($contact, 'host')) ?>
contact_notify_service_timeperiod) ?>
contact_notify_host_timeperiod) ?>
+ +
diff --git a/modules/monitoring/bin/action/list.inc.php b/modules/monitoring/bin/action/list.inc.php index e49b6a71f..65a0ca61d 100644 --- a/modules/monitoring/bin/action/list.inc.php +++ b/modules/monitoring/bin/action/list.inc.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Backend\Ido\Query; diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/CommentdeletionhistoryQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/CommentdeletionhistoryQuery.php index 3d3ffdf65..8149c1c67 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/CommentdeletionhistoryQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/CommentdeletionhistoryQuery.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Backend\Ido\Query; diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/DowntimeendhistoryQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/DowntimeendhistoryQuery.php index 75998e3de..5d600be03 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/DowntimeendhistoryQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/DowntimeendhistoryQuery.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Backend\Ido\Query; diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/HostgroupQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/HostgroupQuery.php index 81712bdff..eedb2f1e9 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/HostgroupQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/HostgroupQuery.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Backend\Ido\Query; diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php index 4d4bf82dc..f0f927487 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/IdoQuery.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Backend\Ido\Query; diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/NotificationhistoryQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/NotificationhistoryQuery.php index 7abb466ca..e557f4c7b 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/NotificationhistoryQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/NotificationhistoryQuery.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Backend\Ido\Query; diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/RuntimesummaryQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/RuntimesummaryQuery.php index ba550ed54..cf3b6ea6d 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/RuntimesummaryQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/RuntimesummaryQuery.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Backend\Ido\Query; diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/RuntimevariablesQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/RuntimevariablesQuery.php index b259562b1..479142547 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/RuntimevariablesQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/RuntimevariablesQuery.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Backend\Ido\Query; diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicegroupQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicegroupQuery.php index ac3ad16e7..84ad94b86 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicegroupQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/ServicegroupQuery.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Backend\Ido\Query; diff --git a/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusSummaryQuery.php b/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusSummaryQuery.php index 0338969ed..ce61c8f1b 100644 --- a/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusSummaryQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Ido/Query/StatusSummaryQuery.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Backend\Ido\Query; diff --git a/modules/monitoring/library/Monitoring/Backend/Livestatus/Query/StatusQuery.php b/modules/monitoring/library/Monitoring/Backend/Livestatus/Query/StatusQuery.php index cdca2e8ae..20ffe57e5 100644 --- a/modules/monitoring/library/Monitoring/Backend/Livestatus/Query/StatusQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Livestatus/Query/StatusQuery.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Backend\Statusdat\Query; diff --git a/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/ContactQuery.php b/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/ContactQuery.php index f69b18452..d4ea895e3 100644 --- a/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/ContactQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/ContactQuery.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Backend\Statusdat\Query; diff --git a/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/GroupsummaryQuery.php b/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/GroupsummaryQuery.php index 77b833ffb..1168d6da3 100644 --- a/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/GroupsummaryQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/GroupsummaryQuery.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Backend\Statusdat\Query; diff --git a/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/HostlistQuery.php b/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/HostlistQuery.php index 810a87fcc..48ee82284 100644 --- a/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/HostlistQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/HostlistQuery.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Backend\Statusdat\Query; diff --git a/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/ServicegroupQuery.php b/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/ServicegroupQuery.php index a08243ec7..8d3f9a4ec 100644 --- a/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/ServicegroupQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/ServicegroupQuery.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Backend\Statusdat\Query; diff --git a/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/ServicegroupsummaryQuery.php b/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/ServicegroupsummaryQuery.php index cf76f7744..cd712d801 100644 --- a/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/ServicegroupsummaryQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/ServicegroupsummaryQuery.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Backend\Statusdat\Query; diff --git a/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/ServicelistQuery.php b/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/ServicelistQuery.php index dabc7026e..86a7310d0 100644 --- a/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/ServicelistQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/ServicelistQuery.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Backend\Statusdat\Query; diff --git a/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/StatusQuery.php b/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/StatusQuery.php index d17468bd3..e78942f4c 100644 --- a/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/StatusQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/StatusQuery.php @@ -1,11 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Backend\Statusdat\Query; diff --git a/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/StatusdatQuery.php b/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/StatusdatQuery.php index 5e6abb4cb..33b006c86 100644 --- a/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/StatusdatQuery.php +++ b/modules/monitoring/library/Monitoring/Backend/Statusdat/Query/StatusdatQuery.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Backend\Statusdat\Query; diff --git a/modules/monitoring/library/Monitoring/Cli/CliUtils.php b/modules/monitoring/library/Monitoring/Cli/CliUtils.php index fd894aeb9..5b443c714 100644 --- a/modules/monitoring/library/Monitoring/Cli/CliUtils.php +++ b/modules/monitoring/library/Monitoring/Cli/CliUtils.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Command; diff --git a/modules/monitoring/library/Monitoring/Command/AddCommentCommand.php b/modules/monitoring/library/Monitoring/Command/AddCommentCommand.php index 703735c25..0464d5cb2 100644 --- a/modules/monitoring/library/Monitoring/Command/AddCommentCommand.php +++ b/modules/monitoring/library/Monitoring/Command/AddCommentCommand.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Command; diff --git a/modules/monitoring/library/Monitoring/Command/CustomNotificationCommand.php b/modules/monitoring/library/Monitoring/Command/CustomNotificationCommand.php index 97e55c3d3..21cf22520 100644 --- a/modules/monitoring/library/Monitoring/Command/CustomNotificationCommand.php +++ b/modules/monitoring/library/Monitoring/Command/CustomNotificationCommand.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Command; diff --git a/modules/monitoring/library/Monitoring/Command/DelayNotificationCommand.php b/modules/monitoring/library/Monitoring/Command/DelayNotificationCommand.php index 67c0823b5..7f8dcf749 100644 --- a/modules/monitoring/library/Monitoring/Command/DelayNotificationCommand.php +++ b/modules/monitoring/library/Monitoring/Command/DelayNotificationCommand.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Command; diff --git a/modules/monitoring/library/Monitoring/Command/DisableNotificationWithExpireCommand.php b/modules/monitoring/library/Monitoring/Command/DisableNotificationWithExpireCommand.php index 5c91f0411..d6fb6322a 100644 --- a/modules/monitoring/library/Monitoring/Command/DisableNotificationWithExpireCommand.php +++ b/modules/monitoring/library/Monitoring/Command/DisableNotificationWithExpireCommand.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Command; diff --git a/modules/monitoring/library/Monitoring/Command/ScheduleCheckCommand.php b/modules/monitoring/library/Monitoring/Command/ScheduleCheckCommand.php index 14b8d4794..7908e637d 100644 --- a/modules/monitoring/library/Monitoring/Command/ScheduleCheckCommand.php +++ b/modules/monitoring/library/Monitoring/Command/ScheduleCheckCommand.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Command; diff --git a/modules/monitoring/library/Monitoring/Command/ScheduleDowntimeCommand.php b/modules/monitoring/library/Monitoring/Command/ScheduleDowntimeCommand.php index 50b55ed8a..e1d79ddce 100644 --- a/modules/monitoring/library/Monitoring/Command/ScheduleDowntimeCommand.php +++ b/modules/monitoring/library/Monitoring/Command/ScheduleDowntimeCommand.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Command; diff --git a/modules/monitoring/library/Monitoring/Command/SingleArgumentCommand.php b/modules/monitoring/library/Monitoring/Command/SingleArgumentCommand.php index 162c8f3ef..27fecd48d 100644 --- a/modules/monitoring/library/Monitoring/Command/SingleArgumentCommand.php +++ b/modules/monitoring/library/Monitoring/Command/SingleArgumentCommand.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Command; diff --git a/modules/monitoring/library/Monitoring/Command/SubmitPassiveCheckresultCommand.php b/modules/monitoring/library/Monitoring/Command/SubmitPassiveCheckresultCommand.php index ce79ece2f..262987de1 100644 --- a/modules/monitoring/library/Monitoring/Command/SubmitPassiveCheckresultCommand.php +++ b/modules/monitoring/library/Monitoring/Command/SubmitPassiveCheckresultCommand.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Command; diff --git a/modules/monitoring/library/Monitoring/Controller.php b/modules/monitoring/library/Monitoring/Controller.php index fd1358c12..32bafb8b2 100644 --- a/modules/monitoring/library/Monitoring/Controller.php +++ b/modules/monitoring/library/Monitoring/Controller.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring; @@ -86,4 +61,4 @@ class Controller extends ModuleActionController } } } -// @codingStandardsIgnoreEnd + diff --git a/modules/monitoring/library/Monitoring/DataView/Comment.php b/modules/monitoring/library/Monitoring/DataView/Comment.php index 1047854a0..4d62fd27c 100644 --- a/modules/monitoring/library/Monitoring/DataView/Comment.php +++ b/modules/monitoring/library/Monitoring/DataView/Comment.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\DataView; diff --git a/modules/monitoring/library/Monitoring/DataView/Contact.php b/modules/monitoring/library/Monitoring/DataView/Contact.php index d095e2982..7d24d1255 100644 --- a/modules/monitoring/library/Monitoring/DataView/Contact.php +++ b/modules/monitoring/library/Monitoring/DataView/Contact.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\DataView; diff --git a/modules/monitoring/library/Monitoring/DataView/DataView.php b/modules/monitoring/library/Monitoring/DataView/DataView.php index 5d8301749..b8ccbb852 100644 --- a/modules/monitoring/library/Monitoring/DataView/DataView.php +++ b/modules/monitoring/library/Monitoring/DataView/DataView.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\DataView; diff --git a/modules/monitoring/library/Monitoring/DataView/Downtime.php b/modules/monitoring/library/Monitoring/DataView/Downtime.php index 73eb5c547..8bd97673a 100644 --- a/modules/monitoring/library/Monitoring/DataView/Downtime.php +++ b/modules/monitoring/library/Monitoring/DataView/Downtime.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\DataView; diff --git a/modules/monitoring/library/Monitoring/DataView/EventHistory.php b/modules/monitoring/library/Monitoring/DataView/EventHistory.php index b1b76459b..09779b27d 100644 --- a/modules/monitoring/library/Monitoring/DataView/EventHistory.php +++ b/modules/monitoring/library/Monitoring/DataView/EventHistory.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\DataView; diff --git a/modules/monitoring/library/Monitoring/DataView/Groupsummary.php b/modules/monitoring/library/Monitoring/DataView/Groupsummary.php index dc1a2ed4b..a623dab45 100644 --- a/modules/monitoring/library/Monitoring/DataView/Groupsummary.php +++ b/modules/monitoring/library/Monitoring/DataView/Groupsummary.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\DataView; diff --git a/modules/monitoring/library/Monitoring/DataView/HostStatus.php b/modules/monitoring/library/Monitoring/DataView/HostStatus.php index 9bf1f97a1..60f224264 100644 --- a/modules/monitoring/library/Monitoring/DataView/HostStatus.php +++ b/modules/monitoring/library/Monitoring/DataView/HostStatus.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\DataView; diff --git a/modules/monitoring/library/Monitoring/DataView/Hostgroup.php b/modules/monitoring/library/Monitoring/DataView/Hostgroup.php index fc5090b65..94fc7ac56 100644 --- a/modules/monitoring/library/Monitoring/DataView/Hostgroup.php +++ b/modules/monitoring/library/Monitoring/DataView/Hostgroup.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} diff --git a/modules/monitoring/library/Monitoring/DataView/Notification.php b/modules/monitoring/library/Monitoring/DataView/Notification.php index cf2882c06..6156a5f15 100644 --- a/modules/monitoring/library/Monitoring/DataView/Notification.php +++ b/modules/monitoring/library/Monitoring/DataView/Notification.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\DataView; diff --git a/modules/monitoring/library/Monitoring/DataView/Runtimesummary.php b/modules/monitoring/library/Monitoring/DataView/Runtimesummary.php index 1ea362b49..d9d15a517 100644 --- a/modules/monitoring/library/Monitoring/DataView/Runtimesummary.php +++ b/modules/monitoring/library/Monitoring/DataView/Runtimesummary.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\DataView; diff --git a/modules/monitoring/library/Monitoring/DataView/Runtimevariables.php b/modules/monitoring/library/Monitoring/DataView/Runtimevariables.php index 2b41c3957..dbdd338c0 100644 --- a/modules/monitoring/library/Monitoring/DataView/Runtimevariables.php +++ b/modules/monitoring/library/Monitoring/DataView/Runtimevariables.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\DataView; diff --git a/modules/monitoring/library/Monitoring/DataView/ServiceStatus.php b/modules/monitoring/library/Monitoring/DataView/ServiceStatus.php index 108261b89..b81b56764 100644 --- a/modules/monitoring/library/Monitoring/DataView/ServiceStatus.php +++ b/modules/monitoring/library/Monitoring/DataView/ServiceStatus.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\DataView; diff --git a/modules/monitoring/library/Monitoring/DataView/Servicegroup.php b/modules/monitoring/library/Monitoring/DataView/Servicegroup.php index d3f65d79c..00a6f7d5f 100644 --- a/modules/monitoring/library/Monitoring/DataView/Servicegroup.php +++ b/modules/monitoring/library/Monitoring/DataView/Servicegroup.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} diff --git a/modules/monitoring/library/Monitoring/DataView/StateHistorySummary.php b/modules/monitoring/library/Monitoring/DataView/StateHistorySummary.php index 0f2a27837..0c7ca68a5 100644 --- a/modules/monitoring/library/Monitoring/DataView/StateHistorySummary.php +++ b/modules/monitoring/library/Monitoring/DataView/StateHistorySummary.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\DataView; diff --git a/modules/monitoring/library/Monitoring/DataView/StatusSummary.php b/modules/monitoring/library/Monitoring/DataView/StatusSummary.php index efba4e37d..74574bc72 100644 --- a/modules/monitoring/library/Monitoring/DataView/StatusSummary.php +++ b/modules/monitoring/library/Monitoring/DataView/StatusSummary.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\DataView; diff --git a/modules/monitoring/library/Monitoring/Environment.php b/modules/monitoring/library/Monitoring/Environment.php index 0213118a2..f9ad28654 100644 --- a/modules/monitoring/library/Monitoring/Environment.php +++ b/modules/monitoring/library/Monitoring/Environment.php @@ -1,4 +1,6 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} diff --git a/modules/monitoring/library/Monitoring/Object/AbstractObject.php b/modules/monitoring/library/Monitoring/Object/AbstractObject.php index 17be0cacf..73314fbc9 100644 --- a/modules/monitoring/library/Monitoring/Object/AbstractObject.php +++ b/modules/monitoring/library/Monitoring/Object/AbstractObject.php @@ -1,4 +1,6 @@ perfdataValue = $perfdataValue; + $this->perfdataValue = $value; + $this->label = $label; $this->parse(); if ($this->unit === '%') { @@ -78,25 +87,30 @@ class Perfdata } /** - * Return a new Perfdata object based on the given performance data value + * Return a new Perfdata object based on the given performance data key=value pair * - * @param string $perfdataValue The value to parse + * @param string $perfdata The key=value pair to parse * * @return Perfdata * - * @throws ProgrammingError In case the given performance data value has no content + * @throws InvalidArgumentException In case the given performance data has no content or a invalid format */ - public static function fromString($perfdataValue) + public static function fromString($perfdata) { - if (empty($perfdataValue)) { - throw new ProgrammingError('Perfdata::fromString expects a string with content'); + if (empty($perfdata)) { + throw new InvalidArgumentException('Perfdata::fromString expects a string with content'); + } elseif (false === strpos($perfdata, '=')) { + throw new InvalidArgumentException( + 'Perfdata::fromString expects a key=value formatted string. Got "' . $perfdata . '" instead' + ); } - return new static($perfdataValue); + list($label, $value) = explode('=', $perfdata, 2); + return new static(trim($label), trim($value)); } /** - * Return whether this performance data value is a number + * Return whether this performance data's value is a number * * @return bool True in case it's a number, otherwise False */ @@ -106,7 +120,7 @@ class Perfdata } /** - * Return whether this performance data value are seconds + * Return whether this performance data's value are seconds * * @return bool True in case it's seconds, otherwise False */ @@ -116,7 +130,7 @@ class Perfdata } /** - * Return whether this performance data value is in percentage + * Return whether this performance data's value is in percentage * * @return bool True in case it's in percentage, otherwise False */ @@ -126,7 +140,7 @@ class Perfdata } /** - * Return whether this performance data value is in bytes + * Return whether this performance data's value is in bytes * * @return bool True in case it's in bytes, otherwise False */ @@ -136,7 +150,7 @@ class Perfdata } /** - * Return whether this performance data value is a counter + * Return whether this performance data's value is a counter * * @return bool True in case it's a counter, otherwise False */ @@ -145,6 +159,14 @@ class Perfdata return $this->unit === 'c'; } + /** + * Return this perfomance data's label + */ + public function getLabel() + { + return $this->label; + } + /** * Return the value or null if it is unknown (U) * @@ -176,7 +198,7 @@ class Perfdata } /** - * Return this value's warning treshold or null if it is not available + * Return this performance data's warning treshold or null if it is not available * * @return null|string */ @@ -186,7 +208,7 @@ class Perfdata } /** - * Return this value's critical treshold or null if it is not available + * Return this performance data's critical treshold or null if it is not available * * @return null|string */ @@ -215,6 +237,16 @@ class Perfdata return $this->maxValue; } + /** + * Return this performance data as string + * + * @return string + */ + public function __toString() + { + return sprintf(strpos($this->label, ' ') === false ? '%s=%s' : "'%s'=%s", $this->label, $this->perfdataValue); + } + /** * Parse the current performance data value * diff --git a/modules/monitoring/library/Monitoring/Plugin/PerfdataSet.php b/modules/monitoring/library/Monitoring/Plugin/PerfdataSet.php index 8038354a4..c62904bb3 100644 --- a/modules/monitoring/library/Monitoring/Plugin/PerfdataSet.php +++ b/modules/monitoring/library/Monitoring/Plugin/PerfdataSet.php @@ -85,7 +85,7 @@ class PerfdataSet implements IteratorAggregate $value = trim($this->readUntil(' ')); if ($label && $value) { - $this->perfdata[$label] = Perfdata::fromString($value); + $this->perfdata[] = new Perfdata($label, $value); } } } diff --git a/modules/monitoring/library/Monitoring/Web/Hook/TopBar.php b/modules/monitoring/library/Monitoring/Web/Hook/TopBar.php index 9fa981c99..32efaca9a 100644 --- a/modules/monitoring/library/Monitoring/Web/Hook/TopBar.php +++ b/modules/monitoring/library/Monitoring/Web/Hook/TopBar.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Monitoring\Web\Hook; diff --git a/modules/monitoring/public/css/module.less b/modules/monitoring/public/css/module.less index d7e3dbe38..1d60b75c7 100644 --- a/modules/monitoring/public/css/module.less +++ b/modules/monitoring/public/css/module.less @@ -1,3 +1,6 @@ +// {{{ICINGA_LICENSE_HEADER}}} +// {{{ICINGA_LICENSE_HEADER}}} + table.action.comments td p, table.action.downtimes td p { margin: 0; font-size: 0.8em; @@ -29,3 +32,24 @@ table.objectstate td.state { padding-top: 0.5em; padding-bottom: 0.5em; } + +div.contacts div.contact { + background-color: lightgray; + padding: 0.5em; + border-radius: 0.5em; + overflow: hidden; + margin: 0.125em; + float: left; +} + +div.contacts div.contact > img { + width: 60px; + border: 4px solid white; + border-radius: 8px; + margin-right: 8px; + float: left; +} + +div.contacts div.notification-periods { + margin-top: 0.5em; +} diff --git a/modules/monitoring/public/js/module.js b/modules/monitoring/public/js/module.js index ea31f18d8..b3ba863ff 100644 --- a/modules/monitoring/public/js/module.js +++ b/modules/monitoring/public/js/module.js @@ -1,3 +1,5 @@ +// {{{ICINGA_LICENSE_HEADER}}} +// {{{ICINGA_LICENSE_HEADER}}} (function(Icinga) { diff --git a/modules/monitoring/run.php b/modules/monitoring/run.php index 51ca985c7..8f4ee1b67 100644 --- a/modules/monitoring/run.php +++ b/modules/monitoring/run.php @@ -1,10 +1,6 @@ registerHook( 'TopBar', diff --git a/modules/monitoring/test/php/library/Monitoring/Plugin/PerfdataSetTest.php b/modules/monitoring/test/php/library/Monitoring/Plugin/PerfdataSetTest.php index 86c0f71a7..3edd20857 100644 --- a/modules/monitoring/test/php/library/Monitoring/Plugin/PerfdataSetTest.php +++ b/modules/monitoring/test/php/library/Monitoring/Plugin/PerfdataSetTest.php @@ -17,19 +17,19 @@ class PerfdataSetTest extends BaseTestCase public function testWhetherValidSimplePerfdataLabelsAreProperlyParsed() { $pset = PerfdataSetWithPublicData::fromString('key1=val1 key2=val2 key3 =val3'); - $this->assertArrayHasKey( + $this->assertEquals( 'key1', - $pset->perfdata, + $pset->perfdata[0]->getLabel(), 'PerfdataSet does not correctly parse valid simple labels' ); - $this->assertArrayHasKey( + $this->assertEquals( 'key2', - $pset->perfdata, + $pset->perfdata[1]->getLabel(), 'PerfdataSet does not correctly parse valid simple labels' ); - $this->assertArrayHasKey( + $this->assertEquals( 'key3', - $pset->perfdata, + $pset->perfdata[2]->getLabel(), 'PerfdataSet does not correctly parse valid simple labels' ); } @@ -37,14 +37,14 @@ class PerfdataSetTest extends BaseTestCase public function testWhetherNonQuotedPerfdataLablesWithSpacesAreProperlyParsed() { $pset = PerfdataSetWithPublicData::fromString('key 1=val1 key 1 + 1=val2'); - $this->assertArrayHasKey( + $this->assertEquals( 'key 1', - $pset->perfdata, + $pset->perfdata[0]->getLabel(), 'PerfdataSet does not correctly parse non quoted labels with spaces' ); - $this->assertArrayHasKey( + $this->assertEquals( 'key 1 + 1', - $pset->perfdata, + $pset->perfdata[1]->getLabel(), 'PerfdataSet does not correctly parse non quoted labels with spaces' ); } @@ -52,14 +52,14 @@ class PerfdataSetTest extends BaseTestCase public function testWhetherValidQuotedPerfdataLabelsAreProperlyParsed() { $pset = PerfdataSetWithPublicData::fromString('\'key 1\'=val1 "key 2"=val2'); - $this->assertArrayHasKey( + $this->assertEquals( 'key 1', - $pset->perfdata, + $pset->perfdata[0]->getLabel(), 'PerfdataSet does not correctly parse valid quoted labels' ); - $this->assertArrayHasKey( + $this->assertEquals( 'key 2', - $pset->perfdata, + $pset->perfdata[1]->getLabel(), 'PerfdataSet does not correctly parse valid quoted labels' ); } @@ -67,14 +67,14 @@ class PerfdataSetTest extends BaseTestCase public function testWhetherInvalidQuotedPerfdataLabelsAreProperlyParsed() { $pset = PerfdataSetWithPublicData::fromString('\'key 1=val1 key 2"=val2'); - $this->assertArrayHasKey( + $this->assertEquals( 'key 1', - $pset->perfdata, + $pset->perfdata[0]->getLabel(), 'PerfdataSet does not correctly parse invalid quoted labels' ); - $this->assertArrayHasKey( + $this->assertEquals( 'key 2"', - $pset->perfdata, + $pset->perfdata[1]->getLabel(), 'PerfdataSet does not correctly parse invalid quoted labels' ); } @@ -85,8 +85,8 @@ class PerfdataSetTest extends BaseTestCase public function testWhetherAPerfdataSetIsIterable() { $pset = PerfdataSet::fromString('key=value'); - foreach ($pset as $label => $value) { - $this->assertEquals('key', $label); + foreach ($pset as $p) { + $this->assertEquals('key', $p->getLabel()); return; } diff --git a/modules/monitoring/test/php/library/Monitoring/Plugin/PerfdataTest.php b/modules/monitoring/test/php/library/Monitoring/Plugin/PerfdataTest.php index be1de875e..2d8a98b73 100644 --- a/modules/monitoring/test/php/library/Monitoring/Plugin/PerfdataTest.php +++ b/modules/monitoring/test/php/library/Monitoring/Plugin/PerfdataTest.php @@ -10,142 +10,189 @@ use Icinga\Module\Monitoring\Plugin\Perfdata; class PerfdataTest extends BaseTestCase { /** - * @expectedException Icinga\Exception\ProgrammingError + * @expectedException \InvalidArgumentException */ public function testWhetherFromStringThrowsExceptionWhenGivenAnEmptyString() { Perfdata::fromString(''); } + /** + * @expectedException \InvalidArgumentException + */ + public function testWhetherFromStringThrowsExceptionWhenGivenAnInvalidString() + { + Perfdata::fromString('test'); + } + + public function testWhetherFromStringParsesAGivenStringCorrectly() + { + $p = Perfdata::fromString('key=1234'); + $this->assertEquals( + 'key', + $p->getLabel(), + 'Perfdata::fromString does not properly parse performance data labels' + ); + $this->assertEquals( + 1234, + $p->getValue(), + 'Perfdata::fromString does not properly parse performance data values' + ); + } + + /** + * @depends testWhetherFromStringParsesAGivenStringCorrectly + */ public function testWhetherGetValueReturnsValidValues() { $this->assertEquals( 1337.0, - Perfdata::fromString('1337')->getValue(), + Perfdata::fromString('test=1337')->getValue(), 'Perfdata::getValue does not return correct values' ); $this->assertEquals( 1337.0, - Perfdata::fromString('1337;;;;')->getValue(), + Perfdata::fromString('test=1337;;;;')->getValue(), 'Perfdata::getValue does not return correct values' ); } + /** + * @depends testWhetherFromStringParsesAGivenStringCorrectly + */ public function testWhetherDecimalValuesAreCorrectlyParsed() { $this->assertEquals( 1337.5, - Perfdata::fromString('1337.5')->getValue(), + Perfdata::fromString('test=1337.5')->getValue(), 'Perfdata objects do not parse decimal values correctly' ); $this->assertEquals( 1337.5, - Perfdata::fromString('1337.5B')->getValue(), + Perfdata::fromString('test=1337.5B')->getValue(), 'Perfdata objects do not parse decimal values correctly' ); } + /** + * @depends testWhetherFromStringParsesAGivenStringCorrectly + */ public function testWhetherGetValueReturnsNullForInvalidOrUnknownValues() { $this->assertNull( - Perfdata::fromString('U')->getValue(), + Perfdata::fromString('test=U')->getValue(), 'Perfdata::getValue does not return null for unknown values' ); $this->assertNull( - Perfdata::fromString('i am not a value')->getValue(), + Perfdata::fromString('test=i am not a value')->getValue(), 'Perfdata::getValue does not return null for invalid values' ); } + /** + * @depends testWhetherFromStringParsesAGivenStringCorrectly + */ public function testWhetherGetWarningTresholdReturnsCorrectValues() { $this->assertEquals( '10', - Perfdata::fromString('1;10')->getWarningThreshold(), + Perfdata::fromString('test=1;10')->getWarningThreshold(), 'Perfdata::getWarningTreshold does not return correct values' ); $this->assertEquals( '10:', - Perfdata::fromString('1;10:')->getWarningThreshold(), + Perfdata::fromString('test=1;10:')->getWarningThreshold(), 'Perfdata::getWarningTreshold does not return correct values' ); $this->assertEquals( '~:10', - Perfdata::fromString('1;~:10')->getWarningThreshold(), + Perfdata::fromString('test=1;~:10')->getWarningThreshold(), 'Perfdata::getWarningTreshold does not return correct values' ); $this->assertEquals( '10:20', - Perfdata::fromString('1;10:20')->getWarningThreshold(), + Perfdata::fromString('test=1;10:20')->getWarningThreshold(), 'Perfdata::getWarningTreshold does not return correct values' ); $this->assertEquals( '@10:20', - Perfdata::fromString('1;@10:20')->getWarningThreshold(), + Perfdata::fromString('test=1;@10:20')->getWarningThreshold(), 'Perfdata::getWarningTreshold does not return correct values' ); } + /** + * @depends testWhetherFromStringParsesAGivenStringCorrectly + */ public function testWhetherGetCriticalTresholdReturnsCorrectValues() { $this->assertEquals( '10', - Perfdata::fromString('1;;10')->getCriticalThreshold(), + Perfdata::fromString('test=1;;10')->getCriticalThreshold(), 'Perfdata::getCriticalTreshold does not return correct values' ); $this->assertEquals( '10:', - Perfdata::fromString('1;;10:')->getCriticalThreshold(), + Perfdata::fromString('test=1;;10:')->getCriticalThreshold(), 'Perfdata::getCriticalTreshold does not return correct values' ); $this->assertEquals( '~:10', - Perfdata::fromString('1;;~:10')->getCriticalThreshold(), + Perfdata::fromString('test=1;;~:10')->getCriticalThreshold(), 'Perfdata::getCriticalTreshold does not return correct values' ); $this->assertEquals( '10:20', - Perfdata::fromString('1;;10:20')->getCriticalThreshold(), + Perfdata::fromString('test=1;;10:20')->getCriticalThreshold(), 'Perfdata::getCriticalTreshold does not return correct values' ); $this->assertEquals( '@10:20', - Perfdata::fromString('1;;@10:20')->getCriticalThreshold(), + Perfdata::fromString('test=1;;@10:20')->getCriticalThreshold(), 'Perfdata::getCriticalTreshold does not return correct values' ); } + /** + * @depends testWhetherFromStringParsesAGivenStringCorrectly + */ public function testWhetherGetMinimumValueReturnsCorrectValues() { $this->assertEquals( 1337.0, - Perfdata::fromString('1;;;1337')->getMinimumValue(), + Perfdata::fromString('test=1;;;1337')->getMinimumValue(), 'Perfdata::getMinimumValue does not return correct values' ); $this->assertEquals( 1337.5, - Perfdata::fromString('1;;;1337.5')->getMinimumValue(), + Perfdata::fromString('test=1;;;1337.5')->getMinimumValue(), 'Perfdata::getMinimumValue does not return correct values' ); } + /** + * @depends testWhetherFromStringParsesAGivenStringCorrectly + */ public function testWhetherGetMaximumValueReturnsCorrectValues() { $this->assertEquals( 1337.0, - Perfdata::fromString('1;;;;1337')->getMaximumValue(), + Perfdata::fromString('test=1;;;;1337')->getMaximumValue(), 'Perfdata::getMaximumValue does not return correct values' ); $this->assertEquals( 1337.5, - Perfdata::fromString('1;;;;1337.5')->getMaximumValue(), + Perfdata::fromString('test=1;;;;1337.5')->getMaximumValue(), 'Perfdata::getMaximumValue does not return correct values' ); } + /** + * @depends testWhetherFromStringParsesAGivenStringCorrectly + */ public function testWhetherMissingValuesAreReturnedAsNull() { - $perfdata = Perfdata::fromString('1;;3;5'); + $perfdata = Perfdata::fromString('test=1;;3;5'); $this->assertNull( $perfdata->getWarningThreshold(), 'Perfdata objects do not return null for missing warning tresholds' @@ -162,7 +209,7 @@ class PerfdataTest extends BaseTestCase public function testWhetherValuesAreIdentifiedAsNumber() { $this->assertTrue( - Perfdata::fromString('666')->isNumber(), + Perfdata::fromString('test=666')->isNumber(), 'Perfdata objects do not identify ordinary digits as number' ); } @@ -173,15 +220,15 @@ class PerfdataTest extends BaseTestCase public function testWhetherValuesAreIdentifiedAsSeconds() { $this->assertTrue( - Perfdata::fromString('666s')->isSeconds(), + Perfdata::fromString('test=666s')->isSeconds(), 'Perfdata objects do not identify seconds as seconds' ); $this->assertTrue( - Perfdata::fromString('666us')->isSeconds(), + Perfdata::fromString('test=666us')->isSeconds(), 'Perfdata objects do not identify microseconds as seconds' ); $this->assertTrue( - Perfdata::fromString('666ms')->isSeconds(), + Perfdata::fromString('test=666ms')->isSeconds(), 'Perfdata objects do not identify milliseconds as seconds' ); } @@ -192,7 +239,7 @@ class PerfdataTest extends BaseTestCase public function testWhetherValuesAreIdentifiedAsPercentage() { $this->assertTrue( - Perfdata::fromString('66%')->isPercentage(), + Perfdata::fromString('test=66%')->isPercentage(), 'Perfdata objects do not identify percentages as percentages' ); } @@ -202,7 +249,7 @@ class PerfdataTest extends BaseTestCase */ public function testWhetherMinAndMaxAreNotRequiredIfUnitIsInPercent() { - $perfdata = Perfdata::fromString('1%'); + $perfdata = Perfdata::fromString('test=1%'); $this->assertEquals( 0.0, $perfdata->getMinimumValue(), @@ -221,23 +268,23 @@ class PerfdataTest extends BaseTestCase public function testWhetherValuesAreIdentifiedAsBytes() { $this->assertTrue( - Perfdata::fromString('66666B')->isBytes(), + Perfdata::fromString('test=66666B')->isBytes(), 'Perfdata objects do not identify bytes as bytes' ); $this->assertTrue( - Perfdata::fromString('6666KB')->isBytes(), + Perfdata::fromString('test=6666KB')->isBytes(), 'Perfdata objects do not identify kilobytes as bytes' ); $this->assertTrue( - Perfdata::fromString('666MB')->isBytes(), + Perfdata::fromString('test=666MB')->isBytes(), 'Perfdata objects do not identify megabytes as bytes' ); $this->assertTrue( - Perfdata::fromString('66GB')->isBytes(), + Perfdata::fromString('test=66GB')->isBytes(), 'Perfdata objects do not identify gigabytes as bytes' ); $this->assertTrue( - Perfdata::fromString('6TB')->isBytes(), + Perfdata::fromString('test=6TB')->isBytes(), 'Perfdata objects do not identify terabytes as bytes' ); } @@ -248,7 +295,7 @@ class PerfdataTest extends BaseTestCase public function testWhetherValuesAreIdentifiedAsCounter() { $this->assertTrue( - Perfdata::fromString('123c')->isCounter(), + Perfdata::fromString('test=123c')->isCounter(), 'Perfdata objects do not identify counters as counters' ); } @@ -260,7 +307,7 @@ class PerfdataTest extends BaseTestCase { $this->assertEquals( 666 / pow(10, 6), - Perfdata::fromString('666us')->getValue(), + Perfdata::fromString('test=666us')->getValue(), 'Perfdata objects do not correctly convert microseconds to seconds' ); } @@ -272,7 +319,7 @@ class PerfdataTest extends BaseTestCase { $this->assertEquals( 666 / pow(10, 3), - Perfdata::fromString('666ms')->getValue(), + Perfdata::fromString('test=666ms')->getValue(), 'Perfdata objects do not correctly convert microseconds to seconds' ); } @@ -284,20 +331,20 @@ class PerfdataTest extends BaseTestCase { $this->assertEquals( 66.0, - Perfdata::fromString('66%')->getPercentage(), + Perfdata::fromString('test=66%')->getPercentage(), 'Perfdata objects do not correctly handle native percentages' ); $this->assertEquals( 50.0, - Perfdata::fromString('0;;;-250;250')->getPercentage(), + Perfdata::fromString('test=0;;;-250;250')->getPercentage(), 'Perfdata objects do not correctly convert suitable values to percentages' ); $this->assertNull( - Perfdata::fromString('50')->getPercentage(), + Perfdata::fromString('test=50')->getPercentage(), 'Perfdata objects do return a percentage though their unit is not % and no maximum is given' ); $this->assertNull( - Perfdata::fromString('25;;;50;100')->getPercentage(), + Perfdata::fromString('test=25;;;50;100')->getPercentage(), 'Perfdata objects do return a percentage though their value is lower than it\'s allowed minimum' ); } @@ -309,7 +356,7 @@ class PerfdataTest extends BaseTestCase { $this->assertEquals( 6666.0 * pow(2, 10), - Perfdata::fromString('6666KB')->getValue(), + Perfdata::fromString('test=6666KB')->getValue(), 'Perfdata objects do not corretly convert kilobytes to bytes' ); } @@ -321,7 +368,7 @@ class PerfdataTest extends BaseTestCase { $this->assertEquals( 666.0 * pow(2, 20), - Perfdata::fromString('666MB')->getValue(), + Perfdata::fromString('test=666MB')->getValue(), 'Perfdata objects do not corretly convert megabytes to bytes' ); } @@ -333,7 +380,7 @@ class PerfdataTest extends BaseTestCase { $this->assertEquals( 66.0 * pow(2, 30), - Perfdata::fromString('66GB')->getValue(), + Perfdata::fromString('test=66GB')->getValue(), 'Perfdata objects do not corretly convert gigabytes to bytes' ); } @@ -345,7 +392,7 @@ class PerfdataTest extends BaseTestCase { $this->assertEquals( 6.0 * pow(2, 40), - Perfdata::fromString('6TB')->getValue(), + Perfdata::fromString('test=6TB')->getValue(), 'Perfdata objects do not corretly convert terabytes to bytes' ); } diff --git a/modules/translation/application/clicommands/CompileCommand.php b/modules/translation/application/clicommands/CompileCommand.php index be4f6b4f9..77116d74a 100644 --- a/modules/translation/application/clicommands/CompileCommand.php +++ b/modules/translation/application/clicommands/CompileCommand.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Translation\Clicommands; diff --git a/modules/translation/application/clicommands/RefreshCommand.php b/modules/translation/application/clicommands/RefreshCommand.php index 9da6cc9e5..78b58f55c 100644 --- a/modules/translation/application/clicommands/RefreshCommand.php +++ b/modules/translation/application/clicommands/RefreshCommand.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Translation\Clicommands; diff --git a/modules/translation/library/Translation/Cli/TranslationCommand.php b/modules/translation/library/Translation/Cli/TranslationCommand.php index 08223cbbb..2cdc875ec 100644 --- a/modules/translation/library/Translation/Cli/TranslationCommand.php +++ b/modules/translation/library/Translation/Cli/TranslationCommand.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Translation\Cli; diff --git a/modules/translation/library/Translation/Util/GettextTranslationHelper.php b/modules/translation/library/Translation/Util/GettextTranslationHelper.php index aa1aaa5db..895e01fa5 100644 --- a/modules/translation/library/Translation/Util/GettextTranslationHelper.php +++ b/modules/translation/library/Translation/Util/GettextTranslationHelper.php @@ -1,30 +1,5 @@ - * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 - * @author Icinga Development Team - * - */ // {{{ICINGA_LICENSE_HEADER}}} namespace Icinga\Module\Translation\Util; diff --git a/packages/files/public/index.php b/packages/files/public/index.php index 77953b1b6..1acee9445 100644 --- a/packages/files/public/index.php +++ b/packages/files/public/index.php @@ -1,4 +1,6 @@ .tabs, .dontprint, .inlinepie { display: none !important; } diff --git a/public/index.php b/public/index.php index 69b3dfce8..171581155 100644 --- a/public/index.php +++ b/public/index.php @@ -1,3 +1,5 @@