Visman před 3 roky
rodič
revize
e0d30948d0

+ 1 - 1
app/Core/Csrf.php

@@ -102,7 +102,7 @@ class Csrf
         $result      = false;
 
         if (
-            is_string($token)
+            \is_string($token)
             && \preg_match('%(e|s)(\d+)$%D', $token, $matches)
         ) {
             switch ($matches[1]) {

+ 1 - 1
app/Core/DB.php

@@ -83,7 +83,7 @@ class DB extends PDO
         $this->dbPrefix = $prefix;
 
         if (isset($options['initSQLCommands'])) {
-            $initSQLCommands = implode(';', $options['initSQLCommands']);
+            $initSQLCommands = \implode(';', $options['initSQLCommands']);
 
             unset($options['initSQLCommands']);
         } else {

+ 3 - 3
app/Core/DB/Mysql.php

@@ -521,7 +521,7 @@ class Mysql
      */
     public function statistics(): array
     {
-        $prefix  = str_replace('_', '\\_', $this->dbPrefix);
+        $prefix  = \str_replace('_', '\\_', $this->dbPrefix);
         $stmt    = $this->db->query("SHOW TABLE STATUS LIKE '{$prefix}%'");
         $records = $size = 0;
         $engine  = [];
@@ -553,7 +553,7 @@ class Mysql
 
         return [
             'db'      => 'MySQL (PDO) v.' . $this->db->getAttribute(PDO::ATTR_SERVER_VERSION),
-            'tables'  => implode(', ', $tmp),
+            'tables'  => \implode(', ', $tmp),
             'records' => $records,
             'size'    => $size,
             'server info' => $this->db->getAttribute(PDO::ATTR_SERVER_INFO),
@@ -566,7 +566,7 @@ class Mysql
     public function getMap(): array
     {
         $vars = [
-            ':tname' => str_replace('_', '\\_', $this->dbPrefix) . '%',
+            ':tname' => \str_replace('_', '\\_', $this->dbPrefix) . '%',
         ];
         $query = 'SELECT TABLE_NAME, COLUMN_NAME, DATA_TYPE
             FROM INFORMATION_SCHEMA.COLUMNS

+ 2 - 2
app/Core/DB/Pgsql.php

@@ -468,7 +468,7 @@ class Pgsql
 
         $vars = [
             ':schema' => 'public',
-            ':tname'  => str_replace('_', '\\_', $this->dbPrefix) . '%',
+            ':tname'  => \str_replace('_', '\\_', $this->dbPrefix) . '%',
         ];
         $query = 'SELECT c.relname, c.relpages, c.reltuples, c.relkind
             FROM pg_class AS c
@@ -520,7 +520,7 @@ class Pgsql
     {
         $vars = [
             ':schema' => 'public',
-            ':tname'  => str_replace('_', '\\_', $this->dbPrefix) . '%',
+            ':tname'  => \str_replace('_', '\\_', $this->dbPrefix) . '%',
         ];
         $query = 'SELECT table_name, column_name, data_type
             FROM information_schema.columns

+ 2 - 2
app/Models/BBCodeList/Structure.php

@@ -389,7 +389,7 @@ class Structure extends Model
                 if (
                     'No_attr' !== $name
                     && 'Def' !== $name
-                    && ! preg_match(self::ATTR_PATTERN, $name)
+                    && ! \preg_match(self::ATTR_PATTERN, $name)
                 ) {
                     return ['Attribute name %s is not valid', $name];
                 }
@@ -425,7 +425,7 @@ class Structure extends Model
                 'No_attr' === $name
                 || 'Def' === $name
                 || isset($this->attrs[$name])
-                || ! preg_match(self::ATTR_PATTERN, $name)
+                || ! \preg_match(self::ATTR_PATTERN, $name)
             ) {
                 return ['Attribute name %s is not valid', $name];
             }

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

@@ -373,7 +373,7 @@ class Forum extends DataModel
             throw new RuntimeException('The model does not have the required data');
         }
 
-        return (int) ceil(($this->num_topics ?: 1) / $this->c->user->disp_topics);
+        return (int) \ceil(($this->num_topics ?: 1) / $this->c->user->disp_topics);
     }
 
     /**

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

@@ -366,7 +366,7 @@ class Forums extends Admin
                     'token'                => 'token:' . $marker,
                     'forum_name'           => 'required|string:trim|max:80',
                     'forum_desc'           => 'string:trim|max:65000 bytes|html',
-                    'parent'               => 'required|integer|in:' . implode(',', $this->listOfIndexes),
+                    'parent'               => 'required|integer|in:' . \implode(',', $this->listOfIndexes),
                     'sort_by'              => 'required|integer|in:0,1,2',
                     'redirect_url'         => 'string:trim|max:255', //????
                     'no_sum_mess'          => 'required|integer|in:0,1',

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

@@ -1291,7 +1291,7 @@ class Install extends Admin
         $ip = \filter_var($_SERVER['REMOTE_ADDR'], \FILTER_VALIDATE_IP) ?: '0.0.0.0';
         $topicId = 1;
 
-        $this->c->DB->exec('INSERT INTO ::users (group_id, username, username_normal, password, email, email_normal, language, style, num_posts, last_post, registered, registration_ip, last_visit, signature, num_topics) VALUES (?i, ?s, ?s, ?s, ?s, ?s, ?s, ?s, 1, ?i, ?i, ?s, ?i, \'\', 1)', [FORK_GROUP_ADMIN, $v->username, $this->c->users->normUsername($v->username), password_hash($v->password, \PASSWORD_DEFAULT), $v->email, $this->c->NormEmail->normalize($v->email), $v->defaultlang, $v->defaultstyle, $now, $now, $ip, $now]);
+        $this->c->DB->exec('INSERT INTO ::users (group_id, username, username_normal, password, email, email_normal, language, style, num_posts, last_post, registered, registration_ip, last_visit, signature, num_topics) VALUES (?i, ?s, ?s, ?s, ?s, ?s, ?s, ?s, 1, ?i, ?i, ?s, ?i, \'\', 1)', [FORK_GROUP_ADMIN, $v->username, $this->c->users->normUsername($v->username), \password_hash($v->password, \PASSWORD_DEFAULT), $v->email, $this->c->NormEmail->normalize($v->email), $v->defaultlang, $v->defaultstyle, $now, $now, $ip, $now]);
 
         $adminId = (int) $this->c->DB->lastInsertId();
 

+ 2 - 2
app/functions.php

@@ -108,13 +108,13 @@ function dt(int $arg, bool $dateOnly = false, string $dateFormat = null, string
     if (null === $dateFormat) {
         $dateFormat = $c->DATE_FORMATS[$c->user->date_format];
     }
-    if(null === $timeFormat) {
+    if (null === $timeFormat) {
         $timeFormat = $c->TIME_FORMATS[$c->user->time_format];
     }
 
     $date = \gmdate($dateFormat, $arg);
 
-    if(! $noText) {
+    if (! $noText) {
         $now = \time() + $diff;
 
         if ($date == \gmdate($dateFormat, $now)) {