From ca23d65c41e10b5ea8d415470c781d3352a4aa0b Mon Sep 17 00:00:00 2001 From: Charl Joseph Mert Date: Wed, 27 Jan 2010 14:26:17 +0200 Subject: [PATCH] Brand server without requiring access to FS PT:1243391 --- plugins/ktcore/admin/manageBranding.php | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/plugins/ktcore/admin/manageBranding.php b/plugins/ktcore/admin/manageBranding.php index 8313f57..75ba5b7 100755 --- a/plugins/ktcore/admin/manageBranding.php +++ b/plugins/ktcore/admin/manageBranding.php @@ -96,10 +96,11 @@ class ManageBrandDispatcher extends KTAdminDispatcher { 'encoding' => 'multipart/form-data', 'context' => &$this, 'extraargs' => $this->meldPersistQuery("","",true), - 'description' => _kt('You can set the branding details.') + 'description' => _kt('You can set the branding details.') )); $oWF =& KTWidgetFactory::getSingleton(); + $oVF =& KTValidatorFactory::getSingleton(); $widgets = array(); $validators = array(); @@ -126,6 +127,13 @@ class ManageBrandDispatcher extends KTAdminDispatcher { 'value' => $logoUrl, 'description' => _kt("This is the website address you will be redirected to after clicking the logo. The url should include the protocol e.g. http://www.knowledgetree.com . If no protocol is given the url is treated as a relative link."), )); + + + // Adding the url widget + $validators[] = $oVF->get('ktcore.widgets.string', array( + 'test' => 'logo_url', + 'output' => 'logo_url', + )); $oForm->setWidgets($widgets); $oForm->setValidators($validators); @@ -428,9 +436,6 @@ class ManageBrandDispatcher extends KTAdminDispatcher { return $oForm; } - - - /* * Action responsible for setting the logo details @@ -443,12 +448,12 @@ class ManageBrandDispatcher extends KTAdminDispatcher { $config =& KTConfig::getSingleton(); $logoUrl = $_REQUEST['data']['logo_url']; $logoTitle = $_REQUEST['data']['logo_title']; + + $aOptions = array('redirect_to' => 'main'); - if(!preg_match('/([a-z])|([A-Z])|([0-9])/', $logoTitle)){ - $this->errorRedirectTo('main', _kt("You have entered an invalid character in the logo title. You may use only letters and numbers.")); + if ($logoTitle != '') { + $this->oValidator->validateIllegalCharacters($logoTitle, $aOptions); } - - $logoTitle = addslashes(htmlentities($logoTitle)); if ($config->set('ui/companyLogoUrl', $logoUrl) && $config->set('ui/companyLogoTitle', $logoTitle)) { $this->successRedirectTo('main', _kt('Logo fields have been successfully updated.')); @@ -458,8 +463,6 @@ class ManageBrandDispatcher extends KTAdminDispatcher { } - - /* * Action responsible for uploading the logo * -- libgit2 0.21.4