Passed
Push — master ( ad29f5...3d7fba )
by Goffy
04:21
created
class/Common/FileChecker.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 //\defined('XOOPS_ROOT_PATH') || die('XOOPS root path not defined');
27 27
 
28
-require_once \dirname(__DIR__, 4) . '/mainfile.php';
28
+require_once \dirname(__DIR__, 4).'/mainfile.php';
29 29
 $moduleDirName      = \basename(\dirname(__DIR__, 2));
30 30
 $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
31 31
 \xoops_loadLanguage('filechecker', $moduleDirName);
@@ -57,24 +57,24 @@  discard block
 block discarded – undo
57 57
         if (null === $original_file_path) {
58 58
             if (self::fileExists($file_path)) {
59 59
                 $path_status = "<img src='$pathIcon16/1.png' >";
60
-                $path_status .= "$file_path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_AVAILABLE') . ') ';
60
+                $path_status .= "$file_path (".\constant('CO_'.$moduleDirNameUpper.'_'.'FC_AVAILABLE').') ';
61 61
             } else {
62 62
                 $path_status = "<img src='$pathIcon16/0.png' >";
63
-                $path_status .= "$file_path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_NOTAVAILABLE') . ') ';
63
+                $path_status .= "$file_path (".\constant('CO_'.$moduleDirNameUpper.'_'.'FC_NOTAVAILABLE').') ';
64 64
             }
65 65
         } else {
66 66
             if (self::compareFiles($file_path, $original_file_path)) {
67 67
                 $path_status = "<img src='$pathIcon16/1.png' >";
68
-                $path_status .= "$file_path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_AVAILABLE') . ') ';
68
+                $path_status .= "$file_path (".\constant('CO_'.$moduleDirNameUpper.'_'.'FC_AVAILABLE').') ';
69 69
             } else {
70 70
                 $path_status = "<img src='$pathIcon16/0.png' >";
71
-                $path_status .= "$file_path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_NOTAVAILABLE') . ') ';
72
-                $path_status .= "<form action='" . $_SERVER['SCRIPT_NAME'] . "' method='post'>";
71
+                $path_status .= "$file_path (".\constant('CO_'.$moduleDirNameUpper.'_'.'FC_NOTAVAILABLE').') ';
72
+                $path_status .= "<form action='".$_SERVER['SCRIPT_NAME']."' method='post'>";
73 73
                 $path_status .= "<input type='hidden' name='op' value='copyfile'>";
74 74
                 $path_status .= "<input type='hidden' name='file_path' value='$file_path'>";
75 75
                 $path_status .= "<input type='hidden' name='original_file_path' value='$original_file_path'>";
76 76
                 $path_status .= "<input type='hidden' name='redirect' value='$redirectFile'>";
77
-                $path_status .= "<button class='submit' onClick='this.form.submit();'>" . \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_CREATETHEFILE') . '</button>';
77
+                $path_status .= "<button class='submit' onClick='this.form.submit();'>".\constant('CO_'.$moduleDirNameUpper.'_'.'FC_CREATETHEFILE').'</button>';
78 78
                 $path_status .= '</form>';
79 79
             }
80 80
         }
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
     {
140 140
         $target = \str_replace('..', '', $target);
141 141
 
142
-        return @\chmod($target, (int)$mode);
142
+        return @\chmod($target, (int) $mode);
143 143
     }
144 144
 }
145 145
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         if (\Xmf\Request::hasVar('redirect', 'POST')) {
156 156
             $redirect = $_POST['redirect'];
157 157
         }
158
-        $msg = FileChecker::copyFile($original_file_path, $file_path) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_FILECOPIED') : \constant('CO_' . $moduleDirNameUpper . '_' . 'FC_FILENOTCOPIED');
159
-        \redirect_header($redirect, 2, $msg . ': ' . $file_path);
158
+        $msg = FileChecker::copyFile($original_file_path, $file_path) ? \constant('CO_'.$moduleDirNameUpper.'_'.'FC_FILECOPIED') : \constant('CO_'.$moduleDirNameUpper.'_'.'FC_FILENOTCOPIED');
159
+        \redirect_header($redirect, 2, $msg.': '.$file_path);
160 160
         break;
161 161
 }
Please login to merge, or discard this patch.
class/Common/DirectoryChecker.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 use XoopsModules\Wggithub;
25 25
 
26 26
 
27
-require_once \dirname(__DIR__, 4) . '/mainfile.php';
27
+require_once \dirname(__DIR__, 4).'/mainfile.php';
28 28
 $moduleDirName      = \basename(\dirname(__DIR__, 2));
29 29
 $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
30 30
 \xoops_loadLanguage('directorychecker', $moduleDirName);
