Completed
Push — develop ( 1baf28...d8e7ec )
by Dmytro
07:22 queued 02:00
created
install/actions/action_mode.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // Determine upgradeability
3 3
 $upgradeable = 0;
4
-if (is_file($base_path . MGR_DIR . '/includes/config.inc.php')) { // Include the file so we can test its validity
5
-    include_once $base_path . MGR_DIR . '/includes/config.inc.php';
4
+if (is_file($base_path.MGR_DIR.'/includes/config.inc.php')) { // Include the file so we can test its validity
5
+    include_once $base_path.MGR_DIR.'/includes/config.inc.php';
6 6
     // We need to have all connection settings - tho prefix may be empty so we have to ignore it
7 7
     if (isset($dbase)) {
8 8
         if (!$conn = @mysqli_connect($database_server, $database_user, $database_password))
@@ -17,16 +17,16 @@  discard block
 block discarded – undo
17 17
 }
18 18
 
19 19
 $ph['moduleName']       = $moduleName;
20
-$ph['displayNew']       = ($upgradeable!=0) ? 'display:none;' : '';
21
-$ph['displayUpg']       = ($upgradeable==0) ? 'display:none;' : '';
20
+$ph['displayNew']       = ($upgradeable != 0) ? 'display:none;' : '';
21
+$ph['displayUpg']       = ($upgradeable == 0) ? 'display:none;' : '';
22 22
 $ph['displayAdvUpg']    = $ph['displayUpg'];
23
-$ph['checkedNew']       = !$upgradeable     ? 'checked' : '';
24
-$ph['checkedUpg']       = ($_POST['installmode']==1 || $upgradeable==1) ? 'checked' : '';
25
-$ph['checkedAdvUpg']    = ($_POST['installmode']==2 || $upgradeable==2) ? 'checked' : '';
23
+$ph['checkedNew']       = !$upgradeable ? 'checked' : '';
24
+$ph['checkedUpg']       = ($_POST['installmode'] == 1 || $upgradeable == 1) ? 'checked' : '';
25
+$ph['checkedAdvUpg']    = ($_POST['installmode'] == 2 || $upgradeable == 2) ? 'checked' : '';
26 26
 $ph['install_language'] = $install_language;
27
-$ph['disabledUpg']      = ($upgradeable!=1) ? 'disabled' : '';
28
-$ph['disabledAdvUpg']   = ($upgradeable==0) ? 'disabled' : '';
27
+$ph['disabledUpg']      = ($upgradeable != 1) ? 'disabled' : '';
28
+$ph['disabledAdvUpg']   = ($upgradeable == 0) ? 'disabled' : '';
29 29
 
30
-$tpl = file_get_contents($base_path . 'install/actions/tpl_mode.html');
30
+$tpl = file_get_contents($base_path.'install/actions/tpl_mode.html');
31 31
 $content = parse($tpl, $ph);
32
-echo parse($content, $_lang,'[%','%]');
32
+echo parse($content, $_lang, '[%', '%]');
Please login to merge, or discard this patch.
Braces   +12 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,20 +1,22 @@
 block discarded – undo
1 1
 <?php
2 2
 // Determine upgradeability
3 3
 $upgradeable = 0;
4
-if (is_file($base_path . MGR_DIR . '/includes/config.inc.php')) { // Include the file so we can test its validity
4
+if (is_file($base_path . MGR_DIR . '/includes/config.inc.php')) {
5
+// Include the file so we can test its validity
5 6
     include_once $base_path . MGR_DIR . '/includes/config.inc.php';
6 7
     // We need to have all connection settings - tho prefix may be empty so we have to ignore it
7 8
     if (isset($dbase)) {
8
-        if (!$conn = @mysqli_connect($database_server, $database_user, $database_password))
9
-            $upgradeable = isset($_POST['installmode']) && $_POST['installmode'] == 'new' ? 0 : 2;
10
-        elseif (!@mysqli_select_db($conn, trim($dbase, '`')))
11
-            $upgradeable = isset($_POST['installmode']) && $_POST['installmode'] == 'new' ? 0 : 2;
12
-        else
13
-            $upgradeable = 1;
9
+        if (!$conn = @mysqli_connect($database_server, $database_user, $database_password)) {
10
+                    $upgradeable = isset($_POST['installmode']) && $_POST['installmode'] == 'new' ? 0 : 2;
11
+        } elseif (!@mysqli_select_db($conn, trim($dbase, '`'))) {
12
+                    $upgradeable = isset($_POST['installmode']) && $_POST['installmode'] == 'new' ? 0 : 2;
13
+        } else {
14
+                    $upgradeable = 1;
15
+        }
16
+    } else {
17
+            $upgradeable = 2;
18
+    }
14 19
     }
15
-    else
16
-        $upgradeable = 2;
17
-}
18 20
 
19 21
 $ph['moduleName']       = $moduleName;
20 22
 $ph['displayNew']       = ($upgradeable!=0) ? 'display:none;' : '';
Please login to merge, or discard this patch.
manager/processors/save_content.processor.php 4 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -492,7 +492,7 @@
 block discarded – undo
492 492
                 }elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) {
493 493
                 $publishedon = $pub_date;
494 494
                 $publishedby = $modx->getLoginUserID();
495
-                   }elseif ($was_published && !$published) {
495
+                    }elseif ($was_published && !$published) {
496 496
                 $publishedon = 0;
497 497
                 $publishedby = 0;
498 498
             } else {
Please login to merge, or discard this patch.
Switch Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -280,19 +280,19 @@
 block discarded – undo
280 280
             // invoke OnBeforeDocFormSave event
281 281
             switch($modx->config['docid_incrmnt_method'])
282 282
             {
283
-            case '1':
284
-                $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id";
285
-                $where = "T1.id IS NULL";
286
-                $rs = $modx->db->select('MIN(T0.id)+1', $from, "T1.id IS NULL");
287
-                $id = $modx->db->getValue($rs);
283
+                case '1':
284
+                    $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id";
285
+                    $where = "T1.id IS NULL";
286
+                    $rs = $modx->db->select('MIN(T0.id)+1', $from, "T1.id IS NULL");
287
+                    $id = $modx->db->getValue($rs);
288
+                    break;
289
+                case '2':
290
+                    $rs = $modx->db->select('MAX(id)+1', $tbl_site_content);
291
+                    $id = $modx->db->getValue($rs);
288 292
                 break;
289
-            case '2':
290
-                $rs = $modx->db->select('MAX(id)+1', $tbl_site_content);
291
-                $id = $modx->db->getValue($rs);
292
-            break;
293 293
 
294
-            default:
295
-                $id = '';
294
+                default:
295
+                    $id = '';
296 296
             }
297 297
 
298 298
         $modx->invokeEvent("OnBeforeDocFormSave", array(
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
         case 'new' :
279 279
 
280 280
             // invoke OnBeforeDocFormSave event
281
-            switch($modx->config['docid_incrmnt_method'])
281
+            switch ($modx->config['docid_incrmnt_method'])
282 282
             {
283 283
             case '1':
284 284
                 $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id";
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
             if (!$was_published && $published) {
490 490
                 $publishedon = $currentdate;
491 491
                 $publishedby = $modx->getLoginUserID();
492
-                }elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) {
492
+                }elseif ((!empty($pub_date) && $pub_date <= $currentdate && $published)) {
493 493
                 $publishedon = $pub_date;
494 494
                 $publishedby = $modx->getLoginUserID();
495 495
                    }elseif ($was_published && !$published) {
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
             }
502 502
 
503 503
             // invoke OnBeforeDocFormSave event
504
-            $modx->invokeEvent("OnBeforeDocFormSave", array (
504
+            $modx->invokeEvent("OnBeforeDocFormSave", array(
505 505
                 "mode" => "upd",
506 506
                 "id" => $id
507 507
             ));
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
                 . "menuindex={$menuindex}, "
527 527
                 . "searchable={$searchable}, "
528 528
                 . "cacheable={$cacheable}, "
529
-                . "editedby=" . $modx->getLoginUserID() . ", "
529
+                . "editedby=".$modx->getLoginUserID().", "
530 530
                 . "editedon={$currentdate}, "
531 531
                 . "publishedon={$publishedon}, "
532 532
                 . "publishedby={$publishedby}, "
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 
541 541
             // update template variables
542 542
             $rs = $modx->db->select('id, tmplvarid', $tbl_site_tmplvar_contentvalues, "contentid='{$id}'");
543
-            $tvIds = array ();
543
+            $tvIds = array();
544 544
             while ($row = $modx->db->getRow($rs)) {
545 545
                 $tvIds[$row['tmplvarid']] = $row['id'];
546 546
             }
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
                     'groups.id, groups.document_group',
594 594
                     "{$tbl_document_groups} AS groups
595 595
                     LEFT JOIN {$tbl_documentgroup_names} AS dgn ON dgn.id = groups.document_group",
596
-                    "((1=".(int)$isManager." AND dgn.private_memgroup) OR (1=".(int)$isWeb." AND dgn.private_webgroup)) AND groups.document = '{$id}'"
596
+                    "((1=".(int) $isManager." AND dgn.private_memgroup) OR (1=".(int) $isWeb." AND dgn.private_webgroup)) AND groups.document = '{$id}'"
597 597
                     );
598 598
                 $old_groups = array();
599 599
                 while ($row = $modx->db->getRow($rs)) $old_groups[$row['document_group']] = $row['id'];
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
                         unset($old_groups[$group]);
606 606
                         continue;
607 607
                     } elseif ($link_id == 'new') {
608
-                        $insertions[] = '('.(int)$group.','.$id.')';
608
+                        $insertions[] = '('.(int) $group.','.$id.')';
609 609
                     }
610 610
                 }
611 611
                 if (!empty($insertions)) {
@@ -637,17 +637,17 @@  discard block
 block discarded – undo
637 637
 
638 638
 
639 639
             // invoke OnDocFormSave event
640
-            $modx->invokeEvent("OnDocFormSave", array (
640
+            $modx->invokeEvent("OnDocFormSave", array(
641 641
                 "mode" => "upd",
642 642
                 "id" => $id
643 643
             ));
644 644
 
645 645
             // secure web documents - flag as private
646
-            include MODX_MANAGER_PATH . "includes/secure_web_documents.inc.php";
646
+            include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php";
647 647
             secureWebDocument($id);
648 648
 
649 649
             // secure manager documents - flag as private
650
-            include MODX_MANAGER_PATH . "includes/secure_mgr_documents.inc.php";
650
+            include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php";
651 651
             secureMgrDocument($id);
652 652
 
653 653
             // Set the item name for logger
@@ -673,13 +673,13 @@  discard block
 block discarded – undo
673 673
                         // document
674 674
                         $a = ($_POST['stay'] == '2') ? "27&id=$id" : "4&pid=$parent";
675 675
                     }
676
-                    $header = "Location: index.php?a=" . $a . "&r=1&stay=" . $_POST['stay'].$add_path;
676
+                    $header = "Location: index.php?a=".$a."&r=1&stay=".$_POST['stay'].$add_path;
677 677
                 } else {
678 678
                     $header = "Location: index.php?a=3&id=$id&r=1".$add_path;
679 679
                 }
680 680
             }
681 681
             if (headers_sent()) {
682
-                $header = str_replace('Location: ','',$header);
682
+                $header = str_replace('Location: ', '', $header);
683 683
                 echo "<script>document.location.href='$header';</script>\n";
684 684
             } else {
685 685
                 header($header);
Please login to merge, or discard this patch.
Braces   +23 added lines, -19 removed lines patch added patch discarded remove patch
@@ -134,8 +134,7 @@  discard block
 block discarded – undo
134 134
         }
135 135
         //end webber
136 136
     }
137
-}
138
-elseif ($alias) {
137
+} elseif ($alias) {
139 138
     $alias = $modx->stripAlias($alias);
140 139
 }
141 140
 
@@ -149,8 +148,7 @@  discard block
 block discarded – undo
149 148
 
150 149
     if ($pub_date < $currentdate) {
151 150
         $published = 1;
152
-    }
153
-    elseif ($pub_date > $currentdate) {
151
+    } elseif ($pub_date > $currentdate) {
154 152
         $published = 0;
155 153
     }
156 154
 }
@@ -278,8 +276,7 @@  discard block
 block discarded – undo
278 276
         case 'new' :
279 277
 
280 278
             // invoke OnBeforeDocFormSave event
281
-            switch($modx->config['docid_incrmnt_method'])
282
-            {
279
+            switch($modx->config['docid_incrmnt_method']) {
283 280
             case '1':
284 281
                 $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id";
285 282
                 $where = "T1.id IS NULL";
@@ -347,8 +344,9 @@  discard block
 block discarded – undo
347 344
             "alias_visible"    => $aliasvisible
348 345
         );
349 346
 
350
-        if ($id != '')
351
-            $dbInsert["id"] = $id;
347
+        if ($id != '') {
348
+                    $dbInsert["id"] = $id;
349
+        }
352 350
 
353 351
         $key = $modx->db->insert($dbInsert, $tbl_site_content);
354 352
 
@@ -424,11 +422,13 @@  discard block
 block discarded – undo
424 422
         // redirect/stay options
425 423
         if ($_POST['stay'] != '') {
426 424
             // weblink
427
-            if ($_POST['mode'] == "72")
428
-                $a = ($_POST['stay'] == '2') ? "27&id=$key" : "72&pid=$parent";
425
+            if ($_POST['mode'] == "72") {
426
+                            $a = ($_POST['stay'] == '2') ? "27&id=$key" : "72&pid=$parent";
427
+            }
429 428
             // document
430
-            if ($_POST['mode'] == "4")
431
-                $a = ($_POST['stay'] == '2') ? "27&id=$key" : "4&pid=$parent";
429
+            if ($_POST['mode'] == "4") {
430
+                            $a = ($_POST['stay'] == '2') ? "27&id=$key" : "4&pid=$parent";
431
+            }
432 432
             $header = "Location: index.php?a=".$a."&r=1&stay=".$_POST['stay'];
433 433
         } else {
434 434
             $header = "Location: index.php?a=3&id=$key&r=1";
@@ -489,10 +489,10 @@  discard block
 block discarded – undo
489 489
             if (!$was_published && $published) {
490 490
                 $publishedon = $currentdate;
491 491
                 $publishedby = $modx->getLoginUserID();
492
-                }elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) {
492
+                } elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) {
493 493
                 $publishedon = $pub_date;
494 494
                 $publishedby = $modx->getLoginUserID();
495
-                   }elseif ($was_published && !$published) {
495
+                   } elseif ($was_published && !$published) {
496 496
                 $publishedon = 0;
497 497
                 $publishedby = 0;
498 498
             } else {
@@ -548,7 +548,9 @@  discard block
 block discarded – undo
548 548
             $tvChanges = array();
549 549
             foreach ($tmplvars as $field => $value) {
550 550
                 if (!is_array($value)) {
551
-                    if (isset($tvIds[$value])) $tvDeletions[] = $tvIds[$value];
551
+                    if (isset($tvIds[$value])) {
552
+                        $tvDeletions[] = $tvIds[$value];
553
+                    }
552 554
                 } else {
553 555
                     $tvId = $value[0];
554 556
                     $tvVal = $value[1];
@@ -596,7 +598,9 @@  discard block
 block discarded – undo
596 598
                     "((1=".(int)$isManager." AND dgn.private_memgroup) OR (1=".(int)$isWeb." AND dgn.private_webgroup)) AND groups.document = '{$id}'"
597 599
                     );
598 600
                 $old_groups = array();
599
-                while ($row = $modx->db->getRow($rs)) $old_groups[$row['document_group']] = $row['id'];
601
+                while ($row = $modx->db->getRow($rs)) {
602
+                    $old_groups[$row['document_group']] = $row['id'];
603
+                }
600 604
 
601 605
                 // update the permissions in the database
602 606
                 $insertions = $deletions = array();
@@ -658,9 +662,9 @@  discard block
 block discarded – undo
658 662
                 $modx->clearCache('full');
659 663
             }
660 664
 
661
-            if ($_POST['refresh_preview'] == '1')
662
-                $header = "Location: ".MODX_SITE_URL."index.php?id=$id&z=manprev";
663
-            else {
665
+            if ($_POST['refresh_preview'] == '1') {
666
+                            $header = "Location: ".MODX_SITE_URL."index.php?id=$id&z=manprev";
667
+            } else {
664 668
                 if ($_POST['stay'] != '2' && $id > 0) {
665 669
                     $modx->unlockElement(7, $id);
666 670
                 }
Please login to merge, or discard this patch.
manager/actions/help/version_notices/1.3.6.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 ?>
Please login to merge, or discard this patch.
manager/actions/help/version_notices/1.4.1.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 ?>
Please login to merge, or discard this patch.
manager/actions/help/version_notices/1.4.0.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 ?>
Please login to merge, or discard this patch.
install/cli-install.php 5 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@
 block discarded – undo
130 130
      * duplicate of method in documentParser class
131 131
      *
132 132
      * @param string $propertyString
133
-     * @return array
133
+     * @return string
134 134
      */
135 135
     function parseProperties($propertyString) {
136 136
         $parameter= array ();
Please login to merge, or discard this patch.
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
25 25
 
26 26
 if (is_file("../assets/cache/siteManager.php")) {
27
-	include_once("../assets/cache/siteManager.php");
27
+    include_once("../assets/cache/siteManager.php");
28 28
 }
29 29
 if(!defined('MGR_DIR') && is_dir("../manager")) {
30
-	define('MGR_DIR', 'manager');
30
+    define('MGR_DIR', 'manager');
31 31
 }
32 32
 
33 33
 require_once("lang.php");
@@ -310,9 +310,9 @@  discard block
 block discarded – undo
310 310
         echo $_lang['failed'] . ' ' . $_lang['table_prefix_not_exist'] . PHP_EOL;
311 311
         $errors++;
312 312
 
313
-  } else {
313
+    } else {
314 314
         echo $_lang['ok'] . PHP_EOL;
315
-  }
315
+    }
316 316
 }
317 317
 
318 318
 // check mysql version
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 
397 397
 
398 398
 if ($installMode == 1) {
399
-	include "../".MGR_DIR."/includes/config.inc.php";
399
+    include "../".MGR_DIR."/includes/config.inc.php";
400 400
 } else {
401 401
     // get db info from post
402 402
     $database_server = $databasehost;
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
     echo $_lang['setup_database_selection_failed']." ".$_lang['setup_database_selection_failed_note'].PHP_EOL;
450 450
     $create = true;
451 451
 } else {
452
-	if (function_exists('mysqli_set_charset')) mysqli_set_charset($conn, $database_charset);
452
+    if (function_exists('mysqli_set_charset')) mysqli_set_charset($conn, $database_charset);
453 453
     mysqli_query($conn, "{$database_connection_method} {$database_connection_charset}");
454 454
     echo $_lang['ok'].PHP_EOL;
455 455
 }
@@ -993,24 +993,24 @@  discard block
 block discarded – undo
993 993
 
994 994
 // Reset database for installation of demo-site
995 995
 if ($installData && $moduleSQLDataFile && $moduleSQLResetFile) {
996
-	echo $_lang['resetting_database'];
997
-	$sqlParser->process($moduleSQLResetFile);
998
-	// display database results
999
-	if ($sqlParser->installFailed == true) {
1000
-		$errors += 1;
1001
-		echo $_lang['database_alerts'] . PHP_EOL;
1002
-		echo $_lang['setup_couldnt_install'] . PHP_EOL;
1003
-		echo $_lang['installation_error_occured'] . PHP_EOL . PHP_EOL;
1004
-		/*
996
+    echo $_lang['resetting_database'];
997
+    $sqlParser->process($moduleSQLResetFile);
998
+    // display database results
999
+    if ($sqlParser->installFailed == true) {
1000
+        $errors += 1;
1001
+        echo $_lang['database_alerts'] . PHP_EOL;
1002
+        echo $_lang['setup_couldnt_install'] . PHP_EOL;
1003
+        echo $_lang['installation_error_occured'] . PHP_EOL . PHP_EOL;
1004
+        /*
1005 1005
         for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) {
1006 1006
 			echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />";
1007 1007
 		}
1008 1008
 		echo "</p>";*/
1009
-		echo $_lang['some_tables_not_updated'] . PHP_EOL;
1010
-		die();
1011
-	} else {
1012
-		echo $_lang['ok'] . PHP_EOL;
1013
-	}
1009
+        echo $_lang['some_tables_not_updated'] . PHP_EOL;
1010
+        die();
1011
+    } else {
1012
+        echo $_lang['ok'] . PHP_EOL;
1013
+    }
1014 1014
 }
