فهرست منبع

Change o_forum_subscriptions

Visman 3 سال پیش
والد
کامیت
a2f8b0c232

+ 1 - 1
app/Models/Forum/Forum.php

@@ -76,7 +76,7 @@ class Forum extends DataModel
      */
     protected function getcanSubscription(): bool
     {
-        return '1' == $this->c->config->o_forum_subscriptions
+        return 1 == $this->c->config->b_forum_subscriptions
             && $this->id > 0
             && ! $this->c->user->isGuest
             && ! $this->c->user->isUnverified;

+ 1 - 1
app/Models/Forum/LoadTree.php

@@ -63,7 +63,7 @@ class LoadTree extends Action
                     f.last_post, f.last_post_id, f.last_poster, f.last_topic
                 FROM ::forums AS f
                 WHERE id IN (?ai:forums)';
-        } elseif ('1' == $this->c->config->o_forum_subscriptions) {
+        } elseif (1 == $this->c->config->b_forum_subscriptions) {
             $query = 'SELECT f.id, f.forum_desc, f.num_topics, f.sort_by, f.num_posts,
                     f.last_post, f.last_post_id, f.last_poster, f.last_topic,
                     mof.mf_mark_all_read, s.user_id AS is_subscribed

+ 1 - 1
app/Models/Pages/Admin/Install.php

@@ -1236,7 +1236,7 @@ class Install extends Admin
             'i_avatars_size'          => 10240,
             'o_admin_email'           => $v->email,
             'o_webmaster_email'       => $v->email,
-            'o_forum_subscriptions'   => 1,
+            'b_forum_subscriptions'   => 1,
             'o_topic_subscriptions'   => 1,
             'i_email_max_recipients'  => 1,
             'o_smtp_host'             => NULL,

+ 3 - 3
app/Models/Pages/Admin/Options.php

@@ -68,7 +68,7 @@ class Options extends Admin
                     'i_avatars_size'          => 'required|integer|min:0|max:9999999',
                     'o_admin_email'           => 'required|string:trim|email',
                     'o_webmaster_email'       => 'required|string:trim|email',
-                    'o_forum_subscriptions'   => 'required|integer|in:0,1',
+                    'b_forum_subscriptions'   => 'required|integer|in:0,1',
                     'o_topic_subscriptions'   => 'required|integer|in:0,1',
                     'i_email_max_recipients'  => 'required|integer|min:1|max:99999',
                     'o_smtp_host'             => 'string:trim|max:255',
@@ -562,9 +562,9 @@ class Options extends Admin
                     'required'  => true,
                     'pattern'   => '.+@.+',
                 ],
-                'o_forum_subscriptions' => [
+                'b_forum_subscriptions' => [
                     'type'    => 'radio',
-                    'value'   => $config->o_forum_subscriptions,
+                    'value'   => $config->b_forum_subscriptions,
                     'values'  => $yn,
                     'caption' => 'Forum subscriptions label',
                     'help'    => 'Forum subscriptions help',

+ 18 - 16
app/Models/Pages/Admin/Update.php

@@ -500,22 +500,24 @@ class Update extends Admin
     {
         $config = $this->c->config;
 
-        $config->i_timeout_visit   = $config->o_timeout_visit ?? 3600;
-        $config->i_timeout_online  = $config->o_timeout_online ?? 900;
-        $config->i_redirect_delay  = $config->o_redirect_delay ?? 1;
-        $config->b_show_user_info  = '1' == $config->o_show_user_info ? 1 : 0;
-        $config->b_show_post_count = '1' == $config->o_show_post_count ? 1 : 0;
-        $config->b_smilies_sig     = '1' == $config->o_smilies_sig ? 1 : 0;
-        $config->b_smilies         = '1' == $config->o_smilies ? 1 : 0;
-        $config->b_make_links      = '1' == $config->o_make_links ? 1 : 0;
-        $config->b_quickpost       = '1' == $config->o_quickpost ? 1 : 0;
-        $config->b_users_online    = '1' == $config->o_users_online ? 1 : 0;
-        $config->b_censoring       = '1' == $config->o_censoring ? 1 : 0;
-        $config->b_show_dot        = '1' == $config->o_show_dot ? 1 : 0;
-        $config->b_topic_views     = '1' == $config->o_topic_views ? 1 : 0;
-        $config->b_regs_report     = '1' == $config->o_regs_report ? 1 : 0;
-        $config->b_avatars         = '1' == $config->o_avatars ? 1 : 0;
-
+        $config->i_timeout_visit       = $config->o_timeout_visit ?? 3600;
+        $config->i_timeout_online      = $config->o_timeout_online ?? 900;
+        $config->i_redirect_delay      = $config->o_redirect_delay ?? 1;
+        $config->b_show_user_info      = '1' == $config->o_show_user_info ? 1 : 0;
+        $config->b_show_post_count     = '1' == $config->o_show_post_count ? 1 : 0;
+        $config->b_smilies_sig         = '1' == $config->o_smilies_sig ? 1 : 0;
+        $config->b_smilies             = '1' == $config->o_smilies ? 1 : 0;
+        $config->b_make_links          = '1' == $config->o_make_links ? 1 : 0;
+        $config->b_quickpost           = '1' == $config->o_quickpost ? 1 : 0;
+        $config->b_users_online        = '1' == $config->o_users_online ? 1 : 0;
+        $config->b_censoring           = '1' == $config->o_censoring ? 1 : 0;
+        $config->b_show_dot            = '1' == $config->o_show_dot ? 1 : 0;
+        $config->b_topic_views         = '1' == $config->o_topic_views ? 1 : 0;
+        $config->b_regs_report         = '1' == $config->o_regs_report ? 1 : 0;
+        $config->b_avatars             = '1' == $config->o_avatars ? 1 : 0;
+        $config->b_forum_subscriptions = '1' == $config->o_forum_subscriptions ? 1 : 0;
+
+        unset($config->o_forum_subscriptions);
         unset($config->o_avatars);
         unset($config->o_regs_report);
         unset($config->o_topic_views);

+ 1 - 1
app/Models/Pages/Post.php

@@ -318,7 +318,7 @@ class Post extends Page
             $this->c->search->index($post);
 
             if ($createTopic) {
-                if ('1' == $this->c->config->o_forum_subscriptions) { // ????
+                if (1 == $this->c->config->b_forum_subscriptions) { // ????
                     $this->c->subscriptions->send($post, $topic);
                 }
             } else {

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

@@ -182,7 +182,7 @@ class Profile extends Rules
                 || $this->admin
             )
             && (
-                '1' == $this->c->config->o_forum_subscriptions
+                1 == $this->c->config->b_forum_subscriptions
                 || '1' == $this->c->config->o_topic_subscriptions
             );
     }

+ 1 - 1
app/Models/Subscription/Subscription.php

@@ -217,7 +217,7 @@ class Subscription extends Model
 
             if (self::FORUMS_DATA & $type) {
                 if (
-                    '1' != $this->c->config->o_forum_subscriptions
+                    1 != $this->c->config->b_forum_subscriptions
                     || $model->isGuest
                 ) {
                     $result[self::FORUMS_DATA] = null;