@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | $autoloader = __DIR__.'/vendor/autoload.php'; |
| 49 | 49 | if (file_exists($autoloader) && is_readable($autoloader)) { |
| 50 | - include_once($autoloader); |
|
| 50 | + include_once($autoloader); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | if(!isset($_SERVER['REQUEST_TIME_FLOAT'])) $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true); |
@@ -56,11 +56,11 @@ discard block |
||
| 56 | 56 | if(is_file($base_path . 'assets/cache/siteManager.php')) |
| 57 | 57 | include_once($base_path . 'assets/cache/siteManager.php'); |
| 58 | 58 | if(!defined('MGR_DIR') && is_dir("{$base_path}manager")) |
| 59 | - define('MGR_DIR', 'manager'); |
|
| 59 | + define('MGR_DIR', 'manager'); |
|
| 60 | 60 | if(is_file($base_path . 'assets/cache/siteHostnames.php')) |
| 61 | 61 | include_once($base_path . 'assets/cache/siteHostnames.php'); |
| 62 | 62 | if(!defined('MODX_SITE_HOSTNAMES')) |
| 63 | - define('MODX_SITE_HOSTNAMES', ''); |
|
| 63 | + define('MODX_SITE_HOSTNAMES', ''); |
|
| 64 | 64 | |
| 65 | 65 | // get start time |
| 66 | 66 | $mstart = memory_get_usage(); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | define('IN_PARSER_MODE', true); |
| 86 | 86 | if ( ! defined('IN_MANAGER_MODE')) { |
| 87 | - define('IN_MANAGER_MODE', false); |
|
| 87 | + define('IN_MANAGER_MODE', false); |
|
| 88 | 88 | } |
| 89 | 89 | if (!defined('MODX_API_MODE')) { |
| 90 | 90 | define('MODX_API_MODE', false); |
@@ -108,11 +108,11 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | // initiate a new document parser |
| 110 | 110 | if (isset($coreClass) && class_exists($coreClass)) { |
| 111 | - $modx = new $coreClass; |
|
| 111 | + $modx = new $coreClass; |
|
| 112 | 112 | } |
| 113 | 113 | if (!isset($modx) || !($modx instanceof \DocumentParser)) { |
| 114 | - include_once(MODX_MANAGER_PATH.'includes/document.parser.class.inc.php'); |
|
| 115 | - $modx = DocumentParser::getInstance(); |
|
| 114 | + include_once(MODX_MANAGER_PATH.'includes/document.parser.class.inc.php'); |
|
| 115 | + $modx = DocumentParser::getInstance(); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | // set some parser options |
@@ -1,16 +1,18 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | $installMode = isset($_POST['installmode']) ? (int)$_POST['installmode'] : 0; |
| 3 | 3 | |
| 4 | -switch($installMode){ |
|
| 4 | +switch($installMode) { |
|
| 5 | 5 | case 0: |
| 6 | 6 | case 2: |
| 7 | 7 | $database_collation = isset($_POST['database_collation']) ? $_POST['database_collation'] : 'utf8_general_ci'; |
| 8 | 8 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
| 9 | 9 | $_POST['database_connection_charset'] = $database_charset; |
| 10 | - if(empty($_SESSION['databaseloginpassword'])) |
|
| 11 | - $_SESSION['databaseloginpassword'] = $_POST['databaseloginpassword']; |
|
| 12 | - if(empty($_SESSION['databaseloginname'])) |
|
| 13 | - $_SESSION['databaseloginname'] = $_POST['databaseloginname']; |
|
| 10 | + if(empty($_SESSION['databaseloginpassword'])) { |
|
| 11 | + $_SESSION['databaseloginpassword'] = $_POST['databaseloginpassword']; |
|
| 12 | + } |
|
| 13 | + if(empty($_SESSION['databaseloginname'])) { |
|
| 14 | + $_SESSION['databaseloginname'] = $_POST['databaseloginname']; |
|
| 15 | + } |
|
| 14 | 16 | break; |
| 15 | 17 | case 1: |
| 16 | 18 | include $base_path . MGR_DIR . '/includes/config.inc.php'; |
@@ -24,7 +26,9 @@ discard block |
||
| 24 | 26 | } |
| 25 | 27 | } |
| 26 | 28 | } |
| 27 | - if (empty ($database_collation)) $database_collation = 'utf8_general_ci'; |
|
| 29 | + if (empty ($database_collation)) { |
|
| 30 | + $database_collation = 'utf8_general_ci'; |
|
| 31 | + } |
|
| 28 | 32 | |
| 29 | 33 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
| 30 | 34 | if (!isset ($database_connection_charset) || empty ($database_connection_charset)) { |
@@ -33,7 +37,9 @@ discard block |
||
| 33 | 37 | |
| 34 | 38 | if (!isset ($database_connection_method) || empty ($database_connection_method)) { |
| 35 | 39 | $database_connection_method = 'SET CHARACTER SET'; |
| 36 | - if (function_exists('mysqli_set_charset')) mysqli_set_charset($conn, $database_connection_charset); |
|
| 40 | + if (function_exists('mysqli_set_charset')) { |
|
| 41 | + mysqli_set_charset($conn, $database_connection_charset); |
|
| 42 | + } |
|
| 37 | 43 | } |
| 38 | 44 | if ($database_connection_method != 'SET NAMES' && $database_connection_charset != $database_charset) { |
| 39 | 45 | $database_connection_method = 'SET NAMES'; |
@@ -770,7 +770,7 @@ |
||
| 770 | 770 | <form name="install" id="install_form" action="index.php?action=options" method="post"> |
| 771 | 771 | <?php |
| 772 | 772 | if ($errors == 0) { |
| 773 | - // check if install folder is removeable |
|
| 773 | + // check if install folder is removeable |
|
| 774 | 774 | if (is_writable("../install")) { ?> |
| 775 | 775 | <span id="removeinstall" style="float:left;cursor:pointer;color:#505050;line-height:18px;" onclick="var chk=document.install.rminstaller; if(chk) chk.checked=!chk.checked;"><input type="checkbox" name="rminstaller" onclick="event.cancelBubble=true;" <?php echo (empty ($errors) ? 'checked="checked"' : '') ?> style="cursor:default;" /><?php echo $_lang['remove_install_folder_auto'] ?></span> |
| 776 | 776 | <?php |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | <?php |
| 13 | 13 | if (file_exists(__DIR__."/../assets/cache/siteManager.php")) { |
| 14 | 14 | include_once(__DIR__."/../assets/cache/siteManager.php"); |
| 15 | -}else{ |
|
| 15 | +} else { |
|
| 16 | 16 | define('MGR_DIR', 'manager'); |
| 17 | 17 | } |
| 18 | 18 | define('MODX_CLI', false); |
@@ -70,13 +70,15 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | // get base path and url |
| 72 | 72 | $a = explode("install", str_replace("\\", "/", dirname($_SERVER["PHP_SELF"]))); |
| 73 | -if (count($a) > 1) |
|
| 73 | +if (count($a) > 1) { |
|
| 74 | 74 | array_pop($a); |
| 75 | +} |
|
| 75 | 76 | $url = implode("install", $a); |
| 76 | 77 | reset($a); |
| 77 | 78 | $a = explode("install", str_replace("\\", "/", realpath(__DIR__))); |
| 78 | -if (count($a) > 1) |
|
| 79 | +if (count($a) > 1) { |
|
| 79 | 80 | array_pop($a); |
| 81 | +} |
|
| 80 | 82 | $pth = implode("install", $a); |
| 81 | 83 | unset ($a); |
| 82 | 84 | $base_url = $url . (substr($url, -1) != "/" ? "/" : ""); |
@@ -97,7 +99,9 @@ discard block |
||
| 97 | 99 | echo "<span class=\"notok\" style='color:#707070'>".$_lang['setup_database_selection_failed']."</span>".$_lang['setup_database_selection_failed_note']."</p>"; |
| 98 | 100 | $create = true; |
| 99 | 101 | } else { |
| 100 | - if (function_exists('mysqli_set_charset')) mysqli_set_charset($conn, $database_charset); |
|
| 102 | + if (function_exists('mysqli_set_charset')) { |
|
| 103 | + mysqli_set_charset($conn, $database_charset); |
|
| 104 | + } |
|
| 101 | 105 | mysqli_query($conn, "{$database_connection_method} {$database_connection_charset}"); |
| 102 | 106 | echo '<span class="ok">'.$_lang['ok']."</span></p>"; |
| 103 | 107 | } |
@@ -199,7 +203,7 @@ discard block |
||
| 199 | 203 | // custom or not |
| 200 | 204 | if (file_exists(__DIR__."/../../assets/cache/siteManager.php")) { |
| 201 | 205 | $mgrdir = 'include_once(__DIR__."/../../assets/cache/siteManager.php");'; |
| 202 | -}else{ |
|
| 206 | +} else { |
|
| 203 | 207 | $mgrdir = 'define(\'MGR_DIR\', \'manager\');'; |
| 204 | 208 | } |
| 205 | 209 | |
@@ -335,7 +339,9 @@ discard block |
||
| 335 | 339 | echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
| 336 | 340 | return; |
| 337 | 341 | } |
| 338 | - if(!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
| 342 | + if(!is_null($save_sql_id_as)) { |
|
| 343 | + $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
| 344 | + } |
|
| 339 | 345 | echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
| 340 | 346 | } |
| 341 | 347 | } |
@@ -429,9 +435,9 @@ discard block |
||
| 429 | 435 | $overwrite = mysqli_real_escape_string($conn, $moduleChunk[4]); |
| 430 | 436 | $filecontent = $moduleChunk[2]; |
| 431 | 437 | |
| 432 | - if (!file_exists($filecontent)) |
|
| 433 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 434 | - else { |
|
| 438 | + if (!file_exists($filecontent)) { |
|
| 439 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 440 | + } else { |
|
| 435 | 441 | |
| 436 | 442 | // Create the category if it does not already exist |
| 437 | 443 | $category_id = getCreateDbCategory($category, $sqlParser); |
@@ -483,9 +489,9 @@ discard block |
||
| 483 | 489 | $guid = mysqli_real_escape_string($conn, $moduleModule[4]); |
| 484 | 490 | $shared = mysqli_real_escape_string($conn, $moduleModule[5]); |
| 485 | 491 | $category = mysqli_real_escape_string($conn, $moduleModule[6]); |
| 486 | - if (!file_exists($filecontent)) |
|
| 487 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 488 | - else { |
|
| 492 | + if (!file_exists($filecontent)) { |
|
| 493 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 494 | + } else { |
|
| 489 | 495 | |
| 490 | 496 | // Create the category if it does not already exist |
| 491 | 497 | $category = getCreateDbCategory($category, $sqlParser); |
@@ -535,9 +541,9 @@ discard block |
||
| 535 | 541 | // parse comma-separated legacy names and prepare them for sql IN clause |
| 536 | 542 | $leg_names = "'" . implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))) . "'"; |
| 537 | 543 | } |
| 538 | - if (!file_exists($filecontent)) |
|
| 539 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 540 | - else { |
|
| 544 | + if (!file_exists($filecontent)) { |
|
| 545 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 546 | + } else { |
|
| 541 | 547 | |
| 542 | 548 | // disable legacy versions based on legacy_names provided |
| 543 | 549 | if(!empty($leg_names)) { |
@@ -556,7 +562,7 @@ discard block |
||
| 556 | 562 | $insert = true; |
| 557 | 563 | while($row = mysqli_fetch_assoc($rs)) { |
| 558 | 564 | $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
| 559 | - if($row['description'] == $desc){ |
|
| 565 | + if($row['description'] == $desc) { |
|
| 560 | 566 | if (! mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) { |
| 561 | 567 | echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
| 562 | 568 | return; |
@@ -614,9 +620,9 @@ discard block |
||
| 614 | 620 | $filecontent = $moduleSnippet[2]; |
| 615 | 621 | $properties = $moduleSnippet[3]; |
| 616 | 622 | $category = mysqli_real_escape_string($conn, $moduleSnippet[4]); |
| 617 | - if (!file_exists($filecontent)) |
|
| 618 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 619 | - else { |
|
| 623 | + if (!file_exists($filecontent)) { |
|
| 624 | + echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 625 | + } else { |
|
| 620 | 626 | |
| 621 | 627 | // Create the category if it does not already exist |
| 622 | 628 | $category = getCreateDbCategory($category, $sqlParser); |
@@ -724,13 +730,16 @@ discard block |
||
| 724 | 730 | } |
| 725 | 731 | |
| 726 | 732 | // call back function |
| 727 | -if ($callBackFnc != "") |
|
| 733 | +if ($callBackFnc != "") { |
|
| 728 | 734 | $callBackFnc ($sqlParser); |
| 735 | +} |
|
| 729 | 736 | |
| 730 | 737 | // Setup the MODX API -- needed for the cache processor |
| 731 | 738 | define('MODX_API_MODE', true); |
| 732 | 739 | define('MODX_BASE_PATH', $base_path); |
| 733 | -if (!defined('MODX_MANAGER_PATH')) define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/'); |
|
| 740 | +if (!defined('MODX_MANAGER_PATH')) { |
|
| 741 | + define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/'); |
|
| 742 | +} |
|
| 734 | 743 | $database_type = 'mysqli'; |
| 735 | 744 | // initiate a new document parser |
| 736 | 745 | include_once('../'.MGR_DIR.'/includes/document.parser.class.inc.php'); |