1015 1015
 
1016 1016
 // Install Templates
@@ -1133,7 +1133,7 @@  discard block
 block discarded – undo
1133 1133
                         $tRow = mysqli_fetch_assoc($ts);
1134 1134
                         $templateId = $tRow['id'];
1135 1135
                         mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)");
1136
-                   }
1136
+                    }
1137 1137
                 }
1138 1138
             }
1139 1139
         }
@@ -1413,51 +1413,51 @@  discard block
 block discarded – undo
1413 1413
 // Install Dependencies
1414 1414
 $moduleDependencies = $mdp;
1415 1415
 foreach ($moduleDependencies as $dependency) {
1416
-	$ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_modules` WHERE name="' . $dependency['module'] . '"');
1417
-	if (!$ds) {
1418
-		echo mysqli_error($sqlParser->conn) . PHP_EOL;
1419
-		return;
1420
-	} else {
1421
-		$row = mysqli_fetch_assoc($ds);
1422
-		$moduleId = $row["id"];
1423
-		$moduleGuid = $row["guid"];
1424
-	}
1425
-	// get extra id
1426
-	$ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE ' . $dependency['column'] . '="' . $dependency['name'] . '"');
1427
-	if (!$ds) {
1428
-		echo mysqli_error($sqlParser->conn) . PHP_EOL;
1429
-		return;
1430
-	} else {
1431
-		$row = mysqli_fetch_assoc($ds);
1432
-		$extraId = $row["id"];
1433
-	}
1434
-	// setup extra as module dependency
1435
-	$ds = mysqli_query($sqlParser->conn, 'SELECT module FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type'] . ' LIMIT 1');
1436
-	if (!$ds) {
1437
-		echo mysqli_error($sqlParser->conn) . PHP_EOL;
1438
-		return;
1439
-	} else {
1440
-		if (mysqli_num_rows($ds) === 0) {
1441
-			mysqli_query($sqlParser->conn, 'INSERT INTO ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` (module, resource, type) VALUES(' . $moduleId . ',' . $extraId . ',' . $dependency['type'] . ')');
1442
-			echo $dependency['module'] . ' Module: ' . $_lang['depedency_create'] . PHP_EOL;
1443
-		} else {
1444
-			mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` SET module = ' . $moduleId . ', resource = ' . $extraId . ', type = ' . $dependency['type'] . ' WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type']);
1445
-			echo $dependency['module'] . ' Module: ' . $_lang['depedency_update'] . PHP_EOL;
1446
-		}
1447
-		if ($dependency['type'] == 30 || $dependency['type'] == 40) {
1448
-			// set extra guid for plugins and snippets
1449
-			$ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE id=' . $extraId . ' LIMIT 1');
1450
-			if (!$ds) {
1451
-				echo mysqli_error($sqlParser->conn) . PHP_EOL;
1452
-				return;
1453
-			} else {
1454
-				if (mysqli_num_rows($ds) != 0) {
1455
-					mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` SET moduleguid = ' . $moduleGuid . ' WHERE id=' . $extraId);
1456
-					echo $dependency['name'] . ': ' . $_lang['guid_set'] . PHP_EOL;
1457
-				}
1458
-			}
1459
-		}
1460
-	}
1416
+    $ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_modules` WHERE name="' . $dependency['module'] . '"');
1417
+    if (!$ds) {
1418
+        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1419
+        return;
1420
+    } else {
1421
+        $row = mysqli_fetch_assoc($ds);
1422
+        $moduleId = $row["id"];
1423
+        $moduleGuid = $row["guid"];
1424
+    }
1425
+    // get extra id
1426
+    $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE ' . $dependency['column'] . '="' . $dependency['name'] . '"');
1427
+    if (!$ds) {
1428
+        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1429
+        return;
1430
+    } else {
1431
+        $row = mysqli_fetch_assoc($ds);
1432
+        $extraId = $row["id"];
1433
+    }
1434
+    // setup extra as module dependency
1435
+    $ds = mysqli_query($sqlParser->conn, 'SELECT module FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type'] . ' LIMIT 1');
1436
+    if (!$ds) {
1437
+        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1438
+        return;
1439
+    } else {
1440
+        if (mysqli_num_rows($ds) === 0) {
1441
+            mysqli_query($sqlParser->conn, 'INSERT INTO ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` (module, resource, type) VALUES(' . $moduleId . ',' . $extraId . ',' . $dependency['type'] . ')');
1442
+            echo $dependency['module'] . ' Module: ' . $_lang['depedency_create'] . PHP_EOL;
1443
+        } else {
1444
+            mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` SET module = ' . $moduleId . ', resource = ' . $extraId . ', type = ' . $dependency['type'] . ' WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type']);
1445
+            echo $dependency['module'] . ' Module: ' . $_lang['depedency_update'] . PHP_EOL;
1446
+        }
1447
+        if ($dependency['type'] == 30 || $dependency['type'] == 40) {
1448
+            // set extra guid for plugins and snippets
1449
+            $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE id=' . $extraId . ' LIMIT 1');
1450
+            if (!$ds) {
1451
+                echo mysqli_error($sqlParser->conn) . PHP_EOL;
1452
+                return;
1453
+            } else {
1454
+                if (mysqli_num_rows($ds) != 0) {
1455
+                    mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` SET moduleguid = ' . $moduleGuid . ' WHERE id=' . $extraId);
1456
+                    echo $dependency['name'] . ': ' . $_lang['guid_set'] . PHP_EOL;
1457
+                }
1458
+            }
1459
+        }
1460
+    }
1461 1461
 }
1462 1462
 
1463 1463
 // call back function
@@ -1498,9 +1498,9 @@  discard block
 block discarded – undo
1498 1498
 echo PHP_EOL . $_lang['installation_successful'] . PHP_EOL . PHP_EOL;
1499 1499
 //echo "<p>" . $_lang['to_log_into_content_manager'] . "</p>";
1500 1500
 if ($installMode == 0) {
1501
-   echo strip_tags($_lang['installation_note']) . PHP_EOL;
1501
+    echo strip_tags($_lang['installation_note']) . PHP_EOL;
1502 1502
 } else {
1503
-   echo strip_tags($_lang['upgrade_note']) . PHP_EOL;
1503
+    echo strip_tags($_lang['upgrade_note']) . PHP_EOL;
1504 1504
 }
1505 1505
 
1506 1506
 echo PHP_EOL . 'Remove install folder?'.PHP_EOL;
Please login to merge, or discard this patch.
Spacing   +326 added lines, -327 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 }
14 14
 
15 15
 $self = 'install/index.php';
16
-$base_path = str_replace($self,'',str_replace('\\','/', __FILE__));
16
+$base_path = str_replace($self, '', str_replace('\\', '/', __FILE__));
17 17
 define('MODX_API_MODE', true);
18 18
 define('MODX_BASE_PATH', $base_path);
19 19
 define('MODX_SITE_URL', '/');
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 if (is_file("../assets/cache/siteManager.php")) {
27 27
 	include_once("../assets/cache/siteManager.php");
28 28
 }