@@ -56,38 +56,38 @@  discard block
 block discarded – undo
56 56
         $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
57 57
         if (!@\is_dir($path)) {
58 58
             $path_status = "<img src='$pathIcon16/0.png' >";
59
-            $path_status .= "$path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_NOTAVAILABLE') . ') ';
60
-            $path_status .= "<form action='" . $_SERVER['SCRIPT_NAME'] . "' method='post'>";
59
+            $path_status .= "$path (".\constant('CO_'.$moduleDirNameUpper.'_'.'DC_NOTAVAILABLE').') ';
60
+            $path_status .= "<form action='".$_SERVER['SCRIPT_NAME']."' method='post'>";
61 61
             $path_status .= "<input type='hidden' name='op' value='createdir'>";
62 62
             $path_status .= "<input type='hidden' name='path' value='$path'>";
63 63
             $path_status .= "<input type='hidden' name='redirect' value='$redirectFile'>";
64
-            $path_status .= "<button class='submit' onClick='this.form.submit();'>" . \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_CREATETHEDIR') . '</button>';
64
+            $path_status .= "<button class='submit' onClick='this.form.submit();'>".\constant('CO_'.$moduleDirNameUpper.'_'.'DC_CREATETHEDIR').'</button>';
65 65
             $path_status .= '</form>';
66 66
         } elseif (@\is_writable($path)) {
67 67
             $path_status = "<img src='$pathIcon16/1.png' >";
68
-            $path_status .= "$path (" . \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_AVAILABLE') . ') ';
68
+            $path_status .= "$path (".\constant('CO_'.$moduleDirNameUpper.'_'.'DC_AVAILABLE').') ';
69 69
             $currentMode = \mb_substr(\decoct(\fileperms($path)), 2);
70 70
             if ($currentMode != \decoct($mode)) {
71 71
                 $path_status = "<img src='$pathIcon16/0.png' >";
72
-                $path_status .= $path . \sprintf(\constant('CO_' . $moduleDirNameUpper . '_' . 'DC_NOTWRITABLE'), \decoct($mode), $currentMode);
73
-                $path_status .= "<form action='" . $_SERVER['SCRIPT_NAME'] . "' method='post'>";
72
+                $path_status .= $path.\sprintf(\constant('CO_'.$moduleDirNameUpper.'_'.'DC_NOTWRITABLE'), \decoct($mode), $currentMode);
73
+                $path_status .= "<form action='".$_SERVER['SCRIPT_NAME']."' method='post'>";
74 74
                 $path_status .= "<input type='hidden' name='op' value='setdirperm'>";
75 75
                 $path_status .= "<input type='hidden' name='mode' value='$mode'>";
76 76
                 $path_status .= "<input type='hidden' name='path' value='$path'>";
77 77
                 $path_status .= "<input type='hidden' name='redirect' value='$redirectFile'>";
78
-                $path_status .= "<button class='submit' onClick='this.form.submit();'>" . \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_SETMPERM') . '</button>';
78
+                $path_status .= "<button class='submit' onClick='this.form.submit();'>".\constant('CO_'.$moduleDirNameUpper.'_'.'DC_SETMPERM').'</button>';
79 79
                 $path_status .= '</form>';
80 80
             }
81 81
         } else {
82 82
             $currentMode = \mb_substr(\decoct(\fileperms($path)), 2);
83 83
             $path_status = "<img src='$pathIcon16/0.png' >";
84
-            $path_status .= $path . \sprintf(\constant('CO_' . $moduleDirNameUpper . '_' . 'DC_NOTWRITABLE'), \decoct($mode), $currentMode);
85
-            $path_status .= "<form action='" . $_SERVER['SCRIPT_NAME'] . "' method='post'>";
84
+            $path_status .= $path.\sprintf(\constant('CO_'.$moduleDirNameUpper.'_'.'DC_NOTWRITABLE'), \decoct($mode), $currentMode);
85
+            $path_status .= "<form action='".$_SERVER['SCRIPT_NAME']."' method='post'>";
86 86
             $path_status .= "<input type='hidden' name='op' value='setdirperm'>";
87 87
             $path_status .= "<input type='hidden' name='mode' value='$mode'>";
88 88
             $path_status .= "<input type='hidden' name='path' value='$path'>";
89 89
             $path_status .= "<input type='hidden' name='redirect' value='$redirectFile'>";
90
-            $path_status .= "<button class='submit' onClick='this.form.submit();'>" . \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_SETMPERM') . '</button>';
90
+            $path_status .= "<button class='submit' onClick='this.form.submit();'>".\constant('CO_'.$moduleDirNameUpper.'_'.'DC_SETMPERM').'</button>';
91 91
             $path_status .= '</form>';
92 92
         }
