From 793a0a061fdcffc782803ba521f389b61cbc67b8 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Mon, 12 May 2014 15:40:59 +0200 Subject: [PATCH] Add validation for application name. refs #6129 --- application/forms/Config/LoggingForm.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/application/forms/Config/LoggingForm.php b/application/forms/Config/LoggingForm.php index eff629e09..3683c29b5 100644 --- a/application/forms/Config/LoggingForm.php +++ b/application/forms/Config/LoggingForm.php @@ -30,7 +30,7 @@ namespace Icinga\Form\Config; -use Zend_Config; +use \Zend_Config; use Icinga\Web\Form; use Icinga\Application\Icinga; use Icinga\Web\Form\Validator\WritablePathValidator; @@ -116,7 +116,19 @@ class LoggingForm extends Form 'required' => true, 'label' => t('Application Prefix'), 'helptext' => t('The name of the application by which to prefix syslog messages.'), - 'value' => $loggingConfig->get('application', 'icingaweb') + 'value' => $loggingConfig->get('application', 'icingaweb'), + 'validators' => array( + array( + 'Regex', + false, + array( + 'pattern' => '/^[^\W]+$/', + 'messages' => array( + 'regexNotMatch' => 'The application prefix cannot contain any whitespaces.' + ) + ) + ) + ) ) ); $this->addElement(