Completed
Pull Request — master (#4)
by Michael
01:24
created
modules/tools/class/Common/FilesManagement.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
                     throw new \RuntimeException(\sprintf('Unable to create the %s directory', $folder));
36 36
                 }
37 37
 
38
-                file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>');
38
+                file_put_contents($folder.'/index.html', '<script>history.go(-1);</script>');
39 39
             }
40 40
         } catch (\Exception $e) {
41 41
             echo 'Caught exception: ', $e->getMessage(), "\n", '<br>';
@@ -61,14 +61,14 @@  discard block
 block discarded – undo
61 61
         $dir = \opendir($src);
62 62
         //        @mkdir($dst);
63 63
         if (!@\mkdir($dst) && !\is_dir($dst)) {
64
-            throw new \RuntimeException('The directory ' . $dst . ' could not be created.');
64
+            throw new \RuntimeException('The directory '.$dst.' could not be created.');
65 65
         }
66 66
         while (false !== ($file = \readdir($dir))) {
67 67
             if (('.' !== $file) && ('..' !== $file)) {
68
-                if (\is_dir($src . '/' . $file)) {
69
-                    self::recurseCopy($src . '/' . $file, $dst . '/' . $file);
68
+                if (\is_dir($src.'/'.$file)) {
69
+                    self::recurseCopy($src.'/'.$file, $dst.'/'.$file);
70 70
                 } else {
71
-                    \copy($src . '/' . $file, $dst . '/' . $file);
71
+                    \copy($src.'/'.$file, $dst.'/'.$file);
72 72
                 }
73 73
             }
74 74
         }
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
                 self::rrmdir($fObj->getPathname());
205 205
             }
206 206
         }
207
-        $iterator = null;   // clear iterator Obj to close file/directory
207
+        $iterator = null; // clear iterator Obj to close file/directory
208 208
         return \rmdir($src); // remove the directory & return results
209 209
     }
210 210
 
@@ -237,14 +237,14 @@  discard block
 block discarded – undo
237 237
         $iterator = new \DirectoryIterator($src);
238 238
         foreach ($iterator as $fObj) {
239 239
             if ($fObj->isFile()) {
240
-                \rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
240
+                \rename($fObj->getPathname(), "{$dest}/".$fObj->getFilename());
241 241
             } elseif (!$fObj->isDot() && $fObj->isDir()) {
242 242
                 // Try recursively on directory
243
-                self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
243
+                self::rmove($fObj->getPathname(), "{$dest}/".$fObj->getFilename());
244 244
                 //                rmdir($fObj->getPath()); // now delete the directory
245 245
             }
246 246
         }
247
-        $iterator = null;   // clear iterator Obj to close file/directory
247
+        $iterator = null; // clear iterator Obj to close file/directory
248 248
         return \rmdir($src); // remove the directory & return results
249 249
     }
250 250
 
@@ -280,9 +280,9 @@  discard block
 block discarded – undo
280 280
         $iterator = new \DirectoryIterator($src);
281 281
         foreach ($iterator as $fObj) {
282 282
             if ($fObj->isFile()) {
283
-                \copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
283
+                \copy($fObj->getPathname(), "{$dest}/".$fObj->getFilename());
284 284
             } elseif (!$fObj->isDot() && $fObj->isDir()) {
285
-                self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
285
+                self::rcopy($fObj->getPathname(), "{$dest}/".$fObj->getFilename());
286 286
             }
287 287
         }
288 288
 
Please login to merge, or discard this patch.
modules/tools/class/Common/VersionChecks.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -42,13 +42,13 @@  discard block
 block discarded – undo
42 42
         //check for minimum XOOPS version
43 43
         $currentVer = mb_substr(XOOPS_VERSION, 6); // get the numeric part of string
44 44
         if (null === $requiredVer) {
45
-            $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string
45
+            $requiredVer = ''.$module->getInfo('min_xoops'); //making sure it's a string
46 46
         }
47 47
         $success = true;
48 48
 
49 49
         if (version_compare($currentVer, $requiredVer, '<')) {
50 50
             $success = false;
51
-            $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer));
51
+            $module->setErrors(sprintf(constant('CO_'.$moduleDirNameUpper.'_ERROR_BAD_XOOPS'), $requiredVer, $currentVer));
52 52
         }
