mirror of
https://github.com/humhub/humhub.git
synced 2025-03-04 07:08:58 +01:00
Fixed: Improved user profile field encoding
This commit is contained in:
parent
6bca36b92d
commit
381aca4834
@ -260,7 +260,13 @@ class BaseType extends \yii\base\Model
|
||||
public function getUserValue($user, $raw = true)
|
||||
{
|
||||
$internalName = $this->profileField->internal_name;
|
||||
return $user->profile->$internalName;
|
||||
|
||||
if ($raw) {
|
||||
return $user->profile->$internalName;
|
||||
} else {
|
||||
return \yii\helpers\Html::encode($user->profile->$internalName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function getLabels()
|
||||
|
@ -113,8 +113,8 @@ class DateTime extends BaseType
|
||||
|
||||
if ($date == "" || $date == "0000-00-00 00:00:00")
|
||||
return "";
|
||||
|
||||
return $date;
|
||||
|
||||
return \yii\helpers\Html::encode($date);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -140,7 +140,7 @@ class Select extends BaseType
|
||||
if (!$raw) {
|
||||
$options = $this->getSelectItems();
|
||||
if (isset($options[$value])) {
|
||||
return Yii::t($this->profileField->getTranslationCategory(), $options[$value]);
|
||||
return \yii\helpers\Html::encode(Yii::t($this->profileField->getTranslationCategory(), $options[$value]));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -193,12 +193,12 @@ class Text extends BaseType
|
||||
$value = $user->profile->$internalName;
|
||||
|
||||
if (!$raw && $this->validator == self::VALIDATOR_EMAIL) {
|
||||
return \yii\helpers\Html::a($value, $value);
|
||||
return \yii\helpers\Html::a(\yii\helpers\Html::encode($value), $value);
|
||||
} elseif (!$raw && $this->validator == self::VALIDATOR_URL) {
|
||||
return \yii\helpers\Html::a($value, $value, array('target' => '_blank'));
|
||||
return \yii\helpers\Html::a(\yii\helpers\Html::encode($value), $value, array('target' => '_blank'));
|
||||
}
|
||||
|
||||
return $value;
|
||||
return \yii\helpers\Html::encode($value);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user