Completed
Pull Request — develop (#716)
by Agel_Nash
09:56
created
manager/actions/files.dynamic.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 if(!function_exists('removeLastPath')) {
746 746
     /**
747 747
      * @param string $string
748
-     * @return bool|string
748
+     * @return string|false
749 749
      */
750 750
     function removeLastPath($string)
751 751
     {
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
 if(!function_exists('getExtension')) {
764 764
     /**
765 765
      * @param string $string
766
-     * @return bool|string
766
+     * @return string|false
767 767
      */
768 768
     function getExtension($string)
769 769
     {
Please login to merge, or discard this patch.
Spacing   +125 added lines, -125 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 if (!$modx->hasPermission('file_manager')) {
@@ -9,15 +9,15 @@  discard block
 block discarded – undo
9 9
 $newToken = makeToken();
10 10
 
11 11
 // settings
12
-$theme_image_path = $modx->config['site_manager_url'] . 'media/style/' . $modx->config['manager_theme'] . '/images/';
12
+$theme_image_path = $modx->config['site_manager_url'].'media/style/'.$modx->config['manager_theme'].'/images/';
13 13
 $excludes = array(
14 14
     '.',
15 15
     '..',
16 16
     '.svn'
17 17
 );
18
-$alias_suffix = (!empty($friendly_url_suffix)) ? ',' . ltrim($friendly_url_suffix, '.') : '';
19
-$editablefiles = explode(',', 'txt,php,tpl,less,sass,shtml,html,htm,xml,js,css,pageCache,htaccess,json,ini' . $alias_suffix);
20
-$inlineviewablefiles = explode(',', 'txt,php,tpl,less,sass,html,htm,xml,js,css,pageCache,htaccess,json,ini' . $alias_suffix);
18
+$alias_suffix = (!empty($friendly_url_suffix)) ? ','.ltrim($friendly_url_suffix, '.') : '';
19
+$editablefiles = explode(',', 'txt,php,tpl,less,sass,shtml,html,htm,xml,js,css,pageCache,htaccess,json,ini'.$alias_suffix);
20
+$inlineviewablefiles = explode(',', 'txt,php,tpl,less,sass,html,htm,xml,js,css,pageCache,htaccess,json,ini'.$alias_suffix);
21 21
 $viewablefiles = explode(',', 'jpg,gif,png,ico');
22 22
 
23 23
 $editablefiles = add_dot($editablefiles);
@@ -30,31 +30,31 @@  discard block
 block discarded – undo
30 30
 {
31 31
 */
32 32
 $protected_path[] = $modx->config['site_manager_path'];
33
-$protected_path[] = $modx->config['base_path'] . 'temp/backup';
34
-$protected_path[] = $modx->config['base_path'] . 'assets/backup';
33
+$protected_path[] = $modx->config['base_path'].'temp/backup';
34
+$protected_path[] = $modx->config['base_path'].'assets/backup';
35 35
 
36 36
 if (!$modx->hasPermission('save_plugin')) {
37
-    $protected_path[] = $modx->config['base_path'] . 'assets/plugins';
37
+    $protected_path[] = $modx->config['base_path'].'assets/plugins';
38 38
 }
39 39
 if (!$modx->hasPermission('save_snippet')) {
40
-    $protected_path[] = $modx->config['base_path'] . 'assets/snippets';
40
+    $protected_path[] = $modx->config['base_path'].'assets/snippets';
41 41
 }
42 42
 if (!$modx->hasPermission('save_template')) {
43
-    $protected_path[] = $modx->config['base_path'] . 'assets/templates';
43
+    $protected_path[] = $modx->config['base_path'].'assets/templates';
44 44
 }
45 45
 if (!$modx->hasPermission('save_module')) {
46
-    $protected_path[] = $modx->config['base_path'] . 'assets/modules';
46
+    $protected_path[] = $modx->config['base_path'].'assets/modules';
47 47
 }
48 48
 if (!$modx->hasPermission('empty_cache')) {
49
-    $protected_path[] = $modx->config['base_path'] . 'assets/cache';
49
+    $protected_path[] = $modx->config['base_path'].'assets/cache';
50 50
 }
51 51
 if (!$modx->hasPermission('import_static')) {
52
-    $protected_path[] = $modx->config['base_path'] . 'temp/import';
53
-    $protected_path[] = $modx->config['base_path'] . 'assets/import';
52
+    $protected_path[] = $modx->config['base_path'].'temp/import';
53
+    $protected_path[] = $modx->config['base_path'].'assets/import';
54 54
 }
55 55
 if (!$modx->hasPermission('export_static')) {
56
-    $protected_path[] = $modx->config['base_path'] . 'temp/export';
57
-    $protected_path[] = $modx->config['base_path'] . 'assets/export';
56
+    $protected_path[] = $modx->config['base_path'].'temp/export';
57
+    $protected_path[] = $modx->config['base_path'].'assets/export';
58 58
 }
59 59
 /*
60 60
 }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 $uploadablefiles = array_merge($upload_files, $upload_images, $upload_media, $upload_flash);
77 77
 $uploadablefiles = add_dot($uploadablefiles);
78 78
 
79
-if(!function_exists('add_dot')) {
79
+if (!function_exists('add_dot')) {
80 80
     /**
81 81
      * @param array $array
82 82
      * @return array
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     {
86 86
         $count = count($array);
87 87
         for ($i = 0; $i < $count; $i++) {
88
-            $array[$i] = '.' . strtolower(trim($array[$i])); // add a dot :)
88
+            $array[$i] = '.'.strtolower(trim($array[$i])); // add a dot :)
89 89
         }
90 90
 
91 91
         return $array;
@@ -111,15 +111,15 @@  discard block
 block discarded – undo
111 111
 $rw = realpath('../');
112 112
 $webstart_path = str_replace('\\', '/', str_replace($rw, '', $rf));
113 113
 if (substr($webstart_path, 0, 1) == '/') {
114
-    $webstart_path = '..' . $webstart_path;
114
+    $webstart_path = '..'.$webstart_path;
115 115
 } else {
116
-    $webstart_path = '../' . $webstart_path;
116
+    $webstart_path = '../'.$webstart_path;
117 117
 }
118 118
 
119 119
 ?>
120 120
     <script type="text/javascript">
121 121
 
122
-        var current_path = '<?= $startpath;?>';
122
+        var current_path = '<?= $startpath; ?>';
123 123
 
124 124
         function viewfile (url)
125 125
         {
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         function unzipFile (file)
156 156
         {
157 157
             if (confirmUnzip()) {
158
-                window.location.href = "index.php?a=31&mode=unzip&path=" + current_path + '/&file=' + file + "&token=<?= $newToken;?>";
158
+                window.location.href = "index.php?a=31&mode=unzip&path=" + current_path + '/&file=' + file + "&token=<?= $newToken; ?>";
159 159
                 return false;
160 160
             }
161 161
         }
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         function deleteFolder (folder, status)
178 178
         {
179 179
             if (confirmDeleteFolder(status)) {
180
-                window.location.href = "index.php?a=31&mode=deletefolder&path=" + current_path + "&folderpath=" + current_path + '/' + folder + "&token=<?= $newToken;?>";
180
+                window.location.href = "index.php?a=31&mode=deletefolder&path=" + current_path + "&folderpath=" + current_path + '/' + folder + "&token=<?= $newToken; ?>";
181 181
                 return false;
182 182
             }
183 183
         }
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
         function deleteFile (file)
186 186
         {
187 187
             if (confirmDelete()) {
188
-                window.location.href = "index.php?a=31&mode=delete&path=" + current_path + '/' + file + "&token=<?= $newToken;?>";
188
+                window.location.href = "index.php?a=31&mode=delete&path=" + current_path + '/' + file + "&token=<?= $newToken; ?>";
189 189
                 return false;
190 190
             }
191 191
         }
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
         {
195 195
             var newFilename = prompt("<?= $_lang["files_dynamic_new_file_name"] ?>", file);
196 196
             if (newFilename !== null && newFilename !== file) {
197
-                window.location.href = "index.php?a=31&mode=duplicate&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken;?>";
197
+                window.location.href = "index.php?a=31&mode=duplicate&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken; ?>";
198 198
             }
199 199
         }
200 200
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
         {
203 203
             var newDirname = prompt("<?= $_lang["files_dynamic_new_folder_name"] ?>", dir);
204 204
             if (newDirname !== null && newDirname !== dir) {
205
-                window.location.href = "index.php?a=31&mode=renameFolder&path=" + current_path + '&dirname=' + dir + "&newDirname=" + newDirname + "&token=<?= $newToken;?>";
205
+                window.location.href = "index.php?a=31&mode=renameFolder&path=" + current_path + '&dirname=' + dir + "&newDirname=" + newDirname + "&token=<?= $newToken; ?>";
206 206
             }
207 207
         }
208 208
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
         {
211 211
             var newFilename = prompt("<?= $_lang["files_dynamic_new_file_name"] ?>", file);
212 212
             if (newFilename !== null && newFilename !== file) {
213
-                window.location.href = "index.php?a=31&mode=renameFile&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken;?>";
213
+                window.location.href = "index.php?a=31&mode=renameFile&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken; ?>";
214 214
             }
215 215
         }
216 216
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
             <?php endif ?>
230 230
             <?php
231 231
             if (isset($_GET['mode']) && $_GET['mode'] !== 'drill') {
232
-                $href = 'a=31&path=' . urlencode($_REQUEST['path']);
232
+                $href = 'a=31&path='.urlencode($_REQUEST['path']);
233 233
             } else {
234 234
                 $href = 'a=2';
235 235
             }
@@ -239,12 +239,12 @@  discard block
 block discarded – undo
239 239
                 $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFolderName(this);"><i class="[+image+]"></i><span>[+subject+]</span></a>';
240 240
                 $ph['image'] = $_style['files_folder-open'];
241 241
                 $ph['subject'] = $_lang['add_folder'];
242
-                $ph['href'] = 'index.php?a=31&mode=newfolder&path=' . urlencode($startpath) . '&name=';
242
+                $ph['href'] = 'index.php?a=31&mode=newfolder&path='.urlencode($startpath).'&name=';
243 243
                 $_ = parsePlaceholder($tpl, $ph);
244 244
 
245
-                $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFileName(this);"><i class="[+image+]"></i><span>' . $_lang['files.dynamic.php1'] . '</span></a>';
245
+                $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFileName(this);"><i class="[+image+]"></i><span>'.$_lang['files.dynamic.php1'].'</span></a>';
246 246
                 $ph['image'] = $_style['files_page_html'];
247
-                $ph['href'] = 'index.php?a=31&mode=newfile&path=' . urlencode($startpath) . '&name=';
247
+                $ph['href'] = 'index.php?a=31&mode=newfile&path='.urlencode($startpath).'&name=';
248 248
                 $_ .= parsePlaceholder($tpl, $ph);
249 249
                 echo $_;
250 250
             }
@@ -274,12 +274,12 @@  discard block
 block discarded – undo
274 274
             $ph = array();
275 275
             $ph['style_path'] = $theme_image_path;
276 276
             // To Top Level with folder icon to the left
277
-            if ($startpath == $filemanager_path || $startpath . '/' == $filemanager_path) {
278
-                $ph['image'] = '' . $_style['files_top'] . '';
277
+            if ($startpath == $filemanager_path || $startpath.'/' == $filemanager_path) {
278
+                $ph['image'] = ''.$_style['files_top'].'';
279 279
                 $ph['subject'] = '<span>Top</span>';
280 280
             } else {
281
-                $ph['image'] = '' . $_style['files_top'] . '';
282
-                $ph['subject'] = '<a href="index.php?a=31&mode=drill&path=' . $filemanager_path . '">Top</a>/';
281
+                $ph['image'] = ''.$_style['files_top'].'';
282
+                $ph['subject'] = '<a href="index.php?a=31&mode=drill&path='.$filemanager_path.'">Top</a>/';
283 283
             }
284 284
 
285 285
             echo parsePlaceholder($tpl, $ph);
@@ -296,12 +296,12 @@  discard block
 block discarded – undo
296 296
                     if (empty($v)) {
297 297
                         continue;
298 298
                     }
299
-                    $path .= rtrim($v, '/') . '/';
299
+                    $path .= rtrim($v, '/').'/';
300 300
                     if (1 < $count) {
301
-                        $href = 'index.php?a=31&mode=drill&path=' . urlencode($filemanager_path . $path);
302
-                        $pieces[$i] = '<a href="' . $href . '">' . trim($v, '/') . '</a>';
301
+                        $href = 'index.php?a=31&mode=drill&path='.urlencode($filemanager_path.$path);
302
+                        $pieces[$i] = '<a href="'.$href.'">'.trim($v, '/').'</a>';
303 303
                     } else {
304
-                        $pieces[$i] = '<span>' . trim($v, '/') . '</span>';
304
+                        $pieces[$i] = '<span>'.trim($v, '/').'</span>';
305 305
                     }
306 306
                     $count--;
307 307
                 }
@@ -314,16 +314,16 @@  discard block
 block discarded – undo
314 314
         </div>
315 315
         <?php
316 316
         // check to see user isn't trying to move below the document_root
317
-        if (substr(strtolower(str_replace('//', '/', $startpath . "/")), 0, $len) != strtolower(str_replace('//', '/', $filemanager_path . '/'))) {
317
+        if (substr(strtolower(str_replace('//', '/', $startpath."/")), 0, $len) != strtolower(str_replace('//', '/', $filemanager_path.'/'))) {
318 318
             $modx->webAlertAndQuit($_lang["files_access_denied"]);
319 319
         }
320 320
 
321 321
         // Unzip .zip files - by Raymond
322 322
         if ($enablefileunzip && $_REQUEST['mode'] == 'unzip' && is_writable($startpath)) {
323
-            if (!$err = unzip(realpath("{$startpath}/" . $_REQUEST['file']), realpath($startpath))) {
324
-                echo '<span class="warning"><b>' . $_lang['file_unzip_fail'] . ($err === 0 ? 'Missing zip library (php_zip.dll / zip.so)' : '') . '</b></span><br /><br />';
323
+            if (!$err = unzip(realpath("{$startpath}/".$_REQUEST['file']), realpath($startpath))) {
324
+                echo '<span class="warning"><b>'.$_lang['file_unzip_fail'].($err === 0 ? 'Missing zip library (php_zip.dll / zip.so)' : '').'</b></span><br /><br />';
325 325
             } else {
326
-                echo '<span class="success"><b>' . $_lang['file_unzip'] . '</b></span><br /><br />';
326
+                echo '<span class="success"><b>'.$_lang['file_unzip'].'</b></span><br /><br />';
327 327
             }
328 328
         }
329 329
         // End Unzip - Raymond
@@ -335,9 +335,9 @@  discard block
 block discarded – undo
335 335
             if ($_REQUEST['mode'] == 'deletefolder') {
336 336
                 $folder = $_REQUEST['folderpath'];
337 337
                 if (!$token_check || !@rrmdir($folder)) {
338
-                    echo '<span class="warning"><b>' . $_lang['file_folder_not_deleted'] . '</b></span><br /><br />';
338
+                    echo '<span class="warning"><b>'.$_lang['file_folder_not_deleted'].'</b></span><br /><br />';
339 339
                 } else {
340
-                    echo '<span class="success"><b>' . $_lang['file_folder_deleted'] . '</b></span><br /><br />';
340
+                    echo '<span class="success"><b>'.$_lang['file_folder_deleted'].'</b></span><br /><br />';
341 341
                 }
342 342
             }
343 343
 
@@ -348,10 +348,10 @@  discard block
 block discarded – undo
348 348
                 if (!mkdirs("{$startpath}/{$foldername}", 0777)) {
349 349
                     echo '<span class="warning"><b>', $_lang['file_folder_not_created'], '</b></span><br /><br />';
350 350
                 } else {
351
-                    if (!@chmod($startpath . '/' . $foldername, $newfolderaccessmode)) {
352
-                        echo '<span class="warning"><b>' . $_lang['file_folder_chmod_error'] . '</b></span><br /><br />';
351
+                    if (!@chmod($startpath.'/'.$foldername, $newfolderaccessmode)) {
352
+                        echo '<span class="warning"><b>'.$_lang['file_folder_chmod_error'].'</b></span><br /><br />';
353 353
                     } else {
354
-                        echo '<span class="success"><b>' . $_lang['file_folder_created'] . '</b></span><br /><br />';
354
+                        echo '<span class="success"><b>'.$_lang['file_folder_created'].'</b></span><br /><br />';
355 355
                     }
356 356
                 }
357 357
                 umask($old_umask);
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
                 $filename = $modx->db->escape($filename);
364 364
 
365 365
                 if (!checkExtension($filename)) {
366
-                    echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />';
366
+                    echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />';
367 367
                 } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $filename) !== 0) {
368 368
                     echo $_lang['files.dynamic.php3'];
369 369
                 } else {
@@ -385,11 +385,11 @@  discard block
 block discarded – undo
385 385
                 $newFilename = $modx->db->escape($newFilename);
386 386
 
387 387
                 if (!checkExtension($newFilename)) {
388
-                    echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />';
388
+                    echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />';
389 389
                 } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newFilename) !== 0) {
390 390
                     echo $_lang['files.dynamic.php3'];
391 391
                 } else {
392
-                    if (!copy($filename, MODX_BASE_PATH . $newFilename)) {
392
+                    if (!copy($filename, MODX_BASE_PATH.$newFilename)) {
393 393
                         echo $_lang['files.dynamic.php5'];
394 394
                     }
395 395
                     umask($old_umask);
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
             // Rename folder here
399 399
             if ($_REQUEST['mode'] == 'renameFolder') {
400 400
                 $old_umask = umask(0);
401
-                $dirname = $_REQUEST['path'] . '/' . $_REQUEST['dirname'];
401
+                $dirname = $_REQUEST['path'].'/'.$_REQUEST['dirname'];
402 402
                 $dirname = $modx->db->escape($dirname);
403 403
                 $newDirname = str_replace(array(
404 404
                     '..\\',
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 
411 411
                 if (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newDirname) !== 0) {
412 412
                     echo $_lang['files.dynamic.php3'];
413
-                } else if (!rename($dirname, $_REQUEST['path'] . '/' . $newDirname)) {
413
+                } else if (!rename($dirname, $_REQUEST['path'].'/'.$newDirname)) {
414 414
                     echo '<span class="warning"><b>', $_lang['file_folder_not_created'], '</b></span><br /><br />';
415 415
                 }
416 416
                 umask($old_umask);
@@ -430,11 +430,11 @@  discard block
 block discarded – undo
430 430
                 $newFilename = $modx->db->escape($newFilename);
431 431
 
432 432
                 if (!checkExtension($newFilename)) {
433
-                    echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />';
433
+                    echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />';
434 434
                 } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newFilename) !== 0) {
435 435
                     echo $_lang['files.dynamic.php3'];
436 436
                 } else {
437
-                    if (!rename($filename, $path . '/' . $newFilename)) {
437
+                    if (!rename($filename, $path.'/'.$newFilename)) {
438 438
                         echo $_lang['files.dynamic.php5'];
439 439
                     }
440 440
                     umask($old_umask);
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
                 ls($startpath);
468 468
                 echo "\n\n\n";
469 469
                 if ($folders == 0 && $files == 0) {
470
-                    echo '<tr><td colspan="4"><i class="' . $_style['files_deleted_folder'] . ' FilesDeletedFolder"></i> <span style="color:#888;cursor:default;"> ' . $_lang['files_directory_is_empty'] . ' </span></td></tr>';
470
+                    echo '<tr><td colspan="4"><i class="'.$_style['files_deleted_folder'].' FilesDeletedFolder"></i> <span style="color:#888;cursor:default;"> '.$_lang['files_directory_is_empty'].' </span></td></tr>';
471 471
                 }
472 472
                 ?>
473 473
             </table>
@@ -476,10 +476,10 @@  discard block
 block discarded – undo
476 476
         <div class="container">
477 477
             <p>
478 478
                 <?php
479
-                echo $_lang['files_directories'] . ': <b>' . $folders . '</b> ';
480
-                echo $_lang['files_files'] . ': <b>' . $files . '</b> ';
481
-                echo $_lang['files_data'] . ': <b><span dir="ltr">' . $modx->nicesize($filesizes) . '</span></b> ';
482
-                echo $_lang['files_dirwritable'] . ' <b>' . (is_writable($startpath) == 1 ? $_lang['yes'] . '.' : $_lang['no']) . '.</b>'
479
+                echo $_lang['files_directories'].': <b>'.$folders.'</b> ';
480
+                echo $_lang['files_files'].': <b>'.$files.'</b> ';
481
+                echo $_lang['files_data'].': <b><span dir="ltr">'.$modx->nicesize($filesizes).'</span></b> ';
482
+                echo $_lang['files_dirwritable'].' <b>'.(is_writable($startpath) == 1 ? $_lang['yes'].'.' : $_lang['no']).'.</b>'
483 483
                 ?>
484 484
             </p>
485 485
 
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
                 </form>
505 505
                 <?php
506 506
             } else {
507
-                echo "<p>" . $_lang['files_upload_inhibited_msg'] . "</p>";
507
+                echo "<p>".$_lang['files_upload_inhibited_msg']."</p>";
508 508
             }
509 509
             ?>
510 510
             <div id="imageviewer"></div>
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 
573 573
 }
574 574
 
575
-if(!function_exists('determineIcon')) {
575
+if (!function_exists('determineIcon')) {
576 576
     /**
577 577
      * @param string $file
578 578
      * @param string $selFile
@@ -591,11 +591,11 @@  discard block
 block discarded – undo
591 591
             $icon = isset($icons[$mode]) ? $icons[$mode] : $icons['default'];
592 592
         }
593 593
 
594
-        return '<i class="' . $icon . ' FilesPage"></i>';
594
+        return '<i class="'.$icon.' FilesPage"></i>';
595 595
     }
596 596
 }
597 597
 
598
-if(!function_exists('markRow')) {
598
+if (!function_exists('markRow')) {
599 599
     /**
600 600
      * @param string $file
601 601
      * @param string $selFile
@@ -612,14 +612,14 @@  discard block
 block discarded – undo
612 612
         if ($file == $selFile) {
613 613
             $class = isset($classNames[$mode]) ? $classNames[$mode] : $classNames['default'];
614 614
 
615
-            return ' class="' . $class . '"';
615
+            return ' class="'.$class.'"';
616 616
         }
617 617
 
618 618
         return '';
619 619
     }
620 620
 }
621 621
 
622
-if(!function_exists('ls')) {
622
+if (!function_exists('ls')) {
623 623
     /**
624 624
      * @param string $curpath
625 625
      */
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
         global $excludes, $protected_path, $editablefiles, $inlineviewablefiles, $viewablefiles, $enablefileunzip, $enablefiledownload, $uploadablefiles, $folders, $files, $filesizes, $len, $dirs_array, $files_array, $webstart_path, $modx;
630 630
         $dircounter = 0;
631 631
         $filecounter = 0;
632
-        $curpath = str_replace('//', '/', $curpath . '/');
632
+        $curpath = str_replace('//', '/', $curpath.'/');
633 633
 
634 634
         if (!is_dir($curpath)) {
635 635
             echo 'Invalid path "', $curpath, '"<br />';
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 
641 641
         // first, get info
642 642
         foreach ($dir as $file) {
643
-            $newpath = $curpath . $file;
643
+            $newpath = $curpath.$file;
644 644
             if ($file === '..' || $file === '.') {
645 645
                 continue;
646 646
             }
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
                 if ($file === '..' || $file === '.') {
651 651
                     continue;
652 652
                 } elseif (!in_array($file, $excludes) && !in_array($newpath, $protected_path)) {
653
-                    $dirs_array[$dircounter]['text'] = '<i class="' . $_style['files_folder'] . ' FilesFolder"></i> <a href="index.php?a=31&mode=drill&path=' . urlencode($newpath) . '"><b>' . $file . '</b></a>';
653
+                    $dirs_array[$dircounter]['text'] = '<i class="'.$_style['files_folder'].' FilesFolder"></i> <a href="index.php?a=31&mode=drill&path='.urlencode($newpath).'"><b>'.$file.'</b></a>';
654 654
 
655 655
                     $dfiles = scandir($newpath);
656 656
                     foreach ($dfiles as $i => $infile) {
@@ -663,13 +663,13 @@  discard block
 block discarded – undo
663 663
                     }
664 664
                     $file_exists = (0 < count($dfiles)) ? 'file_exists' : '';
665 665
 
666
-                    $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<a href="javascript: deleteFolder(\'' . urlencode($file) . '\',\'' . $file_exists . '\');"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_folder'] . '"></i></a>' : '';
666
+                    $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<a href="javascript: deleteFolder(\''.urlencode($file).'\',\''.$file_exists.'\');"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_folder'].'"></i></a>' : '';
667 667
                 } else {
668
-                    $dirs_array[$dircounter]['text'] = '<span><i class="' . $_style['files_deleted_folder'] . ' FilesDeletedFolder"></i> ' . $file . '</span>';
669
-                    $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<span class="disabled"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_folder'] . '"></i></span>' : '';
668
+                    $dirs_array[$dircounter]['text'] = '<span><i class="'.$_style['files_deleted_folder'].' FilesDeletedFolder"></i> '.$file.'</span>';
669
+                    $dirs_array[$dircounter]['delete'] = is_writable($curpath) ? '<span class="disabled"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_folder'].'"></i></span>' : '';
670 670
                 }
671 671
 
672
-                $dirs_array[$dircounter]['rename'] = is_writable($curpath) ? '<a href="javascript:renameFolder(\'' . urlencode($file) . '\');"><i class="' . $_style['files_rename'] . '" title="' . $_lang['rename'] . '"></i></a> ' : '';
672
+                $dirs_array[$dircounter]['rename'] = is_writable($curpath) ? '<a href="javascript:renameFolder(\''.urlencode($file).'\');"><i class="'.$_style['files_rename'].'" title="'.$_lang['rename'].'"></i></a> ' : '';
673 673
 
674 674
                 // increment the counter
675 675
                 $dircounter++;
@@ -678,24 +678,24 @@  discard block
 block discarded – undo
678 678
                 $files_array[$filecounter]['file'] = $newpath;
679 679
                 $files_array[$filecounter]['stats'] = lstat($newpath);
680 680
                 $files_array[$filecounter]['text'] = determineIcon($newpath, $_REQUEST['path'],
681
-                        $_REQUEST['mode']) . ' ' . $file;
681
+                        $_REQUEST['mode']).' '.$file;
682 682
                 $files_array[$filecounter]['view'] = (in_array($type,
683
-                    $viewablefiles)) ? '<a href="javascript:;" onclick="viewfile(\'' . $webstart_path . substr($newpath,
683
+                    $viewablefiles)) ? '<a href="javascript:;" onclick="viewfile(\''.$webstart_path.substr($newpath,
684 684
                         $len,
685
-                        strlen($newpath)) . '\');"><i class="' . $_style['files_view'] . '" title="' . $_lang['files_viewfile'] . '"></i></a>' : (($enablefiledownload && in_array($type,
686
-                        $uploadablefiles)) ? '<a href="' . $webstart_path . implode('/', array_map('rawurlencode',
685
+                        strlen($newpath)).'\');"><i class="'.$_style['files_view'].'" title="'.$_lang['files_viewfile'].'"></i></a>' : (($enablefiledownload && in_array($type,
686
+                        $uploadablefiles)) ? '<a href="'.$webstart_path.implode('/', array_map('rawurlencode',
687 687
                         explode('/', substr($newpath, $len,
688
-                            strlen($newpath))))) . '" style="cursor:pointer;"><i class="' . $_style['files_download'] . '" title="' . $_lang['file_download_file'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_view'] . '" title="' . $_lang['files_viewfile'] . '"></i></span>');
688
+                            strlen($newpath))))).'" style="cursor:pointer;"><i class="'.$_style['files_download'].'" title="'.$_lang['file_download_file'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_view'].'" title="'.$_lang['files_viewfile'].'"></i></span>');
689 689
                 $files_array[$filecounter]['view'] = (in_array($type,
690
-                    $inlineviewablefiles)) ? '<a href="index.php?a=31&mode=view&path=' . urlencode($newpath) . '"><i class="' . $_style['files_view'] . '" title="' . $_lang['files_viewfile'] . '"></i></a>' : $files_array[$filecounter]['view'];
691
-                $files_array[$filecounter]['unzip'] = ($enablefileunzip && $type == '.zip') ? '<a href="javascript:unzipFile(\'' . urlencode($file) . '\');"><i class="' . $_style['files_unzip'] . '" title="' . $_lang['file_download_unzip'] . '"></i></a>' : '';
690
+                    $inlineviewablefiles)) ? '<a href="index.php?a=31&mode=view&path='.urlencode($newpath).'"><i class="'.$_style['files_view'].'" title="'.$_lang['files_viewfile'].'"></i></a>' : $files_array[$filecounter]['view'];
691
+                $files_array[$filecounter]['unzip'] = ($enablefileunzip && $type == '.zip') ? '<a href="javascript:unzipFile(\''.urlencode($file).'\');"><i class="'.$_style['files_unzip'].'" title="'.$_lang['file_download_unzip'].'"></i></a>' : '';
692 692
                 $files_array[$filecounter]['edit'] = (in_array($type,
693
-                        $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="index.php?a=31&mode=edit&path=' . urlencode($newpath) . '#file_editfile"><i class="' . $_style['files_edit'] . '" title="' . $_lang['files_editfile'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_edit'] . '" title="' . $_lang['files_editfile'] . '"></i></span>';
693
+                        $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="index.php?a=31&mode=edit&path='.urlencode($newpath).'#file_editfile"><i class="'.$_style['files_edit'].'" title="'.$_lang['files_editfile'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_edit'].'" title="'.$_lang['files_editfile'].'"></i></span>';
694 694
                 $files_array[$filecounter]['duplicate'] = (in_array($type,
695
-                        $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="javascript:duplicateFile(\'' . urlencode($file) . '\');"><i class="' . $_style['files_duplicate'] . '" title="' . $_lang['duplicate'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_duplicate'] . '" align="absmiddle" title="' . $_lang['duplicate'] . '"></i></span>';
695
+                        $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="javascript:duplicateFile(\''.urlencode($file).'\');"><i class="'.$_style['files_duplicate'].'" title="'.$_lang['duplicate'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_duplicate'].'" align="absmiddle" title="'.$_lang['duplicate'].'"></i></span>';
696 696
                 $files_array[$filecounter]['rename'] = (in_array($type,
697
-                        $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="javascript:renameFile(\'' . urlencode($file) . '\');"><i class="' . $_style['files_rename'] . '" align="absmiddle" title="' . $_lang['rename'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_rename'] . '" align="absmiddle" title="' . $_lang['rename'] . '"></i></span>';
698
-                $files_array[$filecounter]['delete'] = is_writable($curpath) && is_writable($newpath) ? '<a href="javascript:deleteFile(\'' . urlencode($file) . '\');"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_file'] . '"></i></a>' : '<span class="disabled"><i class="' . $_style['files_delete'] . '" title="' . $_lang['file_delete_file'] . '"></i></span>';
697
+                        $editablefiles) && is_writable($curpath) && is_writable($newpath)) ? '<a href="javascript:renameFile(\''.urlencode($file).'\');"><i class="'.$_style['files_rename'].'" align="absmiddle" title="'.$_lang['rename'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_rename'].'" align="absmiddle" title="'.$_lang['rename'].'"></i></span>';
698
+                $files_array[$filecounter]['delete'] = is_writable($curpath) && is_writable($newpath) ? '<a href="javascript:deleteFile(\''.urlencode($file).'\');"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_file'].'"></i></a>' : '<span class="disabled"><i class="'.$_style['files_delete'].'" title="'.$_lang['file_delete_file'].'"></i></span>';
699 699
 
700 700
                 // increment the counter
701 701
                 $filecounter++;
@@ -708,9 +708,9 @@  discard block
 block discarded – undo
708 708
         for ($i = 0; $i < $folders; $i++) {
709 709
             $filesizes += $dirs_array[$i]['stats']['7'];
710 710
             echo '<tr>';
711
-            echo '<td>' . $dirs_array[$i]['text'] . '</td>';
712
-            echo '<td class="text-nowrap">' . $modx->toDateFormat($dirs_array[$i]['stats']['9']) . '</td>';
713
-            echo '<td class="text-right">' . $modx->nicesize($dirs_array[$i]['stats']['7']) . '</td>';
711
+            echo '<td>'.$dirs_array[$i]['text'].'</td>';
712
+            echo '<td class="text-nowrap">'.$modx->toDateFormat($dirs_array[$i]['stats']['9']).'</td>';
713
+            echo '<td class="text-right">'.$modx->nicesize($dirs_array[$i]['stats']['7']).'</td>';
714 714
             echo '<td class="actions text-right">';
715 715
             echo $dirs_array[$i]['rename'];
716 716
             echo $dirs_array[$i]['delete'];
@@ -723,10 +723,10 @@  discard block
 block discarded – undo
723 723
         sort($files_array); // sorting the array alphabetically (Thanks pxl8r!)
724 724
         for ($i = 0; $i < $files; $i++) {
725 725
             $filesizes += $files_array[$i]['stats']['7'];
726
-            echo '<tr ' . markRow($files_array[$i]['file'], $_REQUEST['path'], $_REQUEST['mode']) . '>';
727
-            echo '<td>' . $files_array[$i]['text'] . '</td>';
728
-            echo '<td class="text-nowrap">' . $modx->toDateFormat($files_array[$i]['stats']['9']) . '</td>';
729
-            echo '<td class="text-right">' . $modx->nicesize($files_array[$i]['stats']['7']) . '</td>';
726
+            echo '<tr '.markRow($files_array[$i]['file'], $_REQUEST['path'], $_REQUEST['mode']).'>';
727
+            echo '<td>'.$files_array[$i]['text'].'</td>';
728
+            echo '<td class="text-nowrap">'.$modx->toDateFormat($files_array[$i]['stats']['9']).'</td>';
729
+            echo '<td class="text-right">'.$modx->nicesize($files_array[$i]['stats']['7']).'</td>';
730 730
             echo '<td class="actions text-right">';
731 731
             echo $files_array[$i]['unzip'];
732 732
             echo $files_array[$i]['view'];
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
     }
743 743
 }
744 744
 
745
-if(!function_exists('removeLastPath')) {
745
+if (!function_exists('removeLastPath')) {
746 746
     /**
747 747
      * @param string $string
748 748
      * @return bool|string
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
     }
761 761
 }
762 762
 
763
-if(!function_exists('getExtension')) {
763
+if (!function_exists('getExtension')) {
764 764
     /**
765 765
      * @param string $string
766 766
      * @return bool|string
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
     }
780 780
 }
781 781
 
782
-if(!function_exists('checkExtension')) {
782
+if (!function_exists('checkExtension')) {
783 783
     /**
784 784
      * @param string $path
785 785
      * @return bool
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
     }
797 797
 }
798 798
 
799
-if(!function_exists('mkdirs')) {
799
+if (!function_exists('mkdirs')) {
800 800
     /**
801 801
      * recursive mkdir function
802 802
      *
@@ -818,7 +818,7 @@  discard block
 block discarded – undo
818 818
     }
819 819
 }
820 820
 
821
-if(!function_exists('logFileChange')) {
821
+if (!function_exists('logFileChange')) {
822 822
     /**
823 823
      * @param string $type
824 824
      * @param string $filename
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
     }
855 855
 }
856 856
 
857
-if(!function_exists('unzip')) {
857
+if (!function_exists('unzip')) {
858 858
     /**
859 859
      * by patrick_allaert - php user notes
860 860
      *
@@ -878,17 +878,17 @@  discard block
 block discarded – undo
878 878
         $zip = zip_open($file);
879 879
         if ($zip) {
880 880
             $old_umask = umask(0);
881
-            $path = rtrim($path, '/') . '/';
881
+            $path = rtrim($path, '/').'/';
882 882
             while ($zip_entry = zip_read($zip)) {
883 883
                 if (zip_entry_filesize($zip_entry) > 0) {
884 884
                     // str_replace must be used under windows to convert "/" into "\"
885 885
                     $zip_entry_name = zip_entry_name($zip_entry);
886
-                    $complete_path = $path . str_replace('\\', '/', dirname($zip_entry_name));
887
-                    $complete_name = $path . str_replace('\\', '/', $zip_entry_name);
886
+                    $complete_path = $path.str_replace('\\', '/', dirname($zip_entry_name));
887
+                    $complete_name = $path.str_replace('\\', '/', $zip_entry_name);
888 888
                     if (!file_exists($complete_path)) {
889 889
                         $tmp = '';
890 890
                         foreach (explode('/', $complete_path) AS $k) {
891
-                            $tmp .= $k . '/';
891
+                            $tmp .= $k.'/';
892 892
                             if (!is_dir($tmp)) {
893 893
                                 mkdir($tmp, 0777);
894 894
                             }
@@ -909,14 +909,14 @@  discard block
 block discarded – undo
909 909
     }
910 910
 }
911 911
 
912
-if(!function_exists('rrmdir')) {
912
+if (!function_exists('rrmdir')) {
913 913
     /**
914 914
      * @param string $dir
915 915
      * @return bool
916 916
      */
917 917
     function rrmdir($dir)
918 918
     {
919
-        foreach (glob($dir . '/*') as $file) {
919
+        foreach (glob($dir.'/*') as $file) {
920 920
             if (is_dir($file)) {
921 921
                 rrmdir($file);
922 922
             } else {
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
     }
929 929
 }
930 930
 
931
-if(!function_exists('fileupload')) {
931
+if (!function_exists('fileupload')) {
932 932
     /**
933 933
      * @return string
934 934
      */
@@ -958,13 +958,13 @@  discard block
 block discarded – undo
958 958
             $userfile['type'] = $_FILES['userfile']['type'][$i];
959 959
 
960 960
             // this seems to be an upload action.
961
-            $path = $modx->config['site_url'] . substr($startpath, strlen($filemanager_path), strlen($startpath));
962
-            $path = rtrim($path, '/') . '/' . $userfile['name'];
961
+            $path = $modx->config['site_url'].substr($startpath, strlen($filemanager_path), strlen($startpath));
962
+            $path = rtrim($path, '/').'/'.$userfile['name'];
963 963
             $msg .= $path;
964 964
             if ($userfile['error'] == 0) {
965 965
                 $img = (strpos($userfile['type'],
966
-                        'image') !== false) ? '<br /><img src="' . $path . '" height="75" />' : '';
967
-                $msg .= "<p>" . $_lang['files_file_type'] . $userfile['type'] . ", " . $modx->nicesize(filesize($userfile['tmp_name'])) . $img . '</p>';
966
+                        'image') !== false) ? '<br /><img src="'.$path.'" height="75" />' : '';
967
+                $msg .= "<p>".$_lang['files_file_type'].$userfile['type'].", ".$modx->nicesize(filesize($userfile['tmp_name'])).$img.'</p>';
968 968
             }
969 969
 
970 970
             $userfilename = $userfile['tmp_name'];
@@ -972,15 +972,15 @@  discard block
 block discarded – undo
972 972
             if (is_uploaded_file($userfilename)) {
973 973
                 // file is uploaded file, process it!
974 974
                 if (!checkExtension($userfile['name'])) {
975
-                    $msg .= '<p><span class="warning">' . $_lang['files_filetype_notok'] . '</span></p>';
975
+                    $msg .= '<p><span class="warning">'.$_lang['files_filetype_notok'].'</span></p>';
976 976
                 } else {
977
-                    if (@move_uploaded_file($userfile['tmp_name'], $_POST['path'] . '/' . $userfile['name'])) {
977
+                    if (@move_uploaded_file($userfile['tmp_name'], $_POST['path'].'/'.$userfile['name'])) {
978 978
                         // Ryan: Repair broken permissions issue with file manager
979 979
                         if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
980
-                            @chmod($_POST['path'] . "/" . $userfile['name'], $new_file_permissions);
980
+                            @chmod($_POST['path']."/".$userfile['name'], $new_file_permissions);
981 981
                         }
982 982
                         // Ryan: End
983
-                        $msg .= '<p><span class="success">' . $_lang['files_upload_ok'] . '</span></p><hr/>';
983
+                        $msg .= '<p><span class="success">'.$_lang['files_upload_ok'].'</span></p><hr/>';
984 984
 
985 985
                         // invoke OnFileManagerUpload event
986 986
                         $modx->invokeEvent('OnFileManagerUpload', array(
@@ -988,13 +988,13 @@  discard block
 block discarded – undo
988 988
                             'filename' => $userfile['name']
989 989
                         ));
990 990
                         // Log the change
991
-                        logFileChange('upload', $_POST['path'] . '/' . $userfile['name']);
991
+                        logFileChange('upload', $_POST['path'].'/'.$userfile['name']);
992 992
                     } else {
993
-                        $msg .= '<p><span class="warning">' . $_lang['files_upload_copyfailed'] . '</span> ' . $_lang["files_upload_permissions_error"] . '</p>';
993
+                        $msg .= '<p><span class="warning">'.$_lang['files_upload_copyfailed'].'</span> '.$_lang["files_upload_permissions_error"].'</p>';
994 994
                     }
995 995
                 }
996 996
             } else {
997
-                $msg .= '<br /><span class="warning"><b>' . $_lang['files_upload_error'] . ':</b>';
997
+                $msg .= '<br /><span class="warning"><b>'.$_lang['files_upload_error'].':</b>';
998 998
                 switch ($userfile['error']) {
999 999
                     case 0: //no error; possible file attack!
1000 1000
                         $msg .= $_lang['files_upload_error0'];
@@ -1019,11 +1019,11 @@  discard block
 block discarded – undo
1019 1019
             }
1020 1020
         }
1021 1021
 
1022
-        return $msg . '<br/>';
1022
+        return $msg.'<br/>';
1023 1023
     }
1024 1024
 }
1025 1025
 
1026
-if(!function_exists('textsave')) {
1026
+if (!function_exists('textsave')) {
1027 1027
     /**
1028 1028
      * @return string
1029 1029
      */
@@ -1037,9 +1037,9 @@  discard block
 block discarded – undo
1037 1037
 
1038 1038
         // Write $content to our opened file.
1039 1039
         if (file_put_contents($filename, $content) === false) {
1040
-            $msg .= '<span class="warning"><b>' . $_lang['file_not_saved'] . '</b></span><br /><br />';
1040
+            $msg .= '<span class="warning"><b>'.$_lang['file_not_saved'].'</b></span><br /><br />';
1041 1041
         } else {
1042
-            $msg .= '<span class="success"><b>' . $_lang['file_saved'] . '</b></span><br /><br />';
1042
+            $msg .= '<span class="success"><b>'.$_lang['file_saved'].'</b></span><br /><br />';
1043 1043
             $_REQUEST['mode'] = 'edit';
1044 1044
         }
1045 1045
         // Log the change
@@ -1049,7 +1049,7 @@  discard block
 block discarded – undo
1049 1049
     }
1050 1050
 }
1051 1051
 
1052
-if(!function_exists('delete_file')) {
1052
+if (!function_exists('delete_file')) {
1053 1053
     /**
1054 1054
      * @return string
1055 1055
      */
@@ -1061,9 +1061,9 @@  discard block
 block discarded – undo
1061 1061
 
1062 1062
         $file = $_REQUEST['path'];
1063 1063
         if (!$token_check || !@unlink($file)) {
1064
-            $msg .= '<span class="warning"><b>' . $_lang['file_not_deleted'] . '</b></span><br /><br />';
1064
+            $msg .= '<span class="warning"><b>'.$_lang['file_not_deleted'].'</b></span><br /><br />';
1065 1065
         } else {
1066
-            $msg .= '<span class="success"><b>' . $_lang['file_deleted'] . '</b></span><br /><br />';
1066
+            $msg .= '<span class="success"><b>'.$_lang['file_deleted'].'</b></span><br /><br />';
1067 1067
         }
1068 1068
 
1069 1069
         // Log the change
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
     }
1074 1074
 }
1075 1075
 
1076
-if(!function_exists('parsePlaceholder')) {
1076
+if (!function_exists('parsePlaceholder')) {
1077 1077
     /**
1078 1078
      * @param string $tpl
1079 1079
      * @param array $ph
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
     }
1091 1091
 }
1092 1092
 
1093
-if(!function_exists('checkToken')) {
1093
+if (!function_exists('checkToken')) {
1094 1094
     /**
1095 1095
      * @return bool
1096 1096
      */
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
     }
1116 1116
 }
1117 1117
 
1118
-if(!function_exists('makeToken')) {
1118
+if (!function_exists('makeToken')) {
1119 1119
     /**
1120 1120
      * @return string
1121 1121
      */
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -887,7 +887,7 @@
 block discarded – undo
887 887
                     $complete_name = $path . str_replace('\\', '/', $zip_entry_name);
888 888
                     if (!file_exists($complete_path)) {
889 889
                         $tmp = '';
890
-                        foreach (explode('/', $complete_path) AS $k) {
890
+                        foreach (explode('/', $complete_path) as $k) {
891 891
                             $tmp .= $k . '/';
892 892
                             if (!is_dir($tmp)) {
893 893
                                 mkdir($tmp, 0777);
Please login to merge, or discard this patch.
manager/actions/import_site.static.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -357,7 +357,7 @@
 block discarded – undo
357 357
 if(!function_exists('getFileContent')) {
358 358
     /**
359 359
      * @param string $filepath
360
-     * @return bool|string
360
+     * @return null|string
361 361
      */
362 362
     function getFileContent($filepath)
363 363
     {
Please login to merge, or discard this patch.
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3
-	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3
+    die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 if(!$modx->hasPermission('import_static')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 // Files to upload
10 10
 $allowedfiles = array(
11
-	'html',
12
-	'htm',
13
-	'shtml',
14
-	'xml'
11
+    'html',
12
+    'htm',
13
+    'shtml',
14
+    'xml'
15 15
 );
16 16
 ?>
17 17
 	<script language="javascript">
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 	<div class="tab-page">
44 44
 		<div class="container container-body">
45 45
 			<?php
46
-			if(!isset($_POST['import'])) {
47
-				echo "<div class=\"element-edit-message\">" . $_lang['import_site_message'] . "</div>";
48
-				?>
46
+            if(!isset($_POST['import'])) {
47
+                echo "<div class=\"element-edit-message\">" . $_lang['import_site_message'] . "</div>";
48
+                ?>
49 49
 				<form action="index.php" method="post" name="importFrm">
50 50
 					<input type="hidden" name="import" value="import" />
51 51
 					<input type="hidden" name="a" value="95" />
@@ -85,18 +85,18 @@  discard block
 block discarded – undo
85 85
 					<a href="javascript:;" class="btn btn-primary" onclick="window.importFrm.submit();"><i class="<?= $_style["actions_save"] ?>"></i> <?= $_lang["import_site_start"] ?></a>
86 86
 				</form>
87 87
 			<?php
88
-			} else {
89
-			run();
90
-			$modx->clearCache('full');
91
-			?>
88
+            } else {
89
+            run();
90
+            $modx->clearCache('full');
91
+            ?>
92 92
 				<a href="javascript:;" class="btn btn-primary" onclick="window.location.href='index.php?a=2';"><i class="<?= $_style["actions_close"] ?>"></i> <?= $_lang["close"] ?></a>
93 93
 				<script type="text/javascript">
94 94
 					top.mainMenu.reloadtree();
95 95
 					parent.tree.ca = 'open';
96 96
 				</script>
97 97
 				<?php
98
-			}
99
-			?>
98
+            }
99
+            ?>
100 100
 		</div>
101 101
 	</div>
102 102
 
@@ -216,9 +216,9 @@  discard block
 block discarded – undo
216 216
                 $field['menuindex'] = 1;
217 217
                 $find = false;
218 218
                 foreach (array(
219
-                             'index.html',
220
-                             'index.htm'
221
-                         ) as $filename) {
219
+                                'index.html',
220
+                                'index.htm'
221
+                            ) as $filename) {
222 222
                     $filepath = $filedir . $alias . '/' . $filename;
223 223
                     if ($find === false && file_exists($filepath)) {
224 224
                         $file = getFileContent($filepath);
Please login to merge, or discard this patch.
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5
-if(!$modx->hasPermission('import_static')) {
5
+if (!$modx->hasPermission('import_static')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 	<div class="tab-page">
44 44
 		<div class="container container-body">
45 45
 			<?php
46
-			if(!isset($_POST['import'])) {
47
-				echo "<div class=\"element-edit-message\">" . $_lang['import_site_message'] . "</div>";
46
+			if (!isset($_POST['import'])) {
47
+				echo "<div class=\"element-edit-message\">".$_lang['import_site_message']."</div>";
48 48
 				?>
49 49
 				<form action="index.php" method="post" name="importFrm">
50 50
 					<input type="hidden" name="import" value="import" />
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	</div>
102 102
 
103 103
 <?php
104
-if(!function_exists('run')) {
104
+if (!function_exists('run')) {
105 105
     /**
106 106
      * @return string
107 107
      */
@@ -130,12 +130,12 @@  discard block
 block discarded – undo
130 130
             $modx->db->query("ALTER TABLE {$tbl_site_content} AUTO_INCREMENT = 1");
131 131
         }
132 132
 
133
-        $parent = (int)$_POST['parent'];
133
+        $parent = (int) $_POST['parent'];
134 134
 
135
-        if (is_dir(MODX_BASE_PATH . 'temp/import')) {
136
-            $filedir = MODX_BASE_PATH . 'temp/import/';
137
-        } elseif (is_dir(MODX_BASE_PATH . 'assets/import')) {
138
-            $filedir = MODX_BASE_PATH . 'assets/import/';
135
+        if (is_dir(MODX_BASE_PATH.'temp/import')) {
136
+            $filedir = MODX_BASE_PATH.'temp/import/';
137
+        } elseif (is_dir(MODX_BASE_PATH.'assets/import')) {
138
+            $filedir = MODX_BASE_PATH.'assets/import/';
139 139
         } else {
140 140
             $filedir = '';
141 141
         }
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
         $files = pop_index($files);
147 147
 
148 148
         // no. of files to import
149
-        $output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound);
149
+        $output .= sprintf('<p>'.$_lang['import_files_found'].'</p>', $filesfound);
150 150
 
151 151
         // import files
152 152
         if (0 < count($files)) {
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         $mtime = $mtime[1] + $mtime[0];
160 160
         $importend = $mtime;
161 161
         $totaltime = ($importend - $importstart);
162
-        $output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3));
162
+        $output .= sprintf('<p>'.$_lang['import_site_time'].'</p>', round($totaltime, 3));
163 163
 
164 164
         if ($_POST['convert_link'] == 'on') {
165 165
             convertLink();
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     }
170 170
 }
171 171
 
172
-if(!function_exists('importFiles')) {
172
+if (!function_exists('importFiles')) {
173 173
     /**
174 174
      * @param int $parent
175 175
      * @param string $filedir
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
             if (is_array($value)) {
201 201
                 // create folder
202 202
                 $alias = $id;
203
-                printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias);
203
+                printf('<span>'.$_lang['import_site_importing_document'].'</span>', $alias);
204 204
                 $field = array();
205 205
                 $field['type'] = 'document';
206 206
                 $field['contentType'] = 'text/html';
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
                              'index.html',
220 220
                              'index.htm'
221 221
                          ) as $filename) {
222
-                    $filepath = $filedir . $alias . '/' . $filename;
222
+                    $filepath = $filedir.$alias.'/'.$filename;
223 223
                     if ($find === false && file_exists($filepath)) {
224 224
                         $file = getFileContent($filepath);
225 225
                         list($pagetitle, $content, $description) = treatContent($file, $filename, $alias);
@@ -234,10 +234,10 @@  discard block
 block discarded – undo
234 234
                         $newid = $modx->db->insert($field, $tbl_site_content);
235 235
                         if ($newid) {
236 236
                             $find = true;
237
-                            echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
238
-                            importFiles($newid, $filedir . $alias . '/', $value, 'sub');
237
+                            echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n";
238
+                            importFiles($newid, $filedir.$alias.'/', $value, 'sub');
239 239
                         } else {
240
-                            echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError();
240
+                            echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError();
241 241
                             exit;
242 242
                         }
243 243
                     }
@@ -252,10 +252,10 @@  discard block
 block discarded – undo
252 252
                     $newid = $modx->db->insert($field, $tbl_site_content);
253 253
                     if ($newid) {
254 254
                         $find = true;
255
-                        echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
256
-                        importFiles($newid, $filedir . $alias . '/', $value, 'sub');
255
+                        echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n";
256
+                        importFiles($newid, $filedir.$alias.'/', $value, 'sub');
257 257
                     } else {
258
-                        echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError();
258
+                        echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError();
259 259
                         exit;
260 260
                     }
261 261
                 }
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
                 $fparts = explode('.', $value);
269 269
                 $alias = $fparts[0];
270 270
                 $ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : "";
271
-                printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename);
271
+                printf("<span>".$_lang['import_site_importing_document']."</span>", $filename);
272 272
 
273 273
                 if (!in_array($ext, $allowedfiles)) {
274
-                    echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n";
274
+                    echo ' - <span class="fail">'.$_lang["import_site_skip"].'</span><br />'."\n";
275 275
                 } else {
276
-                    $filepath = $filedir . $filename;
276
+                    $filepath = $filedir.$filename;
277 277
                     $file = getFileContent($filepath);
278 278
                     list($pagetitle, $content, $description) = treatContent($file, $filename, $alias);
279 279
 
@@ -299,9 +299,9 @@  discard block
 block discarded – undo
299 299
                     $field['menuindex'] = ($alias == 'index') ? 0 : 2;
300 300
                     $newid = $modx->db->insert($field, $tbl_site_content);
301 301
                     if ($newid) {
302
-                        echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
302
+                        echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n";
303 303
                     } else {
304
-                        echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError();
304
+                        echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError();
305 305
                         exit;
306 306
                     }
307 307
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
     }
321 321
 }
322 322
 
323
-if(!function_exists('getFiles')) {
323
+if (!function_exists('getFiles')) {
324 324
     /**
325 325
      * @param string $directory
326 326
      * @param array $listing
@@ -336,10 +336,10 @@  discard block
 block discarded – undo
336 336
             foreach ($files as $file) {
337 337
                 if ($file == '.' || $file == '..') {
338 338
                     continue;
339
-                } elseif ($h = @opendir($directory . $file . "/")) {
339
+                } elseif ($h = @opendir($directory.$file."/")) {
340 340
                     closedir($h);
341 341
                     $count = -1;
342
-                    $listing[$file] = getFiles($directory . $file . "/", array(), $count + 1);
342
+                    $listing[$file] = getFiles($directory.$file."/", array(), $count + 1);
343 343
                 } elseif (strpos($file, '.htm') !== false) {
344 344
                     $listing[$dummy] = $file;
345 345
                     $dummy = $dummy + 1;
@@ -347,14 +347,14 @@  discard block
 block discarded – undo
347 347
                 }
348 348
             }
349 349
         } else {
350
-            echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>";
350
+            echo '<p><span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_no_open_dir"].$directory.".</p>";
351 351
         }
352 352
 
353 353
         return ($listing);
354 354
     }
355 355
 }
356 356
 
357
-if(!function_exists('getFileContent')) {
357
+if (!function_exists('getFileContent')) {
358 358
     /**
359 359
      * @param string $filepath
360 360
      * @return bool|string
@@ -364,14 +364,14 @@  discard block
 block discarded – undo
364 364
         global $_lang;
365 365
         // get the file
366 366
         if (!$buffer = file_get_contents($filepath)) {
367
-            echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>";
367
+            echo '<p><span class="fail">'.$_lang['import_site_failed']."</span> ".$_lang["import_site_failed_no_retrieve_file"].$filepath.".</p>";
368 368
         } else {
369 369
             return $buffer;
370 370
         }
371 371
     }
372 372
 }
373 373
 
374
-if(!function_exists('pop_index')) {
374
+if (!function_exists('pop_index')) {
375 375
     /**
376 376
      * @param array $array
377 377
      * @return array
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
     }
397 397
 }
398 398
 
399
-if(!function_exists('treatContent')) {
399
+if (!function_exists('treatContent')) {
400 400
     /**
401 401
      * @param string $src
402 402
      * @param string $filename
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
         } else {
432 432
             $content = $src;
433 433
             $s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i';
434
-            $r = '$1' . $modx->config['modx_charset'] . '$2';
434
+            $r = '$1'.$modx->config['modx_charset'].'$2';
435 435
             $content = preg_replace($s, $r, $content);
436 436
             $content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content);
437 437
         }
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
     }
448 448
 }
449 449
 
450
-if(!function_exists('convertLink')) {
450
+if (!function_exists('convertLink')) {
451 451
     /**
452 452
      * @return void
453 453
      */
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
                     list($href, $v) = explode('"', $v, 2);
471 471
                     $_ = $href;
472 472
                     if (strpos($_, $modx->config['site_url']) !== false) {
473
-                        $_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_);
473
+                        $_ = $modx->config['base_url'].str_replace($modx->config['site_url'], '', $_);
474 474
                     }
475 475
                     if ($_[0] === '/') {
476 476
                         $_ = substr($_, 1);
@@ -497,15 +497,15 @@  discard block
 block discarded – undo
497 497
                     if (strpos($_, '/') !== false) {
498 498
                         $_ = substr($_, strrpos($_, '/'));
499 499
                     }
500
-                    $_ = $dir . str_replace('.html', '', $_);
500
+                    $_ = $dir.str_replace('.html', '', $_);
501 501
                     if (!isset($target[$_])) {
502 502
                         $target[$_] = $modx->getIdFromAlias($_);
503 503
                     }
504 504
                     $target[$_] = trim($target[$_]);
505 505
                     if (!empty($target[$_])) {
506
-                        $href = '[~' . $target[$_] . '~]';
506
+                        $href = '[~'.$target[$_].'~]';
507 507
                     }
508
-                    $array[$c] = '<a href="' . $href . '"' . $v;
508
+                    $array[$c] = '<a href="'.$href.'"'.$v;
509 509
                 }
510 510
                 $c++;
511 511
             }
Please login to merge, or discard this patch.
manager/includes/extenders/dbapi.mysql.class.inc.php 1 patch
Doc Comments   +12 added lines patch added patch discarded remove patch
@@ -268,6 +268,7 @@  discard block
 block discarded – undo
268 268
     /**
269 269
      * @name:  delete
270 270
      *
271
+     * @param string $from
271 272
      */
272 273
     public function delete($from, $where = '', $orderby = '', $limit = '')
273 274
     {
@@ -414,6 +415,9 @@  discard block
 block discarded – undo
414 415
         }
415 416
     }
416 417
 
418
+    /**
419
+     * @param string $table
420
+     */
417 421
     public function save($fields, $table, $where = '')
418 422
     {
419 423
 
@@ -444,6 +448,7 @@  discard block
 block discarded – undo
444 448
     /**
445 449
      * @name:  freeResult
446 450
      *
451
+     * @param mysqli_result $rs
447 452
      */
448 453
     public function freeResult($rs)
449 454
     {
@@ -554,6 +559,7 @@  discard block
 block discarded – undo
554 559
      * @name:  getColumn
555 560
      * @desc:  returns an array of the values found on colun $name
556 561
      * @param: $dsq - dataset or query string
562
+     * @param string $name
557 563
      */
558 564
     public function getColumn($name, $dsq)
559 565
     {
@@ -720,6 +726,9 @@  discard block
 block discarded – undo
720 726
         return $result;
721 727
     }
722 728
 
729
+    /**
730
+     * @param string $table_name
731
+     */
723 732
     public function optimize($table_name)
724 733
     {
725 734
         $rs = $this->query("OPTIMIZE TABLE {$table_name}");
@@ -730,6 +739,9 @@  discard block
 block discarded – undo
730 739
         return $rs;
731 740
     }
732 741
 
742
+    /**
743
+     * @param string $table_name
744
+     */
733 745
     public function truncate($table_name)
734 746
     {
735 747
         $rs = $this->query("TRUNCATE {$table_name}");
Please login to merge, or discard this patch.
manager/includes/functions/tv.php 4 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      *
173 173
      * @param string $param
174 174
      * @param array $tvsArray
175
-     * @return mixed
175
+     * @return string
176 176
      */
177 177
     function parseTvValues($param, $tvsArray)
178 178
     {
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
     /**
567 567
      * returns an array if a delimiter is present. returns array is a recordset is present
568 568
      *
569
-     * @param $src
569
+     * @param string $src
570 570
      * @param string $delim
571 571
      * @param string $type
572 572
      * @param bool $columns
@@ -1022,7 +1022,7 @@  discard block
 block discarded – undo
1022 1022
 
1023 1023
 if (! function_exists('ParseIntputOptions')) {
1024 1024
     /**
1025
-     * @param string|array|mysqli_result $v
1025
+     * @param string $v
1026 1026
      * @return array
1027 1027
      */
1028 1028
     function ParseIntputOptions($v)
Please login to merge, or discard this patch.
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (! function_exists('ProcessTVCommand')) {
3
+if (!function_exists('ProcessTVCommand')) {
4 4
     /**
5 5
      * @param string $value
6 6
      * @param string $name
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
     function ProcessTVCommand($value, $name = '', $docid = '', $src = 'docform', $tvsArray = array())
13 13
     {
14 14
         $modx = evolutionCMS();
15
-        $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier;
15
+        $docid = (int) $docid > 0 ? (int) $docid : $modx->documentIdentifier;
16 16
         $nvalue = trim($value);
17 17
         if (substr($nvalue, 0, 1) != '@') {
18 18
             return $value;
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
                         // if an inherited value is found and if there is content following the @INHERIT binding
78 78
                         // remove @INHERIT and output that following content. This content could contain other
79 79
                         // @ bindings, that are processed in the next step
80
-                        if ((string)$tv['value'] !== '' && !preg_match('%^@INHERIT[\s\n\r]*$%im', $tv['value'])) {
81
-                            $output = trim(str_replace('@INHERIT', '', (string)$tv['value']));
80
+                        if ((string) $tv['value'] !== '' && !preg_match('%^@INHERIT[\s\n\r]*$%im', $tv['value'])) {
81
+                            $output = trim(str_replace('@INHERIT', '', (string) $tv['value']));
82 82
                             break 2;
83 83
                         }
84 84
                     }
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
                 case 'DIRECTORY' :
88 88
                     $files = array();
89
-                    $path = $modx->config['base_path'] . $param;
89
+                    $path = $modx->config['base_path'].$param;
90 90
                     if (substr($path, -1, 1) != '/') {
91 91
                         $path .= '/';
92 92
                     }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     }
118 118
 }
119 119
 
120
-if (! function_exists('ProcessFile')) {
120
+if (!function_exists('ProcessFile')) {
121 121
     /**
122 122
      * @param $file
123 123
      * @return string
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     }
135 135
 }
136 136
 
137
-if (! function_exists('ParseCommand')) {
137
+if (!function_exists('ParseCommand')) {
138 138
     /**
139 139
      * ParseCommand - separate @ cmd from params
140 140
      *
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
         $binding_array = array();
157 157
         foreach ($BINDINGS as $cmd) {
158
-            if (strpos($binding_string, '@' . $cmd) === 0) {
158
+            if (strpos($binding_string, '@'.$cmd) === 0) {
159 159
                 $code = substr($binding_string, strlen($cmd) + 1);
160 160
                 $binding_array = array($cmd, trim($code));
161 161
                 break;
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
     }
167 167
 }
168 168
 
169
-if (! function_exists('parseTvValues')) {
169
+if (!function_exists('parseTvValues')) {
170 170
     /**
171 171
      * Parse MODX Template-Variables
172 172
      *
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     }
198 198
 }
199 199
 
200
-if (! function_exists('getTVDisplayFormat')) {
200
+if (!function_exists('getTVDisplayFormat')) {
201 201
     /**
202 202
      * @param string $name
203 203
      * @param string $value
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
         $o = '';
216 216
 
217 217
         // process any TV commands in value
218
-        $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier;
218
+        $docid = (int) $docid > 0 ? (int) $docid : $modx->documentIdentifier;
219 219
         $value = ProcessTVCommand($value, $name, $docid);
220 220
 
221 221
         $params = array();
@@ -254,12 +254,12 @@  discard block
 block discarded – undo
254 254
                             $attr['align'] = $params['align'];
255 255
                         }
256 256
                         foreach ($attr as $k => $v) {
257
-                            $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
257
+                            $attributes .= ($v ? ' '.$k.'="'.$v.'"' : '');
258 258
                         }
259
-                        $attributes .= ' ' . $params['attrib'];
259
+                        $attributes .= ' '.$params['attrib'];
260 260
 
261 261
                         // Output the image with attributes
262
-                        $o .= '<img' . rtrim($attributes) . ' />';
262
+                        $o .= '<img'.rtrim($attributes).' />';
263 263
                     }
264 264
                 }
265 265
                 break;
@@ -331,12 +331,12 @@  discard block
 block discarded – undo
331 331
                             'target' => $params['target'],
332 332
                         );
333 333
                         foreach ($attr as $k => $v) {
334
-                            $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
334
+                            $attributes .= ($v ? ' '.$k.'="'.$v.'"' : '');
335 335
                         }
336
-                        $attributes .= ' ' . $params['attrib']; // add extra
336
+                        $attributes .= ' '.$params['attrib']; // add extra
337 337
 
338 338
                         // Output the link
339
-                        $o .= '<a' . rtrim($attributes) . '>' . ($params['text'] ? $modx->htmlspecialchars($params['text']) : $name) . '</a>';
339
+                        $o .= '<a'.rtrim($attributes).'>'.($params['text'] ? $modx->htmlspecialchars($params['text']) : $name).'</a>';
340 340
                     }
341 341
                 }
342 342
                 break;
@@ -362,12 +362,12 @@  discard block
 block discarded – undo
362 362
                         'style' => $params['style'],
363 363
                     );
364 364
                     foreach ($attr as $k => $v) {
365
-                        $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
365
+                        $attributes .= ($v ? ' '.$k.'="'.$v.'"' : '');
366 366
                     }
367
-                    $attributes .= ' ' . $params['attrib']; // add extra
367
+                    $attributes .= ' '.$params['attrib']; // add extra
368 368
 
369 369
                     // Output the HTML Tag
370
-                    $o .= '<' . $tagname . rtrim($attributes) . '>' . $tagvalue . '</' . $tagname . '>';
370
+                    $o .= '<'.$tagname.rtrim($attributes).'>'.$tagvalue.'</'.$tagname.'>';
371 371
                 }
372 372
                 break;
373 373
 
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
                 $w = $params['w'] ? $params['w'] : '100%';
377 377
                 $h = $params['h'] ? $params['h'] : '400px';
378 378
                 $richtexteditor = $params['edt'] ? $params['edt'] : "";
379
-                $o = '<div class="MODX_RichTextWidget"><textarea id="' . $id . '" name="' . $id . '" style="width:' . $w . '; height:' . $h . ';">';
379
+                $o = '<div class="MODX_RichTextWidget"><textarea id="'.$id.'" name="'.$id.'" style="width:'.$w.'; height:'.$h.';">';
380 380
                 $o .= $modx->htmlspecialchars($value);
381 381
                 $o .= '</textarea></div>';
382 382
                 $replace_richtext = array($id);
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 
404 404
             case "viewport":
405 405
                 $value = parseInput($value);
406
-                $id = '_' . time();
406
+                $id = '_'.time();
407 407
                 if (!$params['vpid']) {
408 408
                     $params['vpid'] = $id;
409 409
                 }
@@ -417,41 +417,41 @@  discard block
 block discarded – undo
417 417
                     $h = "100%";
418 418
                 }
419 419
                 if ($params['asize'] == 'Yes' || ($params['awidth'] == 'Yes' && $params['aheight'] == 'Yes')) {
420
-                    $autoMode = "3";  //both
420
+                    $autoMode = "3"; //both
421 421
                 } else {
422 422
                     if ($params['awidth'] == 'Yes') {
423 423
                         $autoMode = "1"; //width only
424 424
                     } else {
425 425
                         if ($params['aheight'] == 'Yes') {
426
-                            $autoMode = "2";    //height only
426
+                            $autoMode = "2"; //height only
427 427
                         }
428 428
                     }
429 429
                 }
430 430
 
431
-                $modx->regClientStartupScript(MODX_MANAGER_URL . "media/script/bin/viewport.js", array(
431
+                $modx->regClientStartupScript(MODX_MANAGER_URL."media/script/bin/viewport.js", array(
432 432
                     'name'      => 'viewport',
433 433
                     'version'   => '0',
434 434
                     'plaintext' => false
435 435
                 ));
436
-                $o = $sTag . " id='" . $params['vpid'] . "' name='" . $params['vpid'] . "' ";
436
+                $o = $sTag." id='".$params['vpid']."' name='".$params['vpid']."' ";
437 437
                 if ($params['class']) {
438
-                    $o .= " class='" . $params['class'] . "' ";
438
+                    $o .= " class='".$params['class']."' ";
439 439
                 }
440 440
                 if ($params['style']) {
441
-                    $o .= " style='" . $params['style'] . "' ";
441
+                    $o .= " style='".$params['style']."' ";
442 442
                 }
443 443
                 if ($params['attrib']) {
444
-                    $o .= $params['attrib'] . " ";
444
+                    $o .= $params['attrib']." ";
445 445
                 }
446
-                $o .= "scrolling='" . ($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto")) . "' ";
447
-                $o .= "src='" . $value . "' frameborder='" . $params['borsize'] . "' ";
448
-                $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'" . $params['vpid'] . "\\'," . $autoMode . ")',100);\" width='" . $w . "' height='" . $h . "' ";
446
+                $o .= "scrolling='".($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto"))."' ";
447
+                $o .= "src='".$value."' frameborder='".$params['borsize']."' ";
448
+                $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'".$params['vpid']."\\',".$autoMode.")',100);\" width='".$w."' height='".$h."' ";
449 449
                 $o .= ">";
450 450
                 $o .= $eTag;
451 451
                 break;
452 452
 
453 453
             case "datagrid":
454
-                include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php";
454
+                include_once MODX_MANAGER_PATH."includes/controls/datagrid.class.php";
455 455
                 $grd = new DataGrid('', $value);
456 456
 
457 457
                 $grd->noRecordMsg = $params['egmsg'];
@@ -498,16 +498,16 @@  discard block
 block discarded – undo
498 498
                 $o = '';
499 499
                 /* If we are loading a file */
500 500
                 if (substr($params['output'], 0, 5) == "@FILE") {
501
-                    $file_name = MODX_BASE_PATH . trim(substr($params['output'], 6));
501
+                    $file_name = MODX_BASE_PATH.trim(substr($params['output'], 6));
502 502
                     if (!file_exists($file_name)) {
503
-                        $widget_output = $file_name . ' does not exist';
503
+                        $widget_output = $file_name.' does not exist';
504 504
                     } else {
505 505
                         $widget_output = file_get_contents($file_name);
506 506
                     }
507 507
                 } elseif (substr($params['output'], 0, 8) == '@INCLUDE') {
508
-                    $file_name = MODX_BASE_PATH . trim(substr($params['output'], 9));
508
+                    $file_name = MODX_BASE_PATH.trim(substr($params['output'], 9));
509 509
                     if (!file_exists($file_name)) {
510
-                        $widget_output = $file_name . ' does not exist';
510
+                        $widget_output = $file_name.' does not exist';
511 511
                     } else {
512 512
                         /* The included file needs to set $widget_output. Can be string, array, object */
513 513
                         include $file_name;
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
     }
550 550
 }
551 551
 
552
-if (! function_exists('decodeParamValue')) {
552
+if (!function_exists('decodeParamValue')) {
553 553
     /**
554 554
      * @param string $s
555 555
      * @return string
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
     }
563 563
 }
564 564
 
565
-if (! function_exists('parseInput')) {
565
+if (!function_exists('parseInput')) {
566 566
     /**
567 567
      * returns an array if a delimiter is present. returns array is a recordset is present
568 568
      *
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
     }
595 595
 }
596 596
 
597
-if (! function_exists('getUnixtimeFromDateString')) {
597
+if (!function_exists('getUnixtimeFromDateString')) {
598 598
     /**
599 599
      * @param string $value
600 600
      * @return bool|false|int
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
     }
623 623
 }
624 624
 
625
-if (! function_exists('renderFormElement')) {
625
+if (!function_exists('renderFormElement')) {
626 626
     /**
627 627
      * DISPLAY FORM ELEMENTS
628 628
      *
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
         $field_style = '',
646 646
         $row = array(),
647 647
         $tvsArray = array()
648
-    ) {
648
+    ){
649 649
         $modx = evolutionCMS();
650 650
         global $_style;
651 651
         global $_lang;
@@ -665,22 +665,22 @@  discard block
 block discarded – undo
665 665
 
666 666
                 case "text": // handler for regular text boxes
667 667
                 case "rawtext"; // non-htmlentity converted text boxes
668
-                    $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" />';
668
+                    $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%" />';
669 669
                     break;
670 670
                 case "email": // handles email input fields
671
-                    $field_html .= '<input type="email" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%"/>';
671
+                    $field_html .= '<input type="email" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%"/>';
672 672
                     break;
673 673
                 case "number": // handles the input of numbers
674
-                    $field_html .= '<input type="number" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>';
674
+                    $field_html .= '<input type="number" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>';
675 675
                     break;
676 676
                 case "textareamini": // handler for textarea mini boxes
677
-                    $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>';
677
+                    $field_html .= '<textarea id="tv'.$field_id.'" name="tv'.$field_id.'" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">'.$modx->htmlspecialchars($field_value).'</textarea>';
678 678
                     break;
679 679
                 case "textarea": // handler for textarea boxes
680 680
                 case "rawtextarea": // non-htmlentity convertex textarea boxes
681 681
                 case "htmlarea": // handler for textarea boxes (deprecated)
682 682
                 case "richtext": // handler for textarea boxes
683
-                    $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>';
683
+                    $field_html .= '<textarea id="tv'.$field_id.'" name="tv'.$field_id.'" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">'.$modx->htmlspecialchars($field_value).'</textarea>';
684 684
                     break;
685 685
                 case "date":
686 686
                     $field_id = str_replace(array(
@@ -690,12 +690,12 @@  discard block
 block discarded – undo
690 690
                     if ($field_value == '') {
691 691
                         $field_value = 0;
692 692
                     }
693
-                    $field_html .= '<input id="tv' . $field_id . '" name="tv' . $field_id . '" class="DatePicker" type="text" value="' . ($field_value == 0 || !isset($field_value) ? "" : $field_value) . '" onblur="documentDirty=true;" />';
694
-                    $field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].value=\'\';document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="' . $_style["actions_calendar_delete"] . '"></i></a>';
693
+                    $field_html .= '<input id="tv'.$field_id.'" name="tv'.$field_id.'" class="DatePicker" type="text" value="'.($field_value == 0 || !isset($field_value) ? "" : $field_value).'" onblur="documentDirty=true;" />';
694
+                    $field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv'.$field_id.'\'].value=\'\';document.forms[\'mutate\'].elements[\'tv'.$field_id.'\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="'.$_style["actions_calendar_delete"].'"></i></a>';
695 695
 
696 696
                     break;
697 697
                 case "dropdown": // handler for select boxes
698
-                    $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" size="1" onchange="documentDirty=true;">';
698
+                    $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'" size="1" onchange="documentDirty=true;">';
699 699
                     $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform',
700 700
                         $tvsArray));
701 701
                     while (list($item, $itemvalue) = each($index_list)) {
@@ -703,12 +703,12 @@  discard block
 block discarded – undo
703 703
                         if (strlen($itemvalue) == 0) {
704 704
                             $itemvalue = $item;
705 705
                         }
706
-                        $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>';
706
+                        $field_html .= '<option value="'.$modx->htmlspecialchars($itemvalue).'"'.($itemvalue == $field_value ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($item).'</option>';
707 707
                     }
708 708
                     $field_html .= "</select>";
709 709
                     break;
710 710
                 case "listbox": // handler for select boxes
711
-                    $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" onchange="documentDirty=true;" size="8">';
711
+                    $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'" onchange="documentDirty=true;" size="8">';
712 712
                     $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform',
713 713
                         $tvsArray));
714 714
                     while (list($item, $itemvalue) = each($index_list)) {
@@ -716,13 +716,13 @@  discard block
 block discarded – undo
716 716
                         if (strlen($itemvalue) == 0) {
717 717
                             $itemvalue = $item;
718 718
                         }
719
-                        $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>';
719
+                        $field_html .= '<option value="'.$modx->htmlspecialchars($itemvalue).'"'.($itemvalue == $field_value ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($item).'</option>';
720 720
                     }
721 721
                     $field_html .= "</select>";
722 722
                     break;
723 723
                 case "listbox-multiple": // handler for select boxes where you can choose multiple items
724 724
                     $field_value = explode("||", $field_value);
725
-                    $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '[]" multiple="multiple" onchange="documentDirty=true;" size="8">';
725
+                    $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'[]" multiple="multiple" onchange="documentDirty=true;" size="8">';
726 726
                     $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform',
727 727
                         $tvsArray));
728 728
                     while (list($item, $itemvalue) = each($index_list)) {
@@ -730,8 +730,8 @@  discard block
 block discarded – undo
730 730
                         if (strlen($itemvalue) == 0) {
731 731
                             $itemvalue = $item;
732 732
                         }
733
-                        $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . (in_array($itemvalue,
734
-                                $field_value) ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>';
733
+                        $field_html .= '<option value="'.$modx->htmlspecialchars($itemvalue).'"'.(in_array($itemvalue,
734
+                                $field_value) ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($item).'</option>';
735 735
                     }
736 736
                     $field_html .= "</select>";
737 737
                     break;
@@ -743,17 +743,17 @@  discard block
 block discarded – undo
743 743
                         'ftp://'   => 'ftp://',
744 744
                         'mailto:'  => 'mailto:'
745 745
                     );
746
-                    $field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv' . $field_id . '_prefix" name="tv' . $field_id . '_prefix" onchange="documentDirty=true;">';
746
+                    $field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv'.$field_id.'_prefix" name="tv'.$field_id.'_prefix" onchange="documentDirty=true;">';
747 747
                     foreach ($urls as $k => $v) {
748 748
                         if (strpos($field_value, $v) === false) {
749
-                            $field_html .= '<option value="' . $v . '">' . $k . '</option>';
749
+                            $field_html .= '<option value="'.$v.'">'.$k.'</option>';
750 750
                         } else {
751 751
                             $field_value = str_replace($v, '', $field_value);
752
-                            $field_html .= '<option value="' . $v . '" selected="selected">' . $k . '</option>';
752
+                            $field_html .= '<option value="'.$v.'" selected="selected">'.$k.'</option>';
753 753
                         }
754 754
                     }
755 755
                     $field_html .= '</select></td><td>';
756
-                    $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" width="100" ' . $field_style . ' onchange="documentDirty=true;" /></td></tr></table>';
756
+                    $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" width="100" '.$field_style.' onchange="documentDirty=true;" /></td></tr></table>';
757 757
                     break;
758 758
                 case 'checkbox': // handles check boxes
759 759
                     $values = !is_array($field_value) ? explode('||', $field_value) : $field_value;
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
                         if (strlen($itemvalue) == 0) {
796 796
                             $itemvalue = $item;
797 797
                         }
798
-                        $field_html .= '<input type="radio" value="' . $modx->htmlspecialchars($itemvalue) . '" id="tv_' . $i . '" name="tv' . $field_id . '" ' . ($itemvalue == $field_value ? 'checked="checked"' : '') . ' onchange="documentDirty=true;" /><label for="tv_' . $i . '" class="radio">' . $item . '</label><br />';
798
+                        $field_html .= '<input type="radio" value="'.$modx->htmlspecialchars($itemvalue).'" id="tv_'.$i.'" name="tv'.$field_id.'" '.($itemvalue == $field_value ? 'checked="checked"' : '').' onchange="documentDirty=true;" /><label for="tv_'.$i.'" class="radio">'.$item.'</label><br />';
799 799
                         $i++;
800 800
                     }
801 801
                     break;
@@ -825,13 +825,13 @@  discard block
 block discarded – undo
825 825
 									lastImageCtrl = ctrl;
826 826
 									var w = screen.width * 0.5;
827 827
 									var h = screen.height * 0.5;
828
-									OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=images', w, h);
828
+									OpenServerBrowser('" . MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=images', w, h);
829 829
 								}
830 830
 								function BrowseFileServer(ctrl) {
831 831
 									lastFileCtrl = ctrl;
832 832
 									var w = screen.width * 0.5;
833 833
 									var h = screen.height * 0.5;
834
-									OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=files', w, h);
834
+									OpenServerBrowser('".MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=files', w, h);
835 835
 								}
836 836
 								function SetUrlChange(el) {
837 837
 									if ('createEvent' in document) {
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
 						</script>";
866 866
                         $ResourceManagerLoaded = true;
867 867
                     }
868
-                    $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '"  value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseServer(\'tv' . $field_id . '\')" />';
868
+                    $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'"  value="'.$field_value.'" '.$field_style.' onchange="documentDirty=true;" /><input type="button" value="'.$_lang['insert'].'" onclick="BrowseServer(\'tv'.$field_id.'\')" />';
869 869
                     break;
870 870
                 case "file": // handles the input of file uploads
871 871
                     /* Modified by Timon for use with resource browser */
@@ -895,13 +895,13 @@  discard block
 block discarded – undo
895 895
 									lastImageCtrl = ctrl;
896 896
 									var w = screen.width * 0.5;
897 897
 									var h = screen.height * 0.5;
898
-									OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=images', w, h);
898
+									OpenServerBrowser('" . MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=images', w, h);
899 899
 								}
900 900
 								function BrowseFileServer(ctrl) {
901 901
 									lastFileCtrl = ctrl;
902 902
 									var w = screen.width * 0.5;
903 903
 									var h = screen.height * 0.5;
904
-									OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=files', w, h);
904
+									OpenServerBrowser('".MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=files', w, h);
905 905
 								}
906 906
 								function SetUrlChange(el) {
907 907
 									if ('createEvent' in document) {
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
 						</script>";
936 936
                         $ResourceManagerLoaded = true;
937 937
                     }
938
-                    $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '"  value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseFileServer(\'tv' . $field_id . '\')" />';
938
+                    $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'"  value="'.$field_value.'" '.$field_style.' onchange="documentDirty=true;" /><input type="button" value="'.$_lang['insert'].'" onclick="BrowseFileServer(\'tv'.$field_id.'\')" />';
939 939
 
940 940
                     break;
941 941
 
@@ -943,16 +943,16 @@  discard block
 block discarded – undo
943 943
                     $custom_output = '';
944 944
                     /* If we are loading a file */
945 945
                     if (substr($field_elements, 0, 5) == "@FILE") {
946
-                        $file_name = MODX_BASE_PATH . trim(substr($field_elements, 6));
946
+                        $file_name = MODX_BASE_PATH.trim(substr($field_elements, 6));
947 947
                         if (!file_exists($file_name)) {
948
-                            $custom_output = $file_name . ' does not exist';
948
+                            $custom_output = $file_name.' does not exist';
949 949
                         } else {
950 950
                             $custom_output = file_get_contents($file_name);
951 951
                         }
952 952
                     } elseif (substr($field_elements, 0, 8) == '@INCLUDE') {
953
-                        $file_name = MODX_BASE_PATH . trim(substr($field_elements, 9));
953
+                        $file_name = MODX_BASE_PATH.trim(substr($field_elements, 9));
954 954
                         if (!file_exists($file_name)) {
955
-                            $custom_output = $file_name . ' does not exist';
955
+                            $custom_output = $file_name.' does not exist';
956 956
                         } else {
957 957
                             ob_start();
958 958
                             include $file_name;
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
                         $chunk_name = trim(substr($field_elements, 7));
964 964
                         $chunk_body = $modx->getChunk($chunk_name);
965 965
                         if ($chunk_body == false) {
966
-                            $custom_output = $_lang['chunk_no_exist'] . '(' . $_lang['htmlsnippet_name'] . ':' . $chunk_name . ')';
966
+                            $custom_output = $_lang['chunk_no_exist'].'('.$_lang['htmlsnippet_name'].':'.$chunk_name.')';
967 967
                         } else {
968 968
                             $custom_output = $chunk_body;
969 969
                         }
@@ -988,15 +988,15 @@  discard block
 block discarded – undo
988 988
                     break;
989 989
 
990 990
                 default: // the default handler -- for errors, mostly
991
-                    $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' onchange="documentDirty=true;" />';
991
+                    $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' onchange="documentDirty=true;" />';
992 992
 
993 993
             } // end switch statement
994 994
         } else {
995 995
             $custom = explode(":", $field_type);
996 996
             $custom_output = '';
997
-            $file_name = MODX_BASE_PATH . 'assets/tvs/' . $custom['1'] . '/' . $custom['1'] . '.customtv.php';
997
+            $file_name = MODX_BASE_PATH.'assets/tvs/'.$custom['1'].'/'.$custom['1'].'.customtv.php';
998 998
             if (!file_exists($file_name)) {
999
-                $custom_output = $file_name . ' does not exist';
999
+                $custom_output = $file_name.' does not exist';
1000 1000
             } else {
1001 1001
                 ob_start();
1002 1002
                 include $file_name;
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
     } // end renderFormElement function
1021 1021
 }
1022 1022
 
1023
-if (! function_exists('ParseIntputOptions')) {
1023
+if (!function_exists('ParseIntputOptions')) {
1024 1024
     /**
1025 1025
      * @param string|array|mysqli_result $v
1026 1026
      * @return array
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -573,7 +573,8 @@
 block discarded – undo
573 573
      * @return array|string
574 574
      */
575 575
     function parseInput($src, $delim = "||", $type = "string", $columns = true)
576
-    { // type can be: string, array
576
+    {
577
+// type can be: string, array
577 578
         $modx = evolutionCMS();
578 579
         if ($modx->db->isResult($src)) {
579 580
             // must be a recordset
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
                         $modx->setPlaceholder($rvKey, $rvValue);
52 52
                     }
53 53
                     $param = $modx->mergePlaceholderContent($param);
54
-                    $rs = $modx->db->query("SELECT $param;");
54
+                    $rs = $modx->db->query("select $param;");
55 55
                     $output = $rs;
56 56
                     break;
57 57
 
Please login to merge, or discard this patch.
manager/includes/src/Core.php 2 patches
Doc Comments   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
      * MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php"
267 267
      * $extname - extension name in lowercase
268 268
      *
269
-     * @param $extname
269
+     * @param string $extname
270 270
      * @param bool $reload
271 271
      * @return bool
272 272
      */
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
      * @param int $count_attempts
310 310
      * @param string $type $type
311 311
      * @param string $responseCode
312
-     * @return bool|null
312
+     * @return false|null
313 313
      * @global string $base_url
314 314
      * @global string $site_url
315 315
      */
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
     }
1011 1011
 
1012 1012
     /**
1013
-     * @param $contents
1013
+     * @param string $contents
1014 1014
      * @return mixed
1015 1015
      */
1016 1016
     public function RecoveryEscapedTags($contents)
@@ -1034,7 +1034,7 @@  discard block
 block discarded – undo
1034 1034
     }
1035 1035
 
1036 1036
     /**
1037
-     * @param $tstart
1037
+     * @param double $tstart
1038 1038
      * @return array
1039 1039
      */
1040 1040
     public function getTimerStats($tstart)
@@ -1800,7 +1800,7 @@  discard block
 block discarded – undo
1800 1800
 
1801 1801
     /**
1802 1802
      * Remove Comment-Tags from output like <!--@- Comment -@-->
1803
-     * @param $content
1803
+     * @param string $content
1804 1804
      * @param string $left
1805 1805
      * @param string $right
1806 1806
      * @return mixed
@@ -1973,7 +1973,7 @@  discard block
 block discarded – undo
1973 1973
     /**
1974 1974
      * Run snippets as per the tags in $documentSource and replace the tags with the returned values.
1975 1975
      *
1976
-     * @param $content
1976
+     * @param string $content
1977 1977
      * @return string
1978 1978
      * @internal param string $documentSource
1979 1979
      */
@@ -3008,7 +3008,7 @@  discard block
 block discarded – undo
3008 3008
 
3009 3009
     /**
3010 3010
      * @param $templateID
3011
-     * @return mixed
3011
+     * @return string
3012 3012
      */
3013 3013
     public function _getTemplateCodeFromDB($templateID)
3014 3014
     {
@@ -3051,7 +3051,7 @@  discard block
 block discarded – undo
3051 3051
     /**
3052 3052
      * @param $id
3053 3053
      * @param int $top
3054
-     * @return mixed
3054
+     * @return string
3055 3055
      */
3056 3056
     public function getUltimateParentId($id, $top = 0)
3057 3057
     {
@@ -3391,7 +3391,7 @@  discard block
 block discarded – undo
3391 3391
      *
3392 3392
      * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role
3393 3393
      * @param int $id Element- / Resource-id
3394
-     * @return bool
3394
+     * @return false|null
3395 3395
      */
3396 3396
     public function lockElement($type, $id)
3397 3397
     {
@@ -3413,7 +3413,7 @@  discard block
 block discarded – undo
3413 3413
      * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role
3414 3414
      * @param int $id Element- / Resource-id
3415 3415
      * @param bool $includeAllUsers true = Deletes not only own user-locks
3416
-     * @return bool
3416
+     * @return false|null
3417 3417
      */
3418 3418
     public function unlockElement($type, $id, $includeAllUsers = false)
3419 3419
     {
@@ -3927,7 +3927,7 @@  discard block
 block discarded – undo
3927 3927
      *                     Default: 1
3928 3928
      * @param string $fields List of fields
3929 3929
      *                       Default: id, pagetitle, description, alias
3930
-     * @return boolean|array
3930
+     * @return string
3931 3931
      */
3932 3932
     public function getPageInfo($pageid = -1, $active = 1, $fields = 'id, pagetitle, description, alias')
3933 3933
     {
@@ -4019,7 +4019,7 @@  discard block
 block discarded – undo
4019 4019
      *
4020 4020
      * @param string $type
4021 4021
      * @param bool $report
4022
-     * @return bool
4022
+     * @return boolean|null
4023 4023
      */
4024 4024
     public function clearCache($type = '', $report = false)
4025 4025
     {
@@ -4385,7 +4385,7 @@  discard block
 block discarded – undo
4385 4385
      * - Placeholders prefix. Default: '{'.
4386 4386
      * @param string $suffix {string}
4387 4387
      * - Placeholders suffix. Default: '}'.
4388
-     * @return bool|mixed|string {string; false} - Parsed chunk or false if $chunkArr is not array.
4388
+     * @return false|string {string; false} - Parsed chunk or false if $chunkArr is not array.
4389 4389
      * - Parsed chunk or false if $chunkArr is not array.
4390 4390
      */
4391 4391
     public function parseChunk($chunkName, $chunkArr, $prefix = '{', $suffix = '}')
@@ -5357,7 +5357,7 @@  discard block
 block discarded – undo
5357 5357
      * Remove event listener - only for use within the current execution cycle
5358 5358
      *
5359 5359
      * @param string $evtName
5360
-     * @return boolean
5360
+     * @return false|null
5361 5361
      */
5362 5362
     public function removeEventListener($evtName)
5363 5363
     {
@@ -5381,7 +5381,7 @@  discard block
 block discarded – undo
5381 5381
      *
5382 5382
      * @param string $evtName
5383 5383
      * @param array $extParams Parameters available to plugins. Each array key will be the PHP variable name, and the array value will be the variable value.
5384
-     * @return boolean|array
5384
+     * @return false|null
5385 5385
      */
5386 5386
     public function invokeEvent($evtName, $extParams = array())
5387 5387
     {
@@ -5976,7 +5976,7 @@  discard block
 block discarded – undo
5976 5976
 
5977 5977
     /**
5978 5978
      * @param string $str
5979
-     * @return bool|mixed|string
5979
+     * @return string
5980 5980
      */
5981 5981
     public function atBindFileContent($str = '')
5982 5982
     {
@@ -6027,8 +6027,8 @@  discard block
 block discarded – undo
6027 6027
     }
6028 6028
 
6029 6029
     /**
6030
-     * @param $str
6031
-     * @return bool|string
6030
+     * @param string $str
6031
+     * @return false|string
6032 6032
      */
6033 6033
     public function getExtFromFilename($str)
6034 6034
     {
@@ -6056,7 +6056,7 @@  discard block
 block discarded – undo
6056 6056
      * @param string $text Error message
6057 6057
      * @param string $file File where the error was detected
6058 6058
      * @param string $line Line number within $file
6059
-     * @return boolean
6059
+     * @return boolean|null
6060 6060
      */
6061 6061
     public function phpError($nr, $text, $file, $line)
6062 6062
     {
@@ -6108,7 +6108,7 @@  discard block
 block discarded – undo
6108 6108
      * @param string $text
6109 6109
      * @param string $line
6110 6110
      * @param string $output
6111
-     * @return bool
6111
+     * @return null|boolean
6112 6112
      */
6113 6113
     public function messageQuit($msg = 'unspecified error', $query = '', $is_error = true, $nr = '', $file = '', $source = '', $text = '', $line = '', $output = '')
6114 6114
     {
@@ -6523,7 +6523,7 @@  discard block
 block discarded – undo
6523 6523
 
6524 6524
     /**
6525 6525
      * @param string $str
6526
-     * @return bool|mixed|string
6526
+     * @return string
6527 6527
      */
6528 6528
     public function atBindInclude($str = '')
6529 6529
     {
@@ -6574,7 +6574,7 @@  discard block
 block discarded – undo
6574 6574
      * @param $str
6575 6575
      * @param int $flags
6576 6576
      * @param string $encode
6577
-     * @return mixed
6577
+     * @return string
6578 6578
      */
6579 6579
     public function htmlspecialchars($str, $flags = ENT_COMPAT, $encode = '')
6580 6580
     {
@@ -6583,7 +6583,7 @@  discard block
 block discarded – undo
6583 6583
     }
6584 6584
 
6585 6585
     /**
6586
-     * @param $string
6586
+     * @param string $string
6587 6587
      * @param bool $returnData
6588 6588
      * @return bool|mixed
6589 6589
      */
Please login to merge, or discard this patch.
Spacing   +260 added lines, -260 removed lines patch added patch discarded remove patch
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
      */
216 216
     function __call($method_name, $arguments)
217 217
     {
218
-        include_once(MODX_MANAGER_PATH . 'includes/extenders/deprecated.functions.inc.php');
218
+        include_once(MODX_MANAGER_PATH.'includes/extenders/deprecated.functions.inc.php');
219 219
         if (method_exists($this->old, $method_name)) {
220 220
             $error_type = 1;
221 221
         } else {
@@ -233,12 +233,12 @@  discard block
 block discarded – undo
233 233
             $info = debug_backtrace();
234 234
             $m[] = $msg;
235 235
             if (!empty($this->currentSnippet)) {
236
-                $m[] = 'Snippet - ' . $this->currentSnippet;
236
+                $m[] = 'Snippet - '.$this->currentSnippet;
237 237
             } elseif (!empty($this->event->activePlugin)) {
238
-                $m[] = 'Plugin - ' . $this->event->activePlugin;
238
+                $m[] = 'Plugin - '.$this->event->activePlugin;
239 239
             }
240 240
             $m[] = $this->decoded_request_uri;
241
-            $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')';
241
+            $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')';
242 242
             $msg = implode('<br />', $m);
243 243
             $this->logEvent(0, $error_type, $msg, $title);
244 244
         }
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
     {
256 256
         $flag = false;
257 257
         if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof DBAPI) {
258
-            $flag = (bool)$this->{$connector}->conn;
258
+            $flag = (bool) $this->{$connector}->conn;
259 259
         }
260 260
         return $flag;
261 261
     }
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
         }
283 283
         if (!$out && $flag) {
284 284
             $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname)));
285
-            $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php";
285
+            $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php";
286 286
             $out = is_file($filename) ? include $filename : false;
287 287
         }
288 288
         if ($out && !in_array($extname, $this->extensions)) {
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
     public function getMicroTime()
300 300
     {
301 301
         list ($usec, $sec) = explode(' ', microtime());
302
-        return ((float)$usec + (float)$sec);
302
+        return ((float) $usec + (float) $sec);
303 303
     }
304 304
 
305 305
     /**
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
             // append the redirect count string to the url
324 324
             $currentNumberOfRedirects = isset ($_REQUEST['err']) ? $_REQUEST['err'] : 0;
325 325
             if ($currentNumberOfRedirects > 3) {
326
-                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>');
326
+                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>');
327 327
             } else {
328 328
                 $currentNumberOfRedirects += 1;
329 329
                 if (strpos($url, "?") > 0) {
@@ -334,9 +334,9 @@  discard block
 block discarded – undo
334 334
             }
335 335
         }
336 336
         if ($type == 'REDIRECT_REFRESH') {
337
-            $header = 'Refresh: 0;URL=' . $url;
337
+            $header = 'Refresh: 0;URL='.$url;
338 338
         } elseif ($type == 'REDIRECT_META') {
339
-            $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />';
339
+            $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />';
340 340
             echo $header;
341 341
             exit;
342 342
         } elseif ($type == 'REDIRECT_HEADER' || empty ($type)) {
@@ -344,10 +344,10 @@  discard block
 block discarded – undo
344 344
             global $base_url, $site_url;
345 345
             if (substr($url, 0, strlen($base_url)) == $base_url) {
346 346
                 // append $site_url to make it work with Location:
347
-                $url = $site_url . substr($url, strlen($base_url));
347
+                $url = $site_url.substr($url, strlen($base_url));
348 348
             }
349 349
             if (strpos($url, "\n") === false) {
350
-                $header = 'Location: ' . $url;
350
+                $header = 'Location: '.$url;
351 351
             } else {
352 352
                 $this->messageQuit('No newline allowed in redirect url.');
353 353
             }
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
             header($responseCode);
357 357
         }
358 358
 
359
-        if(!empty($header)) {
359
+        if (!empty($header)) {
360 360
             header($header);
361 361
         }
362 362
 
@@ -461,8 +461,8 @@  discard block
 block discarded – undo
461 461
 
462 462
     private function recoverySiteCache()
463 463
     {
464
-        $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder();
465
-        $site_cache_path = $site_cache_dir . 'siteCache.idx.php';
464
+        $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder();
465
+        $site_cache_path = $site_cache_dir.'siteCache.idx.php';
466 466
 
467 467
         if (is_file($site_cache_path)) {
468 468
             include($site_cache_path);
@@ -522,8 +522,8 @@  discard block
 block discarded – undo
522 522
                 $this->invokeEvent("OnBeforeManagerPageInit");
523 523
             }
524 524
 
525
-            if (isset ($_SESSION[$usrType . 'UsrConfigSet'])) {
526
-                $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet'];
525
+            if (isset ($_SESSION[$usrType.'UsrConfigSet'])) {
526
+                $usrSettings = &$_SESSION[$usrType.'UsrConfigSet'];
527 527
             } else {
528 528
                 if ($usrType == 'web') {
529 529
                     $from = $tbl_web_user_settings;
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
                     $usrSettings[$row['setting_name']] = $row['setting_value'];
544 544
                 }
545 545
                 if (isset ($usrType)) {
546
-                    $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings;
546
+                    $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings;
547 547
                 } // store user settings in session
548 548
             }
549 549
         }
@@ -688,10 +688,10 @@  discard block
 block discarded – undo
688 688
         $suf = $this->config['friendly_url_suffix'];
689 689
         $pre = preg_quote($pre, '/');
690 690
         $suf = preg_quote($suf, '/');
691
-        if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) {
691
+        if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) {
692 692
             $q = $_[1];
693 693
         }
694
-        if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) {
694
+        if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) {
695 695
             $q = $_[1];
696 696
         }
697 697
 
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
         if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { /* we got an ID returned, check to make sure it's not an alias */
714 714
             /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */
715 715
             if ($this->config['use_alias_path'] == 1) {
716
-                if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir . '/' . $q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) {
716
+                if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir.'/'.$q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) {
717 717
                     $this->documentMethod = 'id';
718 718
                     return $q;
719 719
                 } else { /* not a valid id in terms of virtualDir, treat as alias */
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
      */
748 748
     public function getHashFile($key)
749 749
     {
750
-        return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php";
750
+        return $this->getCacheFolder()."docid_".$key.".pageCache.php";
751 751
     }
752 752
 
753 753
     /**
@@ -758,9 +758,9 @@  discard block
 block discarded – undo
758 758
         $hash = $id;
759 759
         $tmp = null;
760 760
         $params = array();
761
-        if(!empty($this->systemCacheKey)){
761
+        if (!empty($this->systemCacheKey)) {
762 762
             $hash = $this->systemCacheKey;
763
-        }else {
763
+        } else {
764 764
             if (!empty($_GET)) {
765 765
                 // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID.
766 766
                 $params = $_GET;
@@ -768,8 +768,8 @@  discard block
 block discarded – undo
768 768
                 $hash .= '_'.md5(http_build_query($params));
769 769
             }
770 770
         }
771
-        $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params));
772
-        if (is_array($evtOut) && count($evtOut) > 0){
771
+        $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params));
772
+        if (is_array($evtOut) && count($evtOut) > 0) {
773 773
             $tmp = array_pop($evtOut);
774 774
         }
775 775
         return empty($tmp) ? $hash : $tmp;
@@ -911,12 +911,12 @@  discard block
 block discarded – undo
911 911
         if ($js = $this->getRegisteredClientStartupScripts()) {
912 912
             // change to just before closing </head>
913 913
             // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent);
914
-            $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput);
914
+            $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput);
915 915
         }
916 916
 
917 917
         // Insert jscripts & html block into template - template must have a </body> tag
918 918
         if ($js = $this->getRegisteredClientScripts()) {
919
-            $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput);
919
+            $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput);
920 920
         }
921 921
         // End fix by sirlancelot
922 922
 
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
         // send out content-type and content-disposition headers
928 928
         if (IN_PARSER_MODE == "true") {
929 929
             $type = !empty ($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html";
930
-            header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']);
930
+            header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']);
931 931
             //            if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error)
932 932
             //                header('HTTP/1.0 404 Not Found');
933 933
             if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) {
@@ -945,7 +945,7 @@  discard block
 block discarded – undo
945 945
                     $name = preg_replace('|-+|', '-', $name);
946 946
                     $name = trim($name, '-');
947 947
                 }
948
-                $header = 'Content-Disposition: attachment; filename=' . $name;
948
+                $header = 'Content-Disposition: attachment; filename='.$name;
949 949
                 header($header);
950 950
             }
951 951
         }
@@ -953,7 +953,7 @@  discard block
 block discarded – undo
953 953
 
954 954
         $stats = $this->getTimerStats($this->tstart);
955 955
 
956
-        $out =& $this->documentOutput;
956
+        $out = & $this->documentOutput;
957 957
         $out = str_replace("[^q^]", $stats['queries'], $out);
958 958
         $out = str_replace("[^qt^]", $stats['queryTime'], $out);
959 959
         $out = str_replace("[^p^]", $stats['phpTime'], $out);
@@ -992,17 +992,17 @@  discard block
 block discarded – undo
992 992
                 $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet
993 993
                 $tt += $t;
994 994
             }
995
-            echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms", $tt) . ")</legend>{$sc}</fieldset><br />";
995
+            echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms", $tt).")</legend>{$sc}</fieldset><br />";
996 996
             echo $this->snippetsCode;
997 997
         }
998 998
         if ($this->dumpPlugins) {
999 999
             $ps = "";
1000 1000
             $tt = 0;
1001 1001
             foreach ($this->pluginsTime as $s => $t) {
1002
-                $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>";
1002
+                $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>";
1003 1003
                 $tt += $t;
1004 1004
             }
1005
-            echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms", $tt * 1000) . ")</legend>{$ps}</fieldset><br />";
1005
+            echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms", $tt * 1000).")</legend>{$ps}</fieldset><br />";
1006 1006
             echo $this->pluginsCode;
1007 1007
         }
1008 1008
 
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
         $srcTags = explode(',', $tags);
1029 1029
         $repTags = array();
1030 1030
         foreach ($srcTags as $tag) {
1031
-            $repTags[] = '\\' . $tag[0] . '\\' . $tag[1];
1031
+            $repTags[] = '\\'.$tag[0].'\\'.$tag[1];
1032 1032
         }
1033 1033
         return array($srcTags, $repTags);
1034 1034
     }
@@ -1050,7 +1050,7 @@  discard block
 block discarded – undo
1050 1050
         $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']);
1051 1051
         $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache";
1052 1052
         $stats['queries'] = isset ($this->executedQueries) ? $this->executedQueries : 0;
1053
-        $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb";
1053
+        $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb";
1054 1054
 
1055 1055
         return $stats;
1056 1056
     }
@@ -1083,7 +1083,7 @@  discard block
 block discarded – undo
1083 1083
     {
1084 1084
         $cacheRefreshTime = 0;
1085 1085
         $recent_update = 0;
1086
-        @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php');
1086
+        @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php');
1087 1087
         $this->recentUpdate = $recent_update;
1088 1088
 
1089 1089
         $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time'];
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
         // now, check for documents that need publishing
1095 1095
         $field = array('published' => 1, 'publishedon' => $timeNow);
1096 1096
         $where = "pub_date <= {$timeNow} AND pub_date!=0 AND published=0";
1097
-        $result_pub = $this->db->select( 'id', '[+prefix+]site_content',  $where);
1097
+        $result_pub = $this->db->select('id', '[+prefix+]site_content', $where);
1098 1098
         $this->db->update($field, '[+prefix+]site_content', $where);
1099 1099
         if ($this->db->getRecordCount($result_pub) >= 1) { //Event unPublished doc
1100 1100
             while ($row_pub = $this->db->getRow($result_pub)) {
@@ -1107,7 +1107,7 @@  discard block
 block discarded – undo
1107 1107
         // now, check for documents that need un-publishing
1108 1108
         $field = array('published' => 0, 'publishedon' => 0);
1109 1109
         $where = "unpub_date <= {$timeNow} AND unpub_date!=0 AND published=1";
1110
-        $result_unpub = $this->db->select( 'id', '[+prefix+]site_content',  $where);
1110
+        $result_unpub = $this->db->select('id', '[+prefix+]site_content', $where);
1111 1111
         $this->db->update($field, '[+prefix+]site_content', $where);
1112 1112
         if ($this->db->getRecordCount($result_unpub) >= 1) { //Event unPublished doc
1113 1113
             while ($row_unpub = $this->db->getRow($result_unpub)) {
@@ -1153,8 +1153,8 @@  discard block
 block discarded – undo
1153 1153
                 }
1154 1154
 
1155 1155
                 $docObjSerial = serialize($this->documentObject);
1156
-                $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent;
1157
-                $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey);
1156
+                $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent;
1157
+                $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey);
1158 1158
                 file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent");
1159 1159
             }
1160 1160
         }
@@ -1196,16 +1196,16 @@  discard block
 block discarded – undo
1196 1196
             return array();
1197 1197
         }
1198 1198
         $spacer = md5('<<<EVO>>>');
1199
-        if($left==='{{' && strpos($content,';}}')!==false)  $content = str_replace(';}}', sprintf(';}%s}',   $spacer),$content);
1200
-        if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content);
1201
-        if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]',  $spacer),$content);
1202
-        if($left==='[[' && strpos($content,']]]')!==false)  $content = str_replace(']]]', sprintf(']%s]]',   $spacer),$content);
1199
+        if ($left === '{{' && strpos($content, ';}}') !== false)  $content = str_replace(';}}', sprintf(';}%s}', $spacer), $content);
1200
+        if ($left === '{{' && strpos($content, '{{}}') !== false) $content = str_replace('{{}}', sprintf('{%$1s{}%$1s}', $spacer), $content);
1201
+        if ($left === '[[' && strpos($content, ']]]]') !== false) $content = str_replace(']]]]', sprintf(']]%s]]', $spacer), $content);
1202
+        if ($left === '[[' && strpos($content, ']]]') !== false)  $content = str_replace(']]]', sprintf(']%s]]', $spacer), $content);
1203 1203
 
1204 1204
         $pos['<![CDATA['] = strpos($content, '<![CDATA[');
1205 1205
         $pos[']]>'] = strpos($content, ']]>');
1206 1206
 
1207 1207
         if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) {
1208
-            $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3);
1208
+            $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3);
1209 1209
         }
1210 1210
 
1211 1211
         $lp = explode($left, $content);
@@ -1269,8 +1269,8 @@  discard block
 block discarded – undo
1269 1269
                 }
1270 1270
             }
1271 1271
         }
1272
-        foreach($tags as $i=>$tag) {
1273
-            if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag);
1272
+        foreach ($tags as $i=>$tag) {
1273
+            if (strpos($tag, $spacer) !== false) $tags[$i] = str_replace($spacer, '', $tag);
1274 1274
         }
1275 1275
         return $tags;
1276 1276
     }
@@ -1310,7 +1310,7 @@  discard block
 block discarded – undo
1310 1310
         }
1311 1311
 
1312 1312
         foreach ($matches[1] as $i => $key) {
1313
-            if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1313
+            if (strpos($key, '[+') !== false) continue; // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1314 1314
             if (substr($key, 0, 1) == '#') {
1315 1315
                 $key = substr($key, 1);
1316 1316
             } // remove # for QuickEdit format
@@ -1340,8 +1340,8 @@  discard block
 block discarded – undo
1340 1340
 
1341 1341
             if (strpos($content, $s) !== false) {
1342 1342
                 $content = str_replace($s, $value, $content);
1343
-            } elseif($this->debug) {
1344
-                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1343
+            } elseif ($this->debug) {
1344
+                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1345 1345
             }
1346 1346
         }
1347 1347
 
@@ -1508,8 +1508,8 @@  discard block
 block discarded – undo
1508 1508
             $s = &$matches[0][$i];
1509 1509
             if (strpos($content, $s) !== false) {
1510 1510
                 $content = str_replace($s, $value, $content);
1511
-            } elseif($this->debug) {
1512
-                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1511
+            } elseif ($this->debug) {
1512
+                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1513 1513
             }
1514 1514
         }
1515 1515
         return $content;
@@ -1562,7 +1562,7 @@  discard block
 block discarded – undo
1562 1562
             }
1563 1563
 
1564 1564
             $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags
1565
-            $value = $this->mergePlaceholderContent($value, $params);  // parse page global placeholers
1565
+            $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers
1566 1566
             if ($this->config['enable_at_syntax']) {
1567 1567
                 $value = $this->mergeConditionalTagsContent($value);
1568 1568
             }
@@ -1577,8 +1577,8 @@  discard block
 block discarded – undo
1577 1577
             $s = &$matches[0][$i];
1578 1578
             if (strpos($content, $s) !== false) {
1579 1579
                 $content = str_replace($s, $value, $content);
1580
-            } elseif($this->debug) {
1581
-                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1580
+            } elseif ($this->debug) {
1581
+                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1582 1582
             }
1583 1583
         }
1584 1584
         return $content;
@@ -1636,8 +1636,8 @@  discard block
 block discarded – undo
1636 1636
             $s = &$matches[0][$i];
1637 1637
             if (strpos($content, $s) !== false) {
1638 1638
                 $content = str_replace($s, $value, $content);
1639
-            } elseif($this->debug) {
1640
-                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1639
+            } elseif ($this->debug) {
1640
+                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1641 1641
             }
1642 1642
         }
1643 1643
         return $content;
@@ -1661,7 +1661,7 @@  discard block
 block discarded – undo
1661 1661
             return $content;
1662 1662
         }
1663 1663
 
1664
-        $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#';
1664
+        $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#';
1665 1665
         $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), $content);
1666 1666
 
1667 1667
         $pieces = explode('<@IF:', $content);
@@ -1672,7 +1672,7 @@  discard block
 block discarded – undo
1672 1672
             }
1673 1673
             list($cmd, $text) = explode('>', $split, 2);
1674 1674
             $cmd = str_replace("'", "\'", $cmd);
1675
-            $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>";
1675
+            $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>";
1676 1676
             $content .= $text;
1677 1677
         }
1678 1678
         $pieces = explode('<@ELSEIF:', $content);
@@ -1683,13 +1683,13 @@  discard block
 block discarded – undo
1683 1683
             }
1684 1684
             list($cmd, $text) = explode('>', $split, 2);
1685 1685
             $cmd = str_replace("'", "\'", $cmd);
1686
-            $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>";
1686
+            $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>";
1687 1687
             $content .= $text;
1688 1688
         }
1689 1689
 
1690 1690
         $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content);
1691 1691
         ob_start();
1692
-        $content = eval('?>' . $content);
1692
+        $content = eval('?>'.$content);
1693 1693
         $content = ob_get_clean();
1694 1694
         $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'), $content);
1695 1695
 
@@ -1814,7 +1814,7 @@  discard block
 block discarded – undo
1814 1814
         $matches = $this->getTagsFromContent($content, $left, $right);
1815 1815
         if (!empty($matches)) {
1816 1816
             foreach ($matches[0] as $i => $v) {
1817
-                $addBreakMatches[$i] = $v . "\n";
1817
+                $addBreakMatches[$i] = $v."\n";
1818 1818
             }
1819 1819
             $content = str_replace($addBreakMatches, '', $content);
1820 1820
             if (strpos($content, $left) !== false) {
@@ -1847,8 +1847,8 @@  discard block
 block discarded – undo
1847 1847
             $s = &$matches[0][$i];
1848 1848
             if (strpos($content, $s) !== false) {
1849 1849
                 $content = str_replace($s, $v, $content);
1850
-            } elseif($this->debug) {
1851
-                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1850
+            } elseif ($this->debug) {
1851
+                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1852 1852
             }
1853 1853
         }
1854 1854
         return $content;
@@ -1912,7 +1912,7 @@  discard block
 block discarded – undo
1912 1912
                 $msg = ($msg === false) ? 'ob_get_contents() error' : $msg;
1913 1913
                 $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin', $error_info['message'], $error_info['line'], $msg);
1914 1914
                 if ($this->isBackend()) {
1915
-                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>');
1915
+                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>');
1916 1916
                 }
1917 1917
             }
1918 1918
         } else {
@@ -1958,7 +1958,7 @@  discard block
 block discarded – undo
1958 1958
                 $echo = ($echo === false) ? 'ob_get_contents() error' : $echo;
1959 1959
                 $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet', $error_info['message'], $error_info['line'], $echo);
1960 1960
                 if ($this->isBackend()) {
1961
-                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>');
1961
+                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>');
1962 1962
                 }
1963 1963
             }
1964 1964
         }
@@ -1966,7 +1966,7 @@  discard block
 block discarded – undo
1966 1966
         if (is_array($return) || is_object($return)) {
1967 1967
             return $return;
1968 1968
         } else {
1969
-            return $echo . $return;
1969
+            return $echo.$return;
1970 1970
         }
1971 1971
     }
1972 1972
 
@@ -2004,8 +2004,8 @@  discard block
 block discarded – undo
2004 2004
                 }
2005 2005
                 if (strpos($content, $s) !== false) {
2006 2006
                     $content = str_replace($s, $value, $content);
2007
-                } elseif($this->debug) {
2008
-                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2);
2007
+                } elseif ($this->debug) {
2008
+                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2);
2009 2009
                 }
2010 2010
                 continue;
2011 2011
             }
@@ -2016,8 +2016,8 @@  discard block
 block discarded – undo
2016 2016
 
2017 2017
             if (strpos($content, $s) !== false) {
2018 2018
                 $content = str_replace($s, $value, $content);
2019
-            } elseif($this->debug) {
2020
-                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2);
2019
+            } elseif ($this->debug) {
2020
+                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2);
2021 2021
             }
2022 2022
         }
2023 2023
 
@@ -2108,7 +2108,7 @@  discard block
 block discarded – undo
2108 2108
             $eventtime = sprintf('%2.2f ms', $eventtime * 1000);
2109 2109
             $code = str_replace("\t", '  ', $this->htmlspecialchars($value));
2110 2110
             $piece = str_replace("\t", '  ', $this->htmlspecialchars($piece));
2111
-            $print_r_params = str_replace("\t", '  ', $this->htmlspecialchars('$modx->event->params = ' . print_r($params, true)));
2111
+            $print_r_params = str_replace("\t", '  ', $this->htmlspecialchars('$modx->event->params = '.print_r($params, true)));
2112 2112
             $this->snippetsCode .= sprintf('<fieldset style="margin:1em;"><legend><b>%s</b>(%s)</legend><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">[[%s]]</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre></fieldset>', $snippetObject['name'], $eventtime, $piece, $print_r_params, $code);
2113 2113
             $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime);
2114 2114
         }
@@ -2353,7 +2353,7 @@  discard block
 block discarded – undo
2353 2353
             $rs = $this->db->select('name,snippet,properties', '[+prefix+]site_snippets', $where);
2354 2354
             $count = $this->db->getRecordCount($rs);
2355 2355
             if (1 < $count) {
2356
-                exit('Error $modx->_getSnippetObject()' . $snip_name);
2356
+                exit('Error $modx->_getSnippetObject()'.$snip_name);
2357 2357
             }
2358 2358
             if ($count) {
2359 2359
                 $row = $this->db->getRow($rs);
@@ -2379,7 +2379,7 @@  discard block
 block discarded – undo
2379 2379
     public function toAlias($text)
2380 2380
     {
2381 2381
         $suff = $this->config['friendly_url_suffix'];
2382
-        return str_replace(array('.xml' . $suff, '.rss' . $suff, '.js' . $suff, '.css' . $suff, '.txt' . $suff, '.json' . $suff, '.pdf' . $suff), array('.xml', '.rss', '.js', '.css', '.txt', '.json', '.pdf'), $text);
2382
+        return str_replace(array('.xml'.$suff, '.rss'.$suff, '.js'.$suff, '.css'.$suff, '.txt'.$suff, '.json'.$suff, '.pdf'.$suff), array('.xml', '.rss', '.js', '.css', '.txt', '.json', '.pdf'), $text);
2383 2383
     }
2384 2384
 
2385 2385
     /**
@@ -2411,7 +2411,7 @@  discard block
 block discarded – undo
2411 2411
                 $suff = '/';
2412 2412
             }
2413 2413
 
2414
-            $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff;
2414
+            $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff;
2415 2415
         }
2416 2416
 
2417 2417
         $evtOut = $this->invokeEvent('OnMakeDocUrl', array(
@@ -2448,7 +2448,7 @@  discard block
 block discarded – undo
2448 2448
                 preg_match_all('!\[\~([0-9]+)\~\]!ise', $documentSource, $match);
2449 2449
                 $ids = implode(',', array_unique($match['1']));
2450 2450
                 if ($ids) {
2451
-                    $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'");
2451
+                    $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'");
2452 2452
                     while ($row = $this->db->getRow($res)) {
2453 2453
                         if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) {
2454 2454
                             $parent = $row['parent'];
@@ -2459,7 +2459,7 @@  discard block
 block discarded – undo
2459 2459
                                 $parent = $this->aliasListing[$parent]['parent'];
2460 2460
                             }
2461 2461
 
2462
-                            $aliases[$row['id']] = $path . '/' . $row['alias'];
2462
+                            $aliases[$row['id']] = $path.'/'.$row['alias'];
2463 2463
                         } else {
2464 2464
                             $aliases[$row['id']] = $row['alias'];
2465 2465
                         }
@@ -2471,7 +2471,7 @@  discard block
 block discarded – undo
2471 2471
             $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0);
2472 2472
             $pref = $this->config['friendly_url_prefix'];
2473 2473
             $suff = $this->config['friendly_url_suffix'];
2474
-            $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2474
+            $documentSource = preg_replace_callback($in, function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2475 2475
                 global $modx;
2476 2476
                 $thealias = $aliases[$m[1]];
2477 2477
                 $thefolder = $isfolder[$m[1]];
@@ -2487,7 +2487,7 @@  discard block
 block discarded – undo
2487 2487
 
2488 2488
         } else {
2489 2489
             $in = '!\[\~([0-9]+)\~\]!is';
2490
-            $out = "index.php?id=" . '\1';
2490
+            $out = "index.php?id=".'\1';
2491 2491
             $documentSource = preg_replace($in, $out, $documentSource);
2492 2492
         }
2493 2493
 
@@ -2508,7 +2508,7 @@  discard block
 block discarded – undo
2508 2508
         $scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
2509 2509
         $len_base_url = strlen($this->config['base_url']);
2510 2510
 
2511
-        $url_path = $q;//LANG
2511
+        $url_path = $q; //LANG
2512 2512
 
2513 2513
         if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) {
2514 2514
             $url_path = substr($url_path, $len_base_url);
@@ -2520,7 +2520,7 @@  discard block
 block discarded – undo
2520 2520
             $strictURL = substr($strictURL, $len_base_url);
2521 2521
         }
2522 2522
         $http_host = $_SERVER['HTTP_HOST'];
2523
-        $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG
2523
+        $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG
2524 2524
 
2525 2525
         $site_url = $this->config['site_url'];
2526 2526
         $url_query_string = explode('?', $_SERVER['REQUEST_URI']);
@@ -2538,7 +2538,7 @@  discard block
 block discarded – undo
2538 2538
                 }
2539 2539
                 if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) {
2540 2540
                     if (empty($_POST)) {
2541
-                        if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) {
2541
+                        if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) {
2542 2542
                             $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently');
2543 2543
                             exit(0);
2544 2544
                         }
@@ -2597,7 +2597,7 @@  discard block
 block discarded – undo
2597 2597
                 $docgrp = implode(",", $docgrp);
2598 2598
             }
2599 2599
             // get document
2600
-            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
2600
+            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
2601 2601
             $rs = $this->db->select('sc.*', "{$tblsc} sc
2602 2602
                 LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1);
2603 2603
             if ($this->db->getRecordCount($rs) < 1) {
@@ -2633,9 +2633,9 @@  discard block
 block discarded – undo
2633 2633
             }
2634 2634
             if ($documentObject['template']) {
2635 2635
                 // load TVs and merge with document - Orig by Apodigm - Docvars
2636
-                $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars") . " tv
2637
-                INNER JOIN " . $this->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id
2638
-                LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'");
2636
+                $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars")." tv
2637
+                INNER JOIN " . $this->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id
2638
+                LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'");
2639 2639
                 $tmplvars = array();
2640 2640
                 while ($row = $this->db->getRow($rs)) {
2641 2641
                     $tmplvars[$row['name']] = array(
@@ -2681,7 +2681,7 @@  discard block
 block discarded – undo
2681 2681
                 $st = md5($source);
2682 2682
             }
2683 2683
             if ($this->dumpSnippets == 1) {
2684
-                $this->snippetsCode .= "<fieldset><legend><b style='color: #821517;'>PARSE PASS " . ($i + 1) . "</b></legend><p>The following snippets (if any) were parsed during this pass.</p>";
2684
+                $this->snippetsCode .= "<fieldset><legend><b style='color: #821517;'>PARSE PASS ".($i + 1)."</b></legend><p>The following snippets (if any) were parsed during this pass.</p>";
2685 2685
             }
2686 2686
 
2687 2687
             // invoke OnParseDocument event
@@ -2723,7 +2723,7 @@  discard block
 block discarded – undo
2723 2723
      */
2724 2724
     public function executeParser()
2725 2725
     {
2726
-        if(MODX_CLI) {
2726
+        if (MODX_CLI) {
2727 2727
             throw new \RuntimeException('Call DocumentParser::executeParser on CLI mode');
2728 2728
         }
2729 2729
 
@@ -2769,7 +2769,7 @@  discard block
 block discarded – undo
2769 2769
 
2770 2770
             // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path
2771 2771
             if ($this->config['use_alias_path'] == 1) {
2772
-                $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier;
2772
+                $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier;
2773 2773
                 if (isset($this->documentListing[$alias])) {
2774 2774
                     $this->documentIdentifier = $this->documentListing[$alias];
2775 2775
                 } else {
@@ -2830,7 +2830,7 @@  discard block
 block discarded – undo
2830 2830
                 } else {
2831 2831
                     $docAlias = $this->db->escape($this->documentIdentifier);
2832 2832
                     $rs = $this->db->select('id', $this->getFullTableName('site_content'), "deleted=0 and alias='{$docAlias}'");
2833
-                    $this->documentIdentifier = (int)$this->db->getValue($rs);
2833
+                    $this->documentIdentifier = (int) $this->db->getValue($rs);
2834 2834
                 }
2835 2835
             }
2836 2836
             $this->documentMethod = 'id';
@@ -2887,7 +2887,7 @@  discard block
 block discarded – undo
2887 2887
                 $_REQUEST[$n] = $_GET[$n] = $v;
2888 2888
             }
2889 2889
         }
2890
-        $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path'];
2890
+        $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path'];
2891 2891
         $this->q = $qp['path'];
2892 2892
         return $qp['path'];
2893 2893
     }
@@ -3033,7 +3033,7 @@  discard block
 block discarded – undo
3033 3033
         while ($id && $height--) {
3034 3034
             $thisid = $id;
3035 3035
             if ($this->config['aliaslistingfolder'] == 1) {
3036
-                $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM " . $this->getFullTableName("site_content") . " WHERE `id` = '{$id}' LIMIT 0,1");
3036
+                $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM ".$this->getFullTableName("site_content")." WHERE `id` = '{$id}' LIMIT 0,1");
3037 3037
                 if (!$id || $id == '0') {
3038 3038
                     break;
3039 3039
                 }
@@ -3084,15 +3084,15 @@  discard block
 block discarded – undo
3084 3084
 
3085 3085
         if ($this->config['aliaslistingfolder'] == 1) {
3086 3086
 
3087
-            $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (" . $id . ") AND deleted = '0'");
3087
+            $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (".$id.") AND deleted = '0'");
3088 3088
             $idx = array();
3089 3089
             while ($row = $this->db->getRow($res)) {
3090 3090
                 $pAlias = '';
3091 3091
                 if (isset($this->aliasListing[$row['parent']])) {
3092
-                    $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : '';
3093
-                    $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : '';
3092
+                    $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : '';
3093
+                    $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : '';
3094 3094
                 };
3095
-                $children[$pAlias . $row['alias']] = $row['id'];
3095
+                $children[$pAlias.$row['alias']] = $row['id'];
3096 3096
                 if ($row['isfolder'] == 1) {
3097 3097
                     $idx[] = $row['id'];
3098 3098
                 }
@@ -3124,7 +3124,7 @@  discard block
 block discarded – undo
3124 3124
                 $depth--;
3125 3125
 
3126 3126
                 foreach ($documentMap_cache[$id] as $childId) {
3127
-                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias'];
3127
+                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias'];
3128 3128
                     if (!strlen($pkey)) {
3129 3129
                         $pkey = "{$childId}";
3130 3130
                     }
@@ -3161,7 +3161,7 @@  discard block
 block discarded – undo
3161 3161
                 $fnc = 'history.back(-1);';
3162 3162
                 break;
3163 3163
             default:
3164
-                $fnc = "window.location.href='" . addslashes($url) . "';";
3164
+                $fnc = "window.location.href='".addslashes($url)."';";
3165 3165
         }
3166 3166
 
3167 3167
         echo "<html><head>
@@ -3193,9 +3193,9 @@  discard block
 block discarded – undo
3193 3193
         $state = 0;
3194 3194
         $pms = $_SESSION['mgrPermissions'];
3195 3195
         if ($pms) {
3196
-            $state = ((bool)$pms[$pm] === true);
3196
+            $state = ((bool) $pms[$pm] === true);
3197 3197
         }
3198
-        return (int)$state;
3198
+        return (int) $state;
3199 3199
     }
3200 3200
 
3201 3201
     /**
@@ -3208,8 +3208,8 @@  discard block
 block discarded – undo
3208 3208
      */
3209 3209
     public function elementIsLocked($type, $id, $includeThisUser = false)
3210 3210
     {
3211
-        $id = (int)$id;
3212
-        $type = (int)$type;
3211
+        $id = (int) $id;
3212
+        $type = (int) $type;
3213 3213
         if (!$type || !$id) {
3214 3214
             return null;
3215 3215
         }
@@ -3259,7 +3259,7 @@  discard block
 block discarded – undo
3259 3259
             return $lockedElements;
3260 3260
         }
3261 3261
 
3262
-        $type = (int)$type;
3262
+        $type = (int) $type;
3263 3263
         if (isset($lockedElements[$type])) {
3264 3264
             return $lockedElements[$type];
3265 3265
         } else {
@@ -3276,7 +3276,7 @@  discard block
 block discarded – undo
3276 3276
             $this->lockedElements = array();
3277 3277
             $this->cleanupExpiredLocks();
3278 3278
 
3279
-            $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks') . " ul
3279
+            $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks')." ul
3280 3280
                 LEFT JOIN {$this->getFullTableName('manager_users')} mu on ul.internalKey = mu.id");
3281 3281
             while ($row = $this->db->getRow($rs)) {
3282 3282
                 $this->lockedElements[$row['elementType']][$row['elementId']] = array(
@@ -3299,7 +3299,7 @@  discard block
 block discarded – undo
3299 3299
     public function cleanupExpiredLocks()
3300 3300
     {
3301 3301
         // Clean-up active_user_sessions first
3302
-        $timeout = (int)$this->config['session_timeout'] < 2 ? 120 : $this->config['session_timeout'] * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum
3302
+        $timeout = (int) $this->config['session_timeout'] < 2 ? 120 : $this->config['session_timeout'] * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum
3303 3303
         $validSessionTimeLimit = $this->time - $timeout;
3304 3304
         $this->db->delete($this->getFullTableName('active_user_sessions'), "lasthit < {$validSessionTimeLimit}");
3305 3305
 
@@ -3312,7 +3312,7 @@  discard block
 block discarded – undo
3312 3312
             foreach ($rs as $row) {
3313 3313
                 $userSids[] = $row['sid'];
3314 3314
             }
3315
-            $userSids = "'" . implode("','", $userSids) . "'";
3315
+            $userSids = "'".implode("','", $userSids)."'";
3316 3316
             $this->db->delete($this->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})");
3317 3317
         } else {
3318 3318
             $this->db->delete($this->getFullTableName('active_user_locks'));
@@ -3396,8 +3396,8 @@  discard block
 block discarded – undo
3396 3396
     public function lockElement($type, $id)
3397 3397
     {
3398 3398
         $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0;
3399
-        $type = (int)$type;
3400
-        $id = (int)$id;
3399
+        $type = (int) $type;
3400
+        $id = (int) $id;
3401 3401
         if (!$type || !$id || !$userId) {
3402 3402
             return false;
3403 3403
         }
@@ -3418,8 +3418,8 @@  discard block
 block discarded – undo
3418 3418
     public function unlockElement($type, $id, $includeAllUsers = false)
3419 3419
     {
3420 3420
         $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0;
3421
-        $type = (int)$type;
3422
-        $id = (int)$id;
3421
+        $type = (int) $type;
3422
+        $id = (int) $id;
3423 3423
         if (!$type || !$id) {
3424 3424
             return false;
3425 3425
         }
@@ -3486,8 +3486,8 @@  discard block
 block discarded – undo
3486 3486
         }
3487 3487
 
3488 3488
         $usertype = $this->isFrontend() ? 1 : 0;
3489
-        $evtid = (int)$evtid;
3490
-        $type = (int)$type;
3489
+        $evtid = (int) $evtid;
3490
+        $type = (int) $type;
3491 3491
 
3492 3492
         // Types: 1 = information, 2 = warning, 3 = error
3493 3493
         if ($type < 1) {
@@ -3509,8 +3509,8 @@  discard block
 block discarded – undo
3509 3509
         if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') {
3510 3510
             if ($this->config['send_errormail'] <= $type) {
3511 3511
                 $this->sendmail(array(
3512
-                    'subject' => 'MODX System Error on ' . $this->config['site_name'],
3513
-                    'body' => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.',
3512
+                    'subject' => 'MODX System Error on '.$this->config['site_name'],
3513
+                    'body' => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.',
3514 3514
                     'type' => 'text'
3515 3515
                 ));
3516 3516
             }
@@ -3559,7 +3559,7 @@  discard block
 block discarded – undo
3559 3559
             $p['fromname'] = $userinfo['username'];
3560 3560
         }
3561 3561
         if ($msg === '' && !isset($p['body'])) {
3562
-            $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER'];
3562
+            $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER'];
3563 3563
         } elseif (is_string($msg) && 0 < strlen($msg)) {
3564 3564
             $p['body'] = $msg;
3565 3565
         }
@@ -3601,8 +3601,8 @@  discard block
 block discarded – undo
3601 3601
             $files = array();
3602 3602
         }
3603 3603
         foreach ($files as $f) {
3604
-            if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) {
3605
-                $this->mail->AddAttachment(MODX_BASE_PATH . $f);
3604
+            if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) {
3605
+                $this->mail->AddAttachment(MODX_BASE_PATH.$f);
3606 3606
             }
3607 3607
         }
3608 3608
         return $this->mail->send();
@@ -3646,7 +3646,7 @@  discard block
 block discarded – undo
3646 3646
      */
3647 3647
     public function isFrontend()
3648 3648
     {
3649
-        return ! $this->isBackend();
3649
+        return !$this->isBackend();
3650 3650
     }
3651 3651
 
3652 3652
     /**
@@ -3671,14 +3671,14 @@  discard block
 block discarded – undo
3671 3671
         $tblsc = $this->getFullTableName("site_content");
3672 3672
         $tbldg = $this->getFullTableName("document_groups");
3673 3673
         // modify field names to use sc. table reference
3674
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3675
-        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3674
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3675
+        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3676 3676
         // get document groups for current user
3677 3677
         if ($docgrp = $this->getUserDocGroups()) {
3678 3678
             $docgrp = implode(",", $docgrp);
3679 3679
         }
3680 3680
         // build query
3681
-        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3681
+        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3682 3682
         $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3683 3683
                 LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}");
3684 3684
         $resourceArray = $this->db->makeArray($result);
@@ -3708,14 +3708,14 @@  discard block
 block discarded – undo
3708 3708
         $tbldg = $this->getFullTableName("document_groups");
3709 3709
 
3710 3710
         // modify field names to use sc. table reference
3711
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3712
-        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3711
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3712
+        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3713 3713
         // get document groups for current user
3714 3714
         if ($docgrp = $this->getUserDocGroups()) {
3715 3715
             $docgrp = implode(",", $docgrp);
3716 3716
         }
3717 3717
         // build query
3718
-        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3718
+        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3719 3719
         $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3720 3720
                 LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND sc.published=1 AND sc.deleted=0 AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}");
3721 3721
         $resourceArray = $this->db->makeArray($result);
@@ -3750,16 +3750,16 @@  discard block
 block discarded – undo
3750 3750
             return $this->tmpCache[__FUNCTION__][$cacheKey];
3751 3751
         }
3752 3752
 
3753
-        $published = ($published !== 'all') ? 'AND sc.published = ' . $published : '';
3754
-        $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : '';
3753
+        $published = ($published !== 'all') ? 'AND sc.published = '.$published : '';
3754
+        $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : '';
3755 3755
 
3756 3756
         if ($where != '') {
3757
-            $where = 'AND ' . $where;
3757
+            $where = 'AND '.$where;
3758 3758
         }
3759 3759
 
3760 3760
         // modify field names to use sc. table reference
3761
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3762
-        $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3761
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3762
+        $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3763 3763
 
3764 3764
         // get document groups for current user
3765 3765
         if ($docgrp = $this->getUserDocGroups()) {
@@ -3767,7 +3767,7 @@  discard block
 block discarded – undo
3767 3767
         }
3768 3768
 
3769 3769
         // build query
3770
-        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
3770
+        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')');
3771 3771
 
3772 3772
         $tblsc = $this->getFullTableName('site_content');
3773 3773
         $tbldg = $this->getFullTableName('document_groups');
@@ -3819,10 +3819,10 @@  discard block
 block discarded – undo
3819 3819
             return false;
3820 3820
         } else {
3821 3821
             // modify field names to use sc. table reference
3822
-            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3823
-            $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3822
+            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3823
+            $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3824 3824
             if ($where != '') {
3825
-                $where = 'AND ' . $where;
3825
+                $where = 'AND '.$where;
3826 3826
             }
3827 3827
 
3828 3828
             $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : '';
@@ -3833,13 +3833,13 @@  discard block
 block discarded – undo
3833 3833
                 $docgrp = implode(',', $docgrp);
3834 3834
             }
3835 3835
 
3836
-            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
3836
+            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')');
3837 3837
 
3838 3838
             $tblsc = $this->getFullTableName('site_content');
3839 3839
             $tbldg = $this->getFullTableName('document_groups');
3840 3840
 
3841 3841
             $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3842
-                    LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (" . implode(',', $ids) . ") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit);
3842
+                    LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (".implode(',', $ids).") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit);
3843 3843
 
3844 3844
             $resourceArray = $this->db->makeArray($result);
3845 3845
 
@@ -3944,12 +3944,12 @@  discard block
 block discarded – undo
3944 3944
             $tbldg = $this->getFullTableName("document_groups");
3945 3945
             $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : "";
3946 3946
             // modify field names to use sc. table reference
3947
-            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3947
+            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3948 3948
             // get document groups for current user
3949 3949
             if ($docgrp = $this->getUserDocGroups()) {
3950 3950
                 $docgrp = implode(",", $docgrp);
3951 3951
             }
3952
-            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3952
+            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3953 3953
             $result = $this->db->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1);
3954 3954
             $pageInfo = $this->db->getRow($result);
3955 3955
 
@@ -3996,7 +3996,7 @@  discard block
 block discarded – undo
3996 3996
     {
3997 3997
         if ($this->currentSnippet) {
3998 3998
             $tbl = $this->getFullTableName("site_snippets");
3999
-            $rs = $this->db->select('id', $tbl, "name='" . $this->db->escape($this->currentSnippet) . "'", '', 1);
3999
+            $rs = $this->db->select('id', $tbl, "name='".$this->db->escape($this->currentSnippet)."'", '', 1);
4000 4000
             if ($snippetId = $this->db->getValue($rs)) {
4001 4001
                 return $snippetId;
4002 4002
             }
@@ -4023,7 +4023,7 @@  discard block
 block discarded – undo
4023 4023
      */
4024 4024
     public function clearCache($type = '', $report = false)
4025 4025
     {
4026
-        $cache_dir = MODX_BASE_PATH . $this->getCacheFolder();
4026
+        $cache_dir = MODX_BASE_PATH.$this->getCacheFolder();
4027 4027
         if (is_array($type)) {
4028 4028
             foreach ($type as $_) {
4029 4029
                 $this->clearCache($_, $report);
@@ -4035,10 +4035,10 @@  discard block
 block discarded – undo
4035 4035
             $sync->emptyCache();
4036 4036
         } elseif (preg_match('@^[1-9][0-9]*$@', $type)) {
4037 4037
             $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type;
4038
-            $file_name = "docid_" . $key . "_*.pageCache.php";
4039
-            $cache_path = $cache_dir . $file_name;
4038
+            $file_name = "docid_".$key."_*.pageCache.php";
4039
+            $cache_path = $cache_dir.$file_name;
4040 4040
             $files = glob($cache_path);
4041
-            $files[] = $cache_dir . "docid_" . $key . ".pageCache.php";
4041
+            $files[] = $cache_dir."docid_".$key.".pageCache.php";
4042 4042
             foreach ($files as $file) {
4043 4043
                 if (!is_file($file)) {
4044 4044
                     continue;
@@ -4046,7 +4046,7 @@  discard block
 block discarded – undo
4046 4046
                 unlink($file);
4047 4047
             }
4048 4048
         } else {
4049
-            $files = glob($cache_dir . '*');
4049
+            $files = glob($cache_dir.'*');
4050 4050
             foreach ($files as $file) {
4051 4051
                 $name = basename($file);
4052 4052
                 if (strpos($name, '.pageCache.php') === false) {
@@ -4115,7 +4115,7 @@  discard block
 block discarded – undo
4115 4115
                         $f_url_suffix = '/';
4116 4116
                     }
4117 4117
 
4118
-                    $alPath = !empty ($al['path']) ? $al['path'] . '/' : '';
4118
+                    $alPath = !empty ($al['path']) ? $al['path'].'/' : '';
4119 4119
 
4120 4120
                     if ($al && $al['alias']) {
4121 4121
                         $alias = $al['alias'];
@@ -4123,7 +4123,7 @@  discard block
 block discarded – undo
4123 4123
 
4124 4124
                 }
4125 4125
 
4126
-                $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix;
4126
+                $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix;
4127 4127
                 $url = "{$alias}{$args}";
4128 4128
             } else {
4129 4129
                 $url = "index.php?id={$id}{$args}";
@@ -4142,7 +4142,7 @@  discard block
 block discarded – undo
4142 4142
             }
4143 4143
 
4144 4144
             //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080)
4145
-            $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host;
4145
+            $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host;
4146 4146
         }
4147 4147
 
4148 4148
         //fix strictUrl by Bumkaka
@@ -4151,9 +4151,9 @@  discard block
 block discarded – undo
4151 4151
         }
4152 4152
 
4153 4153
         if ($this->config['xhtml_urls']) {
4154
-            $url = preg_replace("/&(?!amp;)/", "&amp;", $host . $virtualDir . $url);
4154
+            $url = preg_replace("/&(?!amp;)/", "&amp;", $host.$virtualDir.$url);
4155 4155
         } else {
4156
-            $url = $host . $virtualDir . $url;
4156
+            $url = $host.$virtualDir.$url;
4157 4157
         }
4158 4158
 
4159 4159
         $evtOut = $this->invokeEvent('OnMakeDocUrl', array(
@@ -4177,21 +4177,21 @@  discard block
 block discarded – undo
4177 4177
         if (isset($this->aliasListing[$id])) {
4178 4178
             $out = $this->aliasListing[$id];
4179 4179
         } else {
4180
-            $q = $this->db->query("SELECT id,alias,isfolder,parent FROM " . $this->getFullTableName("site_content") . " WHERE id=" . (int)$id);
4180
+            $q = $this->db->query("SELECT id,alias,isfolder,parent FROM ".$this->getFullTableName("site_content")." WHERE id=".(int) $id);
4181 4181
             if ($this->db->getRecordCount($q) == '1') {
4182 4182
                 $q = $this->db->getRow($q);
4183 4183
                 $this->aliasListing[$id] = array(
4184
-                    'id' => (int)$q['id'],
4184
+                    'id' => (int) $q['id'],
4185 4185
                     'alias' => $q['alias'] == '' ? $q['id'] : $q['alias'],
4186
-                    'parent' => (int)$q['parent'],
4187
-                    'isfolder' => (int)$q['isfolder'],
4186
+                    'parent' => (int) $q['parent'],
4187
+                    'isfolder' => (int) $q['isfolder'],
4188 4188
                 );
4189 4189
                 if ($this->aliasListing[$id]['parent'] > 0) {
4190 4190
                     //fix alias_path_usage
4191 4191
                     if ($this->config['use_alias_path'] == '1') {
4192 4192
                         //&& $tmp['path'] != '' - fix error slash with epty path
4193 4193
                         $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']);
4194
-                        $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : '');
4194
+                        $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : '');
4195 4195
                     } else {
4196 4196
                         $this->aliasListing[$id]['path'] = '';
4197 4197
                     }
@@ -4232,7 +4232,7 @@  discard block
 block discarded – undo
4232 4232
         $out = array();
4233 4233
         if (empty($this->version) || !is_array($this->version)) {
4234 4234
             //include for compatibility modx version < 1.0.10
4235
-            include MODX_MANAGER_PATH . "includes/version.inc.php";
4235
+            include MODX_MANAGER_PATH."includes/version.inc.php";
4236 4236
             $this->version = array();
4237 4237
             $this->version['version'] = isset($modx_version) ? $modx_version : '';
4238 4238
             $this->version['branch'] = isset($modx_branch) ? $modx_branch : '';
@@ -4254,18 +4254,18 @@  discard block
 block discarded – undo
4254 4254
     {
4255 4255
         if (isset ($this->snippetCache[$snippetName])) {
4256 4256
             $snippet = $this->snippetCache[$snippetName];
4257
-            $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : '';
4257
+            $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : '';
4258 4258
         } else { // not in cache so let's check the db
4259
-            $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->db->escape($snippetName) . "'  AND ss.disabled=0;";
4259
+            $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM ".$this->getFullTableName("site_snippets")." as ss LEFT JOIN ".$this->getFullTableName('site_modules')." as sm on sm.guid=ss.moduleguid WHERE ss.`name`='".$this->db->escape($snippetName)."'  AND ss.disabled=0;";
4260 4260
             $result = $this->db->query($sql);
4261 4261
             if ($this->db->getRecordCount($result) == 1) {
4262 4262
                 $row = $this->db->getRow($result);
4263 4263
                 $snippet = $this->snippetCache[$snippetName] = $row['snippet'];
4264 4264
                 $mergedProperties = array_merge($this->parseProperties($row['properties']), $this->parseProperties($row['sharedproperties']));
4265
-                $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties);
4265
+                $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties);
4266 4266
             } else {
4267 4267
                 $snippet = $this->snippetCache[$snippetName] = "return false;";
4268
-                $properties = $this->snippetCache[$snippetName . "Props"] = '';
4268
+                $properties = $this->snippetCache[$snippetName."Props"] = '';
4269 4269
             }
4270 4270
         }
4271 4271
         // load default params/properties
@@ -4365,8 +4365,8 @@  discard block
 block discarded – undo
4365 4365
             }
4366 4366
             if (strpos($tpl, $s) !== false) {
4367 4367
                 $tpl = str_replace($s, $value, $tpl);
4368
-            } elseif($this->debug) {
4369
-                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2);
4368
+            } elseif ($this->debug) {
4369
+                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2);
4370 4370
             }
4371 4371
         }
4372 4372
 
@@ -4415,7 +4415,7 @@  discard block
 block discarded – undo
4415 4415
             case 'CODE':
4416 4416
                 break;
4417 4417
             case 'FILE':
4418
-                $template = file_get_contents(MODX_BASE_PATH . $template);
4418
+                $template = file_get_contents(MODX_BASE_PATH.$template);
4419 4419
                 break;
4420 4420
             case 'CHUNK':
4421 4421
                 $template = $this->getChunk($template);
@@ -4448,7 +4448,7 @@  discard block
 block discarded – undo
4448 4448
         if ($mode !== 'formatOnly' && empty($timestamp)) {
4449 4449
             return '-';
4450 4450
         }
4451
-        $timestamp = (int)$timestamp;
4451
+        $timestamp = (int) $timestamp;
4452 4452
 
4453 4453
         switch ($this->config['datetime_format']) {
4454 4454
             case 'YYYY/mm/dd':
@@ -4468,7 +4468,7 @@  discard block
 block discarded – undo
4468 4468
         }
4469 4469
 
4470 4470
         if (empty($mode)) {
4471
-            $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp);
4471
+            $strTime = strftime($dateFormat." %H:%M:%S", $timestamp);
4472 4472
         } elseif ($mode == 'dateOnly') {
4473 4473
             $strTime = strftime($dateFormat, $timestamp);
4474 4474
         } elseif ($mode == 'formatOnly') {
@@ -4522,7 +4522,7 @@  discard block
 block discarded – undo
4522 4522
             $S = 0;
4523 4523
         }
4524 4524
         $timeStamp = mktime($H, $M, $S, $m, $d, $Y);
4525
-        $timeStamp = (int)$timeStamp;
4525
+        $timeStamp = (int) $timeStamp;
4526 4526
         return $timeStamp;
4527 4527
     }
4528 4528
 
@@ -4564,7 +4564,7 @@  discard block
 block discarded – undo
4564 4564
                     if ($v === 'value') {
4565 4565
                         unset($_[$i]);
4566 4566
                     } else {
4567
-                        $_[$i] = 'tv.' . $v;
4567
+                        $_[$i] = 'tv.'.$v;
4568 4568
                     }
4569 4569
                 }
4570 4570
                 $fields = implode(',', $_);
@@ -4573,12 +4573,12 @@  discard block
 block discarded – undo
4573 4573
             }
4574 4574
 
4575 4575
             if ($tvsort != '') {
4576
-                $tvsort = 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort))));
4576
+                $tvsort = 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort))));
4577 4577
             }
4578 4578
             if ($tvidnames == "*") {
4579 4579
                 $query = "tv.id<>0";
4580 4580
             } else {
4581
-                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . implode("','", $tvidnames) . "')";
4581
+                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".implode("','", $tvidnames)."')";
4582 4582
             }
4583 4583
 
4584 4584
             $this->getUserDocGroups();
@@ -4722,7 +4722,7 @@  discard block
 block discarded – undo
4722 4722
             return $this->tmpCache[__FUNCTION__][$cacheKey];
4723 4723
         }
4724 4724
 
4725
-        if (($idnames != '*' && !is_array($idnames)) || empty($idnames) ) {
4725
+        if (($idnames != '*' && !is_array($idnames)) || empty($idnames)) {
4726 4726
             return false;
4727 4727
         } else {
4728 4728
 
@@ -4740,23 +4740,23 @@  discard block
 block discarded – undo
4740 4740
             }
4741 4741
 
4742 4742
             // get user defined template variables
4743
-            $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $fields))));
4744
-            $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
4743
+            $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $fields))));
4744
+            $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
4745 4745
 
4746 4746
             if ($idnames == '*') {
4747 4747
                 $query = 'tv.id<>0';
4748 4748
             } else {
4749
-                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')";
4749
+                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')";
4750 4750
             }
4751 4751
 
4752
-            $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars') . " tv
4753
-                    INNER JOIN " . $this->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id
4754
-                    LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues') . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : ""));
4752
+            $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars')." tv
4753
+                    INNER JOIN " . $this->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id
4754
+                    LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues')." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : ""));
4755 4755
 
4756 4756
             $result = $this->db->makeArray($rs);
4757 4757
 
4758 4758
             // get default/built-in template variables
4759
-            if(is_array($docRow)){
4759
+            if (is_array($docRow)) {
4760 4760
                 ksort($docRow);
4761 4761
 
4762 4762
                 foreach ($docRow as $key => $value) {
@@ -4794,13 +4794,13 @@  discard block
 block discarded – undo
4794 4794
      */
4795 4795
     public function getTemplateVarOutput($idnames = array(), $docid = '', $published = 1, $sep = '')
4796 4796
     {
4797
-        if (is_array($idnames) && empty($idnames) ) {
4797
+        if (is_array($idnames) && empty($idnames)) {
4798 4798
             return false;
4799 4799
         } else {
4800 4800
             $output = array();
4801 4801
             $vars = ($idnames == '*' || is_array($idnames)) ? $idnames : array($idnames);
4802 4802
 
4803
-            $docid = (int)$docid > 0 ? (int)$docid : $this->documentIdentifier;
4803
+            $docid = (int) $docid > 0 ? (int) $docid : $this->documentIdentifier;
4804 4804
             // remove sort for speed
4805 4805
             $result = $this->getTemplateVars($vars, '*', $docid, $published, '', '');
4806 4806
 
@@ -4830,7 +4830,7 @@  discard block
 block discarded – undo
4830 4830
      */
4831 4831
     public function getFullTableName($tbl)
4832 4832
     {
4833
-        return $this->db->config['dbase'] . ".`" . $this->db->config['table_prefix'] . $tbl . "`";
4833
+        return $this->db->config['dbase'].".`".$this->db->config['table_prefix'].$tbl."`";
4834 4834
     }
4835 4835
 
4836 4836
     /**
@@ -4909,7 +4909,7 @@  discard block
 block discarded – undo
4909 4909
     public function getCachePath()
4910 4910
     {
4911 4911
         global $base_url;
4912
-        $pth = $base_url . $this->getCacheFolder();
4912
+        $pth = $base_url.$this->getCacheFolder();
4913 4913
         return $pth;
4914 4914
     }
4915 4915
 
@@ -4961,8 +4961,8 @@  discard block
 block discarded – undo
4961 4961
         $out = false;
4962 4962
 
4963 4963
         if (!empty($context)) {
4964
-            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
4965
-                $out = $_SESSION[$context . 'InternalKey'];
4964
+            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) {
4965
+                $out = $_SESSION[$context.'InternalKey'];
4966 4966
             }
4967 4967
         } else {
4968 4968
             switch (true) {
@@ -4990,8 +4990,8 @@  discard block
 block discarded – undo
4990 4990
         $out = false;
4991 4991
 
4992 4992
         if (!empty($context)) {
4993
-            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
4994
-                $out = $_SESSION[$context . 'Shortname'];
4993
+            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) {
4994
+                $out = $_SESSION[$context.'Shortname'];
4995 4995
             }
4996 4996
         } else {
4997 4997
             switch (true) {
@@ -5062,8 +5062,8 @@  discard block
 block discarded – undo
5062 5062
      */
5063 5063
     public function getWebUserInfo($uid)
5064 5064
     {
5065
-        $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users") . " wu
5066
-                INNER JOIN " . $this->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id", "wu.id='{$uid}'");
5065
+        $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users")." wu
5066
+                INNER JOIN " . $this->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id", "wu.id='{$uid}'");
5067 5067
         if ($row = $this->db->getRow($rs)) {
5068 5068
             if (!isset($row['usertype']) or !$row["usertype"]) {
5069 5069
                 $row["usertype"] = "web";
@@ -5099,7 +5099,7 @@  discard block
 block discarded – undo
5099 5099
         } else if (is_array($dg)) {
5100 5100
             // resolve ids to names
5101 5101
             $dgn = array();
5102
-            $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (" . implode(",", $dg) . ")");
5102
+            $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (".implode(",", $dg).")");
5103 5103
             while ($row = $this->db->getRow($ds)) {
5104 5104
                 $dgn[] = $row['name'];
5105 5105
             }
@@ -5127,7 +5127,7 @@  discard block
 block discarded – undo
5127 5127
         $rt = false;
5128 5128
         if ($_SESSION["webValidated"] == 1) {
5129 5129
             $tbl = $this->getFullTableName("web_users");
5130
-            $ds = $this->db->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'");
5130
+            $ds = $this->db->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'");
5131 5131
             if ($row = $this->db->getRow($ds)) {
5132 5132
                 if ($row["password"] == md5($oldPwd)) {
5133 5133
                     if (strlen($newPwd) < 6) {
@@ -5137,7 +5137,7 @@  discard block
 block discarded – undo
5137 5137
                     } else {
5138 5138
                         $this->db->update(array(
5139 5139
                             'password' => $this->db->escape($newPwd),
5140
-                        ), $tbl, "id='" . $this->getLoginUserID() . "'");
5140
+                        ), $tbl, "id='".$this->getLoginUserID()."'");
5141 5141
                         // invoke OnWebChangePassword event
5142 5142
                         $this->invokeEvent("OnWebChangePassword", array(
5143 5143
                             "userid" => $row["id"],
@@ -5168,8 +5168,8 @@  discard block
 block discarded – undo
5168 5168
         // check cache
5169 5169
         $grpNames = isset ($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false;
5170 5170
         if (!is_array($grpNames)) {
5171
-            $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names") . " wgn
5172
-                    INNER JOIN " . $this->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'");
5171
+            $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names")." wgn
5172
+                    INNER JOIN " . $this->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'");
5173 5173
             $grpNames = $this->db->getColumn("name", $rs);
5174 5174
             // save to cache
5175 5175
             $_SESSION['webUserGroupNames'] = $grpNames;
@@ -5202,7 +5202,7 @@  discard block
 block discarded – undo
5202 5202
         if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) {
5203 5203
             $this->sjscripts[$nextpos] = $src;
5204 5204
         } else {
5205
-            $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>';
5205
+            $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>';
5206 5206
         }
5207 5207
     }
5208 5208
 
@@ -5281,7 +5281,7 @@  discard block
 block discarded – undo
5281 5281
         }
5282 5282
 
5283 5283
         if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) {
5284
-            $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>';
5284
+            $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>';
5285 5285
         }
5286 5286
         if ($startup) {
5287 5287
             $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1;
@@ -5428,7 +5428,7 @@  discard block
 block discarded – undo
5428 5428
                 $eventtime = $this->getMicroTime() - $eventtime;
5429 5429
                 $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName, $pluginName, $eventtime * 1000);
5430 5430
                 foreach ($parameter as $k => $v) {
5431
-                    $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>';
5431
+                    $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>';
5432 5432
                 }
5433 5433
                 $this->pluginsCode .= '</fieldset><br />';
5434 5434
                 $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime;
@@ -5456,13 +5456,13 @@  discard block
 block discarded – undo
5456 5456
         $plugin = array();
5457 5457
         if (isset ($this->pluginCache[$pluginName])) {
5458 5458
             $pluginCode = $this->pluginCache[$pluginName];
5459
-            $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : '';
5459
+            $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : '';
5460 5460
         } else {
5461 5461
             $pluginName = $this->db->escape($pluginName);
5462 5462
             $result = $this->db->select('name, plugincode, properties', $this->getFullTableName("site_plugins"), "name='{$pluginName}' AND disabled=0");
5463 5463
             if ($row = $this->db->getRow($result)) {
5464 5464
                 $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode'];
5465
-                $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties'];
5465
+                $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties'];
5466 5466
             } else {
5467 5467
                 $pluginCode = $this->pluginCache[$pluginName] = "return false;";
5468 5468
                 $pluginProperties = '';
@@ -5565,7 +5565,7 @@  discard block
 block discarded – undo
5565 5565
     public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false)
5566 5566
     {
5567 5567
         $params = array();
5568
-        $fullpath = $element_dir . '/' . $filename;
5568
+        $fullpath = $element_dir.'/'.$filename;
5569 5569
         if (is_readable($fullpath)) {
5570 5570
             $tpl = @fopen($fullpath, "r");
5571 5571
             if ($tpl) {
@@ -5732,8 +5732,8 @@  discard block
 block discarded – undo
5732 5732
         $ph = array('site_url' => MODX_SITE_URL);
5733 5733
         $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/";
5734 5734
         $regexEmail = '#([0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-wyz][a-z](fo|g|l|m|mes|o|op|pa|ro|seum|t|u|v|z)?)#i';
5735
-        $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : '';
5736
-        $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : '';
5735
+        $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : '';
5736
+        $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : '';
5737 5737
         foreach ($parsed as $key => $val) {
5738 5738
             if (is_array($val)) {
5739 5739
                 foreach ($val as $key2 => $val2) {
@@ -5742,7 +5742,7 @@  discard block
 block discarded – undo
5742 5742
                         $val2 = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val2);
5743 5743
                     }
5744 5744
                     if (preg_match($regexEmail, $val2, $url)) {
5745
-                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2);
5745
+                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2);
5746 5746
                     }
5747 5747
                     $parsed[$key][$key2] = $val2;
5748 5748
                 }
@@ -5752,7 +5752,7 @@  discard block
 block discarded – undo
5752 5752
                     $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val);
5753 5753
                 }
5754 5754
                 if (preg_match($regexEmail, $val, $url)) {
5755
-                    $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val);
5755
+                    $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val);
5756 5756
                 }
5757 5757
                 $parsed[$key] = $val;
5758 5758
             }
@@ -5766,32 +5766,32 @@  discard block
 block discarded – undo
5766 5766
         );
5767 5767
 
5768 5768
         $nl = "\n";
5769
-        $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'], "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : '';
5770
-        $list .= '<p>' . $nl;
5771
-        $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : '';
5772
-        $list .= isset($parsed['description']) ? $parsed['description'] . $nl : '';
5773
-        $list .= '</p><br/>' . $nl;
5774
-        $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : '';
5775
-        $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : '';
5776
-        $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : '';
5777
-        $list .= '<br/>' . $nl;
5769
+        $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'], "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : '';
5770
+        $list .= '<p>'.$nl;
5771
+        $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : '';
5772
+        $list .= isset($parsed['description']) ? $parsed['description'].$nl : '';
5773
+        $list .= '</p><br/>'.$nl;
5774
+        $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : '';
5775
+        $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : '';
5776
+        $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : '';
5777
+        $list .= '<br/>'.$nl;
5778 5778
         $first = true;
5779 5779
         foreach ($arrayParams as $param => $label) {
5780 5780
             if (isset($parsed[$param])) {
5781 5781
                 if ($first) {
5782
-                    $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl;
5783
-                    $list .= '<ul class="docBlockList">' . $nl;
5782
+                    $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl;
5783
+                    $list .= '<ul class="docBlockList">'.$nl;
5784 5784
                     $first = false;
5785 5785
                 }
5786
-                $list .= '    <li><strong>' . $label . '</strong>' . $nl;
5787
-                $list .= '        <ul>' . $nl;
5786
+                $list .= '    <li><strong>'.$label.'</strong>'.$nl;
5787
+                $list .= '        <ul>'.$nl;
5788 5788
                 foreach ($parsed[$param] as $val) {
5789
-                    $list .= '            <li>' . $val . '</li>' . $nl;
5789
+                    $list .= '            <li>'.$val.'</li>'.$nl;
5790 5790
                 }
5791
-                $list .= '        </ul></li>' . $nl;
5791
+                $list .= '        </ul></li>'.$nl;
5792 5792
             }
5793 5793
         }
5794
-        $list .= !$first ? '</ul>' . $nl : '';
5794
+        $list .= !$first ? '</ul>'.$nl : '';
5795 5795
 
5796 5796
         return $list;
5797 5797
     }
@@ -5867,7 +5867,7 @@  discard block
 block discarded – undo
5867 5867
      */
5868 5868
     public function addSnippet($name, $phpCode)
5869 5869
     {
5870
-        $this->snippetCache['#' . $name] = $phpCode;
5870
+        $this->snippetCache['#'.$name] = $phpCode;
5871 5871
     }
5872 5872
 
5873 5873
     /**
@@ -5876,7 +5876,7 @@  discard block
 block discarded – undo
5876 5876
      */
5877 5877
     public function addChunk($name, $text)
5878 5878
     {
5879
-        $this->chunkCache['#' . $name] = $text;
5879
+        $this->chunkCache['#'.$name] = $text;
5880 5880
     }
5881 5881
 
5882 5882
     /**
@@ -5912,7 +5912,7 @@  discard block
 block discarded – undo
5912 5912
         }
5913 5913
 
5914 5914
         if (!$isSafe) {
5915
-            $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true);
5915
+            $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true);
5916 5916
             $title = sprintf('Unknown eval was executed (%s)', $this->htmlspecialchars(substr(trim($phpcode), 0, 50)));
5917 5917
             $this->messageQuit($title, '', true, '', '', 'Parser', $msg);
5918 5918
             return;
@@ -5926,7 +5926,7 @@  discard block
 block discarded – undo
5926 5926
             return 'array()';
5927 5927
         }
5928 5928
 
5929
-        $output = $echo . $return;
5929
+        $output = $echo.$return;
5930 5930
         modx_sanitize_gpc($output);
5931 5931
         return $this->htmlspecialchars($output); // Maybe, all html tags are dangerous
5932 5932
     }
@@ -5944,8 +5944,8 @@  discard block
 block discarded – undo
5944 5944
 
5945 5945
         $safe = explode(',', $safe_functions);
5946 5946
 
5947
-        $phpcode = rtrim($phpcode, ';') . ';';
5948
-        $tokens = token_get_all('<?php ' . $phpcode);
5947
+        $phpcode = rtrim($phpcode, ';').';';
5948
+        $tokens = token_get_all('<?php '.$phpcode);
5949 5949
         foreach ($tokens as $i => $token) {
5950 5950
             if (!is_array($token)) {
5951 5951
                 continue;
@@ -5981,7 +5981,7 @@  discard block
 block discarded – undo
5981 5981
     public function atBindFileContent($str = '')
5982 5982
     {
5983 5983
 
5984
-        $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'] . 'files/', '');
5984
+        $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'].'files/', '');
5985 5985
 
5986 5986
         if (stripos($str, '@FILE') !== 0) {
5987 5987
             return $str;
@@ -6004,7 +6004,7 @@  discard block
 block discarded – undo
6004 6004
         $errorMsg = sprintf("Could not retrieve string '%s'.", $str);
6005 6005
 
6006 6006
         foreach ($search_path as $path) {
6007
-            $file_path = MODX_BASE_PATH . $path . $str;
6007
+            $file_path = MODX_BASE_PATH.$path.$str;
6008 6008
             if (strpos($file_path, MODX_MANAGER_PATH) === 0) {
6009 6009
                 return $errorMsg;
6010 6010
             } elseif (is_file($file_path)) {
@@ -6018,7 +6018,7 @@  discard block
 block discarded – undo
6018 6018
             return $errorMsg;
6019 6019
         }
6020 6020
 
6021
-        $content = (string)file_get_contents($file_path);
6021
+        $content = (string) file_get_contents($file_path);
6022 6022
         if ($content === false) {
6023 6023
             return $errorMsg;
6024 6024
         }
@@ -6127,22 +6127,22 @@  discard block
 block discarded – undo
6127 6127
 
6128 6128
         $version = isset ($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : '';
6129 6129
         $release_date = isset ($GLOBALS['release_date']) ? $GLOBALS['release_date'] : '';
6130
-        $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI'];
6130
+        $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI'];
6131 6131
         $request_uri = $this->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']);
6132 6132
         $ua = $this->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']);
6133 6133
         $referer = $this->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']);
6134 6134
         if ($is_error) {
6135 6135
             $str = '<h2 style="color:red">&laquo; Evo Parse Error &raquo;</h2>';
6136 6136
             if ($msg != 'PHP Parse Error') {
6137
-                $str .= '<h3 style="color:red">' . $msg . '</h3>';
6137
+                $str .= '<h3 style="color:red">'.$msg.'</h3>';
6138 6138
             }
6139 6139
         } else {
6140 6140
             $str = '<h2 style="color:#003399">&laquo; Evo Debug/ stop message &raquo;</h2>';
6141
-            $str .= '<h3 style="color:#003399">' . $msg . '</h3>';
6141
+            $str .= '<h3 style="color:#003399">'.$msg.'</h3>';
6142 6142
         }
6143 6143
 
6144 6144
         if (!empty ($query)) {
6145
-            $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL &gt; <span id="sqlHolder">' . $query . '</span></div>';
6145
+            $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL &gt; <span id="sqlHolder">'.$query.'</span></div>';
6146 6146
         }
6147 6147
 
6148 6148
         $errortype = array(
@@ -6165,13 +6165,13 @@  discard block
 block discarded – undo
6165 6165
 
6166 6166
         if (!empty($nr) || !empty($file)) {
6167 6167
             if ($text != '') {
6168
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>';
6168
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>';
6169 6169
             }
6170 6170
             if ($output != '') {
6171
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>';
6171
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>';
6172 6172
             }
6173 6173
             if ($nr !== '') {
6174
-                $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]");
6174
+                $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]");
6175 6175
             }
6176 6176
             if ($file) {
6177 6177
                 $table[] = array('File', $file);
@@ -6191,7 +6191,7 @@  discard block
 block discarded – undo
6191 6191
         }
6192 6192
 
6193 6193
         if (!empty($this->event->activePlugin)) {
6194
-            $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')');
6194
+            $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')');
6195 6195
         }
6196 6196
 
6197 6197
         $str .= $MakeTable->create($table, array('Error information', ''));
@@ -6201,17 +6201,17 @@  discard block
 block discarded – undo
6201 6201
         $table[] = array('REQUEST_URI', $request_uri);
6202 6202
 
6203 6203
         if ($this->manager->action) {
6204
-            include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
6204
+            include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php');
6205 6205
             global $action_list;
6206 6206
             $actionName = (isset($action_list[$this->manager->action])) ? " - {$action_list[$this->manager->action]}" : '';
6207 6207
 
6208
-            $table[] = array('Manager action', $this->manager->action . $actionName);
6208
+            $table[] = array('Manager action', $this->manager->action.$actionName);
6209 6209
         }
6210 6210
 
6211 6211
         if (preg_match('@^[0-9]+@', $this->documentIdentifier)) {
6212 6212
             $resource = $this->getDocumentObject('id', $this->documentIdentifier);
6213 6213
             $url = $this->makeUrl($this->documentIdentifier, '', '', 'full');
6214
-            $table[] = array('Resource', '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>');
6214
+            $table[] = array('Resource', '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>');
6215 6215
         }
6216 6216
         $table[] = array('Referer', $referer);
6217 6217
         $table[] = array('User Agent', $ua);
@@ -6232,7 +6232,7 @@  discard block
 block discarded – undo
6232 6232
 
6233 6233
         $mem = memory_get_peak_usage(true);
6234 6234
         $total_mem = $mem - $this->mstart;
6235
-        $total_mem = ($total_mem / 1024 / 1024) . ' mb';
6235
+        $total_mem = ($total_mem / 1024 / 1024).' mb';
6236 6236
 
6237 6237
         $queryTime = $this->queryTime;
6238 6238
         $phpTime = $totalTime - $queryTime;
@@ -6253,18 +6253,18 @@  discard block
 block discarded – undo
6253 6253
         $str .= $this->get_backtrace(debug_backtrace());
6254 6254
         // Log error
6255 6255
         if (!empty($this->currentSnippet)) {
6256
-            $source = 'Snippet - ' . $this->currentSnippet;
6256
+            $source = 'Snippet - '.$this->currentSnippet;
6257 6257
         } elseif (!empty($this->event->activePlugin)) {
6258
-            $source = 'Plugin - ' . $this->event->activePlugin;
6258
+            $source = 'Plugin - '.$this->event->activePlugin;
6259 6259
         } elseif ($source !== '') {
6260
-            $source = 'Parser - ' . $source;
6260
+            $source = 'Parser - '.$source;
6261 6261
         } elseif ($query !== '') {
6262 6262
             $source = 'SQL Query';
6263 6263
         } else {
6264 6264
             $source = 'Parser';
6265 6265
         }
6266 6266
         if ($msg) {
6267
-            $source .= ' / ' . $msg;
6267
+            $source .= ' / '.$msg;
6268 6268
         }
6269 6269
         if (isset($actionName) && !empty($actionName)) {
6270 6270
             $source .= $actionName;
@@ -6296,12 +6296,12 @@  discard block
 block discarded – undo
6296 6296
 
6297 6297
         // Display error
6298 6298
         if (isset($_SESSION['mgrValidated'])) {
6299
-            echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>EVO Content Manager ' . $version . ' &raquo; ' . $release_date . '</title>
6299
+            echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>EVO Content Manager '.$version.' &raquo; '.$release_date.'</title>
6300 6300
                  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6301
-                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" />
6301
+                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" />
6302 6302
                  <style type="text/css">body { padding:10px; } td {font:inherit;}</style>
6303 6303
                  </head><body>
6304
-                 ' . $str . '</body></html>';
6304
+                 ' . $str.'</body></html>';
6305 6305
 
6306 6306
         } else {
6307 6307
             echo 'Error';
@@ -6336,7 +6336,7 @@  discard block
 block discarded – undo
6336 6336
             switch ($val['type']) {
6337 6337
                 case '->':
6338 6338
                 case '::':
6339
-                    $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function'];
6339
+                    $functionName = $val['function'] = $val['class'].$val['type'].$val['function'];
6340 6340
                     break;
6341 6341
                 default:
6342 6342
                     $functionName = $val['function'];
@@ -6346,7 +6346,7 @@  discard block
 block discarded – undo
6346 6346
             $args = array_pad(array(), $_, '$var');
6347 6347
             $args = implode(", ", $args);
6348 6348
             $modx = &$this;
6349
-            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) {
6349
+            $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) {
6350 6350
                 $arg = $val['args'][$tmp - 1];
6351 6351
                 switch (true) {
6352 6352
                     case is_null($arg): {
@@ -6358,7 +6358,7 @@  discard block
 block discarded – undo
6358 6358
                         break;
6359 6359
                     }
6360 6360
                     case is_scalar($arg): {
6361
-                        $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->htmlspecialchars(str_replace("'", "\\'", $arg)) . "'");
6361
+                        $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->htmlspecialchars(str_replace("'", "\\'", $arg))."'");
6362 6362
                         break;
6363 6363
                     }
6364 6364
                     case is_bool($arg): {
@@ -6366,23 +6366,23 @@  discard block
 block discarded – undo
6366 6366
                         break;
6367 6367
                     }
6368 6368
                     case is_array($arg): {
6369
-                        $out = 'array $var' . $tmp;
6369
+                        $out = 'array $var'.$tmp;
6370 6370
                         break;
6371 6371
                     }
6372 6372
                     case is_object($arg): {
6373
-                        $out = get_class($arg) . ' $var' . $tmp;
6373
+                        $out = get_class($arg).' $var'.$tmp;
6374 6374
                         break;
6375 6375
                     }
6376 6376
                     default: {
6377
-                        $out = '$var' . $tmp;
6377
+                        $out = '$var'.$tmp;
6378 6378
                     }
6379 6379
                 }
6380 6380
                 $tmp++;
6381 6381
                 return $out;
6382 6382
             }, $args);
6383 6383
             $line = array(
6384
-                "<strong>" . $functionName . "</strong>(" . $args . ")",
6385
-                $path . " on line " . $val['line']
6384
+                "<strong>".$functionName."</strong>(".$args.")",
6385
+                $path." on line ".$val['line']
6386 6386
             );
6387 6387
             $table[] = array(implode("<br />", $line));
6388 6388
         }
@@ -6423,7 +6423,7 @@  discard block
 block discarded – undo
6423 6423
             $alias = strip_tags($alias); // strip HTML
6424 6424
             $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters
6425 6425
             $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash
6426
-            $alias = preg_replace('/-+/', '-', $alias);  // convert multiple dashes to one
6426
+            $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one
6427 6427
             $alias = trim($alias, '-'); // trim excess
6428 6428
             return $alias;
6429 6429
         }
@@ -6439,7 +6439,7 @@  discard block
 block discarded – undo
6439 6439
         $precisions = count($sizes) - 1;
6440 6440
         foreach ($sizes as $unit => $bytes) {
6441 6441
             if ($size >= $bytes) {
6442
-                return number_format($size / $bytes, $precisions) . ' ' . $unit;
6442
+                return number_format($size / $bytes, $precisions).' '.$unit;
6443 6443
             }
6444 6444
             $precisions--;
6445 6445
         }
@@ -6543,10 +6543,10 @@  discard block
 block discarded – undo
6543 6543
 
6544 6544
         if (strpos($str, MODX_MANAGER_PATH) === 0) {
6545 6545
             return false;
6546
-        } elseif (is_file(MODX_BASE_PATH . $str)) {
6547
-            $file_path = MODX_BASE_PATH . $str;
6548
-        } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) {
6549
-            $file_path = MODX_BASE_PATH . $tpl_dir . $str;
6546
+        } elseif (is_file(MODX_BASE_PATH.$str)) {
6547
+            $file_path = MODX_BASE_PATH.$str;
6548
+        } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) {
6549
+            $file_path = MODX_BASE_PATH.$tpl_dir.$str;
6550 6550
         } else {
6551 6551
             return false;
6552 6552
         }
@@ -6672,7 +6672,7 @@  discard block
 block discarded – undo
6672 6672
             $title = 'no title';
6673 6673
         }
6674 6674
         if (is_array($msg)) {
6675
-            $msg = '<pre>' . print_r($msg, true) . '</pre>';
6675
+            $msg = '<pre>'.print_r($msg, true).'</pre>';
6676 6676
         } elseif ($msg === '') {
6677 6677
             $msg = $_SERVER['REQUEST_URI'];
6678 6678
         }
Please login to merge, or discard this patch.
manager/includes/src/Event.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
     }
64 64
 
65 65
     /**
66
-     * @return mixed
66
+     * @return string
67 67
      */
68 68
     public function getOutput()
69 69
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
         if (is_array($SystemAlertMsgQueque)) {
36 36
             $title = '';
37 37
             if ($this->name && $this->activePlugin) {
38
-                $title = "<div><b>" . $this->activePlugin . "</b> - <span style='color:maroon;'>" . $this->name . "</span></div>";
38
+                $title = "<div><b>".$this->activePlugin."</b> - <span style='color:maroon;'>".$this->name."</span></div>";
39 39
             }
40 40
             $SystemAlertMsgQueque[] = "$title<div style='margin-left:10px;margin-top:3px;'>$msg</div>";
41 41
         }
Please login to merge, or discard this patch.
install/cli-install.php 1 patch
Spacing   +331 added lines, -332 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@  discard block
 block discarded – undo
5 5
  */
6 6
 
7 7
 $self = 'install/cli-install.php';
8
-$path = dirname(__FILE__) . '/';
9
-$base_path = str_replace($self,'',str_replace('\\','/', __FILE__));
8
+$path = dirname(__FILE__).'/';
9
+$base_path = str_replace($self, '', str_replace('\\', '/', __FILE__));
10 10
 define('MODX_API_MODE', true);
11 11
 define('MODX_BASE_PATH', $base_path);
12 12
 define('MODX_SITE_URL', '/');
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 if (is_file($base_path."assets/cache/siteManager.php")) {
20 20
     include_once($base_path."assets/cache/siteManager.php");
21 21
 }
22
-if(!defined('MGR_DIR') && is_dir($base_path."manager")) {
22
+if (!defined('MGR_DIR') && is_dir($base_path."manager")) {
23 23
     define('MGR_DIR', 'manager');
24 24
 }
25 25
 
@@ -33,43 +33,43 @@  discard block
 block discarded – undo
33 33
 $moduleSQLDataFile = $path."setup.data.sql";
34 34
 $moduleSQLResetFile = $path."setup.data.reset.sql";
35 35
 
36
-$moduleChunks = array (); // chunks - array : name, description, type - 0:file or 1:content, file or content
37
-$moduleTemplates = array (); // templates - array : name, description, type - 0:file or 1:content, file or content
38
-$moduleSnippets = array (); // snippets - array : name, description, type - 0:file or 1:content, file or content,properties
39
-$modulePlugins = array (); // plugins - array : name, description, type - 0:file or 1:content, file or content,properties, events,guid
40
-$moduleModules = array (); // modules - array : name, description, type - 0:file or 1:content, file or content,properties, guid
41
-$moduleTemplates = array (); // templates - array : name, description, type - 0:file or 1:content, file or content,properties
42
-$moduleTVs = array (); // template variables - array : name, description, type - 0:file or 1:content, file or content,properties
36
+$moduleChunks = array(); // chunks - array : name, description, type - 0:file or 1:content, file or content
37
+$moduleTemplates = array(); // templates - array : name, description, type - 0:file or 1:content, file or content
38
+$moduleSnippets = array(); // snippets - array : name, description, type - 0:file or 1:content, file or content,properties
39
+$modulePlugins = array(); // plugins - array : name, description, type - 0:file or 1:content, file or content,properties, events,guid
40
+$moduleModules = array(); // modules - array : name, description, type - 0:file or 1:content, file or content,properties, guid
41
+$moduleTemplates = array(); // templates - array : name, description, type - 0:file or 1:content, file or content,properties
42
+$moduleTVs = array(); // template variables - array : name, description, type - 0:file or 1:content, file or content,properties
43 43
 $moduleDependencies = array(); // module depedencies - array : module, table, column, type, name
44
-$errors= 0;
44
+$errors = 0;
45 45
 
46 46
 
47
-$installMode= 0;
47
+$installMode = 0;
48 48
 $installData = 0;
49 49
 $tableprefixauto = base_convert(rand(10, 20), 10, 36).substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyz'), rand(0, 33), 3).'_';
50 50
 
51 51
 $args = array_slice($argv, 1);
52 52
 
53
-if ( empty($args) ){
53
+if (empty($args)) {
54 54
     echo 'Install Evolution CMS'.PHP_EOL;
55 55
     //$installYes = readline("Type 'y' to continue: ");
56 56
     //if ($installYes != 'y') return;
57 57
 
58 58
     //set param manual
59
-    $databasehost = readline($_lang['connection_screen_database_host']. ' [localhost] ');
60
-    $databaseloginname = readline($_lang['connection_screen_database_login']. ' ');
61
-    $databaseloginpassword = readline($_lang['connection_screen_database_pass']. ' ');
62
-    $database_name = readline($_lang['connection_screen_database_name']. ' ');
63
-    $tableprefix = readline($_lang['connection_screen_table_prefix']. ' ['.$tableprefixauto.'] ');
64
-    $database_connection_method = readline($_lang['connection_screen_connection_method']. ' [SET CHARACTER SET] ');
65
-    $database_collation = readline($_lang['connection_screen_collation']. ' [utf8_general_ci] ');
66
-    $cmsadmin = readline($_lang['connection_screen_default_admin_login']. ' [admin] ');
67
-    $cmsadminemail = readline($_lang['connection_screen_default_admin_email']. ' ');
68
-    $cmspassword = readline($_lang['connection_screen_default_admin_password']. ' ');
69
-    $managerlanguage = readline('Мanager language:' . ' [en] ');
70
-    $installData = readline('Instal demo-site (y/n):' . ' [n] ');
71
-
72
-}else{
59
+    $databasehost = readline($_lang['connection_screen_database_host'].' [localhost] ');
60
+    $databaseloginname = readline($_lang['connection_screen_database_login'].' ');
61
+    $databaseloginpassword = readline($_lang['connection_screen_database_pass'].' ');
62
+    $database_name = readline($_lang['connection_screen_database_name'].' ');
63
+    $tableprefix = readline($_lang['connection_screen_table_prefix'].' ['.$tableprefixauto.'] ');
64
+    $database_connection_method = readline($_lang['connection_screen_connection_method'].' [SET CHARACTER SET] ');
65
+    $database_collation = readline($_lang['connection_screen_collation'].' [utf8_general_ci] ');
66
+    $cmsadmin = readline($_lang['connection_screen_default_admin_login'].' [admin] ');
67
+    $cmsadminemail = readline($_lang['connection_screen_default_admin_email'].' ');
68
+    $cmspassword = readline($_lang['connection_screen_default_admin_password'].' ');
69
+    $managerlanguage = readline('Мanager language:'.' [en] ');
70
+    $installData = readline('Instal demo-site (y/n):'.' [n] ');
71
+
72
+} else {
73 73
 
74 74
     $cli_variables = [];
75 75
     foreach ($args as $arg) {
@@ -100,14 +100,14 @@  discard block
 block discarded – undo
100 100
 }
101 101
 
102 102
 
103
-if ($databasehost == '') { $databasehost= 'localhost'; }
104
-if ($tableprefix == ''){ $tableprefix = $tableprefixauto; }
103
+if ($databasehost == '') { $databasehost = 'localhost'; }
104
+if ($tableprefix == '') { $tableprefix = $tableprefixauto; }
105 105
 if ($database_connection_method == '') { $database_connection_method = 'SET CHARACTER SET'; }
106 106
 if ($database_collation == '') { $database_collation = 'utf8_general_ci'; }
107
-if ($cmsadmin == ''){ $cmsadmin = 'admin'; }
107
+if ($cmsadmin == '') { $cmsadmin = 'admin'; }
108 108
 if ($managerlanguage == '') { $managerlanguage = 'en'; }
109
-if ($installData == 'y') { $installData = 1;}
110
-if ($mode == 'upgrade') { $installMode = 1;}
109
+if ($installData == 'y') { $installData = 1; }
110
+if ($mode == 'upgrade') { $installMode = 1; }
111 111
 
112 112
 //добавить обработку языка
113 113
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 }
124 124
 
125 125
 //////////////////////////////////////////////////////////////////////////////////////
126
-if( ! function_exists('f_owc')){
126
+if (!function_exists('f_owc')) {
127 127
     /**
128 128
      * @param $path
129 129
      * @param $data
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
             fwrite($hnd, $data);
137 137
             fclose($hnd);
138 138
 
139
-            if(null !== $mode) chmod($path, $mode);
140
-        }catch(Exception $e){
139
+            if (null !== $mode) chmod($path, $mode);
140
+        } catch (Exception $e) {
141 141
             // Nothing, this is NOT normal
142 142
             unset($e);
143 143
         }
@@ -147,24 +147,24 @@  discard block
 block discarded – undo
147 147
 // check PHP version
148 148
 define('PHP_MIN_VERSION', '5.4.0');
149 149
 $phpMinVersion = PHP_MIN_VERSION; // Maybe not necessary. For backward compatibility
150
-echo PHP_EOL . $_lang['checking_php_version'];
150
+echo PHP_EOL.$_lang['checking_php_version'];
151 151
 // -1 if left is less, 0 if equal, +1 if left is higher
152 152
 if (version_compare(phpversion(), PHP_MIN_VERSION) < 0) {
153 153
     $errors++;
154
-    $tmp = $_lang['you_running_php'] . phpversion() . str_replace('[+min_version+]', PHP_MIN_VERSION, $_lang["modx_requires_php"]);
155
-    echo $_lang['failed'] . ' ' . $tmp . PHP_EOL;
154
+    $tmp = $_lang['you_running_php'].phpversion().str_replace('[+min_version+]', PHP_MIN_VERSION, $_lang["modx_requires_php"]);
155
+    echo $_lang['failed'].' '.$tmp.PHP_EOL;
156 156
 } else {
157
-    echo $_lang['ok'] . PHP_EOL;
157
+    echo $_lang['ok'].PHP_EOL;
158 158
 }
159 159
 
160 160
 // check directories
161 161
 // cache exists?
162 162
 echo strip_tags($_lang['checking_if_cache_exist']);
163 163
 if (!file_exists($path."../assets/cache") || !file_exists($path."../assets/cache/rss")) {
164
-    echo $_lang['failed'] . PHP_EOL;
164
+    echo $_lang['failed'].PHP_EOL;
165 165
     $errors++;
166 166
 } else {
167
-    echo $_lang['ok'] . PHP_EOL;
167
+    echo $_lang['ok'].PHP_EOL;
168 168
 }
169 169
 
170 170
 
@@ -172,82 +172,82 @@  discard block
 block discarded – undo
172 172
 echo strip_tags($_lang['checking_if_cache_writable']);
173 173
 if (!is_writable($path."../assets/cache")) {
174 174
     $errors++;
175
-    echo $_lang['failed'] . PHP_EOL;
175
+    echo $_lang['failed'].PHP_EOL;
176 176
 } else {
177
-    echo $_lang['ok'] . PHP_EOL;
177
+    echo $_lang['ok'].PHP_EOL;
178 178
 }
179 179
 
180 180
 
181 181
 // cache files writable?
182 182
 echo strip_tags($_lang['checking_if_cache_file_writable']);
183 183
 $tmp = $path."../assets/cache/siteCache.idx.php";
184
-if ( ! file_exists($tmp)) {
184
+if (!file_exists($tmp)) {
185 185
     f_owc($tmp, "<?php //EVO site cache file ?>");
186 186
 }
187
-if ( ! is_writable($tmp)) {
187
+if (!is_writable($tmp)) {
188 188
     $errors++;
189
-    echo $_lang['failed'] . PHP_EOL;
189
+    echo $_lang['failed'].PHP_EOL;
190 190
 } else {
191
-    echo $_lang['ok'] . PHP_EOL;
191
+    echo $_lang['ok'].PHP_EOL;
192 192
 }
193 193
 
194 194
 
195 195
 echo strip_tags($_lang['checking_if_cache_file2_writable']);
196
-if ( ! is_writable($path."../assets/cache/sitePublishing.idx.php")) {
196
+if (!is_writable($path."../assets/cache/sitePublishing.idx.php")) {
197 197
     $errors++;
198
-    echo $_lang['failed'] . PHP_EOL;
198
+    echo $_lang['failed'].PHP_EOL;
199 199
 } else {
200
-    echo $_lang['ok'] . PHP_EOL;
200
+    echo $_lang['ok'].PHP_EOL;
201 201
 }
202 202
 
203 203
 
204 204
 // File Browser directories exists?
205 205
 echo strip_tags($_lang['checking_if_images_exist']);
206
-switch(true){
206
+switch (true) {
207 207
     case !file_exists($path."../assets/images"):
208 208
     case !file_exists($path."../assets/files"):
209 209
     case !file_exists($path."../assets/backup"):
210 210
     //case !file_exists("../assets/.thumbs"):
211 211
         $errors++;
212
-        echo $_lang['failed'] . PHP_EOL;
212
+        echo $_lang['failed'].PHP_EOL;
213 213
         break;
214 214
     default:
215
-        echo $_lang['ok'] . PHP_EOL;
215
+        echo $_lang['ok'].PHP_EOL;
216 216
 }
217 217
 
218 218
 
219 219
 // File Browser directories writable?
220 220
 echo strip_tags($_lang['checking_if_images_writable']);
221
-switch(true){
221
+switch (true) {
222 222
     case !is_writable($path."../assets/images"):
223 223
     case !is_writable($path."../assets/files"):
224 224
     case !is_writable($path."../assets/backup"):
225 225
     //case !is_writable("../assets/.thumbs"):
226 226
         $errors++;
227
-        echo $_lang['failed'] . PHP_EOL;
227
+        echo $_lang['failed'].PHP_EOL;
228 228
         break;
229 229
     default:
230
-        echo $_lang['ok'] . PHP_EOL;
230
+        echo $_lang['ok'].PHP_EOL;
231 231
 }
232 232
 
233 233
 
234 234
 // export exists?
235 235
 echo strip_tags($_lang['checking_if_export_exists']);
236 236
 if (!file_exists($path."../assets/export")) {
237
-    echo $_lang['failed'] . PHP_EOL;
237
+    echo $_lang['failed'].PHP_EOL;
238 238
     $errors++;
239 239
 } else {
240
-    echo $_lang['ok'] . PHP_EOL;
240
+    echo $_lang['ok'].PHP_EOL;
241 241
 }
242 242
 
243 243
 
244 244
 // export writable?
245 245
 echo strip_tags($_lang['checking_if_export_writable']);
246 246
 if (!is_writable($path."../assets/export")) {
247
-    echo $_lang['failed'] . PHP_EOL;
247
+    echo $_lang['failed'].PHP_EOL;
248 248
     $errors++;
249 249
 } else {
250
-    echo $_lang['ok'] . PHP_EOL;
250
+    echo $_lang['ok'].PHP_EOL;
251 251
 }
252 252
 
253 253
 
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
 $isWriteable = is_writable($tmp);
263 263
 if (!$isWriteable) {
264 264
     $errors++;
265
-    echo $_lang['failed'] . PHP_EOL;
265
+    echo $_lang['failed'].PHP_EOL;
266 266
 } else {
267
-    echo $_lang['ok'] . PHP_EOL;
267
+    echo $_lang['ok'].PHP_EOL;
268 268
 }
269 269
 
270 270
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
     $database_charset = substr($database_collation, 0, strpos($database_collation, '_') - 1);
281 281
     $database_connection_charset = $database_collation;
282 282
     $database_connection_method = $database_connection_method;
283
-    $dbase = '`' . $database_name . '`';
283
+    $dbase = '`'.$database_name.'`';
284 284
     $table_prefix = $tableprefix;
285 285
 }
286 286
 echo $_lang['creating_database_connection'];
@@ -320,33 +320,33 @@  discard block
 block discarded – undo
320 320
 
321 321
 // check table prefix
322 322
 if ($conn && $installMode == 0) {
323
-    echo $_lang['checking_table_prefix'] . $table_prefix . '`: ';
324
-    if ($rs= mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) {
325
-        echo $_lang['failed'] . ' ' . $_lang['table_prefix_already_inuse_note'] . PHP_EOL;
323
+    echo $_lang['checking_table_prefix'].$table_prefix.'`: ';
324
+    if ($rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) {
325
+        echo $_lang['failed'].' '.$_lang['table_prefix_already_inuse_note'].PHP_EOL;
326 326
         $errors++;
327 327
 
328 328
     } else {
329
-        echo $_lang['ok'] . PHP_EOL;
329
+        echo $_lang['ok'].PHP_EOL;
330 330
     }
331 331
 } elseif ($conn && $installMode == 2) {
332
-    echo $_lang['checking_table_prefix'] . $table_prefix . '`: ';
333
-    if (!$rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) {
334
-        echo $_lang['failed'] . ' ' . $_lang['table_prefix_not_exist'] . PHP_EOL;
332
+    echo $_lang['checking_table_prefix'].$table_prefix.'`: ';
333
+    if (!$rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) {
334
+        echo $_lang['failed'].' '.$_lang['table_prefix_not_exist'].PHP_EOL;
335 335
         $errors++;
336 336
 
337 337
   } else {
338
-        echo $_lang['ok'] . PHP_EOL;
338
+        echo $_lang['ok'].PHP_EOL;
339 339
   }
340 340
 }
341 341
 
342 342
 // check mysql version
343 343
 if ($conn) {
344 344
     echo $_lang['checking_mysql_version'];
345
-    if ( version_compare(mysqli_get_server_info($conn), '5.0.51', '=') ) {
346
-        echo $_lang['warning'] . ' ' . $_lang['mysql_5051'] . PHP_EOL;
347
-        echo $_lang['mysql_5051_warning'] . PHP_EOL;
345
+    if (version_compare(mysqli_get_server_info($conn), '5.0.51', '=')) {
346
+        echo $_lang['warning'].' '.$_lang['mysql_5051'].PHP_EOL;
347
+        echo $_lang['mysql_5051_warning'].PHP_EOL;
348 348
     } else {
349
-        echo $_lang['ok'] . ' ' . $_lang['mysql_version_is'] . mysqli_get_server_info($conn) . PHP_EOL;
349
+        echo $_lang['ok'].' '.$_lang['mysql_version_is'].mysqli_get_server_info($conn).PHP_EOL;
350 350
     }
351 351
 }
352 352
 
@@ -354,20 +354,20 @@  discard block
 block discarded – undo
354 354
 if ($conn) {
355 355
     echo $_lang['checking_mysql_strict_mode'];
356 356
     $mysqlmode = mysqli_query($conn, "SELECT @@global.sql_mode");
357
-    if (mysqli_num_rows($mysqlmode) > 0){
357
+    if (mysqli_num_rows($mysqlmode) > 0) {
358 358
         $modes = mysqli_fetch_array($mysqlmode, MYSQLI_NUM);
359 359
         //$modes = array("STRICT_TRANS_TABLES"); // for testing
360 360
         // print_r($modes);
361 361
         foreach ($modes as $mode) {
362 362
             if (stristr($mode, "STRICT_TRANS_TABLES") !== false || stristr($mode, "STRICT_ALL_TABLES") !== false) {
363
-                echo $_lang['warning'] . ' ' . $_lang['strict_mode'] . PHP_EOL;
364
-                echo $_lang['strict_mode_error'] . PHP_EOL;
363
+                echo $_lang['warning'].' '.$_lang['strict_mode'].PHP_EOL;
364
+                echo $_lang['strict_mode_error'].PHP_EOL;
365 365
             } else {
366
-                echo $_lang['ok'] . PHP_EOL;
366
+                echo $_lang['ok'].PHP_EOL;
367 367
             }
368 368
         }
369 369
     } else {
370
-        echo $_lang['ok'] . PHP_EOL;
370
+        echo $_lang['ok'].PHP_EOL;
371 371
     }
372 372
 }
373 373
 // Version and strict mode check end
@@ -383,17 +383,17 @@  discard block
 block discarded – undo
383 383
     f_owc($path."../assets/cache/installProc.inc.php", '<?php $installStartTime = '.time().'; ?>');
384 384
 }
385 385
 
386
-if($installMode > 0 && $_POST['installdata'] == "1") {
387
-    echo $_lang['sample_web_site'] . ': ' . $_lang['sample_web_site_note'] . PHP_EOL;
386
+if ($installMode > 0 && $_POST['installdata'] == "1") {
387
+    echo $_lang['sample_web_site'].': '.$_lang['sample_web_site_note'].PHP_EOL;
388 388
 }
389 389
 
390 390
 if ($errors > 0) {
391
-    echo $_lang['setup_cannot_continue'] . ' ';
391
+    echo $_lang['setup_cannot_continue'].' ';
392 392
 
393
-    if($errors > 1){
394
-        echo $errors . " " . $_lang['errors'] . $_lang['please_correct_errors'] . $_lang['and_try_again_plural'];
395
-    }else{
396
-        echo $_lang['error'] . $_lang['please_correct_error'] . $_lang['and_try_again']. PHP_EOL;
393
+    if ($errors > 1) {
394
+        echo $errors." ".$_lang['errors'].$_lang['please_correct_errors'].$_lang['and_try_again_plural'];
395
+    } else {
396
+        echo $_lang['error'].$_lang['please_correct_error'].$_lang['and_try_again'].PHP_EOL;
397 397
     }
398 398
 
399 399
     die();
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
     $database_charset = substr($database_collation, 0, strpos($database_collation, '_'));
423 423
     $database_connection_charset = $database_charset;
424 424
     $database_connection_method = $database_connection_method;
425
-    $dbase = "`" .$database_name. "`";
425
+    $dbase = "`".$database_name."`";
426 426
     $table_prefix = $tableprefix;
427 427
     $adminname = $cmsadmin;
428 428
     $adminemail = $cmsadminemail;
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 
434 434
 // set session name variable
435 435
 if (!isset ($site_sessionname)) {
436
-    $site_sessionname = 'SN' . uniqid('');
436
+    $site_sessionname = 'SN'.uniqid('');
437 437
 }
438 438
 
439 439
 // get base path and url
@@ -447,8 +447,8 @@  discard block
 block discarded – undo
447 447
     array_pop($a);
448 448
 $pth = implode("install", $a);
449 449
 unset ($a);
450
-$base_url = $url . (substr($url, -1) != "/" ? "/" : "");
451
-$base_path = $pth . (substr($pth, -1) != "/" ? "/" : "");
450
+$base_url = $url.(substr($url, -1) != "/" ? "/" : "");
451
+$base_path = $pth.(substr($pth, -1) != "/" ? "/" : "");
452 452
 
453 453
 // connect to the database
454 454
 echo $_lang['setup_database_create_connection'].': ';
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 }
461 461
 
462 462
 // select database
463
-echo $_lang['setup_database_selection']. str_replace("`", "", $dbase) . "`: ";
463
+echo $_lang['setup_database_selection'].str_replace("`", "", $dbase)."`: ";
464 464
 if (!mysqli_select_db($conn, str_replace("`", "", $dbase))) {
465 465
     echo $_lang['setup_database_selection_failed']." ".$_lang['setup_database_selection_failed_note'].PHP_EOL;
466 466
     $create = true;
@@ -472,16 +472,16 @@  discard block
 block discarded – undo
472 472
 
473 473
 // try to create the database
474 474
 if ($create) {
475
-    echo $_lang['setup_database_creation']. str_replace("`", "", $dbase) . "`: ";
475
+    echo $_lang['setup_database_creation'].str_replace("`", "", $dbase)."`: ";
476 476
     //  if(!@mysqli_create_db(str_replace("`","",$dbase), $conn)) {
477
-    if (! mysqli_query($conn, "CREATE DATABASE $dbase DEFAULT CHARACTER SET $database_charset COLLATE $database_collation")) {
477
+    if (!mysqli_query($conn, "CREATE DATABASE $dbase DEFAULT CHARACTER SET $database_charset COLLATE $database_collation")) {
478 478
         echo $_lang['setup_database_creation_failed']." ".$_lang['setup_database_creation_failed_note'].PHP_EOL;
479 479
         $errors += 1;
480 480
 
481
-        echo 'database charset: ' . $database_charset . PHP_EOL;
482
-        echo 'database collation: ' . $database_collation . PHP_EOL;
481
+        echo 'database charset: '.$database_charset.PHP_EOL;
482
+        echo 'database collation: '.$database_collation.PHP_EOL;
483 483
 
484
-        echo $_lang['setup_database_creation_failed_note2'] . PHP_EOL;
484
+        echo $_lang['setup_database_creation_failed_note2'].PHP_EOL;
485 485
 
486 486
         die();
487 487
 
@@ -492,18 +492,18 @@  discard block
 block discarded – undo
492 492
 
493 493
 // check table prefix
494 494
 if ($installMode == 0) {
495
-    echo $_lang['checking_table_prefix'] . $table_prefix . "`: ";
496
-    if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) {
497
-        echo $_lang['failed'] . " " . $_lang['table_prefix_already_inuse'] . PHP_EOL;
495
+    echo $_lang['checking_table_prefix'].$table_prefix."`: ";
496
+    if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) {
497
+        echo $_lang['failed']." ".$_lang['table_prefix_already_inuse'].PHP_EOL;
498 498
         $errors += 1;
499
-        echo $_lang['table_prefix_already_inuse_note'] . PHP_EOL;
499
+        echo $_lang['table_prefix_already_inuse_note'].PHP_EOL;
500 500
         return;
501 501
     } else {
502 502
         echo $_lang['ok'].PHP_EOL;
503 503
     }
504 504
 }
505 505
 
506
-if(!function_exists('parseProperties')) {
506
+if (!function_exists('parseProperties')) {
507 507
     /**
508 508
      * parses a resource property string and returns the result as an array
509 509
      * duplicate of method in documentParser class
@@ -511,20 +511,20 @@  discard block
 block discarded – undo
511 511
      * @param string $propertyString
512 512
      * @return array
513 513
      */
514
-    function parseProperties($propertyString) {
515
-        $parameter= array ();
514
+    function parseProperties($propertyString){
515
+        $parameter = array();
516 516
         if (!empty ($propertyString)) {
517
-            $tmpParams= explode("&", $propertyString);
517
+            $tmpParams = explode("&", $propertyString);
518 518
             $countParams = count($tmpParams);
519
-            for ($x= 0; $x < $countParams; $x++) {
519
+            for ($x = 0; $x < $countParams; $x++) {
520 520
                 if (strpos($tmpParams[$x], '=', 0)) {
521
-                    $pTmp= explode("=", $tmpParams[$x]);
522
-                    $pvTmp= explode(";", trim($pTmp[1]));
521
+                    $pTmp = explode("=", $tmpParams[$x]);
522
+                    $pvTmp = explode(";", trim($pTmp[1]));
523 523
                     if ($pvTmp[1] == 'list' && $pvTmp[3] != "")
524
-                        $parameter[trim($pTmp[0])]= $pvTmp[3]; //list default
524
+                        $parameter[trim($pTmp[0])] = $pvTmp[3]; //list default
525 525
                     else
526 526
                         if ($pvTmp[1] != 'list' && $pvTmp[2] != "")
527
-                            $parameter[trim($pTmp[0])]= $pvTmp[2];
527
+                            $parameter[trim($pTmp[0])] = $pvTmp[2];
528 528
                 }
529 529
             }
530 530
         }
@@ -535,20 +535,20 @@  discard block
 block discarded – undo
535 535
 // check status of Inherit Parent Template plugin
536 536
 $auto_template_logic = 'parent';
537 537
 if ($installMode != 0) {
538
-    $rs = mysqli_query($conn, "SELECT properties, disabled FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='Inherit Parent Template'");
538
+    $rs = mysqli_query($conn, "SELECT properties, disabled FROM $dbase.`".$table_prefix."site_plugins` WHERE name='Inherit Parent Template'");
539 539
     $row = mysqli_fetch_row($rs);
540
-    if(!$row) {
540
+    if (!$row) {
541 541
         // not installed
542 542
         $auto_template_logic = 'system';
543 543
     } else {
544
-        if($row[1] == 1) {
544
+        if ($row[1] == 1) {
545 545
             // installed but disabled
546 546
             $auto_template_logic = 'system';
547 547
         } else {
548 548
             // installed, enabled .. see how it's configured
549 549
             $properties = parseProperties($row[0]);
550
-            if(isset($properties['inheritTemplate'])) {
551
-                if($properties['inheritTemplate'] == 'From First Sibling') {
550
+            if (isset($properties['inheritTemplate'])) {
551
+                if ($properties['inheritTemplate'] == 'From First Sibling') {
552 552
                     $auto_template_logic = 'sibling';
553 553
                 }
554 554
             }
@@ -570,17 +570,16 @@  discard block
 block discarded – undo
570 570
 
571 571
 // setup Template template files - array : name, description, type - 0:file or 1:content, parameters, category
572 572
 $mt = &$moduleTemplates;
573
-if(is_dir($templatePath) && is_readable($templatePath)) {
573
+if (is_dir($templatePath) && is_readable($templatePath)) {
574 574
     $d = dir($templatePath);
575 575
     while (false !== ($tplfile = $d->read()))
576 576
     {
577
-        if(substr($tplfile, -4) != '.tpl') continue;
577
+        if (substr($tplfile, -4) != '.tpl') continue;
578 578
         $params = parse_docblock($templatePath, $tplfile);
579
-        if(is_array($params) && (count($params)>0))
579
+        if (is_array($params) && (count($params) > 0))
580 580
         {
581 581
             $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
582
-            $mt[] = array
583
-            (
582
+            $mt[] = array(
584 583
                 $params['name'],
585 584
                 $description,
586 585
                 // Don't think this is gonna be used ... but adding it just in case 'type'
@@ -598,12 +597,12 @@  discard block
 block discarded – undo
598 597
 
599 598
 // setup Template Variable template files
600 599
 $mtv = &$moduleTVs;
601
-if(is_dir($tvPath) && is_readable($tvPath)) {
600
+if (is_dir($tvPath) && is_readable($tvPath)) {
602 601
     $d = dir($tvPath);
603 602
     while (false !== ($tplfile = $d->read())) {
604
-        if(substr($tplfile, -4) != '.tpl') continue;
603
+        if (substr($tplfile, -4) != '.tpl') continue;
605 604
         $params = parse_docblock($tvPath, $tplfile);
606
-        if(is_array($params) && (count($params)>0)) {
605
+        if (is_array($params) && (count($params) > 0)) {
607 606
             $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
608 607
             $mtv[] = array(
609 608
                 $params['name'],
@@ -615,9 +614,9 @@  discard block
 block discarded – undo
615 614
                 $params['output_widget'],
616 615
                 $params['output_widget_params'],
617 616
                 "$templatePath/{$params['filename']}", /* not currently used */
618
-                $params['template_assignments']!="*"?$params['template_assignments']:implode(",",array_map(create_function('$v','return $v[0];'),$mt)), /* comma-separated list of template names */
617
+                $params['template_assignments'] != "*" ? $params['template_assignments'] : implode(",", array_map(create_function('$v', 'return $v[0];'), $mt)), /* comma-separated list of template names */
619 618
                 $params['modx_category'],
620
-                $params['lock_tv'],  /* value should be 1 or 0 */
619
+                $params['lock_tv'], /* value should be 1 or 0 */
621 620
                 array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false
622 621
             );
623 622
         }
@@ -627,14 +626,14 @@  discard block
 block discarded – undo
627 626
 
628 627
 // setup chunks template files - array : name, description, type - 0:file or 1:content, file or content
629 628
 $mc = &$moduleChunks;
630
-if(is_dir($chunkPath) && is_readable($chunkPath)) {
629
+if (is_dir($chunkPath) && is_readable($chunkPath)) {
631 630
     $d = dir($chunkPath);
632 631
     while (false !== ($tplfile = $d->read())) {
633
-        if(substr($tplfile, -4) != '.tpl') {
632
+        if (substr($tplfile, -4) != '.tpl') {
634 633
             continue;
635 634
         }
636 635
         $params = parse_docblock($chunkPath, $tplfile);
637
-        if(is_array($params) && count($params) > 0) {
636
+        if (is_array($params) && count($params) > 0) {
638 637
             $mc[] = array(
639 638
                 $params['name'],
640 639
                 $params['description'],
@@ -650,14 +649,14 @@  discard block
 block discarded – undo
650 649
 
651 650
 // setup snippets template files - array : name, description, type - 0:file or 1:content, file or content,properties
652 651
 $ms = &$moduleSnippets;
653
-if(is_dir($snippetPath) && is_readable($snippetPath)) {
652
+if (is_dir($snippetPath) && is_readable($snippetPath)) {
654 653
     $d = dir($snippetPath);
655 654
     while (false !== ($tplfile = $d->read())) {
656
-        if(substr($tplfile, -4) != '.tpl') {
655
+        if (substr($tplfile, -4) != '.tpl') {
657 656
             continue;
658 657
         }
659 658
         $params = parse_docblock($snippetPath, $tplfile);
660
-        if(is_array($params) && count($params) > 0) {
659
+        if (is_array($params) && count($params) > 0) {
661 660
             $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
662 661
             $ms[] = array(
663 662
                 $params['name'],
@@ -674,14 +673,14 @@  discard block
 block discarded – undo
674 673
 
675 674
 // setup plugins template files - array : name, description, type - 0:file or 1:content, file or content,properties
676 675
 $mp = &$modulePlugins;
677
-if(is_dir($pluginPath) && is_readable($pluginPath)) {
676
+if (is_dir($pluginPath) && is_readable($pluginPath)) {
678 677
     $d = dir($pluginPath);
679 678
     while (false !== ($tplfile = $d->read())) {
680
-        if(substr($tplfile, -4) != '.tpl') {
679
+        if (substr($tplfile, -4) != '.tpl') {
681 680
             continue;
682 681
         }
683 682
         $params = parse_docblock($pluginPath, $tplfile);
684
-        if(is_array($params) && count($params) > 0) {
683
+        if (is_array($params) && count($params) > 0) {
685 684
             $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
686 685
             $mp[] = array(
687 686
                 $params['name'],
@@ -693,7 +692,7 @@  discard block
 block discarded – undo
693 692
                 $params['modx_category'],
694 693
                 $params['legacy_names'],
695 694
                 array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false,
696
-                (int)$params['disabled']
695
+                (int) $params['disabled']
697 696
             );
698 697
         }
699 698
     }
@@ -703,14 +702,14 @@  discard block
 block discarded – undo
703 702
 // setup modules - array : name, description, type - 0:file or 1:content, file or content,properties, guid,enable_sharedparams
704 703
 $mm = &$moduleModules;
705 704
 $mdp = &$moduleDependencies;
706
-if(is_dir($modulePath) && is_readable($modulePath)) {
705
+if (is_dir($modulePath) && is_readable($modulePath)) {
707 706
     $d = dir($modulePath);
708 707
     while (false !== ($tplfile = $d->read())) {
709
-        if(substr($tplfile, -4) != '.tpl') {
708
+        if (substr($tplfile, -4) != '.tpl') {
710 709
             continue;
711 710
         }
712 711
         $params = parse_docblock($modulePath, $tplfile);
713
-        if(is_array($params) && count($params) > 0) {
712
+        if (is_array($params) && count($params) > 0) {
714 713
             $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
715 714
             $mm[] = array(
716 715
                 $params['name'],
@@ -718,12 +717,12 @@  discard block
 block discarded – undo
718 717
                 "$modulePath/{$params['filename']}",
719 718
                 $params['properties'],
720 719
                 $params['guid'],
721
-                (int)$params['shareparams'],
720
+                (int) $params['shareparams'],
722 721
                 $params['modx_category'],
723 722
                 array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false
724 723
             );
725 724
         }
726
-        if ((int)$params['shareparams'] || !empty($params['dependencies'])) {
725
+        if ((int) $params['shareparams'] || !empty($params['dependencies'])) {
727 726
             $dependencies = explode(',', $params['dependencies']);
728 727
             foreach ($dependencies as $dependency) {
729 728
                 $dependency = explode(':', $dependency);
@@ -794,103 +793,103 @@  discard block
 block discarded – undo
794 793
 // setup callback function
795 794
 $callBackFnc = "clean_up";
796 795
 
797
-function clean_up($sqlParser) {
796
+function clean_up($sqlParser){
798 797
     $ids = array();
799 798
 
800 799
     // secure web documents - privateweb
801
-    mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 0 WHERE privateweb = 1");
802
-    $sql =  "SELECT DISTINCT sc.id
800
+    mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 0 WHERE privateweb = 1");
801
+    $sql = "SELECT DISTINCT sc.id
803 802
              FROM `".$sqlParser->prefix."site_content` sc
804 803
              LEFT JOIN `".$sqlParser->prefix."document_groups` dg ON dg.document = sc.id
805 804
              LEFT JOIN `".$sqlParser->prefix."webgroup_access` wga ON wga.documentgroup = dg.document_group
806 805
              WHERE wga.id>0";
807
-    $ds = mysqli_query($sqlParser->conn,$sql);
808
-    if(!$ds) {
806
+    $ds = mysqli_query($sqlParser->conn, $sql);
807
+    if (!$ds) {
809 808
         echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn);
810 809
     }
811 810
     else {
812
-        while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"];
813
-        if(count($ids)>0) {
814
-            mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ",$ids).")");
811
+        while ($r = mysqli_fetch_assoc($ds)) $ids[] = $r["id"];
812
+        if (count($ids) > 0) {
813
+            mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ", $ids).")");
815 814
             unset($ids);
816 815
         }
817 816
     }
818 817
 
819 818
     // secure manager documents privatemgr
820
-    mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 0 WHERE privatemgr = 1");
821
-    $sql =  "SELECT DISTINCT sc.id
819
+    mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 0 WHERE privatemgr = 1");
820
+    $sql = "SELECT DISTINCT sc.id
822 821
              FROM `".$sqlParser->prefix."site_content` sc
823 822
              LEFT JOIN `".$sqlParser->prefix."document_groups` dg ON dg.document = sc.id
824 823
              LEFT JOIN `".$sqlParser->prefix."membergroup_access` mga ON mga.documentgroup = dg.document_group
825 824
              WHERE mga.id>0";
826
-    $ds = mysqli_query($sqlParser->conn,$sql);
827
-    if(!$ds) {
825
+    $ds = mysqli_query($sqlParser->conn, $sql);
826
+    if (!$ds) {
828 827
         echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn);
829 828
     }
830 829
     else {
831
-        while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"];
832
-        if(count($ids)>0) {
833
-            mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ",$ids).")");
830
+        while ($r = mysqli_fetch_assoc($ds)) $ids[] = $r["id"];
831
+        if (count($ids) > 0) {
832
+            mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ", $ids).")");
834 833
             unset($ids);
835 834
         }
836 835
     }
837 836
 }
838 837
 
839
-function parse_docblock($element_dir, $filename) {
838
+function parse_docblock($element_dir, $filename){
840 839
     $params = array();
841
-    $fullpath = $element_dir . '/' . $filename;
842
-    if(is_readable($fullpath)) {
840
+    $fullpath = $element_dir.'/'.$filename;
841
+    if (is_readable($fullpath)) {
843 842
         $tpl = @fopen($fullpath, "r");
844
-        if($tpl) {
843
+        if ($tpl) {
845 844
             $params['filename'] = $filename;
846 845
             $docblock_start_found = false;
847 846
             $name_found = false;
848 847
             $description_found = false;
849 848
 
850
-            while(!feof($tpl)) {
849
+            while (!feof($tpl)) {
851 850
                 $line = fgets($tpl);
852
-                if(!$docblock_start_found) {
851
+                if (!$docblock_start_found) {
853 852
                     // find docblock start
854
-                    if(strpos($line, '/**') !== false) {
853
+                    if (strpos($line, '/**') !== false) {
855 854
                         $docblock_start_found = true;
856 855
                     }
857 856
                     continue;
858
-                } elseif(!$name_found) {
857
+                } elseif (!$name_found) {
859 858
                     // find name
860 859
                     $ma = null;
861
-                    if(preg_match("/^\s+\*\s+(.+)/", $line, $ma)) {
860
+                    if (preg_match("/^\s+\*\s+(.+)/", $line, $ma)) {
862 861
                         $params['name'] = trim($ma[1]);
863 862
                         $name_found = !empty($params['name']);
864 863
                     }
865 864
                     continue;
866
-                } elseif(!$description_found) {
865
+                } elseif (!$description_found) {
867 866
                     // find description
868 867
                     $ma = null;
869
-                    if(preg_match("/^\s+\*\s+(.+)/", $line, $ma)) {
868
+                    if (preg_match("/^\s+\*\s+(.+)/", $line, $ma)) {
870 869
                         $params['description'] = trim($ma[1]);
871 870
                         $description_found = !empty($params['description']);
872 871
                     }
873 872
                     continue;
874 873
                 } else {
875 874
                     $ma = null;
876
-                    if(preg_match("/^\s+\*\s+\@([^\s]+)\s+(.+)/", $line, $ma)) {
875
+                    if (preg_match("/^\s+\*\s+\@([^\s]+)\s+(.+)/", $line, $ma)) {
877 876
                         $param = trim($ma[1]);
878 877
                         $val = trim($ma[2]);
879
-                        if(!empty($param) && !empty($val)) {
880
-                            if($param == 'internal') {
878
+                        if (!empty($param) && !empty($val)) {
879
+                            if ($param == 'internal') {
881 880
                                 $ma = null;
882
-                                if(preg_match("/\@([^\s]+)\s+(.+)/", $val, $ma)) {
881
+                                if (preg_match("/\@([^\s]+)\s+(.+)/", $val, $ma)) {
883 882
                                     $param = trim($ma[1]);
884 883
                                     $val = trim($ma[2]);
885 884
                                 }
886 885
                                 //if($val !== '0' && (empty($param) || empty($val))) {
887
-                                if(empty($param)) {
886
+                                if (empty($param)) {
888 887
                                     continue;
889 888
                                 }
890 889
                             }
891 890
                             $params[$param] = $val;
892 891
                         }
893
-                    } elseif(preg_match("/^\s*\*\/\s*$/", $line)) {
892
+                    } elseif (preg_match("/^\s*\*\/\s*$/", $line)) {
894 893
                         break;
895 894
                     }
896 895
                 }
@@ -921,13 +920,13 @@  discard block
 block discarded – undo
921 920
     // display database results
922 921
     if ($sqlParser->installFailed == true) {
923 922
         $errors += 1;
924
-        echo $_lang['database_alerts'] . PHP_EOL;
925
-        echo $_lang['setup_couldnt_install'] . PHP_EOL;
926
-        echo $_lang['installation_error_occured'] . PHP_EOL;
923
+        echo $_lang['database_alerts'].PHP_EOL;
924
+        echo $_lang['setup_couldnt_install'].PHP_EOL;
925
+        echo $_lang['installation_error_occured'].PHP_EOL;
927 926
         for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) {
928
-            echo $sqlParser->mysqlErrors[$i]["error"] . " " . $_lang['during_execution_of_sql'] . " " . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . PHP_EOL;
927
+            echo $sqlParser->mysqlErrors[$i]["error"]." ".$_lang['during_execution_of_sql']." ".strip_tags($sqlParser->mysqlErrors[$i]["sql"]).PHP_EOL;
929 928
         }
930
-        echo $_lang['some_tables_not_updated'] . PHP_EOL;
929
+        echo $_lang['some_tables_not_updated'].PHP_EOL;
931 930
         die();
932 931
     } else {
933 932
         echo $_lang['ok'].PHP_EOL;
@@ -937,7 +936,7 @@  discard block
 block discarded – undo
937 936
 // custom or not
938 937
 if (file_exists($path."../assets/cache/siteManager.php")) {
939 938
     $mgrdir = 'include_once(dirname(__FILE__)."/../../assets/cache/siteManager.php");';
940
-}else{
939
+} else {
941 940
     $mgrdir = 'define(\'MGR_DIR\', \'manager\');';
942 941
 }
943 942
 
@@ -974,16 +973,16 @@  discard block
 block discarded – undo
974 973
 $chmodSuccess = @chmod($filename, 0404);
975 974
 
976 975
 if ($configFileFailed == true) {
977
-    echo $_lang['failed'] . PHP_EOL;
976
+    echo $_lang['failed'].PHP_EOL;
978 977
     $errors += 1;
979 978
 
980
-    echo $_lang['cant_write_config_file'] . ' ' . MGR_DIR .'/includes/config.inc.php' .PHP_EOL;
979
+    echo $_lang['cant_write_config_file'].' '.MGR_DIR.'/includes/config.inc.php'.PHP_EOL;
981 980
     echo ' '.PHP_EOL;
982 981
     echo ' '.PHP_EOL;
983 982
     echo $configString;
984 983
     echo ' '.PHP_EOL;
985 984
     echo ' '.PHP_EOL;
986
-    echo $_lang['cant_write_config_file_note'] . PHP_EOL;
985
+    echo $_lang['cant_write_config_file_note'].PHP_EOL;
987 986
     die();
988 987
 
989 988
 } else {
@@ -993,16 +992,16 @@  discard block
 block discarded – undo
993 992
 // generate new site_id and set manager theme to default
994 993
 if ($installMode == 0) {
995 994
     $siteid = uniqid('');
996
-    mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')");
995
+    mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')");
997 996
 } else {
998 997
     // update site_id if missing
999
-    $ds = mysqli_query($sqlParser->conn, "SELECT setting_name,setting_value FROM $dbase.`" . $table_prefix . "system_settings` WHERE setting_name='site_id'");
998
+    $ds = mysqli_query($sqlParser->conn, "SELECT setting_name,setting_value FROM $dbase.`".$table_prefix."system_settings` WHERE setting_name='site_id'");
1000 999
     if ($ds) {
1001 1000
         $r = mysqli_fetch_assoc($ds);
1002 1001
         $siteid = $r['setting_value'];
1003 1002
         if ($siteid == '' || $siteid = 'MzGeQ2faT4Dw06+U49x3') {
1004 1003
             $siteid = uniqid('');
1005
-            mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')");
1004
+            mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')");
1006 1005
         }
1007 1006
     }
1008 1007
 }
@@ -1014,29 +1013,29 @@  discard block
 block discarded – undo
1014 1013
     // display database results
1015 1014
     if ($sqlParser->installFailed == true) {
1016 1015
         $errors += 1;
1017
-        echo $_lang['database_alerts'] . PHP_EOL;
1018
-        echo $_lang['setup_couldnt_install'] . PHP_EOL;
1019
-        echo $_lang['installation_error_occured'] . PHP_EOL . PHP_EOL;
1016
+        echo $_lang['database_alerts'].PHP_EOL;
1017
+        echo $_lang['setup_couldnt_install'].PHP_EOL;
1018
+        echo $_lang['installation_error_occured'].PHP_EOL.PHP_EOL;
1020 1019
         /*
1021 1020
         for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) {
1022 1021
             echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />";
1023 1022
         }
1024 1023
         echo "</p>";*/
1025
-        echo $_lang['some_tables_not_updated'] . PHP_EOL;
1024
+        echo $_lang['some_tables_not_updated'].PHP_EOL;
1026 1025
         die();
1027 1026
     } else {
1028
-        echo $_lang['ok'] . PHP_EOL;
1027
+        echo $_lang['ok'].PHP_EOL;
1029 1028
     }
1030 1029
 }
1031 1030
 
1032 1031
 // Install Templates
1033 1032
 $moduleTemplate = $mt;
1034 1033
 if (!empty($moduleTemplate) || $installData) {
1035
-    echo PHP_EOL . $_lang['templates'] . ":" . PHP_EOL;
1034
+    echo PHP_EOL.$_lang['templates'].":".PHP_EOL;
1036 1035
     //$selTemplates = $_POST['template'];
1037 1036
     foreach ($moduleTemplates as $k=>$moduleTemplate) {
1038 1037
         $installSample = in_array('sample', $moduleTemplate[6]) && $installData == 1;
1039
-        if($installSample || is_array($moduleTemplate)) {
1038
+        if ($installSample || is_array($moduleTemplate)) {
1040 1039
             $name = mysqli_real_escape_string($conn, $moduleTemplate[0]);
1041 1040
             $desc = mysqli_real_escape_string($conn, $moduleTemplate[1]);
1042 1041
             $category = mysqli_real_escape_string($conn, $moduleTemplate[4]);
@@ -1044,7 +1043,7 @@  discard block
 block discarded – undo
1044 1043
             $filecontent = $moduleTemplate[3];
1045 1044
             $save_sql_id_as = $moduleTemplate[7]; // Nessecary for demo-site
1046 1045
             if (!file_exists($filecontent)) {
1047
-                echo "  $name: " . $_lang['unable_install_template'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1046
+                echo "  $name: ".$_lang['unable_install_template']." '$filecontent' ".$_lang['not_found'].PHP_EOL;
1048 1047
             } else {
1049 1048
                 // Create the category if it does not already exist
1050 1049
                 $category_id = getCreateDbCategory($category, $sqlParser);
@@ -1054,31 +1053,31 @@  discard block
 block discarded – undo
1054 1053
                 $template = mysqli_real_escape_string($conn, $template);
1055 1054
 
1056 1055
                 // See if the template already exists
1057
-                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name'");
1056
+                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name'");
1058 1057
 
1059 1058
                 if (mysqli_num_rows($rs)) {
1060
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;")) {
1059
+                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;")) {
1061 1060
                         $errors += 1;
1062
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1061
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1063 1062
                         return;
1064 1063
                     }
1065
-                    if(!is_null($save_sql_id_as)) {
1064
+                    if (!is_null($save_sql_id_as)) {
1066 1065
                         $sql_id = @mysqli_insert_id($sqlParser->conn);
1067
-                        if(!$sql_id) {
1068
-                            $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name' LIMIT 1;"));
1066
+                        if (!$sql_id) {
1067
+                            $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name' LIMIT 1;"));
1069 1068
                             $sql_id = $idQuery['id'];
1070 1069
                         }
1071 1070
                         $custom_placeholders[$save_sql_id_as] = $sql_id;
1072 1071
                     }
1073
-                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1072
+                    echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1074 1073
                 } else {
1075
-                    if (!@ mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) {
1074
+                    if (!@ mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) {
1076 1075
                         $errors += 1;
1077
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1076
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1078 1077
                         die();
1079 1078
                     }
1080
-                    if(!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn);
1081
-                    echo "  $name: " . $_lang['installed'] . PHP_EOL;
1079
+                    if (!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn);
1080
+                    echo "  $name: ".$_lang['installed'].PHP_EOL;
1082 1081
                 }
1083 1082
             }
1084 1083
         }
@@ -1088,11 +1087,11 @@  discard block
 block discarded – undo
1088 1087
 // Install Template Variables
1089 1088
 $moduleTVs = $mtv;
1090 1089
 if (is_array($moduleTVs) || $installData) {
1091
-    echo PHP_EOL . $_lang['tvs'].': '.PHP_EOL;
1090
+    echo PHP_EOL.$_lang['tvs'].': '.PHP_EOL;
1092 1091
     //$selTVs = $_POST['tv'];
1093 1092
     foreach ($moduleTVs as $k=>$moduleTV) {
1094 1093
         $installSample = in_array('sample', $moduleTV[12]) && $installData == 1;
1095
-        if($installSample || is_array($moduleTVs)) {
1094
+        if ($installSample || is_array($moduleTVs)) {
1096 1095
             $name = mysqli_real_escape_string($conn, $moduleTV[0]);
1097 1096
             $caption = mysqli_real_escape_string($conn, $moduleTV[1]);
1098 1097
             $desc = mysqli_real_escape_string($conn, $moduleTV[2]);
@@ -1110,24 +1109,24 @@  discard block
 block discarded – undo
1110 1109
             // Create the category if it does not already exist
1111 1110
             $category = getCreateDbCategory($category, $sqlParser);
1112 1111
 
1113
-            $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name'");
1112
+            $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name'");
1114 1113
             if (mysqli_num_rows($rs)) {
1115 1114
                 $insert = true;
1116
-                while($row = mysqli_fetch_assoc($rs)) {
1117
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};")) {
1118
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1115
+                while ($row = mysqli_fetch_assoc($rs)) {
1116
+                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};")) {
1117
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1119 1118
                         return;
1120 1119
                     }
1121 1120
                     $insert = false;
1122 1121
                 }
1123
-                echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1122
+                echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1124 1123
             } else {
1125
-                $q = "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',$category,$locked,'$input_options','$output_widget','$output_widget_params','$input_default');";
1124
+                $q = "INSERT INTO $dbase.`".$table_prefix."site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',$category,$locked,'$input_options','$output_widget','$output_widget_params','$input_default');";
1126 1125
                 if (!mysqli_query($sqlParser->conn, $q)) {
1127
-                    echo mysqli_error($sqlParser->conn) . PHP_EOL;
1126
+                    echo mysqli_error($sqlParser->conn).PHP_EOL;
1128 1127
                     return;
1129 1128
                 }
1130
-                echo "  $name: " . $_lang['installed'] . PHP_EOL;
1129
+                echo "  $name: ".$_lang['installed'].PHP_EOL;
1131 1130
             }
1132 1131
 
1133 1132
             // add template assignments
@@ -1136,10 +1135,10 @@  discard block
 block discarded – undo
1136 1135
             if (count($assignments) > 0) {
1137 1136
 
1138 1137
                 // remove existing tv -> template assignments
1139
-                $ds=mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';");
1138
+                $ds = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';");
1140 1139
                 $row = mysqli_fetch_assoc($ds);
1141 1140
                 $id = $row["id"];
1142
-                mysqli_query($sqlParser->conn, 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_tmplvar_templates` WHERE tmplvarid = \'' . $id . '\'');
1141
+                mysqli_query($sqlParser->conn, 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_tmplvar_templates` WHERE tmplvarid = \''.$id.'\'');
1143 1142
 
1144 1143
                 // add tv -> template assignments
1145 1144
                 foreach ($assignments as $assignment) {
@@ -1148,7 +1147,7 @@  discard block
 block discarded – undo
1148 1147
                     if ($ds && $ts) {
1149 1148
                         $tRow = mysqli_fetch_assoc($ts);
1150 1149
                         $templateId = $tRow['id'];
1151
-                        mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)");
1150
+                        mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)");
1152 1151
                    }
1153 1152
                 }
1154 1153
             }
@@ -1159,12 +1158,12 @@  discard block
 block discarded – undo
1159 1158
 
1160 1159
 $moduleChunks = $mc;
1161 1160
 // Install Chunks
1162
-if (is_array ($moduleChunks) || $installData) {
1163
-    echo PHP_EOL . $_lang['chunks'] . ": " . PHP_EOL;
1161
+if (is_array($moduleChunks) || $installData) {
1162
+    echo PHP_EOL.$_lang['chunks'].": ".PHP_EOL;
1164 1163
     foreach ($moduleChunks as $k=>$moduleChunk) {
1165 1164
         $installSample = in_array('sample', $moduleChunk[5]) && $installData == 1;
1166 1165
         $count_new_name = 0;
1167
-        if($installSample || is_array ($moduleChunks)) {
1166
+        if ($installSample || is_array($moduleChunks)) {
1168 1167
 
1169 1168
             $name = mysqli_real_escape_string($conn, $moduleChunk[0]);
1170 1169
             $desc = mysqli_real_escape_string($conn, $moduleChunk[1]);
@@ -1173,7 +1172,7 @@  discard block
 block discarded – undo
1173 1172
             $filecontent = $moduleChunk[2];
1174 1173
 
1175 1174
             if (!file_exists($filecontent))
1176
-                echo "  $name: " . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1175
+                echo "  $name: ".$_lang['unable_install_chunk']." '$filecontent' ".$_lang['not_found'].PHP_EOL;
1177 1176
             else {
1178 1177
 
1179 1178
                 // Create the category if it does not already exist
@@ -1181,31 +1180,31 @@  discard block
 block discarded – undo
1181 1180
 
1182 1181
                 $chunk = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', file_get_contents($filecontent), 1);
1183 1182
                 $chunk = mysqli_real_escape_string($conn, $chunk);
1184
-                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$name'");
1183
+                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$name'");
1185 1184
                 $count_original_name = mysqli_num_rows($rs);
1186
-                if($overwrite == 'false') {
1187
-                    $newname = $name . '-' . str_replace('.', '_', $modx_version);
1188
-                    $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$newname'");
1185
+                if ($overwrite == 'false') {
1186
+                    $newname = $name.'-'.str_replace('.', '_', $modx_version);
1187
+                    $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$newname'");
1189 1188
                     $count_new_name = mysqli_num_rows($rs);
1190 1189
                 }
1191 1190
                 $update = $count_original_name > 0 && $overwrite == 'true';
1192 1191
                 if ($update) {
1193
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
1192
+                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
1194 1193
                         $errors += 1;
1195
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1194
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1196 1195
                         return;
1197 1196
                     }
1198
-                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1199
-                } elseif($count_new_name == 0) {
1200
-                    if($count_original_name > 0 && $overwrite == 'false') {
1197
+                    echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1198
+                } elseif ($count_new_name == 0) {
1199
+                    if ($count_original_name > 0 && $overwrite == 'false') {
1201 1200
                         $name = $newname;
1202 1201
                     }
1203
-                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) {
1202
+                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) {
1204 1203
                         $errors += 1;
1205
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1204
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1206 1205
                         return;
1207 1206
                     }
1208
-                    echo "  $name: " . $_lang['installed'] . PHP_EOL;
1207
+                    echo "  $name: ".$_lang['installed'].PHP_EOL;
1209 1208
                 }
1210 1209
             }
1211 1210
         }
@@ -1215,11 +1214,11 @@  discard block
 block discarded – undo
1215 1214
 // Install Modules
1216 1215
 $moduleModules = $mm;
1217 1216
 if (is_array($moduleModules) || $installData) {
1218
-    echo PHP_EOL . $_lang['modules'] . ":" . PHP_EOL;
1217
+    echo PHP_EOL.$_lang['modules'].":".PHP_EOL;
1219 1218
     //$selModules = $_POST['module'];
1220 1219
     foreach ($moduleModules as $k=>$moduleModule) {
1221 1220
         $installSample = in_array('sample', $moduleModule[7]) && $installData == 1;
1222
-        if($installSample || is_array($moduleModules)) {
1221
+        if ($installSample || is_array($moduleModules)) {
1223 1222
             $name = mysqli_real_escape_string($conn, $moduleModule[0]);
1224 1223
             $desc = mysqli_real_escape_string($conn, $moduleModule[1]);
1225 1224
             $filecontent = $moduleModule[2];
@@ -1228,7 +1227,7 @@  discard block
 block discarded – undo
1228 1227
             $shared = mysqli_real_escape_string($conn, $moduleModule[5]);
1229 1228
             $category = mysqli_real_escape_string($conn, $moduleModule[6]);
1230 1229
             if (!file_exists($filecontent))
1231
-                echo "  $name: " . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1230
+                echo "  $name: ".$_lang['unable_install_module']." '$filecontent' ".$_lang['not_found'].PHP_EOL;
1232 1231
             else {
1233 1232
 
1234 1233
                 // Create the category if it does not already exist
@@ -1237,24 +1236,24 @@  discard block
 block discarded – undo
1237 1236
                 $module = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2));
1238 1237
                 // $module = removeDocblock($module, 'module'); // Modules have no fileBinding, keep docblock for info-tab
1239 1238
                 $module = mysqli_real_escape_string($conn, $module);
1240
-                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_modules` WHERE name='$name'");
1239
+                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_modules` WHERE name='$name'");
1241 1240
                 if (mysqli_num_rows($rs)) {
1242 1241
                     $row = mysqli_fetch_assoc($rs);
1243
-                    $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
1244
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
1245
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1242
+                    $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
1243
+                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
1244
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1246 1245
                         return;
1247 1246
                     }
1248
-                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1247
+                    echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1249 1248
                 } else {
1250
-                    if ($properties != NULL ){
1249
+                    if ($properties != NULL) {
1251 1250
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
1252 1251
                     }
1253
-                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) {
1254
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
1252
+                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) {
1253
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
1255 1254
                         return;
1256 1255
                     }
1257
-                    echo "  $name: " . $_lang['installed'] . PHP_EOL;
1256
+                    echo "  $name: ".$_lang['installed'].PHP_EOL;
1258 1257
                 }
1259 1258
             }
1260 1259
         }
@@ -1264,11 +1263,11 @@  discard block
 block discarded – undo
1264 1263
 // Install Plugins
1265 1264
 $modulePlugins = $mp;
1266 1265
 if (is_array($modulePlugins) || $installData) {
1267
-    echo PHP_EOL . $_lang['plugins'] . ":" . PHP_EOL;
1266
+    echo PHP_EOL.$_lang['plugins'].":".PHP_EOL;
1268 1267
     $selPlugs = $_POST['plugin'];
1269 1268
     foreach ($modulePlugins as $k=>$modulePlugin) {
1270 1269
         //$installSample = in_array('sample', $modulePlugin[8]) && $installData == 1;
1271
-        if($installSample || is_array($modulePlugins)) {
1270
+        if ($installSample || is_array($modulePlugins)) {
1272 1271
             $name = mysqli_real_escape_string($conn, $modulePlugin[0]);
1273 1272
             $desc = mysqli_real_escape_string($conn, $modulePlugin[1]);
1274 1273
             $filecontent = $modulePlugin[2];
@@ -1278,17 +1277,17 @@  discard block
 block discarded – undo
1278 1277
             $category = mysqli_real_escape_string($conn, $modulePlugin[6]);
1279 1278
             $leg_names = '';
1280 1279
             $disabled = $modulePlugin[9];
1281
-            if(array_key_exists(7, $modulePlugin)) {
1280
+            if (array_key_exists(7, $modulePlugin)) {
1282 1281
                 // parse comma-separated legacy names and prepare them for sql IN clause
1283
-                $leg_names = "'" . implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))) . "'";
1282
+                $leg_names = "'".implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7])))."'";
1284 1283
             }
1285 1284
             if (!file_exists($filecontent))
1286
-                echo "  $name: " . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1285
+                echo "  $name: ".$_lang['unable_install_plugin']." '$filecontent' ".$_lang['not_found'].PHP_EOL;
1287 1286
             else {
1288 1287
 
1289 1288
                 // disable legacy versions based on legacy_names provided
1290
-                if(!empty($leg_names)) {
1291
-                    $update_query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
1289
+                if (!empty($leg_names)) {
1290
+                    $update_query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
1292 1291
                     $rs = mysqli_query($sqlParser->conn, $update_query);
1293 1292
                 }
1294 1293
 
@@ -1298,52 +1297,52 @@  discard block
 block discarded – undo
1298 1297
                 $plugin = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2));
1299 1298
                 $plugin = removeDocblock($plugin, 'plugin');
1300 1299
                 $plugin = mysqli_real_escape_string($conn, $plugin);
1301
-                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='$name'");
1300
+                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name'");
1302 1301
                 if (mysqli_num_rows($rs)) {
1303 1302
                     $insert = true;
1304
-                    while($row = mysqli_fetch_assoc($rs)) {
1305
-                        $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
1306
-                        if($row['description'] == $desc){
1307
-                            if (! mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) {
1308
-                                echo mysqli_error($sqlParser->conn) . PHP_EOL;
1303
+                    while ($row = mysqli_fetch_assoc($rs)) {
1304
+                        $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
1305
+                        if ($row['description'] == $desc) {
1306
+                            if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) {
1307
+                                echo mysqli_error($sqlParser->conn).PHP_EOL;
1309 1308
                                 return;
1310 1309
                             }
1311 1310
                             $insert = false;
1312 1311
                         } else {
1313
-                            if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};")) {
1312
+                            if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE id={$row['id']};")) {
1314 1313
                                 echo mysqli_error($sqlParser->conn).PHP_EOL;
1315 1314
                                 return;
1316 1315
                             }
1317 1316
                         }
1318 1317
                     }
1319
-                    if($insert === true) {
1320
-                        $properties = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
1321
-                        if(!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);")) {
1318
+                    if ($insert === true) {
1319
+                        $properties = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
1320
+                        if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);")) {
1322 1321
                             echo mysqli_error($sqlParser->conn).PHP_EOL;
1323 1322
                             return;
1324 1323
                         }
1325 1324
                     }
1326
-                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1325
+                    echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1327 1326
                 } else {
1328
-                    if ($properties != NULL ){
1327
+                    if ($properties != NULL) {
1329 1328
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
1330 1329
                     }
1331
-                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) {
1332
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1330
+                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) {
1331
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1333 1332
                         return;
1334 1333
                     }
1335
-                    echo "  $name: " . $_lang['installed'] . PHP_EOL;
1334
+                    echo "  $name: ".$_lang['installed'].PHP_EOL;
1336 1335
                 }
1337 1336
                 // add system events
1338 1337
                 if (count($events) > 0) {
1339
-                    $ds=mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';");
1338
+                    $ds = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';");
1340 1339
                     if ($ds) {
1341 1340
                         $row = mysqli_fetch_assoc($ds);
1342 1341
                         $id = $row["id"];
1343 1342
                         // remove existing events
1344
-                        mysqli_query($sqlParser->conn, 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_plugin_events` WHERE pluginid = \'' . $id . '\'');
1343
+                        mysqli_query($sqlParser->conn, 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_plugin_events` WHERE pluginid = \''.$id.'\'');
1345 1344
                         // add new events
1346
-                        mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_plugin_events` (pluginid, evtid) SELECT '$id' as 'pluginid',se.id as 'evtid' FROM $dbase.`" . $table_prefix . "system_eventnames` se WHERE name IN ('" . implode("','", $events) . "')");
1345
+                        mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugin_events` (pluginid, evtid) SELECT '$id' as 'pluginid',se.id as 'evtid' FROM $dbase.`".$table_prefix."system_eventnames` se WHERE name IN ('".implode("','", $events)."')");
1347 1346
                     }
1348 1347
                 }
1349 1348
             }
@@ -1354,18 +1353,18 @@  discard block
 block discarded – undo
1354 1353
 // Install Snippets
1355 1354
 $moduleSnippet = $ms;
1356 1355
 if (is_array($moduleSnippet) || $installData) {
1357
-    echo PHP_EOL . $_lang['snippets'] . ":" . PHP_EOL;
1356
+    echo PHP_EOL.$_lang['snippets'].":".PHP_EOL;
1358 1357
     //$selSnips = $_POST['snippet'];
1359 1358
     foreach ($moduleSnippets as $k=>$moduleSnippet) {
1360 1359
         $installSample = in_array('sample', $moduleSnippet[5]) && $installData == 1;
1361
-        if($installSample || is_array($moduleSnippet)) {
1360
+        if ($installSample || is_array($moduleSnippet)) {
1362 1361
             $name = mysqli_real_escape_string($conn, $moduleSnippet[0]);
1363 1362
             $desc = mysqli_real_escape_string($conn, $moduleSnippet[1]);
1364 1363
             $filecontent = $moduleSnippet[2];
1365 1364
             $properties = $moduleSnippet[3];
1366 1365
             $category = mysqli_real_escape_string($conn, $moduleSnippet[4]);
1367 1366
             if (!file_exists($filecontent))
1368
-                echo "  $name: " . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1367
+                echo "  $name: ".$_lang['unable_install_snippet']." '$filecontent' ".$_lang['not_found'].PHP_EOL;
1369 1368
             else {
1370 1369
 
1371 1370
                 // Create the category if it does not already exist
@@ -1374,24 +1373,24 @@  discard block
 block discarded – undo
1374 1373
                 $snippet = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent)));
1375 1374
                 $snippet = removeDocblock($snippet, 'snippet');
1376 1375
                 $snippet = mysqli_real_escape_string($conn, $snippet);
1377
-                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_snippets` WHERE name='$name'");
1376
+                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_snippets` WHERE name='$name'");
1378 1377
                 if (mysqli_num_rows($rs)) {
1379 1378
                     $row = mysqli_fetch_assoc($rs);
1380
-                    $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
1381
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
1382
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1379
+                    $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
1380
+                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
1381
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1383 1382
                         return;
1384 1383
                     }
1385
-                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1384
+                    echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1386 1385
                 } else {
1387
-                    if ($properties != NULL ){
1386
+                    if ($properties != NULL) {
1388 1387
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
1389 1388
                     }
1390
-                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) {
1391
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1389
+                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) {
1390
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1392 1391
                         return;
1393 1392
                     }
1394
-                    echo "  $name: " . $_lang['installed'] . PHP_EOL;
1393
+                    echo "  $name: ".$_lang['installed'].PHP_EOL;
1395 1394
                 }
1396 1395
             }
1397 1396
         }
@@ -1400,24 +1399,24 @@  discard block
 block discarded – undo
1400 1399
 
1401 1400
 // Install demo-site
1402 1401
 if ($installData && $moduleSQLDataFile) {
1403
-    echo PHP_EOL . $_lang['installing_demo_site'];
1402
+    echo PHP_EOL.$_lang['installing_demo_site'];
1404 1403
     $sqlParser->process($moduleSQLDataFile);
1405 1404
     // display database results
1406 1405
     if ($sqlParser->installFailed == true) {
1407 1406
         $errors += 1;
1408
-        echo $_lang['database_alerts'] . PHP_EOL;
1409
-        echo $_lang['setup_couldnt_install'] . PHP_EOL;
1410
-        echo $_lang['installation_error_occured'] . PHP_EOL . PHP_EOL;
1407
+        echo $_lang['database_alerts'].PHP_EOL;
1408
+        echo $_lang['setup_couldnt_install'].PHP_EOL;
1409
+        echo $_lang['installation_error_occured'].PHP_EOL.PHP_EOL;
1411 1410
         for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) {
1412
-            echo $sqlParser->mysqlErrors[$i]["error"] . " " . $_lang['during_execution_of_sql'] . " " . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . PHP_EOL;
1411
+            echo $sqlParser->mysqlErrors[$i]["error"]." ".$_lang['during_execution_of_sql']." ".strip_tags($sqlParser->mysqlErrors[$i]["sql"]).PHP_EOL;
1413 1412
         }
1414 1413
 
1415
-        echo $_lang['some_tables_not_updated'] . PHP_EOL;
1414
+        echo $_lang['some_tables_not_updated'].PHP_EOL;
1416 1415
         return;
1417 1416
     } else {
1418 1417
         $sql = sprintf("SELECT id FROM `%ssite_templates` WHERE templatename='EVO startup - Bootstrap'", $sqlParser->prefix);
1419 1418
         $rs = mysqli_query($sqlParser->conn, $sql);
1420
-        if(mysqli_num_rows($rs)) {
1419
+        if (mysqli_num_rows($rs)) {
1421 1420
             $row = mysqli_fetch_assoc($rs);
1422 1421
             $sql = sprintf('UPDATE `%ssite_content` SET template=%s WHERE template=4', $sqlParser->prefix, $row['id']);
1423 1422
             mysqli_query($sqlParser->conn, $sql);
@@ -1429,9 +1428,9 @@  discard block
 block discarded – undo
1429 1428
 // Install Dependencies
1430 1429
 $moduleDependencies = $mdp;
1431 1430
 foreach ($moduleDependencies as $dependency) {
1432
-    $ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_modules` WHERE name="' . $dependency['module'] . '"');
1431
+    $ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM '.$dbase.'`'.$sqlParser->prefix.'site_modules` WHERE name="'.$dependency['module'].'"');
1433 1432
     if (!$ds) {
1434
-        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1433
+        echo mysqli_error($sqlParser->conn).PHP_EOL;
1435 1434
         return;
1436 1435
     } else {
1437 1436
         $row = mysqli_fetch_assoc($ds);
@@ -1439,37 +1438,37 @@  discard block
 block discarded – undo
1439 1438
         $moduleGuid = $row["guid"];
1440 1439
     }
1441 1440
     // get extra id
1442
-    $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE ' . $dependency['column'] . '="' . $dependency['name'] . '"');
1441
+    $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE '.$dependency['column'].'="'.$dependency['name'].'"');
1443 1442
     if (!$ds) {
1444
-        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1443
+        echo mysqli_error($sqlParser->conn).PHP_EOL;
1445 1444
         return;
1446 1445
     } else {
1447 1446
         $row = mysqli_fetch_assoc($ds);
1448 1447
         $extraId = $row["id"];
1449 1448
     }
1450 1449
     // setup extra as module dependency
1451
-    $ds = mysqli_query($sqlParser->conn, 'SELECT module FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type'] . ' LIMIT 1');
1450
+    $ds = mysqli_query($sqlParser->conn, 'SELECT module FROM '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type'].' LIMIT 1');
1452 1451
     if (!$ds) {
1453
-        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1452
+        echo mysqli_error($sqlParser->conn).PHP_EOL;
1454 1453
         return;
1455 1454
     } else {
1456 1455
         if (mysqli_num_rows($ds) === 0) {
1457
-            mysqli_query($sqlParser->conn, 'INSERT INTO ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` (module, resource, type) VALUES(' . $moduleId . ',' . $extraId . ',' . $dependency['type'] . ')');
1458
-            echo $dependency['module'] . ' Module: ' . $_lang['depedency_create'] . PHP_EOL;
1456
+            mysqli_query($sqlParser->conn, 'INSERT INTO '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` (module, resource, type) VALUES('.$moduleId.','.$extraId.','.$dependency['type'].')');
1457
+            echo $dependency['module'].' Module: '.$_lang['depedency_create'].PHP_EOL;
1459 1458
         } else {
1460
-            mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` SET module = ' . $moduleId . ', resource = ' . $extraId . ', type = ' . $dependency['type'] . ' WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type']);
1461
-            echo $dependency['module'] . ' Module: ' . $_lang['depedency_update'] . PHP_EOL;
1459
+            mysqli_query($sqlParser->conn, 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` SET module = '.$moduleId.', resource = '.$extraId.', type = '.$dependency['type'].' WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type']);
1460
+            echo $dependency['module'].' Module: '.$_lang['depedency_update'].PHP_EOL;
1462 1461
         }
1463 1462
         if ($dependency['type'] == 30 || $dependency['type'] == 40) {
1464 1463
             // set extra guid for plugins and snippets
1465
-            $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE id=' . $extraId . ' LIMIT 1');
1464
+            $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE id='.$extraId.' LIMIT 1');
1466 1465
             if (!$ds) {
1467
-                echo mysqli_error($sqlParser->conn) . PHP_EOL;
1466
+                echo mysqli_error($sqlParser->conn).PHP_EOL;
1468 1467
                 return;
1469 1468
             } else {
1470 1469
                 if (mysqli_num_rows($ds) != 0) {
1471
-                    mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` SET moduleguid = ' . $moduleGuid . ' WHERE id=' . $extraId);
1472
-                    echo $dependency['name'] . ': ' . $_lang['guid_set'] . PHP_EOL;
1470
+                    mysqli_query($sqlParser->conn, 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` SET moduleguid = '.$moduleGuid.' WHERE id='.$extraId);
1471
+                    echo $dependency['name'].': '.$_lang['guid_set'].PHP_EOL;
1473 1472
                 }
1474 1473
             }
1475 1474
         }
@@ -1478,7 +1477,7 @@  discard block
 block discarded – undo
1478 1477
 
1479 1478
 // call back function
1480 1479
 if ($callBackFnc != "")
1481
-    $callBackFnc ($sqlParser);
1480
+    $callBackFnc($sqlParser);
1482 1481
 
1483 1482
 // Setup the MODX API -- needed for the cache processor
1484 1483
 if (!defined('MODX_MANAGER_PATH')) define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/');
@@ -1510,17 +1509,17 @@  discard block
 block discarded – undo
1510 1509
 }
1511 1510
 
1512 1511
 // setup completed!
1513
-echo PHP_EOL . $_lang['installation_successful'] . PHP_EOL . PHP_EOL;
1512
+echo PHP_EOL.$_lang['installation_successful'].PHP_EOL.PHP_EOL;
1514 1513
 //echo "<p>" . $_lang['to_log_into_content_manager'] . "</p>";
1515 1514
 if ($installMode == 0) {
1516
-   echo strip_tags($_lang['installation_note']) . PHP_EOL;
1515
+   echo strip_tags($_lang['installation_note']).PHP_EOL;
1517 1516
 } else {
1518
-   echo strip_tags($_lang['upgrade_note']) . PHP_EOL;
1517
+   echo strip_tags($_lang['upgrade_note']).PHP_EOL;
1519 1518
 }
1520 1519
 
1521 1520
 
1522
-if ( empty($args) ){
1523
-    echo PHP_EOL . 'Remove install folder?'.PHP_EOL;
1521
+if (empty($args)) {
1522
+    echo PHP_EOL.'Remove install folder?'.PHP_EOL;
1524 1523
     $removeInstall = readline("Type 'y' or 'n' to continue: ");
1525 1524
 }
1526 1525
 //remove installFolder
@@ -1528,7 +1527,7 @@  discard block
 block discarded – undo
1528 1527
     removeFolder($path);
1529 1528
     removeFolder($base_path.'.tx');
1530 1529
     unlink($base_path.'README.md');
1531
-    echo 'Install folder deleted!'. PHP_EOL . PHP_EOL;
1530
+    echo 'Install folder deleted!'.PHP_EOL.PHP_EOL;
1532 1531
 }
1533 1532
 
1534 1533
 /**
@@ -1567,11 +1566,11 @@  discard block
 block discarded – undo
1567 1566
  * @param string $old
1568 1567
  * @return string
1569 1568
  */
1570
-function propUpdate($new,$old){
1569
+function propUpdate($new, $old){
1571 1570
     $newArr = parseProperties($new);
1572 1571
     $oldArr = parseProperties($old);
1573
-    foreach ($oldArr as $k => $v){
1574
-        if (isset($v['0']['options'])){
1572
+    foreach ($oldArr as $k => $v) {
1573
+        if (isset($v['0']['options'])) {
1575 1574
             $oldArr[$k]['0']['options'] = $newArr[$k]['0']['options'];
1576 1575
         }
1577 1576
     }
@@ -1586,30 +1585,30 @@  discard block
 block discarded – undo
1586 1585
  * @param bool|mixed $json
1587 1586
  * @return string
1588 1587
  */
1589
-function parseProperties($propertyString, $json=false) {
1590
-    $propertyString = str_replace('{}', '', $propertyString );
1591
-    $propertyString = str_replace('} {', ',', $propertyString );
1588
+function parseProperties($propertyString, $json = false){
1589
+    $propertyString = str_replace('{}', '', $propertyString);
1590
+    $propertyString = str_replace('} {', ',', $propertyString);
1592 1591
 
1593
-    if(empty($propertyString)) return array();
1594
-    if($propertyString=='{}' || $propertyString=='[]') return array();
1592
+    if (empty($propertyString)) return array();
1593
+    if ($propertyString == '{}' || $propertyString == '[]') return array();
1595 1594
 
1596 1595
     $jsonFormat = isJson($propertyString, true);
1597 1596
     $property = array();
1598 1597
     // old format
1599
-    if ( $jsonFormat === false) {
1600
-        $props= explode('&', $propertyString);
1598
+    if ($jsonFormat === false) {
1599
+        $props = explode('&', $propertyString);
1601 1600
         foreach ($props as $prop) {
1602 1601
             $prop = trim($prop);
1603
-            if($prop === '') {
1602
+            if ($prop === '') {
1604 1603
                 continue;
1605 1604
             }
1606 1605
 
1607 1606
             $arr = explode(';', $prop);
1608
-            if( ! is_array($arr)) {
1607
+            if (!is_array($arr)) {
1609 1608
                 $arr = array();
1610 1609
             }
1611 1610
             $key = explode('=', isset($arr[0]) ? $arr[0] : '');
1612
-            if( ! is_array($key) || empty($key[0])) {
1611
+            if (!is_array($key) || empty($key[0])) {
1613 1612
                 continue;
1614 1613
             }
1615 1614
 
@@ -1633,7 +1632,7 @@  discard block
 block discarded – undo
1633 1632
 
1634 1633
         }
1635 1634
     // new json-format
1636
-    } else if(!empty($jsonFormat)){
1635
+    } else if (!empty($jsonFormat)) {
1637 1636
         $property = $jsonFormat;
1638 1637
     }
1639 1638
     if ($json) {
@@ -1648,7 +1647,7 @@  discard block
 block discarded – undo
1648 1647
  * @param bool $returnData
1649 1648
  * @return bool|mixed
1650 1649
  */
1651
-function isJson($string, $returnData=false) {
1650
+function isJson($string, $returnData = false){
1652 1651
     $data = json_decode($string, true);
1653 1652
     return (json_last_error() == JSON_ERROR_NONE) ? ($returnData ? $data : true) : false;
1654 1653
 }
@@ -1658,20 +1657,20 @@  discard block
 block discarded – undo
1658 1657
  * @param SqlParser $sqlParser
1659 1658
  * @return int
1660 1659
  */
1661
-function getCreateDbCategory($category, $sqlParser) {
1660
+function getCreateDbCategory($category, $sqlParser){
1662 1661
     $dbase = $sqlParser->dbname;
1663
-    $dbase = '`' . trim($dbase,'`') . '`';
1662
+    $dbase = '`'.trim($dbase, '`').'`';
1664 1663
     $table_prefix = $sqlParser->prefix;
1665 1664
     $category_id = 0;
1666
-    if(!empty($category)) {
1665
+    if (!empty($category)) {
1667 1666
         $category = mysqli_real_escape_string($sqlParser->conn, $category);
1668 1667
         $rs = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."categories` WHERE category = '".$category."'");
1669
-        if(mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) {
1668
+        if (mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) {
1670 1669
             $category_id = $row['id'];
1671 1670
         } else {
1672 1671
             $q = "INSERT INTO $dbase.`".$table_prefix."categories` (`category`) VALUES ('{$category}');";
1673 1672
             $rs = mysqli_query($sqlParser->conn, $q);
1674
-            if($rs) {
1673
+            if ($rs) {
1675 1674
                 $category_id = mysqli_insert_id($sqlParser->conn);
1676 1675
             }
1677 1676
         }
@@ -1686,12 +1685,12 @@  discard block
 block discarded – undo
1686 1685
  * @param string $type
1687 1686
  * @return string
1688 1687
  */
1689
-function removeDocblock($code, $type) {
1688
+function removeDocblock($code, $type){
1690 1689
 
1691 1690
     $cleaned = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', $code, 1);
1692 1691
 
1693 1692
     // Procedure taken from plugin.filesource.php
1694
-    switch($type) {
1693
+    switch ($type) {
1695 1694
         case 'snippet':
1696 1695
             $elm_name = 'snippets';
1697 1696
             $include = 'return require';
@@ -1707,7 +1706,7 @@  discard block
 block discarded – undo
1707 1706
         default:
1708 1707
             return $cleaned;
1709 1708
     };
1710
-    if(substr(trim($cleaned),0,$count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/')
1709
+    if (substr(trim($cleaned), 0, $count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/')
1711 1710
         return $cleaned;
1712 1711
 
1713 1712
     // fileBinding not found - return code incl docblock
Please login to merge, or discard this patch.
manager/includes/error.class.inc.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
  * @deprecated EvolutionCMS\Legacy\ErrorHandler
6 6
  * @todo could be unnecessary
7 7
  */
8
-class errorHandler extends EvolutionCMS\Legacy\ErrorHandler {
8
+class errorHandler extends EvolutionCMS\Legacy\ErrorHandler{
9 9
     public function include_lang($context = 'common')
10 10
     {
11 11
         parent::includeLang($context);
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,8 @@
 block discarded – undo
5 5
  * @deprecated EvolutionCMS\Legacy\ErrorHandler
6 6
  * @todo could be unnecessary
7 7
  */
8
-class errorHandler extends EvolutionCMS\Legacy\ErrorHandler {
8
+class errorHandler extends EvolutionCMS\Legacy\ErrorHandler
9
+{
9 10
     public function include_lang($context = 'common')
10 11
     {
11 12
         parent::includeLang($context);
Please login to merge, or discard this patch.
manager/includes/log.class.inc.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,4 +3,6 @@
 block discarded – undo
3 3
 /**
4 4
  * @deprecated use EvolutionCMS\Legacy\LogHandler
5 5
  */
6
-class logHandler extends EvolutionCMS\Legacy\LogHandler{}
6
+class logHandler extends EvolutionCMS\Legacy\LogHandler
7
+{
8
+}
Please login to merge, or discard this patch.