53 53
 
54 54
         return $success;
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 
80 80
         if (false !== $reqVer && '' !== $reqVer && !is_array($reqVer)) {
81 81
             if (version_compare($verNum, $reqVer, '<')) {
82
-                $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum));
82
+                $module->setErrors(sprintf(constant('CO_'.$moduleDirNameUpper.'_ERROR_BAD_PHP'), $reqVer, $verNum));
83 83
                 $success = false;
84 84
             }
85 85
         }
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
         $moduleDirName      = \basename(\dirname(__DIR__, 2));
104 104
         $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
105 105
         $update             = '';
106
-        $repository         = 'XoopsModules25x/' . $moduleDirName;
106
+        $repository         = 'XoopsModules25x/'.$moduleDirName;
107 107
         //        $repository         = 'XoopsModules25x/publisher'; //for testing only
108 108
         $ret             = '';
109 109
         $infoReleasesUrl = "https://api.github.com/repos/$repository/releases";
@@ -117,14 +117,14 @@  discard block
 block discarded – undo
117 117
                 if (false === $curlReturn) {
118 118
                     trigger_error(curl_error($curlHandle));
119 119
                 } elseif (false !== strpos($curlReturn, 'Not Found')) {
120
-                    trigger_error('Repository Not Found: ' . $infoReleasesUrl);
120
+                    trigger_error('Repository Not Found: '.$infoReleasesUrl);
121 121
                 } else {
122 122
                     $file              = json_decode($curlReturn, false);
123 123
                     $latestVersionLink = sprintf("https://github.com/$repository/archive/%s.zip", $file ? reset($file)->tag_name : $default);
124 124
                     $latestVersion     = $file[0]->tag_name;
125 125
                     $prerelease        = $file[0]->prerelease;
126 126
                     if ('master' !== $latestVersionLink) {
127
-                        $update = constant('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION') . $latestVersion;
127
+                        $update = constant('CO_'.$moduleDirNameUpper.'_'.'NEW_VERSION').$latestVersion;
128 128
                     }
129 129
                     //"PHP-standardized" version
130 130
                     $latestVersion = mb_strtolower($latestVersion);
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
                         $latestVersion = str_replace('_', '', mb_strtolower($latestVersion));
133 133
                         $latestVersion = str_replace('final', '', mb_strtolower($latestVersion));
134 134
                     }
135
-                    $moduleVersion = ($helper->getModule()->getInfo('version') . '_' . $helper->getModule()->getInfo('module_status'));
135
+                    $moduleVersion = ($helper->getModule()->getInfo('version').'_'.$helper->getModule()->getInfo('module_status'));
136 136
                     //"PHP-standardized" version
137 137
                     $moduleVersion = str_replace(' ', '', mb_strtolower($moduleVersion));
138 138
                     //                    $moduleVersion = '1.0'; //for testing only
Please login to merge, or discard this patch.
modules/tools/class/Common/ServerStats.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -38,19 +38,19 @@  discard block
 block discarded – undo
38 38
         //        $query = $GLOBALS['xoopsDB']->query($sql);
39 39
         //        list($meta) = $GLOBALS['xoopsDB']->fetchRow($query);
40 40
         $html .= '<fieldset>';
41
-        $html .= "<legend style='font-weight: bold; color: #900;'>" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . '</legend>';
41
+        $html .= "<legend style='font-weight: bold; color: #900;'>".constant('CO_'.$moduleDirNameUpper.'_IMAGEINFO').'</legend>';
42 42
         $html .= "<div style='padding: 8px;'>";
43 43
         //        $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "</div>";
44 44
         //        $html .= "<br>";
45 45
         //        $html .= "<br>";
46
-        $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . '</div>';
46
+        $html .= '<div>'.constant('CO_'.$moduleDirNameUpper.'_SPHPINI').'</div>';
47 47
         $html .= '<ul>';
48 48
 
