Browse Source

2018-03-25

Visman 7 years ago
parent
commit
abe2ebb477

+ 2 - 0
app/Core/Func.php

@@ -2,6 +2,8 @@
 
 
 namespace ForkBB\Core;
 namespace ForkBB\Core;
 
 
+use ForkBB\Core\Container;
+
 class Func
 class Func
 {
 {
     /**
     /**

+ 10 - 4
app/Models/Pages/Profile.php

@@ -140,13 +140,19 @@ class Profile extends Page
                 ];
                 ];
             }
             }
             if ($isEdit) {
             if ($isEdit) {
+                $form['enctype'] = 'multipart/form-data';
+                $form['hidden']['MAX_FILE_SIZE'] = 999999999;
+
                 $fields['upload_avatar'] = [
                 $fields['upload_avatar'] = [
                     'id'        => 'upload_avatar',
                     'id'        => 'upload_avatar',
-                    'type'      => 'text',
-                    'maxlength' => 50,
+                    'type'      => 'file',
                     'caption'   => \ForkBB\__('New avatar'),
                     'caption'   => \ForkBB\__('New avatar'),
-                    'value'     => '',
-                    'info'      => \ForkBB\__('New avatar info', \ForkBB\num($this->c->config->o_avatars_width), \ForkBB\num($this->c->config->o_avatars_height), \ForkBB\num($this->c->config->o_avatars_size), \ForkBB\size($this->c->config->o_avatars_size)),
+                    'info'      => \ForkBB\__('New avatar info',
+                        \ForkBB\num($this->c->config->o_avatars_width),
+                        \ForkBB\num($this->c->config->o_avatars_height),
+                        \ForkBB\num($this->c->config->o_avatars_size),
+                        \ForkBB\size($this->c->config->o_avatars_size)
+                    ),
                 ];
                 ];
             }
             }
         }
         }

+ 9 - 9
app/Models/Rules/Profile.php

@@ -35,22 +35,22 @@ class Profile extends Rules
         return $this;
         return $this;
     }
     }
 
 
-    public function getrename()
+    protected function getrename()
     {
     {
         return $this->admin || ($this->moderator  && '1' == $this->user->g_mod_rename_users);
         return $this->admin || ($this->moderator  && '1' == $this->user->g_mod_rename_users);
     }
     }
 
 
-    public function getsetTitle()
+    protected function getsetTitle()
     {
     {
         return $this->admin || $this->moderator || '1' == $this->user->g_set_title;
         return $this->admin || $this->moderator || '1' == $this->user->g_set_title;
     }
     }
 
 
-    public function getviewOEmail()
+    protected function getviewOEmail()
     {
     {
         return $this->my || $this->user->isAdmMod;
         return $this->my || $this->user->isAdmMod;
     }
     }
 
 
-    public function getviewEmail() // ?????
+    protected function getviewEmail() // ?????
     {
     {
         return ! $this->my
         return ! $this->my
             && (($this->user->isAdmMod && 1 === $this->curUser->email_setting)
             && (($this->user->isAdmMod && 1 === $this->curUser->email_setting)
@@ -58,27 +58,27 @@ class Profile extends Rules
             );
             );
     }
     }
 
 
-    public function getviewLastVisit()
+    protected function getviewLastVisit()
     {
     {
         return $this->my || $this->user->isAdmMod;
         return $this->my || $this->user->isAdmMod;
     }
     }
 
 
-    public function getbanUser()
+    protected function getbanUser()
     {
     {
         return ! $this->my && ($this->admin || ($this->moderator && '1' == $this->user->g_mod_ban_users));
         return ! $this->my && ($this->admin || ($this->moderator && '1' == $this->user->g_mod_ban_users));
     }
     }
 
 
-    public function getdeleteUser()
+    protected function getdeleteUser()
     {
     {
         return ! $this->my && ($this->admin || $this->moderator); // ????
         return ! $this->my && ($this->admin || $this->moderator); // ????
     }
     }
 
 
-    public function getviewIP()
+    protected function getviewIP()
     {
     {
         return $this->user->isAdmin;
         return $this->user->isAdmin;
     }
     }
 
 
-    public function getuseAvatar()
+    protected function getuseAvatar()
     {
     {
         return '1' == $this->c->config->o_avatars;
         return '1' == $this->c->config->o_avatars;
     }
     }

+ 3 - 3
app/lang/English/profile_other.po

@@ -133,10 +133,10 @@ msgid "UTC+14:00"
 msgstr "(UTC+14:00) Line Islands"
 msgstr "(UTC+14:00) Line Islands"
 
 
 msgid "Display e-mail label"
 msgid "Display e-mail label"
-msgstr "Display email address to other users."
+msgstr "Display email address to other users"
 
 
 msgid "Hide allow form label"
 msgid "Hide allow form label"
-msgstr "Hide email address but allow form e-mail."
+msgstr "Hide email address but allow form e-mail"
 
 
 msgid "Hide both label"
 msgid "Hide both label"
-msgstr "Hide email address and disallow form email."
+msgstr "Hide email address and disallow form email"

+ 3 - 3
app/lang/Russian/profile_other.po

@@ -133,10 +133,10 @@ msgid "UTC+14:00"
 msgstr "(UTC+14:00) о-ва Лайн"
 msgstr "(UTC+14:00) о-ва Лайн"
 
 
 msgid "Display e-mail label"
 msgid "Display e-mail label"
-msgstr "Показывать email другим пользователя."
+msgstr "Показывать email другим пользователя"
 
 
 msgid "Hide allow form label"
 msgid "Hide allow form label"
-msgstr "Спрятать email, но разрешить отправку писем через специальную форму."
+msgstr "Спрятать email, но разрешить отправку писем через специальную форму"
 
 
 msgid "Hide both label"
 msgid "Hide both label"
-msgstr "Спрятать email и запретить отправку писем."
+msgstr "Спрятать email и запретить отправку писем"

+ 5 - 3
app/templates/layouts/form.forkbb.php

@@ -1,5 +1,5 @@
 @if ($form['action'])
 @if ($form['action'])
-        <form class="f-form" method="post" action="{!! $form['action'] !!}">
+        <form class="f-form" method="post" action="{!! $form['action'] !!}" @if ($form['enctype']) enctype="{{ $form['enctype'] }}" @endif>
     @if ($form['hidden'])
     @if ($form['hidden'])
         @foreach ($form['hidden'] as $key => $val)
         @foreach ($form['hidden'] as $key => $val)
           <input type="hidden" name="{{ $key }}" value="{{ $val }}">
           <input type="hidden" name="{{ $key }}" value="{{ $val }}">
@@ -100,12 +100,14 @@
                 <input @if ($cur['required']) required @endif @if ($cur['disabled']) disabled @endif @if ($cur['autofocus']) autofocus @endif class="f-ctrl" id="id-{{ $key }}" name="{{ $key }}" type="password" @if ($cur['maxlength']) maxlength="{{ $cur['maxlength'] }}" @endif @if ($cur['pattern']) pattern="{{ $cur['pattern'] }}" @endif @if (isset($cur['value'])) value="{{ $cur['value'] }}" @endif>
                 <input @if ($cur['required']) required @endif @if ($cur['disabled']) disabled @endif @if ($cur['autofocus']) autofocus @endif class="f-ctrl" id="id-{{ $key }}" name="{{ $key }}" type="password" @if ($cur['maxlength']) maxlength="{{ $cur['maxlength'] }}" @endif @if ($cur['pattern']) pattern="{{ $cur['pattern'] }}" @endif @if (isset($cur['value'])) value="{{ $cur['value'] }}" @endif>
                 @elseif ('btn' === $cur['type'])
                 @elseif ('btn' === $cur['type'])
                 <a class="f-btn @if ($cur['disabled']) f-disabled @endif" href="{!! $cur['link'] !!}" @if ($cur['disabled']) tabindex="-1" @endif>{{ $cur['value'] }}</a>
                 <a class="f-btn @if ($cur['disabled']) f-disabled @endif" href="{!! $cur['link'] !!}" @if ($cur['disabled']) tabindex="-1" @endif>{{ $cur['value'] }}</a>
-                @elseif ('yield' === $cur['type'])
-                {!! $this->block($cur['value']) !!}
                 @elseif ('str' === $cur['type'])
                 @elseif ('str' === $cur['type'])
                 <p class="f-str" id="id-{{ $key }}">{{ $cur['value'] }}</p>
                 <p class="f-str" id="id-{{ $key }}">{{ $cur['value'] }}</p>
                 @elseif ('link' === $cur['type'])
                 @elseif ('link' === $cur['type'])
                 <a class="f-link" id="id-{{ $key }}" href="{{ $cur['href'] or '' }}" title="{{ $cur['title'] or '' }}">{{ $cur['value'] or '' }}</a>
                 <a class="f-link" id="id-{{ $key }}" href="{{ $cur['href'] or '' }}" title="{{ $cur['title'] or '' }}">{{ $cur['value'] or '' }}</a>
+                @elseif ('yield' === $cur['type'])
+                {!! $this->block($cur['value']) !!}
+                @elseif ('file' === $cur['type'])
+                <input @if ($cur['required']) required @endif @if ($cur['disabled']) disabled @endif @if ($cur['autofocus']) autofocus @endif class="f-ctrl" id="id-{{ $key }}" name="{{ $key }}" type="file">
                 @endif
                 @endif
                 @if ($cur['info'])
                 @if ($cur['info'])
                 <p class="f-child4">{!! $cur['info'] !!}</p>
                 <p class="f-child4">{!! $cur['info'] !!}</p>