2018-04-04
This commit is contained in:
parent
a94f166337
commit
555d1ef858
2 changed files with 31 additions and 15 deletions
|
@ -104,9 +104,11 @@ class Profile extends Page
|
|||
}
|
||||
|
||||
if ($rules->useAvatar) {
|
||||
$ruleAvatar = "image|max:{$this->c->Files->maxImgSize('K')}";
|
||||
$ruleAvatar = "image|max:{$this->c->Files->maxImgSize('K')}";
|
||||
$ruleDelAvatar = $this->curUser->avatar ? 'checkbox' : 'absent';
|
||||
} else {
|
||||
$ruleAvatar = 'absent';
|
||||
$ruleAvatar = 'absent';
|
||||
$ruleDelAvatar = 'absent';
|
||||
}
|
||||
|
||||
if ($this->user->isAdmMod) {
|
||||
|
@ -137,6 +139,7 @@ class Profile extends Page
|
|||
'username' => $ruleUsername,
|
||||
'title' => $ruleTitle,
|
||||
'upload_avatar' => $ruleAvatar,
|
||||
'delete_avatar' => $ruleDelAvatar,
|
||||
'admin_note' => $ruleAdminNote,
|
||||
'realname' => 'string:trim|max:40|no_url',
|
||||
'gender' => 'required|integer|in:0,1,2',
|
||||
|
@ -148,6 +151,7 @@ class Profile extends Page
|
|||
'username' => 'Username',
|
||||
'title' => 'Title',
|
||||
'upload_avatar' => 'New avatar',
|
||||
'delete_avatar' => 'Delete avatar',
|
||||
'admin_note' => 'Admin note',
|
||||
'realname' => 'Realname',
|
||||
'gender' => 'Gender',
|
||||
|
@ -166,8 +170,11 @@ class Profile extends Page
|
|||
unset($data['token'], $data['upload_avatar']);
|
||||
|
||||
if ($valid) {
|
||||
if ($v->upload_avatar instanceof Image) {
|
||||
if ($v->delete_avatar || $v->upload_avatar instanceof Image) {
|
||||
$this->curUser->deleteAvatar();
|
||||
}
|
||||
|
||||
if ($v->upload_avatar instanceof Image) {
|
||||
$v->upload_avatar
|
||||
->rename(false)
|
||||
->rewrite(true)
|
||||
|
@ -342,6 +349,15 @@ class Profile extends Page
|
|||
$form['enctype'] = 'multipart/form-data';
|
||||
$form['hidden']['MAX_FILE_SIZE'] = $this->c->Files->maxImgSize();
|
||||
|
||||
if ($this->curUser->avatar) {
|
||||
$fields['delete_avatar'] = [
|
||||
'type' => 'checkbox',
|
||||
'label' => \ForkBB\__('Delete avatar'),
|
||||
'value' => '1',
|
||||
'checked' => false,
|
||||
];
|
||||
}
|
||||
|
||||
$fields['upload_avatar'] = [
|
||||
'id' => 'upload_avatar',
|
||||
'type' => 'file',
|
||||
|
@ -565,17 +581,6 @@ class Profile extends Page
|
|||
|
||||
// активность
|
||||
$fields = [];
|
||||
if ($rules->viewIP) {
|
||||
$fields['ip'] = [
|
||||
'id' => 'ip',
|
||||
'class' => 'pline',
|
||||
'type' => 'link',
|
||||
'caption' => 'IP',
|
||||
'value' => $this->curUser->registration_ip,
|
||||
'href' => $this->c->Router->link('', ['id' => $this->curUser->id]), // ????
|
||||
'title' => 'IP',
|
||||
];
|
||||
}
|
||||
$fields['registered'] = [
|
||||
'id' => 'registered',
|
||||
'class' => 'pline',
|
||||
|
@ -636,6 +641,17 @@ class Profile extends Page
|
|||
];
|
||||
}
|
||||
}
|
||||
if ($rules->viewIP) {
|
||||
$fields['ip'] = [
|
||||
'id' => 'ip',
|
||||
'class' => 'pline',
|
||||
'type' => 'link',
|
||||
'caption' => 'IP',
|
||||
'value' => $this->curUser->registration_ip,
|
||||
'href' => $this->c->Router->link('', ['id' => $this->curUser->id]), // ????
|
||||
'title' => 'IP',
|
||||
];
|
||||
}
|
||||
$form['sets'][] = [
|
||||
'id' => 'activity',
|
||||
'class' => 'data' . $clSuffix,
|
||||
|
|
|
@ -409,7 +409,7 @@ msgid "Configure "
|
|||
msgstr "Настроить"
|
||||
|
||||
msgid "Board configuration"
|
||||
msgstr "Настрйока форума"
|
||||
msgstr "Настройка форума"
|
||||
|
||||
msgid "Not uploaded"
|
||||
msgstr "Не загружена"
|
||||
|
|
Loading…
Reference in a new issue