Skip to content

Commit

Permalink
Fixed issue #7827: Ampersands in end url are encoded for non-admins
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed May 17, 2013
1 parent 22419ca commit 69baf09
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 24 deletions.
29 changes: 6 additions & 23 deletions application/controllers/admin/database.php
Expand Up @@ -910,29 +910,12 @@ function index($sa = null)
$url = Yii::app()->request->getPost('url_'.$langname);
if ($url == 'http://') {$url="";}

// Clean XSS attacks
if ($xssfilter)
{
$purifier = new CHtmlPurifier();
$purifier->options = array(
'HTML.Allowed' => 'p,a[href],b,i'
);
$short_title=$purifier->purify(Yii::app()->request->getPost('short_title_'.$langname));
$description=$purifier->purify(Yii::app()->request->getPost('description_'.$langname));
$welcome=$purifier->purify(Yii::app()->request->getPost('welcome_'.$langname));
$endtext=$purifier->purify(Yii::app()->request->getPost('endtext_'.$langname));
$sURLDescription=$purifier->purify(Yii::app()->request->getPost('urldescrip_'.$langname));
$sURL = html_entity_decode($purifier->purify(Yii::app()->request->getPost('url_'.$langname)),null,'UTF-8');
}
else
{
$short_title = html_entity_decode(Yii::app()->request->getPost('short_title_'.$langname), ENT_QUOTES, "UTF-8");
$description = html_entity_decode(Yii::app()->request->getPost('description_'.$langname), ENT_QUOTES, "UTF-8");
$welcome = html_entity_decode(Yii::app()->request->getPost('welcome_'.$langname), ENT_QUOTES, "UTF-8");
$endtext = html_entity_decode(Yii::app()->request->getPost('endtext_'.$langname), ENT_QUOTES, "UTF-8");
$sURLDescription = html_entity_decode(Yii::app()->request->getPost('urldescrip_'.$langname), ENT_QUOTES, "UTF-8");
$sURL = html_entity_decode(Yii::app()->request->getPost('url_'.$langname), ENT_QUOTES, "UTF-8");
}
$short_title = html_entity_decode(Yii::app()->request->getPost('short_title_'.$langname), ENT_QUOTES, "UTF-8");
$description = html_entity_decode(Yii::app()->request->getPost('description_'.$langname), ENT_QUOTES, "UTF-8");
$welcome = html_entity_decode(Yii::app()->request->getPost('welcome_'.$langname), ENT_QUOTES, "UTF-8");
$endtext = html_entity_decode(Yii::app()->request->getPost('endtext_'.$langname), ENT_QUOTES, "UTF-8");
$sURLDescription = html_entity_decode(Yii::app()->request->getPost('urldescrip_'.$langname), ENT_QUOTES, "UTF-8");
$sURL = html_entity_decode(Yii::app()->request->getPost('url_'.$langname), ENT_QUOTES, "UTF-8");

// Fix bug with FCKEditor saving strange BR types
$short_title = Yii::app()->request->getPost('short_title_'.$langname);
Expand Down
4 changes: 3 additions & 1 deletion application/core/LSYii_Validators.php
Expand Up @@ -39,6 +39,7 @@ protected function validateAttribute($object,$attribute)
if($this->isUrl)
{
if ($object->$attribute== 'http://' || $object->$attribute=='https://') {$object->$attribute="";}
$object->$attribute=html_entity_decode($object->$attribute, ENT_QUOTES, "UTF-8");
}
}

Expand All @@ -53,7 +54,8 @@ public function xssFilter($value)
$filter->options = array('URI.AllowedSchemes'=>array(
'http' => true,
'https' => true,
));
),
'HTML.Allowed' => 'p,a[href],b,i');
return $filter->purify($value);
}
}

0 comments on commit 69baf09

Please sign in to comment.