xssfilter=($this->xssfilter && Yii::app()->getConfig('filterxsshtml') && Yii::app()->session['USER_RIGHT_SUPERADMIN'] != 1); } protected function validateAttribute($object,$attribute) { if($this->xssfilter) { $object->$attribute=$this->xssFilter($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"); } } /** * Defines the customs validation rule xssfilter * * @param mixed $value */ public function xssFilter($value) { $filter = new CHtmlPurifier(); $filter->options = array( 'URI.AllowedSchemes'=>array( 'http' => true, 'https' => true, 'mailto' => true, 'ftp' => true, 'nntp' => true, 'news' => true, ) ); return $filter->purify($value); } }