2018-04-04

This commit is contained in:
Visman 2018-04-04 14:37:21 +07:00
parent e3565df9d2
commit a94f166337
4 changed files with 20 additions and 13 deletions

View file

@ -408,16 +408,25 @@ class Validator
* Возвращает проверенные данные
* Поля с ошибками содержат значения по умолчанию или значения с ошибками
*
* @param bool $all
*
* @throws RuntimeException
*
* @return array
*/
public function getData()
public function getData($all = false)
{
if (empty($this->status)) {
throw new RuntimeException('Data not found');
}
return $this->result;
if ($all) {
return $this->result;
} else {
return \array_filter($this->result, function ($value) {
return null !== $value;
});
}
}
/**

View file

@ -45,8 +45,6 @@ class DataModel extends Model
$this->__set($name, $value);
if (! $setFlags) {
// $this->modified[$name] = true;
// } else {
unset($this->modified[$name]);
}
}

View file

@ -466,7 +466,7 @@ class Profile extends Page
$fields['open-email'] = [
'id' => 'open-email',
'class' => 'pline',
'type' => 'link',
'type' => 2 === $this->curUser->email_setting ? 'str' : 'link',
'caption' => \ForkBB\__('Email info'),
'value' => \ForkBB\cens($this->curUser->email),
'href' => 'mailto:' . $this->curUser->email,
@ -565,13 +565,6 @@ class Profile extends Page
// активность
$fields = [];
$fields['registered'] = [
'id' => 'registered',
'class' => 'pline',
'type' => 'str',
'value' => \ForkBB\dt($this->curUser->registered, true),
'caption' => \ForkBB\__('Registered info'),
];
if ($rules->viewIP) {
$fields['ip'] = [
'id' => 'ip',
@ -583,6 +576,13 @@ class Profile extends Page
'title' => 'IP',
];
}
$fields['registered'] = [
'id' => 'registered',
'class' => 'pline',
'type' => 'str',
'value' => \ForkBB\dt($this->curUser->registered, true),
'caption' => \ForkBB\__('Registered info'),
];
if ($rules->viewLastVisit) {
$fields['lastvisit'] = [
'id' => 'lastvisit',

View file

@ -54,7 +54,7 @@ class Profile extends Rules
{
return ! $this->my
&& (($this->user->isAdmMod && 1 === $this->curUser->email_setting)
|| (! $this->user->isGuest && '1' == $this->user->g_send_email)
|| (! $this->user->isGuest && ! $this->user->isAdmMod && '1' == $this->user->g_send_email)
);
}