49
-        $gdlib = function_exists('gd_info') ? '<span style="color: #008000;">' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: #ff0000;">' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>';
50
-        $html  .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib;
49
+        $gdlib = function_exists('gd_info') ? '<span style="color: #008000;">'.constant('CO_'.$moduleDirNameUpper.'_GDON').'</span>' : '<span style="color: #ff0000;">'.constant('CO_'.$moduleDirNameUpper.'_GDOFF').'</span>';
50
+        $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_GDLIBSTATUS').$gdlib;
51 51
         if (function_exists('gd_info')) {
52 52
             if (true === ($gdlib = gd_info())) {
53
-                $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>';
53
+                $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_GDLIBVERSION').'<b>'.$gdlib['GD Version'].'</b>';
54 54
             }
55 55
         }
56 56
 
@@ -60,18 +60,18 @@  discard block
 block discarded – undo
60 60
         //    $registerglobals = (!ini_get('register_globals')) ? "<span style=\"color: #008000;\">" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>' : "<span style=\"color: #ff0000;\">" . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>';
61 61
         //    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals;
62 62
 
63
-        $downloads = ini_get('file_uploads') ? '<span style="color: #008000;">' . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>' : '<span style="color: #ff0000;">' . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>';
64
-        $html      .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads;
63
+        $downloads = ini_get('file_uploads') ? '<span style="color: #008000;">'.constant('CO_'.$moduleDirNameUpper.'_ON').'</span>' : '<span style="color: #ff0000;">'.constant('CO_'.$moduleDirNameUpper.'_OFF').'</span>';
64
+        $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_SERVERUPLOADSTATUS').$downloads;
65 65
 
66
-        $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' <b><span style="color: #0000ff;">' . ini_get('upload_max_filesize') . '</span></b>';
67
-        $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' <b><span style="color: #0000ff;">' . ini_get('post_max_size') . '</span></b>';
68
-        $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' <b><span style="color: #0000ff;">' . ini_get('memory_limit') . '</span></b>';
66
+        $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_MAXUPLOADSIZE').' <b><span style="color: #0000ff;">'.ini_get('upload_max_filesize').'</span></b>';
67
+        $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_MAXPOSTSIZE').' <b><span style="color: #0000ff;">'.ini_get('post_max_size').'</span></b>';
68
+        $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_MEMORYLIMIT').' <b><span style="color: #0000ff;">'.ini_get('memory_limit').'</span></b>';
69 69
         $html .= '</ul>';
70 70
         $html .= '<ul>';
71
-        $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . '</b>';
71
+        $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_SERVERPATH').' <b>'.XOOPS_ROOT_PATH.'</b>';
72 72
         $html .= '</ul>';
73 73
         $html .= '<br>';
74
-        $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . '';
74
+        $html .= constant('CO_'.$moduleDirNameUpper.'_UPLOADPATHDSC').'';
75 75
         $html .= '</div>';
76 76
         $html .= '</fieldset><br>';
77 77
 
Please login to merge, or discard this patch.
class/smarty/xoops_plugins/function.xoBlk.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,19 +26,19 @@
 block discarded – undo
26 26
     user=admin
27 27
 }>
28 28
 */
29
-function smarty_function_xoBlk( $params, $smarty )
29
+function smarty_function_xoBlk($params, $smarty)
30 30
 {
31 31
     /** @var Smarty $smarty */
32 32
     $old_caching = $smarty->caching;
33 33
     $old_cache_lifetime = $smarty->cache_lifetime;
34 34
     if (isset($params['cachetime'])) {
35 35
         $smarty->caching = 2;
36
-        $smarty->cache_lifetime = (int)$params['cachetime'];
36
+        $smarty->cache_lifetime = (int) $params['cachetime'];
37 37
     } else {
38 38
         $smarty->caching = 0;
39 39
     }
40
-    $tplName = 'db:' . $params['template'];
41
-    $params['cacheid'] = $params['cacheid'] ?? ('xoBlk_' . md5(var_export($params, true)));
40
+    $tplName = 'db:'.$params['template'];
41
+    $params['cacheid'] = $params['cacheid'] ?? ('xoBlk_'.md5(var_export($params, true)));
42 42
     if (!isset($params['cachetime']) || !$smarty->is_cached($tplName, $params['cacheid'])) {
43 43
         $myBlock = [
44 44
             'dirname' => $params['module'],
Please login to merge, or discard this patch.