93 93
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
     {
119 119
         $target = \str_replace('..', '', $target);
120 120
 
121
-        return @\chmod($target, (int)$mode);
121
+        return @\chmod($target, (int) $mode);
122 122
     }
123 123
 
124 124
     /**
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
         if (\Xmf\Request::hasVar('redirect', 'POST')) {
142 142
             $redirect = $_POST['redirect'];
143 143
         }
144
-        $msg = DirectoryChecker::createDirectory($path) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_DIRCREATED') : \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_DIRNOTCREATED');
145
-        \redirect_header($redirect, 2, $msg . ': ' . $path);
144
+        $msg = DirectoryChecker::createDirectory($path) ? \constant('CO_'.$moduleDirNameUpper.'_'.'DC_DIRCREATED') : \constant('CO_'.$moduleDirNameUpper.'_'.'DC_DIRNOTCREATED');
145
+        \redirect_header($redirect, 2, $msg.': '.$path);
146 146
         break;
147 147
     case 'setdirperm':
148 148
         if (\Xmf\Request::hasVar('path', 'POST')) {
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
         if (\Xmf\Request::hasVar('mode', 'POST')) {
155 155
             $mode = $_POST['mode'];
156 156
         }
157
-        $msg = DirectoryChecker::setDirectoryPermissions($path, $mode) ? \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_PERMSET') : \constant('CO_' . $moduleDirNameUpper . '_' . 'DC_PERMNOTSET');
158
-        \redirect_header($redirect, 2, $msg . ': ' . $path);
157
+        $msg = DirectoryChecker::setDirectoryPermissions($path, $mode) ? \constant('CO_'.$moduleDirNameUpper.'_'.'DC_PERMSET') : \constant('CO_'.$moduleDirNameUpper.'_'.'DC_PERMNOTSET');
158
+        \redirect_header($redirect, 2, $msg.': '.$path);
159 159
         break;
160 160
 }
Please login to merge, or discard this patch.
class/Common/MigrateHelper.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
             $line = \trim($value);
85 85
             if ('CREATE TABLE' === \mb_strtoupper(\substr($line, 0, 12))) {
86 86
                 // start table definition
87
-                $tableName = $this->getTableName ($line);
87
+                $tableName = $this->getTableName($line);
88 88
                 $tables[$tableName] = [];
89 89
                 $tables[$tableName]['options'] = '';
90 90
                 $tables[$tableName]['columns'] = [];
@@ -121,22 +121,22 @@  discard block
 block discarded – undo
121 121
             $schema[] = "{$tkey}:\n";
122 122
             foreach ($table as $lkey => $line) {
123 123
                 if ('keys' == $lkey) {
124
-                    $schema[] = $level1 . "keys:\n";
124
+                    $schema[] = $level1."keys:\n";
125 125
                     foreach ($line as $kkey => $kvalue) {
126 126
                         foreach ($kvalue as $kkey2 => $kvalue2) {
127
-                            $schema[] = $level2 . $kkey2 . ":\n";
128
-                            $schema[] = $level3 . 'columns: ' . $kvalue2['columns'] . "\n";
129
-                            $schema[] = $level3 . 'unique: ' . $kvalue2['unique'] . "\n";
127
+                            $schema[] = $level2.$kkey2.":\n";
128
+                            $schema[] = $level3.'columns: '.$kvalue2['columns']."\n";
129
+                            $schema[] = $level3.'unique: '.$kvalue2['unique']."\n";
130 130
                         }
131 131
                     }
132 132
                 } elseif ('options' == $lkey) {
133
-                    $schema[] = $level1 . 'options: ' . $line . "\n";
133
+                    $schema[] = $level1.'options: '.$line."\n";
134 134
                 } else {
135
-                    $schema[] = $level1 . 'columns: ' . "\n";
135
+                    $schema[] = $level1.'columns: '."\n";
136 136
                     foreach ($line as $kkey => $kvalue) {
137
-                        $schema[] = $level2 . '-' . "\n";
137
+                        $schema[] = $level2.'-'."\n";
138 138
                         foreach ($kvalue as $kkey2 => $kvalue2) {
139
-                            $schema[] = $level3 . $kkey2 . ": " . $kvalue2 . "\n";
139
+                            $schema[] = $level3.$kkey2.": ".$kvalue2."\n";
140 140
                         }
141 141
                     }
142 142
                 }
@@ -164,10 +164,10 @@  discard block
 block discarded – undo
164 164
      * @param  string $line
165 165
      * @return string|bool
166 166
      */
