Parcourir la source

* Fix install + new start group for stop spam

Visman il y a 7 ans
Parent
commit
f6a69f2b41

+ 1 - 1
app/Core/Container.php

@@ -64,7 +64,7 @@ class Container
      */
     public function __get($id)
     {
-        if (isset($this->instances[$id])) {
+        if (isset($this->instances[$id]) || \array_key_exists($id, $this->instances)) { //????
             return $this->instances[$id];
         } elseif (\strpos($id, '.') !== false) {
             $tree = \explode('.', $id);

+ 12 - 11
app/Models/Pages/Install.php

@@ -84,7 +84,7 @@ class Install extends Page
         $this->c->Lang->load('install');
 
         // версия PHP
-        if (\version_compare(PHP_VERSION, self::PHP_MIN, '<')) {
+        if (\version_compare(\PHP_VERSION, self::PHP_MIN, '<')) {
             $this->fIswev = ['e', \ForkBB\__('You are running error', 'PHP', \PHP_VERSION, $this->c->FORK_REVISION, self::PHP_MIN)];
         }
 
@@ -422,7 +422,7 @@ class Install extends Page
     {
         $this->c->DB_USERNAME = $v->dbuser;
         $this->c->DB_PASSWORD = $v->dbpass;
-        $this->c->DB_PREFIX   = $v->dbprefix;
+        $this->c->DB_PREFIX   = \is_string($v->dbprefix) ? $v->dbprefix : '';
         $dbtype               = $v->dbtype;
         $dbname               = $v->dbname;
 
@@ -1023,20 +1023,21 @@ class Install extends Page
         $now = \time();
 
         $groups = [
-            // g_id,                 g_title,                      g_user_title,        g_moderator, g_mod_edit_users, g_mod_rename_users, g_mod_change_passwords, g_mod_ban_users, g_mod_promote_users, g_read_board, g_view_users, g_post_replies, g_post_topics, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_send_email, g_post_flood, g_search_flood, g_email_flood, g_report_flood
-            [$this->c->GROUP_ADMIN,  \ForkBB\__('Administrators'), \ForkBB\__('Administrator '), 0,           0,                0,                  0,                      0,               1,                   1,            1,            1,              1,             1,            1,              1,               1,           1,        1,              1,            0,            0,              0,             0],
-            [$this->c->GROUP_MOD,    \ForkBB\__('Moderators'),     \ForkBB\__('Moderator '),     1,           1,                1,                  1,                      1,               1,                   1,            1,            1,              1,             1,            1,              1,               1,           1,        1,              1,            0,            0,              0,             0],
-            [$this->c->GROUP_GUEST,  \ForkBB\__('Guests'),         NULL,                         0,           0,                0,                  0,                      0,               0,                   1,            1,            0,              0,             0,            0,              0,               0,           1,        1,              0,            120,          60,             0,             0],
-            [$this->c->GROUP_MEMBER, \ForkBB\__('Members'),        NULL,                         0,           0,                0,                  0,                      0,               0,                   1,            1,            1,              1,             1,            1,              1,               0,           1,        1,              1,            30,           30,             60,            60],
+            // g_id,                     g_title,                      g_user_title,        g_moderator, g_mod_edit_users, g_mod_rename_users, g_mod_change_passwords, g_mod_ban_users, g_mod_promote_users, g_read_board, g_view_users, g_post_replies, g_post_topics, g_edit_posts, g_delete_posts, g_delete_topics, g_post_links, g_set_title, g_search, g_search_users, g_send_email, g_post_flood, g_search_flood, g_email_flood, g_report_flood
+            [$this->c->GROUP_ADMIN,      \ForkBB\__('Administrators'), \ForkBB\__('Administrator '), 0,           0,                0,                  0,                      0,               1,                1,            1,            1,              1,             1,            1,              1,              1,             1,         1,        1,              1,            0,            0,              0,             0],
+            [$this->c->GROUP_MOD,        \ForkBB\__('Moderators'),     \ForkBB\__('Moderator '),     1,           1,                1,                  1,                      1,               1,                1,            1,            1,              1,             1,            1,              1,              1,             1,         1,        1,              1,            0,            0,              0,             0],
+            [$this->c->GROUP_GUEST,      \ForkBB\__('Guests'),         NULL,                         0,           0,                0,                  0,                      0,               0,                1,            1,            0,              0,             0,            0,              0,              0,             0,         1,        1,              0,            120,          60,             0,             0],
+            [$this->c->GROUP_MEMBER,     \ForkBB\__('Members'),        NULL,                         0,           0,                0,                  0,                      0,               0,                1,            1,            1,              1,             1,            1,              1,              1,             0,         1,        1,              1,            30,           30,             60,            60],
+            [$this->c->GROUP_NEW_MEMBER, \ForkBB\__('New members'),    \ForkBB\__('New member'),     0,           0,                0,                  0,                      0,               0,                1,            1,            1,              1,             1,            1,              1,              0,             0,         1,        1,              1,            60,           30,             120,           60],
         ];
         foreach ($groups as $group) { //???? $db_type != 'pgsql'
-            $this->c->DB->exec('INSERT INTO ::groups (g_id, g_title, g_user_title, g_moderator, g_mod_edit_users, g_mod_rename_users, g_mod_change_passwords, g_mod_ban_users, g_mod_promote_users, g_read_board, g_view_users, g_post_replies, g_post_topics, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_send_email, g_post_flood, g_search_flood, g_email_flood, g_report_flood) VALUES (?i, ?s, ?s, ?i, ?i, ?i, ?i, ?i, ?i, ?i, ?i, ?i, ?i, ?i, ?i, ?i, ?i, ?i, ?i, ?i, ?i, ?i, ?i, ?i)', $group) ;
+            $this->c->DB->exec('INSERT INTO ::groups (g_id, g_title, g_user_title, g_moderator, g_mod_edit_users, g_mod_rename_users, g_mod_change_passwords, g_mod_ban_users, g_mod_promote_users, g_read_board, g_view_users, g_post_replies, g_post_topics, g_edit_posts, g_delete_posts, g_delete_topics, g_post_links, g_set_title, g_search, g_search_users, g_send_email, g_post_flood, g_search_flood, g_email_flood, g_report_flood) VALUES (?i, ?s, ?s, ?i, ?i, ?i, ?i, ?i, ?i, ?i, ?i, ?i, ?i, ?i, ?i, ?i, ?i, ?i, ?i, ?i, ?i, ?i, ?i, ?i, ?i)', $group) ;
         }
         $this->c->DB->exec('UPDATE ::groups SET g_pm_limit=0 WHERE g_id=?i', [$this->c->GROUP_ADMIN]);
 
-        $ip = \filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP) ?: 'unknow';
+        $ip = \filter_var($_SERVER['REMOTE_ADDR'], \FILTER_VALIDATE_IP) ?: 'unknow';
         $this->c->DB->exec('INSERT INTO ::users (group_id, username, password, email) VALUES (?i, ?s, ?s, ?s)', [$this->c->GROUP_GUEST, \ForkBB\__('Guest '), \ForkBB\__('Guest '), \ForkBB\__('Guest ')]);
-        $this->c->DB->exec('INSERT INTO ::users (group_id, username, password, email, language, style, num_posts, last_post, registered, registration_ip, last_visit) VALUES (?i, ?s, ?s, ?s, ?s, ?s, ?i, ?i, ?i, ?s, ?i)', [$this->c->GROUP_ADMIN, $v->username, password_hash($v->password, PASSWORD_DEFAULT), $v->email, $v->defaultlang, $v->defaultstyle, 1, $now, $now, $ip, $now]);
+        $this->c->DB->exec('INSERT INTO ::users (group_id, username, password, email, language, style, num_posts, last_post, registered, registration_ip, last_visit) VALUES (?i, ?s, ?s, ?s, ?s, ?s, ?i, ?i, ?i, ?s, ?i)', [$this->c->GROUP_ADMIN, $v->username, password_hash($v->password, \PASSWORD_DEFAULT), $v->email, $v->defaultlang, $v->defaultstyle, 1, $now, $now, $ip, $now]);
 
         $pun_config = [
             'i_fork_revision'         => $this->c->FORK_REVISION,
@@ -1057,7 +1058,7 @@ class Install extends Page
             'o_make_links'            => 1,
             'o_default_lang'          => $v->defaultlang,
             'o_default_style'         => $v->defaultstyle,
-            'o_default_user_group'    => $this->c->GROUP_MEMBER,
+            'o_default_user_group'    => $this->c->GROUP_NEW_MEMBER,
             'o_topic_review'          => 15,
             'o_disp_topics_default'   => 30,
             'o_disp_posts_default'    => 25,

+ 3 - 0
app/config/install.php

@@ -11,6 +11,7 @@ return [
     'GROUP_MOD'        => 2,
     'GROUP_GUEST'      => 3,
     'GROUP_MEMBER'     => 4,
+    'GROUP_NEW_MEMBER' => 5,
     'EOL'              => PHP_EOL,
 
     'HMAC' => [
@@ -80,6 +81,8 @@ return [
 
         'config'     => '@ConfigModel:install',
         'users'      => \ForkBB\Models\User\Manager::class,
+
+        'VLemail'    => \ForkBB\Models\Validators\Email::class,
     ],
     'multiple'  => [
         'PrimaryController' => \ForkBB\Controllers\Install::class,

+ 6 - 0
app/lang/en/install.po

@@ -177,6 +177,12 @@ msgstr "Guest"
 msgid "Members"
 msgstr "Members"
 
+msgid "New members"
+msgstr "New members"
+
+msgid "New member"
+msgstr "New member"
+
 msgid "Announcement "
 msgstr "Enter your announcement here."
 

+ 6 - 0
app/lang/ru/install.po

@@ -174,6 +174,12 @@ msgstr "Гость"
 msgid "Members"
 msgstr "Пользователи"
 
+msgid "New members"
+msgstr "Новички"
+
+msgid "New member"
+msgstr "Новичок"
+
 msgid "Announcement "
 msgstr "Тут можно задать свое объявление"