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
*
*/
public function authenticationAction()
{
@ -182,7 +181,6 @@ class ConfigController extends BaseConfigController
/**
* Action for creating a new authentication backend
*
*/
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
* handle ordering
*
* @param array $config The configuration changes
* @param array $config The configuration changes
*
* @return bool True when persisting succeeded, otherwise false
* @see writeConfigFile()
* @return bool True when persisting succeeded, otherwise false
*
* @see writeConfigFile()
*/
private function writeAuthenticationFile($config) {
$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 string $file The filename to write to (without .ini)
* @param Zend_Config_Writer $writer An optional writer to use for persisting changes
* @param array|Zend_Config $config The configuration to write
* @param string $file The filename to write to (without .ini)
* @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)
{

View File

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

View File

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

View File

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

View File

@ -2,24 +2,24 @@
// {{{ICINGA_LICENSE_HEADER}}}
/**
* This file is part of Icinga 2 Web.
*
*
* Icinga 2 Web - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
@ -28,15 +28,14 @@
namespace Icinga\Form\Config;
use \Zend_Config;
use \Icinga\Application\Config as IcingaConfig;
use \Icinga\Application\Icinga;
use \Icinga\Application\Logger;
use \Icinga\Application\DbAdapterFactory;
use \Icinga\Web\Form;
use \Icinga\Web\Form\Element\Note;
use \Icinga\Web\Form\Decorator\ConditionalHidden;
use \Zend_Config;
/**
* 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
* (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)
{
@ -93,9 +92,9 @@ class AuthenticationForm extends Form
*
* 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)
{
@ -103,10 +102,10 @@ class AuthenticationForm extends Form
'checkbox',
'backend_' . $name . '_remove',
array(
'name' => 'backend_' . $name . '_remove',
'label' => 'Remove this authentication provider',
'value' => $name,
'checked' => $this->isMarkedForDeletion($name)
'name' => 'backend_' . $name . '_remove',
'label' => 'Remove this authentication provider',
'value' => $name,
'checked' => $this->isMarkedForDeletion($name)
)
);
$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
* all elements to this form explicitly.
*
* @param string $name The name of the backend to add
* @param Zend_Config $backend The configuration of the backend
* @param string $name The name of the backend to add
* @param Zend_Config $backend The configuration of the backend
*/
private function addProviderForm($name, $backend)
{
@ -159,10 +158,10 @@ class AuthenticationForm extends Form
/**
* Add the buttons for modifying authentication priorities
*
* @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 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
*
* @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())
{
@ -204,24 +203,25 @@ class AuthenticationForm extends Form
/**
* 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
* @see Zend_Form::populate
* @return self
*
* @see Zend_Form::populate()
*/
public function populate(array $values)
{
$last_priority = $this->getValue('current_priority');
parent::populate($values);
$this->getElement('current_priority')->setValue($last_priority);
return $this;
}
/**
* 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
* the order they should be persisted
* @return array An array containing the identifiers (section names) of the authentication backend in
* the order they should be persisted
*/
private function getAuthenticationOrder()
{
@ -243,9 +243,9 @@ class AuthenticationForm extends Form
/**
* 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)
{

View File

@ -2,24 +2,24 @@
// {{{ICINGA_LICENSE_HEADER}}}
/**
* This file is part of Icinga 2 Web.
*
*
* Icinga 2 Web - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
@ -28,6 +28,10 @@
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\Icinga;
use \Icinga\Application\DbAdapterFactory;
@ -37,11 +41,6 @@ use \Icinga\Web\Form\Validator\TimeFormatValidator;
use \Icinga\Web\Form\Validator\DateFormatValidator;
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
*
@ -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 string
* @see IcingaConfig::configDir
* @return string
*
* @see IcingaConfig::configDir
*/
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
* (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)
{
@ -129,7 +129,7 @@ class GeneralForm extends 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)
{
@ -140,9 +140,8 @@ class GeneralForm extends Form
array(
'label' => 'Development Mode',
'required' => true,
'helptext' => 'Set true to show more detailed errors '
. 'and disable certain optimizations '
. 'in order to make debugging easier.',
'helptext' => 'Set true to show more detailed errors and disable certain optimizations in order to '
. 'make debugging easier.',
'tooltip' => 'More verbose output',
'value' => $env === 'development'
)
@ -155,7 +154,7 @@ class GeneralForm extends Form
*
* 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)
{
@ -182,7 +181,7 @@ class GeneralForm extends Form
/**
* 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)
{
@ -201,12 +200,12 @@ class GeneralForm extends Form
/**
* 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)
{
$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(
array(
@ -236,7 +235,7 @@ class GeneralForm extends Form
/**
* 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)
{

View File

@ -2,24 +2,24 @@
// {{{ICINGA_LICENSE_HEADER}}}
/**
* This file is part of Icinga 2 Web.
*
*
* Icinga 2 Web - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
@ -28,18 +28,16 @@
namespace Icinga\Form\Config;
use \Zend_Config;
use \Zend_Form_Element_Text;
use \Icinga\Application\Config as IcingaConfig;
use \Icinga\Application\Icinga;
use \Icinga\Web\Form;
use \Icinga\Web\Form\Element\Note;
use \Icinga\Web\Form\Validator\WritablePathValidator;
use \Icinga\Web\Form\Decorator\ConditionalHidden;
use \Zend_Config;
use \Zend_Form_Element_Text;
/**
* Form class for setting the application wide logging configuration
*
*/
class LoggingForm extends Form
{
@ -62,7 +60,7 @@ class LoggingForm extends Form
*
* 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)
{
@ -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()
*
* @param string $dir The new directory to use
* @param string $dir The new directory to use
*/
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
* 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)
{
@ -143,7 +141,7 @@ class LoggingForm extends Form
'name' => 'logging_app_target',
'label' => 'Application Log Path',
'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,
'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 Zend_Config The config defined in this form
* @return Zend_Config The config defined in this form
*/
public function getConfig()
{

View File

@ -28,6 +28,10 @@
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\Icinga;
use \Icinga\Application\DbAdapterFactory;
@ -36,14 +40,8 @@ use \Icinga\Web\Form;
use \Icinga\Web\Form\Validator\TimeFormatValidator;
use \Icinga\Web\Form\Validator\DateFormatValidator;
use \DateTimeZone;
use \Zend_Config;
use \Zend_Form_Element_Text;
use \Zend_Form_Element_Select;
/**
* General user preferences
*
*/
class GeneralForm extends Form
{
@ -100,7 +98,7 @@ class GeneralForm extends Form
* 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
*
* @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)
{
@ -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
*
* @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)
{
@ -205,8 +203,6 @@ class GeneralForm extends Form
}
$this->enableAutoSubmit(array('default_time_format', 'default_date_format'));
}
/**
@ -243,6 +239,5 @@ class GeneralForm extends Form
'app.dateFormat' => $values['date_format'],
'app.timeFormat' => $values['time_format']
);
}
}

View File

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

View File

@ -28,12 +28,14 @@
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
* The remote host must have KeyAuth enabled for this user
* 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
*/
class SecureShell implements Transport
{
@ -66,20 +68,27 @@ class SecureShell implements Transport
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->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)
{
@ -113,11 +122,11 @@ class SecureShell implements Transport
Logger::debug("Return code %s: %s ", $retCode, $output);
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)
. " (returncode $retCode)";
Logger::error($msg);
throw new \RuntimeException($msg);
throw new RuntimeException($msg);
}
}
}

View File

@ -28,23 +28,24 @@
namespace Icinga\Protocol\Commandpipe\Transport;
use \Zend_Config;
/**
* Interface for Transport classes handling the concrete access to the command pipe
*
*/
interface Transport
{
/**
* 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
*
* @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);
}

View File

@ -28,26 +28,22 @@
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\Application\Benchmark;
use \Icinga\Exception;
use \Icinga\Application\Config;
use \Icinga\Web\Notification;
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
*
* 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
{
@ -148,7 +144,7 @@ class ActionController extends ZfController
/**
* Return the tabs
*
* @return \Icinga\Widget\Web\Tabs
* @return Tabs
*/
public function getTabs()
{
@ -159,39 +155,15 @@ class ActionController extends ZfController
/**
* 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)
{
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()
{
$this->_request->setModuleName('default')
@ -202,8 +174,6 @@ class ActionController extends ZfController
/**
* Prepare action execution by testing for correct permissions and setting shortcuts
*
* @return void
*/
public function preDispatch()
{
@ -229,7 +199,7 @@ class ActionController extends ZfController
/**
* 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)
{

View File

@ -25,13 +25,13 @@
namespace Icinga\Web;
use \Icinga\Web\Form\Decorator\HelpText;
use \Zend_Controller_Request_Abstract;
use \Zend_Form;
use \Zend_Form_Element_Submit;
use \Zend_Form_Element_Reset;
use \Zend_View_Interface;
use \Zend_Form;
use \Icinga\Exception\ProgrammingError;
use \Icinga\Web\Form\Decorator\HelpText;
use \Icinga\Web\Form\InvalidCSRFTokenException;
/**
@ -41,6 +41,7 @@ abstract class Form extends Zend_Form
{
/**
* The form's request object
*
* @var Zend_Controller_Request_Abstract
*/
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
* 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
*
* @var bool
*/
protected $tokenDisabled = false;
/**
* Name of the CSRF token element (used to create non-colliding hashes)
*
* @var string
*/
private $tokenElementName = 'CSRFToken';
/**
* Flag to indicate that form is already build
*
* @var bool
*/
private $created = false;
/**
* Session id used for CSRF token generation
*
* @var string
*/
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
*
* @return string
*
* @see session_id()
* @see setSessionId()
*/
@ -111,7 +117,7 @@ abstract class Form extends Zend_Form
*
* This method should be used for testing purposes only
*
* @param string $sessionId
* @param string $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 string
* @return string
*/
public function getTokenElementName()
{
@ -132,6 +138,7 @@ abstract class Form extends Zend_Form
* Render the form to HTML
*
* @param Zend_View_Interface $view
*
* @return string
*/
public function render(Zend_View_Interface $view = null)
@ -156,7 +163,7 @@ abstract class Form extends Zend_Form
/**
* Setter for the request
*
* @param Zend_Controller_Request_Abstract $request
* @param 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
*
* @return Zend_Controller_Request_Abstract
* @return Zend_Controller_Request_Abstract
*/
public function getRequest()
{
@ -197,7 +204,7 @@ abstract class Form extends Zend_Form
if (!$this->getAction() && $this->getRequest()) {
$this->setAction($this->getRequest()->getRequestUri());
}
$this->enableAdditionalDecorators();
$this->addElementDecorators();
$this->created = true;
}
}
@ -205,7 +212,7 @@ abstract class Form extends Zend_Form
/**
* Setter for the cancel label
*
* @param string $cancelLabel
* @param string $cancelLabel
*/
public function setCancelLabel($cancelLabel)
{
@ -230,7 +237,7 @@ abstract class Form extends Zend_Form
/**
* Setter for the submit label
*
* @param string $submitLabel
* @param string $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
*
* @param array $triggerElements The element names which should auto-submit the form
* @throws ProgrammingError When an element is found which does not yet exist
* @param array $triggerElements The element names which should auto-submit the form
*
* @throws ProgrammingError When an element is found which does not yet exist
*/
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
* in the request is valid and gets repopulated in case its invalid.
*
* @return bool
* @return bool
*/
public function isSubmittedAndValid()
{
@ -309,13 +317,13 @@ abstract class Form extends Zend_Form
}
}
/**
* Disable CSRF counter measure and remove its field if already added
*
* This method should be used for testing purposes only
*
* @param bool $disabled
* @param bool $disabled
*
* @see tokenDisabled
*/
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
*
* @param array $checkData The POST data send by the user
* @throws InvalidCSRFTokenException When CSRF Validation fails
* @param array $checkData The POST data send by the user
*
* @throws InvalidCSRFTokenException When CSRF Validation fails
*/
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
*
* @param string $elementValue Value from the form element
* @param string $elementValue Value from the form element
*
* @return bool
*/
private function hasValidCsrfToken($elementValue)
@ -387,7 +397,14 @@ abstract class Form extends Zend_Form
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) {
$element->addDecorator(new HelpText());
@ -397,7 +414,7 @@ abstract class Form extends Zend_Form
/**
* Generate a new (seed, token) pair
*
* @return array
* @return array
*/
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 string
* @return string
*/
final public function generateCsrfTokenAsString()
{

View File

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

View File

@ -39,13 +39,9 @@ class HelpText extends Zend_Form_Decorator_Abstract
/**
* Add a helptext to an input field
*
* @access public
* @param string $content The help text
*
* @param string $name The element name.
* @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.
* @return string The generated tag
*/
public function render($content = '')
{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -29,13 +29,12 @@
namespace Monitoring\Form\Config\Instance;
use \Zend_Config;
use \Icinga\Web\Form;
use \Icinga\Web\Form\Element\Note;
use \Zend_Config;
/**
* Form for editing existing instances
*
*/
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)
*
*/
private function addTypeSelection()
{
@ -90,7 +88,6 @@ class EditInstanceForm extends Form
/**
* Add form elements for remote instance
*
*/
private function addRemoteInstanceForm()
{
@ -163,7 +160,7 @@ class EditInstanceForm extends 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()
{

View File

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