167
-    private function getTableName (string $line)
167
+    private function getTableName(string $line)
168 168
     {
169 169
 
170
-        $arrLine = \explode( '`', $line);
170
+        $arrLine = \explode('`', $line);
171 171
         if (\count($arrLine) > 0) {
172 172
             return $arrLine[1];
173 173
         }
@@ -182,12 +182,12 @@  discard block
 block discarded – undo
182 182
      * @param string $line
183 183
      * @return array|bool
184 184
      */
185
-    private function getColumns (string $line)
185
+    private function getColumns(string $line)
186 186
     {
187 187
 
188 188
         $columns = [];
189 189
 
190
-        $arrCol = \explode( ' ', \trim($line));
190
+        $arrCol = \explode(' ', \trim($line));
191 191
         if (\count($arrCol) > 0) {
192 192
             $name = \str_replace(['`'], '', $arrCol[0]);
193 193
         } else {
@@ -198,11 +198,11 @@  discard block
 block discarded – undo
198 198
         $columns['name'] = $name;
199 199
         // update quotes
200 200
         if (\strpos($attributes, "''") > 0) {
201
-            $attributes = \trim(\str_replace("''", "''''''''" , $attributes));
201
+            $attributes = \trim(\str_replace("''", "''''''''", $attributes));
202 202
         } elseif (\strpos($attributes, "'") > 0) {
203
-            $attributes = \trim(\str_replace("'", "''" , $attributes));
203
+            $attributes = \trim(\str_replace("'", "''", $attributes));
204 204
         }
205
-        $columns['attributes'] = "' " . $attributes . " '";
205
+        $columns['attributes'] = "' ".$attributes." '";
206 206
 
207 207
         return $columns;
208 208
 
@@ -214,12 +214,12 @@  discard block
 block discarded – undo
214 214
      * @param string $line
215 215
      * @return string
216 216
      */
217
-    private function getOptions (string $line): string
217
+    private function getOptions(string $line): string
218 218
     {
219 219
 
220 220
         $options = \str_replace([')', ';'], '', $line);
221 221
         $options = \trim($options);
222
-        $options = "'" . $options . "'";
222
+        $options = "'".$options."'";
223 223
 
224 224
         return $options;
225 225
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
      * @param string $line
232 232
      * @return array|bool
233 233
      */
234
-    private function getKey (string $line)
234
+    private function getKey(string $line)
235 235
     {
236 236
 
237 237
         $key = [];
@@ -254,12 +254,12 @@  discard block
 block discarded – undo
254 254
                 if ('' == $name) {
255 255
                     $name = $columns;
256 256
                 }
257
-                if (\strpos($name,' ') > 0) {
258
-                    $name = "'" . $name . "'";
257
+                if (\strpos($name, ' ') > 0) {
258
+                    $name = "'".$name."'";
259 259
                 }
260 260
                 $key[$name] = [];
261
-                if (\strpos($columns,' ') > 0) {
262
-                    $columns = "'" . $columns . "'";
261
+                if (\strpos($columns, ' ') > 0) {
262
+                    $columns = "'".$columns."'";
263 263
                 }
264 264
                 $key[$name]['columns'] = $columns;
265 265
                 $key[$name]['unique'] = $unique;
Please login to merge, or discard this patch.
xoops_version.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,10 +39,10 @@  discard block
 block discarded – undo
39 39
     'license_url'         => 'http://www.gnu.org/licenses/gpl-3.0.en.html',
40 40
     'help'                => 'page=help',
41 41
     'release_info'        => 'release_info',
42
-    'release_file'        => \XOOPS_URL . '/modules/wggithub/docs/release_info file',
42
+    'release_file'        => \XOOPS_URL.'/modules/wggithub/docs/release_info file',
43 43
     'release_date'        => '2021/03/31',
44 44
     'manual'              => 'link to manual file',
45
-    'manual_file'         => \XOOPS_URL . '/modules/wggithub/docs/install.txt',
45
+    'manual_file'         => \XOOPS_URL.'/modules/wggithub/docs/install.txt',
46 46
     'min_php'             => '7.4',
47 47
     'min_xoops'           => '2.5.11 Beta1',
48 48
     'min_admin'           => '1.2',
@@ -299,8 +299,8 @@  discard block
 block discarded – undo
299 299
 // Make Sample button visible?
300 300
 $modversion['config'][] = [
301 301
     'name'        => 'displaySampleButton',
302
-    'title'       => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON',
303
-    'description' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC',
302
+    'title'       => 'CO_'.$moduleDirNameUpper.'_'.'SHOW_SAMPLE_BUTTON',
303
+    'description' => 'CO_'.$moduleDirNameUpper.'_'.'SHOW_SAMPLE_BUTTON_DESC',
304 304
     'formtype'    => 'yesno',
305 305
     'valuetype'   => 'int',
306 306
     'default'     => 1,
Please login to merge, or discard this patch.