Commit ca23d65c41e10b5ea8d415470c781d3352a4aa0b
1 parent
3df32e6a
Brand server without requiring access to FS
PT:1243391 Now using standard illegalchar validation against title field. Updated by: Charl Joseph Mert
Showing
1 changed file
with
13 additions
and
10 deletions
plugins/ktcore/admin/manageBranding.php
| @@ -96,10 +96,11 @@ class ManageBrandDispatcher extends KTAdminDispatcher { | @@ -96,10 +96,11 @@ class ManageBrandDispatcher extends KTAdminDispatcher { | ||
| 96 | 'encoding' => 'multipart/form-data', | 96 | 'encoding' => 'multipart/form-data', |
| 97 | 'context' => &$this, | 97 | 'context' => &$this, |
| 98 | 'extraargs' => $this->meldPersistQuery("","",true), | 98 | 'extraargs' => $this->meldPersistQuery("","",true), |
| 99 | - 'description' => _kt('You can set the branding details.') | 99 | + 'description' => _kt('You can set the branding details.') |
| 100 | )); | 100 | )); |
| 101 | 101 | ||
| 102 | $oWF =& KTWidgetFactory::getSingleton(); | 102 | $oWF =& KTWidgetFactory::getSingleton(); |
| 103 | + $oVF =& KTValidatorFactory::getSingleton(); | ||
| 103 | 104 | ||
| 104 | $widgets = array(); | 105 | $widgets = array(); |
| 105 | $validators = array(); | 106 | $validators = array(); |
| @@ -126,6 +127,13 @@ class ManageBrandDispatcher extends KTAdminDispatcher { | @@ -126,6 +127,13 @@ class ManageBrandDispatcher extends KTAdminDispatcher { | ||
| 126 | 'value' => $logoUrl, | 127 | 'value' => $logoUrl, |
| 127 | '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."), | 128 | '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."), |
| 128 | )); | 129 | )); |
| 130 | + | ||
| 131 | + | ||
| 132 | + // Adding the url widget | ||
| 133 | + $validators[] = $oVF->get('ktcore.widgets.string', array( | ||
| 134 | + 'test' => 'logo_url', | ||
| 135 | + 'output' => 'logo_url', | ||
| 136 | + )); | ||
| 129 | 137 | ||
| 130 | $oForm->setWidgets($widgets); | 138 | $oForm->setWidgets($widgets); |
| 131 | $oForm->setValidators($validators); | 139 | $oForm->setValidators($validators); |
| @@ -428,9 +436,6 @@ class ManageBrandDispatcher extends KTAdminDispatcher { | @@ -428,9 +436,6 @@ class ManageBrandDispatcher extends KTAdminDispatcher { | ||
| 428 | 436 | ||
| 429 | return $oForm; | 437 | return $oForm; |
| 430 | } | 438 | } |
| 431 | - | ||
| 432 | - | ||
| 433 | - | ||
| 434 | 439 | ||
| 435 | /* | 440 | /* |
| 436 | * Action responsible for setting the logo details | 441 | * Action responsible for setting the logo details |
| @@ -443,12 +448,12 @@ class ManageBrandDispatcher extends KTAdminDispatcher { | @@ -443,12 +448,12 @@ class ManageBrandDispatcher extends KTAdminDispatcher { | ||
| 443 | $config =& KTConfig::getSingleton(); | 448 | $config =& KTConfig::getSingleton(); |
| 444 | $logoUrl = $_REQUEST['data']['logo_url']; | 449 | $logoUrl = $_REQUEST['data']['logo_url']; |
| 445 | $logoTitle = $_REQUEST['data']['logo_title']; | 450 | $logoTitle = $_REQUEST['data']['logo_title']; |
| 451 | + | ||
| 452 | + $aOptions = array('redirect_to' => 'main'); | ||
| 446 | 453 | ||
| 447 | - if(!preg_match('/([a-z])|([A-Z])|([0-9])/', $logoTitle)){ | ||
| 448 | - $this->errorRedirectTo('main', _kt("You have entered an invalid character in the logo title. You may use only letters and numbers.")); | 454 | + if ($logoTitle != '') { |
| 455 | + $this->oValidator->validateIllegalCharacters($logoTitle, $aOptions); | ||
| 449 | } | 456 | } |
| 450 | - | ||
| 451 | - $logoTitle = addslashes(htmlentities($logoTitle)); | ||
| 452 | 457 | ||
| 453 | if ($config->set('ui/companyLogoUrl', $logoUrl) && $config->set('ui/companyLogoTitle', $logoTitle)) { | 458 | if ($config->set('ui/companyLogoUrl', $logoUrl) && $config->set('ui/companyLogoTitle', $logoTitle)) { |
| 454 | $this->successRedirectTo('main', _kt('Logo fields have been successfully updated.')); | 459 | $this->successRedirectTo('main', _kt('Logo fields have been successfully updated.')); |
| @@ -458,8 +463,6 @@ class ManageBrandDispatcher extends KTAdminDispatcher { | @@ -458,8 +463,6 @@ class ManageBrandDispatcher extends KTAdminDispatcher { | ||
| 458 | 463 | ||
| 459 | } | 464 | } |
| 460 | 465 | ||
| 461 | - | ||
| 462 | - | ||
| 463 | /* | 466 | /* |
| 464 | * Action responsible for uploading the logo | 467 | * Action responsible for uploading the logo |
| 465 | * | 468 | * |