CS: Fix viloations for touched files in branch feature/backend-configuration-ui-3776
refs #3776
This commit is contained in:
parent
585f69fe8f
commit
edb06ea8ea
|
@ -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,7 +206,7 @@ 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
|
||||
|
@ -216,6 +214,7 @@ class ConfigController extends BaseConfigController
|
|||
* @param array $config The configuration changes
|
||||
*
|
||||
* @return bool True when persisting succeeded, otherwise false
|
||||
*
|
||||
* @see writeConfigFile()
|
||||
*/
|
||||
private function writeAuthenticationFile($config) {
|
||||
|
@ -229,7 +228,7 @@ 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)
|
||||
|
|
|
@ -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,21 +48,21 @@ 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
|
||||
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
|
@ -104,7 +100,8 @@ class DbBackendForm extends BaseBackendForm
|
|||
* Return the datatbase authentication backend configuration for this form
|
||||
*
|
||||
* @return array
|
||||
* @see BaseBackendForm::getConfig
|
||||
*
|
||||
* @see BaseBackendForm::getConfig()
|
||||
*/
|
||||
public function getConfig()
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
@ -139,7 +137,8 @@ class LdapBackendForm extends BaseBackendForm
|
|||
* Return the ldap authentication backend configuration for this form
|
||||
*
|
||||
* @return array
|
||||
* @see BaseBackendForm::getConfig
|
||||
*
|
||||
* @see BaseBackendForm::getConfig()
|
||||
*/
|
||||
public function getConfig()
|
||||
{
|
||||
|
|
|
@ -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.
|
||||
|
@ -206,15 +205,16 @@ class AuthenticationForm extends Form
|
|||
*
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
@ -94,6 +93,7 @@ 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
|
||||
*/
|
||||
public function getConfigDir()
|
||||
|
@ -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'
|
||||
)
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
@ -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']
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,18 +28,19 @@
|
|||
|
||||
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
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
@ -168,30 +164,6 @@ class ActionController extends ZfController
|
|||
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()
|
||||
{
|
||||
|
|
|
@ -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()
|
||||
*/
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -258,6 +265,7 @@ 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
|
||||
*/
|
||||
final public function enableAutoSubmit($triggerElements)
|
||||
|
@ -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
|
||||
*
|
||||
* @see tokenDisabled
|
||||
*/
|
||||
final public function setTokenDisabled($disabled = true)
|
||||
|
@ -348,6 +356,7 @@ 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
|
||||
*/
|
||||
final public function assertValidCsrfToken(array $checkData)
|
||||
|
@ -367,6 +376,7 @@ 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
|
||||
*
|
||||
* @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());
|
||||
|
|
|
@ -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 = '')
|
||||
{
|
||||
|
|
|
@ -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 = '')
|
||||
{
|
||||
|
|
|
@ -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,6 +57,7 @@ class DateFormatValidator extends Zend_Validate_Abstract
|
|||
* Error templates
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @see Zend_Validate_Abstract::$_messageTemplates
|
||||
*/
|
||||
// @codingStandardsIgnoreStart
|
||||
|
@ -72,7 +73,8 @@ class DateFormatValidator extends Zend_Validate_Abstract
|
|||
* @param null $context The form context (ignored)
|
||||
*
|
||||
* @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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
@ -71,7 +70,8 @@ class TimeFormatValidator extends Zend_Validate_Abstract
|
|||
* @param null $context The form context (ignored)
|
||||
*
|
||||
* @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)
|
||||
{
|
||||
|
|
|
@ -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,6 +39,7 @@ class WritablePathValidator extends Zend_Validate_Abstract
|
|||
* The messages to write on differen error states
|
||||
*
|
||||
* @var array
|
||||
*
|
||||
* @see Zend_Validate_Abstract::$_messageTemplates‚
|
||||
*/
|
||||
// @codingStandardsIgnoreStart
|
||||
|
@ -68,10 +68,11 @@ 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 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)
|
||||
{
|
||||
|
|
|
@ -27,11 +27,13 @@
|
|||
*/
|
||||
// {{{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()
|
||||
{
|
||||
|
@ -129,7 +126,6 @@ class Monitoring_ConfigController extends BaseConfigController {
|
|||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
|
@ -276,7 +269,7 @@ 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
|
||||
*/
|
||||
|
|
|
@ -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,11 +37,9 @@ 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
|
||||
{
|
||||
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -36,7 +36,6 @@ use Icinga\Web\Form;
|
|||
*/
|
||||
class ConfirmRemovalForm extends Form
|
||||
{
|
||||
|
||||
/**
|
||||
* The value of the target to remove
|
||||
*
|
||||
|
@ -66,7 +65,7 @@ class ConfirmRemovalForm extends Form
|
|||
/**
|
||||
* Create the confirmation form
|
||||
*
|
||||
* @see Icinga\Web\Form
|
||||
* @see Form::create()
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
|
|
|
@ -35,7 +35,7 @@ use \Zend_Config;
|
|||
/**
|
||||
* Form for creating new instances
|
||||
*
|
||||
* @see EditInstanceFor,
|
||||
* @see EditInstanceForm
|
||||
*/
|
||||
class CreateInstanceForm extends EditInstanceForm
|
||||
{
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
@ -75,9 +75,9 @@ class Backend
|
|||
/**
|
||||
* Get the first configuration name of all backends
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @return AbstractBackend
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function getBackend($name = null)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue