Visman před 7 roky
rodič
revize
a94f166337

+ 11 - 2
app/Core/Validator.php

@@ -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;
+            });
+        }
     }
 
     /**

+ 0 - 2
app/Models/DataModel.php

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

+ 8 - 8
app/Models/Pages/Profile.php

@@ -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',

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

@@ -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)
             );
     }