Completed
Push — develop ( d271f8...cb7ecf )
by Serg
08:17 queued 57s
created
install/src/controllers/install.php 2 patches
Upper-Lower-Casing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 
295 295
                     if (mysqli_num_rows($rs)) {
296 296
                         $installDataLevel['templates'][$moduleTemplate[0]]['type'] = 'update';
297
-                        $query = "UPDATE $dbase.`" . $table_prefix . "site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;";
297
+                        $query = "update $dbase.`" . $table_prefix . "site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;";
298 298
                         if (!mysqli_query($sqlParser->conn, $query)) {
299 299
                             $errors += 1;
300 300
                             $installDataLevel['templates'][$moduleTemplate[0]]['error'] = array(
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
                 if (mysqli_num_rows($rs)) {
386 386
                     $installDataLevel['tvs'][$moduleTV[0]]['type'] = 'update';
387 387
                     while ($row = mysqli_fetch_assoc($rs)) {
388
-                        $query = "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']};";
388
+                        $query = "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']};";
389 389
                         if (!mysqli_query($sqlParser->conn, $query)) {
390 390
                             $installDataLevel['tvs'][$moduleTV[0]]['error'] = array(
391 391
                                 'type' => 'sql',
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
                     if ($update) {
497 497
                         $installDataLevel['chunks'][$moduleChunk[0]]['type'] = 'update';
498 498
                         if (!mysqli_query($sqlParser->conn,
499
-                            "UPDATE $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
499
+                            "update $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
500 500
                             $errors += 1;
501 501
                             $installDataLevel['chunks'][$moduleChunk[0]]['error'] = array(
502 502
                                 'type' => 'sql',
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
                         $row = mysqli_fetch_assoc($rs);
582 582
                         $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
583 583
                         if (!mysqli_query($sqlParser->conn,
584
-                            "UPDATE $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
584
+                            "update $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
585 585
                             $installDataLevel['modules'][$moduleModule[0]]['error'] = array(
586 586
                                 'type' => 'sql',
587 587
                                 'content' => mysqli_error($sqlParser->conn)
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 
661 661
                     // disable legacy versions based on legacy_names provided
662 662
                     if (!empty($leg_names)) {
663
-                        $update_query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
663
+                        $update_query = "update $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
664 664
                         $rs = mysqli_query($sqlParser->conn, $update_query);
665 665
                     }
666 666
 
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
                         while ($row = mysqli_fetch_assoc($rs)) {
679 679
                             $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
680 680
                             if ($row['description'] == $desc) {
681
-                                $query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};";
681
+                                $query = "update $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};";
682 682
                                 if (!mysqli_query($sqlParser->conn, $query)) {
683 683
                                     $installDataLevel['plugins'][$modulePlugin[0]]['error'] = array(
684 684
                                         'type' => 'sql',
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
                                 }
690 690
                                 $insert = false;
691 691
                             } else {
692
-                                $query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};";
692
+                                $query = "update $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};";
693 693
                                 if (!mysqli_query($sqlParser->conn, $query)) {
694 694
                                     $installDataLevel['plugins'][$modulePlugin[0]]['error'] = array(
695 695
                                         'type' => 'sql',
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
                         $row = mysqli_fetch_assoc($rs);
793 793
                         $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
794 794
                         if (!mysqli_query($sqlParser->conn,
795
-                            "UPDATE $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
795
+                            "update $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
796 796
                             $installDataLevel['snippets'][$moduleSnippet[0]]['error'] = array(
797 797
                                 'type' => 'sql',
798 798
                                 'content' => mysqli_error($sqlParser->conn)
Please login to merge, or discard this patch.
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (file_exists(dirname(dirname(dirname(__DIR__))) . "/assets/cache/siteManager.php")) {
3
-    include_once(dirname(dirname(dirname(__DIR__))) . "/assets/cache/siteManager.php");
2
+if (file_exists(dirname(dirname(dirname(__DIR__)))."/assets/cache/siteManager.php")) {
3
+    include_once(dirname(dirname(dirname(__DIR__)))."/assets/cache/siteManager.php");
4 4
 } else {
5 5
     define('MGR_DIR', 'manager');
6 6
 }
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
 // set timout limit
26 26
 @ set_time_limit(120); // used @ to prevent warning when using safe mode?
27 27
 
28
-$installMode = (int)$_POST['installmode'];
29
-$installData = (int)!empty($_POST['installdata']);
28
+$installMode = (int) $_POST['installmode'];
29
+$installData = (int) !empty($_POST['installdata']);
30 30
 
31 31
 // get db info from post
32 32
 $database_server = $_POST['databasehost'];
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 $database_charset = substr($database_collation, 0, strpos($database_collation, '_'));
37 37
 $database_connection_charset = $_POST['database_connection_charset'];
38 38
 $database_connection_method = $_POST['database_connection_method'];
39
-$dbase = "`" . $_POST['database_name'] . "`";
39
+$dbase = "`".$_POST['database_name']."`";
40 40
 $table_prefix = $_POST['tableprefix'];
41 41
 $adminname = $_POST['cmsadmin'];
42 42
 $adminemail = $_POST['cmsadminemail'];
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
 // set session name variable
48 48
 if (!isset ($site_sessionname)) {
49
-    $site_sessionname = 'SN' . uniqid('');
49
+    $site_sessionname = 'SN'.uniqid('');
50 50
 }
51 51
 
52 52
 // get base path and url
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 }
63 63
 $pth = implode('install', $a);
64 64
 unset ($a);
65
-$base_url = $url . (substr($url, -1) != '/' ? '/' : '');
66
-$base_path = $pth . (substr($pth, -1) != '/' ? '/' : '');
65
+$base_url = $url.(substr($url, -1) != '/' ? '/' : '');
66
+$base_path = $pth.(substr($pth, -1) != '/' ? '/' : '');
67 67
 
68 68
 // connect to the database
69 69
 $conn = @mysqli_connect($database_server, $database_user, $database_password);
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     if ($installLevel === 1) {
93 93
         // check table prefix
94 94
         if ($installMode === 0) {
95
-            $query = "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`";
95
+            $query = "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`";
96 96
             if (@mysqli_query($conn, $query)) {
97 97
                 $errors += 1;
98 98
             } else {
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         // check status of Inherit Parent Template plugin
108 108
         $auto_template_logic = 'parent';
109 109
         if ($installMode !== 0) {
110
-            $query = "SELECT properties, disabled FROM " . $dbase . ".`" . $table_prefix . "site_plugins` WHERE name='Inherit Parent Template'";
110
+            $query = "SELECT properties, disabled FROM ".$dbase.".`".$table_prefix."site_plugins` WHERE name='Inherit Parent Template'";
111 111
             $rs = mysqli_query($conn, $query);
112 112
             $row = mysqli_fetch_row($rs);
113 113
             if (!$row) {
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
         }
131 131
 
132 132
         // open db connection
133
-        include dirname(__DIR__) . '/processor/result.php';
134
-        include_once dirname(__DIR__) . '/sqlParser.class.php';
133
+        include dirname(__DIR__).'/processor/result.php';
134
+        include_once dirname(__DIR__).'/sqlParser.class.php';
135 135
         $sqlParser = new SqlParser(
136 136
             $database_server,
137 137
             $database_user,
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
         $confph['lastInstallTime'] = time();
178 178
         $confph['site_sessionname'] = $site_sessionname;
179 179
 
180
-        $configString = file_get_contents(dirname(dirname(__DIR__)) . '/stubs/config.tpl');
180
+        $configString = file_get_contents(dirname(dirname(__DIR__)).'/stubs/config.tpl');
181 181
         $configString = parse($configString, $confph);
182 182
 
183
-        $filename = dirname(dirname(dirname(__DIR__))) . '/' . MGR_DIR . '/includes/config.inc.php';
183
+        $filename = dirname(dirname(dirname(__DIR__))).'/'.MGR_DIR.'/includes/config.inc.php';
184 184
         $configFileFailed = false;
185 185
         if (@ !$handle = fopen($filename, 'w')) {
186 186
             $configFileFailed = true;
@@ -208,13 +208,13 @@  discard block
 block discarded – undo
208 208
             $siteid = uniqid('');
209 209
             mysqli_query(
210 210
                     $sqlParser->conn,
211
-                "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')"
211
+                "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')"
212 212
             );
213 213
         } else {
214 214
             // update site_id if missing
215 215
             $ds = mysqli_query(
216 216
                     $sqlParser->conn,
217
-                "SELECT setting_name,setting_value FROM $dbase.`" . $table_prefix . "system_settings` WHERE setting_name='site_id'"
217
+                "SELECT setting_name,setting_value FROM $dbase.`".$table_prefix."system_settings` WHERE setting_name='site_id'"
218 218
             );
219 219
             if ($ds) {
220 220
                 $r = mysqli_fetch_assoc($ds);
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
                     $siteid = uniqid('');
224 224
                     mysqli_query(
225 225
                             $sqlParser->conn,
226
-                        "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')"
226
+                        "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')"
227 227
                     );
228 228
                 }
229 229
             }
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
     if ($installLevel === 5 && (isset ($_POST['template']) || $installData)) {
250 250
         $selTemplates = $_POST['template'];
251 251
         foreach ($moduleTemplates as $k => $moduleTemplate) {
252
-            if (! is_array($moduleTemplate)) {
252
+            if (!is_array($moduleTemplate)) {
253 253
                 continue;
254 254
             }
255 255
             $installDataLevel['templates'][$moduleTemplate[0]] = array(
@@ -287,12 +287,12 @@  discard block
 block discarded – undo
287 287
                     $template = mysqli_real_escape_string($conn, $template);
288 288
 
289 289
                     // See if the template already exists
290
-                    $query = "SELECT * FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name'";
290
+                    $query = "SELECT * FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name'";
291 291
                     $rs = mysqli_query($sqlParser->conn, $query);
292 292
 
293 293
                     if (mysqli_num_rows($rs)) {
294 294
                         $installDataLevel['templates'][$moduleTemplate[0]]['type'] = 'update';
295
-                        $query = "UPDATE $dbase.`" . $table_prefix . "site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;";
295
+                        $query = "UPDATE $dbase.`".$table_prefix."site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;";
296 296
                         if (!mysqli_query($sqlParser->conn, $query)) {
297 297
                             $errors += 1;
298 298
                             $installDataLevel['templates'][$moduleTemplate[0]]['error'] = array(
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
                         if (!is_null($save_sql_id_as)) {
306 306
                             $sql_id = @mysqli_insert_id($sqlParser->conn);
307 307
                             if (!$sql_id) {
308
-                                $query = "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name' LIMIT 1;";
308
+                                $query = "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name' LIMIT 1;";
309 309
                                 $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, $query));
310 310
                                 $sql_id = $idQuery['id'];
311 311
                             }
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
                         }
314 314
                     } else {
315 315
                         $installDataLevel['templates'][$moduleTemplate[0]]['type'] = 'create';
316
-                        $query = "INSERT INTO $dbase.`" . $table_prefix . "site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');";
316
+                        $query = "INSERT INTO $dbase.`".$table_prefix."site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');";
317 317
                         if (!@mysqli_query($sqlParser->conn, $query)) {
318 318
                             $errors += 1;
319 319
                             $installDataLevel['templates'][$moduleTemplate[0]]['error'] = array(
@@ -378,12 +378,12 @@  discard block
 block discarded – undo
378 378
                 // Create the category if it does not already exist
379 379
                 $category = getCreateDbCategory($category, $sqlParser);
380 380
 
381
-                $query = "SELECT * FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name'";
382
-                $rs = mysqli_query($sqlParser->conn,$query);
381
+                $query = "SELECT * FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name'";
382
+                $rs = mysqli_query($sqlParser->conn, $query);
383 383
                 if (mysqli_num_rows($rs)) {
384 384
                     $installDataLevel['tvs'][$moduleTV[0]]['type'] = 'update';
385 385
                     while ($row = mysqli_fetch_assoc($rs)) {
386
-                        $query = "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']};";
386
+                        $query = "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']};";
387 387
                         if (!mysqli_query($sqlParser->conn, $query)) {
388 388
                             $installDataLevel['tvs'][$moduleTV[0]]['error'] = array(
389 389
                                 'type' => 'sql',
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
                     }
397 397
                 } else {
398 398
                     $installDataLevel['tvs'][$moduleTV[0]]['type'] = 'create';
399
-                    $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');";
399
+                    $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');";
400 400
                     if (!mysqli_query($sqlParser->conn, $q)) {
401 401
                         $installDataLevel['tvs'][$moduleTV[0]]['error'] = array(
402 402
                             'type' => 'sql',
@@ -413,23 +413,23 @@  discard block
 block discarded – undo
413 413
                 if (count($assignments) > 0) {
414 414
 
415 415
                     // remove existing tv -> template assignments
416
-                    $query = "SELECT id FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name' AND description='$desc';";
416
+                    $query = "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';";
417 417
                     $ds = mysqli_query($sqlParser->conn, $query);
418 418
                     $row = mysqli_fetch_assoc($ds);
419 419
                     $id = $row["id"];
420
-                    $query = 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_tmplvar_templates` WHERE tmplvarid = \'' . $id . '\'';
420
+                    $query = 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_tmplvar_templates` WHERE tmplvarid = \''.$id.'\'';
421 421
                     mysqli_query($sqlParser->conn, $query);
422 422
 
423 423
                     // add tv -> template assignments
424 424
                     foreach ($assignments as $assignment) {
425 425
                         $template = mysqli_real_escape_string($conn, $assignment);
426
-                        $query = "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$template';";
426
+                        $query = "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$template';";
427 427
                         $ts = mysqli_query($sqlParser->conn, $query);
428 428
                         if ($ds && $ts) {
429 429
                             $tRow = mysqli_fetch_assoc($ts);
430 430
                             $templateId = $tRow['id'];
431
-                            $query = "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)";
432
-                            mysqli_query($sqlParser->conn,$query);
431
+                            $query = "INSERT INTO $dbase.`".$table_prefix."site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)";
432
+                            mysqli_query($sqlParser->conn, $query);
433 433
                         }
434 434
                     }
435 435
                 }
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
     if ($installLevel === 5 && $errorData === false && (isset ($_POST['chunk']) || $installData)) {
442 442
         $selChunks = $_POST['chunk'];
443 443
         foreach ($moduleChunks as $k => $moduleChunk) {
444
-            if (! is_array($moduleChunk)) {
444
+            if (!is_array($moduleChunk)) {
445 445
                 continue;
446 446
             }
447 447
             $installDataLevel['chunks'][$moduleChunk[0]] = array(
@@ -479,14 +479,14 @@  discard block
 block discarded – undo
479 479
                     $chunk = mysqli_real_escape_string($conn, $chunk);
480 480
                     $rs = mysqli_query(
481 481
                         $sqlParser->conn,
482
-                        "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$name'"
482
+                        "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$name'"
483 483
                     );
484 484
                     $count_original_name = mysqli_num_rows($rs);
485 485
                     if ($overwrite == 'false') {
486
-                        $newname = $name . '-' . str_replace('.', '_', $modx_version);
486
+                        $newname = $name.'-'.str_replace('.', '_', $modx_version);
487 487
                         $rs = mysqli_query(
488 488
                             $sqlParser->conn,
489
-                            "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$newname'"
489
+                            "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$newname'"
490 490
                         );
491 491
                         $count_new_name = mysqli_num_rows($rs);
492 492
                     }
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
                     if ($update) {
495 495
                         $installDataLevel['chunks'][$moduleChunk[0]]['type'] = 'update';
496 496
                         if (!mysqli_query($sqlParser->conn,
497
-                            "UPDATE $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
497
+                            "UPDATE $dbase.`".$table_prefix."site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
498 498
                             $errors += 1;
499 499
                             $installDataLevel['chunks'][$moduleChunk[0]]['error'] = array(
500 500
                                 'type' => 'sql',
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
                         } else {
512 512
                             $installDataLevel['chunks'][$moduleChunk[0]]['type'] = 'create';
513 513
                         }
514
-                        $query = "INSERT INTO $dbase.`" . $table_prefix . "site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);";
514
+                        $query = "INSERT INTO $dbase.`".$table_prefix."site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);";
515 515
                         if (!mysqli_query($sqlParser->conn, $query)) {
516 516
                             $errors += 1;
517 517
                             $installDataLevel['chunks'][$moduleChunk[0]]['error'] = array(
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
     if ($installLevel === 5 && $errorData === false && (isset ($_POST['module']) || $installData)) {
535 535
         $selModules = $_POST['module'];
536 536
         foreach ($moduleModules as $k => $moduleModule) {
537
-            if (! is_array($moduleModule)) {
537
+            if (!is_array($moduleModule)) {
538 538
                 continue;
539 539
             }
540 540
             $installDataLevel['modules'][$moduleModule[0]] = array(
@@ -573,13 +573,13 @@  discard block
 block discarded – undo
573 573
                     // $module = removeDocblock($module, 'module'); // Modules have no fileBinding, keep docblock for info-tab
574 574
                     $module = mysqli_real_escape_string($conn, $module);
575 575
                     $rs = mysqli_query($sqlParser->conn,
576
-                        "SELECT * FROM $dbase.`" . $table_prefix . "site_modules` WHERE name='$name'");
576
+                        "SELECT * FROM $dbase.`".$table_prefix."site_modules` WHERE name='$name'");
577 577
                     if (mysqli_num_rows($rs)) {
578 578
                         $installDataLevel['modules'][$moduleModule[0]]['type'] = 'update';
579 579
                         $row = mysqli_fetch_assoc($rs);
580 580
                         $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
581 581
                         if (!mysqli_query($sqlParser->conn,
582
-                            "UPDATE $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
582
+                            "UPDATE $dbase.`".$table_prefix."site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
583 583
                             $installDataLevel['modules'][$moduleModule[0]]['error'] = array(
584 584
                                 'type' => 'sql',
585 585
                                 'content' => mysqli_error($sqlParser->conn)
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
                         $installDataLevel['modules'][$moduleModule[0]]['type'] = 'create';
592 592
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
593 593
                         if (!mysqli_query($sqlParser->conn,
594
-                            "INSERT INTO $dbase.`" . $table_prefix . "site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) {
594
+                            "INSERT INTO $dbase.`".$table_prefix."site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) {
595 595
                             $installDataLevel['modules'][$moduleModule[0]]['error'] = array(
596 596
                                 'type' => 'sql',
597 597
                                 'content' => mysqli_error($sqlParser->conn)
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
     if ($installLevel === 5 && $errorData === false && (isset ($_POST['plugin']) || $installData)) {
612 612
         $selPlugs = $_POST['plugin'];
613 613
         foreach ($modulePlugins as $k => $modulePlugin) {
614
-            if (! is_array($modulePlugin)) {
614
+            if (!is_array($modulePlugin)) {
615 615
                 continue;
616 616
             }
617 617
             $installDataLevel['plugins'][$modulePlugin[0]] = array(
@@ -645,12 +645,12 @@  discard block
 block discarded – undo
645 645
                 $disabled = $modulePlugin[9];
646 646
                 if (array_key_exists(7, $modulePlugin)) {
647 647
                     // parse comma-separated legacy names and prepare them for sql IN clause
648
-                    $leg_names = "'" . implode(
648
+                    $leg_names = "'".implode(
649 649
                             "','",
650 650
                             preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))
651
-                        ) . "'";
651
+                        )."'";
652 652
                 }
653
-                if (! file_exists($filecontent)) {
653
+                if (!file_exists($filecontent)) {
654 654
                     $installDataLevel['plugins'][$modulePlugin[0]]['error'] = array(
655 655
                         'type' => 'file_not_found'
656 656
                     );
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 
659 659
                     // disable legacy versions based on legacy_names provided
660 660
                     if (!empty($leg_names)) {
661
-                        $update_query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
661
+                        $update_query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
662 662
                         $rs = mysqli_query($sqlParser->conn, $update_query);
663 663
                     }
664 664
 
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
                     $plugin = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2));
669 669
                     $plugin = removeDocblock($plugin, 'plugin');
670 670
                     $plugin = mysqli_real_escape_string($conn, $plugin);
671
-                    $query = "SELECT * FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='$name'";
671
+                    $query = "SELECT * FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name'";
672 672
                     $rs = mysqli_query($sqlParser->conn, $query);
673 673
                     if (mysqli_num_rows($rs)) {
674 674
                         $installDataLevel['plugins'][$modulePlugin[0]]['type'] = 'update';
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
                         while ($row = mysqli_fetch_assoc($rs)) {
677 677
                             $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
678 678
                             if ($row['description'] == $desc) {
679
-                                $query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};";
679
+                                $query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};";
680 680
                                 if (!mysqli_query($sqlParser->conn, $query)) {
681 681
                                     $installDataLevel['plugins'][$modulePlugin[0]]['error'] = array(
682 682
                                         'type' => 'sql',
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
                                 }
688 688
                                 $insert = false;
689 689
                             } else {
690
-                                $query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};";
690
+                                $query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE id={$row['id']};";
691 691
                                 if (!mysqli_query($sqlParser->conn, $query)) {
692 692
                                     $installDataLevel['plugins'][$modulePlugin[0]]['error'] = array(
693 693
                                         'type' => 'sql',
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
                         }
701 701
                         if ($insert === true) {
702 702
                             $properties = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
703
-                            $query = "INSERT INTO $dbase.`" . $table_prefix . "site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);";
703
+                            $query = "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);";
704 704
                             if (!mysqli_query($sqlParser->conn, $query)) {
705 705
                                 $installDataLevel['plugins'][$modulePlugin[0]]['error'] = array(
706 706
                                     'type' => 'sql',
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
                     } else {
714 714
                         $installDataLevel['plugins'][$modulePlugin[0]]['type'] = 'create';
715 715
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
716
-                        $query = "INSERT INTO $dbase.`" . $table_prefix . "site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);";
716
+                        $query = "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);";
717 717
                         if (!mysqli_query($sqlParser->conn, $query)) {
718 718
                             $installDataLevel['plugins'][$modulePlugin[0]]['error'] = array(
719 719
                                 'type' => 'sql',
@@ -725,17 +725,17 @@  discard block
 block discarded – undo
725 725
                     }
726 726
                     // add system events
727 727
                     if (count($events) > 0) {
728
-                        $query = "SELECT id FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='$name' AND description='$desc';";
728
+                        $query = "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';";
729 729
                         $ds = mysqli_query($sqlParser->conn, $query);
730 730
                         if ($ds) {
731 731
                             $row = mysqli_fetch_assoc($ds);
732 732
                             $id = $row["id"];
733 733
                             // remove existing events
734
-                            $query = 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_plugin_events` WHERE pluginid = \'' . $id . '\'';
734
+                            $query = 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_plugin_events` WHERE pluginid = \''.$id.'\'';
735 735
                             mysqli_query($sqlParser->conn, $query);
736 736
                             // add new events
737
-                            $query = "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) . "')";
738
-                            mysqli_query($sqlParser->conn,$query);
737
+                            $query = "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)."')";
738
+                            mysqli_query($sqlParser->conn, $query);
739 739
                         }
740 740
                     }
741 741
                 }
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
     if ($installLevel === 5 && $errorData === false && (isset ($_POST['snippet']) || $installData)) {
750 750
         $selSnips = $_POST['snippet'];
751 751
         foreach ($moduleSnippets as $k => $moduleSnippet) {
752
-            if (! is_array($moduleSnippet)) {
752
+            if (!is_array($moduleSnippet)) {
753 753
                 continue;
754 754
             }
755 755
             $installDataLevel['snippets'][$moduleSnippet[0]] = array(
@@ -784,13 +784,13 @@  discard block
 block discarded – undo
784 784
                     $snippet = removeDocblock($snippet, 'snippet');
785 785
                     $snippet = mysqli_real_escape_string($conn, $snippet);
786 786
                     $rs = mysqli_query($sqlParser->conn,
787
-                        "SELECT * FROM $dbase.`" . $table_prefix . "site_snippets` WHERE name='$name'");
787
+                        "SELECT * FROM $dbase.`".$table_prefix."site_snippets` WHERE name='$name'");
788 788
                     if (mysqli_num_rows($rs)) {
789 789
                         $installDataLevel['snippets'][$moduleSnippet[0]]['type'] = 'update';
790 790
                         $row = mysqli_fetch_assoc($rs);
791 791
                         $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
792 792
                         if (!mysqli_query($sqlParser->conn,
793
-                            "UPDATE $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
793
+                            "UPDATE $dbase.`".$table_prefix."site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
794 794
                             $installDataLevel['snippets'][$moduleSnippet[0]]['error'] = array(
795 795
                                 'type' => 'sql',
796 796
                                 'content' => mysqli_error($sqlParser->conn)
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
                         $installDataLevel['snippets'][$moduleSnippet[0]]['type'] = 'create';
803 803
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
804 804
                         if (!mysqli_query($sqlParser->conn,
805
-                            "INSERT INTO $dbase.`" . $table_prefix . "site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) {
805
+                            "INSERT INTO $dbase.`".$table_prefix."site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) {
806 806
                             $installDataLevel['snippets'][$moduleSnippet[0]]['error'] = array(
807 807
                                 'type' => 'sql',
808 808
                                 'content' => mysqli_error($sqlParser->conn)
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
                     'content' => '' //dependency name or error message
870 870
                 )*/
871 871
             );
872
-            $query = 'SELECT id, guid FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_modules` WHERE name="' . $dependency['module'] . '"';
872
+            $query = 'SELECT id, guid FROM '.$dbase.'`'.$sqlParser->prefix.'site_modules` WHERE name="'.$dependency['module'].'"';
873 873
             $ds = mysqli_query($sqlParser->conn, $query);
874 874
             if (!$ds) {
875 875
                 $installDependencyLevel[$dependency['module']]['error'] = array(
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
                 $moduleGuid = $row["guid"];
885 885
             }
886 886
             // get extra id
887
-            $query = 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE ' . $dependency['column'] . '="' . $dependency['name'] . '"';
887
+            $query = 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE '.$dependency['column'].'="'.$dependency['name'].'"';
888 888
             $ds = mysqli_query($sqlParser->conn, $query);
889 889
             if (!$ds) {
890 890
                 $installDependencyLevel[$dependency['module']]['error'] = array(
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
                 $extraId = $row["id"];
899 899
             }
900 900
             // setup extra as module dependency
901
-            $query = 'SELECT module FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type'] . ' LIMIT 1';
901
+            $query = 'SELECT module FROM '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type'].' LIMIT 1';
902 902
             $ds = mysqli_query($sqlParser->conn, $query);
903 903
             if (!$ds) {
904 904
                 $installDependencyLevel[$dependency['module']]['error'] = array(
@@ -909,17 +909,17 @@  discard block
 block discarded – undo
909 909
                 break;
910 910
             } else {
911 911
                 if (mysqli_num_rows($ds) === 0) {
912
-                    $query = 'INSERT INTO ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` (module, resource, type) VALUES(' . $moduleId . ',' . $extraId . ',' . $dependency['type'] . ')';
912
+                    $query = 'INSERT INTO '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` (module, resource, type) VALUES('.$moduleId.','.$extraId.','.$dependency['type'].')';
913 913
                     mysqli_query($sqlParser->conn, $query);
914 914
                     $installDependencyLevel[$dependency['module']]['type'] = 'create';
915 915
                 } else {
916
-                    $query = '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'];
916
+                    $query = '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'];
917 917
                     mysqli_query($sqlParser->conn, $query);
918 918
                     $installDependencyLevel[$dependency['module']]['type'] = 'update';
919 919
                 }
920 920
                 if ($dependency['type'] == 30 || $dependency['type'] == 40) {
921 921
                     // set extra guid for plugins and snippets
922
-                    $query = 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE id=' . $extraId . ' LIMIT 1';
922
+                    $query = 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE id='.$extraId.' LIMIT 1';
923 923
                     $ds = mysqli_query($sqlParser->conn, $query);
924 924
                     if (!$ds) {
925 925
                         $installDependencyLevel[$dependency['module']]['extra'] = array(
@@ -930,8 +930,8 @@  discard block
 block discarded – undo
930 930
                         break;
931 931
                     } else {
932 932
                         if (mysqli_num_rows($ds) != 0) {
933
-                            $query = 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` SET moduleguid = ' . $moduleGuid . ' WHERE id=' . $extraId;
934
-                            $ds= mysqli_query($sqlParser->conn, $query);
933
+                            $query = 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` SET moduleguid = '.$moduleGuid.' WHERE id='.$extraId;
934
+                            $ds = mysqli_query($sqlParser->conn, $query);
935 935
                             $installDependencyLevel[$dependency['module']]['extra'] = array(
936 936
                                 'type' => 'done',
937 937
                                 'content' => $dependency['name']
@@ -953,48 +953,48 @@  discard block
 block discarded – undo
953 953
         }
954 954
 
955 955
         // Setup the MODX API -- needed for the cache processor
956
-        if (file_exists(dirname(dirname(dirname(__DIR__))) . '/' . MGR_DIR . '/includes/config_mutator.php')) {
957
-            require_once dirname(dirname(dirname(__DIR__))) . '/' . MGR_DIR . '/includes/config_mutator.php';
956
+        if (file_exists(dirname(dirname(dirname(__DIR__))).'/'.MGR_DIR.'/includes/config_mutator.php')) {
957
+            require_once dirname(dirname(dirname(__DIR__))).'/'.MGR_DIR.'/includes/config_mutator.php';
958 958
         }
959 959
         define('MODX_API_MODE', true);
960 960
         if (!defined('MODX_BASE_PATH')) {
961 961
             define('MODX_BASE_PATH', $base_path);
962 962
         }
963 963
         if (!defined('MODX_MANAGER_PATH')) {
964
-            define('MODX_MANAGER_PATH', $base_path . MGR_DIR . '/');
964
+            define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/');
965 965
         }
966 966
         $database_type = 'mysqli';
967 967
         // initiate a new document parser
968 968
         if (!defined('EVO_BOOTSTRAP_FILE')) {
969 969
             define('EVO_BOOTSTRAP_FILE',
970
-                dirname(dirname(dirname(__DIR__))) . '/' . MGR_DIR . '/includes/bootstrap.php');
971
-            require_once dirname(dirname(dirname(__DIR__))) . '/' . MGR_DIR . '/includes/bootstrap.php';
970
+                dirname(dirname(dirname(__DIR__))).'/'.MGR_DIR.'/includes/bootstrap.php');
971
+            require_once dirname(dirname(dirname(__DIR__))).'/'.MGR_DIR.'/includes/bootstrap.php';
972 972
         }
973 973
 
974
-        include_once(dirname(dirname(dirname(__DIR__))) . '/' . MGR_DIR . '/includes/document.parser.class.inc.php');
974
+        include_once(dirname(dirname(dirname(__DIR__))).'/'.MGR_DIR.'/includes/document.parser.class.inc.php');
975 975
         $modx = new DocumentParser;
976 976
         $modx->db->connect();
977 977
         // always empty cache after install
978 978
         $sync = new EvolutionCMS\Cache();
979
-        $sync->setCachepath(dirname(dirname(dirname(__DIR__))) . '/assets/cache/');
979
+        $sync->setCachepath(dirname(dirname(dirname(__DIR__))).'/assets/cache/');
980 980
         $sync->setReport(false);
981 981
         $sync->emptyCache(); // first empty the cache
982 982
 
983 983
         // try to chmod the cache go-rwx (for suexeced php)
984
-        @chmod(dirname(dirname(dirname(__DIR__))) . '/assets/cache/siteCache.idx.php', 0600);
985
-        @chmod(dirname(dirname(dirname(__DIR__))) . '/assets/cache/sitePublishing.idx.php', 0600);
984
+        @chmod(dirname(dirname(dirname(__DIR__))).'/assets/cache/siteCache.idx.php', 0600);
985
+        @chmod(dirname(dirname(dirname(__DIR__))).'/assets/cache/sitePublishing.idx.php', 0600);
986 986
 
987 987
         // remove any locks on the manager functions so initial manager login is not blocked
988
-        mysqli_query($conn, "TRUNCATE TABLE `" . $table_prefix . "active_users`");
988
+        mysqli_query($conn, "TRUNCATE TABLE `".$table_prefix."active_users`");
989 989
 
990 990
         // close db connection
991 991
         $sqlParser->close();
992 992
 
993 993
         // andrazk 20070416 - release manager access
994
-        if (file_exists(dirname(dirname(dirname(__DIR__))) . '/assets/cache/installProc.inc.php')) {
995
-            @chmod(dirname(dirname(dirname(__DIR__))) . '/assets/cache/installProc.inc.php', 0755);
996
-            unlink(dirname(dirname(dirname(__DIR__))) . '/assets/cache/installProc.inc.php');
994
+        if (file_exists(dirname(dirname(dirname(__DIR__))).'/assets/cache/installProc.inc.php')) {
995
+            @chmod(dirname(dirname(dirname(__DIR__))).'/assets/cache/installProc.inc.php', 0755);
996
+            unlink(dirname(dirname(dirname(__DIR__))).'/assets/cache/installProc.inc.php');
997 997
         }
998 998
     }
999 999
 }
1000
-include_once dirname(__DIR__) . '/template/actions/install.php';
1000
+include_once dirname(__DIR__).'/template/actions/install.php';
Please login to merge, or discard this patch.
install/index.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -3,13 +3,13 @@  discard block
 block discarded – undo
3 3
  * EVO Installer
4 4
  */
5 5
 error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
6
-$base_path = dirname(__DIR__) . '/';
6
+$base_path = dirname(__DIR__).'/';
7 7
 
8
-if (is_file($base_path . 'assets/cache/siteManager.php')) {
9
-    include_once $base_path . 'assets/cache/siteManager.php';
8
+if (is_file($base_path.'assets/cache/siteManager.php')) {
9
+    include_once $base_path.'assets/cache/siteManager.php';
10 10
 }
11
-if (! defined('MGR_DIR')) {
12
-    if (is_dir($base_path . 'manager')) {
11
+if (!defined('MGR_DIR')) {
12
+    if (is_dir($base_path.'manager')) {
13 13
         define('MGR_DIR', 'manager');
14 14
     } else {
15 15
         die('MGR_DIR is not defined');
@@ -19,12 +19,12 @@  discard block
 block discarded – undo
19 19
 require_once 'src/functions.php';
20 20
 
21 21
 if (empty($_GET['self'])) {
22
-    $autoloader = realpath(__DIR__ . '/../vendor/autoload.php');
22
+    $autoloader = realpath(__DIR__.'/../vendor/autoload.php');
23 23
     if (file_exists($autoloader) && is_readable($autoloader)) {
24 24
         include_once $autoloader;
25 25
     }
26 26
 
27
-    require_once '../' . MGR_DIR . '/includes/version.inc.php';
27
+    require_once '../'.MGR_DIR.'/includes/version.inc.php';
28 28
 
29 29
     // start session
30 30
     session_start();
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     install_sessionCheck();
33 33
 
34 34
     $moduleName = 'EVO';
35
-    $moduleVersion = $modx_branch . ' ' . $modx_version;
35
+    $moduleVersion = $modx_branch.' '.$modx_version;
36 36
     $moduleRelease = $modx_release_date;
37 37
     $moduleSQLBaseFile = 'stubs/sql/setup.sql';
38 38
     $moduleSQLDataFile = 'stubs/sql/setup.data.sql';
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
     $action = isset($_GET['action']) ? trim(strip_tags($_GET['action'])) : 'language';
74 74
     str_replace('.', '', $action);
75 75
 
76
-    $controller = 'src/controllers/' . $action . '.php';
77
-    if (! file_exists($controller)) {
76
+    $controller = 'src/controllers/'.$action.'.php';
77
+    if (!file_exists($controller)) {
78 78
         die("Invalid install action attempted. [action={$action}]");
79 79
     }
80 80
     require $controller;
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 } else {
87 87
     $action = isset($_GET['action']) && is_scalar($_GET['action']) ? trim($_GET['action']) : 'language';
88 88
     str_replace('.', '', $action);
89
-    $controller = 'src/controllers/' . $action . '.php';
90
-    if (! file_exists($controller)) {
89
+    $controller = 'src/controllers/'.$action.'.php';
90
+    if (!file_exists($controller)) {
91 91
         die("Invalid install action attempted. [action={$action}]");
92 92
     }
93 93
     require $controller;
Please login to merge, or discard this patch.
manager/media/style/default/ajax.php 2 patches
Spacing   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
 $modx->loadExtension("ManagerAPI");
20 20
 
21 21
 $_lang = array();
22
-include_once MODX_MANAGER_PATH . '/includes/lang/english.inc.php';
22
+include_once MODX_MANAGER_PATH.'/includes/lang/english.inc.php';
23 23
 if ($modx->config['manager_language'] != 'english') {
24
-    include_once MODX_MANAGER_PATH . '/includes/lang/' . $modx->config['manager_language'] . '.inc.php';
24
+    include_once MODX_MANAGER_PATH.'/includes/lang/'.$modx->config['manager_language'].'.inc.php';
25 25
 }
26
-include_once MODX_MANAGER_PATH . '/media/style/' . $modx->config['manager_theme'] . '/style.php';
26
+include_once MODX_MANAGER_PATH.'/media/style/'.$modx->config['manager_theme'].'/style.php';
27 27
 
28 28
 $action = isset($_REQUEST['a']) ? $_REQUEST['a'] : '';
29 29
 $frame = isset($_REQUEST['f']) ? $_REQUEST['f'] : '';
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
             switch ($frame) {
42 42
                 case 'nodes':
43
-                    include_once MODX_MANAGER_PATH . '/frames/nodes.php';
43
+                    include_once MODX_MANAGER_PATH.'/frames/nodes.php';
44 44
 
45 45
                     break;
46 46
             }
@@ -58,21 +58,21 @@  discard block
 block discarded – undo
58 58
                 $sql = '';
59 59
                 $a = '';
60 60
                 $filter = !empty($_REQUEST['filter']) && is_scalar($_REQUEST['filter']) ? addcslashes(trim($_REQUEST['filter']), '%*_') : '';
61
-                $sqlLike = $filter ? 'WHERE t1.name LIKE "' . $modx->db->escape($filter) . '%"' : '';
62
-                $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit;
61
+                $sqlLike = $filter ? 'WHERE t1.name LIKE "'.$modx->db->escape($filter).'%"' : '';
62
+                $sqlLimit = $sqlLike ? '' : 'LIMIT '.$limit;
63 63
 
64 64
                 switch ($elements) {
65 65
                     case 'element_templates':
66 66
                         $a = 16;
67
-                        $sqlLike = $filter ? 'WHERE t1.templatename LIKE "' . $modx->db->escape($filter) . '%"' : '';
67
+                        $sqlLike = $filter ? 'WHERE t1.templatename LIKE "'.$modx->db->escape($filter).'%"' : '';
68 68
                         $sql = $modx->db->query('SELECT t1.id, t1.templatename AS name, t1.locked, 0 AS disabled
69
-                        FROM ' . $modx->getFullTableName('site_templates') . ' AS t1
70
-                        ' . $sqlLike . '
69
+                        FROM ' . $modx->getFullTableName('site_templates').' AS t1
70
+                        ' . $sqlLike.'
71 71
                         ORDER BY t1.templatename ASC
72 72
                         ' . $sqlLimit);
73 73
 
74 74
                         if ($modx->hasPermission('new_template')) {
75
-                            $output .= '<li><a id="a_19" href="index.php?a=19" target="main"><i class="fa fa-plus"></i>' . $_lang['new_template'] . '</a></li>';
75
+                            $output .= '<li><a id="a_19" href="index.php?a=19" target="main"><i class="fa fa-plus"></i>'.$_lang['new_template'].'</a></li>';
76 76
                         }
77 77
 
78 78
                         break;
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
                     case 'element_tplvars':
81 81
                         $a = 301;
82 82
                         $sql = $modx->db->query('SELECT t1.id, t1.name, t1.locked, IF(MIN(t2.tmplvarid),0,1) AS disabled
83
-                        FROM ' . $modx->getFullTableName('site_tmplvars') . ' AS t1
84
-                        LEFT JOIN ' . $modx->getFullTableName('site_tmplvar_templates') . ' AS t2 ON t1.id=t2.tmplvarid
85
-                        ' . $sqlLike . '
83
+                        FROM ' . $modx->getFullTableName('site_tmplvars').' AS t1
84
+                        LEFT JOIN ' . $modx->getFullTableName('site_tmplvar_templates').' AS t2 ON t1.id=t2.tmplvarid
85
+                        ' . $sqlLike.'
86 86
                         GROUP BY t1.id
87 87
                         ORDER BY t1.name ASC
88 88
                         ' . $sqlLimit);
89 89
 
90 90
                         if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
91
-                            $output .= '<li><a id="a_300" href="index.php?a=300" target="main"><i class="fa fa-plus"></i>' . $_lang['new_tmplvars'] . '</a></li>';
91
+                            $output .= '<li><a id="a_300" href="index.php?a=300" target="main"><i class="fa fa-plus"></i>'.$_lang['new_tmplvars'].'</a></li>';
92 92
                         }
93 93
 
94 94
                         break;
@@ -96,13 +96,13 @@  discard block
 block discarded – undo
96 96
                     case 'element_htmlsnippets':
97 97
                         $a = 78;
98 98
                         $sql = $modx->db->query('SELECT t1.id, t1.name, t1.locked, t1.disabled
99
-                        FROM ' . $modx->getFullTableName('site_htmlsnippets') . ' AS t1
100
-                        ' . $sqlLike . '
99
+                        FROM ' . $modx->getFullTableName('site_htmlsnippets').' AS t1
100
+                        ' . $sqlLike.'
101 101
                         ORDER BY t1.name ASC
102 102
                         ' . $sqlLimit);
103 103
 
104 104
                         if ($modx->hasPermission('new_chunk')) {
105
-                            $output .= '<li><a id="a_77" href="index.php?a=77" target="main"><i class="fa fa-plus"></i>' . $_lang['new_htmlsnippet'] . '</a></li>';
105
+                            $output .= '<li><a id="a_77" href="index.php?a=77" target="main"><i class="fa fa-plus"></i>'.$_lang['new_htmlsnippet'].'</a></li>';
106 106
                         }
107 107
 
108 108
                         break;
@@ -110,13 +110,13 @@  discard block
 block discarded – undo
110 110
                     case 'element_snippets':
111 111
                         $a = 22;
112 112
                         $sql = $modx->db->query('SELECT t1.id, t1.name, t1.locked, t1.disabled
113
-                        FROM ' . $modx->getFullTableName('site_snippets') . ' AS t1
114
-                        ' . $sqlLike . '
113
+                        FROM ' . $modx->getFullTableName('site_snippets').' AS t1
114
+                        ' . $sqlLike.'
115 115
                         ORDER BY t1.name ASC
116 116
                         ' . $sqlLimit);
117 117
 
118 118
                         if ($modx->hasPermission('new_snippet')) {
119
-                            $output .= '<li><a id="a_23" href="index.php?a=23" target="main"><i class="fa fa-plus"></i>' . $_lang['new_snippet'] . '</a></li>';
119
+                            $output .= '<li><a id="a_23" href="index.php?a=23" target="main"><i class="fa fa-plus"></i>'.$_lang['new_snippet'].'</a></li>';
120 120
                         }
121 121
 
122 122
                         break;
@@ -124,13 +124,13 @@  discard block
 block discarded – undo
124 124
                     case 'element_plugins':
125 125
                         $a = 102;
126 126
                         $sql = $modx->db->query('SELECT t1.id, t1.name, t1.locked, t1.disabled
127
-                        FROM ' . $modx->getFullTableName('site_plugins') . ' AS t1
128
-                        ' . $sqlLike . '
127
+                        FROM ' . $modx->getFullTableName('site_plugins').' AS t1
128
+                        ' . $sqlLike.'
129 129
                         ORDER BY t1.name ASC
130 130
                         ' . $sqlLimit);
131 131
 
132 132
                         if ($modx->hasPermission('new_plugin')) {
133
-                            $output .= '<li><a id="a_101" href="index.php?a=101" target="main"><i class="fa fa-plus"></i>' . $_lang['new_plugin'] . '</a></li>';
133
+                            $output .= '<li><a id="a_101" href="index.php?a=101" target="main"><i class="fa fa-plus"></i>'.$_lang['new_plugin'].'</a></li>';
134 134
                         }
135 135
 
136 136
                         break;
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
                             continue;
146 146
                         }
147 147
 
148
-                        $items .= '<li class="item ' . ($row['disabled'] ? 'disabled' : '') . ($row['locked'] ? ' locked' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main" data-parent-id="a_76__elements_' . $elements . '">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>' . "\n";
148
+                        $items .= '<li class="item '.($row['disabled'] ? 'disabled' : '').($row['locked'] ? ' locked' : '').'"><a id="a_'.$a.'__id_'.$row['id'].'" href="index.php?a='.$a.'&id='.$row['id'].'" target="main" data-parent-id="a_76__elements_'.$elements.'">'.$row['name'].' <small>('.$row['id'].')</small></a></li>'."\n";
149 149
                     }
150 150
                 }
151 151
 
@@ -166,23 +166,23 @@  discard block
 block discarded – undo
166 166
             $output = '';
167 167
             $items = '';
168 168
             $filter = !empty($_REQUEST['filter']) && is_scalar($_REQUEST['filter']) ? addcslashes(trim($_REQUEST['filter']), '\%*_') : '';
169
-            $sqlLike = $filter ? 'WHERE t1.username LIKE "' . $modx->db->escape($filter) . '%"' : '';
170
-            $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit;
169
+            $sqlLike = $filter ? 'WHERE t1.username LIKE "'.$modx->db->escape($filter).'%"' : '';
170
+            $sqlLimit = $sqlLike ? '' : 'LIMIT '.$limit;
171 171
 
172
-            if(!$modx->hasPermission('save_role')) {
172
+            if (!$modx->hasPermission('save_role')) {
173 173
                 $sqlLike .= $sqlLike ? ' AND ' : 'WHERE ';
174 174
                 $sqlLike .= 't2.role != 1';
175 175
             }
176 176
 
177 177
             $sql = $modx->db->query('SELECT t1.*, t1.username AS name, t2.blocked
178
-				FROM ' . $modx->getFullTableName('manager_users') . ' AS t1
179
-				LEFT JOIN ' . $modx->getFullTableName('user_attributes') . ' AS t2 ON t1.id=t2.internalKey
180
-				' . $sqlLike . '
178
+				FROM ' . $modx->getFullTableName('manager_users').' AS t1
179
+				LEFT JOIN ' . $modx->getFullTableName('user_attributes').' AS t2 ON t1.id=t2.internalKey
180
+				' . $sqlLike.'
181 181
 				ORDER BY t1.username ASC
182 182
 				' . $sqlLimit);
183 183
 
184 184
             if ($modx->hasPermission('new_user')) {
185
-                $output .= '<li><a id="a_11" href="index.php?a=11" target="main"><i class="fa fa-plus"></i>' . $_lang['new_user'] . '</a></li>';
185
+                $output .= '<li><a id="a_11" href="index.php?a=11" target="main"><i class="fa fa-plus"></i>'.$_lang['new_user'].'</a></li>';
186 186
             }
187 187
 
188 188
             if ($count = $modx->db->getRecordCount($sql)) {
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
                     $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>';
191 191
                 }
192 192
                 while ($row = $modx->db->getRow($sql)) {
193
-                    $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>';
193
+                    $items .= '<li class="item '.($row['blocked'] ? 'disabled' : '').'"><a id="a_'.$a.'__id_'.$row['id'].'" href="index.php?a='.$a.'&id='.$row['id'].'" target="main">'.$row['name'].' <small>('.$row['id'].')</small></a></li>';
194 194
                 }
195 195
             }
196 196
 
@@ -210,18 +210,18 @@  discard block
 block discarded – undo
210 210
             $output = '';
211 211
             $items = '';
212 212
             $filter = !empty($_REQUEST['filter']) && is_scalar($_REQUEST['filter']) ? addcslashes(trim($_REQUEST['filter']), '\%*_') : '';
213
-            $sqlLike = $filter ? 'WHERE t1.username LIKE "' . $modx->db->escape($filter) . '%"' : '';
214
-            $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit;
213
+            $sqlLike = $filter ? 'WHERE t1.username LIKE "'.$modx->db->escape($filter).'%"' : '';
214
+            $sqlLimit = $sqlLike ? '' : 'LIMIT '.$limit;
215 215
 
216 216
             $sql = $modx->db->query('SELECT t1.*, t1.username AS name, t2.blocked
217
-				FROM ' . $modx->getFullTableName('web_users') . ' AS t1
218
-				LEFT JOIN ' . $modx->getFullTableName('web_user_attributes') . ' AS t2 ON t1.id=t2.internalKey
219
-				' . $sqlLike . '
217
+				FROM ' . $modx->getFullTableName('web_users').' AS t1
218
+				LEFT JOIN ' . $modx->getFullTableName('web_user_attributes').' AS t2 ON t1.id=t2.internalKey
219
+				' . $sqlLike.'
220 220
 				ORDER BY t1.username ASC
221 221
 				' . $sqlLimit);
222 222
 
223 223
             if ($modx->hasPermission('new_web_user')) {
224
-                $output .= '<li><a id="a_87" href="index.php?a=87" target="main"><i class="fa fa-plus"></i>' . $_lang['new_web_user'] . '</a></li>';
224
+                $output .= '<li><a id="a_87" href="index.php?a=87" target="main"><i class="fa fa-plus"></i>'.$_lang['new_web_user'].'</a></li>';
225 225
             }
226 226
 
227 227
             if ($count = $modx->db->getRecordCount($sql)) {
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
                     $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>';
230 230
                 }
231 231
                 while ($row = $modx->db->getRow($sql)) {
232
-                    $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>';
232
+                    $items .= '<li class="item '.($row['blocked'] ? 'disabled' : '').'"><a id="a_'.$a.'__id_'.$row['id'].'" href="index.php?a='.$a.'&id='.$row['id'].'" target="main">'.$row['name'].' <small>('.$row['id'].')</small></a></li>';
233 233
                 }
234 234
             }
235 235
 
@@ -255,35 +255,35 @@  discard block
 block discarded – undo
255 255
                     case 'SnippetNoCache': {
256 256
 
257 257
                         $sql = $modx->db->query('SELECT *
258
-						FROM ' . $modx->getFullTableName('site_snippets') . '
259
-						WHERE name="' . $name . '"
258
+						FROM ' . $modx->getFullTableName('site_snippets').'
259
+						WHERE name="' . $name.'"
260 260
 						LIMIT 1');
261 261
 
262 262
                         if ($modx->db->getRecordCount($sql)) {
263 263
                             $row = $modx->db->getRow($sql);
264 264
                             $contextmenu = array(
265 265
                                 'header' => array(
266
-                                    'innerHTML' => '<i class="fa fa-code"></i> ' . $row['name']
266
+                                    'innerHTML' => '<i class="fa fa-code"></i> '.$row['name']
267 267
                                 ),
268 268
                                 'item' => array(
269
-                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'],
270
-                                    'url' => "index.php?a=22&id=" . $row['id']
269
+                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'],
270
+                                    'url' => "index.php?a=22&id=".$row['id']
271 271
                                 )
272 272
                             );
273 273
                             if (!empty($row['description'])) {
274 274
                                 $contextmenu['seperator'] = '';
275 275
                                 $contextmenu['description'] = array(
276
-                                    'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
276
+                                    'innerHTML' => '<i class="fa fa-info"></i> '.$row['description']
277 277
                                 );
278 278
                             }
279 279
                         } else {
280 280
                             $contextmenu = array(
281 281
                                 'header' => array(
282
-                                    'innerHTML' => '<i class="fa fa-code"></i> ' . $name
282
+                                    'innerHTML' => '<i class="fa fa-code"></i> '.$name
283 283
                                 ),
284 284
                                 'item' => array(
285
-                                    'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_snippet'],
286
-                                    'url' => "index.php?a=23&itemname=" . $name
285
+                                    'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_snippet'],
286
+                                    'url' => "index.php?a=23&itemname=".$name
287 287
                                 )
288 288
                             );
289 289
                         }
@@ -293,35 +293,35 @@  discard block
 block discarded – undo
293 293
                     case 'Chunk' : {
294 294
 
295 295
                         $sql = $modx->db->query('SELECT *
296
-						FROM ' . $modx->getFullTableName('site_htmlsnippets') . '
297
-						WHERE name="' . $name . '"
296
+						FROM ' . $modx->getFullTableName('site_htmlsnippets').'
297
+						WHERE name="' . $name.'"
298 298
 						LIMIT 1');
299 299
 
300 300
                         if ($modx->db->getRecordCount($sql)) {
301 301
                             $row = $modx->db->getRow($sql);
302 302
                             $contextmenu = array(
303 303
                                 'header' => array(
304
-                                    'innerHTML' => '<i class="fa fa-th-large"></i> ' . $row['name']
304
+                                    'innerHTML' => '<i class="fa fa-th-large"></i> '.$row['name']
305 305
                                 ),
306 306
                                 'item' => array(
307
-                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'],
308
-                                    'url' => "index.php?a=78&id=" . $row['id']
307
+                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'],
308
+                                    'url' => "index.php?a=78&id=".$row['id']
309 309
                                 )
310 310
                             );
311 311
                             if (!empty($row['description'])) {
312 312
                                 $contextmenu['seperator'] = '';
313 313
                                 $contextmenu['description'] = array(
314
-                                    'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
314
+                                    'innerHTML' => '<i class="fa fa-info"></i> '.$row['description']
315 315
                                 );
316 316
                             }
317 317
                         } else {
318 318
                             $contextmenu = array(
319 319
                                 'header' => array(
320
-                                    'innerHTML' => '<i class="fa fa-th-large"></i> ' . $name
320
+                                    'innerHTML' => '<i class="fa fa-th-large"></i> '.$name
321 321
                                 ),
322 322
                                 'item' => array(
323
-                                    'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_htmlsnippet'],
324
-                                    'url' => "index.php?a=77&itemname=" . $name
323
+                                    'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_htmlsnippet'],
324
+                                    'url' => "index.php?a=77&itemname=".$name
325 325
                                 )
326 326
                             );
327 327
                         }
@@ -330,8 +330,8 @@  discard block
 block discarded – undo
330 330
                     }
331 331
                     case 'AttributeValue': {
332 332
                         $sql = $modx->db->query('SELECT *
333
-						FROM ' . $modx->getFullTableName('site_htmlsnippets') . '
334
-						WHERE name="' . $name . '"
333
+						FROM ' . $modx->getFullTableName('site_htmlsnippets').'
334
+						WHERE name="' . $name.'"
335 335
 						LIMIT 1');
336 336
 
337 337
                         if ($modx->db->getRecordCount($sql)) {
@@ -341,52 +341,52 @@  discard block
 block discarded – undo
341 341
                                     'innerText' => $row['name']
342 342
                                 ),
343 343
                                 'item' => array(
344
-                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'],
345
-                                    'url' => "index.php?a=78&id=" . $row['id']
344
+                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'],
345
+                                    'url' => "index.php?a=78&id=".$row['id']
346 346
                                 )
347 347
                             );
348 348
                             if (!empty($row['description'])) {
349 349
                                 $contextmenu['seperator'] = '';
350 350
                                 $contextmenu['description'] = array(
351
-                                    'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
351
+                                    'innerHTML' => '<i class="fa fa-info"></i> '.$row['description']
352 352
                                 );
353 353
                             }
354 354
                         } else {
355 355
 
356 356
                             $sql = $modx->db->query('SELECT *
357
-							FROM ' . $modx->getFullTableName('site_snippets') . '
358
-							WHERE name="' . $name . '"
357
+							FROM ' . $modx->getFullTableName('site_snippets').'
358
+							WHERE name="' . $name.'"
359 359
 							LIMIT 1');
360 360
 
361 361
                             if ($modx->db->getRecordCount($sql)) {
362 362
                                 $row = $modx->db->getRow($sql);
363 363
                                 $contextmenu = array(
364 364
                                     'header' => array(
365
-                                        'innerHTML' => '<i class="fa fa-code"></i> ' . $row['name']
365
+                                        'innerHTML' => '<i class="fa fa-code"></i> '.$row['name']
366 366
                                     ),
367 367
                                     'item' => array(
368
-                                        'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'],
369
-                                        'url' => "index.php?a=22&id=" . $row['id']
368
+                                        'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'],
369
+                                        'url' => "index.php?a=22&id=".$row['id']
370 370
                                     )
371 371
                                 );
372 372
                                 if (!empty($row['description'])) {
373 373
                                     $contextmenu['seperator'] = '';
374 374
                                     $contextmenu['description'] = array(
375
-                                        'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
375
+                                        'innerHTML' => '<i class="fa fa-info"></i> '.$row['description']
376 376
                                     );
377 377
                                 }
378 378
                             } else {
379 379
                                 $contextmenu = array(
380 380
                                     'header' => array(
381
-                                        'innerHTML' => '<i class="fa fa-code"></i> ' . $name
381
+                                        'innerHTML' => '<i class="fa fa-code"></i> '.$name
382 382
                                     ),
383 383
                                     'item' => array(
384
-                                        'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_htmlsnippet'],
385
-                                        'url' => "index.php?a=77&itemname=" . $name
384
+                                        'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_htmlsnippet'],
385
+                                        'url' => "index.php?a=77&itemname=".$name
386 386
                                     ),
387 387
                                     'item2' => array(
388
-                                        'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_snippet'],
389
-                                        'url' => "index.php?a=23&itemname=" . $name
388
+                                        'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_snippet'],
389
+                                        'url' => "index.php?a=23&itemname=".$name
390 390
                                     )
391 391
                                 );
392 392
                             }
@@ -442,35 +442,35 @@  discard block
 block discarded – undo
442 442
                         }
443 443
 
444 444
                         $sql = $modx->db->query('SELECT *
445
-						FROM ' . $modx->getFullTableName('site_tmplvars') . '
446
-						WHERE name="' . $name . '"
445
+						FROM ' . $modx->getFullTableName('site_tmplvars').'
446
+						WHERE name="' . $name.'"
447 447
 						LIMIT 1');
448 448
 
449 449
                         if ($modx->db->getRecordCount($sql)) {
450 450
                             $row = $modx->db->getRow($sql);
451 451
                             $contextmenu = array(
452 452
                                 'header' => array(
453
-                                    'innerHTML' => '<i class="fa fa-list-alt"></i> ' . $row['name']
453
+                                    'innerHTML' => '<i class="fa fa-list-alt"></i> '.$row['name']
454 454
                                 ),
455 455
                                 'item' => array(
456
-                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'],
457
-                                    'url' => "index.php?a=301&id=" . $row['id']
456
+                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'],
457
+                                    'url' => "index.php?a=301&id=".$row['id']
458 458
                                 )
459 459
                             );
460 460
                             if (!empty($row['description'])) {
461 461
                                 $contextmenu['seperator'] = '';
462 462
                                 $contextmenu['description'] = array(
463
-                                    'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
463
+                                    'innerHTML' => '<i class="fa fa-info"></i> '.$row['description']
464 464
                                 );
465 465
                             }
466 466
                         } else {
467 467
                             $contextmenu = array(
468 468
                                 'header' => array(
469
-                                    'innerHTML' => '<i class="fa fa-list-alt"></i> ' . $name
469
+                                    'innerHTML' => '<i class="fa fa-list-alt"></i> '.$name
470 470
                                 ),
471 471
                                 'item' => array(
472
-                                    'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_tmplvars'],
473
-                                    'url' => "index.php?a=300&itemname=" . $name
472
+                                    'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_tmplvars'],
473
+                                    'url' => "index.php?a=300&itemname=".$name
474 474
                                 )
475 475
                             );
476 476
                         }
@@ -489,15 +489,15 @@  discard block
 block discarded – undo
489 489
             $json = array();
490 490
 
491 491
             if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) {
492
-                $id = !empty($_REQUEST['id']) ? (int)$_REQUEST['id'] : '';
493
-                $parent = isset($_REQUEST['parent']) ? (int)$_REQUEST['parent'] : 0;
492
+                $id = !empty($_REQUEST['id']) ? (int) $_REQUEST['id'] : '';
493
+                $parent = isset($_REQUEST['parent']) ? (int) $_REQUEST['parent'] : 0;
494 494
                 $menuindex = isset($_REQUEST['menuindex']) && is_scalar($_REQUEST['menuindex']) ? $_REQUEST['menuindex'] : 0;
495 495
 
496 496
                 // set parent
497 497
                 if ($id && $parent >= 0) {
498 498
 
499 499
                     // find older parent
500
-                    $parentOld = $modx->db->getValue($modx->db->select('parent', $modx->getFullTableName('site_content'), 'id=' . $id));
500
+                    $parentOld = $modx->db->getValue($modx->db->select('parent', $modx->getFullTableName('site_content'), 'id='.$id));
501 501
 
502 502
                     $eventOut = $modx->invokeEvent('onBeforeMoveDocument', [
503 503
                         'id_document' => $id,
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
                     if (empty($json['errors'])) {
519 519
                         // check privileges user for move docs
520 520
                         if (!empty($modx->config['tree_show_protected']) && $role != 1) {
521
-                            $sql = $modx->db->select('*', $modx->getFullTableName('document_groups'), 'document IN(' . $id . ',' . $parent . ',' . $parentOld . ')');
521
+                            $sql = $modx->db->select('*', $modx->getFullTableName('document_groups'), 'document IN('.$id.','.$parent.','.$parentOld.')');
522 522
                             if ($modx->db->getRecordCount($sql)) {
523 523
                                 $document_groups = array();
524 524
                                 while ($row = $modx->db->getRow($sql)) {
@@ -543,22 +543,22 @@  discard block
 block discarded – undo
543 543
                             // set new parent
544 544
                             $modx->db->update(array(
545 545
                                 'parent' => $parent
546
-                            ), $modx->getFullTableName('site_content'), 'id=' . $id);
546
+                            ), $modx->getFullTableName('site_content'), 'id='.$id);
547 547
                             // set parent isfolder = 1
548 548
                             $modx->db->update(array(
549 549
                                 'isfolder' => 1
550
-                            ), $modx->getFullTableName('site_content'), 'id=' . $parent);
550
+                            ), $modx->getFullTableName('site_content'), 'id='.$parent);
551 551
 
552 552
                             if ($parent != $parentOld) {
553 553
                                 // check children docs and set parent isfolder
554
-                                if ($modx->db->getRecordCount($modx->db->select('id', $modx->getFullTableName('site_content'), 'parent=' . $parentOld))) {
554
+                                if ($modx->db->getRecordCount($modx->db->select('id', $modx->getFullTableName('site_content'), 'parent='.$parentOld))) {
555 555
                                     $modx->db->update(array(
556 556
                                         'isfolder' => 1
557
-                                    ), $modx->getFullTableName('site_content'), 'id=' . $parentOld);
557
+                                    ), $modx->getFullTableName('site_content'), 'id='.$parentOld);
558 558
                                 } else {
559 559
                                     $modx->db->update(array(
560 560
                                         'isfolder' => 0
561
-                                    ), $modx->getFullTableName('site_content'), 'id=' . $parentOld);
561
+                                    ), $modx->getFullTableName('site_content'), 'id='.$parentOld);
562 562
                                 }
563 563
                             }
564 564
 
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
                             if (!empty($menuindex)) {
567 567
                                 $menuindex = explode(',', $menuindex);
568 568
                                 foreach ($menuindex as $key => $value) {
569
-                                    $modx->db->query('UPDATE ' . $modx->getFullTableName('site_content') . ' SET menuindex=' . $key . ' WHERE id=' . $value);
569
+                                    $modx->db->query('UPDATE '.$modx->getFullTableName('site_content').' SET menuindex='.$key.' WHERE id='.$value);
570 570
                                 }
571 571
                             } else {
572 572
                                 // TODO: max(*) menuindex
@@ -595,19 +595,19 @@  discard block
 block discarded – undo
595 595
         }
596 596
 
597 597
         case 'getLockedElements': {
598
-            $type = isset($_REQUEST['type']) ? (int)$_REQUEST['type'] : 0;
599
-            $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
598
+            $type = isset($_REQUEST['type']) ? (int) $_REQUEST['type'] : 0;
599
+            $id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
600 600
 
601 601
             $output = !!$modx->elementIsLocked($type, $id, true);
602 602
 
603 603
             if (!$output) {
604 604
                 $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : '';
605
-                $docgrp_cond = $docgrp ? ' OR dg.document_group IN (' . $docgrp . ')' : '';
605
+                $docgrp_cond = $docgrp ? ' OR dg.document_group IN ('.$docgrp.')' : '';
606 606
                 $sql = '
607
-                    SELECT MAX(IF(1=' . $role . ' OR sc.privatemgr=0' . $docgrp_cond . ', 0, 1)) AS locked
608
-                    FROM ' . $modx->getFullTableName('site_content') . ' AS sc 
609
-                    LEFT JOIN ' . $modx->getFullTableName('document_groups') . ' dg ON dg.document=sc.id
610
-                    WHERE sc.id=' . $id . ' GROUP BY sc.id';
607
+                    SELECT MAX(IF(1=' . $role.' OR sc.privatemgr=0'.$docgrp_cond.', 0, 1)) AS locked
608
+                    FROM ' . $modx->getFullTableName('site_content').' AS sc 
609
+                    LEFT JOIN ' . $modx->getFullTableName('document_groups').' dg ON dg.document=sc.id
610
+                    WHERE sc.id=' . $id.' GROUP BY sc.id';
611 611
                 $sql = $modx->db->query($sql);
612 612
                 if ($modx->db->getRecordCount($sql)) {
613 613
                     $row = $modx->db->getRow($sql);
Please login to merge, or discard this patch.
Braces   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -7,11 +7,11 @@  discard block
 block discarded – undo
7 7
 
8 8
 $modx->db->connect();
9 9
 
10
-if (empty ($modx->config)) {
10
+if (empty ($modx->config)) {
11 11
     $modx->getSettings();
12 12
 }
13 13
 
14
-if (!isset($_SESSION['mgrValidated']) || !isset($_SERVER['HTTP_X_REQUESTED_WITH']) || (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') || ($_SERVER['REQUEST_METHOD'] != 'POST')) {
14
+if (!isset($_SESSION['mgrValidated']) || !isset($_SERVER['HTTP_X_REQUESTED_WITH']) || (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') || ($_SERVER['REQUEST_METHOD'] != 'POST')) {
15 15
     $modx->sendErrorPage();
16 16
 }
17 17
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
 $_lang = array();
22 22
 include_once MODX_MANAGER_PATH . '/includes/lang/english.inc.php';
23
-if ($modx->config['manager_language'] != 'english') {
23
+if ($modx->config['manager_language'] != 'english') {
24 24
     include_once MODX_MANAGER_PATH . '/includes/lang/' . $modx->config['manager_language'] . '.inc.php';
25 25
 }
26 26
 include_once MODX_MANAGER_PATH . '/media/style/' . $modx->config['manager_theme'] . '/style.php';
@@ -33,12 +33,12 @@  discard block
 block discarded – undo
33 33
 // set limit sql query
34 34
 $limit = !empty($modx->config['number_of_results']) ? (int) $modx->config['number_of_results'] : 100;
35 35
 
36
-if (isset($action)) {
37
-    switch ($action) {
36
+if (isset($action)) {
37
+    switch ($action) {
38 38
 
39 39
         case '1': {
40 40
 
41
-            switch ($frame) {
41
+            switch ($frame) {
42 42
                 case 'nodes':
43 43
                     include_once MODX_MANAGER_PATH . '/frames/nodes.php';
44 44
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
             $elements = isset($_REQUEST['elements']) && is_scalar($_REQUEST['elements']) ? htmlentities($_REQUEST['elements']) : '';
54 54
 
55
-            if ($elements) {
55
+            if ($elements) {
56 56
                 $output = '';
57 57
                 $items = '';
58 58
                 $sql = '';
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
                 $sqlLike = $filter ? 'WHERE t1.name LIKE "' . $modx->db->escape($filter) . '%"' : '';
62 62
                 $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit;
63 63
 
64
-                switch ($elements) {
64
+                switch ($elements) {
65 65
                     case 'element_templates':
66 66
                         $a = 16;
67 67
                         $sqlLike = $filter ? 'WHERE t1.templatename LIKE "' . $modx->db->escape($filter) . '%"' : '';
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
                         ORDER BY t1.templatename ASC
72 72
                         ' . $sqlLimit);
73 73
 
74
-                        if ($modx->hasPermission('new_template')) {
74
+                        if ($modx->hasPermission('new_template')) {
75 75
                             $output .= '<li><a id="a_19" href="index.php?a=19" target="main"><i class="fa fa-plus"></i>' . $_lang['new_template'] . '</a></li>';
76 76
                         }
77 77
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
                         ORDER BY t1.name ASC
88 88
                         ' . $sqlLimit);
89 89
 
90
-                        if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
90
+                        if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
91 91
                             $output .= '<li><a id="a_300" href="index.php?a=300" target="main"><i class="fa fa-plus"></i>' . $_lang['new_tmplvars'] . '</a></li>';
92 92
                         }
93 93
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
                         ORDER BY t1.name ASC
102 102
                         ' . $sqlLimit);
103 103
 
104
-                        if ($modx->hasPermission('new_chunk')) {
104
+                        if ($modx->hasPermission('new_chunk')) {
105 105
                             $output .= '<li><a id="a_77" href="index.php?a=77" target="main"><i class="fa fa-plus"></i>' . $_lang['new_htmlsnippet'] . '</a></li>';
106 106
                         }
107 107
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
                         ORDER BY t1.name ASC
116 116
                         ' . $sqlLimit);
117 117
 
118
-                        if ($modx->hasPermission('new_snippet')) {
118
+                        if ($modx->hasPermission('new_snippet')) {
119 119
                             $output .= '<li><a id="a_23" href="index.php?a=23" target="main"><i class="fa fa-plus"></i>' . $_lang['new_snippet'] . '</a></li>';
120 120
                         }
121 121
 
@@ -129,19 +129,19 @@  discard block
 block discarded – undo
129 129
                         ORDER BY t1.name ASC
130 130
                         ' . $sqlLimit);
131 131
 
132
-                        if ($modx->hasPermission('new_plugin')) {
132
+                        if ($modx->hasPermission('new_plugin')) {
133 133
                             $output .= '<li><a id="a_101" href="index.php?a=101" target="main"><i class="fa fa-plus"></i>' . $_lang['new_plugin'] . '</a></li>';
134 134
                         }
135 135
 
136 136
                         break;
137 137
                 }
138 138
 
139
-                if ($count = $modx->db->getRecordCount($sql)) {
140
-                    if ($count == $limit) {
139
+                if ($count = $modx->db->getRecordCount($sql)) {
140
+                    if ($count == $limit) {
141 141
                         $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>';
142 142
                     }
143
-                    while ($row = $modx->db->getRow($sql)) {
144
-                        if (($row['disabled'] || $row['locked']) && $role != 1) {
143
+                    while ($row = $modx->db->getRow($sql)) {
144
+                        if (($row['disabled'] || $row['locked']) && $role != 1) {
145 145
                             continue;
146 146
                         }
147 147
 
@@ -149,9 +149,9 @@  discard block
 block discarded – undo
149 149
                     }
150 150
                 }
151 151
 
152
-                if (isset($_REQUEST['filter'])) {
152
+                if (isset($_REQUEST['filter'])) {
153 153
                     $output = $items;
154
-                } else {
154
+                } else {
155 155
                     $output .= $items;
156 156
                 }
157 157
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
             $sqlLike = $filter ? 'WHERE t1.username LIKE "' . $modx->db->escape($filter) . '%"' : '';
170 170
             $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit;
171 171
 
172
-            if(!$modx->hasPermission('save_role')) {
172
+            if(!$modx->hasPermission('save_role')) {
173 173
                 $sqlLike .= $sqlLike ? ' AND ' : 'WHERE ';
174 174
                 $sqlLike .= 't2.role != 1';
175 175
             }
@@ -181,22 +181,22 @@  discard block
 block discarded – undo
181 181
 				ORDER BY t1.username ASC
182 182
 				' . $sqlLimit);
183 183
 
184
-            if ($modx->hasPermission('new_user')) {
184
+            if ($modx->hasPermission('new_user')) {
185 185
                 $output .= '<li><a id="a_11" href="index.php?a=11" target="main"><i class="fa fa-plus"></i>' . $_lang['new_user'] . '</a></li>';
186 186
             }
187 187
 
188
-            if ($count = $modx->db->getRecordCount($sql)) {
189
-                if ($count == $limit) {
188
+            if ($count = $modx->db->getRecordCount($sql)) {
189
+                if ($count == $limit) {
190 190
                     $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>';
191 191
                 }
192
-                while ($row = $modx->db->getRow($sql)) {
192
+                while ($row = $modx->db->getRow($sql)) {
193 193
                     $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>';
194 194
                 }
195 195
             }
196 196
 
197
-            if (isset($_REQUEST['filter'])) {
197
+            if (isset($_REQUEST['filter'])) {
198 198
                 $output = $items;
199
-            } else {
199
+            } else {
200 200
                 $output .= $items;
201 201
             }
202 202
 
@@ -220,22 +220,22 @@  discard block
 block discarded – undo
220 220
 				ORDER BY t1.username ASC
221 221
 				' . $sqlLimit);
222 222
 
223
-            if ($modx->hasPermission('new_web_user')) {
223
+            if ($modx->hasPermission('new_web_user')) {
224 224
                 $output .= '<li><a id="a_87" href="index.php?a=87" target="main"><i class="fa fa-plus"></i>' . $_lang['new_web_user'] . '</a></li>';
225 225
             }
226 226
 
227
-            if ($count = $modx->db->getRecordCount($sql)) {
228
-                if ($count == $limit) {
227
+            if ($count = $modx->db->getRecordCount($sql)) {
228
+                if ($count == $limit) {
229 229
                     $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>';
230 230
                 }
231
-                while ($row = $modx->db->getRow($sql)) {
231
+                while ($row = $modx->db->getRow($sql)) {
232 232
                     $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>';
233 233
                 }
234 234
             }
235 235
 
236
-            if (isset($_REQUEST['filter'])) {
236
+            if (isset($_REQUEST['filter'])) {
237 237
                 $output = $items;
238
-            } else {
238
+            } else {
239 239
                 $output .= $items;
240 240
             }
241 241
 
@@ -249,8 +249,8 @@  discard block
 block discarded – undo
249 249
             $type = isset($_REQUEST['type']) && is_scalar($_REQUEST['type']) ? $modx->db->escape($_REQUEST['type']) : false;
250 250
             $contextmenu = '';
251 251
 
252
-            if ($role && $name && $type) {
253
-                switch ($type) {
252
+            if ($role && $name && $type) {
253
+                switch ($type) {
254 254
                     case 'Snippet':
255 255
                     case 'SnippetNoCache': {
256 256
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 						WHERE name="' . $name . '"
260 260
 						LIMIT 1');
261 261
 
262
-                        if ($modx->db->getRecordCount($sql)) {
262
+                        if ($modx->db->getRecordCount($sql)) {
263 263
                             $row = $modx->db->getRow($sql);
264 264
                             $contextmenu = array(
265 265
                                 'header' => array(
@@ -270,13 +270,13 @@  discard block
 block discarded – undo
270 270
                                     'url' => "index.php?a=22&id=" . $row['id']
271 271
                                 )
272 272
                             );
273
-                            if (!empty($row['description'])) {
273
+                            if (!empty($row['description'])) {
274 274
                                 $contextmenu['seperator'] = '';
275 275
                                 $contextmenu['description'] = array(
276 276
                                     'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
277 277
                                 );
278 278
                             }
279
-                        } else {
279
+                        } else {
280 280
                             $contextmenu = array(
281 281
                                 'header' => array(
282 282
                                     'innerHTML' => '<i class="fa fa-code"></i> ' . $name
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 						WHERE name="' . $name . '"
298 298
 						LIMIT 1');
299 299
 
300
-                        if ($modx->db->getRecordCount($sql)) {
300
+                        if ($modx->db->getRecordCount($sql)) {
301 301
                             $row = $modx->db->getRow($sql);
302 302
                             $contextmenu = array(
303 303
                                 'header' => array(
@@ -308,13 +308,13 @@  discard block
 block discarded – undo
308 308
                                     'url' => "index.php?a=78&id=" . $row['id']
309 309
                                 )
310 310
                             );
311
-                            if (!empty($row['description'])) {
311
+                            if (!empty($row['description'])) {
312 312
                                 $contextmenu['seperator'] = '';
313 313
                                 $contextmenu['description'] = array(
314 314
                                     'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
315 315
                                 );
316 316
                             }
317
-                        } else {
317
+                        } else {
318 318
                             $contextmenu = array(
319 319
                                 'header' => array(
320 320
                                     'innerHTML' => '<i class="fa fa-th-large"></i> ' . $name
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 						WHERE name="' . $name . '"
335 335
 						LIMIT 1');
336 336
 
337
-                        if ($modx->db->getRecordCount($sql)) {
337
+                        if ($modx->db->getRecordCount($sql)) {
338 338
                             $row = $modx->db->getRow($sql);
339 339
                             $contextmenu = array(
340 340
                                 'header' => array(
@@ -345,20 +345,20 @@  discard block
 block discarded – undo
345 345
                                     'url' => "index.php?a=78&id=" . $row['id']
346 346
                                 )
347 347
                             );
348
-                            if (!empty($row['description'])) {
348
+                            if (!empty($row['description'])) {
349 349
                                 $contextmenu['seperator'] = '';
350 350
                                 $contextmenu['description'] = array(
351 351
                                     'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
352 352
                                 );
353 353
                             }
354
-                        } else {
354
+                        } else {
355 355
 
356 356
                             $sql = $modx->db->query('SELECT *
357 357
 							FROM ' . $modx->getFullTableName('site_snippets') . '
358 358
 							WHERE name="' . $name . '"
359 359
 							LIMIT 1');
360 360
 
361
-                            if ($modx->db->getRecordCount($sql)) {
361
+                            if ($modx->db->getRecordCount($sql)) {
362 362
                                 $row = $modx->db->getRow($sql);
363 363
                                 $contextmenu = array(
364 364
                                     'header' => array(
@@ -369,13 +369,13 @@  discard block
 block discarded – undo
369 369
                                         'url' => "index.php?a=22&id=" . $row['id']
370 370
                                     )
371 371
                                 );
372
-                                if (!empty($row['description'])) {
372
+                                if (!empty($row['description'])) {
373 373
                                     $contextmenu['seperator'] = '';
374 374
                                     $contextmenu['description'] = array(
375 375
                                         'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
376 376
                                     );
377 377
                                 }
378
-                            } else {
378
+                            } else {
379 379
                                 $contextmenu = array(
380 380
                                     'header' => array(
381 381
                                         'innerHTML' => '<i class="fa fa-code"></i> ' . $name
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
                             'alias_visible'
438 438
                         );
439 439
 
440
-                        if (in_array($name, $default_field)) {
440
+                        if (in_array($name, $default_field)) {
441 441
                             return;
442 442
                         }
443 443
 
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 						WHERE name="' . $name . '"
447 447
 						LIMIT 1');
448 448
 
449
-                        if ($modx->db->getRecordCount($sql)) {
449
+                        if ($modx->db->getRecordCount($sql)) {
450 450
                             $row = $modx->db->getRow($sql);
451 451
                             $contextmenu = array(
452 452
                                 'header' => array(
@@ -457,13 +457,13 @@  discard block
 block discarded – undo
457 457
                                     'url' => "index.php?a=301&id=" . $row['id']
458 458
                                 )
459 459
                             );
460
-                            if (!empty($row['description'])) {
460
+                            if (!empty($row['description'])) {
461 461
                                 $contextmenu['seperator'] = '';
462 462
                                 $contextmenu['description'] = array(
463 463
                                     'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
464 464
                                 );
465 465
                             }
466
-                        } else {
466
+                        } else {
467 467
                             $contextmenu = array(
468 468
                                 'header' => array(
469 469
                                     'innerHTML' => '<i class="fa fa-list-alt"></i> ' . $name
@@ -488,13 +488,13 @@  discard block
 block discarded – undo
488 488
         case 'movedocument' : {
489 489
             $json = array();
490 490
 
491
-            if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) {
491
+            if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) {
492 492
                 $id = !empty($_REQUEST['id']) ? (int)$_REQUEST['id'] : '';
493 493
                 $parent = isset($_REQUEST['parent']) ? (int)$_REQUEST['parent'] : 0;
494 494
                 $menuindex = isset($_REQUEST['menuindex']) && is_scalar($_REQUEST['menuindex']) ? $_REQUEST['menuindex'] : 0;
495 495
 
496 496
                 // set parent
497
-                if ($id && $parent >= 0) {
497
+                if ($id && $parent >= 0) {
498 498
 
499 499
                     // find older parent
500 500
                     $parentOld = $modx->db->getValue($modx->db->select('parent', $modx->getFullTableName('site_content'), 'id=' . $id));
@@ -505,31 +505,31 @@  discard block
 block discarded – undo
505 505
                         'new_parent'  => $parent,
506 506
                     ]);
507 507
 
508
-                    if (is_array($eventOut) && count($eventOut) > 0) {
508
+                    if (is_array($eventOut) && count($eventOut) > 0) {
509 509
                         $eventParent = array_pop($eventOut);
510 510
 
511
-                        if ($eventParent == $parentOld) {
511
+                        if ($eventParent == $parentOld) {
512 512
                             $json['errors'] = $_lang['error_movedocument2'];
513
-                        } else {
513
+                        } else {
514 514
                             $parent = $eventParent;
515 515
                         }
516 516
                     }
517 517
 
518
-                    if (empty($json['errors'])) {
518
+                    if (empty($json['errors'])) {
519 519
                         // check privileges user for move docs
520
-                        if (!empty($modx->config['tree_show_protected']) && $role != 1) {
520
+                        if (!empty($modx->config['tree_show_protected']) && $role != 1) {
521 521
                             $sql = $modx->db->select('*', $modx->getFullTableName('document_groups'), 'document IN(' . $id . ',' . $parent . ',' . $parentOld . ')');
522
-                            if ($modx->db->getRecordCount($sql)) {
522
+                            if ($modx->db->getRecordCount($sql)) {
523 523
                                 $document_groups = array();
524
-                                while ($row = $modx->db->getRow($sql)) {
524
+                                while ($row = $modx->db->getRow($sql)) {
525 525
                                     $document_groups[$row['document']]['groups'][] = $row['document_group'];
526 526
                                 }
527
-                                foreach ($document_groups as $key => $value) {
528
-                                    if (($key == $parent || $key == $parentOld || $key == $id) && !in_array($role, $value['groups'])) {
527
+                                foreach ($document_groups as $key => $value) {
528
+                                    if (($key == $parent || $key == $parentOld || $key == $id) && !in_array($role, $value['groups'])) {
529 529
                                         $json['errors'] = $_lang["error_no_privileges"];
530 530
                                     }
531 531
                                 }
532
-                                if ($json['errors']) {
532
+                                if ($json['errors']) {
533 533
                                     header('content-type: application/json');
534 534
                                     echo json_encode($json, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE);
535 535
                                     break;
@@ -537,9 +537,9 @@  discard block
 block discarded – undo
537 537
                             }
538 538
                         }
539 539
 
540
-                        if ($parent == 0 && $parent != $parentOld && !$modx->config['udperms_allowroot'] && $role != 1) {
540
+                        if ($parent == 0 && $parent != $parentOld && !$modx->config['udperms_allowroot'] && $role != 1) {
541 541
                             $json['errors'] = $_lang["error_no_privileges"];
542
-                        } else {
542
+                        } else {
543 543
                             // set new parent
544 544
                             $modx->db->update(array(
545 545
                                 'parent' => $parent
@@ -549,13 +549,13 @@  discard block
 block discarded – undo
549 549
                                 'isfolder' => 1
550 550
                             ), $modx->getFullTableName('site_content'), 'id=' . $parent);
551 551
 
552
-                            if ($parent != $parentOld) {
552
+                            if ($parent != $parentOld) {
553 553
                                 // check children docs and set parent isfolder
554
-                                if ($modx->db->getRecordCount($modx->db->select('id', $modx->getFullTableName('site_content'), 'parent=' . $parentOld))) {
554
+                                if ($modx->db->getRecordCount($modx->db->select('id', $modx->getFullTableName('site_content'), 'parent=' . $parentOld))) {
555 555
                                     $modx->db->update(array(
556 556
                                         'isfolder' => 1
557 557
                                     ), $modx->getFullTableName('site_content'), 'id=' . $parentOld);
558
-                                } else {
558
+                                } else {
559 559
                                     $modx->db->update(array(
560 560
                                         'isfolder' => 0
561 561
                                     ), $modx->getFullTableName('site_content'), 'id=' . $parentOld);
@@ -563,16 +563,16 @@  discard block
 block discarded – undo
563 563
                             }
564 564
 
565 565
                             // set menuindex
566
-                            if (!empty($menuindex)) {
566
+                            if (!empty($menuindex)) {
567 567
                                 $menuindex = explode(',', $menuindex);
568
-                                foreach ($menuindex as $key => $value) {
568
+                                foreach ($menuindex as $key => $value) {
569 569
                                     $modx->db->query('UPDATE ' . $modx->getFullTableName('site_content') . ' SET menuindex=' . $key . ' WHERE id=' . $value);
570 570
                                 }
571
-                            } else {
571
+                            } else {
572 572
                                 // TODO: max(*) menuindex
573 573
                             }
574 574
 
575
-                            if (!$json['errors']) {
575
+                            if (!$json['errors']) {
576 576
                                 $json['success'] = $_lang["actioncomplete"];
577 577
 
578 578
                                 $modx->invokeEvent('onAfterMoveDocument', [
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
                         }
585 585
                     }
586 586
                 }
587
-            } else {
587
+            } else {
588 588
                 $json['errors'] = $_lang["error_no_privileges"];
589 589
             }
590 590
 
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
 
601 601
             $output = !!$modx->elementIsLocked($type, $id, true);
602 602
 
603
-            if (!$output) {
603
+            if (!$output) {
604 604
                 $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : '';
605 605
                 $docgrp_cond = $docgrp ? ' OR dg.document_group IN (' . $docgrp . ')' : '';
606 606
                 $sql = '
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
                     LEFT JOIN ' . $modx->getFullTableName('document_groups') . ' dg ON dg.document=sc.id
610 610
                     WHERE sc.id=' . $id . ' GROUP BY sc.id';
611 611
                 $sql = $modx->db->query($sql);
612
-                if ($modx->db->getRecordCount($sql)) {
612
+                if ($modx->db->getRecordCount($sql)) {
613 613
                     $row = $modx->db->getRow($sql);
614 614
                     $output = !!$row['locked'];
615 615
                 }
Please login to merge, or discard this patch.