29
-if(!defined('MGR_DIR') && is_dir("../manager")) {
29
+if (!defined('MGR_DIR') && is_dir("../manager")) {
30 30
 	define('MGR_DIR', 'manager');
31 31
 }
32 32
 
@@ -40,15 +40,15 @@  discard block
 block discarded – undo
40 40
 $moduleSQLDataFile = "setup.data.sql";
41 41
 $moduleSQLResetFile = "setup.data.reset.sql";
42 42
 
43
-$moduleChunks = array (); // chunks - array : name, description, type - 0:file or 1:content, file or content
44
-$moduleTemplates = array (); // templates - array : name, description, type - 0:file or 1:content, file or content
45
-$moduleSnippets = array (); // snippets - array : name, description, type - 0:file or 1:content, file or content,properties
46
-$modulePlugins = array (); // plugins - array : name, description, type - 0:file or 1:content, file or content,properties, events,guid
47
-$moduleModules = array (); // modules - array : name, description, type - 0:file or 1:content, file or content,properties, guid
48
-$moduleTemplates = array (); // templates - array : name, description, type - 0:file or 1:content, file or content,properties
49
-$moduleTVs = array (); // template variables - array : name, description, type - 0:file or 1:content, file or content,properties
43
+$moduleChunks = array(); // chunks - array : name, description, type - 0:file or 1:content, file or content
44
+$moduleTemplates = array(); // templates - array : name, description, type - 0:file or 1:content, file or content
45
+$moduleSnippets = array(); // snippets - array : name, description, type - 0:file or 1:content, file or content,properties
46
+$modulePlugins = array(); // plugins - array : name, description, type - 0:file or 1:content, file or content,properties, events,guid
47
+$moduleModules = array(); // modules - array : name, description, type - 0:file or 1:content, file or content,properties, guid
48
+$moduleTemplates = array(); // templates - array : name, description, type - 0:file or 1:content, file or content,properties
49
+$moduleTVs = array(); // template variables - array : name, description, type - 0:file or 1:content, file or content,properties
50 50
 $moduleDependencies = array(); // module depedencies - array : module, table, column, type, name
51
-$errors= 0;
51
+$errors = 0;
52 52
 
53 53
 
54 54
 
@@ -56,40 +56,40 @@  discard block
 block discarded – undo
56 56
 
57 57
 
58 58
 //set param manual
59
-$installMode= 0;
59
+$installMode = 0;
60 60
 $installData = 0;
61 61
 
62 62
 
63
-$databasehost = readline($_lang['connection_screen_database_host']. ' [localhost] ');
64
-if ($databasehost == '') { $databasehost= 'localhost'; } 
63
+$databasehost = readline($_lang['connection_screen_database_host'].' [localhost] ');
64
+if ($databasehost == '') { $databasehost = 'localhost'; } 
65 65
 
66
-$databaseloginname = readline($_lang['connection_screen_database_login']. ' ');
66
+$databaseloginname = readline($_lang['connection_screen_database_login'].' ');
67 67
 
68
-$databaseloginpassword = readline($_lang['connection_screen_database_pass']. ' ');
68
+$databaseloginpassword = readline($_lang['connection_screen_database_pass'].' ');
69 69
 
70
-$database_name = readline($_lang['connection_screen_database_name']. ' ');
70
+$database_name = readline($_lang['connection_screen_database_name'].' ');
71 71
 
72
-$tableprefix = readline($_lang['connection_screen_table_prefix']. ' ['.$tableprefixauto.'] ');
73
-if ($tableprefix == ''){ $tableprefix = $tableprefixauto; }
72
+$tableprefix = readline($_lang['connection_screen_table_prefix'].' ['.$tableprefixauto.'] ');
73
+if ($tableprefix == '') { $tableprefix = $tableprefixauto; }
74 74
 
75
-$database_connection_method = readline($_lang['connection_screen_connection_method']. ' [SET CHARACTER SET] ');
75
+$database_connection_method = readline($_lang['connection_screen_connection_method'].' [SET CHARACTER SET] ');
76 76
 if ($database_connection_method == '') { $database_connection_method = 'SET CHARACTER SET'; } 
77 77
 
78
-$database_collation = readline($_lang['connection_screen_collation']. ' [utf8_general_ci] ');
78
+$database_collation = readline($_lang['connection_screen_collation'].' [utf8_general_ci] ');
79 79
 if ($database_collation == '') { $database_collation = 'utf8_general_ci'; } 
80 80
 
81
-$cmsadmin = readline($_lang['connection_screen_default_admin_login']. ' [admin] ');
82
-if ($cmsadmin == ''){ $cmsadmin = 'admin'; }
81
+$cmsadmin = readline($_lang['connection_screen_default_admin_login'].' [admin] ');
82
+if ($cmsadmin == '') { $cmsadmin = 'admin'; }
83 83
 
84
-$cmsadminemail = readline($_lang['connection_screen_default_admin_email']. ' ');
84
+$cmsadminemail = readline($_lang['connection_screen_default_admin_email'].' ');
85 85
 
86
-$cmspassword = readline($_lang['connection_screen_default_admin_password']. ' ');
86
+$cmspassword = readline($_lang['connection_screen_default_admin_password'].' ');
87 87
 
88
-$managerlanguage = readline('Мanager language:' . ' [english] ');
88
+$managerlanguage = readline('Мanager language:'.' [english] ');
89 89
 if ($managerlanguage == '') { $managerlanguage = 'english'; } 
90 90
 
91
-$installData = readline('Instal demo-site (y/n):' . ' [n] ');
92
-if ($installData == 'y') { $installData = 1;}
91
+$installData = readline('Instal demo-site (y/n):'.' [n] ');
92
+if ($installData == 'y') { $installData = 1; }
93 93
 //cms login 
94 94
 //////
95 95
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 # load setup information file
100 100
 //include('setup.info.php');
101 101
 //////////////////////////////////////////////////////////////////////////////////////
102
-if( ! function_exists('f_owc')){
102
+if (!function_exists('f_owc')) {
103 103
     /**
104 104
      * @param $path
105 105
      * @param $data
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
             fwrite($hnd, $data);
113 113
             fclose($hnd);
114 114
 
115
-            if(null !== $mode) chmod($path, $mode);
116
-        }catch(Exception $e){
115
+            if (null !== $mode) chmod($path, $mode);
116
+        } catch (Exception $e) {
117 117
             // Nothing, this is NOT normal
118 118
             unset($e);
119 119
         }
@@ -123,24 +123,24 @@  discard block
 block discarded – undo
123 123
 // check PHP version
124 124
 define('PHP_MIN_VERSION', '5.4.0');
125 125
 $phpMinVersion = PHP_MIN_VERSION; // Maybe not necessary. For backward compatibility
126
-echo PHP_EOL . $_lang['checking_php_version'];
126
+echo PHP_EOL.$_lang['checking_php_version'];
127 127
 // -1 if left is less, 0 if equal, +1 if left is higher
128 128
 if (version_compare(phpversion(), PHP_MIN_VERSION) < 0) {
129 129
     $errors++;
130
-    $tmp = $_lang['you_running_php'] . phpversion() . str_replace('[+min_version+]', PHP_MIN_VERSION, $_lang["modx_requires_php"]);
131
-    echo $_lang['failed'] . ' ' . $tmp . PHP_EOL;
130
+    $tmp = $_lang['you_running_php'].phpversion().str_replace('[+min_version+]', PHP_MIN_VERSION, $_lang["modx_requires_php"]);
131
+    echo $_lang['failed'].' '.$tmp.PHP_EOL;
132 132
 } else {
133
-    echo $_lang['ok'] . PHP_EOL;
133
+    echo $_lang['ok'].PHP_EOL;
134 134
 }
135 135
 
136 136
 // check directories
137 137
 // cache exists?
138 138
 echo strip_tags($_lang['checking_if_cache_exist']);
139 139
 if (!file_exists("../assets/cache") || !file_exists("../assets/cache/rss")) {
140
-    echo $_lang['failed'] . PHP_EOL;
140
+    echo $_lang['failed'].PHP_EOL;
141 141
     $errors++;
142 142
 } else {
143
-    echo $_lang['ok'] . PHP_EOL;
143
+    echo $_lang['ok'].PHP_EOL;
144 144
 }
145 145
 
146 146
 
@@ -148,82 +148,82 @@  discard block
 block discarded – undo
148 148
 echo strip_tags($_lang['checking_if_cache_writable']);
149 149
 if (!is_writable("../assets/cache")) {
150 150
     $errors++;
151
-    echo $_lang['failed'] . PHP_EOL;
151
+    echo $_lang['failed'].PHP_EOL;
152 152
 } else {
153
-    echo $_lang['ok'] . PHP_EOL;
153
+    echo $_lang['ok'].PHP_EOL;
154 154
 }
155 155
 
156 156
 
157 157
 // cache files writable?
158 158
 echo strip_tags($_lang['checking_if_cache_file_writable']);
159 159
 $tmp = "../assets/cache/siteCache.idx.php";
160
-if ( ! file_exists($tmp)) {
160
+if (!file_exists($tmp)) {
161 161
     f_owc($tmp, "<?php //EVO site cache file ?>");
162 162
 }
163
-if ( ! is_writable($tmp)) {
163
+if (!is_writable($tmp)) {
164 164
     $errors++;
165
-    echo $_lang['failed'] . PHP_EOL;
165
+    echo $_lang['failed'].PHP_EOL;
166 166
 } else {
167
-    echo $_lang['ok'] . PHP_EOL;
167
+    echo $_lang['ok'].PHP_EOL;
168 168
 }
169 169
 
170 170
 
171 171
 echo strip_tags($_lang['checking_if_cache_file2_writable']);
172
-if ( ! is_writable("../assets/cache/sitePublishing.idx.php")) {
172
+if (!is_writable("../assets/cache/sitePublishing.idx.php")) {
173 173
     $errors++;
174
-    echo $_lang['failed'] . PHP_EOL;
174
+    echo $_lang['failed'].PHP_EOL;
175 175
 } else {
176
-    echo $_lang['ok'] . PHP_EOL;
176
+    echo $_lang['ok'].PHP_EOL;
177 177
 }
178 178
 
179 179
 
180 180
 // File Browser directories exists?
181 181
 echo strip_tags($_lang['checking_if_images_exist']);
182
-switch(true){
182
+switch (true) {
183 183
     case !file_exists("../assets/images"):
184 184
     case !file_exists("../assets/files"):
185 185
     case !file_exists("../assets/backup"):
186 186
     //case !file_exists("../assets/.thumbs"):
187 187
         $errors++;
188
-        echo $_lang['failed'] . PHP_EOL;
188
+        echo $_lang['failed'].PHP_EOL;
189 189
         break;
190 190
     default:
191
-        echo $_lang['ok'] . PHP_EOL;
191
+        echo $_lang['ok'].PHP_EOL;
192 192
 }
193 193
 
194 194
 
195 195
 // File Browser directories writable?
196 196
 echo strip_tags($_lang['checking_if_images_writable']);
197
-switch(true){
197
+switch (true) {
198 198
     case !is_writable("../assets/images"):
199 199
     case !is_writable("../assets/files"):
200 200
     case !is_writable("../assets/backup"):
201 201
     //case !is_writable("../assets/.thumbs"):
202 202
         $errors++;
203
-        echo $_lang['failed'] . PHP_EOL;
203
+        echo $_lang['failed'].PHP_EOL;
204 204
         break;
205 205
     default:
206
-        echo $_lang['ok'] . PHP_EOL;
206
+        echo $_lang['ok'].PHP_EOL;
207 207
 }
208 208
 
209 209
 
210 210
 // export exists?
211 211
 echo strip_tags($_lang['checking_if_export_exists']);
212 212
 if (!file_exists("../assets/export")) {
213
-    echo $_lang['failed'] . PHP_EOL;
213
+    echo $_lang['failed'].PHP_EOL;
214 214
     $errors++;
215 215
 } else {
216
-    echo $_lang['ok'] . PHP_EOL;
216
+    echo $_lang['ok'].PHP_EOL;
217 217
 }
218 218
 
219 219
 
220 220
 // export writable?
221 221
 echo strip_tags($_lang['checking_if_export_writable']);
222 222
 if (!is_writable("../assets/export")) {
223
-    echo $_lang['failed'] . PHP_EOL;
223
+    echo $_lang['failed'].PHP_EOL;
224 224
     $errors++;
225 225
 } else {
226
-    echo $_lang['ok'] . PHP_EOL;
226
+    echo $_lang['ok'].PHP_EOL;
227 227
 }
228 228
 
229 229
 
@@ -238,9 +238,9 @@  discard block
 block discarded – undo
238 238
 $isWriteable = is_writable($tmp);
239 239
 if (!$isWriteable) {
240 240
     $errors++;
241
-    echo $_lang['failed'] . PHP_EOL;
241
+    echo $_lang['failed'].PHP_EOL;
242 242
 } else {
243
-    echo $_lang['ok'] . PHP_EOL;
243
+    echo $_lang['ok'].PHP_EOL;
244 244
 }
245 245
 
246 246
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
     $database_charset = substr($database_collation, 0, strpos($database_collation, '_') - 1);
257 257
     $database_connection_charset = $database_collation;
258 258
     $database_connection_method = $database_connection_method;
259
-    $dbase = '`' . $database_name . '`';
259
+    $dbase = '`'.$database_name.'`';
260 260
     $table_prefix = $tableprefix;
261 261
 }
262 262
 echo $_lang['creating_database_connection'];
@@ -296,33 +296,33 @@  discard block
 block discarded – undo
296 296
 
297 297
 // check table prefix
298 298
 if ($conn && $installMode == 0) {
299
-    echo $_lang['checking_table_prefix'] . $table_prefix . '`: ';
300
-    if ($rs= mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) {
301
-        echo $_lang['failed'] . ' ' . $_lang['table_prefix_already_inuse_note'] . PHP_EOL;
299
+    echo $_lang['checking_table_prefix'].$table_prefix.'`: ';
300
+    if ($rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) {
301
+        echo $_lang['failed'].' '.$_lang['table_prefix_already_inuse_note'].PHP_EOL;
302 302
         $errors++;
303 303
 
304 304
     } else {
305
-        echo $_lang['ok'] . PHP_EOL;
305
+        echo $_lang['ok'].PHP_EOL;
306 306
     }
307 307
 } elseif ($conn && $installMode == 2) {
308
-    echo $_lang['checking_table_prefix'] . $table_prefix . '`: ';
309
-    if (!$rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) {
310
-        echo $_lang['failed'] . ' ' . $_lang['table_prefix_not_exist'] . PHP_EOL;
308
+    echo $_lang['checking_table_prefix'].$table_prefix.'`: ';
309
+    if (!$rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) {
310
+        echo $_lang['failed'].' '.$_lang['table_prefix_not_exist'].PHP_EOL;
311 311
         $errors++;
312 312
 
313 313
   } else {
314
-        echo $_lang['ok'] . PHP_EOL;
314
+        echo $_lang['ok'].PHP_EOL;
315 315
   }
316 316
 }
317 317
 
318 318
 // check mysql version
319 319
 if ($conn) {
320 320
     echo $_lang['checking_mysql_version'];
321
-    if ( version_compare(mysqli_get_server_info($conn), '5.0.51', '=') ) {
322
-        echo $_lang['warning'] . ' ' . $_lang['mysql_5051'] . PHP_EOL;
323
-        echo $_lang['mysql_5051_warning'] . PHP_EOL;
321
+    if (version_compare(mysqli_get_server_info($conn), '5.0.51', '=')) {
322
+        echo $_lang['warning'].' '.$_lang['mysql_5051'].PHP_EOL;
323
+        echo $_lang['mysql_5051_warning'].PHP_EOL;
324 324
     } else {
325
-        echo $_lang['ok'] . ' ' . $_lang['mysql_version_is'] . mysqli_get_server_info($conn) . PHP_EOL;
325
+        echo $_lang['ok'].' '.$_lang['mysql_version_is'].mysqli_get_server_info($conn).PHP_EOL;
326 326
     }
327 327
 }
328 328
 
@@ -330,20 +330,20 @@  discard block
 block discarded – undo
330 330
 if ($conn) {
331 331
     echo $_lang['checking_mysql_strict_mode'];
332 332
     $mysqlmode = mysqli_query($conn, "SELECT @@global.sql_mode");
333
-    if (mysqli_num_rows($mysqlmode) > 0){
333
+    if (mysqli_num_rows($mysqlmode) > 0) {
334 334
         $modes = mysqli_fetch_array($mysqlmode, MYSQLI_NUM);
335 335
         //$modes = array("STRICT_TRANS_TABLES"); // for testing
336 336
         // print_r($modes);
337 337
         foreach ($modes as $mode) {
338 338
             if (stristr($mode, "STRICT_TRANS_TABLES") !== false || stristr($mode, "STRICT_ALL_TABLES") !== false) {
339
-                echo $_lang['warning'] . ' ' . $_lang['strict_mode'] . PHP_EOL;
340
-                echo $_lang['strict_mode_error'] . PHP_EOL;
339
+                echo $_lang['warning'].' '.$_lang['strict_mode'].PHP_EOL;
340
+                echo $_lang['strict_mode_error'].PHP_EOL;
341 341
             } else {
342
-                echo $_lang['ok'] . PHP_EOL;
342
+                echo $_lang['ok'].PHP_EOL;
343 343
             }
344 344
         }
345 345
     } else {
346
-        echo $_lang['ok'] . PHP_EOL;
346
+        echo $_lang['ok'].PHP_EOL;
347 347
     }
348 348
 }
349 349
 // Version and strict mode check end
@@ -359,17 +359,17 @@  discard block
 block discarded – undo
359 359
     f_owc("../assets/cache/installProc.inc.php", '<?php $installStartTime = '.time().'; ?>');
360 360
 }
361 361
 
362
-if($installMode > 0 && $_POST['installdata'] == "1") {
363
-    echo $_lang['sample_web_site'] . ': ' . $_lang['sample_web_site_note'] . PHP_EOL;
362
+if ($installMode > 0 && $_POST['installdata'] == "1") {
363
+    echo $_lang['sample_web_site'].': '.$_lang['sample_web_site_note'].PHP_EOL;
364 364
 }
365 365
 
366 366
 if ($errors > 0) {
367
-    echo $_lang['setup_cannot_continue'] . ' ';
367
+    echo $_lang['setup_cannot_continue'].' ';
368 368
 
369
-    if($errors > 1){
370
-        echo $errors . " " . $_lang['errors'] . $_lang['please_correct_errors'] . $_lang['and_try_again_plural'];
371
-    }else{
372
-        echo $_lang['error'] . $_lang['please_correct_error'] . $_lang['and_try_again']. PHP_EOL;
369
+    if ($errors > 1) {
370
+        echo $errors." ".$_lang['errors'].$_lang['please_correct_errors'].$_lang['and_try_again_plural'];
371
+    } else {
372
+        echo $_lang['error'].$_lang['please_correct_error'].$_lang['and_try_again'].PHP_EOL;
373 373
     }
374 374
 
375 375
     die();
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 
382 382
 if (file_exists(dirname(__FILE__)."/../assets/cache/siteManager.php")) {
383 383
     include_once(dirname(__FILE__)."/../assets/cache/siteManager.php");
384
-}else{
384
+} else {
385 385
     define('MGR_DIR', 'manager');
386 386
 }
387 387
 
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
     $database_charset = substr($database_collation, 0, strpos($database_collation, '_'));
407 407
     $database_connection_charset = $database_charset;
408 408
     $database_connection_method = $database_connection_method;
409
-    $dbase = "`" .$database_name. "`";
409
+    $dbase = "`".$database_name."`";
410 410
     $table_prefix = $tableprefix;
411 411
     $adminname = $cmsadmin;
412 412
     $adminemail = $cmsadminemail;
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 
418 418
 // set session name variable
419 419
 if (!isset ($site_sessionname)) {
420
-    $site_sessionname = 'SN' . uniqid('');
420
+    $site_sessionname = 'SN'.uniqid('');
421 421
 }
422 422
 
423 423
 // get base path and url
@@ -431,8 +431,8 @@  discard block
 block discarded – undo
431 431
     array_pop($a);
432 432
 $pth = implode("install", $a);
433 433
 unset ($a);
434
-$base_url = $url . (substr($url, -1) != "/" ? "/" : "");
435
-$base_path = $pth . (substr($pth, -1) != "/" ? "/" : "");
434
+$base_url = $url.(substr($url, -1) != "/" ? "/" : "");
435
+$base_path = $pth.(substr($pth, -1) != "/" ? "/" : "");
436 436
 
437 437
 // connect to the database
438 438
 echo $_lang['setup_database_create_connection'].': ';
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 }
445 445
 
446 446
 // select database
447
-echo $_lang['setup_database_selection']. str_replace("`", "", $dbase) . "`: ";
447
+echo $_lang['setup_database_selection'].str_replace("`", "", $dbase)."`: ";
448 448
 if (!mysqli_select_db($conn, str_replace("`", "", $dbase))) {
449 449
     echo $_lang['setup_database_selection_failed']." ".$_lang['setup_database_selection_failed_note'].PHP_EOL;
450 450
     $create = true;
@@ -456,16 +456,16 @@  discard block
 block discarded – undo
456 456
 
457 457
 // try to create the database
458 458
 if ($create) {
459
-    echo $_lang['setup_database_creation']. str_replace("`", "", $dbase) . "`: ";
459
+    echo $_lang['setup_database_creation'].str_replace("`", "", $dbase)."`: ";
460 460
     //	if(!@mysqli_create_db(str_replace("`","",$dbase), $conn)) {
461
-    if (! mysqli_query($conn, "CREATE DATABASE $dbase DEFAULT CHARACTER SET $database_charset COLLATE $database_collation")) {
461
+    if (!mysqli_query($conn, "CREATE DATABASE $dbase DEFAULT CHARACTER SET $database_charset COLLATE $database_collation")) {
462 462
         echo $_lang['setup_database_creation_failed']." ".$_lang['setup_database_creation_failed_note'].PHP_EOL;
463 463
         $errors += 1;
464 464
         
465
-        echo 'database charset: ' . $database_charset . PHP_EOL;
466
-        echo 'database collation: ' . $database_collation . PHP_EOL;
465
+        echo 'database charset: '.$database_charset.PHP_EOL;
466
+        echo 'database collation: '.$database_collation.PHP_EOL;
467 467
 
468
-        echo $_lang['setup_database_creation_failed_note2'] . PHP_EOL;
468
+        echo $_lang['setup_database_creation_failed_note2'].PHP_EOL;
469 469
 
470 470
         die();
471 471
 
@@ -476,18 +476,18 @@  discard block
 block discarded – undo
476 476
 
477 477
 // check table prefix
478 478
 if ($installMode == 0) {
479
-    echo $_lang['checking_table_prefix'] . $table_prefix . "`: ";
480
-    if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) {
481
-        echo $_lang['failed'] . " " . $_lang['table_prefix_already_inuse'] . PHP_EOL;
479
+    echo $_lang['checking_table_prefix'].$table_prefix."`: ";
480
+    if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) {
481
+        echo $_lang['failed']." ".$_lang['table_prefix_already_inuse'].PHP_EOL;
482 482
         $errors += 1;
483
-        echo $_lang['table_prefix_already_inuse_note'] . PHP_EOL;
483
+        echo $_lang['table_prefix_already_inuse_note'].PHP_EOL;
484 484
         return;
485 485
     } else {
486 486
         echo $_lang['ok'].PHP_EOL;
487 487
     }
488 488
 }
489 489
 
490
-if(!function_exists('parseProperties')) {
490
+if (!function_exists('parseProperties')) {
491 491
     /**
492 492
      * parses a resource property string and returns the result as an array
493 493
      * duplicate of method in documentParser class
@@ -495,20 +495,20 @@  discard block
 block discarded – undo
495 495
      * @param string $propertyString
496 496
      * @return array
497 497
      */
498
-    function parseProperties($propertyString) {
499
-        $parameter= array ();
498
+    function parseProperties($propertyString){
499
+        $parameter = array();
500 500
         if (!empty ($propertyString)) {
501
-            $tmpParams= explode("&", $propertyString);
501
+            $tmpParams = explode("&", $propertyString);
502 502
             $countParams = count($tmpParams);
503
-            for ($x= 0; $x < $countParams; $x++) {
503
+            for ($x = 0; $x < $countParams; $x++) {
504 504
                 if (strpos($tmpParams[$x], '=', 0)) {
505
-                    $pTmp= explode("=", $tmpParams[$x]);
506
-                    $pvTmp= explode(";", trim($pTmp[1]));
505
+                    $pTmp = explode("=", $tmpParams[$x]);
506
+                    $pvTmp = explode(";", trim($pTmp[1]));
507 507
                     if ($pvTmp[1] == 'list' && $pvTmp[3] != "")
508
-                        $parameter[trim($pTmp[0])]= $pvTmp[3]; //list default
508
+                        $parameter[trim($pTmp[0])] = $pvTmp[3]; //list default
509 509
                     else
510 510
                         if ($pvTmp[1] != 'list' && $pvTmp[2] != "")
511
-                            $parameter[trim($pTmp[0])]= $pvTmp[2];
511
+                            $parameter[trim($pTmp[0])] = $pvTmp[2];
512 512
                 }
513 513
             }
514 514
         }
@@ -519,20 +519,20 @@  discard block
 block discarded – undo
519 519
 // check status of Inherit Parent Template plugin
520 520
 $auto_template_logic = 'parent';
521 521
 if ($installMode != 0) {
522
-    $rs = mysqli_query($conn, "SELECT properties, disabled FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='Inherit Parent Template'");
522
+    $rs = mysqli_query($conn, "SELECT properties, disabled FROM $dbase.`".$table_prefix."site_plugins` WHERE name='Inherit Parent Template'");
523 523
     $row = mysqli_fetch_row($rs);
524
-    if(!$row) {
524
+    if (!$row) {
525 525
         // not installed
526 526
         $auto_template_logic = 'system';
527 527
     } else {
528
-        if($row[1] == 1) {
528
+        if ($row[1] == 1) {
529 529
             // installed but disabled
530 530
             $auto_template_logic = 'system';
531 531
         } else {
532 532
             // installed, enabled .. see how it's configured
533 533
             $properties = parseProperties($row[0]);
534
-            if(isset($properties['inheritTemplate'])) {
535
-                if($properties['inheritTemplate'] == 'From First Sibling') {
534
+            if (isset($properties['inheritTemplate'])) {
535
+                if ($properties['inheritTemplate'] == 'From First Sibling') {
536 536
                     $auto_template_logic = 'sibling';
537 537
                 }
538 538
             }
@@ -554,17 +554,16 @@  discard block
 block discarded – undo
554 554
 
555 555
 // setup Template template files - array : name, description, type - 0:file or 1:content, parameters, category
556 556
 $mt = &$moduleTemplates;
557
-if(is_dir($templatePath) && is_readable($templatePath)) {
557
+if (is_dir($templatePath) && is_readable($templatePath)) {
558 558
     $d = dir($templatePath);
559 559
     while (false !== ($tplfile = $d->read()))
560 560
     {
561
-        if(substr($tplfile, -4) != '.tpl') continue;
561
+        if (substr($tplfile, -4) != '.tpl') continue;
562 562
         $params = parse_docblock($templatePath, $tplfile);
563
-        if(is_array($params) && (count($params)>0))
563
+        if (is_array($params) && (count($params) > 0))
564 564
         {
565 565
             $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
566
-            $mt[] = array
567
-            (
566
+            $mt[] = array(
568 567
                 $params['name'],
569 568
                 $description,
570 569
                 // Don't think this is gonna be used ... but adding it just in case 'type'
@@ -582,12 +581,12 @@  discard block
 block discarded – undo
582 581
 
583 582
 // setup Template Variable template files
584 583
 $mtv = &$moduleTVs;
585
-if(is_dir($tvPath) && is_readable($tvPath)) {
584
+if (is_dir($tvPath) && is_readable($tvPath)) {
586 585
     $d = dir($tvPath);
587 586
     while (false !== ($tplfile = $d->read())) {
588
-        if(substr($tplfile, -4) != '.tpl') continue;
587
+        if (substr($tplfile, -4) != '.tpl') continue;
589 588
         $params = parse_docblock($tvPath, $tplfile);
590
-        if(is_array($params) && (count($params)>0)) {
589
+        if (is_array($params) && (count($params) > 0)) {
591 590
             $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
592 591
             $mtv[] = array(
593 592
                 $params['name'],
@@ -599,9 +598,9 @@  discard block
 block discarded – undo
599 598
                 $params['output_widget'],
600 599
                 $params['output_widget_params'],
601 600
                 "$templatePath/{$params['filename']}", /* not currently used */
602
-                $params['template_assignments']!="*"?$params['template_assignments']:implode(",",array_map(create_function('$v','return $v[0];'),$mt)), /* comma-separated list of template names */
601
+                $params['template_assignments'] != "*" ? $params['template_assignments'] : implode(",", array_map(create_function('$v', 'return $v[0];'), $mt)), /* comma-separated list of template names */
603 602
                 $params['modx_category'],
604
-                $params['lock_tv'],  /* value should be 1 or 0 */
603
+                $params['lock_tv'], /* value should be 1 or 0 */
605 604
                 array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false
606 605
             );
607 606
         }
@@ -611,14 +610,14 @@  discard block
 block discarded – undo
611 610
 
612 611
 // setup chunks template files - array : name, description, type - 0:file or 1:content, file or content
613 612
 $mc = &$moduleChunks;
614
-if(is_dir($chunkPath) && is_readable($chunkPath)) {
613
+if (is_dir($chunkPath) && is_readable($chunkPath)) {
615 614
     $d = dir($chunkPath);
616 615
     while (false !== ($tplfile = $d->read())) {
617
-        if(substr($tplfile, -4) != '.tpl') {
616
+        if (substr($tplfile, -4) != '.tpl') {
618 617
             continue;
619 618
         }
620 619
         $params = parse_docblock($chunkPath, $tplfile);
621
-        if(is_array($params) && count($params) > 0) {
620
+        if (is_array($params) && count($params) > 0) {
622 621
             $mc[] = array(
623 622
                 $params['name'],
624 623
                 $params['description'],
@@ -634,14 +633,14 @@  discard block
 block discarded – undo
634 633
 
635 634
 // setup snippets template files - array : name, description, type - 0:file or 1:content, file or content,properties
636 635
 $ms = &$moduleSnippets;
637
-if(is_dir($snippetPath) && is_readable($snippetPath)) {
636
+if (is_dir($snippetPath) && is_readable($snippetPath)) {
638 637
     $d = dir($snippetPath);
639 638
     while (false !== ($tplfile = $d->read())) {
640
-        if(substr($tplfile, -4) != '.tpl') {
639
+        if (substr($tplfile, -4) != '.tpl') {
641 640
             continue;
642 641
         }
643 642
         $params = parse_docblock($snippetPath, $tplfile);
644
-        if(is_array($params) && count($params) > 0) {
643
+        if (is_array($params) && count($params) > 0) {
645 644
             $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
646 645
             $ms[] = array(
647 646
                 $params['name'],
@@ -658,14 +657,14 @@  discard block
 block discarded – undo
658 657
 
659 658
 // setup plugins template files - array : name, description, type - 0:file or 1:content, file or content,properties
660 659
 $mp = &$modulePlugins;
661
-if(is_dir($pluginPath) && is_readable($pluginPath)) {
660
+if (is_dir($pluginPath) && is_readable($pluginPath)) {
662 661
     $d = dir($pluginPath);
663 662
     while (false !== ($tplfile = $d->read())) {
664
-        if(substr($tplfile, -4) != '.tpl') {
663
+        if (substr($tplfile, -4) != '.tpl') {
665 664
             continue;
666 665
         }
667 666
         $params = parse_docblock($pluginPath, $tplfile);
668
-        if(is_array($params) && count($params) > 0) {
667
+        if (is_array($params) && count($params) > 0) {
669 668
             $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
670 669
             $mp[] = array(
671 670
                 $params['name'],
@@ -677,7 +676,7 @@  discard block
 block discarded – undo
677 676
                 $params['modx_category'],
678 677
                 $params['legacy_names'],
679 678
                 array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false,
680
-                (int)$params['disabled']
679
+                (int) $params['disabled']
681 680
             );
682 681
         }
683 682
     }
@@ -687,14 +686,14 @@  discard block
 block discarded – undo
687 686
 // setup modules - array : name, description, type - 0:file or 1:content, file or content,properties, guid,enable_sharedparams
688 687
 $mm = &$moduleModules;
689 688
 $mdp = &$moduleDependencies;
690
-if(is_dir($modulePath) && is_readable($modulePath)) {
689
+if (is_dir($modulePath) && is_readable($modulePath)) {
691 690
     $d = dir($modulePath);
692 691
     while (false !== ($tplfile = $d->read())) {
693
-        if(substr($tplfile, -4) != '.tpl') {
692
+        if (substr($tplfile, -4) != '.tpl') {
694 693
             continue;
695 694
         }
696 695
         $params = parse_docblock($modulePath, $tplfile);
697
-        if(is_array($params) && count($params) > 0) {
696
+        if (is_array($params) && count($params) > 0) {
698 697
             $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
699 698
             $mm[] = array(
700 699
                 $params['name'],
@@ -702,12 +701,12 @@  discard block
 block discarded – undo
702 701
                 "$modulePath/{$params['filename']}",
703 702
                 $params['properties'],
704 703
                 $params['guid'],
705
-                (int)$params['shareparams'],
704
+                (int) $params['shareparams'],
706 705
                 $params['modx_category'],
707 706
                 array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false
708 707
             );
709 708
         }
710
-        if ((int)$params['shareparams'] || !empty($params['dependencies'])) {
709
+        if ((int) $params['shareparams'] || !empty($params['dependencies'])) {
711 710
             $dependencies = explode(',', $params['dependencies']);
712 711
             foreach ($dependencies as $dependency) {
713 712
                 $dependency = explode(':', $dependency);
@@ -778,103 +777,103 @@  discard block
 block discarded – undo
778 777
 // setup callback function
779 778
 $callBackFnc = "clean_up";
780 779
 
781
-function clean_up($sqlParser) {
780
+function clean_up($sqlParser){
782 781
     $ids = array();
783 782
 
784 783
     // secure web documents - privateweb
785
-    mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 0 WHERE privateweb = 1");
786
-    $sql =  "SELECT DISTINCT sc.id
784
+    mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 0 WHERE privateweb = 1");
785
+    $sql = "SELECT DISTINCT sc.id
787 786
              FROM `".$sqlParser->prefix."site_content` sc
788 787
              LEFT JOIN `".$sqlParser->prefix."document_groups` dg ON dg.document = sc.id
789 788
              LEFT JOIN `".$sqlParser->prefix."webgroup_access` wga ON wga.documentgroup = dg.document_group
790 789
              WHERE wga.id>0";
791
-    $ds = mysqli_query($sqlParser->conn,$sql);
792
-    if(!$ds) {
790
+    $ds = mysqli_query($sqlParser->conn, $sql);
791
+    if (!$ds) {
793 792
         echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn);
794 793
     }
795 794
     else {
796
-        while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"];
797
-        if(count($ids)>0) {
798
-            mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ",$ids).")");
795
+        while ($r = mysqli_fetch_assoc($ds)) $ids[] = $r["id"];
796
+        if (count($ids) > 0) {
797
+            mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ", $ids).")");
799 798
             unset($ids);
800 799
         }
801 800
     }
802 801
 
803 802
     // secure manager documents privatemgr
804
-    mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 0 WHERE privatemgr = 1");
805
-    $sql =  "SELECT DISTINCT sc.id
803
+    mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 0 WHERE privatemgr = 1");
804
+    $sql = "SELECT DISTINCT sc.id
806 805
              FROM `".$sqlParser->prefix."site_content` sc
807 806
              LEFT JOIN `".$sqlParser->prefix."document_groups` dg ON dg.document = sc.id
808 807
              LEFT JOIN `".$sqlParser->prefix."membergroup_access` mga ON mga.documentgroup = dg.document_group
809 808
              WHERE mga.id>0";
810
-    $ds = mysqli_query($sqlParser->conn,$sql);
811
-    if(!$ds) {
809
+    $ds = mysqli_query($sqlParser->conn, $sql);
810
+    if (!$ds) {
812 811
         echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn);
813 812
     }
814 813
     else {
815
-        while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"];
816
-        if(count($ids)>0) {
817
-            mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ",$ids).")");
814
+        while ($r = mysqli_fetch_assoc($ds)) $ids[] = $r["id"];
815
+        if (count($ids) > 0) {
816
+            mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ", $ids).")");
818 817
             unset($ids);
819 818
         }
820 819
     }
821 820
 }
822 821
 
823
-function parse_docblock($element_dir, $filename) {
822
+function parse_docblock($element_dir, $filename){
824 823
     $params = array();
825
-    $fullpath = $element_dir . '/' . $filename;
826
-    if(is_readable($fullpath)) {
824
+    $fullpath = $element_dir.'/'.$filename;
825
+    if (is_readable($fullpath)) {
827 826
         $tpl = @fopen($fullpath, "r");
828
-        if($tpl) {
827
+        if ($tpl) {
829 828
             $params['filename'] = $filename;
830 829
             $docblock_start_found = false;
831 830
             $name_found = false;
832 831
             $description_found = false;
833 832
 
834
-            while(!feof($tpl)) {
833
+            while (!feof($tpl)) {
835 834
                 $line = fgets($tpl);
836
-                if(!$docblock_start_found) {
835
+                if (!$docblock_start_found) {
837 836
                     // find docblock start
838
-                    if(strpos($line, '/**') !== false) {
837
+                    if (strpos($line, '/**') !== false) {
839 838
                         $docblock_start_found = true;
840 839
                     }
841 840
                     continue;
842
-                } elseif(!$name_found) {
841
+                } elseif (!$name_found) {
843 842
                     // find name
844 843
                     $ma = null;
845
-                    if(preg_match("/^\s+\*\s+(.+)/", $line, $ma)) {
844
+                    if (preg_match("/^\s+\*\s+(.+)/", $line, $ma)) {
846 845
                         $params['name'] = trim($ma[1]);
847 846
                         $name_found = !empty($params['name']);
848 847
                     }
849 848
                     continue;
850
-                } elseif(!$description_found) {
849
+                } elseif (!$description_found) {
851 850
                     // find description
852 851
                     $ma = null;
853
-                    if(preg_match("/^\s+\*\s+(.+)/", $line, $ma)) {
852
+                    if (preg_match("/^\s+\*\s+(.+)/", $line, $ma)) {
854 853
                         $params['description'] = trim($ma[1]);
855 854
                         $description_found = !empty($params['description']);
856 855
                     }
857 856
                     continue;
858 857
                 } else {
859 858
                     $ma = null;
860
-                    if(preg_match("/^\s+\*\s+\@([^\s]+)\s+(.+)/", $line, $ma)) {
859
+                    if (preg_match("/^\s+\*\s+\@([^\s]+)\s+(.+)/", $line, $ma)) {
861 860
                         $param = trim($ma[1]);
862 861
                         $val = trim($ma[2]);
863
-                        if(!empty($param) && !empty($val)) {
864
-                            if($param == 'internal') {
862
+                        if (!empty($param) && !empty($val)) {
863
+                            if ($param == 'internal') {
865 864
                                 $ma = null;
866
-                                if(preg_match("/\@([^\s]+)\s+(.+)/", $val, $ma)) {
865
+                                if (preg_match("/\@([^\s]+)\s+(.+)/", $val, $ma)) {
867 866
                                     $param = trim($ma[1]);
868 867
                                     $val = trim($ma[2]);
869 868
                                 }
870 869
                                 //if($val !== '0' && (empty($param) || empty($val))) {
871
-                                if(empty($param)) {
870
+                                if (empty($param)) {
872 871
                                     continue;
873 872
                                 }
874 873
                             }
875 874
                             $params[$param] = $val;
876 875
                         }
877
-                    } elseif(preg_match("/^\s*\*\/\s*$/", $line)) {
876
+                    } elseif (preg_match("/^\s*\*\/\s*$/", $line)) {
878 877
                         break;
879 878
                     }
880 879
                 }
@@ -905,13 +904,13 @@  discard block
 block discarded – undo
905 904
     // display database results
906 905
     if ($sqlParser->installFailed == true) {
907 906
         $errors += 1;
908
-        echo $_lang['database_alerts'] . PHP_EOL;
909
-        echo $_lang['setup_couldnt_install'] . PHP_EOL;
910
-        echo $_lang['installation_error_occured'] . PHP_EOL;
907
+        echo $_lang['database_alerts'].PHP_EOL;
908
+        echo $_lang['setup_couldnt_install'].PHP_EOL;
909
+        echo $_lang['installation_error_occured'].PHP_EOL;
911 910
         for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) {
912
-            echo $sqlParser->mysqlErrors[$i]["error"] . " " . $_lang['during_execution_of_sql'] . " " . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . PHP_EOL;
911
+            echo $sqlParser->mysqlErrors[$i]["error"]." ".$_lang['during_execution_of_sql']." ".strip_tags($sqlParser->mysqlErrors[$i]["sql"]).PHP_EOL;
913 912
         }
914
-        echo $_lang['some_tables_not_updated'] . PHP_EOL;
913
+        echo $_lang['some_tables_not_updated'].PHP_EOL;
915 914
         die();
916 915
     } else {
917 916
         echo $_lang['ok'].PHP_EOL;
@@ -921,7 +920,7 @@  discard block
 block discarded – undo
921 920
 // custom or not
922 921
 if (file_exists(dirname(__FILE__)."/../../assets/cache/siteManager.php")) {
923 922
     $mgrdir = 'include_once(dirname(__FILE__)."/../../assets/cache/siteManager.php");';
924
-}else{
923
+} else {
925 924
     $mgrdir = 'define(\'MGR_DIR\', \'manager\');';
926 925
 }
927 926
 
@@ -958,16 +957,16 @@  discard block
 block discarded – undo
958 957
 $chmodSuccess = @chmod($filename, 0404);
959 958
 
960 959
 if ($configFileFailed == true) {
961
-    echo $_lang['failed'] . PHP_EOL;
960
+    echo $_lang['failed'].PHP_EOL;
962 961
     $errors += 1;
963 962
 
964
-    echo $_lang['cant_write_config_file'] . ' ' . MGR_DIR .'/includes/config.inc.php' .PHP_EOL;
963
+    echo $_lang['cant_write_config_file'].' '.MGR_DIR.'/includes/config.inc.php'.PHP_EOL;
965 964
     echo ' '.PHP_EOL;
966 965
     echo ' '.PHP_EOL;
967 966
     echo $configString;
968 967
     echo ' '.PHP_EOL;
969 968
     echo ' '.PHP_EOL;
970
-    echo $_lang['cant_write_config_file_note'] . PHP_EOL;
969
+    echo $_lang['cant_write_config_file_note'].PHP_EOL;
971 970
     die();
972 971
 
973 972
 } else {
@@ -977,16 +976,16 @@  discard block
 block discarded – undo
977 976
 // generate new site_id and set manager theme to default
978 977
 if ($installMode == 0) {
979 978
     $siteid = uniqid('');
980
-    mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')");
979
+    mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')");
981 980
 } else {
982 981
     // update site_id if missing
983
-    $ds = mysqli_query($sqlParser->conn, "SELECT setting_name,setting_value FROM $dbase.`" . $table_prefix . "system_settings` WHERE setting_name='site_id'");
982
+    $ds = mysqli_query($sqlParser->conn, "SELECT setting_name,setting_value FROM $dbase.`".$table_prefix."system_settings` WHERE setting_name='site_id'");
984 983
     if ($ds) {
985 984
         $r = mysqli_fetch_assoc($ds);
986 985
         $siteid = $r['setting_value'];
987 986
         if ($siteid == '' || $siteid = 'MzGeQ2faT4Dw06+U49x3') {
988 987
             $siteid = uniqid('');
989
-            mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')");
988
+            mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')");
990 989
         }
991 990
     }
992 991
 }
@@ -998,29 +997,29 @@  discard block
 block discarded – undo
998 997
 	// display database results
999 998
 	if ($sqlParser->installFailed == true) {
1000 999
 		$errors += 1;
1001
-		echo $_lang['database_alerts'] . PHP_EOL;
1002
-		echo $_lang['setup_couldnt_install'] . PHP_EOL;
1003
-		echo $_lang['installation_error_occured'] . PHP_EOL . PHP_EOL;
1000
+		echo $_lang['database_alerts'].PHP_EOL;
1001
+		echo $_lang['setup_couldnt_install'].PHP_EOL;
1002
+		echo $_lang['installation_error_occured'].PHP_EOL.PHP_EOL;
1004 1003
 		/*
1005 1004
         for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) {
1006 1005
 			echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />";
1007 1006
 		}
1008 1007
 		echo "</p>";*/
1009
-		echo $_lang['some_tables_not_updated'] . PHP_EOL;
1008
+		echo $_lang['some_tables_not_updated'].PHP_EOL;
1010 1009
 		die();
1011 1010
 	} else {
1012
-		echo $_lang['ok'] . PHP_EOL;
1011
+		echo $_lang['ok'].PHP_EOL;
1013 1012
 	}
1014 1013
 }
1015 1014
 
1016 1015
 // Install Templates
1017 1016
 $moduleTemplate = $mt; 
1018 1017
 if (!empty($moduleTemplate) || $installData) {
1019
-    echo PHP_EOL . $_lang['templates'] . ":" . PHP_EOL;
1018
+    echo PHP_EOL.$_lang['templates'].":".PHP_EOL;
1020 1019
     //$selTemplates = $_POST['template'];
1021 1020
     foreach ($moduleTemplates as $k=>$moduleTemplate) {
1022 1021
         $installSample = in_array('sample', $moduleTemplate[6]) && $installData == 1;
1023
-        if($installSample || is_array($moduleTemplate)) {
1022
+        if ($installSample || is_array($moduleTemplate)) {
1024 1023
             $name = mysqli_real_escape_string($conn, $moduleTemplate[0]);
1025 1024
             $desc = mysqli_real_escape_string($conn, $moduleTemplate[1]);
1026 1025
             $category = mysqli_real_escape_string($conn, $moduleTemplate[4]);
@@ -1028,7 +1027,7 @@  discard block
 block discarded – undo
1028 1027
             $filecontent = $moduleTemplate[3];
1029 1028
             $save_sql_id_as = $moduleTemplate[7]; // Nessecary for demo-site
1030 1029
             if (!file_exists($filecontent)) {
1031
-                echo "  $name: " . $_lang['unable_install_template'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1030
+                echo "  $name: ".$_lang['unable_install_template']." '$filecontent' ".$_lang['not_found'].PHP_EOL;
1032 1031
             } else {
1033 1032
                 // Create the category if it does not already exist
1034 1033
                 $category_id = getCreateDbCategory($category, $sqlParser);
@@ -1038,31 +1037,31 @@  discard block
 block discarded – undo
1038 1037
                 $template = mysqli_real_escape_string($conn, $template);
1039 1038
 
1040 1039
                 // See if the template already exists
1041
-                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name'");
1040
+                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name'");
1042 1041
 
1043 1042
                 if (mysqli_num_rows($rs)) {
1044
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;")) {
1043
+                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;")) {
1045 1044
                         $errors += 1;
1046
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1045
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1047 1046
                         return;
1048 1047
                     }
1049
-                    if(!is_null($save_sql_id_as)) {
1048
+                    if (!is_null($save_sql_id_as)) {
1050 1049
                         $sql_id = @mysqli_insert_id($sqlParser->conn);
1051
-                        if(!$sql_id) {
1052
-                            $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name' LIMIT 1;"));
1050
+                        if (!$sql_id) {
1051
+                            $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name' LIMIT 1;"));
1053 1052
                             $sql_id = $idQuery['id'];
1054 1053
                         }
1055 1054
                         $custom_placeholders[$save_sql_id_as] = $sql_id;
1056 1055
                     }
1057
-                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1056
+                    echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1058 1057
                 } else {
1059
-                    if (!@ mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) {
1058
+                    if (!@ mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) {
1060 1059
                         $errors += 1;
1061
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1060
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1062 1061
                         die();
1063 1062
                     }
1064
-                    if(!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn);
1065
-                    echo "  $name: " . $_lang['installed'] . PHP_EOL;
1063
+                    if (!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn);
1064
+                    echo "  $name: ".$_lang['installed'].PHP_EOL;
1066 1065
                 }
1067 1066
             }
1068 1067
         }
@@ -1072,11 +1071,11 @@  discard block
 block discarded – undo
1072 1071
 // Install Template Variables
1073 1072
 $moduleTVs = $mtv;
1074 1073
 if (is_array($moduleTVs) || $installData) {
1075
-    echo PHP_EOL . $_lang['tvs'].': '.PHP_EOL;
1074
+    echo PHP_EOL.$_lang['tvs'].': '.PHP_EOL;
1076 1075
     //$selTVs = $_POST['tv'];
1077 1076
     foreach ($moduleTVs as $k=>$moduleTV) {
1078 1077
         $installSample = in_array('sample', $moduleTV[12]) && $installData == 1;
1079
-        if($installSample || is_array($moduleTVs)) {
1078
+        if ($installSample || is_array($moduleTVs)) {
1080 1079
             $name = mysqli_real_escape_string($conn, $moduleTV[0]);
1081 1080
             $caption = mysqli_real_escape_string($conn, $moduleTV[1]);
1082 1081
             $desc = mysqli_real_escape_string($conn, $moduleTV[2]);
@@ -1094,24 +1093,24 @@  discard block
 block discarded – undo
1094 1093
             // Create the category if it does not already exist
1095 1094
             $category = getCreateDbCategory($category, $sqlParser);
1096 1095
 
1097
-            $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name'");
1096
+            $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name'");
1098 1097
             if (mysqli_num_rows($rs)) {
1099 1098
                 $insert = true;
1100
-                while($row = mysqli_fetch_assoc($rs)) {
1101
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};")) {
1102
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1099
+                while ($row = mysqli_fetch_assoc($rs)) {
1100
+                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};")) {
1101
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1103 1102
                         return;
1104 1103
                     }
1105 1104
                     $insert = false;
1106 1105
                 }
1107
-                echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1106
+                echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1108 1107
             } else {
1109
-                $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');";
1108
+                $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');";
1110 1109
                 if (!mysqli_query($sqlParser->conn, $q)) {
1111
-                    echo mysqli_error($sqlParser->conn) . PHP_EOL;
1110
+                    echo mysqli_error($sqlParser->conn).PHP_EOL;
1112 1111
                     return;
1113 1112
                 }
1114
-                echo "  $name: " . $_lang['installed'] . PHP_EOL;
1113
+                echo "  $name: ".$_lang['installed'].PHP_EOL;
1115 1114
             }
1116 1115
 
1117 1116
             // add template assignments
@@ -1120,10 +1119,10 @@  discard block
 block discarded – undo
1120 1119
             if (count($assignments) > 0) {
1121 1120
 
1122 1121
                 // remove existing tv -> template assignments
1123
-                $ds=mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';");
1122
+                $ds = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';");
1124 1123
                 $row = mysqli_fetch_assoc($ds);
1125 1124
                 $id = $row["id"];
1126
-                mysqli_query($sqlParser->conn, 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_tmplvar_templates` WHERE tmplvarid = \'' . $id . '\'');
1125
+                mysqli_query($sqlParser->conn, 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_tmplvar_templates` WHERE tmplvarid = \''.$id.'\'');
1127 1126
 
1128 1127
                 // add tv -> template assignments
1129 1128
                 foreach ($assignments as $assignment) {
@@ -1132,7 +1131,7 @@  discard block
 block discarded – undo
1132 1131
                     if ($ds && $ts) {
1133 1132
                         $tRow = mysqli_fetch_assoc($ts);
1134 1133
                         $templateId = $tRow['id'];
1135
-                        mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)");
1134
+                        mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)");
1136 1135
                    }
1137 1136
                 }
1138 1137
             }
@@ -1143,12 +1142,12 @@  discard block
 block discarded – undo
1143 1142
 
1144 1143
 $moduleChunks = $mc;
1145 1144
 // Install Chunks
1146
-if (is_array ($moduleChunks) || $installData) {
1147
-    echo PHP_EOL . $_lang['chunks'] . ": " . PHP_EOL;
1145
+if (is_array($moduleChunks) || $installData) {
1146
+    echo PHP_EOL.$_lang['chunks'].": ".PHP_EOL;
1148 1147
     foreach ($moduleChunks as $k=>$moduleChunk) {
1149 1148
         $installSample = in_array('sample', $moduleChunk[5]) && $installData == 1;
1150 1149
         $count_new_name = 0;
1151
-        if($installSample || is_array ($moduleChunks)) {
1150
+        if ($installSample || is_array($moduleChunks)) {
1152 1151
 
1153 1152
             $name = mysqli_real_escape_string($conn, $moduleChunk[0]);
1154 1153
             $desc = mysqli_real_escape_string($conn, $moduleChunk[1]);
@@ -1157,7 +1156,7 @@  discard block
 block discarded – undo
1157 1156
             $filecontent = $moduleChunk[2];
1158 1157
 
1159 1158
             if (!file_exists($filecontent))
1160
-                echo "  $name: " . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1159
+                echo "  $name: ".$_lang['unable_install_chunk']." '$filecontent' ".$_lang['not_found'].PHP_EOL;
1161 1160
             else {
1162 1161
 
1163 1162
                 // Create the category if it does not already exist
@@ -1165,31 +1164,31 @@  discard block
 block discarded – undo
1165 1164
 
1166 1165
                 $chunk = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', file_get_contents($filecontent), 1);
1167 1166
                 $chunk = mysqli_real_escape_string($conn, $chunk);
1168
-                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$name'");
1167
+                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$name'");
1169 1168
                 $count_original_name = mysqli_num_rows($rs);
1170
-                if($overwrite == 'false') {
1171
-                    $newname = $name . '-' . str_replace('.', '_', $modx_version);
1172
-                    $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$newname'");
1169
+                if ($overwrite == 'false') {
1170
+                    $newname = $name.'-'.str_replace('.', '_', $modx_version);
1171
+                    $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$newname'");
1173 1172
                     $count_new_name = mysqli_num_rows($rs);
1174 1173
                 }
1175 1174
                 $update = $count_original_name > 0 && $overwrite == 'true';
1176 1175
                 if ($update) {
1177
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
1176
+                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
1178 1177
                         $errors += 1;
1179
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1178
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1180 1179
                         return;
1181 1180
                     }
1182
-                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1183
-                } elseif($count_new_name == 0) {
1184
-                    if($count_original_name > 0 && $overwrite == 'false') {
1181
+                    echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1182
+                } elseif ($count_new_name == 0) {
1183
+                    if ($count_original_name > 0 && $overwrite == 'false') {
1185 1184
                         $name = $newname;
1186 1185
                     }
1187
-                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) {
1186
+                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) {
1188 1187
                         $errors += 1;
1189
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1188
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1190 1189
                         return;
1191 1190
                     }
1192
-                    echo "  $name: " . $_lang['installed'] . PHP_EOL;
1191
+                    echo "  $name: ".$_lang['installed'].PHP_EOL;
1193 1192
                 }
1194 1193
             }
1195 1194
         }
@@ -1199,11 +1198,11 @@  discard block
 block discarded – undo
1199 1198
 // Install Modules
1200 1199
 $moduleModules = $mm;
1201 1200
 if (is_array($moduleModules) || $installData) {
1202
-    echo PHP_EOL . $_lang['modules'] . ":" . PHP_EOL;
1201
+    echo PHP_EOL.$_lang['modules'].":".PHP_EOL;
1203 1202
     //$selModules = $_POST['module'];
1204 1203
     foreach ($moduleModules as $k=>$moduleModule) {
1205 1204
         $installSample = in_array('sample', $moduleModule[7]) && $installData == 1;
1206
-        if($installSample || is_array($moduleModules)) {
1205
+        if ($installSample || is_array($moduleModules)) {
1207 1206
             $name = mysqli_real_escape_string($conn, $moduleModule[0]);
1208 1207
             $desc = mysqli_real_escape_string($conn, $moduleModule[1]);
1209 1208
             $filecontent = $moduleModule[2];
@@ -1212,7 +1211,7 @@  discard block
 block discarded – undo
1212 1211
             $shared = mysqli_real_escape_string($conn, $moduleModule[5]);
1213 1212
             $category = mysqli_real_escape_string($conn, $moduleModule[6]);
1214 1213
             if (!file_exists($filecontent))
1215
-                echo "  $name: " . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1214
+                echo "  $name: ".$_lang['unable_install_module']." '$filecontent' ".$_lang['not_found'].PHP_EOL;
1216 1215
             else {
1217 1216
 
1218 1217
                 // Create the category if it does not already exist
@@ -1221,24 +1220,24 @@  discard block
 block discarded – undo
1221 1220
                 $module = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2));
1222 1221
                 // $module = removeDocblock($module, 'module'); // Modules have no fileBinding, keep docblock for info-tab
1223 1222
                 $module = mysqli_real_escape_string($conn, $module);
1224
-                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_modules` WHERE name='$name'");
1223
+                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_modules` WHERE name='$name'");
1225 1224
                 if (mysqli_num_rows($rs)) {
1226 1225
                     $row = mysqli_fetch_assoc($rs);
1227
-                    $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
1228
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
1229
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1226
+                    $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
1227
+                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
1228
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1230 1229
                         return;
1231 1230
                     }
1232
-                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1231
+                    echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1233 1232
                 } else {
1234
-                    if ($properties != NULL ){
1233
+                    if ($properties != NULL) {
1235 1234
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
1236 1235
                     }
1237
-                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) {
1238
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
1236
+                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) {
1237
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
1239 1238
                         return;
1240 1239
                     }
1241
-                    echo "  $name: " . $_lang['installed'] . PHP_EOL;
1240
+                    echo "  $name: ".$_lang['installed'].PHP_EOL;
1242 1241
                 }
1243 1242
             }
1244 1243
         }
@@ -1248,11 +1247,11 @@  discard block
 block discarded – undo
1248 1247
 // Install Plugins
1249 1248
 $modulePlugins = $mp;
1250 1249
 if (is_array($modulePlugins) || $installData) {
1251
-    echo PHP_EOL . $_lang['plugins'] . ":" . PHP_EOL;
1250
+    echo PHP_EOL.$_lang['plugins'].":".PHP_EOL;
1252 1251
     $selPlugs = $_POST['plugin'];
1253 1252
     foreach ($modulePlugins as $k=>$modulePlugin) {
1254 1253
         //$installSample = in_array('sample', $modulePlugin[8]) && $installData == 1;
1255
-        if($installSample || is_array($modulePlugins)) {
1254
+        if ($installSample || is_array($modulePlugins)) {
1256 1255
             $name = mysqli_real_escape_string($conn, $modulePlugin[0]);
1257 1256
             $desc = mysqli_real_escape_string($conn, $modulePlugin[1]);
1258 1257
             $filecontent = $modulePlugin[2];
@@ -1262,17 +1261,17 @@  discard block
 block discarded – undo
1262 1261
             $category = mysqli_real_escape_string($conn, $modulePlugin[6]);
1263 1262
             $leg_names = '';
1264 1263
             $disabled = $modulePlugin[9];
1265
-            if(array_key_exists(7, $modulePlugin)) {
1264
+            if (array_key_exists(7, $modulePlugin)) {
1266 1265
                 // parse comma-separated legacy names and prepare them for sql IN clause
1267
-                $leg_names = "'" . implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))) . "'";
1266
+                $leg_names = "'".implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7])))."'";
1268 1267
             }
1269 1268
             if (!file_exists($filecontent))
1270
-                echo "  $name: " . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1269
+                echo "  $name: ".$_lang['unable_install_plugin']." '$filecontent' ".$_lang['not_found'].PHP_EOL;
1271 1270
             else {
1272 1271
 
1273 1272
                 // disable legacy versions based on legacy_names provided
1274
-                if(!empty($leg_names)) {
1275
-                    $update_query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
1273
+                if (!empty($leg_names)) {
1274
+                    $update_query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
1276 1275
                     $rs = mysqli_query($sqlParser->conn, $update_query);
1277 1276
                 }
1278 1277
 
@@ -1282,52 +1281,52 @@  discard block
 block discarded – undo
1282 1281
                 $plugin = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2));
1283 1282
                 $plugin = removeDocblock($plugin, 'plugin');
1284 1283
                 $plugin = mysqli_real_escape_string($conn, $plugin);
1285
-                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='$name'");
1284
+                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name'");
1286 1285
                 if (mysqli_num_rows($rs)) {
1287 1286
                     $insert = true;
1288
-                    while($row = mysqli_fetch_assoc($rs)) {
1289
-                        $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
1290
-                        if($row['description'] == $desc){
1291
-                            if (! mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) {
1292
-                                echo mysqli_error($sqlParser->conn) . PHP_EOL;
1287
+                    while ($row = mysqli_fetch_assoc($rs)) {
1288
+                        $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
1289
+                        if ($row['description'] == $desc) {
1290
+                            if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) {
1291
+                                echo mysqli_error($sqlParser->conn).PHP_EOL;
1293 1292
                                 return;
1294 1293
                             }
1295 1294
                             $insert = false;
1296 1295
                         } else {
1297
-                            if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};")) {
1296
+                            if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE id={$row['id']};")) {
1298 1297
                                 echo mysqli_error($sqlParser->conn).PHP_EOL;
1299 1298
                                 return;
1300 1299
                             }
1301 1300
                         }
1302 1301
                     }
1303
-                    if($insert === true) {
1304
-                        $properties = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
1305
-                        if(!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);")) {
1302
+                    if ($insert === true) {
1303
+                        $properties = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
1304
+                        if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);")) {
1306 1305
                             echo mysqli_error($sqlParser->conn).PHP_EOL;
1307 1306
                             return;
1308 1307
                         }
1309 1308
                     }
1310
-                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1309
+                    echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1311 1310
                 } else {
1312
-                    if ($properties != NULL ){
1311
+                    if ($properties != NULL) {
1313 1312
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
1314 1313
                     }
1315
-                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) {
1316
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1314
+                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) {
1315
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1317 1316
                         return;
1318 1317
                     }
1319
-                    echo "  $name: " . $_lang['installed'] . PHP_EOL;
1318
+                    echo "  $name: ".$_lang['installed'].PHP_EOL;
1320 1319
                 }
1321 1320
                 // add system events
1322 1321
                 if (count($events) > 0) {
1323
-                    $ds=mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';");
1322
+                    $ds = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';");
1324 1323
                     if ($ds) {
1325 1324
                         $row = mysqli_fetch_assoc($ds);
1326 1325
                         $id = $row["id"];
1327 1326
                         // remove existing events
1328
-                        mysqli_query($sqlParser->conn, 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_plugin_events` WHERE pluginid = \'' . $id . '\'');
1327
+                        mysqli_query($sqlParser->conn, 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_plugin_events` WHERE pluginid = \''.$id.'\'');
1329 1328
                         // add new events
1330
-                        mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_plugin_events` (pluginid, evtid) SELECT '$id' as 'pluginid',se.id as 'evtid' FROM $dbase.`" . $table_prefix . "system_eventnames` se WHERE name IN ('" . implode("','", $events) . "')");
1329
+                        mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugin_events` (pluginid, evtid) SELECT '$id' as 'pluginid',se.id as 'evtid' FROM $dbase.`".$table_prefix."system_eventnames` se WHERE name IN ('".implode("','", $events)."')");
1331 1330
                     }
1332 1331
                 }
1333 1332
             }
@@ -1338,18 +1337,18 @@  discard block
 block discarded – undo
1338 1337
 // Install Snippets
1339 1338
 $moduleSnippet = $ms;
1340 1339
 if (is_array($moduleSnippet) || $installData) {
1341
-    echo PHP_EOL . $_lang['snippets'] . ":" . PHP_EOL;
1340
+    echo PHP_EOL.$_lang['snippets'].":".PHP_EOL;
1342 1341
     //$selSnips = $_POST['snippet'];
1343 1342
     foreach ($moduleSnippets as $k=>$moduleSnippet) {
1344 1343
         $installSample = in_array('sample', $moduleSnippet[5]) && $installData == 1;
1345
-        if($installSample || is_array($moduleSnippet)) {
1344
+        if ($installSample || is_array($moduleSnippet)) {
1346 1345
             $name = mysqli_real_escape_string($conn, $moduleSnippet[0]);
1347 1346
             $desc = mysqli_real_escape_string($conn, $moduleSnippet[1]);
1348 1347
             $filecontent = $moduleSnippet[2];
1349 1348
             $properties = $moduleSnippet[3];
1350 1349
             $category = mysqli_real_escape_string($conn, $moduleSnippet[4]);
1351 1350
             if (!file_exists($filecontent))
1352
-                echo "  $name: " . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1351
+                echo "  $name: ".$_lang['unable_install_snippet']." '$filecontent' ".$_lang['not_found'].PHP_EOL;
1353 1352
             else {
1354 1353
 
1355 1354
                 // Create the category if it does not already exist
@@ -1358,24 +1357,24 @@  discard block
 block discarded – undo
1358 1357
                 $snippet = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent)));
1359 1358
                 $snippet = removeDocblock($snippet, 'snippet');
1360 1359
                 $snippet = mysqli_real_escape_string($conn, $snippet);
1361
-                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_snippets` WHERE name='$name'");
1360
+                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_snippets` WHERE name='$name'");
1362 1361
                 if (mysqli_num_rows($rs)) {
1363 1362
                     $row = mysqli_fetch_assoc($rs);
1364
-                    $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
1365
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
1366
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1363
+                    $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
1364
+                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
1365
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1367 1366
                         return;
1368 1367
                     }
1369
-                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1368
+                    echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1370 1369
                 } else {
1371
-                    if ($properties != NULL ){
1370
+                    if ($properties != NULL) {
1372 1371
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
1373 1372
                     }
1374
-                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) {
1375
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1373
+                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) {
1374
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1376 1375
                         return;
1377 1376
                     }
1378
-                    echo "  $name: " . $_lang['installed'] . PHP_EOL;
1377
+                    echo "  $name: ".$_lang['installed'].PHP_EOL;
1379 1378
                 }
1380 1379
             }
1381 1380
         }
@@ -1384,24 +1383,24 @@  discard block
 block discarded – undo
1384 1383
 
1385 1384
 // Install demo-site
1386 1385
 if ($installData && $moduleSQLDataFile) {
1387
-    echo PHP_EOL . $_lang['installing_demo_site'];
1386
+    echo PHP_EOL.$_lang['installing_demo_site'];
1388 1387
     $sqlParser->process($moduleSQLDataFile);
1389 1388
     // display database results
1390 1389
     if ($sqlParser->installFailed == true) {
1391 1390
         $errors += 1;
1392
-        echo $_lang['database_alerts'] . PHP_EOL;
1393
-        echo $_lang['setup_couldnt_install'] . PHP_EOL;
1394
-        echo $_lang['installation_error_occured'] . PHP_EOL . PHP_EOL;
1391
+        echo $_lang['database_alerts'].PHP_EOL;
1392
+        echo $_lang['setup_couldnt_install'].PHP_EOL;
1393
+        echo $_lang['installation_error_occured'].PHP_EOL.PHP_EOL;
1395 1394
         for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) {
1396
-            echo $sqlParser->mysqlErrors[$i]["error"] . " " . $_lang['during_execution_of_sql'] . " " . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . PHP_EOL;
1395
+            echo $sqlParser->mysqlErrors[$i]["error"]." ".$_lang['during_execution_of_sql']." ".strip_tags($sqlParser->mysqlErrors[$i]["sql"]).PHP_EOL;
1397 1396
         }
1398 1397
 
1399
-        echo $_lang['some_tables_not_updated'] . PHP_EOL;
1398
+        echo $_lang['some_tables_not_updated'].PHP_EOL;
1400 1399
         return;
1401 1400
     } else {
1402 1401
         $sql = sprintf("SELECT id FROM `%ssite_templates` WHERE templatename='EVO startup - Bootstrap'", $sqlParser->prefix);
1403 1402
         $rs = mysqli_query($sqlParser->conn, $sql);
1404
-        if(mysqli_num_rows($rs)) {
1403
+        if (mysqli_num_rows($rs)) {
1405 1404
             $row = mysqli_fetch_assoc($rs);
1406 1405
             $sql = sprintf('UPDATE `%ssite_content` SET template=%s WHERE template=4', $sqlParser->prefix, $row['id']);
1407 1406
             mysqli_query($sqlParser->conn, $sql);
@@ -1413,9 +1412,9 @@  discard block
 block discarded – undo
1413 1412
 // Install Dependencies
1414 1413
 $moduleDependencies = $mdp;
1415 1414
 foreach ($moduleDependencies as $dependency) {
1416
-	$ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_modules` WHERE name="' . $dependency['module'] . '"');
1415
+	$ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM '.$dbase.'`'.$sqlParser->prefix.'site_modules` WHERE name="'.$dependency['module'].'"');
1417 1416
 	if (!$ds) {
1418
-		echo mysqli_error($sqlParser->conn) . PHP_EOL;
1417
+		echo mysqli_error($sqlParser->conn).PHP_EOL;
1419 1418
 		return;
1420 1419
 	} else {
1421 1420
 		$row = mysqli_fetch_assoc($ds);
@@ -1423,37 +1422,37 @@  discard block
 block discarded – undo
1423 1422
 		$moduleGuid = $row["guid"];
1424 1423
 	}
1425 1424
 	// get extra id
1426
-	$ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE ' . $dependency['column'] . '="' . $dependency['name'] . '"');
1425
+	$ds = mysqli_query($sqlParser->conn, 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE '.$dependency['column'].'="'.$dependency['name'].'"');
1427 1426
 	if (!$ds) {
1428
-		echo mysqli_error($sqlParser->conn) . PHP_EOL;
1427
+		echo mysqli_error($sqlParser->conn).PHP_EOL;
1429 1428
 		return;
1430 1429
 	} else {
1431 1430
 		$row = mysqli_fetch_assoc($ds);
1432 1431
 		$extraId = $row["id"];
1433 1432
 	}
1434 1433
 	// setup extra as module dependency
1435
-	$ds = mysqli_query($sqlParser->conn, 'SELECT module FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type'] . ' LIMIT 1');
1434
+	$ds = mysqli_query($sqlParser->conn, 'SELECT module FROM '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type'].' LIMIT 1');
1436 1435
 	if (!$ds) {
1437
-		echo mysqli_error($sqlParser->conn) . PHP_EOL;
1436
+		echo mysqli_error($sqlParser->conn).PHP_EOL;
1438 1437
 		return;
1439 1438
 	} else {
1440 1439
 		if (mysqli_num_rows($ds) === 0) {
1441
-			mysqli_query($sqlParser->conn, 'INSERT INTO ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` (module, resource, type) VALUES(' . $moduleId . ',' . $extraId . ',' . $dependency['type'] . ')');
1442
-			echo $dependency['module'] . ' Module: ' . $_lang['depedency_create'] . PHP_EOL;
1440
+			mysqli_query($sqlParser->conn, 'INSERT INTO '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` (module, resource, type) VALUES('.$moduleId.','.$extraId.','.$dependency['type'].')');
1441
+			echo $dependency['module'].' Module: '.$_lang['depedency_create'].PHP_EOL;
1443 1442
 		} else {
1444
-			mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` SET module = ' . $moduleId . ', resource = ' . $extraId . ', type = ' . $dependency['type'] . ' WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type']);
1445
-			echo $dependency['module'] . ' Module: ' . $_lang['depedency_update'] . PHP_EOL;
1443
+			mysqli_query($sqlParser->conn, 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` SET module = '.$moduleId.', resource = '.$extraId.', type = '.$dependency['type'].' WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type']);
1444
+			echo $dependency['module'].' Module: '.$_lang['depedency_update'].PHP_EOL;
1446 1445
 		}
1447 1446
 		if ($dependency['type'] == 30 || $dependency['type'] == 40) {
1448 1447
 			// set extra guid for plugins and snippets
1449
-			$ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE id=' . $extraId . ' LIMIT 1');
1448
+			$ds = mysqli_query($sqlParser->conn, 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE id='.$extraId.' LIMIT 1');
1450 1449
 			if (!$ds) {
1451
-				echo mysqli_error($sqlParser->conn) . PHP_EOL;
1450
+				echo mysqli_error($sqlParser->conn).PHP_EOL;
1452 1451
 				return;
1453 1452
 			} else {
1454 1453
 				if (mysqli_num_rows($ds) != 0) {
1455
-					mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` SET moduleguid = ' . $moduleGuid . ' WHERE id=' . $extraId);
1456
-					echo $dependency['name'] . ': ' . $_lang['guid_set'] . PHP_EOL;
1454
+					mysqli_query($sqlParser->conn, 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` SET moduleguid = '.$moduleGuid.' WHERE id='.$extraId);
1455
+					echo $dependency['name'].': '.$_lang['guid_set'].PHP_EOL;
1457 1456
 				}
1458 1457
 			}
1459 1458
 		}
@@ -1462,7 +1461,7 @@  discard block
 block discarded – undo
1462 1461
 
1463 1462
 // call back function
1464 1463
 if ($callBackFnc != "")
1465
-    $callBackFnc ($sqlParser);
1464
+    $callBackFnc($sqlParser);
1466 1465
 
1467 1466
 // Setup the MODX API -- needed for the cache processor
1468 1467
 if (!defined('MODX_MANAGER_PATH')) define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/');
@@ -1495,18 +1494,18 @@  discard block
 block discarded – undo
1495 1494
 }
1496 1495
 
1497 1496
 // setup completed!
1498
-echo PHP_EOL . $_lang['installation_successful'] . PHP_EOL . PHP_EOL;
1497
+echo PHP_EOL.$_lang['installation_successful'].PHP_EOL.PHP_EOL;
1499 1498
 //echo "<p>" . $_lang['to_log_into_content_manager'] . "</p>";
1500 1499
 if ($installMode == 0) {
1501
-   echo strip_tags($_lang['installation_note']) . PHP_EOL;
1500
+   echo strip_tags($_lang['installation_note']).PHP_EOL;
1502 1501
 } else {
1503
-   echo strip_tags($_lang['upgrade_note']) . PHP_EOL;
1502
+   echo strip_tags($_lang['upgrade_note']).PHP_EOL;
1504 1503
 }
1505 1504
 
1506
-echo PHP_EOL . 'Remove install folder?'.PHP_EOL;
1505
+echo PHP_EOL.'Remove install folder?'.PHP_EOL;
1507 1506
 $removeInstall = readline("Type 'y' or 'n' to continue: ");
1508 1507
 if ($removeInstall == 'y') {
1509
-    echo 'Install folder deleted!'. PHP_EOL . PHP_EOL;
1508
+    echo 'Install folder deleted!'.PHP_EOL.PHP_EOL;
1510 1509
 }
1511 1510
 
1512 1511
 /**
@@ -1516,11 +1515,11 @@  discard block
 block discarded – undo
1516 1515
  * @param string $old
1517 1516
  * @return string
1518 1517
  */
1519
-function propUpdate($new,$old){
1518
+function propUpdate($new, $old){
1520 1519
     $newArr = parseProperties($new);
1521 1520
     $oldArr = parseProperties($old);
1522
-    foreach ($oldArr as $k => $v){
1523
-        if (isset($v['0']['options'])){
1521
+    foreach ($oldArr as $k => $v) {
1522
+        if (isset($v['0']['options'])) {
1524 1523
             $oldArr[$k]['0']['options'] = $newArr[$k]['0']['options'];
1525 1524
         }
1526 1525
     }
@@ -1535,30 +1534,30 @@  discard block
 block discarded – undo
1535 1534
  * @param bool|mixed $json
1536 1535
  * @return string
1537 1536
  */
1538
-function parseProperties($propertyString, $json=false) {
1539
-    $propertyString = str_replace('{}', '', $propertyString );
1540
-    $propertyString = str_replace('} {', ',', $propertyString );
1537
+function parseProperties($propertyString, $json = false){
1538
+    $propertyString = str_replace('{}', '', $propertyString);
1539
+    $propertyString = str_replace('} {', ',', $propertyString);
1541 1540
 
1542
-    if(empty($propertyString)) return array();
1543
-    if($propertyString=='{}' || $propertyString=='[]') return array();
1541
+    if (empty($propertyString)) return array();
1542
+    if ($propertyString == '{}' || $propertyString == '[]') return array();
1544 1543
 
1545 1544
     $jsonFormat = isJson($propertyString, true);
1546 1545
     $property = array();
1547 1546
     // old format
1548
-    if ( $jsonFormat === false) {
1549
-        $props= explode('&', $propertyString);
1547
+    if ($jsonFormat === false) {
1548
+        $props = explode('&', $propertyString);
1550 1549
         foreach ($props as $prop) {
1551 1550
             $prop = trim($prop);
1552
-            if($prop === '') {
1551
+            if ($prop === '') {
1553 1552
                 continue;
1554 1553
             }
1555 1554
 
1556 1555
             $arr = explode(';', $prop);
1557
-            if( ! is_array($arr)) {
1556
+            if (!is_array($arr)) {
1558 1557
                 $arr = array();
1559 1558
             }
1560 1559
             $key = explode('=', isset($arr[0]) ? $arr[0] : '');
1561
-            if( ! is_array($key) || empty($key[0])) {
1560
+            if (!is_array($key) || empty($key[0])) {
1562 1561
                 continue;
1563 1562
             }
1564 1563
 
@@ -1582,7 +1581,7 @@  discard block
 block discarded – undo
1582 1581
 
1583 1582
         }
1584 1583
     // new json-format
1585
-    } else if(!empty($jsonFormat)){
1584
+    } else if (!empty($jsonFormat)) {
1586 1585
         $property = $jsonFormat;
1587 1586
     }
1588 1587
     if ($json) {
@@ -1597,7 +1596,7 @@  discard block
 block discarded – undo
1597 1596
  * @param bool $returnData
1598 1597
  * @return bool|mixed
1599 1598
  */
1600
-function isJson($string, $returnData=false) {
1599
+function isJson($string, $returnData = false){
1601 1600
     $data = json_decode($string, true);
1602 1601
     return (json_last_error() == JSON_ERROR_NONE) ? ($returnData ? $data : true) : false;
1603 1602
 }
@@ -1607,20 +1606,20 @@  discard block
 block discarded – undo
1607 1606
  * @param SqlParser $sqlParser
1608 1607
  * @return int
1609 1608
  */
1610
-function getCreateDbCategory($category, $sqlParser) {
1609
+function getCreateDbCategory($category, $sqlParser){
1611 1610
     $dbase = $sqlParser->dbname;
1612
-    $dbase = '`' . trim($dbase,'`') . '`';
1611
+    $dbase = '`'.trim($dbase, '`').'`';
1613 1612
     $table_prefix = $sqlParser->prefix;
1614 1613
     $category_id = 0;
1615
-    if(!empty($category)) {
1614
+    if (!empty($category)) {
1616 1615
         $category = mysqli_real_escape_string($sqlParser->conn, $category);
1617 1616
         $rs = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."categories` WHERE category = '".$category."'");
1618
-        if(mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) {
1617
+        if (mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) {
1619 1618
             $category_id = $row['id'];
1620 1619
         } else {
1621 1620
             $q = "INSERT INTO $dbase.`".$table_prefix."categories` (`category`) VALUES ('{$category}');";
1622 1621
             $rs = mysqli_query($sqlParser->conn, $q);
1623
-            if($rs) {
1622
+            if ($rs) {
1624 1623
                 $category_id = mysqli_insert_id($sqlParser->conn);
1625 1624
             }
1626 1625
         }
@@ -1635,12 +1634,12 @@  discard block
 block discarded – undo
1635 1634
  * @param string $type
1636 1635
  * @return string
1637 1636
  */
1638
-function removeDocblock($code, $type) {
1637
+function removeDocblock($code, $type){
1639 1638
 
1640 1639
     $cleaned = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', $code, 1);
1641 1640
 
1642 1641
     // Procedure taken from plugin.filesource.php
1643
-    switch($type) {
1642
+    switch ($type) {
1644 1643
         case 'snippet':
1645 1644
             $elm_name = 'snippets';
1646 1645
             $include = 'return require';
@@ -1656,7 +1655,7 @@  discard block
 block discarded – undo
1656 1655
         default:
1657 1656
             return $cleaned;
1658 1657
     };
1659
-    if(substr(trim($cleaned),0,$count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/')
1658
+    if (substr(trim($cleaned), 0, $count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/')
1660 1659
         return $cleaned;
1661 1660
 
1662 1661
     // fileBinding not found - return code incl docblock
Please login to merge, or discard this patch.
Braces   +99 added lines, -65 removed lines patch added patch discarded remove patch
@@ -4,7 +4,9 @@  discard block
 block discarded – undo
4 4
  */
5 5
 echo 'Install Evolution CMS?'.PHP_EOL;
6 6
 $installYes = readline("Type 'y' to continue: ");
7
-if ($installYes != 'y') return;
7
+if ($installYes != 'y') {
8
+    return;
9
+}
8 10
 
9 11
 
10 12
 $autoloader = realpath(__DIR__.'/../vendor/autoload.php');
@@ -99,21 +101,24 @@  discard block
 block discarded – undo
99 101
 # load setup information file
100 102
 //include('setup.info.php');
101 103
 //////////////////////////////////////////////////////////////////////////////////////
102
-if( ! function_exists('f_owc')){
104
+if( ! function_exists('f_owc')) {
103 105
     /**
104 106
      * @param $path
105 107
      * @param $data
106 108
      * @param null|int $mode
107 109
      */
108
-    function f_owc($path, $data, $mode = null){
110
+    function f_owc($path, $data, $mode = null)
111
+    {
109 112
         try {
110 113
             // make an attempt to create the file
111 114
             $hnd = fopen($path, 'w');
112 115
             fwrite($hnd, $data);
113 116
             fclose($hnd);
114 117
 
115
-            if(null !== $mode) chmod($path, $mode);
116
-        }catch(Exception $e){
118
+            if(null !== $mode) {
119
+                chmod($path, $mode);
120
+            }
121
+        } catch(Exception $e) {
117 122
             // Nothing, this is NOT normal
118 123
             unset($e);
119 124
         }
@@ -179,7 +184,7 @@  discard block
 block discarded – undo
179 184
 
180 185
 // File Browser directories exists?
181 186
 echo strip_tags($_lang['checking_if_images_exist']);
182
-switch(true){
187
+switch(true) {
183 188
     case !file_exists("../assets/images"):
184 189
     case !file_exists("../assets/files"):
185 190
     case !file_exists("../assets/backup"):
@@ -194,7 +199,7 @@  discard block
 block discarded – undo
194 199
 
195 200
 // File Browser directories writable?
196 201
 echo strip_tags($_lang['checking_if_images_writable']);
197
-switch(true){
202
+switch(true) {
198 203
     case !is_writable("../assets/images"):
199 204
     case !is_writable("../assets/files"):
200 205
     case !is_writable("../assets/backup"):
@@ -330,7 +335,7 @@  discard block
 block discarded – undo
330 335
 if ($conn) {
331 336
     echo $_lang['checking_mysql_strict_mode'];
332 337
     $mysqlmode = mysqli_query($conn, "SELECT @@global.sql_mode");
333
-    if (mysqli_num_rows($mysqlmode) > 0){
338
+    if (mysqli_num_rows($mysqlmode) > 0) {
334 339
         $modes = mysqli_fetch_array($mysqlmode, MYSQLI_NUM);
335 340
         //$modes = array("STRICT_TRANS_TABLES"); // for testing
336 341
         // print_r($modes);
@@ -366,9 +371,9 @@  discard block
 block discarded – undo
366 371
 if ($errors > 0) {
367 372
     echo $_lang['setup_cannot_continue'] . ' ';
368 373
 
369
-    if($errors > 1){
374
+    if($errors > 1) {
370 375
         echo $errors . " " . $_lang['errors'] . $_lang['please_correct_errors'] . $_lang['and_try_again_plural'];
371
-    }else{
376
+    } else {
372 377
         echo $_lang['error'] . $_lang['please_correct_error'] . $_lang['and_try_again']. PHP_EOL;
373 378
     }
374 379
 
@@ -381,7 +386,7 @@  discard block
 block discarded – undo
381 386
 
382 387
 if (file_exists(dirname(__FILE__)."/../assets/cache/siteManager.php")) {
383 388
     include_once(dirname(__FILE__)."/../assets/cache/siteManager.php");
384
-}else{
389
+} else {
385 390
     define('MGR_DIR', 'manager');
386 391
 }
387 392
 
@@ -422,13 +427,15 @@  discard block
 block discarded – undo
422 427
 
423 428
 // get base path and url
424 429
 $a = explode("install", str_replace("\\", "/", dirname($_SERVER["PHP_SELF"])));
425
-if (count($a) > 1)
430
+if (count($a) > 1) {
426 431
     array_pop($a);
432
+}
427 433
 $url = implode("install", $a);
428 434
 reset($a);
429 435
 $a = explode("install", str_replace("\\", "/", realpath(dirname(__FILE__))));
430
-if (count($a) > 1)
436
+if (count($a) > 1) {
431 437
     array_pop($a);
438
+}
432 439
 $pth = implode("install", $a);
433 440
 unset ($a);
434 441
 $base_url = $url . (substr($url, -1) != "/" ? "/" : "");
@@ -449,7 +456,9 @@  discard block
 block discarded – undo
449 456
     echo $_lang['setup_database_selection_failed']." ".$_lang['setup_database_selection_failed_note'].PHP_EOL;
450 457
     $create = true;
451 458
 } else {
452
-	if (function_exists('mysqli_set_charset')) mysqli_set_charset($conn, $database_charset);
459
+	if (function_exists('mysqli_set_charset')) {
460
+	    mysqli_set_charset($conn, $database_charset);
461
+	}
453 462
     mysqli_query($conn, "{$database_connection_method} {$database_connection_charset}");
454 463
     echo $_lang['ok'].PHP_EOL;
455 464
 }
@@ -495,7 +504,8 @@  discard block
 block discarded – undo
495 504
      * @param string $propertyString
496 505
      * @return array
497 506
      */
498
-    function parseProperties($propertyString) {
507
+    function parseProperties($propertyString)
508
+    {
499 509
         $parameter= array ();
500 510
         if (!empty ($propertyString)) {
501 511
             $tmpParams= explode("&", $propertyString);
@@ -504,11 +514,14 @@  discard block
 block discarded – undo
504 514
                 if (strpos($tmpParams[$x], '=', 0)) {
505 515
                     $pTmp= explode("=", $tmpParams[$x]);
506 516
                     $pvTmp= explode(";", trim($pTmp[1]));
507
-                    if ($pvTmp[1] == 'list' && $pvTmp[3] != "")
508
-                        $parameter[trim($pTmp[0])]= $pvTmp[3]; //list default
517
+                    if ($pvTmp[1] == 'list' && $pvTmp[3] != "") {
518
+                                            $parameter[trim($pTmp[0])]= $pvTmp[3];
519
+                    }
520
+                    //list default
509 521
                     else
510
-                        if ($pvTmp[1] != 'list' && $pvTmp[2] != "")
511
-                            $parameter[trim($pTmp[0])]= $pvTmp[2];
522
+                        if ($pvTmp[1] != 'list' && $pvTmp[2] != "") {
523
+                                                    $parameter[trim($pTmp[0])]= $pvTmp[2];
524
+                        }
512 525
                 }
513 526
             }
514 527
         }
@@ -556,12 +569,12 @@  discard block
 block discarded – undo
556 569
 $mt = &$moduleTemplates;
557 570
 if(is_dir($templatePath) && is_readable($templatePath)) {
558 571
     $d = dir($templatePath);
559
-    while (false !== ($tplfile = $d->read()))
560
-    {
561
-        if(substr($tplfile, -4) != '.tpl') continue;
572
+    while (false !== ($tplfile = $d->read())) {
573
+        if(substr($tplfile, -4) != '.tpl') {
574
+            continue;
575
+        }
562 576
         $params = parse_docblock($templatePath, $tplfile);
563
-        if(is_array($params) && (count($params)>0))
564
-        {
577
+        if(is_array($params) && (count($params)>0)) {
565 578
             $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
566 579
             $mt[] = array
567 580
             (
@@ -585,7 +598,9 @@  discard block
 block discarded – undo
585 598
 if(is_dir($tvPath) && is_readable($tvPath)) {
586 599
     $d = dir($tvPath);
587 600
     while (false !== ($tplfile = $d->read())) {
588
-        if(substr($tplfile, -4) != '.tpl') continue;
601
+        if(substr($tplfile, -4) != '.tpl') {
602
+            continue;
603
+        }
589 604
         $params = parse_docblock($tvPath, $tplfile);
590 605
         if(is_array($params) && (count($params)>0)) {
591 606
             $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
@@ -778,7 +793,8 @@  discard block
 block discarded – undo
778 793
 // setup callback function
779 794
 $callBackFnc = "clean_up";
780 795
 
781
-function clean_up($sqlParser) {
796
+function clean_up($sqlParser)
797
+{
782 798
     $ids = array();
783 799
 
784 800
     // secure web documents - privateweb
@@ -791,9 +807,10 @@  discard block
 block discarded – undo
791 807
     $ds = mysqli_query($sqlParser->conn,$sql);
792 808
     if(!$ds) {
793 809
         echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn);
794
-    }
795
-    else {
796
-        while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"];
810
+    } else {
811
+        while($r = mysqli_fetch_assoc($ds)) {
812
+            $ids[]=$r["id"];
813
+        }
797 814
         if(count($ids)>0) {
798 815
             mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ",$ids).")");
799 816
             unset($ids);
@@ -810,9 +827,10 @@  discard block
 block discarded – undo
810 827
     $ds = mysqli_query($sqlParser->conn,$sql);
811 828
     if(!$ds) {
812 829
         echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn);
813
-    }
814
-    else {
815
-        while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"];
830
+    } else {
831
+        while($r = mysqli_fetch_assoc($ds)) {
832
+            $ids[]=$r["id"];
833
+        }
816 834
         if(count($ids)>0) {
817 835
             mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ",$ids).")");
818 836
             unset($ids);
@@ -820,7 +838,8 @@  discard block
 block discarded – undo
820 838
     }
821 839
 }
822 840
 
823
-function parse_docblock($element_dir, $filename) {
841
+function parse_docblock($element_dir, $filename)
842
+{
824 843
     $params = array();
825 844
     $fullpath = $element_dir . '/' . $filename;
826 845
     if(is_readable($fullpath)) {
@@ -921,7 +940,7 @@  discard block
 block discarded – undo
921 940
 // custom or not
922 941
 if (file_exists(dirname(__FILE__)."/../../assets/cache/siteManager.php")) {
923 942
     $mgrdir = 'include_once(dirname(__FILE__)."/../../assets/cache/siteManager.php");';
924
-}else{
943
+} else {
925 944
     $mgrdir = 'define(\'MGR_DIR\', \'manager\');';
926 945
 }
927 946
 
@@ -1061,7 +1080,9 @@  discard block
 block discarded – undo
1061 1080
                         echo mysqli_error($sqlParser->conn) . PHP_EOL;
1062 1081
                         die();
1063 1082
                     }
1064
-                    if(!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn);
1083
+                    if(!is_null($save_sql_id_as)) {
1084
+                        $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn);
1085
+                    }
1065 1086
                     echo "  $name: " . $_lang['installed'] . PHP_EOL;
1066 1087
                 }
1067 1088
             }
@@ -1156,9 +1177,9 @@  discard block
 block discarded – undo
1156 1177
             $overwrite = mysqli_real_escape_string($conn, $moduleChunk[4]);
1157 1178
             $filecontent = $moduleChunk[2];
1158 1179
 
1159
-            if (!file_exists($filecontent))
1160
-                echo "  $name: " . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1161
-            else {
1180
+            if (!file_exists($filecontent)) {
1181
+                            echo "  $name: " . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1182
+            } else {
1162 1183
 
1163 1184
                 // Create the category if it does not already exist
1164 1185
                 $category_id = getCreateDbCategory($category, $sqlParser);
@@ -1211,9 +1232,9 @@  discard block
 block discarded – undo
1211 1232
             $guid = mysqli_real_escape_string($conn, $moduleModule[4]);
1212 1233
             $shared = mysqli_real_escape_string($conn, $moduleModule[5]);
1213 1234
             $category = mysqli_real_escape_string($conn, $moduleModule[6]);
1214
-            if (!file_exists($filecontent))
1215
-                echo "  $name: " . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1216
-            else {
1235
+            if (!file_exists($filecontent)) {
1236
+                            echo "  $name: " . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1237
+            } else {
1217 1238
 
1218 1239
                 // Create the category if it does not already exist
1219 1240
                 $category = getCreateDbCategory($category, $sqlParser);
@@ -1231,7 +1252,7 @@  discard block
 block discarded – undo
1231 1252
                     }
1232 1253
                     echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1233 1254
                 } else {
1234
-                    if ($properties != NULL ){
1255
+                    if ($properties != NULL ) {
1235 1256
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
1236 1257
                     }
1237 1258
                     if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) {
@@ -1266,9 +1287,9 @@  discard block
 block discarded – undo
1266 1287
                 // parse comma-separated legacy names and prepare them for sql IN clause
1267 1288
                 $leg_names = "'" . implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))) . "'";
1268 1289
             }
1269
-            if (!file_exists($filecontent))
1270
-                echo "  $name: " . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1271
-            else {
1290
+            if (!file_exists($filecontent)) {
1291
+                            echo "  $name: " . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1292
+            } else {
1272 1293
 
1273 1294
                 // disable legacy versions based on legacy_names provided
1274 1295
                 if(!empty($leg_names)) {
@@ -1287,7 +1308,7 @@  discard block
 block discarded – undo
1287 1308
                     $insert = true;
1288 1309
                     while($row = mysqli_fetch_assoc($rs)) {
1289 1310
                         $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
1290
-                        if($row['description'] == $desc){
1311
+                        if($row['description'] == $desc) {
1291 1312
                             if (! mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) {
1292 1313
                                 echo mysqli_error($sqlParser->conn) . PHP_EOL;
1293 1314
                                 return;
@@ -1309,7 +1330,7 @@  discard block
 block discarded – undo
1309 1330
                     }
1310 1331
                     echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1311 1332
                 } else {
1312
-                    if ($properties != NULL ){
1333
+                    if ($properties != NULL ) {
1313 1334
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
1314 1335
                     }
1315 1336
                     if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) {
@@ -1348,9 +1369,9 @@  discard block
 block discarded – undo
1348 1369
             $filecontent = $moduleSnippet[2];
1349 1370
             $properties = $moduleSnippet[3];
1350 1371
             $category = mysqli_real_escape_string($conn, $moduleSnippet[4]);
1351
-            if (!file_exists($filecontent))
1352
-                echo "  $name: " . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1353
-            else {
1372
+            if (!file_exists($filecontent)) {
1373
+                            echo "  $name: " . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1374
+            } else {
1354 1375
 
1355 1376
                 // Create the category if it does not already exist
1356 1377
                 $category = getCreateDbCategory($category, $sqlParser);
@@ -1368,7 +1389,7 @@  discard block
 block discarded – undo
1368 1389
                     }
1369 1390
                     echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1370 1391
                 } else {
1371
-                    if ($properties != NULL ){
1392
+                    if ($properties != NULL ) {
1372 1393
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
1373 1394
                     }
1374 1395
                     if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) {
@@ -1461,11 +1482,14 @@  discard block
 block discarded – undo
1461 1482
 }
1462 1483
 
1463 1484
 // call back function
1464
-if ($callBackFnc != "")
1485
+if ($callBackFnc != "") {
1465 1486
     $callBackFnc ($sqlParser);
1487
+}
1466 1488
 
1467 1489
 // Setup the MODX API -- needed for the cache processor
1468
-if (!defined('MODX_MANAGER_PATH')) define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/');
1490
+if (!defined('MODX_MANAGER_PATH')) {
1491
+    define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/');
1492
+}
1469 1493
 $database_type = 'mysqli';
1470 1494
 // initiate a new document parser
1471 1495
 include_once('../'.MGR_DIR.'/includes/document.parser.class.inc.php');
@@ -1516,11 +1540,12 @@  discard block
 block discarded – undo
1516 1540
  * @param string $old
1517 1541
  * @return string
1518 1542
  */
1519
-function propUpdate($new,$old){
1543
+function propUpdate($new,$old)
1544
+{
1520 1545
     $newArr = parseProperties($new);
1521 1546
     $oldArr = parseProperties($old);
1522
-    foreach ($oldArr as $k => $v){
1523
-        if (isset($v['0']['options'])){
1547
+    foreach ($oldArr as $k => $v) {
1548
+        if (isset($v['0']['options'])) {
1524 1549
             $oldArr[$k]['0']['options'] = $newArr[$k]['0']['options'];
1525 1550
         }
1526 1551
     }
@@ -1535,12 +1560,17 @@  discard block
 block discarded – undo
1535 1560
  * @param bool|mixed $json
1536 1561
  * @return string
1537 1562
  */
1538
-function parseProperties($propertyString, $json=false) {
1563
+function parseProperties($propertyString, $json=false)
1564
+{
1539 1565
     $propertyString = str_replace('{}', '', $propertyString );
1540 1566
     $propertyString = str_replace('} {', ',', $propertyString );
1541 1567
 
1542
-    if(empty($propertyString)) return array();
1543
-    if($propertyString=='{}' || $propertyString=='[]') return array();
1568
+    if(empty($propertyString)) {
1569
+        return array();
1570
+    }
1571
+    if($propertyString=='{}' || $propertyString=='[]') {
1572
+        return array();
1573
+    }
1544 1574
 
1545 1575
     $jsonFormat = isJson($propertyString, true);
1546 1576
     $property = array();
@@ -1582,7 +1612,7 @@  discard block
 block discarded – undo
1582 1612
 
1583 1613
         }
1584 1614
     // new json-format
1585
-    } else if(!empty($jsonFormat)){
1615
+    } else if(!empty($jsonFormat)) {
1586 1616
         $property = $jsonFormat;
1587 1617
     }
1588 1618
     if ($json) {
@@ -1597,7 +1627,8 @@  discard block
 block discarded – undo
1597 1627
  * @param bool $returnData
1598 1628
  * @return bool|mixed
1599 1629
  */
1600
-function isJson($string, $returnData=false) {
1630
+function isJson($string, $returnData=false)
1631
+{
1601 1632
     $data = json_decode($string, true);
1602 1633
     return (json_last_error() == JSON_ERROR_NONE) ? ($returnData ? $data : true) : false;
1603 1634
 }
@@ -1607,7 +1638,8 @@  discard block
 block discarded – undo
1607 1638
  * @param SqlParser $sqlParser
1608 1639
  * @return int
1609 1640
  */
1610
-function getCreateDbCategory($category, $sqlParser) {
1641
+function getCreateDbCategory($category, $sqlParser)
1642
+{
1611 1643
     $dbase = $sqlParser->dbname;
1612 1644
     $dbase = '`' . trim($dbase,'`') . '`';
1613 1645
     $table_prefix = $sqlParser->prefix;
@@ -1635,7 +1667,8 @@  discard block
 block discarded – undo
1635 1667
  * @param string $type
1636 1668
  * @return string
1637 1669
  */
1638
-function removeDocblock($code, $type) {
1670
+function removeDocblock($code, $type)
1671
+{
1639 1672
 
1640 1673
     $cleaned = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', $code, 1);
1641 1674
 
@@ -1656,8 +1689,9 @@  discard block
 block discarded – undo
1656 1689
         default:
1657 1690
             return $cleaned;
1658 1691
     };
1659
-    if(substr(trim($cleaned),0,$count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/')
1660
-        return $cleaned;
1692
+    if(substr(trim($cleaned),0,$count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') {
1693
+            return $cleaned;
1694
+    }
1661 1695
 
1662 1696
     // fileBinding not found - return code incl docblock
1663 1697
     return $code;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 
270 270
 
271 271
 // make sure we can use the database
272
-if ($installMode > 0 && !mysqli_query($conn, "USE {$dbase}")) {
272
+if ($installMode > 0 && !mysqli_query($conn, "use {$dbase}")) {
273 273
     $errors++;
274 274
     echo $_lang['database_use_failed'].PHP_EOL;
275 275
 }
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
                 $params['modx_category'],
574 574
                 $params['lock_template'],
575 575
                 array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false,
576
-                isset($params['save_sql_id_as']) ? $params['save_sql_id_as'] : NULL // Nessecary to fix template-ID for demo-site
576
+                isset($params['save_sql_id_as']) ? $params['save_sql_id_as'] : null // Nessecary to fix template-ID for demo-site
577 577
             );
578 578
         }
579 579
     }
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
 }
950 950
 
951 951
 // write $somecontent to our opened file.
952
-if (@ fwrite($handle, $configString) === FALSE) {
952
+if (@ fwrite($handle, $configString) === false) {
953 953
     $configFileFailed = true;
954 954
 }
955 955
 @ fclose($handle);
@@ -1041,7 +1041,7 @@  discard block
 block discarded – undo
1041 1041
                 $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name'");
1042 1042
 
1043 1043
                 if (mysqli_num_rows($rs)) {
1044
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;")) {
1044
+                    if (!mysqli_query($sqlParser->conn, "update $dbase.`" . $table_prefix . "site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;")) {
1045 1045
                         $errors += 1;
1046 1046
                         echo mysqli_error($sqlParser->conn) . PHP_EOL;
1047 1047
                         return;
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
             if (mysqli_num_rows($rs)) {
1099 1099
                 $insert = true;
1100 1100
                 while($row = mysqli_fetch_assoc($rs)) {
1101
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};")) {
1101
+                    if (!mysqli_query($sqlParser->conn, "update $dbase.`" . $table_prefix . "site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};")) {
1102 1102
                         echo mysqli_error($sqlParser->conn) . PHP_EOL;
1103 1103
                         return;
1104 1104
                     }
@@ -1174,7 +1174,7 @@  discard block
 block discarded – undo
1174 1174
                 }
1175 1175
                 $update = $count_original_name > 0 && $overwrite == 'true';
1176 1176
                 if ($update) {
1177
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
1177
+                    if (!mysqli_query($sqlParser->conn, "update $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
1178 1178
                         $errors += 1;
1179 1179
                         echo mysqli_error($sqlParser->conn) . PHP_EOL;
1180 1180
                         return;
@@ -1225,13 +1225,13 @@  discard block
 block discarded – undo
1225 1225
                 if (mysqli_num_rows($rs)) {
1226 1226
                     $row = mysqli_fetch_assoc($rs);
1227 1227
                     $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
1228
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
1228
+                    if (!mysqli_query($sqlParser->conn, "update $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
1229 1229
                         echo mysqli_error($sqlParser->conn) . PHP_EOL;
1230 1230
                         return;
1231 1231
                     }
1232 1232
                     echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1233 1233
                 } else {
1234
-                    if ($properties != NULL ){
1234
+                    if ($properties != null ){
1235 1235
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
1236 1236
                     }
1237 1237
                     if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) {
@@ -1272,7 +1272,7 @@  discard block
 block discarded – undo
1272 1272
 
1273 1273
                 // disable legacy versions based on legacy_names provided
1274 1274
                 if(!empty($leg_names)) {
1275
-                    $update_query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
1275
+                    $update_query = "update $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
1276 1276
                     $rs = mysqli_query($sqlParser->conn, $update_query);
1277 1277
                 }
1278 1278
 
@@ -1288,13 +1288,13 @@  discard block
 block discarded – undo
1288 1288
                     while($row = mysqli_fetch_assoc($rs)) {
1289 1289
                         $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
1290 1290
                         if($row['description'] == $desc){
1291
-                            if (! mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) {
1291
+                            if (! mysqli_query($sqlParser->conn, "update $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) {
1292 1292
                                 echo mysqli_error($sqlParser->conn) . PHP_EOL;
1293 1293
                                 return;
1294 1294
                             }
1295 1295
                             $insert = false;
1296 1296
                         } else {
1297
-                            if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};")) {
1297
+                            if (!mysqli_query($sqlParser->conn, "update $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};")) {
1298 1298
                                 echo mysqli_error($sqlParser->conn).PHP_EOL;
1299 1299
                                 return;
1300 1300
                             }
@@ -1309,7 +1309,7 @@  discard block
 block discarded – undo
1309 1309
                     }
1310 1310
                     echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1311 1311
                 } else {
1312
-                    if ($properties != NULL ){
1312
+                    if ($properties != null ){
1313 1313
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
1314 1314
                     }
1315 1315
                     if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) {
@@ -1362,13 +1362,13 @@  discard block
 block discarded – undo
1362 1362
                 if (mysqli_num_rows($rs)) {
1363 1363
                     $row = mysqli_fetch_assoc($rs);
1364 1364
                     $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
1365
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
1365
+                    if (!mysqli_query($sqlParser->conn, "update $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
1366 1366
                         echo mysqli_error($sqlParser->conn) . PHP_EOL;
1367 1367
                         return;
1368 1368
                     }
1369 1369
                     echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1370 1370
                 } else {
1371
-                    if ($properties != NULL ){
1371
+                    if ($properties != null ){
1372 1372
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
1373 1373
                     }
1374 1374
                     if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) {
Please login to merge, or discard this patch.