Completed
Pull Request — master (#616)
by Richard
13:56
created
xoops_lib/Xoops/Core/Lists/HtmlFile.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,8 +37,8 @@
 block discarded – undo
37 37
         if (is_dir($path) && $handle = opendir($path)) {
38 38
             while (false !== ($file = readdir($handle))) {
39 39
                 if ((preg_match('/\.(htm|html|xhtml)$/i', $file) && !is_dir($file))) {
40
-                    $file = $prefix . $file;
41
-                    $fileList[$file] = $prefix . $file;
40
+                    $file = $prefix.$file;
41
+                    $fileList[$file] = $prefix.$file;
42 42
                 }
43 43
             }
44 44
             closedir($handle);
Please login to merge, or discard this patch.
xoops_lib/Xoops/Core/Lists/Directory.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,15 +34,15 @@
 block discarded – undo
34 34
      */
35 35
     public static function getList($path = '', $ignored = [])
36 36
     {
37
-        $ignored = (array) $ignored;
37
+        $ignored = (array)$ignored;
38 38
         $list = array();
39
-        $path = rtrim($path, '/') . '/';
39
+        $path = rtrim($path, '/').'/';
40 40
         if (is_dir($path) && $handle = opendir($path)) {
41 41
             while ($file = readdir($handle)) {
42 42
                 if (substr($file, 0, 1) === '.' || in_array(strtolower($file), $ignored)) {
43 43
                     continue;
44 44
                 }
45
-                if (is_dir($path . $file)) {
45
+                if (is_dir($path.$file)) {
46 46
                     $list[$file] = $file;
47 47
                 }
48 48
             }
Please login to merge, or discard this patch.
xoops_lib/Xoops/Core/Lists/ImageFile.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
         if (is_dir($path) && $handle = opendir($path)) {
38 38
             while (false !== ($file = readdir($handle))) {
39 39
                 if (preg_match('/\.(gif|jpg|jpeg|png|swf)$/i', $file)) {
40
-                    $file = $prefix . $file;
40
+                    $file = $prefix.$file;
41 41
                     $fileList[$file] = $file;
42 42
                 }
43 43
             }
Please login to merge, or discard this patch.
xoops_lib/Xoops/Core/Lists/Theme.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
      */
31 31
     public static function getList()
32 32
     {
33
-        $fileList = Directory::getList(\XoopsBaseConfig::get('themes-path') . '/');
33
+        $fileList = Directory::getList(\XoopsBaseConfig::get('themes-path').'/');
34 34
 
35 35
         return $fileList;
36 36
     }
Please login to merge, or discard this patch.
xoops_lib/Xoops/Core/Lists/SubjectIcon.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
     {
37 37
         $xoops = \Xoops::getInstance();
38 38
         $subDirectory = trim($subDirectory, '/');
39
-        $path = 'images/subject/' . $subDirectory;
40
-        $subjects = ImageFile::getList($xoops->path($path), $subDirectory . '/');
39
+        $path = 'images/subject/'.$subDirectory;
40
+        $subjects = ImageFile::getList($xoops->path($path), $subDirectory.'/');
41 41
 
42 42
         return $subjects;
43 43
     }
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         foreach (array_keys($subjects) as $name) {
58 58
             $element->addOption(
59 59
                 $name,
60
-                '<img src="' . $xoops->url('images/subject/') . $name . '" alt="' . $name . '" />'
60
+                '<img src="'.$xoops->url('images/subject/').$name.'" alt="'.$name.'" />'
61 61
             );
62 62
         }
63 63
     }
Please login to merge, or discard this patch.
xoops_lib/Xoops/Core/Lists/TimeZone.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         //$xoops->cache()->delete($key);
40 40
         $timeZones = $xoops->cache()->cacheRead(
41 41
             $key,
42
-            function () {
42
+            function() {
43 43
                 $timeZones = array();
44 44
                 $territories = Territory::getContinentsAndCountries();
45 45
                 $maxLen = 0;
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
                             $maxLen = max(strlen($zone), $maxLen);
53 53
                             $name = Calendar::getTimezoneExemplarCity($zone);
54 54
                             if (!isset($timeZones[$zone]) && !empty($name)) {
55
-                                $timeZones[$zone] = $cName['name'] . '/' . $name;
55
+                                $timeZones[$zone] = $cName['name'].'/'.$name;
56 56
                             }
57 57
                         }
58 58
                     }
Please login to merge, or discard this patch.
xoops_lib/Xoops/Core/Security.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -60,13 +60,13 @@  discard block
 block discarded – undo
60 60
         $timeout = ($timeout <= 0) ? 300 : $timeout;
61 61
         $token_id = Random::generateOneTimeToken();
62 62
         // save token data on the server
63
-        if (!isset($_SESSION[$name . '_SESSION'])) {
64
-            $_SESSION[$name . '_SESSION'] = array();
63
+        if (!isset($_SESSION[$name.'_SESSION'])) {
64
+            $_SESSION[$name.'_SESSION'] = array();
65 65
         }
66 66
         $token_data = array(
67 67
             'id' => $token_id, 'expire' => time() + (int)($timeout)
68 68
         );
69
-        array_push($_SESSION[$name . '_SESSION'], $token_data);
69
+        array_push($_SESSION[$name.'_SESSION'], $token_data);
70 70
         return $token_id;
71 71
     }
72 72
 
@@ -85,13 +85,13 @@  discard block
 block discarded – undo
85 85
         $log = array();
86 86
         $token = ($token !== false)
87 87
             ? $token
88
-            : (isset($_REQUEST[$name . '_REQUEST']) ? $_REQUEST[$name . '_REQUEST'] : '');
89
-        if (empty($token) || empty($_SESSION[$name . '_SESSION'])) {
88
+            : (isset($_REQUEST[$name.'_REQUEST']) ? $_REQUEST[$name.'_REQUEST'] : '');
89
+        if (empty($token) || empty($_SESSION[$name.'_SESSION'])) {
90 90
             $str = 'No valid token found in request/session';
91 91
             $this->setErrors($str);
92 92
             $log[] = array('Token Validation', $str);
93 93
         } else {
94
-            $token_data =& $_SESSION[$name . '_SESSION'];
94
+            $token_data = & $_SESSION[$name.'_SESSION'];
95 95
             if (is_array($token_data)) {
96 96
                 foreach (array_keys($token_data) as $i) {
97 97
                     if ($token === $token_data[$i]['id']) {
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
      */
129 129
     public function clearTokens($name = 'XOOPS_TOKEN')
130 130
     {
131
-        $_SESSION[$name . '_SESSION'] = array();
131
+        $_SESSION[$name.'_SESSION'] = array();
132 132
     }
133 133
 
134 134
     /**
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
      */
153 153
     public function garbageCollection($name = 'XOOPS_TOKEN')
154 154
     {
155
-        $sessionName = $name . '_SESSION';
155
+        $sessionName = $name.'_SESSION';
156 156
         if (!empty($_SESSION[$sessionName]) && is_array($_SESSION[$sessionName])) {
157 157
             $_SESSION[$sessionName] = array_filter($_SESSION[$sessionName], array($this, 'filterToken'));
158 158
         }
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
             && $_SERVER['REMOTE_ADDR'] != ''
195 195
         ) {
196 196
             foreach ($xoops->getConfig('bad_ips') as $bi) {
197
-                if (!empty($bi) && preg_match('/' . $bi . '/', $_SERVER['REMOTE_ADDR'])) {
197
+                if (!empty($bi) && preg_match('/'.$bi.'/', $_SERVER['REMOTE_ADDR'])) {
198 198
                     exit();
199 199
                 }
200 200
             }
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
         } else {
242 242
             $ret = '';
243 243
             if (is_array($this->errors)) {
244
-                $ret = implode('<br />', $this->errors) . '<br />';
244
+                $ret = implode('<br />', $this->errors).'<br />';
245 245
             }
246 246
             return $ret;
247 247
         }
Please login to merge, or discard this patch.
xoops_lib/Xoops/Core/Logger.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -468,7 +468,7 @@
 block discarded – undo
468 468
      * @return void
469 469
      *
470 470
      * @deprecated
471
-    */
471
+     */
472 472
     public function __call($method, $args)
473 473
     {
474 474
         $this->deprecatedMessage();
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
             // if an error occurs before a locale is established,
102 102
             // we still need messages, so check and deal with it
103 103
 
104
-            $msg = ': ' . sprintf(
104
+            $msg = ': '.sprintf(
105 105
                     (class_exists('\XoopsLocale', false) ? \XoopsLocale::EF_LOGGER_FILELINE : "%s in file %s line %s"),
106 106
                     $this->sanitizePath($errorString),
107 107
                     $this->sanitizePath($errorFile),
@@ -110,23 +110,23 @@  discard block
 block discarded – undo
110 110
 
111 111
             switch ($errorNumber) {
112 112
                 case E_USER_NOTICE:
113
-                    $msg = (class_exists('\XoopsLocale', false) ? \XoopsLocale::E_LOGGER_ERROR : '*Error:') . $msg;
113
+                    $msg = (class_exists('\XoopsLocale', false) ? \XoopsLocale::E_LOGGER_ERROR : '*Error:').$msg;
114 114
                     $this->log(LogLevel::NOTICE, $msg);
115 115
                     break;
116 116
                 case E_NOTICE:
117
-                    $msg = (class_exists('\XoopsLocale', false) ? \XoopsLocale::E_LOGGER_NOTICE : '*Notice:') . $msg;
117
+                    $msg = (class_exists('\XoopsLocale', false) ? \XoopsLocale::E_LOGGER_NOTICE : '*Notice:').$msg;
118 118
                     $this->log(LogLevel::NOTICE, $msg);
119 119
                     break;
120 120
                 case E_WARNING:
121
-                    $msg = (class_exists('\XoopsLocale', false) ? \XoopsLocale::E_LOGGER_WARNING : '*Warning:') . $msg;
121
+                    $msg = (class_exists('\XoopsLocale', false) ? \XoopsLocale::E_LOGGER_WARNING : '*Warning:').$msg;
122 122
                     $this->log(LogLevel::WARNING, $msg);
123 123
                     break;
124 124
                 case E_STRICT:
125
-                    $msg = (class_exists('\XoopsLocale', false) ? \XoopsLocale::E_LOGGER_STRICT : '*Strict:') . $msg;
125
+                    $msg = (class_exists('\XoopsLocale', false) ? \XoopsLocale::E_LOGGER_STRICT : '*Strict:').$msg;
126 126
                     $this->log(LogLevel::WARNING, $msg);
127 127
                     break;
128 128
                 case E_USER_ERROR:
129
-                    $msg = (class_exists('\XoopsLocale', false) ? \XoopsLocale::E_LOGGER_ERROR : '*Error:') . $msg;
129
+                    $msg = (class_exists('\XoopsLocale', false) ? \XoopsLocale::E_LOGGER_ERROR : '*Error:').$msg;
130 130
                     @$this->log(LogLevel::CRITICAL, $msg);
131 131
                     break;
132 132
                 case E_USER_DEPRECATED:
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
                     \Xoops::getInstance()->events()->triggerEvent('core.deprecated', array($msg));
135 135
                     break;
136 136
                 default:
137
-                    $msg = $this->getReadableErrorType($errorNumber) . $msg;
137
+                    $msg = $this->getReadableErrorType($errorNumber).$msg;
138 138
                     $this->log(LogLevel::ERROR, $msg);
139 139
                     break;
140 140
             }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
                         }
158 158
                     }
159 159
                 } else {
160
-                    echo "<div style='color:#f0f0f0;background-color:#f0f0f0'>" . _XOOPS_FATAL_BACKTRACE . ":<br />";
160
+                    echo "<div style='color:#f0f0f0;background-color:#f0f0f0'>"._XOOPS_FATAL_BACKTRACE.":<br />";
161 161
                     foreach ($trace as $step) {
162 162
                         if (isset($step['file'])) {
163 163
                             printf("%s (%d)\n<br />", $this->sanitizePath($step['file']), $step['line']);
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
      */
240 240
     private function reportFatalError($msg)
241 241
     {
242
-        $msg=$this->sanitizePath($msg);
242
+        $msg = $this->sanitizePath($msg);
243 243
         if ('cli' === php_sapi_name()) {
244 244
             fprintf(STDERR, "\nError : %s\n", $msg);
245 245
         } else {
@@ -262,18 +262,18 @@  discard block
 block discarded – undo
262 262
     public function sanitizePath($message)
263 263
     {
264 264
         $cleaners = [
265
-            ['\\', '/',],
266
-            [\XoopsBaseConfig::get('var-path'), 'VAR',],
267
-            [str_replace('\\', '/', realpath(\XoopsBaseConfig::get('var-path'))), 'VAR',],
268
-            [\XoopsBaseConfig::get('lib-path'), 'LIB',],
269
-            [str_replace('\\', '/', realpath(\XoopsBaseConfig::get('lib-path'))), 'LIB',],
270
-            [\XoopsBaseConfig::get('root-path'), 'ROOT',],
271
-            [str_replace('\\', '/', realpath(\XoopsBaseConfig::get('root-path'))), 'ROOT',],
272
-            [\XoopsBaseConfig::get('db-name') . '.', '',],
273
-            [\XoopsBaseConfig::get('db-name'), '',],
274
-            [\XoopsBaseConfig::get('db-prefix') . '_', '',],
275
-            [\XoopsBaseConfig::get('db-user'), '***',],
276
-            [\XoopsBaseConfig::get('db-pass'), '***',],
265
+            ['\\', '/', ],
266
+            [\XoopsBaseConfig::get('var-path'), 'VAR', ],
267
+            [str_replace('\\', '/', realpath(\XoopsBaseConfig::get('var-path'))), 'VAR', ],
268
+            [\XoopsBaseConfig::get('lib-path'), 'LIB', ],
269
+            [str_replace('\\', '/', realpath(\XoopsBaseConfig::get('lib-path'))), 'LIB', ],
270
+            [\XoopsBaseConfig::get('root-path'), 'ROOT', ],
271
+            [str_replace('\\', '/', realpath(\XoopsBaseConfig::get('root-path'))), 'ROOT', ],
272
+            [\XoopsBaseConfig::get('db-name').'.', '', ],
273
+            [\XoopsBaseConfig::get('db-name'), '', ],
274
+            [\XoopsBaseConfig::get('db-prefix').'_', '', ],
275
+            [\XoopsBaseConfig::get('db-user'), '***', ],
276
+            [\XoopsBaseConfig::get('db-pass'), '***', ],
277 277
         ];
278 278
         $stringsToClean = array_column($cleaners, 0);
279 279
         $replacementStings = array_column($cleaners, 1);
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
     {
479 479
         $this->deprecatedMessage();
480 480
         // legacy compatibility: turn off logger display for $xoopsLogger->activated = false; usage
481
-        if ($var==='activated' && !$val) {
481
+        if ($var === 'activated' && !$val) {
482 482
             $this->quiet();
483 483
         }
484 484
 
Please login to merge, or discard this patch.
xoops_lib/Xoops/Core/MediaUploader.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -410,13 +410,13 @@  discard block
 block discarded – undo
410 410
             $this->savedFileName = $this->targetFileName;
411 411
         } else {
412 412
             if (isset($this->prefix)) {
413
-                $this->savedFileName = uniqid($this->prefix) . '.' . strtolower($matched[1]);
413
+                $this->savedFileName = uniqid($this->prefix).'.'.strtolower($matched[1]);
414 414
             } else {
415 415
                 $this->savedFileName = strtolower($this->mediaName);
416 416
             }
417 417
         }
418 418
 
419
-        $this->savedDestination = $this->uploadDir . '/' . $this->savedFileName;
419
+        $this->savedDestination = $this->uploadDir.'/'.$this->savedFileName;
420 420
         if (!move_uploaded_file($this->mediaTmpName, $this->savedDestination)) {
421 421
             $this->setErrors(sprintf(\XoopsLocale::EF_FILE_NOT_SAVED_TO, $this->savedDestination));
422 422
             return false;
@@ -554,8 +554,8 @@  discard block
 block discarded – undo
554 554
         $patterns = array();
555 555
         $replaces = array();
556 556
         foreach ($this->extensionsToBeSanitized as $ext) {
557
-            $patterns[] = "/\." . preg_quote($ext) . "\./i";
558
-            $replaces[] = "_" . $ext . ".";
557
+            $patterns[] = "/\.".preg_quote($ext)."\./i";
558
+            $replaces[] = "_".$ext.".";
559 559
         }
560 560
         $this->mediaName = preg_replace($patterns, $replaces, $this->mediaName);
561 561
     }
@@ -587,9 +587,9 @@  discard block
 block discarded – undo
587 587
             $ret = '';
588 588
             if (count($this->errors) > 0) {
589 589
                 $ret = '<h4>'
590
-                . sprintf(\XoopsLocale::EF_ERRORS_RETURNED_WHILE_UPLOADING_FILE, $this->mediaName) . '</h4>';
590
+                . sprintf(\XoopsLocale::EF_ERRORS_RETURNED_WHILE_UPLOADING_FILE, $this->mediaName).'</h4>';
591 591
                 foreach ($this->errors as $error) {
592
-                    $ret .= $error . '<br />';
592
+                    $ret .= $error.'<br />';
593 593
                 }
594 594
             }
595 595
             return $ret;
Please login to merge, or discard this patch.