@@ -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); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | echo "<p>{$_lang['setup_database']}</p>\n"; |
| 42 | 42 | |
| 43 | -$installMode= (int)$_POST['installmode']; |
|
| 43 | +$installMode = (int) $_POST['installmode']; |
|
| 44 | 44 | $installData = $_POST['installdata'] == "1" ? 1 : 0; |
| 45 | 45 | |
| 46 | 46 | //if ($installMode == 1) { |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
| 55 | 55 | $database_connection_charset = $_POST['database_connection_charset']; |
| 56 | 56 | $database_connection_method = $_POST['database_connection_method']; |
| 57 | -$dbase = "`" . $_POST['database_name'] . "`"; |
|
| 57 | +$dbase = "`".$_POST['database_name']."`"; |
|
| 58 | 58 | $table_prefix = $_POST['tableprefix']; |
| 59 | 59 | $adminname = $_POST['cmsadmin']; |
| 60 | 60 | $adminemail = $_POST['cmsadminemail']; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | // set session name variable |
| 67 | 67 | if (!isset ($site_sessionname)) { |
| 68 | - $site_sessionname = 'SN' . uniqid(''); |
|
| 68 | + $site_sessionname = 'SN'.uniqid(''); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | // get base path and url |
@@ -79,11 +79,11 @@ discard block |
||
| 79 | 79 | array_pop($a); |
| 80 | 80 | $pth = implode("install", $a); |
| 81 | 81 | unset ($a); |
| 82 | -$base_url = $url . (substr($url, -1) != "/" ? "/" : ""); |
|
| 83 | -$base_path = $pth . (substr($pth, -1) != "/" ? "/" : ""); |
|
| 82 | +$base_url = $url.(substr($url, -1) != "/" ? "/" : ""); |
|
| 83 | +$base_path = $pth.(substr($pth, -1) != "/" ? "/" : ""); |
|
| 84 | 84 | |
| 85 | 85 | // connect to the database |
| 86 | -echo "<p>". $_lang['setup_database_create_connection']; |
|
| 86 | +echo "<p>".$_lang['setup_database_create_connection']; |
|
| 87 | 87 | if (!$conn = mysqli_connect($database_server, $database_user, $database_password)) { |
| 88 | 88 | echo '<span class="notok">'.$_lang["setup_database_create_connection_failed"]."</span></p><p>".$_lang['setup_database_create_connection_failed_note']."</p>"; |
| 89 | 89 | return; |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | // select database |
| 95 | -echo "<p>".$_lang['setup_database_selection']. str_replace("`", "", $dbase) . "`: "; |
|
| 95 | +echo "<p>".$_lang['setup_database_selection'].str_replace("`", "", $dbase)."`: "; |
|
| 96 | 96 | if (!mysqli_select_db($conn, str_replace("`", "", $dbase))) { |
| 97 | 97 | echo "<span class=\"notok\" style='color:#707070'>".$_lang['setup_database_selection_failed']."</span>".$_lang['setup_database_selection_failed_note']."</p>"; |
| 98 | 98 | $create = true; |
@@ -104,9 +104,9 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | // try to create the database |
| 106 | 106 | if ($create) { |
| 107 | - echo "<p>".$_lang['setup_database_creation']. str_replace("`", "", $dbase) . "`: "; |
|
| 107 | + echo "<p>".$_lang['setup_database_creation'].str_replace("`", "", $dbase)."`: "; |
|
| 108 | 108 | // if(!@mysqli_create_db(str_replace("`","",$dbase), $conn)) { |
| 109 | - if (! mysqli_query($conn, "CREATE DATABASE $dbase DEFAULT CHARACTER SET $database_charset COLLATE $database_collation")) { |
|
| 109 | + if (!mysqli_query($conn, "CREATE DATABASE $dbase DEFAULT CHARACTER SET $database_charset COLLATE $database_collation")) { |
|
| 110 | 110 | echo '<span class="notok">'.$_lang['setup_database_creation_failed']."</span>".$_lang['setup_database_creation_failed_note']."</p>"; |
| 111 | 111 | $errors += 1; |
| 112 | 112 | ?> |
@@ -125,11 +125,11 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | // check table prefix |
| 127 | 127 | if ($installMode == 0) { |
| 128 | - echo "<p>" . $_lang['checking_table_prefix'] . $table_prefix . "`: "; |
|
| 129 | - if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) { |
|
| 130 | - echo '<span class="notok">' . $_lang['failed'] . "</span>" . $_lang['table_prefix_already_inuse'] . "</p>"; |
|
| 128 | + echo "<p>".$_lang['checking_table_prefix'].$table_prefix."`: "; |
|
| 129 | + if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) { |
|
| 130 | + echo '<span class="notok">'.$_lang['failed']."</span>".$_lang['table_prefix_already_inuse']."</p>"; |
|
| 131 | 131 | $errors += 1; |
| 132 | - echo "<p>" . $_lang['table_prefix_already_inuse_note'] . "</p>"; |
|
| 132 | + echo "<p>".$_lang['table_prefix_already_inuse_note']."</p>"; |
|
| 133 | 133 | return; |
| 134 | 134 | } else { |
| 135 | 135 | echo '<span class="ok">'.$_lang['ok']."</span></p>"; |
@@ -139,20 +139,20 @@ discard block |
||
| 139 | 139 | // check status of Inherit Parent Template plugin |
| 140 | 140 | $auto_template_logic = 'parent'; |
| 141 | 141 | if ($installMode != 0) { |
| 142 | - $rs = mysqli_query($conn, "SELECT properties, disabled FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='Inherit Parent Template'"); |
|
| 142 | + $rs = mysqli_query($conn, "SELECT properties, disabled FROM $dbase.`".$table_prefix."site_plugins` WHERE name='Inherit Parent Template'"); |
|
| 143 | 143 | $row = mysqli_fetch_row($rs); |
| 144 | - if(!$row) { |
|
| 144 | + if (!$row) { |
|
| 145 | 145 | // not installed |
| 146 | 146 | $auto_template_logic = 'system'; |
| 147 | 147 | } else { |
| 148 | - if($row[1] == 1) { |
|
| 148 | + if ($row[1] == 1) { |
|
| 149 | 149 | // installed but disabled |
| 150 | 150 | $auto_template_logic = 'system'; |
| 151 | 151 | } else { |
| 152 | 152 | // installed, enabled .. see how it's configured |
| 153 | 153 | $properties = parseProperties($row[0]); |
| 154 | - if(isset($properties['inheritTemplate'])) { |
|
| 155 | - if($properties['inheritTemplate'] == 'From First Sibling') { |
|
| 154 | + if (isset($properties['inheritTemplate'])) { |
|
| 155 | + if ($properties['inheritTemplate'] == 'From First Sibling') { |
|
| 156 | 156 | $auto_template_logic = 'sibling'; |
| 157 | 157 | } |
| 158 | 158 | } |
@@ -162,8 +162,8 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | // open db connection |
| 164 | 164 | $setupPath = realpath(__DIR__); |
| 165 | -include dirname(__DIR__) . '/processor/result.php'; |
|
| 166 | -include_once dirname(__DIR__) . '/sqlParser.class.php'; |
|
| 165 | +include dirname(__DIR__).'/processor/result.php'; |
|
| 166 | +include_once dirname(__DIR__).'/sqlParser.class.php'; |
|
| 167 | 167 | $sqlParser = new SqlParser($database_server, $database_user, $database_password, str_replace("`", "", $dbase), $table_prefix, $adminname, $adminemail, $adminpass, $database_connection_charset, $managerlanguage, $database_connection_method, $auto_template_logic); |
| 168 | 168 | $sqlParser->mode = ($installMode < 1) ? "new" : "upd"; |
| 169 | 169 | /* image and file manager paths now handled via settings screen in Manager |
@@ -176,20 +176,20 @@ discard block |
||
| 176 | 176 | $sqlParser->connect(); |
| 177 | 177 | |
| 178 | 178 | // install/update database |
| 179 | -echo "<p>" . $_lang['setup_database_creating_tables']; |
|
| 179 | +echo "<p>".$_lang['setup_database_creating_tables']; |
|
| 180 | 180 | if ($moduleSQLBaseFile) { |
| 181 | 181 | $sqlParser->process($moduleSQLBaseFile); |
| 182 | 182 | // display database results |
| 183 | 183 | if ($sqlParser->installFailed == true) { |
| 184 | 184 | $errors += 1; |
| 185 | - echo "<span class=\"notok\"><b>" . $_lang['database_alerts'] . "</span></p>"; |
|
| 186 | - echo "<p>" . $_lang['setup_couldnt_install'] . "</p>"; |
|
| 187 | - echo "<p>" . $_lang['installation_error_occured'] . "<br /><br />"; |
|
| 185 | + echo "<span class=\"notok\"><b>".$_lang['database_alerts']."</span></p>"; |
|
| 186 | + echo "<p>".$_lang['setup_couldnt_install']."</p>"; |
|
| 187 | + echo "<p>".$_lang['installation_error_occured']."<br /><br />"; |
|
| 188 | 188 | for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { |
| 189 | - echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />"; |
|
| 189 | + echo "<em>".$sqlParser->mysqlErrors[$i]["error"]."</em>".$_lang['during_execution_of_sql']."<span class='mono'>".strip_tags($sqlParser->mysqlErrors[$i]["sql"])."</span>.<hr />"; |
|
| 190 | 190 | } |
| 191 | 191 | echo "</p>"; |
| 192 | - echo "<p>" . $_lang['some_tables_not_updated'] . "</p>"; |
|
| 192 | + echo "<p>".$_lang['some_tables_not_updated']."</p>"; |
|
| 193 | 193 | return; |
| 194 | 194 | } else { |
| 195 | 195 | echo '<span class="ok">'.$_lang['ok']."</span></p>"; |
@@ -199,12 +199,12 @@ discard block |
||
| 199 | 199 | // custom or not |
| 200 | 200 | if (file_exists(__DIR__."/../../assets/cache/siteManager.php")) { |
| 201 | 201 | $mgrdir = 'include_once(__DIR__."/../../assets/cache/siteManager.php");'; |
| 202 | -}else{ |
|
| 202 | +} else { |
|
| 203 | 203 | $mgrdir = 'define(\'MGR_DIR\', \'manager\');'; |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | // write the config.inc.php file if new installation |
| 207 | -echo "<p>" . $_lang['writing_config_file']; |
|
| 207 | +echo "<p>".$_lang['writing_config_file']; |
|
| 208 | 208 | |
| 209 | 209 | $confph = array(); |
| 210 | 210 | $confph['database_server'] = $database_server; |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | $confph['lastInstallTime'] = time(); |
| 218 | 218 | $confph['site_sessionname'] = $site_sessionname; |
| 219 | 219 | |
| 220 | -$configString = file_get_contents(dirname(__DIR__) . '/stubs/config.tpl'); |
|
| 220 | +$configString = file_get_contents(dirname(__DIR__).'/stubs/config.tpl'); |
|
| 221 | 221 | $configString = parse($configString, $confph); |
| 222 | 222 | |
| 223 | 223 | $filename = '../'.MGR_DIR.'/includes/config.inc.php'; |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | @chmod($filename, 0404); |
| 237 | 237 | |
| 238 | 238 | if ($configFileFailed == true) { |
| 239 | - echo '<span class="notok">' . $_lang['failed'] . "</span></p>"; |
|
| 239 | + echo '<span class="notok">'.$_lang['failed']."</span></p>"; |
|
| 240 | 240 | $errors += 1; |
| 241 | 241 | ?> |
| 242 | 242 | <p><?php echo $_lang['cant_write_config_file']?><span class="mono"><?php echo MGR_DIR; ?>/includes/config.inc.php</span></p> |
@@ -253,35 +253,35 @@ discard block |
||
| 253 | 253 | // generate new site_id and set manager theme to default |
| 254 | 254 | if ($installMode == 0) { |
| 255 | 255 | $siteid = uniqid(''); |
| 256 | - mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')"); |
|
| 256 | + mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')"); |
|
| 257 | 257 | } else { |
| 258 | 258 | // update site_id if missing |
| 259 | - $ds = mysqli_query($sqlParser->conn, "SELECT setting_name,setting_value FROM $dbase.`" . $table_prefix . "system_settings` WHERE setting_name='site_id'"); |
|
| 259 | + $ds = mysqli_query($sqlParser->conn, "SELECT setting_name,setting_value FROM $dbase.`".$table_prefix."system_settings` WHERE setting_name='site_id'"); |
|
| 260 | 260 | if ($ds) { |
| 261 | 261 | $r = mysqli_fetch_assoc($ds); |
| 262 | 262 | $siteid = $r['setting_value']; |
| 263 | 263 | if ($siteid == '' || $siteid = 'MzGeQ2faT4Dw06+U49x3') { |
| 264 | 264 | $siteid = uniqid(''); |
| 265 | - mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')"); |
|
| 265 | + mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')"); |
|
| 266 | 266 | } |
| 267 | 267 | } |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | // Reset database for installation of demo-site |
| 271 | 271 | if ($installData && $moduleSQLDataFile && $moduleSQLResetFile) { |
| 272 | - echo "<p>" . $_lang['resetting_database']; |
|
| 272 | + echo "<p>".$_lang['resetting_database']; |
|
| 273 | 273 | $sqlParser->process($moduleSQLResetFile); |
| 274 | 274 | // display database results |
| 275 | 275 | if ($sqlParser->installFailed == true) { |
| 276 | 276 | $errors += 1; |
| 277 | - echo "<span class=\"notok\"><b>" . $_lang['database_alerts'] . "</span></p>"; |
|
| 278 | - echo "<p>" . $_lang['setup_couldnt_install'] . "</p>"; |
|
| 279 | - echo "<p>" . $_lang['installation_error_occured'] . "<br /><br />"; |
|
| 277 | + echo "<span class=\"notok\"><b>".$_lang['database_alerts']."</span></p>"; |
|
| 278 | + echo "<p>".$_lang['setup_couldnt_install']."</p>"; |
|
| 279 | + echo "<p>".$_lang['installation_error_occured']."<br /><br />"; |
|
| 280 | 280 | for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { |
| 281 | - echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />"; |
|
| 281 | + echo "<em>".$sqlParser->mysqlErrors[$i]["error"]."</em>".$_lang['during_execution_of_sql']."<span class='mono'>".strip_tags($sqlParser->mysqlErrors[$i]["sql"])."</span>.<hr />"; |
|
| 282 | 282 | } |
| 283 | 283 | echo "</p>"; |
| 284 | - echo "<p>" . $_lang['some_tables_not_updated'] . "</p>"; |
|
| 284 | + echo "<p>".$_lang['some_tables_not_updated']."</p>"; |
|
| 285 | 285 | return; |
| 286 | 286 | } else { |
| 287 | 287 | echo '<span class="ok">'.$_lang['ok']."</span></p>"; |
@@ -290,11 +290,11 @@ discard block |
||
| 290 | 290 | |
| 291 | 291 | // Install Templates |
| 292 | 292 | if (isset ($_POST['template']) || $installData) { |
| 293 | - echo "<h3>" . $_lang['templates'] . ":</h3> "; |
|
| 293 | + echo "<h3>".$_lang['templates'].":</h3> "; |
|
| 294 | 294 | $selTemplates = $_POST['template']; |
| 295 | 295 | foreach ($moduleTemplates as $k=>$moduleTemplate) { |
| 296 | 296 | $installSample = in_array('sample', $moduleTemplate[6]) && $installData == 1; |
| 297 | - if($installSample || in_array($k, $selTemplates)) { |
|
| 297 | + if ($installSample || in_array($k, $selTemplates)) { |
|
| 298 | 298 | $name = mysqli_real_escape_string($conn, $moduleTemplate[0]); |
| 299 | 299 | $desc = mysqli_real_escape_string($conn, $moduleTemplate[1]); |
| 300 | 300 | $category = mysqli_real_escape_string($conn, $moduleTemplate[4]); |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | $filecontent = $moduleTemplate[3]; |
| 303 | 303 | $save_sql_id_as = $moduleTemplate[7]; // Nessecary for demo-site |
| 304 | 304 | if (!file_exists($filecontent)) { |
| 305 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_template'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 305 | + echo "<p> $name: <span class=\"notok\">".$_lang['unable_install_template']." '$filecontent' ".$_lang['not_found'].".</span></p>"; |
|
| 306 | 306 | } else { |
| 307 | 307 | // Create the category if it does not already exist |
| 308 | 308 | $category_id = getCreateDbCategory($category, $sqlParser); |
@@ -312,31 +312,31 @@ discard block |
||
| 312 | 312 | $template = mysqli_real_escape_string($conn, $template); |
| 313 | 313 | |
| 314 | 314 | // See if the template already exists |
| 315 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name'"); |
|
| 315 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name'"); |
|
| 316 | 316 | |
| 317 | 317 | if (mysqli_num_rows($rs)) { |
| 318 | - 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;")) { |
|
| 318 | + 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;")) { |
|
| 319 | 319 | $errors += 1; |
| 320 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 320 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 321 | 321 | return; |
| 322 | 322 | } |
| 323 | - if(!is_null($save_sql_id_as)) { |
|
| 323 | + if (!is_null($save_sql_id_as)) { |
|
| 324 | 324 | $sql_id = @mysqli_insert_id($sqlParser->conn); |
| 325 | - if(!$sql_id) { |
|
| 326 | - $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name' LIMIT 1;")); |
|
| 325 | + if (!$sql_id) { |
|
| 326 | + $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name' LIMIT 1;")); |
|
| 327 | 327 | $sql_id = $idQuery['id']; |
| 328 | 328 | } |
| 329 | 329 | $custom_placeholders[$save_sql_id_as] = $sql_id; |
| 330 | 330 | } |
| 331 | - echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
| 331 | + echo "<p> $name: <span class=\"ok\">".$_lang['upgraded']."</span></p>"; |
|
| 332 | 332 | } else { |
| 333 | - if (!@ mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) { |
|
| 333 | + if (!@ mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) { |
|
| 334 | 334 | $errors += 1; |
| 335 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 335 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 336 | 336 | return; |
| 337 | 337 | } |
| 338 | - if(!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
| 339 | - echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
| 338 | + if (!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn); |
|
| 339 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
| 340 | 340 | } |
| 341 | 341 | } |
| 342 | 342 | } |
@@ -345,11 +345,11 @@ discard block |
||
| 345 | 345 | |
| 346 | 346 | // Install Template Variables |
| 347 | 347 | if (isset ($_POST['tv']) || $installData) { |
| 348 | - echo "<h3>" . $_lang['tvs'] . ":</h3> "; |
|
| 348 | + echo "<h3>".$_lang['tvs'].":</h3> "; |
|
| 349 | 349 | $selTVs = $_POST['tv']; |
| 350 | 350 | foreach ($moduleTVs as $k=>$moduleTV) { |
| 351 | 351 | $installSample = in_array('sample', $moduleTV[12]) && $installData == 1; |
| 352 | - if($installSample || in_array($k, $selTVs)) { |
|
| 352 | + if ($installSample || in_array($k, $selTVs)) { |
|
| 353 | 353 | $name = mysqli_real_escape_string($conn, $moduleTV[0]); |
| 354 | 354 | $caption = mysqli_real_escape_string($conn, $moduleTV[1]); |
| 355 | 355 | $desc = mysqli_real_escape_string($conn, $moduleTV[2]); |
@@ -367,25 +367,25 @@ discard block |
||
| 367 | 367 | // Create the category if it does not already exist |
| 368 | 368 | $category = getCreateDbCategory($category, $sqlParser); |
| 369 | 369 | |
| 370 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name'"); |
|
| 370 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name'"); |
|
| 371 | 371 | if (mysqli_num_rows($rs)) { |
| 372 | 372 | $insert = true; |
| 373 | - while($row = mysqli_fetch_assoc($rs)) { |
|
| 374 | - 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']};")) { |
|
| 375 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 373 | + while ($row = mysqli_fetch_assoc($rs)) { |
|
| 374 | + 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']};")) { |
|
| 375 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 376 | 376 | return; |
| 377 | 377 | } |
| 378 | 378 | $insert = false; |
| 379 | 379 | } |
| 380 | - echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
| 380 | + echo "<p> $name: <span class=\"ok\">".$_lang['upgraded']."</span></p>"; |
|
| 381 | 381 | } else { |
| 382 | 382 | //$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',(SELECT (CASE COUNT(*) WHEN 0 THEN 0 ELSE `id` END) `id` FROM $dbase.`" . $table_prefix . "categories` WHERE `category` = '$category'),$locked,'$input_options','$output_widget','$output_widget_params','$input_default');"; |
| 383 | - $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');"; |
|
| 383 | + $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');"; |
|
| 384 | 384 | if (!mysqli_query($sqlParser->conn, $q)) { |
| 385 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 385 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 386 | 386 | return; |
| 387 | 387 | } |
| 388 | - echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
| 388 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | // add template assignments |
@@ -394,10 +394,10 @@ discard block |
||
| 394 | 394 | if (count($assignments) > 0) { |
| 395 | 395 | |
| 396 | 396 | // remove existing tv -> template assignments |
| 397 | - $ds=mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';"); |
|
| 397 | + $ds = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';"); |
|
| 398 | 398 | $row = mysqli_fetch_assoc($ds); |
| 399 | 399 | $id = $row["id"]; |
| 400 | - mysqli_query($sqlParser->conn, 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_tmplvar_templates` WHERE tmplvarid = \'' . $id . '\''); |
|
| 400 | + mysqli_query($sqlParser->conn, 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_tmplvar_templates` WHERE tmplvarid = \''.$id.'\''); |
|
| 401 | 401 | |
| 402 | 402 | // add tv -> template assignments |
| 403 | 403 | foreach ($assignments as $assignment) { |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | if ($ds && $ts) { |
| 407 | 407 | $tRow = mysqli_fetch_assoc($ts); |
| 408 | 408 | $templateId = $tRow['id']; |
| 409 | - mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)"); |
|
| 409 | + mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)"); |
|
| 410 | 410 | } |
| 411 | 411 | } |
| 412 | 412 | } |
@@ -416,12 +416,12 @@ discard block |
||
| 416 | 416 | |
| 417 | 417 | // Install Chunks |
| 418 | 418 | if (isset ($_POST['chunk']) || $installData) { |
| 419 | - echo "<h3>" . $_lang['chunks'] . ":</h3> "; |
|
| 419 | + echo "<h3>".$_lang['chunks'].":</h3> "; |
|
| 420 | 420 | $selChunks = $_POST['chunk']; |
| 421 | 421 | foreach ($moduleChunks as $k=>$moduleChunk) { |
| 422 | 422 | $installSample = in_array('sample', $moduleChunk[5]) && $installData == 1; |
| 423 | 423 | $count_new_name = 0; |
| 424 | - if($installSample || in_array($k, $selChunks)) { |
|
| 424 | + if ($installSample || in_array($k, $selChunks)) { |
|
| 425 | 425 | |
| 426 | 426 | $name = mysqli_real_escape_string($conn, $moduleChunk[0]); |
| 427 | 427 | $desc = mysqli_real_escape_string($conn, $moduleChunk[1]); |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | $filecontent = $moduleChunk[2]; |
| 431 | 431 | |
| 432 | 432 | if (!file_exists($filecontent)) |
| 433 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 433 | + echo "<p> $name: <span class=\"notok\">".$_lang['unable_install_chunk']." '$filecontent' ".$_lang['not_found'].".</span></p>"; |
|
| 434 | 434 | else { |
| 435 | 435 | |
| 436 | 436 | // Create the category if it does not already exist |
@@ -438,31 +438,31 @@ discard block |
||
| 438 | 438 | |
| 439 | 439 | $chunk = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', file_get_contents($filecontent), 1); |
| 440 | 440 | $chunk = mysqli_real_escape_string($conn, $chunk); |
| 441 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$name'"); |
|
| 441 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$name'"); |
|
| 442 | 442 | $count_original_name = mysqli_num_rows($rs); |
| 443 | - if($overwrite == 'false') { |
|
| 444 | - $newname = $name . '-' . str_replace('.', '_', $modx_version); |
|
| 445 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$newname'"); |
|
| 443 | + if ($overwrite == 'false') { |
|
| 444 | + $newname = $name.'-'.str_replace('.', '_', $modx_version); |
|
| 445 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$newname'"); |
|
| 446 | 446 | $count_new_name = mysqli_num_rows($rs); |
| 447 | 447 | } |
| 448 | 448 | $update = $count_original_name > 0 && $overwrite == 'true'; |
| 449 | 449 | if ($update) { |
| 450 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) { |
|
| 450 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) { |
|
| 451 | 451 | $errors += 1; |
| 452 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 452 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 453 | 453 | return; |
| 454 | 454 | } |
| 455 | - echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
| 456 | - } elseif($count_new_name == 0) { |
|
| 457 | - if($count_original_name > 0 && $overwrite == 'false') { |
|
| 455 | + echo "<p> $name: <span class=\"ok\">".$_lang['upgraded']."</span></p>"; |
|
| 456 | + } elseif ($count_new_name == 0) { |
|
| 457 | + if ($count_original_name > 0 && $overwrite == 'false') { |
|
| 458 | 458 | $name = $newname; |
| 459 | 459 | } |
| 460 | - if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) { |
|
| 460 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) { |
|
| 461 | 461 | $errors += 1; |
| 462 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 462 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 463 | 463 | return; |
| 464 | 464 | } |
| 465 | - echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
| 465 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
| 466 | 466 | } |
| 467 | 467 | } |
| 468 | 468 | } |
@@ -471,11 +471,11 @@ discard block |
||
| 471 | 471 | |
| 472 | 472 | // Install Modules |
| 473 | 473 | if (isset ($_POST['module']) || $installData) { |
| 474 | - echo "<h3>" . $_lang['modules'] . ":</h3> "; |
|
| 474 | + echo "<h3>".$_lang['modules'].":</h3> "; |
|
| 475 | 475 | $selModules = $_POST['module']; |
| 476 | 476 | foreach ($moduleModules as $k=>$moduleModule) { |
| 477 | 477 | $installSample = in_array('sample', $moduleModule[7]) && $installData == 1; |
| 478 | - if($installSample || in_array($k, $selModules)) { |
|
| 478 | + if ($installSample || in_array($k, $selModules)) { |
|
| 479 | 479 | $name = mysqli_real_escape_string($conn, $moduleModule[0]); |
| 480 | 480 | $desc = mysqli_real_escape_string($conn, $moduleModule[1]); |
| 481 | 481 | $filecontent = $moduleModule[2]; |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | $shared = mysqli_real_escape_string($conn, $moduleModule[5]); |
| 485 | 485 | $category = mysqli_real_escape_string($conn, $moduleModule[6]); |
| 486 | 486 | if (!file_exists($filecontent)) |
| 487 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 487 | + echo "<p> $name: <span class=\"notok\">".$_lang['unable_install_module']." '$filecontent' ".$_lang['not_found'].".</span></p>"; |
|
| 488 | 488 | else { |
| 489 | 489 | |
| 490 | 490 | // Create the category if it does not already exist |
@@ -493,22 +493,22 @@ discard block |
||
| 493 | 493 | $module = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2)); |
| 494 | 494 | // $module = removeDocblock($module, 'module'); // Modules have no fileBinding, keep docblock for info-tab |
| 495 | 495 | $module = mysqli_real_escape_string($conn, $module); |
| 496 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_modules` WHERE name='$name'"); |
|
| 496 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_modules` WHERE name='$name'"); |
|
| 497 | 497 | if (mysqli_num_rows($rs)) { |
| 498 | 498 | $row = mysqli_fetch_assoc($rs); |
| 499 | - $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
| 500 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) { |
|
| 501 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 499 | + $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
| 500 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) { |
|
| 501 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 502 | 502 | return; |
| 503 | 503 | } |
| 504 | - echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
| 504 | + echo "<p> $name: <span class=\"ok\">".$_lang['upgraded']."</span></p>"; |
|
| 505 | 505 | } else { |
| 506 | 506 | $properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
| 507 | - 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);")) { |
|
| 508 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 507 | + 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);")) { |
|
| 508 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 509 | 509 | return; |
| 510 | 510 | } |
| 511 | - echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
| 511 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
| 512 | 512 | } |
| 513 | 513 | } |
| 514 | 514 | } |
@@ -517,11 +517,11 @@ discard block |
||
| 517 | 517 | |
| 518 | 518 | // Install Plugins |
| 519 | 519 | if (isset ($_POST['plugin']) || $installData) { |
| 520 | - echo "<h3>" . $_lang['plugins'] . ":</h3> "; |
|
| 520 | + echo "<h3>".$_lang['plugins'].":</h3> "; |
|
| 521 | 521 | $selPlugs = $_POST['plugin']; |
| 522 | 522 | foreach ($modulePlugins as $k=>$modulePlugin) { |
| 523 | 523 | $installSample = in_array('sample', $modulePlugin[8]) && $installData == 1; |
| 524 | - if($installSample || in_array($k, $selPlugs)) { |
|
| 524 | + if ($installSample || in_array($k, $selPlugs)) { |
|
| 525 | 525 | $name = mysqli_real_escape_string($conn, $modulePlugin[0]); |
| 526 | 526 | $desc = mysqli_real_escape_string($conn, $modulePlugin[1]); |
| 527 | 527 | $filecontent = $modulePlugin[2]; |
@@ -531,17 +531,17 @@ discard block |
||
| 531 | 531 | $category = mysqli_real_escape_string($conn, $modulePlugin[6]); |
| 532 | 532 | $leg_names = ''; |
| 533 | 533 | $disabled = $modulePlugin[9]; |
| 534 | - if(array_key_exists(7, $modulePlugin)) { |
|
| 534 | + if (array_key_exists(7, $modulePlugin)) { |
|
| 535 | 535 | // parse comma-separated legacy names and prepare them for sql IN clause |
| 536 | - $leg_names = "'" . implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))) . "'"; |
|
| 536 | + $leg_names = "'".implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7])))."'"; |
|
| 537 | 537 | } |
| 538 | 538 | if (!file_exists($filecontent)) |
| 539 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 539 | + echo "<p> $name: <span class=\"notok\">".$_lang['unable_install_plugin']." '$filecontent' ".$_lang['not_found'].".</span></p>"; |
|
| 540 | 540 | else { |
| 541 | 541 | |
| 542 | 542 | // disable legacy versions based on legacy_names provided |
| 543 | - if(!empty($leg_names)) { |
|
| 544 | - $update_query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);"; |
|
| 543 | + if (!empty($leg_names)) { |
|
| 544 | + $update_query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE name IN ($leg_names);"; |
|
| 545 | 545 | $rs = mysqli_query($sqlParser->conn, $update_query); |
| 546 | 546 | } |
| 547 | 547 | |
@@ -551,50 +551,50 @@ discard block |
||
| 551 | 551 | $plugin = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2)); |
| 552 | 552 | $plugin = removeDocblock($plugin, 'plugin'); |
| 553 | 553 | $plugin = mysqli_real_escape_string($conn, $plugin); |
| 554 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='$name'"); |
|
| 554 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name'"); |
|
| 555 | 555 | if (mysqli_num_rows($rs)) { |
| 556 | 556 | $insert = true; |
| 557 | - while($row = mysqli_fetch_assoc($rs)) { |
|
| 558 | - $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
| 559 | - if($row['description'] == $desc){ |
|
| 560 | - if (! mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) { |
|
| 561 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 557 | + while ($row = mysqli_fetch_assoc($rs)) { |
|
| 558 | + $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
| 559 | + if ($row['description'] == $desc) { |
|
| 560 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) { |
|
| 561 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 562 | 562 | return; |
| 563 | 563 | } |
| 564 | 564 | $insert = false; |
| 565 | 565 | } else { |
| 566 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};")) { |
|
| 566 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE id={$row['id']};")) { |
|
| 567 | 567 | echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
| 568 | 568 | return; |
| 569 | 569 | } |
| 570 | 570 | } |
| 571 | 571 | } |
| 572 | - if($insert === true) { |
|
| 573 | - $properties = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
| 574 | - 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);")) { |
|
| 572 | + if ($insert === true) { |
|
| 573 | + $properties = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
| 574 | + 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);")) { |
|
| 575 | 575 | echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
| 576 | 576 | return; |
| 577 | 577 | } |
| 578 | 578 | } |
| 579 | - echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
| 579 | + echo "<p> $name: <span class=\"ok\">".$_lang['upgraded']."</span></p>"; |
|
| 580 | 580 | } else { |
| 581 | 581 | $properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
| 582 | - 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);")) { |
|
| 583 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 582 | + 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);")) { |
|
| 583 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 584 | 584 | return; |
| 585 | 585 | } |
| 586 | - echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
| 586 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
| 587 | 587 | } |
| 588 | 588 | // add system events |
| 589 | 589 | if (count($events) > 0) { |
| 590 | - $ds=mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';"); |
|
| 590 | + $ds = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';"); |
|
| 591 | 591 | if ($ds) { |
| 592 | 592 | $row = mysqli_fetch_assoc($ds); |
| 593 | 593 | $id = $row["id"]; |
| 594 | 594 | // remove existing events |
| 595 | - mysqli_query($sqlParser->conn, 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_plugin_events` WHERE pluginid = \'' . $id . '\''); |
|
| 595 | + mysqli_query($sqlParser->conn, 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_plugin_events` WHERE pluginid = \''.$id.'\''); |
|
| 596 | 596 | // add new events |
| 597 | - 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) . "')"); |
|
| 597 | + 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)."')"); |
|
| 598 | 598 | } |
| 599 | 599 | } |
| 600 | 600 | } |
@@ -604,18 +604,18 @@ discard block |
||
| 604 | 604 | |
| 605 | 605 | // Install Snippets |
| 606 | 606 | if (isset ($_POST['snippet']) || $installData) { |
| 607 | - echo "<h3>" . $_lang['snippets'] . ":</h3> "; |
|
| 607 | + echo "<h3>".$_lang['snippets'].":</h3> "; |
|
| 608 | 608 | $selSnips = $_POST['snippet']; |
| 609 | 609 | foreach ($moduleSnippets as $k=>$moduleSnippet) { |
| 610 | 610 | $installSample = in_array('sample', $moduleSnippet[5]) && $installData == 1; |
| 611 | - if($installSample || in_array($k, $selSnips)) { |
|
| 611 | + if ($installSample || in_array($k, $selSnips)) { |
|
| 612 | 612 | $name = mysqli_real_escape_string($conn, $moduleSnippet[0]); |
| 613 | 613 | $desc = mysqli_real_escape_string($conn, $moduleSnippet[1]); |
| 614 | 614 | $filecontent = $moduleSnippet[2]; |
| 615 | 615 | $properties = $moduleSnippet[3]; |
| 616 | 616 | $category = mysqli_real_escape_string($conn, $moduleSnippet[4]); |
| 617 | 617 | if (!file_exists($filecontent)) |
| 618 | - echo "<p> $name: <span class=\"notok\">" . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>"; |
|
| 618 | + echo "<p> $name: <span class=\"notok\">".$_lang['unable_install_snippet']." '$filecontent' ".$_lang['not_found'].".</span></p>"; |
|
| 619 | 619 | else { |
| 620 | 620 | |
| 621 | 621 | // Create the category if it does not already exist |
@@ -624,22 +624,22 @@ discard block |
||
| 624 | 624 | $snippet = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent))); |
| 625 | 625 | $snippet = removeDocblock($snippet, 'snippet'); |
| 626 | 626 | $snippet = mysqli_real_escape_string($conn, $snippet); |
| 627 | - $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_snippets` WHERE name='$name'"); |
|
| 627 | + $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_snippets` WHERE name='$name'"); |
|
| 628 | 628 | if (mysqli_num_rows($rs)) { |
| 629 | 629 | $row = mysqli_fetch_assoc($rs); |
| 630 | - $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties'])); |
|
| 631 | - if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) { |
|
| 632 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 630 | + $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
|
| 631 | + if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) { |
|
| 632 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 633 | 633 | return; |
| 634 | 634 | } |
| 635 | - echo "<p> $name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>"; |
|
| 635 | + echo "<p> $name: <span class=\"ok\">".$_lang['upgraded']."</span></p>"; |
|
| 636 | 636 | } else { |
| 637 | 637 | $properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
| 638 | - if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) { |
|
| 639 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 638 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) { |
|
| 639 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 640 | 640 | return; |
| 641 | 641 | } |
| 642 | - echo "<p> $name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>"; |
|
| 642 | + echo "<p> $name: <span class=\"ok\">".$_lang['installed']."</span></p>"; |
|
| 643 | 643 | } |
| 644 | 644 | } |
| 645 | 645 | } |
@@ -648,24 +648,24 @@ discard block |
||
| 648 | 648 | |
| 649 | 649 | // Install demo-site |
| 650 | 650 | if ($installData && $moduleSQLDataFile) { |
| 651 | - echo "<p>" . $_lang['installing_demo_site']; |
|
| 651 | + echo "<p>".$_lang['installing_demo_site']; |
|
| 652 | 652 | $sqlParser->process($moduleSQLDataFile); |
| 653 | 653 | // display database results |
| 654 | 654 | if ($sqlParser->installFailed == true) { |
| 655 | 655 | $errors += 1; |
| 656 | - echo "<span class=\"notok\"><b>" . $_lang['database_alerts'] . "</span></p>"; |
|
| 657 | - echo "<p>" . $_lang['setup_couldnt_install'] . "</p>"; |
|
| 658 | - echo "<p>" . $_lang['installation_error_occured'] . "<br /><br />"; |
|
| 656 | + echo "<span class=\"notok\"><b>".$_lang['database_alerts']."</span></p>"; |
|
| 657 | + echo "<p>".$_lang['setup_couldnt_install']."</p>"; |
|
| 658 | + echo "<p>".$_lang['installation_error_occured']."<br /><br />"; |
|
| 659 | 659 | for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) { |
| 660 | - echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />"; |
|
| 660 | + echo "<em>".$sqlParser->mysqlErrors[$i]["error"]."</em>".$_lang['during_execution_of_sql']."<span class='mono'>".strip_tags($sqlParser->mysqlErrors[$i]["sql"])."</span>.<hr />"; |
|
| 661 | 661 | } |
| 662 | 662 | echo "</p>"; |
| 663 | - echo "<p>" . $_lang['some_tables_not_updated'] . "</p>"; |
|
| 663 | + echo "<p>".$_lang['some_tables_not_updated']."</p>"; |
|
| 664 | 664 | return; |
| 665 | 665 | } else { |
| 666 | 666 | $sql = sprintf("SELECT id FROM `%ssite_templates` WHERE templatename='EVO startup - Bootstrap'", $sqlParser->prefix); |
| 667 | 667 | $rs = mysqli_query($sqlParser->conn, $sql); |
| 668 | - if(mysqli_num_rows($rs)) { |
|
| 668 | + if (mysqli_num_rows($rs)) { |
|
| 669 | 669 | $row = mysqli_fetch_assoc($rs); |
| 670 | 670 | $sql = sprintf('UPDATE `%ssite_content` SET template=%s WHERE template=4', $sqlParser->prefix, $row['id']); |
| 671 | 671 | mysqli_query($sqlParser->conn, $sql); |
@@ -676,9 +676,9 @@ discard block |
||
| 676 | 676 | |
| 677 | 677 | // Install Dependencies |
| 678 | 678 | foreach ($moduleDependencies as $dependency) { |
| 679 | - $ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_modules` WHERE name="' . $dependency['module'] . '"'); |
|
| 679 | + $ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM '.$dbase.'`'.$sqlParser->prefix.'site_modules` WHERE name="'.$dependency['module'].'"'); |
|
| 680 | 680 | if (!$ds) { |
| 681 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 681 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 682 | 682 | return; |
| 683 | 683 | } else { |
| 684 | 684 | $row = mysqli_fetch_assoc($ds); |
@@ -686,37 +686,37 @@ discard block |
||
| 686 | 686 | $moduleGuid = $row["guid"]; |
| 687 | 687 | } |
| 688 | 688 | // get extra id |
| 689 | - $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE ' . $dependency['column'] . '="' . $dependency['name'] . '"'); |
|
| 689 | + $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE '.$dependency['column'].'="'.$dependency['name'].'"'); |
|
| 690 | 690 | if (!$ds) { |
| 691 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 691 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 692 | 692 | return; |
| 693 | 693 | } else { |
| 694 | 694 | $row = mysqli_fetch_assoc($ds); |
| 695 | 695 | $extraId = $row["id"]; |
| 696 | 696 | } |
| 697 | 697 | // setup extra as module dependency |
| 698 | - $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'); |
|
| 698 | + $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'); |
|
| 699 | 699 | if (!$ds) { |
| 700 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 700 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 701 | 701 | return; |
| 702 | 702 | } else { |
| 703 | 703 | if (mysqli_num_rows($ds) === 0) { |
| 704 | - mysqli_query($sqlParser->conn, 'INSERT INTO ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` (module, resource, type) VALUES(' . $moduleId . ',' . $extraId . ',' . $dependency['type'] . ')'); |
|
| 705 | - echo '<p> ' . $dependency['module'] . ' Module: <span class="ok">' . $_lang['depedency_create'] . '</span></p>'; |
|
| 704 | + mysqli_query($sqlParser->conn, 'INSERT INTO '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` (module, resource, type) VALUES('.$moduleId.','.$extraId.','.$dependency['type'].')'); |
|
| 705 | + echo '<p> '.$dependency['module'].' Module: <span class="ok">'.$_lang['depedency_create'].'</span></p>'; |
|
| 706 | 706 | } else { |
| 707 | - 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']); |
|
| 708 | - echo '<p> ' . $dependency['module'] . ' Module: <span class="ok">' . $_lang['depedency_update'] . '</span></p>'; |
|
| 707 | + 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']); |
|
| 708 | + echo '<p> '.$dependency['module'].' Module: <span class="ok">'.$_lang['depedency_update'].'</span></p>'; |
|
| 709 | 709 | } |
| 710 | 710 | if ($dependency['type'] == 30 || $dependency['type'] == 40) { |
| 711 | 711 | // set extra guid for plugins and snippets |
| 712 | - $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE id=' . $extraId . ' LIMIT 1'); |
|
| 712 | + $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE id='.$extraId.' LIMIT 1'); |
|
| 713 | 713 | if (!$ds) { |
| 714 | - echo "<p>" . mysqli_error($sqlParser->conn) . "</p>"; |
|
| 714 | + echo "<p>".mysqli_error($sqlParser->conn)."</p>"; |
|
| 715 | 715 | return; |
| 716 | 716 | } else { |
| 717 | 717 | if (mysqli_num_rows($ds) != 0) { |
| 718 | - mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` SET moduleguid = ' . $moduleGuid . ' WHERE id=' . $extraId); |
|
| 719 | - echo '<p> ' . $dependency['name'] . ': <span class="ok">' . $_lang['guid_set'] . '</span></p>'; |
|
| 718 | + mysqli_query($sqlParser->conn, 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` SET moduleguid = '.$moduleGuid.' WHERE id='.$extraId); |
|
| 719 | + echo '<p> '.$dependency['name'].': <span class="ok">'.$_lang['guid_set'].'</span></p>'; |
|
| 720 | 720 | } |
| 721 | 721 | } |
| 722 | 722 | } |
@@ -725,7 +725,7 @@ discard block |
||
| 725 | 725 | |
| 726 | 726 | // call back function |
| 727 | 727 | if ($callBackFnc != "") |
| 728 | - $callBackFnc ($sqlParser); |
|
| 728 | + $callBackFnc($sqlParser); |
|
| 729 | 729 | |
| 730 | 730 | // Setup the MODX API -- needed for the cache processor |
| 731 | 731 | define('MODX_API_MODE', true); |
@@ -759,12 +759,12 @@ discard block |
||
| 759 | 759 | } |
| 760 | 760 | |
| 761 | 761 | // setup completed! |
| 762 | -echo "<p><b>" . $_lang['installation_successful'] . "</b></p>"; |
|
| 763 | -echo "<p>" . $_lang['to_log_into_content_manager'] . "</p>"; |
|
| 762 | +echo "<p><b>".$_lang['installation_successful']."</b></p>"; |
|
| 763 | +echo "<p>".$_lang['to_log_into_content_manager']."</p>"; |
|
| 764 | 764 | if ($installMode == 0) { |
| 765 | - echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />" . $_lang['installation_note'] . "</p>"; |
|
| 765 | + echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />".$_lang['installation_note']."</p>"; |
|
| 766 | 766 | } else { |
| 767 | - echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />" . $_lang['upgrade_note'] . "</p>"; |
|
| 767 | + echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />".$_lang['upgrade_note']."</p>"; |
|
| 768 | 768 | } |
| 769 | 769 | ?> |
| 770 | 770 | <form name="install" id="install_form" action="index.php?action=options" method="post"> |
@@ -793,10 +793,10 @@ discard block |
||
| 793 | 793 | var chk = document.install.rminstaller; |
| 794 | 794 | if(chk && chk.checked) { |
| 795 | 795 | // remove install folder and files |
| 796 | - window.location.href = "../<?php echo MGR_DIR;?>/processors/remove_installer.processor.php?rminstall=1"; |
|
| 796 | + window.location.href = "../<?php echo MGR_DIR; ?>/processors/remove_installer.processor.php?rminstall=1"; |
|
| 797 | 797 | } |
| 798 | 798 | else { |
| 799 | - window.location.href = "../<?php echo MGR_DIR;?>/"; |
|
| 799 | + window.location.href = "../<?php echo MGR_DIR; ?>/"; |
|
| 800 | 800 | } |
| 801 | 801 | } |
| 802 | 802 | /* ]]> */ |
@@ -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'); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | 'sv' => 'svenska' |
| 38 | 38 | ); |
| 39 | 39 | $_langISO6391 = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); |
| 40 | -if (! empty($_langFiles[$_langISO6391])) { |
|
| 40 | +if (!empty($_langFiles[$_langISO6391])) { |
|
| 41 | 41 | $install_language = $_langFiles[$_langISO6391]; |
| 42 | 42 | } |
| 43 | 43 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | } |
| 52 | 52 | # load language file |
| 53 | 53 | require_once 'lang/english.inc.php'; // As fallback |
| 54 | -require_once 'lang/' . $install_language . '.inc.php'; |
|
| 54 | +require_once 'lang/'.$install_language.'.inc.php'; |
|
| 55 | 55 | |
| 56 | 56 | $manager_language = $install_language; |
| 57 | 57 | |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | * |
| 16 | 16 | * Please commit your language changes on Transifex (https://www.transifex.com/projects/p/modx-evolution/) or on GitHub (https://github.com/modxcms/evolution). |
| 17 | 17 | */ |
| 18 | -setlocale (LC_ALL, 'ru_RU.UTF-8'); |
|
| 18 | +setlocale(LC_ALL, 'ru_RU.UTF-8'); |
|
| 19 | 19 | $_lang["agree_to_terms"] = 'Согласиться с условиями лицензии и приступить к установке'; |
| 20 | 20 | $_lang["alert_database_test_connection"] = 'Вы должны создать базу данных или выбрать базу данных для проверки!'; |
| 21 | 21 | $_lang["alert_database_test_connection_failed"] = 'Неудачная проверка выбранной базы данных!'; |
@@ -1,21 +1,21 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | //:: EVO Installer Setup file |
| 3 | 3 | //::::::::::::::::::::::::::::::::::::::::: |
| 4 | -if (is_file($base_path . 'assets/cache/siteManager.php')) { |
|
| 5 | - include_once($base_path . 'assets/cache/siteManager.php'); |
|
| 4 | +if (is_file($base_path.'assets/cache/siteManager.php')) { |
|
| 5 | + include_once($base_path.'assets/cache/siteManager.php'); |
|
| 6 | 6 | } |
| 7 | 7 | if (!defined('MGR_DIR')) { |
| 8 | 8 | define('MGR_DIR', 'manager'); |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | -require_once(dirname(dirname(dirname(__DIR__))) . '/' . MGR_DIR . '/includes/version.inc.php'); |
|
| 11 | +require_once(dirname(dirname(dirname(__DIR__))).'/'.MGR_DIR.'/includes/version.inc.php'); |
|
| 12 | 12 | |
| 13 | -$chunkPath = $base_path . 'install/assets/chunks'; |
|
| 14 | -$snippetPath = $base_path . 'install/assets/snippets'; |
|
| 15 | -$pluginPath = $base_path . 'install/assets/plugins'; |
|
| 16 | -$modulePath = $base_path . 'install/assets/modules'; |
|
| 17 | -$templatePath = $base_path . 'install/assets/templates'; |
|
| 18 | -$tvPath = $base_path . 'install/assets/tvs'; |
|
| 13 | +$chunkPath = $base_path.'install/assets/chunks'; |
|
| 14 | +$snippetPath = $base_path.'install/assets/snippets'; |
|
| 15 | +$pluginPath = $base_path.'install/assets/plugins'; |
|
| 16 | +$modulePath = $base_path.'install/assets/modules'; |
|
| 17 | +$templatePath = $base_path.'install/assets/templates'; |
|
| 18 | +$tvPath = $base_path.'install/assets/tvs'; |
|
| 19 | 19 | |
| 20 | 20 | // setup Template template files - array : name, description, type - 0:file or 1:content, parameters, category |
| 21 | 21 | $mt = &$moduleTemplates; |
@@ -28,8 +28,7 @@ discard block |
||
| 28 | 28 | $params = parse_docblock($templatePath, $tplfile); |
| 29 | 29 | if (is_array($params) && (count($params) > 0)) { |
| 30 | 30 | $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}"; |
| 31 | - $mt[] = array |
|
| 32 | - ( |
|
| 31 | + $mt[] = array( |
|
| 33 | 32 | $params['name'], |
| 34 | 33 | $description, |
| 35 | 34 | // Don't think this is gonna be used ... but adding it just in case 'type' |
@@ -149,7 +148,7 @@ discard block |
||
| 149 | 148 | $params['modx_category'], |
| 150 | 149 | $params['legacy_names'], |
| 151 | 150 | array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false, |
| 152 | - (int)$params['disabled'] |
|
| 151 | + (int) $params['disabled'] |
|
| 153 | 152 | ); |
| 154 | 153 | } |
| 155 | 154 | } |
@@ -174,12 +173,12 @@ discard block |
||
| 174 | 173 | "$modulePath/{$params['filename']}", |
| 175 | 174 | $params['properties'], |
| 176 | 175 | $params['guid'], |
| 177 | - (int)$params['shareparams'], |
|
| 176 | + (int) $params['shareparams'], |
|
| 178 | 177 | $params['modx_category'], |
| 179 | 178 | array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false |
| 180 | 179 | ); |
| 181 | 180 | } |
| 182 | - if ((int)$params['shareparams'] || !empty($params['dependencies'])) { |
|
| 181 | + if ((int) $params['shareparams'] || !empty($params['dependencies'])) { |
|
| 183 | 182 | $dependencies = explode(',', $params['dependencies']); |
| 184 | 183 | foreach ($dependencies as $dependency) { |
| 185 | 184 | $dependency = explode(':', $dependency); |