CS: Fix viloations for touched files in branch feature/backend-configuration-ui-3776

refs #3776
This commit is contained in:
Eric Lippmann 2013-08-21 11:02:53 +02:00
parent 585f69fe8f
commit edb06ea8ea
25 changed files with 318 additions and 354 deletions

View File

@ -158,7 +158,6 @@ class ConfigController extends BaseConfigController
/** /**
* Action for creating a new authentication backend * Action for creating a new authentication backend
*
*/ */
public function authenticationAction() public function authenticationAction()
{ {
@ -182,7 +181,6 @@ class ConfigController extends BaseConfigController
/** /**
* Action for creating a new authentication backend * Action for creating a new authentication backend
*
*/ */
public function createauthenticationbackendAction() public function createauthenticationbackendAction()
{ {
@ -208,15 +206,16 @@ class ConfigController extends BaseConfigController
} }
/** /**
* Write changes to an authentication file. * Write changes to an authentication file
* *
* This uses the Zend_Config_Writer_Ini implementation for now, as the Preserving ini writer can't * This uses the Zend_Config_Writer_Ini implementation for now, as the Preserving ini writer can't
* handle ordering * handle ordering
* *
* @param array $config The configuration changes * @param array $config The configuration changes
* *
* @return bool True when persisting succeeded, otherwise false * @return bool True when persisting succeeded, otherwise false
* @see writeConfigFile() *
* @see writeConfigFile()
*/ */
private function writeAuthenticationFile($config) { private function writeAuthenticationFile($config) {
$writer = new Zend_Config_Writer_Ini( $writer = new Zend_Config_Writer_Ini(
@ -229,13 +228,13 @@ class ConfigController extends BaseConfigController
} }
/** /**
* Write changes to a configuration file $file, using the supllied writer or PreservingIniWriter if none is set * Write changes to a configuration file $file, using the supplied writer or PreservingIniWriter if none is set
* *
* @param array|Zend_Config $config The configuration to write * @param array|Zend_Config $config The configuration to write
* @param string $file The filename to write to (without .ini) * @param string $file The filename to write to (without .ini)
* @param Zend_Config_Writer $writer An optional writer to use for persisting changes * @param Zend_Config_Writer $writer An optional writer to use for persisting changes
* *
* @return bool True when persisting succeeded, otherwise false * @return bool True when persisting succeeded, otherwise false
*/ */
private function writeConfigFile($config, $file, $writer = null) private function writeConfigFile($config, $file, $writer = null)
{ {

View File

@ -2,24 +2,24 @@
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
/** /**
* This file is part of Icinga 2 Web. * This file is part of Icinga 2 Web.
* *
* Icinga 2 Web - Head for multiple monitoring backends. * Icinga 2 Web - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team * Copyright (C) 2013 Icinga Development Team
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @copyright 2013 Icinga Development Team <info@icinga.org> * @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org> * @author Icinga Development Team <info@icinga.org>
@ -29,16 +29,15 @@
namespace Icinga\Form\Config\Authentication; namespace Icinga\Form\Config\Authentication;
use \Zend_Config;
use \Icinga\Application\Config as IcingaConfig; use \Icinga\Application\Config as IcingaConfig;
use \Icinga\Application\Icinga; use \Icinga\Application\Icinga;
use \Icinga\Application\Logger; use \Icinga\Application\Logger;
use \Icinga\Application\DbAdapterFactory; use \Icinga\Application\DbAdapterFactory;
use \Icinga\Web\Form; use \Icinga\Web\Form;
use \Zend_Config;
/** /**
* Base form for authentication backend forms * Base form for authentication backend forms
*
*/ */
abstract class BaseBackendForm extends Form abstract class BaseBackendForm extends Form
{ {
@ -49,26 +48,26 @@ abstract class BaseBackendForm extends Form
* *
* @var string * @var string
*/ */
private $backendName = ""; private $backendName = '';
/** /**
* The backend configuration as a Zend_Config object * The backend configuration as a Zend_Config object
* *
* @var Zend_Config * @var Zend_Config
*/ */
private $backend = null; private $backend;
/** /**
* The resources to use instead of the factory provided ones (use for testing) * The resources to use instead of the factory provided ones (use for testing)
* *
* @var Zend_Config * @var Zend_Config
*/ */
private $resources = null; private $resources;
/** /**
* Set the name of the currently displayed backend * Set the name of the currently displayed backend
* *
* @param string $name The name to be stored as the section when persisting * @param string $name The name to be stored as the section when persisting
*/ */
public function setBackendName($name) public function setBackendName($name)
{ {
@ -98,7 +97,7 @@ abstract class BaseBackendForm extends Form
/** /**
* Set the backend configuration for initial population * Set the backend configuration for initial population
* *
* @param Zend_Config $backend The backend to display in this form * @param Zend_Config $backend The backend to display in this form
*/ */
public function setBackend(Zend_Config $backend) public function setBackend(Zend_Config $backend)
{ {
@ -109,7 +108,7 @@ abstract class BaseBackendForm extends Form
* Set an alternative array of resources that should be used instead of the DBFactory resource set * Set an alternative array of resources that should be used instead of the DBFactory resource set
* (used for testing) * (used for testing)
* *
* @param array $resources The resources to use for populating the db selection field * @param array $resources The resources to use for populating the db selection field
*/ */
public function setResources(array $resources) public function setResources(array $resources)
{ {
@ -132,7 +131,7 @@ abstract class BaseBackendForm extends Form
/** /**
* Return an array containing all sections defined by this form as the key and all settings * Return an array containing all sections defined by this form as the key and all settings
* as an keyvalue subarray * as an key-value sub-array
* *
* @return array * @return array
*/ */

View File

@ -2,24 +2,24 @@
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
/** /**
* This file is part of Icinga 2 Web. * This file is part of Icinga 2 Web.
* *
* Icinga 2 Web - Head for multiple monitoring backends. * Icinga 2 Web - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team * Copyright (C) 2013 Icinga Development Team
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @copyright 2013 Icinga Development Team <info@icinga.org> * @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org> * @author Icinga Development Team <info@icinga.org>
@ -29,22 +29,18 @@
namespace Icinga\Form\Config\Authentication; namespace Icinga\Form\Config\Authentication;
use \Zend_Config;
use \Icinga\Application\Config as IcingaConfig; use \Icinga\Application\Config as IcingaConfig;
use \Icinga\Application\Icinga; use \Icinga\Application\Icinga;
use \Icinga\Application\Logger; use \Icinga\Application\Logger;
use \Icinga\Application\DbAdapterFactory; use \Icinga\Application\DbAdapterFactory;
use \Icinga\Web\Form; use \Icinga\Web\Form;
use \Zend_Config;
/** /**
* Form class for adding/modifying database authentication backends * Form class for adding/modifying database authentication backends
*
*/ */
class DbBackendForm extends BaseBackendForm class DbBackendForm extends BaseBackendForm
{ {
/** /**
* Return a list of all database resource ready to be used as the multiOptions * Return a list of all database resource ready to be used as the multiOptions
* attribute in a Zend_Form_Element_Select object * attribute in a Zend_Form_Element_Select object
@ -64,10 +60,10 @@ class DbBackendForm extends BaseBackendForm
} }
/** /**
* Create this form and add all required elements * Create this form and add all required elements
* *
* @see Form::create() * @see Form::create()
*/ */
public function create() public function create()
{ {
$name = $this->filterName($this->getBackendName()); $name = $this->filterName($this->getBackendName());
@ -76,11 +72,11 @@ class DbBackendForm extends BaseBackendForm
'text', 'text',
'backend_' . $name . '_name', 'backend_' . $name . '_name',
array( array(
'required' => true, 'required' => true,
'allowEmpty'=> false, 'allowEmpty' => false,
'label' => 'Backend Name', 'label' => 'Backend Name',
'helptext' => 'The name of this authentication provider', 'helptext' => 'The name of this authentication provider',
'value' => $this->getBackendName() 'value' => $this->getBackendName()
) )
); );
@ -103,8 +99,9 @@ class DbBackendForm extends BaseBackendForm
/** /**
* Return the datatbase authentication backend configuration for this form * Return the datatbase authentication backend configuration for this form
* *
* @return array * @return array
* @see BaseBackendForm::getConfig *
* @see BaseBackendForm::getConfig()
*/ */
public function getConfig() public function getConfig()
{ {
@ -113,9 +110,9 @@ class DbBackendForm extends BaseBackendForm
$section = $this->getValue($prefix . 'name'); $section = $this->getValue($prefix . 'name');
$cfg = array( $cfg = array(
'backend' => 'db', 'backend' => 'db',
'target' => 'user', 'target' => 'user',
'resource' => $this->getValue($prefix . 'resource'), 'resource' => $this->getValue($prefix . 'resource'),
); );
return array( return array(
$section => $cfg $section => $cfg

View File

@ -2,24 +2,24 @@
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
/** /**
* This file is part of Icinga 2 Web. * This file is part of Icinga 2 Web.
* *
* Icinga 2 Web - Head for multiple monitoring backends. * Icinga 2 Web - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team * Copyright (C) 2013 Icinga Development Team
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @copyright 2013 Icinga Development Team <info@icinga.org> * @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org> * @author Icinga Development Team <info@icinga.org>
@ -28,17 +28,15 @@
namespace Icinga\Form\Config\Authentication; namespace Icinga\Form\Config\Authentication;
use \Zend_Config;
use \Icinga\Application\Config as IcingaConfig; use \Icinga\Application\Config as IcingaConfig;
use \Icinga\Application\Icinga; use \Icinga\Application\Icinga;
use \Icinga\Application\Logger; use \Icinga\Application\Logger;
use \Icinga\Application\DbAdapterFactory; use \Icinga\Application\DbAdapterFactory;
use \Icinga\Web\Form; use \Icinga\Web\Form;
use \Zend_Config;
/** /**
* Form for adding or modifying LDAP authentication backends * Form for adding or modifying LDAP authentication backends
*
*/ */
class LdapBackendForm extends BaseBackendForm class LdapBackendForm extends BaseBackendForm
{ {
@ -56,11 +54,11 @@ class LdapBackendForm extends BaseBackendForm
'text', 'text',
'backend_'.$name.'_name', 'backend_'.$name.'_name',
array( array(
'required' => true, 'required' => true,
'allowEmpty'=> false, 'allowEmpty' => false,
'label' => 'Backend Name', 'label' => 'Backend Name',
'helptext' => 'The name of this authentication backend', 'helptext' => 'The name of this authentication backend',
'value' => $this->getBackendName() 'value' => $this->getBackendName()
) )
); );
@ -82,7 +80,7 @@ class LdapBackendForm extends BaseBackendForm
array( array(
'label' => 'LDAP Root DN', 'label' => 'LDAP Root DN',
'value' => $backend->get('root_dn', 'ou=people,dc=icinga,dc=org'), 'value' => $backend->get('root_dn', 'ou=people,dc=icinga,dc=org'),
'helptext' => 'The path where users can be found on the ldap server', 'helptext' => 'The path where users can be found on the ldap server',
'required' => true 'required' => true
) )
); );
@ -93,7 +91,7 @@ class LdapBackendForm extends BaseBackendForm
array( array(
'label' => 'LDAP Bind DN', 'label' => 'LDAP Bind DN',
'value' => $backend->get('bind_dn', 'cn=admin,cn=config'), 'value' => $backend->get('bind_dn', 'cn=admin,cn=config'),
'helptext' => 'The user dn to use for querying the ldap server', 'helptext' => 'The user dn to use for querying the ldap server',
'required' => true 'required' => true
) )
); );
@ -102,11 +100,11 @@ class LdapBackendForm extends BaseBackendForm
'password', 'password',
'backend_' . $name . '_bind_pw', 'backend_' . $name . '_bind_pw',
array( array(
'label' => 'LDAP Bind Password', 'label' => 'LDAP Bind Password',
'renderPassword' => true, 'renderPassword' => true,
'value' => $backend->get('bind_pw', 'admin'), 'value' => $backend->get('bind_pw', 'admin'),
'helptext' => 'The password to use for querying the ldap server', 'helptext' => 'The password to use for querying the ldap server',
'required' => true 'required' => true
) )
); );
@ -138,8 +136,9 @@ class LdapBackendForm extends BaseBackendForm
/** /**
* Return the ldap authentication backend configuration for this form * Return the ldap authentication backend configuration for this form
* *
* @return array * @return array
* @see BaseBackendForm::getConfig *
* @see BaseBackendForm::getConfig()
*/ */
public function getConfig() public function getConfig()
{ {
@ -148,14 +147,14 @@ class LdapBackendForm extends BaseBackendForm
$section = $this->getValue($prefix . 'name'); $section = $this->getValue($prefix . 'name');
$cfg = array( $cfg = array(
'backend' => 'ldap', 'backend' => 'ldap',
'target' => 'user', 'target' => 'user',
'hostname' => $this->getValue($prefix . 'hostname'), 'hostname' => $this->getValue($prefix . 'hostname'),
'root_dn' => $this->getValue($prefix . 'root_dn'), 'root_dn' => $this->getValue($prefix . 'root_dn'),
'bind_dn' => $this->getValue($prefix . 'bind_dn'), 'bind_dn' => $this->getValue($prefix . 'bind_dn'),
'bind_pw' => $this->getValue($prefix . 'bind_pw'), 'bind_pw' => $this->getValue($prefix . 'bind_pw'),
'user_class' => $this->getValue($prefix . 'user_class'), 'user_class' => $this->getValue($prefix . 'user_class'),
'user_name_attribute' => $this->getValue($prefix . 'user_name_attribute') 'user_name_attribute' => $this->getValue($prefix . 'user_name_attribute')
); );
return array( return array(
$section => $cfg $section => $cfg

View File

@ -2,24 +2,24 @@
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
/** /**
* This file is part of Icinga 2 Web. * This file is part of Icinga 2 Web.
* *
* Icinga 2 Web - Head for multiple monitoring backends. * Icinga 2 Web - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team * Copyright (C) 2013 Icinga Development Team
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @copyright 2013 Icinga Development Team <info@icinga.org> * @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org> * @author Icinga Development Team <info@icinga.org>
@ -28,15 +28,14 @@
namespace Icinga\Form\Config; namespace Icinga\Form\Config;
use \Zend_Config;
use \Icinga\Application\Config as IcingaConfig; use \Icinga\Application\Config as IcingaConfig;
use \Icinga\Application\Icinga; use \Icinga\Application\Icinga;
use \Icinga\Application\Logger; use \Icinga\Application\Logger;
use \Icinga\Application\DbAdapterFactory; use \Icinga\Application\DbAdapterFactory;
use \Icinga\Web\Form; use \Icinga\Web\Form;
use \Icinga\Web\Form\Element\Note; use \Icinga\Web\Form\Element\Note;
use \Icinga\Web\Form\Decorator\ConditionalHidden; use \Icinga\Web\Form\Decorator\ConditionalHidden;
use \Zend_Config;
/** /**
* Form for modifying the authentication provider and order. * Form for modifying the authentication provider and order.
@ -71,7 +70,7 @@ class AuthenticationForm extends Form
* Set an alternative array of resources that should be used instead of the DBFactory resource set * Set an alternative array of resources that should be used instead of the DBFactory resource set
* (used for testing) * (used for testing)
* *
* @param array $resources The resources to use for populating the db selection field * @param array $resources The resources to use for populating the db selection field
*/ */
public function setResources(array $resources) public function setResources(array $resources)
{ {
@ -93,9 +92,9 @@ class AuthenticationForm extends Form
* *
* The button will have the name "backend_$name_remove" * The button will have the name "backend_$name_remove"
* *
* @param string $name The backend to add this button for * @param string $name The backend to add this button for
* *
* @return string The id of the added button * @return string The id of the added button
*/ */
private function addRemoveHint($name) private function addRemoveHint($name)
{ {
@ -103,10 +102,10 @@ class AuthenticationForm extends Form
'checkbox', 'checkbox',
'backend_' . $name . '_remove', 'backend_' . $name . '_remove',
array( array(
'name' => 'backend_' . $name . '_remove', 'name' => 'backend_' . $name . '_remove',
'label' => 'Remove this authentication provider', 'label' => 'Remove this authentication provider',
'value' => $name, 'value' => $name,
'checked' => $this->isMarkedForDeletion($name) 'checked' => $this->isMarkedForDeletion($name)
) )
); );
$this->enableAutoSubmit(array('backend_' . $name . '_remove')); $this->enableAutoSubmit(array('backend_' . $name . '_remove'));
@ -123,8 +122,8 @@ class AuthenticationForm extends Form
* the Zend validation logic (maybe our own validation logic breaks it), we now create the form, but add * the Zend validation logic (maybe our own validation logic breaks it), we now create the form, but add
* all elements to this form explicitly. * all elements to this form explicitly.
* *
* @param string $name The name of the backend to add * @param string $name The name of the backend to add
* @param Zend_Config $backend The configuration of the backend * @param Zend_Config $backend The configuration of the backend
*/ */
private function addProviderForm($name, $backend) private function addProviderForm($name, $backend)
{ {
@ -159,10 +158,10 @@ class AuthenticationForm extends Form
/** /**
* Add the buttons for modifying authentication priorities * Add the buttons for modifying authentication priorities
* *
* @param string $name The name of the backend to add the buttons for * @param string $name The name of the backend to add the buttons for
* @param array $order The current order which will be used to determine the changed order * @param array $order The current order which will be used to determine the changed order
* *
* @return array An array containing the newly added form element ids as strings * @return array An array containing the newly added form element ids as strings
*/ */
public function addPriorityButtons($name, $order = array()) public function addPriorityButtons($name, $order = array())
{ {
@ -204,24 +203,25 @@ class AuthenticationForm extends Form
/** /**
* Overwrite for Zend_Form::populate in order to preserve the modified priority of the backends * Overwrite for Zend_Form::populate in order to preserve the modified priority of the backends
* *
* @param array $values The values to populate the form with * @param array $values The values to populate the form with
* *
* @return void|\Zend_Form * @return self
* @see Zend_Form::populate *
* @see Zend_Form::populate()
*/ */
public function populate(array $values) public function populate(array $values)
{ {
$last_priority = $this->getValue('current_priority'); $last_priority = $this->getValue('current_priority');
parent::populate($values); parent::populate($values);
$this->getElement('current_priority')->setValue($last_priority); $this->getElement('current_priority')->setValue($last_priority);
return $this;
} }
/** /**
* Return an array containing all authentication providers in the order they should be used * Return an array containing all authentication providers in the order they should be used
* *
* @return array An array containing the identifiers (section names) of the authentication backend in * @return array An array containing the identifiers (section names) of the authentication backend in
* the order they should be persisted * the order they should be persisted
*/ */
private function getAuthenticationOrder() private function getAuthenticationOrder()
{ {
@ -243,9 +243,9 @@ class AuthenticationForm extends Form
/** /**
* Return true if the backend should be deleted when the changes are persisted * Return true if the backend should be deleted when the changes are persisted
* *
* @param string $backendName The name of the backend to check for being in a 'delete' state * @param string $backendName The name of the backend to check for being in a 'delete' state
* *
* @return bool Whether this backend will be deleted on save * @return bool Whether this backend will be deleted on save
*/ */
private function isMarkedForDeletion($backendName) private function isMarkedForDeletion($backendName)
{ {

View File

@ -2,24 +2,24 @@
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
/** /**
* This file is part of Icinga 2 Web. * This file is part of Icinga 2 Web.
* *
* Icinga 2 Web - Head for multiple monitoring backends. * Icinga 2 Web - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team * Copyright (C) 2013 Icinga Development Team
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @copyright 2013 Icinga Development Team <info@icinga.org> * @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org> * @author Icinga Development Team <info@icinga.org>
@ -28,6 +28,10 @@
namespace Icinga\Form\Config; namespace Icinga\Form\Config;
use \DateTimeZone;
use \Zend_Config;
use \Zend_Form_Element_Text;
use \Zend_Form_Element_Select;
use \Icinga\Application\Config as IcingaConfig; use \Icinga\Application\Config as IcingaConfig;
use \Icinga\Application\Icinga; use \Icinga\Application\Icinga;
use \Icinga\Application\DbAdapterFactory; use \Icinga\Application\DbAdapterFactory;
@ -37,11 +41,6 @@ use \Icinga\Web\Form\Validator\TimeFormatValidator;
use \Icinga\Web\Form\Validator\DateFormatValidator; use \Icinga\Web\Form\Validator\DateFormatValidator;
use \Icinga\Web\Form\Decorator\ConditionalHidden; use \Icinga\Web\Form\Decorator\ConditionalHidden;
use \DateTimeZone;
use \Zend_Config;
use \Zend_Form_Element_Text;
use \Zend_Form_Element_Select;
/** /**
* Configuration form for general, application-wide settings * Configuration form for general, application-wide settings
* *
@ -93,8 +92,9 @@ class GeneralForm extends Form
/** /**
* Return the config path set for this form or the application wide config path if none is set * Return the config path set for this form or the application wide config path if none is set
* *
* @return string * @return string
* @see IcingaConfig::configDir *
* @see IcingaConfig::configDir
*/ */
public function getConfigDir() public function getConfigDir()
{ {
@ -105,7 +105,7 @@ class GeneralForm extends Form
* Set an alternative array of resources that should be used instead of the DBFactory resource set * Set an alternative array of resources that should be used instead of the DBFactory resource set
* (used for testing) * (used for testing)
* *
* @param array $resources The resources to use for populating the db selection field * @param array $resources The resources to use for populating the db selection field
*/ */
public function setResources(array $resources) public function setResources(array $resources)
{ {
@ -129,7 +129,7 @@ class GeneralForm extends Form
/** /**
* Add the checkbox for using the development environment to this form * Add the checkbox for using the development environment to this form
* *
* @param Zend_Config $cfg The "global" section of the config.ini * @param Zend_Config $cfg The "global" section of the config.ini
*/ */
private function addDevelopmentCheckbox(Zend_Config $cfg) private function addDevelopmentCheckbox(Zend_Config $cfg)
{ {
@ -140,9 +140,8 @@ class GeneralForm extends Form
array( array(
'label' => 'Development Mode', 'label' => 'Development Mode',
'required' => true, 'required' => true,
'helptext' => 'Set true to show more detailed errors ' 'helptext' => 'Set true to show more detailed errors and disable certain optimizations in order to '
. 'and disable certain optimizations ' . 'make debugging easier.',
. 'in order to make debugging easier.',
'tooltip' => 'More verbose output', 'tooltip' => 'More verbose output',
'value' => $env === 'development' 'value' => $env === 'development'
) )
@ -155,7 +154,7 @@ class GeneralForm extends Form
* *
* Possible values are determined by DateTimeZone::listIdentifiers * Possible values are determined by DateTimeZone::listIdentifiers
* *
* @param Zend_Config $cfg The "global" section of the config.ini * @param Zend_Config $cfg The "global" section of the config.ini
*/ */
private function addTimezoneSelection(Zend_Config $cfg) private function addTimezoneSelection(Zend_Config $cfg)
{ {
@ -182,7 +181,7 @@ class GeneralForm extends Form
/** /**
* Add configuration settings for module paths * Add configuration settings for module paths
* *
* @param Zend_Config $cfg The "global" section of the config.ini * @param Zend_Config $cfg The "global" section of the config.ini
*/ */
private function addModuleSettings(Zend_Config $cfg) private function addModuleSettings(Zend_Config $cfg)
{ {
@ -201,12 +200,12 @@ class GeneralForm extends Form
/** /**
* Add text fields for the date and time format used in the application * Add text fields for the date and time format used in the application
* *
* @param Zend_Config $cfg The "global" section of the config.ini * @param Zend_Config $cfg The "global" section of the config.ini
*/ */
private function addDateFormatSettings(Zend_Config $cfg) private function addDateFormatSettings(Zend_Config $cfg)
{ {
$phpUrl = '<a href="http://php.net/manual/en/function.date.php" target="_new">' $phpUrl = '<a href="http://php.net/manual/en/function.date.php" target="_new">'
. 'the official PHP documentation</a>'; . 'the official PHP documentation</a>';
$txtDefaultDateFormat = new Zend_Form_Element_Text( $txtDefaultDateFormat = new Zend_Form_Element_Text(
array( array(
@ -236,7 +235,7 @@ class GeneralForm extends Form
/** /**
* Add form elements for setting the user preference storage backend * Add form elements for setting the user preference storage backend
* *
* @param Zend_Config $cfg The Zend_config object of preference section * @param Zend_Config $cfg The Zend_config object of preference section
*/ */
public function addUserPreferencesDialog(Zend_Config $cfg) public function addUserPreferencesDialog(Zend_Config $cfg)
{ {

View File

@ -2,24 +2,24 @@
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
/** /**
* This file is part of Icinga 2 Web. * This file is part of Icinga 2 Web.
* *
* Icinga 2 Web - Head for multiple monitoring backends. * Icinga 2 Web - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team * Copyright (C) 2013 Icinga Development Team
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @copyright 2013 Icinga Development Team <info@icinga.org> * @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org> * @author Icinga Development Team <info@icinga.org>
@ -28,18 +28,16 @@
namespace Icinga\Form\Config; namespace Icinga\Form\Config;
use \Zend_Config;
use \Zend_Form_Element_Text;
use \Icinga\Application\Config as IcingaConfig; use \Icinga\Application\Config as IcingaConfig;
use \Icinga\Application\Icinga; use \Icinga\Application\Icinga;
use \Icinga\Web\Form; use \Icinga\Web\Form;
use \Icinga\Web\Form\Element\Note;
use \Icinga\Web\Form\Validator\WritablePathValidator; use \Icinga\Web\Form\Validator\WritablePathValidator;
use \Icinga\Web\Form\Decorator\ConditionalHidden; use \Icinga\Web\Form\Decorator\ConditionalHidden;
use \Zend_Config;
use \Zend_Form_Element_Text;
/** /**
* Form class for setting the application wide logging configuration * Form class for setting the application wide logging configuration
*
*/ */
class LoggingForm extends Form class LoggingForm extends Form
{ {
@ -62,7 +60,7 @@ class LoggingForm extends Form
* *
* If not called, default values are used instead * If not called, default values are used instead
* *
* @param Zend_Config $cfg The config.ini to set with this form * @param Zend_Config $cfg The config.ini to set with this form
*/ */
public function setConfiguration(Zend_Config $cfg) public function setConfiguration(Zend_Config $cfg)
{ {
@ -72,7 +70,7 @@ class LoggingForm extends Form
/** /**
* Set a different base directory to use for default paths instead of the one provided by Icinga::app() * Set a different base directory to use for default paths instead of the one provided by Icinga::app()
* *
* @param string $dir The new directory to use * @param string $dir The new directory to use
*/ */
public function setBaseDir($dir) public function setBaseDir($dir)
{ {
@ -102,9 +100,9 @@ class LoggingForm extends Form
* and true or if it is not submitted, but the configuration for debug * and true or if it is not submitted, but the configuration for debug
* logging is set to true * logging is set to true
* *
* @param Zend_Config $config The debug section of the config.ini * @param Zend_Config $config The debug section of the config.ini
* *
* @return bool Whether to display the debug path field or not * @return bool Whether to display the debug path field or not
*/ */
private function shouldDisplayDebugLog(Zend_Config $config) private function shouldDisplayDebugLog(Zend_Config $config)
{ {
@ -143,7 +141,7 @@ class LoggingForm extends Form
'name' => 'logging_app_target', 'name' => 'logging_app_target',
'label' => 'Application Log Path', 'label' => 'Application Log Path',
'helptext' => 'The logfile to write the icingaweb debug logs to.' 'helptext' => 'The logfile to write the icingaweb debug logs to.'
. 'The webserver must be able to write at this location', . 'The webserver must be able to write at this location',
'required' => true, 'required' => true,
'value' => $logging->get('target', '/var/log/icingaweb.log') 'value' => $logging->get('target', '/var/log/icingaweb.log')
) )
@ -198,7 +196,7 @@ class LoggingForm extends Form
/** /**
* Return a Zend_Config object containing the state defined in this form * Return a Zend_Config object containing the state defined in this form
* *
* @return Zend_Config The config defined in this form * @return Zend_Config The config defined in this form
*/ */
public function getConfig() public function getConfig()
{ {

View File

@ -28,6 +28,10 @@
namespace Icinga\Form\Preference; namespace Icinga\Form\Preference;
use \DateTimeZone;
use \Zend_Config;
use \Zend_Form_Element_Text;
use \Zend_Form_Element_Select;
use \Icinga\Application\Config as IcingaConfig; use \Icinga\Application\Config as IcingaConfig;
use \Icinga\Application\Icinga; use \Icinga\Application\Icinga;
use \Icinga\Application\DbAdapterFactory; use \Icinga\Application\DbAdapterFactory;
@ -36,14 +40,8 @@ use \Icinga\Web\Form;
use \Icinga\Web\Form\Validator\TimeFormatValidator; use \Icinga\Web\Form\Validator\TimeFormatValidator;
use \Icinga\Web\Form\Validator\DateFormatValidator; use \Icinga\Web\Form\Validator\DateFormatValidator;
use \DateTimeZone;
use \Zend_Config;
use \Zend_Form_Element_Text;
use \Zend_Form_Element_Select;
/** /**
* General user preferences * General user preferences
*
*/ */
class GeneralForm extends Form class GeneralForm extends Form
{ {
@ -100,7 +98,7 @@ class GeneralForm extends Form
* Possible values are determined by DateTimeZone::listIdentifiers * Possible values are determined by DateTimeZone::listIdentifiers
* Also, a 'use default format' checkbox is added in order to allow a user to discard his overwritten setting * Also, a 'use default format' checkbox is added in order to allow a user to discard his overwritten setting
* *
* @param Zend_Config $cfg The "global" section of the config.ini to be used as default valuse * @param Zend_Config $cfg The "global" section of the config.ini to be used as default valuse
*/ */
private function addTimezoneSelection(Zend_Config $cfg) private function addTimezoneSelection(Zend_Config $cfg)
{ {
@ -143,7 +141,7 @@ class GeneralForm extends Form
* *
* Also, a 'use default format' checkbox is added in order to allow a user to discard his overwritten setting * Also, a 'use default format' checkbox is added in order to allow a user to discard his overwritten setting
* *
* @param Zend_Config $cfg The "global" section of the config.ini to be used as default values * @param Zend_Config $cfg The "global" section of the config.ini to be used as default values
*/ */
private function addDateFormatSettings(Zend_Config $cfg) private function addDateFormatSettings(Zend_Config $cfg)
{ {
@ -205,8 +203,6 @@ class GeneralForm extends Form
} }
$this->enableAutoSubmit(array('default_time_format', 'default_date_format')); $this->enableAutoSubmit(array('default_time_format', 'default_date_format'));
} }
/** /**
@ -243,6 +239,5 @@ class GeneralForm extends Form
'app.dateFormat' => $values['date_format'], 'app.dateFormat' => $values['date_format'],
'app.timeFormat' => $values['time_format'] 'app.timeFormat' => $values['time_format']
); );
} }
} }

View File

@ -207,8 +207,9 @@ class Web extends ApplicationBootstrap
/** /**
* Create user object and inject preference interface * Create user object and inject preference interface
* *
* @throws ConfigurationError
* @return User * @return User
*
* @throws ConfigurationError
*/ */
private function setupUser() private function setupUser()
{ {
@ -328,7 +329,7 @@ class Web extends ApplicationBootstrap
/** /**
* Configure pagination settings * Configure pagination settings
*
* @return self * @return self
*/ */
private function setupPagination() private function setupPagination()

View File

@ -28,12 +28,14 @@
namespace Icinga\Protocol\Commandpipe\Transport; namespace Icinga\Protocol\Commandpipe\Transport;
use Icinga\Application\Logger; use \RuntimeException;
use \Zend_Config;
use \Icinga\Application\Logger;
/** /**
* Command pipe transport class that uses ssh for connecting to a remote filesystem with the icinga.cmd pipe * Command pipe transport class that uses ssh for connecting to a remote filesystem with the icinga.cmd pipe
* The remote host must have KeyAuth enabled for this user
* *
* The remote host must have KeyAuth enabled for this user
*/ */
class SecureShell implements Transport class SecureShell implements Transport
{ {
@ -66,20 +68,27 @@ class SecureShell implements Transport
private $user = null; private $user = null;
/** /**
* @see Transport::setEndpoint() * Overwrite the target file of this Transport class using the given config from instances.ini
* *
* @param Zend_Config $config
*
* @see Transport::setEndpoint()
*/ */
public function setEndpoint(\Zend_Config $config) public function setEndpoint(Zend_Config $config)
{ {
$this->host = isset($config->host) ? $config->host : "localhost"; $this->host = isset($config->host) ? $config->host : 'localhost';
$this->port = isset($config->port) ? $config->port : 22; $this->port = isset($config->port) ? $config->port : 22;
$this->user = isset($config->user) ? $config->user : null; $this->user = isset($config->user) ? $config->user : null;
$this->path = isset($config->path) ? $config->path : "/usr/local/icinga/var/rw/icinga.cmd"; $this->path = isset($config->path) ? $config->path : '/usr/local/icinga/var/rw/icinga.cmd';
} }
/** /**
* @see Transport::send() * Write the given external command to the command pipe
* *
* @param string $command
*
* @throws RuntimeException When the command could not be sent to the remote Icinga host
* @see Transport::send()
*/ */
public function send($command) public function send($command)
{ {
@ -113,11 +122,11 @@ class SecureShell implements Transport
Logger::debug("Return code %s: %s ", $retCode, $output); Logger::debug("Return code %s: %s ", $retCode, $output);
if ($retCode != 0) { if ($retCode != 0) {
$msg = 'Could not send command to remote icinga host: ' $msg = 'Could not send command to remote Icinga host: '
. implode(PHP_EOL, $output) . implode(PHP_EOL, $output)
. " (returncode $retCode)"; . " (returncode $retCode)";
Logger::error($msg); Logger::error($msg);
throw new \RuntimeException($msg); throw new RuntimeException($msg);
} }
} }
} }

View File

@ -28,23 +28,24 @@
namespace Icinga\Protocol\Commandpipe\Transport; namespace Icinga\Protocol\Commandpipe\Transport;
use \Zend_Config;
/** /**
* Interface for Transport classes handling the concrete access to the command pipe * Interface for Transport classes handling the concrete access to the command pipe
*
*/ */
interface Transport interface Transport
{ {
/** /**
* Overwrite the target file of this Transport class using the given config from instances.ini * Overwrite the target file of this Transport class using the given config from instances.ini
* *
* @param \Zend_Config $config A configuration file containing a 'path' setting * @param Zend_Config $config A configuration file containing a 'path' setting
*/ */
public function setEndpoint(\Zend_Config $config); public function setEndpoint(Zend_Config $config);
/** /**
* Write the given external command to the command pipe * Write the given external command to the command pipe
* *
* @param string $message The command to send, without the timestamp (this will be added here) * @param string $message The command to send, without the timestamp (this will be added here)
*/ */
public function send($message); public function send($message);
} }

View File

@ -28,26 +28,22 @@
namespace Icinga\Web\Controller; namespace Icinga\Web\Controller;
use \Zend_Controller_Action as ZfController;
use \Zend_Controller_Request_Abstract as ZfRequest;
use \Zend_Controller_Response_Abstract as ZfResponse;
use \Zend_Controller_Action_HelperBroker as ZfActionHelper;
use \Zend_Layout as ZfLayout;
use \Icinga\Authentication\Manager as AuthManager; use \Icinga\Authentication\Manager as AuthManager;
use \Icinga\Application\Benchmark; use \Icinga\Application\Benchmark;
use \Icinga\Exception; use \Icinga\Exception;
use \Icinga\Application\Config; use \Icinga\Application\Config;
use \Icinga\Web\Notification; use \Icinga\Web\Notification;
use \Icinga\Web\Widget\Tabs; use \Icinga\Web\Widget\Tabs;
use \Zend_Layout as ZfLayout;
use \Zend_Controller_Action as ZfController;
use \Zend_Controller_Request_Abstract as ZfRequest;
use \Zend_Controller_Response_Abstract as ZfResponse;
use \Zend_Controller_Action_HelperBroker as ZfActionHelper;
/** /**
* Base class for all core action controllers * Base class for all core action controllers
* *
* All Icinga Web core controllers should extend this class * All Icinga Web core controllers should extend this class
*
* @copyright Copyright (c) 2013 Icinga-Web Team <info@icinga.org>
* @author Icinga-Web Team <info@icinga.org>
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
*/ */
class ActionController extends ZfController class ActionController extends ZfController
{ {
@ -148,7 +144,7 @@ class ActionController extends ZfController
/** /**
* Return the tabs * Return the tabs
* *
* @return \Icinga\Widget\Web\Tabs * @return Tabs
*/ */
public function getTabs() public function getTabs()
{ {
@ -159,39 +155,15 @@ class ActionController extends ZfController
/** /**
* Translate the given string with the global translation catalog * Translate the given string with the global translation catalog
* *
* @param string $string The string that should be translated * @param string $string The string that should be translated
* *
* @return string * @return string
*/ */
public function translate($string) public function translate($string)
{ {
return t($string); return t($string);
} }
/**
* Whether the current user has the given permission
*
* TODO: This has not been implemented yet (Feature #4111)
*
* @return bool
*/
final protected function hasPermission($uri)
{
return true;
}
/**
* Assert the current user has the given permission
*
* TODO: This has not been implemented yet (Feature #4111)
*
* @return self
*/
final protected function assertPermission()
{
return $this;
}
private function redirectToLogin() private function redirectToLogin()
{ {
$this->_request->setModuleName('default') $this->_request->setModuleName('default')
@ -202,8 +174,6 @@ class ActionController extends ZfController
/** /**
* Prepare action execution by testing for correct permissions and setting shortcuts * Prepare action execution by testing for correct permissions and setting shortcuts
*
* @return void
*/ */
public function preDispatch() public function preDispatch()
{ {
@ -229,7 +199,7 @@ class ActionController extends ZfController
/** /**
* Redirect to a specific url, updating the browsers URL field * Redirect to a specific url, updating the browsers URL field
* *
* @param Url|string $url The target to redirect to * @param Url|string $url The target to redirect to
**/ **/
public function redirectNow($url) public function redirectNow($url)
{ {

View File

@ -25,13 +25,13 @@
namespace Icinga\Web; namespace Icinga\Web;
use \Icinga\Web\Form\Decorator\HelpText;
use \Zend_Controller_Request_Abstract; use \Zend_Controller_Request_Abstract;
use \Zend_Form;
use \Zend_Form_Element_Submit; use \Zend_Form_Element_Submit;
use \Zend_Form_Element_Reset; use \Zend_Form_Element_Reset;
use \Zend_View_Interface; use \Zend_View_Interface;
use \Zend_Form;
use \Icinga\Exception\ProgrammingError; use \Icinga\Exception\ProgrammingError;
use \Icinga\Web\Form\Decorator\HelpText;
use \Icinga\Web\Form\InvalidCSRFTokenException; use \Icinga\Web\Form\InvalidCSRFTokenException;
/** /**
@ -41,6 +41,7 @@ abstract class Form extends Zend_Form
{ {
/** /**
* The form's request object * The form's request object
*
* @var Zend_Controller_Request_Abstract * @var Zend_Controller_Request_Abstract
*/ */
private $request; private $request;
@ -49,24 +50,28 @@ abstract class Form extends Zend_Form
* Whether this form should NOT add random generated "challenge" tokens that are associated with the user's current * Whether this form should NOT add random generated "challenge" tokens that are associated with the user's current
* session in order to prevent Cross-Site Request Forgery (CSRF). It is the form's responsibility to verify the * session in order to prevent Cross-Site Request Forgery (CSRF). It is the form's responsibility to verify the
* existence and correctness of this token * existence and correctness of this token
*
* @var bool * @var bool
*/ */
protected $tokenDisabled = false; protected $tokenDisabled = false;
/** /**
* Name of the CSRF token element (used to create non-colliding hashes) * Name of the CSRF token element (used to create non-colliding hashes)
*
* @var string * @var string
*/ */
private $tokenElementName = 'CSRFToken'; private $tokenElementName = 'CSRFToken';
/** /**
* Flag to indicate that form is already build * Flag to indicate that form is already build
*
* @var bool * @var bool
*/ */
private $created = false; private $created = false;
/** /**
* Session id used for CSRF token generation * Session id used for CSRF token generation
*
* @var string * @var string
*/ */
private $sessionId; private $sessionId;
@ -95,6 +100,7 @@ abstract class Form extends Zend_Form
* If the ID has never been set, the ID from session_id() is returned * If the ID has never been set, the ID from session_id() is returned
* *
* @return string * @return string
*
* @see session_id() * @see session_id()
* @see setSessionId() * @see setSessionId()
*/ */
@ -111,7 +117,7 @@ abstract class Form extends Zend_Form
* *
* This method should be used for testing purposes only * This method should be used for testing purposes only
* *
* @param string $sessionId * @param string $sessionId
*/ */
public function setSessionId($sessionId) public function setSessionId($sessionId)
{ {
@ -121,7 +127,7 @@ abstract class Form extends Zend_Form
/** /**
* Return the HTML element name of the CSRF token field * Return the HTML element name of the CSRF token field
* *
* @return string * @return string
*/ */
public function getTokenElementName() public function getTokenElementName()
{ {
@ -132,6 +138,7 @@ abstract class Form extends Zend_Form
* Render the form to HTML * Render the form to HTML
* *
* @param Zend_View_Interface $view * @param Zend_View_Interface $view
*
* @return string * @return string
*/ */
public function render(Zend_View_Interface $view = null) public function render(Zend_View_Interface $view = null)
@ -156,7 +163,7 @@ abstract class Form extends Zend_Form
/** /**
* Setter for the request * Setter for the request
* *
* @param Zend_Controller_Request_Abstract $request * @param Zend_Controller_Request_Abstract $request
*/ */
public function setRequest(Zend_Controller_Request_Abstract $request) public function setRequest(Zend_Controller_Request_Abstract $request)
{ {
@ -166,7 +173,7 @@ abstract class Form extends Zend_Form
/** /**
* Getter for the request * Getter for the request
* *
* @return Zend_Controller_Request_Abstract * @return Zend_Controller_Request_Abstract
*/ */
public function getRequest() public function getRequest()
{ {
@ -197,7 +204,7 @@ abstract class Form extends Zend_Form
if (!$this->getAction() && $this->getRequest()) { if (!$this->getAction() && $this->getRequest()) {
$this->setAction($this->getRequest()->getRequestUri()); $this->setAction($this->getRequest()->getRequestUri());
} }
$this->enableAdditionalDecorators(); $this->addElementDecorators();
$this->created = true; $this->created = true;
} }
} }
@ -205,7 +212,7 @@ abstract class Form extends Zend_Form
/** /**
* Setter for the cancel label * Setter for the cancel label
* *
* @param string $cancelLabel * @param string $cancelLabel
*/ */
public function setCancelLabel($cancelLabel) public function setCancelLabel($cancelLabel)
{ {
@ -230,7 +237,7 @@ abstract class Form extends Zend_Form
/** /**
* Setter for the submit label * Setter for the submit label
* *
* @param string $submitLabel * @param string $submitLabel
*/ */
public function setSubmitLabel($submitLabel) public function setSubmitLabel($submitLabel)
{ {
@ -257,8 +264,9 @@ abstract class Form extends Zend_Form
* *
* Enables automatic submission of this form once the user edits specific elements * Enables automatic submission of this form once the user edits specific elements
* *
* @param array $triggerElements The element names which should auto-submit the form * @param array $triggerElements The element names which should auto-submit the form
* @throws ProgrammingError When an element is found which does not yet exist *
* @throws ProgrammingError When an element is found which does not yet exist
*/ */
final public function enableAutoSubmit($triggerElements) final public function enableAutoSubmit($triggerElements)
{ {
@ -281,7 +289,7 @@ abstract class Form extends Zend_Form
* Ensures that the current request method is POST, that the form was manually submitted and that the data provided * Ensures that the current request method is POST, that the form was manually submitted and that the data provided
* in the request is valid and gets repopulated in case its invalid. * in the request is valid and gets repopulated in case its invalid.
* *
* @return bool * @return bool
*/ */
public function isSubmittedAndValid() public function isSubmittedAndValid()
{ {
@ -309,13 +317,13 @@ abstract class Form extends Zend_Form
} }
} }
/** /**
* Disable CSRF counter measure and remove its field if already added * Disable CSRF counter measure and remove its field if already added
* *
* This method should be used for testing purposes only * This method should be used for testing purposes only
* *
* @param bool $disabled * @param bool $disabled
*
* @see tokenDisabled * @see tokenDisabled
*/ */
final public function setTokenDisabled($disabled = true) final public function setTokenDisabled($disabled = true)
@ -347,8 +355,9 @@ abstract class Form extends Zend_Form
/** /**
* Test the submitted data for a correct CSRF token * Test the submitted data for a correct CSRF token
* *
* @param array $checkData The POST data send by the user * @param array $checkData The POST data send by the user
* @throws InvalidCSRFTokenException When CSRF Validation fails *
* @throws InvalidCSRFTokenException When CSRF Validation fails
*/ */
final public function assertValidCsrfToken(array $checkData) final public function assertValidCsrfToken(array $checkData)
{ {
@ -366,7 +375,8 @@ abstract class Form extends Zend_Form
/** /**
* Check whether the form's CSRF token-field has a valid value * Check whether the form's CSRF token-field has a valid value
* *
* @param string $elementValue Value from the form element * @param string $elementValue Value from the form element
*
* @return bool * @return bool
*/ */
private function hasValidCsrfToken($elementValue) private function hasValidCsrfToken($elementValue)
@ -387,7 +397,14 @@ abstract class Form extends Zend_Form
return $token === hash('sha256', $this->getSessionId() . $seed); return $token === hash('sha256', $this->getSessionId() . $seed);
} }
public function enableAdditionalDecorators() /**
* Add element decorators which apply to all elements
*
* Adds `HelpText` decorator
*
* @see HelpText
*/
private function addElementDecorators()
{ {
foreach ($this->getElements() as $element) { foreach ($this->getElements() as $element) {
$element->addDecorator(new HelpText()); $element->addDecorator(new HelpText());
@ -397,7 +414,7 @@ abstract class Form extends Zend_Form
/** /**
* Generate a new (seed, token) pair * Generate a new (seed, token) pair
* *
* @return array * @return array
*/ */
final public function generateCsrfToken() final public function generateCsrfToken()
{ {
@ -410,7 +427,7 @@ abstract class Form extends Zend_Form
/** /**
* Return the string representation of the CSRF seed/token pair * Return the string representation of the CSRF seed/token pair
* *
* @return string * @return string
*/ */
final public function generateCsrfTokenAsString() final public function generateCsrfTokenAsString()
{ {

View File

@ -2,24 +2,24 @@
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
/** /**
* This file is part of Icinga 2 Web. * This file is part of Icinga 2 Web.
* *
* Icinga 2 Web - Head for multiple monitoring backends. * Icinga 2 Web - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team * Copyright (C) 2013 Icinga Development Team
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @copyright 2013 Icinga Development Team <info@icinga.org> * @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org> * @author Icinga Development Team <info@icinga.org>
@ -44,13 +44,9 @@ class ConditionalHidden extends Zend_Form_Decorator_Abstract
* Generate a field that will be wrapped in <noscript> tag if the * Generate a field that will be wrapped in <noscript> tag if the
* "condition" attribute is set and false or 0 * "condition" attribute is set and false or 0
* *
* @access public * @param string $content The tag's content
* *
* @param string $name The element name. * @return string The generated tag
* @param string $value The default value.
* @param array $attribs Attributes which should be added to the input tag.
*
* @return string The input tag and options XHTML.
*/ */
public function render($content = '') public function render($content = '')
{ {

View File

@ -39,13 +39,9 @@ class HelpText extends Zend_Form_Decorator_Abstract
/** /**
* Add a helptext to an input field * Add a helptext to an input field
* *
* @access public * @param string $content The help text
* *
* @param string $name The element name. * @return string The generated tag
* @param string $value The default value.
* @param array $attribs Attributes which should be added to the input tag.
*
* @return string The input tag and options XHTML.
*/ */
public function render($content = '') public function render($content = '')
{ {

View File

@ -2,24 +2,24 @@
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
/** /**
* This file is part of Icinga 2 Web. * This file is part of Icinga 2 Web.
* *
* Icinga 2 Web - Head for multiple monitoring backends. * Icinga 2 Web - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team * Copyright (C) 2013 Icinga Development Team
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @copyright 2013 Icinga Development Team <info@icinga.org> * @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org> * @author Icinga Development Team <info@icinga.org>
@ -32,7 +32,6 @@ use \Zend_Validate_Abstract;
/** /**
* Validator that checks if a textfield contains a correct date format * Validator that checks if a textfield contains a correct date format
*
*/ */
class DateFormatValidator extends Zend_Validate_Abstract class DateFormatValidator extends Zend_Validate_Abstract
{ {
@ -41,6 +40,7 @@ class DateFormatValidator extends Zend_Validate_Abstract
* Valid date characters according to @see http://www.php.net/manual/en/function.date.php * Valid date characters according to @see http://www.php.net/manual/en/function.date.php
* *
* @var array * @var array
*
* @see http://www.php.net/manual/en/function.date.php * @see http://www.php.net/manual/en/function.date.php
*/ */
private $validChars = private $validChars =
@ -57,22 +57,24 @@ class DateFormatValidator extends Zend_Validate_Abstract
* Error templates * Error templates
* *
* @var array * @var array
*
* @see Zend_Validate_Abstract::$_messageTemplates * @see Zend_Validate_Abstract::$_messageTemplates
*/ */
// @codingStandardsIgnoreStart // @codingStandardsIgnoreStart
protected $_messageTemplates = array( protected $_messageTemplates = array(
'INVALID_CHARACTERS' => 'Invalid date format' 'INVALID_CHARACTERS' => 'Invalid date format'
); );
// @codingStandardsIgnoreEnd // @codingStandardsIgnoreEnd
/** /**
* Validate the input value * Validate the input value
* *
* @param string $value The format string to validate * @param string $value The format string to validate
* @param null $context The form context (ignored) * @param null $context The form context (ignored)
* *
* @return bool True when the input is valid, otherwise false * @return bool True when the input is valid, otherwise false
* @see Zend_Validate_Abstract::isValid *
* @see Zend_Validate_Abstract::isValid()
*/ */
public function isValid($value, $context = null) public function isValid($value, $context = null)
{ {

View File

@ -2,24 +2,24 @@
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
/** /**
* This file is part of Icinga 2 Web. * This file is part of Icinga 2 Web.
* *
* Icinga 2 Web - Head for multiple monitoring backends. * Icinga 2 Web - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team * Copyright (C) 2013 Icinga Development Team
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @copyright 2013 Icinga Development Team <info@icinga.org> * @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org> * @author Icinga Development Team <info@icinga.org>
@ -32,7 +32,6 @@ use \Zend_Validate_Abstract;
/** /**
* Validator that checks if a textfield contains a correct time format * Validator that checks if a textfield contains a correct time format
*
*/ */
class TimeFormatValidator extends Zend_Validate_Abstract class TimeFormatValidator extends Zend_Validate_Abstract
{ {
@ -60,18 +59,19 @@ class TimeFormatValidator extends Zend_Validate_Abstract
*/ */
// @codingStandardsIgnoreStart // @codingStandardsIgnoreStart
protected $_messageTemplates = array( protected $_messageTemplates = array(
'INVALID_CHARACTERS' => 'Invalid time format' 'INVALID_CHARACTERS' => 'Invalid time format'
); );
// @codingStandardsIgnoreEnd // @codingStandardsIgnoreEnd
/** /**
* Validate the input value * Validate the input value
* *
* @param string $value The format string to validate * @param string $value The format string to validate
* @param null $context The form context (ignored) * @param null $context The form context (ignored)
* *
* @return bool True when the input is valid, otherwise false * @return bool True when the input is valid, otherwise false
* @see Zend_Validate_Abstract::isValid *
* @see Zend_Validate_Abstract::isValid()
*/ */
public function isValid($value, $context = null) public function isValid($value, $context = null)
{ {

View File

@ -2,24 +2,24 @@
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
/** /**
* This file is part of Icinga 2 Web. * This file is part of Icinga 2 Web.
* *
* Icinga 2 Web - Head for multiple monitoring backends. * Icinga 2 Web - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team * Copyright (C) 2013 Icinga Development Team
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @copyright 2013 Icinga Development Team <info@icinga.org> * @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org> * @author Icinga Development Team <info@icinga.org>
@ -32,7 +32,6 @@ use \Zend_Validate_Abstract;
/** /**
* Validator that interprets the value as a path and checks if it's writable * Validator that interprets the value as a path and checks if it's writable
*
*/ */
class WritablePathValidator extends Zend_Validate_Abstract class WritablePathValidator extends Zend_Validate_Abstract
{ {
@ -40,12 +39,13 @@ class WritablePathValidator extends Zend_Validate_Abstract
* The messages to write on differen error states * The messages to write on differen error states
* *
* @var array * @var array
*
* @see Zend_Validate_Abstract::$_messageTemplates * @see Zend_Validate_Abstract::$_messageTemplates
*/ */
// @codingStandardsIgnoreStart // @codingStandardsIgnoreStart
protected $_messageTemplates = array( protected $_messageTemplates = array(
'NOT_WRITABLE' => 'Path is not writable', 'NOT_WRITABLE' => 'Path is not writable',
'DOES_NOT_EXIST'=> 'Path does not exist' 'DOES_NOT_EXIST' => 'Path does not exist'
); );
// @codingStandardsIgnoreEnd // @codingStandardsIgnoreEnd
@ -67,11 +67,12 @@ class WritablePathValidator extends Zend_Validate_Abstract
/** /**
* Check whether the given value is writable path * Check whether the given value is writable path
* *
* @param string $value The value submitted in the form * @param string $value The value submitted in the form
* @param null $context The context of the form * @param mixed $context The context of the form
* *
* @return bool True when validation worked, otherwise false * @return bool True when validation worked, otherwise false
* @see Zend_Validate_Abstract::isValid() *
* @see Zend_Validate_Abstract::isValid()
*/ */
public function isValid($value, $context = null) public function isValid($value, $context = null)
{ {

View File

@ -3,35 +3,37 @@
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
/** /**
* This file is part of Icinga 2 Web. * This file is part of Icinga 2 Web.
* *
* Icinga 2 Web - Head for multiple monitoring backends. * Icinga 2 Web - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team * Copyright (C) 2013 Icinga Development Team
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @copyright 2013 Icinga Development Team <info@icinga.org> * @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org> * @author Icinga Development Team <info@icinga.org>
*/ */
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
use \Exception;
use \Icinga\Application\Config as IcingaConfig;
use \Icinga\Config\PreservingIniWriter;
use \Icinga\Web\Controller\BaseConfigController; use \Icinga\Web\Controller\BaseConfigController;
use \Icinga\Web\Widget\Tab; use \Icinga\Web\Widget\Tab;
use \Icinga\Application\Config as IcingaConfig;
use \Icinga\Web\Url; use \Icinga\Web\Url;
use \Icinga\Config\PreservingIniWriter;
use \Monitoring\Form\Config\ConfirmRemovalForm; use \Monitoring\Form\Config\ConfirmRemovalForm;
use \Monitoring\Form\Config\Backend\EditBackendForm; use \Monitoring\Form\Config\Backend\EditBackendForm;
@ -40,11 +42,8 @@ use \Monitoring\Form\Config\Backend\CreateBackendForm;
use \Monitoring\Form\Config\Instance\EditInstanceForm; use \Monitoring\Form\Config\Instance\EditInstanceForm;
use \Monitoring\Form\Config\Instance\CreateInstanceForm; use \Monitoring\Form\Config\Instance\CreateInstanceForm;
use \Exception;
/** /**
* Configuration controller for editing monitoring resources * Configuration controller for editing monitoring resources
*
*/ */
class Monitoring_ConfigController extends BaseConfigController { class Monitoring_ConfigController extends BaseConfigController {
@ -75,7 +74,6 @@ class Monitoring_ConfigController extends BaseConfigController {
/** /**
* Display a form to modify the backend identified by the 'backend' parameter of the request * Display a form to modify the backend identified by the 'backend' parameter of the request
*
*/ */
public function editbackendAction() public function editbackendAction()
{ {
@ -105,8 +103,7 @@ class Monitoring_ConfigController extends BaseConfigController {
} }
/** /**
* Display a form to create a new backend * Display a form to create a new backends
* s
*/ */
public function createbackendAction() public function createbackendAction()
{ {
@ -128,8 +125,7 @@ class Monitoring_ConfigController extends BaseConfigController {
} }
/** /**
* Display a confirmation form to remove the backend identified by the 'backend' parameter * Display a confirmation form to remove the backend identified by the 'backend' parameter
*
*/ */
public function removebackendAction() public function removebackendAction()
{ {
@ -160,7 +156,6 @@ class Monitoring_ConfigController extends BaseConfigController {
/** /**
* Display a form to remove the instance identified by the 'instance' parameter * Display a form to remove the instance identified by the 'instance' parameter
*
*/ */
public function removeinstanceAction() public function removeinstanceAction()
{ {
@ -218,7 +213,6 @@ class Monitoring_ConfigController extends BaseConfigController {
/** /**
* Display a form to create a new instance * Display a form to create a new instance
*
*/ */
public function createinstanceAction() public function createinstanceAction()
{ {
@ -240,7 +234,6 @@ class Monitoring_ConfigController extends BaseConfigController {
/** /**
* Display a form to remove the instance identified by the 'instance' parameter * Display a form to remove the instance identified by the 'instance' parameter
*
*/ */
private function writeConfiguration($config, $file) private function writeConfiguration($config, $file)
{ {
@ -263,9 +256,9 @@ class Monitoring_ConfigController extends BaseConfigController {
/** /**
* Return true if the backend exists in the current configuration * Return true if the backend exists in the current configuration
* *
* @param string $backend The name of the backend to check for existence * @param string $backend The name of the backend to check for existence
* *
* @return bool True if the backend name exists, otherwise false * @return bool True if the backend name exists, otherwise false
*/ */
private function isExistingBackend($backend) private function isExistingBackend($backend)
{ {
@ -276,9 +269,9 @@ class Monitoring_ConfigController extends BaseConfigController {
/** /**
* Return true if the instance exists in the current configuration * Return true if the instance exists in the current configuration
* *
* @param string $backend The name of the instance to check for existence * @param string $instance The name of the instance to check for existence
* *
* @return bool True if the instance name exists, otherwise false * @return bool True if the instance name exists, otherwise false
*/ */
private function isExistingInstance($instance) private function isExistingInstance($instance)
{ {

View File

@ -2,24 +2,24 @@
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
/** /**
* This file is part of Icinga 2 Web. * This file is part of Icinga 2 Web.
* *
* Icinga 2 Web - Head for multiple monitoring backends. * Icinga 2 Web - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team * Copyright (C) 2013 Icinga Development Team
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @copyright 2013 Icinga Development Team <info@icinga.org> * @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org> * @author Icinga Development Team <info@icinga.org>
@ -61,7 +61,7 @@ class CreateBackendForm extends EditBackendForm
/** /**
* Return the name of the backend that is to be created * Return the name of the backend that is to be created
* *
* @return string The name of the backend as entered in the form * @return string The name of the backend as entered in the form
*/ */
public function getBackendName() public function getBackendName()
{ {

View File

@ -2,24 +2,24 @@
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
/** /**
* This file is part of Icinga 2 Web. * This file is part of Icinga 2 Web.
* *
* Icinga 2 Web - Head for multiple monitoring backends. * Icinga 2 Web - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team * Copyright (C) 2013 Icinga Development Team
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @copyright 2013 Icinga Development Team <info@icinga.org> * @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org> * @author Icinga Development Team <info@icinga.org>
@ -28,6 +28,8 @@
namespace Monitoring\Form\Config\Backend; namespace Monitoring\Form\Config\Backend;
use \Zend_Config;
use \Icinga\Application\Config as IcingaConfig; use \Icinga\Application\Config as IcingaConfig;
use \Icinga\Application\Icinga; use \Icinga\Application\Icinga;
use \Icinga\Application\Logger; use \Icinga\Application\Logger;
@ -35,16 +37,14 @@ use \Icinga\Application\DbAdapterFactory;
use \Icinga\Web\Form; use \Icinga\Web\Form;
use \Icinga\Web\Form\Element\Note; use \Icinga\Web\Form\Element\Note;
use \Zend_Config;
/** /**
* Form for modifying a monitoring backend * Form for modifying a monitoring backend
*
*/ */
class EditBackendForm extends Form class EditBackendForm extends Form
{ {
/** /**
* Database resources to use instead of the one's from DBAdapterFactory (used for testing) * Database resources to use instead of the one's from DBAdapterFactory (used for testing)
* *
* @var array * @var array
*/ */
@ -130,7 +130,6 @@ class EditBackendForm extends Form
/** /**
* Add form elements used for setting IDO backend parameters * Add form elements used for setting IDO backend parameters
*
*/ */
private function addIdoBackendForm() private function addIdoBackendForm()
{ {
@ -149,7 +148,6 @@ class EditBackendForm extends Form
/** /**
* Add form elements used for setting status.dat backend parameters * Add form elements used for setting status.dat backend parameters
*
*/ */
private function addStatusDatForm() private function addStatusDatForm()
{ {
@ -176,8 +174,7 @@ class EditBackendForm extends Form
} }
/** /**
* Add form elements used for setting livstatus parameters * Add form elements used for setting Livestatus parameters
*
*/ */
private function addLivestatusForm() private function addLivestatusForm()
{ {
@ -195,7 +192,6 @@ class EditBackendForm extends Form
/** /**
* Add a checkbox to disable this backends * Add a checkbox to disable this backends
*
*/ */
private function addDisableButton() private function addDisableButton()
{ {
@ -212,7 +208,6 @@ class EditBackendForm extends Form
/** /**
* Add a select box for choosing the type to use for this backend * Add a select box for choosing the type to use for this backend
*
*/ */
private function addTypeSelectionBox() private function addTypeSelectionBox()
{ {
@ -271,7 +266,7 @@ class EditBackendForm extends Form
/** /**
* Return a configuration containing the backend settings entered in this form * Return a configuration containing the backend settings entered in this form
* *
* @return Zend_Config The updated configuration for this backend * @return Zend_Config The updated configuration for this backend
*/ */
public function getConfig() public function getConfig()
{ {

View File

@ -2,24 +2,24 @@
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
/** /**
* This file is part of Icinga 2 Web. * This file is part of Icinga 2 Web.
* *
* Icinga 2 Web - Head for multiple monitoring backends. * Icinga 2 Web - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team * Copyright (C) 2013 Icinga Development Team
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @copyright 2013 Icinga Development Team <info@icinga.org> * @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org> * @author Icinga Development Team <info@icinga.org>
@ -36,7 +36,6 @@ use Icinga\Web\Form;
*/ */
class ConfirmRemovalForm extends Form class ConfirmRemovalForm extends Form
{ {
/** /**
* The value of the target to remove * The value of the target to remove
* *
@ -54,8 +53,8 @@ class ConfirmRemovalForm extends Form
/** /**
* Set the remove target in this field to be a hidden field with $name and value $target * Set the remove target in this field to be a hidden field with $name and value $target
* *
* @param string $name The name to be set in the hidden field * @param string $name The name to be set in the hidden field
* @param string $target The value to be set in the hidden field * @param string $target The value to be set in the hidden field
*/ */
public function setRemoveTarget($name, $target) public function setRemoveTarget($name, $target)
{ {
@ -66,7 +65,7 @@ class ConfirmRemovalForm extends Form
/** /**
* Create the confirmation form * Create the confirmation form
* *
* @see Icinga\Web\Form * @see Form::create()
*/ */
public function create() public function create()
{ {

View File

@ -2,24 +2,24 @@
// {{{ICINGA_LICENSE_HEADER}}} // {{{ICINGA_LICENSE_HEADER}}}
/** /**
* This file is part of Icinga 2 Web. * This file is part of Icinga 2 Web.
* *
* Icinga 2 Web - Head for multiple monitoring backends. * Icinga 2 Web - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team * Copyright (C) 2013 Icinga Development Team
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @copyright 2013 Icinga Development Team <info@icinga.org> * @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 * @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org> * @author Icinga Development Team <info@icinga.org>
@ -35,7 +35,7 @@ use \Zend_Config;
/** /**
* Form for creating new instances * Form for creating new instances
* *
* @see EditInstanceFor, * @see EditInstanceForm
*/ */
class CreateInstanceForm extends EditInstanceForm class CreateInstanceForm extends EditInstanceForm
{ {
@ -62,7 +62,7 @@ class CreateInstanceForm extends EditInstanceForm
/** /**
* Return the name of the instance to be created * Return the name of the instance to be created
* *
* @return string The name of the instance as entered in the form * @return string The name of the instance as entered in the form
*/ */
public function getInstanceName() public function getInstanceName()
{ {

View File

@ -29,13 +29,12 @@
namespace Monitoring\Form\Config\Instance; namespace Monitoring\Form\Config\Instance;
use \Zend_Config;
use \Icinga\Web\Form; use \Icinga\Web\Form;
use \Icinga\Web\Form\Element\Note; use \Icinga\Web\Form\Element\Note;
use \Zend_Config;
/** /**
* Form for editing existing instances * Form for editing existing instances
*
*/ */
class EditInstanceForm extends Form class EditInstanceForm extends Form
{ {
@ -70,7 +69,6 @@ class EditInstanceForm extends Form
/** /**
* Add a form field for selecting the command pipe type (local or remote) * Add a form field for selecting the command pipe type (local or remote)
*
*/ */
private function addTypeSelection() private function addTypeSelection()
{ {
@ -90,7 +88,6 @@ class EditInstanceForm extends Form
/** /**
* Add form elements for remote instance * Add form elements for remote instance
*
*/ */
private function addRemoteInstanceForm() private function addRemoteInstanceForm()
{ {
@ -163,7 +160,7 @@ class EditInstanceForm extends Form
/** /**
* Return the configuration set by this form * Return the configuration set by this form
* *
* @return Zend_Config The configuration set in this form * @return Zend_Config The configuration set in this form
*/ */
public function getConfig() public function getConfig()
{ {

View File

@ -28,9 +28,9 @@
namespace Monitoring; namespace Monitoring;
use \Exception;
use \Icinga\Application\Config as IcingaConfig; use \Icinga\Application\Config as IcingaConfig;
use \Icinga\Authentication\Manager as AuthManager; use \Icinga\Authentication\Manager as AuthManager;
use \Exception;
use \Monitoring\Backend\AbstractBackend; use \Monitoring\Backend\AbstractBackend;
/** /**
@ -62,9 +62,9 @@ class Backend
/** /**
* Test if configuration key exist * Test if configuration key exist
* *
* @param string $name * @param string $name
* *
* @return bool * @return bool
*/ */
public static function exists($name) public static function exists($name)
{ {
@ -75,9 +75,9 @@ class Backend
/** /**
* Get the first configuration name of all backends * Get the first configuration name of all backends
* *
* @throws Exception * @return string
* *
* @return string * @throws Exception
*/ */
public static function getDefaultName() public static function getDefaultName()
{ {
@ -115,10 +115,11 @@ class Backend
/** /**
* Get a backend by name or a default one * Get a backend by name or a default one
* *
* @throws \Exception * @param string $name
* @param string $name
* *
* @return AbstractBackend * @return AbstractBackend
*
* @throws Exception
*/ */
public static function getBackend($name = null) public static function getBackend($name = null)
{ {
@ -148,9 +149,9 @@ class Backend
/** /**
* Get backend by name or by user configuration * Get backend by name or by user configuration
* *
* @param string $name * @param string $name
* *
* @return AbstractBackend * @return AbstractBackend
*/ */
public static function getInstance($name = null) public static function getInstance($name = null)
{ {