Completed
Push — develop ( acc675...3313cf )
by Dmytro
12:18
created
index.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -50,16 +50,16 @@  discard block
 block discarded – undo
50 50
 	include_once($autoloader);
51 51
 }
52 52
 
53
-if(!isset($_SERVER['REQUEST_TIME_FLOAT'])) $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true);
53
+if (!isset($_SERVER['REQUEST_TIME_FLOAT'])) $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true);
54 54
 
55
-$base_path = str_replace('\\','/',dirname(__FILE__)) . '/';
56
-if(is_file($base_path . 'assets/cache/siteManager.php'))
57
-    include_once($base_path . 'assets/cache/siteManager.php');
58
-if(!defined('MGR_DIR') && is_dir("{$base_path}manager"))
55
+$base_path = str_replace('\\', '/', dirname(__FILE__)).'/';
56
+if (is_file($base_path.'assets/cache/siteManager.php'))
57
+    include_once($base_path.'assets/cache/siteManager.php');
58
+if (!defined('MGR_DIR') && is_dir("{$base_path}manager"))
59 59
 	define('MGR_DIR', 'manager');
60
-if(is_file($base_path . 'assets/cache/siteHostnames.php'))
61
-    include_once($base_path . 'assets/cache/siteHostnames.php');
62
-if(!defined('MODX_SITE_HOSTNAMES'))
60
+if (is_file($base_path.'assets/cache/siteHostnames.php'))
61
+    include_once($base_path.'assets/cache/siteHostnames.php');
62
+if (!defined('MODX_SITE_HOSTNAMES'))
63 63
 	define('MODX_SITE_HOSTNAMES', '');
64 64
 
65 65
 // get start time
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 // set some settings, and address some IE issues
72 72
 @ini_set('url_rewriter.tags', '');
73 73
 @ini_set('session.use_trans_sid', 0);
74
-@ini_set('session.use_only_cookies',1);
74
+@ini_set('session.use_only_cookies', 1);
75 75
 session_cache_limiter('');
76 76
 header('P3P: CP="NOI NID ADMa OUR IND UNI COM NAV"'); // header for weird cookie stuff. Blame IE.
77 77
 header('Cache-Control: private, must-revalidate');
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
  */
84 84
 
85 85
 define('IN_PARSER_MODE', true);
86
-if ( ! defined('IN_MANAGER_MODE')) {
86
+if (!defined('IN_MANAGER_MODE')) {
87 87
 	define('IN_MANAGER_MODE', false);
88 88
 }
89 89
 if (!defined('MODX_API_MODE')) {
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
 }
92 92
 
93 93
 // get the required includes
94
-if(! isset($database_user) || $database_user==="") {
95
-    $rt = @include_once(__DIR__ . '/' . MGR_DIR . '/includes/config.inc.php');
94
+if (!isset($database_user) || $database_user === "") {
95
+    $rt = @include_once(__DIR__.'/'.MGR_DIR.'/includes/config.inc.php');
96 96
     $path = 'install/src/template/not_installed.tpl';
97 97
     // Be sure config.inc.php is there and that it contains some important values
98 98
     if (!$rt || !$database_type || !$database_server || !$database_user || !$dbase) {
@@ -128,13 +128,13 @@  discard block
 block discarded – undo
128 128
 $modx->stopOnNotice = false;
129 129
 
130 130
 // Don't show PHP errors to the public
131
-if(!isset($_SESSION['mgrValidated']) || !$_SESSION['mgrValidated']) {
132
-    @ini_set("display_errors","0");
131
+if (!isset($_SESSION['mgrValidated']) || !$_SESSION['mgrValidated']) {
132
+    @ini_set("display_errors", "0");
133 133
 }
134 134
 
135
-if(MODX_CLI){
135
+if (MODX_CLI) {
136 136
     @set_time_limit(0);
137
-    @ini_set('max_execution_time',0);
137
+    @ini_set('max_execution_time', 0);
138 138
 }
139 139
 
140 140
 // execute the parser if index.php was not included
Please login to merge, or discard this patch.
install/cli-install.php 1 patch
Spacing   +276 added lines, -277 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 $self = 'install/cli-install.php';
10
-$path = __DIR__ . '/';
11
-$base_path = dirname(__DIR__) . '/';
10
+$path = __DIR__.'/';
11
+$base_path = dirname(__DIR__).'/';
12 12
 define('MODX_API_MODE', true);
13 13
 define('MODX_BASE_PATH', $base_path);
14 14
 define('MODX_SITE_URL', '/');
@@ -18,22 +18,22 @@  discard block
 block discarded – undo
18 18
 // set error reporting
19 19
 error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
20 20
 
21
-if (is_file($base_path . "assets/cache/siteManager.php")) {
22
-    include_once($base_path . "assets/cache/siteManager.php");
21
+if (is_file($base_path."assets/cache/siteManager.php")) {
22
+    include_once($base_path."assets/cache/siteManager.php");
23 23
 }
24
-if (!defined('MGR_DIR') && is_dir($base_path . "manager")) {
24
+if (!defined('MGR_DIR') && is_dir($base_path."manager")) {
25 25
     define('MGR_DIR', 'manager');
26 26
 }
27 27
 
28 28
 require_once 'src/lang.php';
29
-require_once($base_path . MGR_DIR . '/includes/version.inc.php');
29
+require_once($base_path.MGR_DIR.'/includes/version.inc.php');
30 30
 
31 31
 $moduleName = "EVO";
32
-$moduleVersion = $modx_branch . ' ' . $modx_version;
32
+$moduleVersion = $modx_branch.' '.$modx_version;
33 33
 $moduleRelease = $modx_release_date;
34
-$moduleSQLBaseFile = $path . '/src/stubs/sql/setup.sql';
35
-$moduleSQLDataFile = $path . 'src/stubs/sql/setup.data.sql';
36
-$moduleSQLResetFile = $path . 'src/stubs/sql/setup.data.reset.sql';
34
+$moduleSQLBaseFile = $path.'/src/stubs/sql/setup.sql';
35
+$moduleSQLDataFile = $path.'src/stubs/sql/setup.data.sql';
36
+$moduleSQLResetFile = $path.'src/stubs/sql/setup.data.reset.sql';
37 37
 
38 38
 $moduleChunks = array(); // chunks - array : name, description, type - 0:file or 1:content, file or content
39 39
 $moduleTemplates = array(); // templates - array : name, description, type - 0:file or 1:content, file or content
@@ -48,29 +48,29 @@  discard block
 block discarded – undo
48 48
 
49 49
 $installMode = 0;
50 50
 $installData = 0;
51
-$tableprefixauto = base_convert(rand(10, 20), 10, 36) . substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyz'),
52
-        rand(0, 33), 3) . '_';
51
+$tableprefixauto = base_convert(rand(10, 20), 10, 36).substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyz'),
52
+        rand(0, 33), 3).'_';
53 53
 
54 54
 $args = array_slice($argv, 1);
55 55
 
56 56
 if (empty($args)) {
57
-    echo 'Install Evolution CMS' . PHP_EOL;
57
+    echo 'Install Evolution CMS'.PHP_EOL;
58 58
     //$installYes = readline("Type 'y' to continue: ");
59 59
     //if ($installYes != 'y') return;
60 60
 
61 61
     //set param manual
62
-    $databasehost = readline($_lang['connection_screen_database_host'] . ' [localhost] ');
63
-    $databaseloginname = readline($_lang['connection_screen_database_login'] . ' ');
64
-    $databaseloginpassword = readline($_lang['connection_screen_database_pass'] . ' ');
65
-    $database_name = readline($_lang['connection_screen_database_name'] . ' ');
66
-    $tableprefix = readline($_lang['connection_screen_table_prefix'] . ' [' . $tableprefixauto . '] ');
67
-    $database_connection_method = readline($_lang['connection_screen_connection_method'] . ' [SET CHARACTER SET] ');
68
-    $database_collation = readline($_lang['connection_screen_collation'] . ' [utf8_general_ci] ');
69
-    $cmsadmin = readline($_lang['connection_screen_default_admin_login'] . ' [admin] ');
70
-    $cmsadminemail = readline($_lang['connection_screen_default_admin_email'] . ' ');
71
-    $cmspassword = readline($_lang['connection_screen_default_admin_password'] . ' ');
72
-    $managerlanguage = readline('Мanager language:' . ' [en] ');
73
-    $installData = readline('Instal demo-site (y/n):' . ' [n] ');
62
+    $databasehost = readline($_lang['connection_screen_database_host'].' [localhost] ');
63
+    $databaseloginname = readline($_lang['connection_screen_database_login'].' ');
64
+    $databaseloginpassword = readline($_lang['connection_screen_database_pass'].' ');
65
+    $database_name = readline($_lang['connection_screen_database_name'].' ');
66
+    $tableprefix = readline($_lang['connection_screen_table_prefix'].' ['.$tableprefixauto.'] ');
67
+    $database_connection_method = readline($_lang['connection_screen_connection_method'].' [SET CHARACTER SET] ');
68
+    $database_collation = readline($_lang['connection_screen_collation'].' [utf8_general_ci] ');
69
+    $cmsadmin = readline($_lang['connection_screen_default_admin_login'].' [admin] ');
70
+    $cmsadminemail = readline($_lang['connection_screen_default_admin_email'].' ');
71
+    $cmspassword = readline($_lang['connection_screen_default_admin_password'].' ');
72
+    $managerlanguage = readline('Мanager language:'.' [en] ');
73
+    $installData = readline('Instal demo-site (y/n):'.' [n] ');
74 74
 
75 75
 } else {
76 76
 
@@ -169,114 +169,114 @@  discard block
 block discarded – undo
169 169
 // check PHP version
170 170
 define('PHP_MIN_VERSION', '5.4.0');
171 171
 $phpMinVersion = PHP_MIN_VERSION; // Maybe not necessary. For backward compatibility
172
-echo PHP_EOL . $_lang['checking_php_version'];
172
+echo PHP_EOL.$_lang['checking_php_version'];
173 173
 // -1 if left is less, 0 if equal, +1 if left is higher
174 174
 if (version_compare(phpversion(), PHP_MIN_VERSION) < 0) {
175 175
     $errors++;
176
-    $tmp = $_lang['you_running_php'] . phpversion() . str_replace('[+min_version+]', PHP_MIN_VERSION,
176
+    $tmp = $_lang['you_running_php'].phpversion().str_replace('[+min_version+]', PHP_MIN_VERSION,
177 177
             $_lang["modx_requires_php"]);
178
-    echo $_lang['failed'] . ' ' . $tmp . PHP_EOL;
178
+    echo $_lang['failed'].' '.$tmp.PHP_EOL;
179 179
 } else {
180
-    echo $_lang['ok'] . PHP_EOL;
180
+    echo $_lang['ok'].PHP_EOL;
181 181
 }
182 182
 
183 183
 // check directories
184 184
 // cache exists?
185 185
 echo strip_tags($_lang['checking_if_cache_exist']);
186
-if (!file_exists($path . "../assets/cache") || !file_exists($path . "../assets/cache/rss")) {
187
-    echo $_lang['failed'] . PHP_EOL;
186
+if (!file_exists($path."../assets/cache") || !file_exists($path."../assets/cache/rss")) {
187
+    echo $_lang['failed'].PHP_EOL;
188 188
     $errors++;
189 189
 } else {
190
-    echo $_lang['ok'] . PHP_EOL;
190
+    echo $_lang['ok'].PHP_EOL;
191 191
 }
192 192
 
193 193
 
194 194
 // cache writable?
195 195
 echo strip_tags($_lang['checking_if_cache_writable']);
196
-if (!is_writable($path . "../assets/cache")) {
196
+if (!is_writable($path."../assets/cache")) {
197 197
     $errors++;
198
-    echo $_lang['failed'] . PHP_EOL;
198
+    echo $_lang['failed'].PHP_EOL;
199 199
 } else {
200
-    echo $_lang['ok'] . PHP_EOL;
200
+    echo $_lang['ok'].PHP_EOL;
201 201
 }
202 202
 
203 203
 
204 204
 // cache files writable?
205 205
 echo strip_tags($_lang['checking_if_cache_file_writable']);
206
-$tmp = $path . "../assets/cache/siteCache.idx.php";
206
+$tmp = $path."../assets/cache/siteCache.idx.php";
207 207
 if (!file_exists($tmp)) {
208 208
     f_owc($tmp, "<?php //EVO site cache file ?>");
209 209
 }
210 210
 if (!is_writable($tmp)) {
211 211
     $errors++;
212
-    echo $_lang['failed'] . PHP_EOL;
212
+    echo $_lang['failed'].PHP_EOL;
213 213
 } else {
214
-    echo $_lang['ok'] . PHP_EOL;
214
+    echo $_lang['ok'].PHP_EOL;
215 215
 }
216 216
 
217 217
 
218 218
 echo strip_tags($_lang['checking_if_cache_file2_writable']);
219
-if (!is_writable($path . "../assets/cache/sitePublishing.idx.php")) {
219
+if (!is_writable($path."../assets/cache/sitePublishing.idx.php")) {
220 220
     $errors++;
221
-    echo $_lang['failed'] . PHP_EOL;
221
+    echo $_lang['failed'].PHP_EOL;
222 222
 } else {
223
-    echo $_lang['ok'] . PHP_EOL;
223
+    echo $_lang['ok'].PHP_EOL;
224 224
 }
225 225
 
226 226
 
227 227
 // File Browser directories exists?
228 228
 echo strip_tags($_lang['checking_if_images_exist']);
229 229
 switch (true) {
230
-    case !file_exists($path . "../assets/images"):
231
-    case !file_exists($path . "../assets/files"):
232
-    case !file_exists($path . "../assets/backup"):
230
+    case !file_exists($path."../assets/images"):
231
+    case !file_exists($path."../assets/files"):
232
+    case !file_exists($path."../assets/backup"):
233 233
         //case !file_exists("../assets/.thumbs"):
234 234
         $errors++;
235
-        echo $_lang['failed'] . PHP_EOL;
235
+        echo $_lang['failed'].PHP_EOL;
236 236
         break;
237 237
     default:
238
-        echo $_lang['ok'] . PHP_EOL;
238
+        echo $_lang['ok'].PHP_EOL;
239 239
 }
240 240
 
241 241
 
242 242
 // File Browser directories writable?
243 243
 echo strip_tags($_lang['checking_if_images_writable']);
244 244
 switch (true) {
245
-    case !is_writable($path . "../assets/images"):
246
-    case !is_writable($path . "../assets/files"):
247
-    case !is_writable($path . "../assets/backup"):
245
+    case !is_writable($path."../assets/images"):
246
+    case !is_writable($path."../assets/files"):
247
+    case !is_writable($path."../assets/backup"):
248 248
         //case !is_writable("../assets/.thumbs"):
249 249
         $errors++;
250
-        echo $_lang['failed'] . PHP_EOL;
250
+        echo $_lang['failed'].PHP_EOL;
251 251
         break;
252 252
     default:
253
-        echo $_lang['ok'] . PHP_EOL;
253
+        echo $_lang['ok'].PHP_EOL;
254 254
 }
255 255
 
256 256
 
257 257
 // export exists?
258 258
 echo strip_tags($_lang['checking_if_export_exists']);
259
-if (!file_exists($path . "../assets/export")) {
260
-    echo $_lang['failed'] . PHP_EOL;
259
+if (!file_exists($path."../assets/export")) {
260
+    echo $_lang['failed'].PHP_EOL;
261 261
     $errors++;
262 262
 } else {
263
-    echo $_lang['ok'] . PHP_EOL;
263
+    echo $_lang['ok'].PHP_EOL;
264 264
 }
265 265
 
266 266
 
267 267
 // export writable?
268 268
 echo strip_tags($_lang['checking_if_export_writable']);
269
-if (!is_writable($path . "../assets/export")) {
270
-    echo $_lang['failed'] . PHP_EOL;
269
+if (!is_writable($path."../assets/export")) {
270
+    echo $_lang['failed'].PHP_EOL;
271 271
     $errors++;
272 272
 } else {
273
-    echo $_lang['ok'] . PHP_EOL;
273
+    echo $_lang['ok'].PHP_EOL;
274 274
 }
275 275
 
276 276
 
277 277
 // config.inc.php writable?
278 278
 echo strip_tags($_lang['checking_if_config_exist_and_writable']);
279
-$tmp = $path . "../" . MGR_DIR . "/includes/config.inc.php";
279
+$tmp = $path."../".MGR_DIR."/includes/config.inc.php";
280 280
 if (!is_file($tmp)) {
281 281
     f_owc($tmp, "<?php //EVO configuration file ?>", 0666);
282 282
 } else {
@@ -285,15 +285,15 @@  discard block
 block discarded – undo
285 285
 $isWriteable = is_writable($tmp);
286 286
 if (!$isWriteable) {
287 287
     $errors++;
288
-    echo $_lang['failed'] . PHP_EOL;
288
+    echo $_lang['failed'].PHP_EOL;
289 289
 } else {
290
-    echo $_lang['ok'] . PHP_EOL;
290
+    echo $_lang['ok'].PHP_EOL;
291 291
 }
292 292
 
293 293
 
294 294
 // connect to the database
295 295
 if ($installMode == 1) {
296
-    include $path . "../" . MGR_DIR . "/includes/config.inc.php";
296
+    include $path."../".MGR_DIR."/includes/config.inc.php";
297 297
 } else {
298 298
     // get db info from post
299 299
     $database_server = $databasehost;
@@ -303,22 +303,22 @@  discard block
 block discarded – undo
303 303
     $database_charset = substr($database_collation, 0, strpos($database_collation, '_') - 1);
304 304
     $database_connection_charset = $database_collation;
305 305
     $database_connection_method = $database_connection_method;
306
-    $dbase = '`' . $database_name . '`';
306
+    $dbase = '`'.$database_name.'`';
307 307
     $table_prefix = $tableprefix;
308 308
 }
309 309
 echo $_lang['creating_database_connection'];
310 310
 if (!$conn = mysqli_connect($database_server, $database_user, $database_password)) {
311 311
     $errors++;
312
-    echo $_lang['database_connection_failed'] . PHP_EOL;
312
+    echo $_lang['database_connection_failed'].PHP_EOL;
313 313
 } else {
314
-    echo $_lang['ok'] . PHP_EOL;
314
+    echo $_lang['ok'].PHP_EOL;
315 315
 }
316 316
 
317 317
 
318 318
 // make sure we can use the database
319 319
 if ($installMode > 0 && !mysqli_query($conn, "USE {$dbase}")) {
320 320
     $errors++;
321
-    echo $_lang['database_use_failed'] . PHP_EOL;
321
+    echo $_lang['database_use_failed'].PHP_EOL;
322 322
 }
323 323
 
324 324
 // check the database collation if not specified in the configuration
@@ -343,22 +343,22 @@  discard block
 block discarded – undo
343 343
 
344 344
 // check table prefix
345 345
 if ($conn && $installMode == 0) {
346
-    echo $_lang['checking_table_prefix'] . $table_prefix . '`: ';
347
-    if ($rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) {
348
-        echo $_lang['failed'] . ' ' . $_lang['table_prefix_already_inuse_note'] . PHP_EOL;
346
+    echo $_lang['checking_table_prefix'].$table_prefix.'`: ';
347
+    if ($rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) {
348
+        echo $_lang['failed'].' '.$_lang['table_prefix_already_inuse_note'].PHP_EOL;
349 349
         $errors++;
350 350
 
351 351
     } else {
352
-        echo $_lang['ok'] . PHP_EOL;
352
+        echo $_lang['ok'].PHP_EOL;
353 353
     }
354 354
 } elseif ($conn && $installMode == 2) {
355
-    echo $_lang['checking_table_prefix'] . $table_prefix . '`: ';
356
-    if (!$rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) {
357
-        echo $_lang['failed'] . ' ' . $_lang['table_prefix_not_exist'] . PHP_EOL;
355
+    echo $_lang['checking_table_prefix'].$table_prefix.'`: ';
356
+    if (!$rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) {
357
+        echo $_lang['failed'].' '.$_lang['table_prefix_not_exist'].PHP_EOL;
358 358
         $errors++;
359 359
 
360 360
     } else {
361
-        echo $_lang['ok'] . PHP_EOL;
361
+        echo $_lang['ok'].PHP_EOL;
362 362
     }
363 363
 }
364 364
 
@@ -366,10 +366,10 @@  discard block
 block discarded – undo
366 366
 if ($conn) {
367 367
     echo $_lang['checking_mysql_version'];
368 368
     if (version_compare(mysqli_get_server_info($conn), '5.0.51', '=')) {
369
-        echo $_lang['warning'] . ' ' . $_lang['mysql_5051'] . PHP_EOL;
370
-        echo $_lang['mysql_5051_warning'] . PHP_EOL;
369
+        echo $_lang['warning'].' '.$_lang['mysql_5051'].PHP_EOL;
370
+        echo $_lang['mysql_5051_warning'].PHP_EOL;
371 371
     } else {
372
-        echo $_lang['ok'] . ' ' . $_lang['mysql_version_is'] . mysqli_get_server_info($conn) . PHP_EOL;
372
+        echo $_lang['ok'].' '.$_lang['mysql_version_is'].mysqli_get_server_info($conn).PHP_EOL;
373 373
     }
374 374
 }
375 375
 
@@ -383,40 +383,40 @@  discard block
 block discarded – undo
383 383
         // print_r($modes);
384 384
         foreach ($modes as $mode) {
385 385
             if (stristr($mode, "STRICT_TRANS_TABLES") !== false || stristr($mode, "STRICT_ALL_TABLES") !== false) {
386
-                echo $_lang['warning'] . ' ' . $_lang['strict_mode'] . PHP_EOL;
387
-                echo $_lang['strict_mode_error'] . PHP_EOL;
386
+                echo $_lang['warning'].' '.$_lang['strict_mode'].PHP_EOL;
387
+                echo $_lang['strict_mode_error'].PHP_EOL;
388 388
             } else {
389
-                echo $_lang['ok'] . PHP_EOL;
389
+                echo $_lang['ok'].PHP_EOL;
390 390
             }
391 391
         }
392 392
     } else {
393
-        echo $_lang['ok'] . PHP_EOL;
393
+        echo $_lang['ok'].PHP_EOL;
394 394
     }
395 395
 }
396 396
 // Version and strict mode check end
397 397
 
398 398
 // andrazk 20070416 - add install flag and disable manager login
399 399
 // assets/cache writable?
400
-if (is_writable($path . "../assets/cache")) {
401
-    if (file_exists($path . '../assets/cache/installProc.inc.php')) {
402
-        @chmod($path . '../assets/cache/installProc.inc.php', 0755);
403
-        unlink($path . '../assets/cache/installProc.inc.php');
400
+if (is_writable($path."../assets/cache")) {
401
+    if (file_exists($path.'../assets/cache/installProc.inc.php')) {
402
+        @chmod($path.'../assets/cache/installProc.inc.php', 0755);
403
+        unlink($path.'../assets/cache/installProc.inc.php');
404 404
     }
405 405
 
406
-    f_owc($path . "../assets/cache/installProc.inc.php", '<?php $installStartTime = ' . time() . '; ?>');
406
+    f_owc($path."../assets/cache/installProc.inc.php", '<?php $installStartTime = '.time().'; ?>');
407 407
 }
408 408
 
409 409
 if ($installMode > 0 && $_POST['installdata'] == "1") {
410
-    echo $_lang['sample_web_site'] . ': ' . $_lang['sample_web_site_note'] . PHP_EOL;
410
+    echo $_lang['sample_web_site'].': '.$_lang['sample_web_site_note'].PHP_EOL;
411 411
 }
412 412
 
413 413
 if ($errors > 0) {
414
-    echo $_lang['setup_cannot_continue'] . ' ';
414
+    echo $_lang['setup_cannot_continue'].' ';
415 415
 
416 416
     if ($errors > 1) {
417
-        echo $errors . " " . $_lang['errors'] . $_lang['please_correct_errors'] . $_lang['and_try_again_plural'];
417
+        echo $errors." ".$_lang['errors'].$_lang['please_correct_errors'].$_lang['and_try_again_plural'];
418 418
     } else {
419
-        echo $_lang['error'] . $_lang['please_correct_error'] . $_lang['and_try_again'] . PHP_EOL;
419
+        echo $_lang['error'].$_lang['please_correct_error'].$_lang['and_try_again'].PHP_EOL;
420 420
     }
421 421
 
422 422
     die();
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 
434 434
 
435 435
 if ($installMode == 1) {
436
-    include $path . "../" . MGR_DIR . "/includes/config.inc.php";
436
+    include $path."../".MGR_DIR."/includes/config.inc.php";
437 437
 } else {
438 438
     // get db info from post
439 439
     $database_server = $databasehost;
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
     $database_charset = substr($database_collation, 0, strpos($database_collation, '_'));
444 444
     $database_connection_charset = $database_charset;
445 445
     $database_connection_method = $database_connection_method;
446
-    $dbase = "`" . $database_name . "`";
446
+    $dbase = "`".$database_name."`";
447 447
     $table_prefix = $tableprefix;
448 448
     $adminname = $cmsadmin;
449 449
     $adminemail = $cmsadminemail;
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 
455 455
 // set session name variable
456 456
 if (!isset ($site_sessionname)) {
457
-    $site_sessionname = 'SN' . uniqid('');
457
+    $site_sessionname = 'SN'.uniqid('');
458 458
 }
459 459
 
460 460
 // get base path and url
@@ -470,64 +470,64 @@  discard block
 block discarded – undo
470 470
 }
471 471
 $pth = implode("install", $a);
472 472
 unset ($a);
473
-$base_url = $url . (substr($url, -1) != "/" ? "/" : "");
474
-$base_path = $pth . (substr($pth, -1) != "/" ? "/" : "");
473
+$base_url = $url.(substr($url, -1) != "/" ? "/" : "");
474
+$base_path = $pth.(substr($pth, -1) != "/" ? "/" : "");
475 475
 
476 476
 // connect to the database
477
-echo $_lang['setup_database_create_connection'] . ': ';
477
+echo $_lang['setup_database_create_connection'].': ';
478 478
 if (!$conn = mysqli_connect($database_server, $database_user, $database_password)) {
479
-    echo $_lang["setup_database_create_connection_failed"] . " " . $_lang['setup_database_create_connection_failed_note'] . PHP_EOL;
479
+    echo $_lang["setup_database_create_connection_failed"]." ".$_lang['setup_database_create_connection_failed_note'].PHP_EOL;
480 480
 
481 481
     return;
482 482
 } else {
483
-    echo $_lang['ok'] . PHP_EOL;
483
+    echo $_lang['ok'].PHP_EOL;
484 484
 }
485 485
 
486 486
 // select database
487
-echo $_lang['setup_database_selection'] . str_replace("`", "", $dbase) . "`: ";
487
+echo $_lang['setup_database_selection'].str_replace("`", "", $dbase)."`: ";
488 488
 if (!mysqli_select_db($conn, str_replace("`", "", $dbase))) {
489
-    echo $_lang['setup_database_selection_failed'] . " " . $_lang['setup_database_selection_failed_note'] . PHP_EOL;
489
+    echo $_lang['setup_database_selection_failed']." ".$_lang['setup_database_selection_failed_note'].PHP_EOL;
490 490
     $create = true;
491 491
 } else {
492 492
     if (function_exists('mysqli_set_charset')) {
493 493
         mysqli_set_charset($conn, $database_charset);
494 494
     }
495 495
     mysqli_query($conn, "{$database_connection_method} {$database_connection_charset}");
496
-    echo $_lang['ok'] . PHP_EOL;
496
+    echo $_lang['ok'].PHP_EOL;
497 497
 }
498 498
 
499 499
 // try to create the database
500 500
 if ($create) {
501
-    echo $_lang['setup_database_creation'] . str_replace("`", "", $dbase) . "`: ";
501
+    echo $_lang['setup_database_creation'].str_replace("`", "", $dbase)."`: ";
502 502
     //  if(!@mysqli_create_db(str_replace("`","",$dbase), $conn)) {
503 503
     if (!mysqli_query($conn,
504 504
         "CREATE DATABASE $dbase DEFAULT CHARACTER SET $database_charset COLLATE $database_collation")) {
505
-        echo $_lang['setup_database_creation_failed'] . " " . $_lang['setup_database_creation_failed_note'] . PHP_EOL;
505
+        echo $_lang['setup_database_creation_failed']." ".$_lang['setup_database_creation_failed_note'].PHP_EOL;
506 506
         $errors += 1;
507 507
 
508
-        echo 'database charset: ' . $database_charset . PHP_EOL;
509
-        echo 'database collation: ' . $database_collation . PHP_EOL;
508
+        echo 'database charset: '.$database_charset.PHP_EOL;
509
+        echo 'database collation: '.$database_collation.PHP_EOL;
510 510
 
511
-        echo $_lang['setup_database_creation_failed_note2'] . PHP_EOL;
511
+        echo $_lang['setup_database_creation_failed_note2'].PHP_EOL;
512 512
 
513 513
         die();
514 514
 
515 515
     } else {
516
-        echo $_lang['ok'] . PHP_EOL;
516
+        echo $_lang['ok'].PHP_EOL;
517 517
     }
518 518
 }
519 519
 
520 520
 // check table prefix
521 521
 if ($installMode == 0) {
522
-    echo $_lang['checking_table_prefix'] . $table_prefix . "`: ";
523
-    if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) {
524
-        echo $_lang['failed'] . " " . $_lang['table_prefix_already_inuse'] . PHP_EOL;
522
+    echo $_lang['checking_table_prefix'].$table_prefix."`: ";
523
+    if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) {
524
+        echo $_lang['failed']." ".$_lang['table_prefix_already_inuse'].PHP_EOL;
525 525
         $errors += 1;
526
-        echo $_lang['table_prefix_already_inuse_note'] . PHP_EOL;
526
+        echo $_lang['table_prefix_already_inuse_note'].PHP_EOL;
527 527
 
528 528
         return;
529 529
     } else {
530
-        echo $_lang['ok'] . PHP_EOL;
530
+        echo $_lang['ok'].PHP_EOL;
531 531
     }
532 532
 }
533 533
 
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 $auto_template_logic = 'parent';
570 570
 if ($installMode != 0) {
571 571
     $rs = mysqli_query($conn,
572
-        "SELECT properties, disabled FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='Inherit Parent Template'");
572
+        "SELECT properties, disabled FROM $dbase.`".$table_prefix."site_plugins` WHERE name='Inherit Parent Template'");
573 573
     $row = mysqli_fetch_row($rs);
574 574
     if (!$row) {
575 575
         // not installed
@@ -593,12 +593,12 @@  discard block
 block discarded – undo
593 593
 
594 594
 // open db connection
595 595
 $setupPath = realpath(__DIR__);
596
-$chunkPath = $path . 'assets/chunks';
597
-$snippetPath = $path . 'assets/snippets';
598
-$pluginPath = $path . 'assets/plugins';
599
-$modulePath = $path . 'assets/modules';
600
-$templatePath = $path . 'assets/templates';
601
-$tvPath = $path . 'assets/tvs';
596
+$chunkPath = $path.'assets/chunks';
597
+$snippetPath = $path.'assets/snippets';
598
+$pluginPath = $path.'assets/plugins';
599
+$modulePath = $path.'assets/modules';
600
+$templatePath = $path.'assets/templates';
601
+$tvPath = $path.'assets/tvs';
602 602
 
603 603
 // setup Template template files - array : name, description, type - 0:file or 1:content, parameters, category
604 604
 $mt = &$moduleTemplates;
@@ -611,8 +611,7 @@  discard block
 block discarded – undo
611 611
         $params = parse_docblock($templatePath, $tplfile);
612 612
         if (is_array($params) && (count($params) > 0)) {
613 613
             $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
614
-            $mt[] = array
615
-            (
614
+            $mt[] = array(
616 615
                 $params['name'],
617 616
                 $description,
618 617
                 // Don't think this is gonna be used ... but adding it just in case 'type'
@@ -732,7 +731,7 @@  discard block
 block discarded – undo
732 731
                 $params['modx_category'],
733 732
                 $params['legacy_names'],
734 733
                 array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false,
735
-                (int)$params['disabled']
734
+                (int) $params['disabled']
736 735
             );
737 736
         }
738 737
     }
@@ -757,12 +756,12 @@  discard block
 block discarded – undo
757 756
                 "$modulePath/{$params['filename']}",
758 757
                 $params['properties'],
759 758
                 $params['guid'],
760
-                (int)$params['shareparams'],
759
+                (int) $params['shareparams'],
761 760
                 $params['modx_category'],
762 761
                 array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false
763 762
             );
764 763
         }
765
-        if ((int)$params['shareparams'] || !empty($params['dependencies'])) {
764
+        if ((int) $params['shareparams'] || !empty($params['dependencies'])) {
766 765
             $dependencies = explode(',', $params['dependencies']);
767 766
             foreach ($dependencies as $dependency) {
768 767
                 $dependency = explode(':', $dependency);
@@ -840,46 +839,46 @@  discard block
 block discarded – undo
840 839
 
841 840
         // secure web documents - privateweb
842 841
         mysqli_query($sqlParser->conn,
843
-            "UPDATE `" . $sqlParser->prefix . "site_content` SET privateweb = 0 WHERE privateweb = 1");
842
+            "UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 0 WHERE privateweb = 1");
844 843
         $sql = "SELECT DISTINCT sc.id
845
-             FROM `" . $sqlParser->prefix . "site_content` sc
846
-             LEFT JOIN `" . $sqlParser->prefix . "document_groups` dg ON dg.document = sc.id
847
-             LEFT JOIN `" . $sqlParser->prefix . "webgroup_access` wga ON wga.documentgroup = dg.document_group
844
+             FROM `" . $sqlParser->prefix."site_content` sc
845
+             LEFT JOIN `" . $sqlParser->prefix."document_groups` dg ON dg.document = sc.id
846
+             LEFT JOIN `" . $sqlParser->prefix."webgroup_access` wga ON wga.documentgroup = dg.document_group
848 847
              WHERE wga.id>0";
849 848
         $ds = mysqli_query($sqlParser->conn, $sql);
850 849
         if (!$ds) {
851
-            echo "An error occurred while executing a query: " . mysqli_error($sqlParser->conn);
850
+            echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn);
852 851
         } else {
853 852
             while ($r = mysqli_fetch_assoc($ds)) {
854 853
                 $ids[] = $r["id"];
855 854
             }
856 855
             if (count($ids) > 0) {
857 856
                 mysqli_query($sqlParser->conn,
858
-                    "UPDATE `" . $sqlParser->prefix . "site_content` SET privateweb = 1 WHERE id IN (" . implode(", ",
859
-                        $ids) . ")");
857
+                    "UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ",
858
+                        $ids).")");
860 859
                 unset($ids);
861 860
             }
862 861
         }
863 862
 
864 863
         // secure manager documents privatemgr
865 864
         mysqli_query($sqlParser->conn,
866
-            "UPDATE `" . $sqlParser->prefix . "site_content` SET privatemgr = 0 WHERE privatemgr = 1");
865
+            "UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 0 WHERE privatemgr = 1");
867 866
         $sql = "SELECT DISTINCT sc.id
868
-             FROM `" . $sqlParser->prefix . "site_content` sc
869
-             LEFT JOIN `" . $sqlParser->prefix . "document_groups` dg ON dg.document = sc.id
870
-             LEFT JOIN `" . $sqlParser->prefix . "membergroup_access` mga ON mga.documentgroup = dg.document_group
867
+             FROM `" . $sqlParser->prefix."site_content` sc
868
+             LEFT JOIN `" . $sqlParser->prefix."document_groups` dg ON dg.document = sc.id
869
+             LEFT JOIN `" . $sqlParser->prefix."membergroup_access` mga ON mga.documentgroup = dg.document_group
871 870
              WHERE mga.id>0";
872 871
         $ds = mysqli_query($sqlParser->conn, $sql);
873 872
         if (!$ds) {
874
-            echo "An error occurred while executing a query: " . mysqli_error($sqlParser->conn);
873
+            echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn);
875 874
         } else {
876 875
             while ($r = mysqli_fetch_assoc($ds)) {
877 876
                 $ids[] = $r["id"];
878 877
             }
879 878
             if (count($ids) > 0) {
880 879
                 mysqli_query($sqlParser->conn,
881
-                    "UPDATE `" . $sqlParser->prefix . "site_content` SET privatemgr = 1 WHERE id IN (" . implode(", ",
882
-                        $ids) . ")");
880
+                    "UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ",
881
+                        $ids).")");
883 882
                 unset($ids);
884 883
             }
885 884
         }
@@ -890,7 +889,7 @@  discard block
 block discarded – undo
890 889
     function parse_docblock($element_dir, $filename)
891 890
     {
892 891
         $params = array();
893
-        $fullpath = $element_dir . '/' . $filename;
892
+        $fullpath = $element_dir.'/'.$filename;
894 893
         if (is_readable($fullpath)) {
895 894
             $tpl = @fopen($fullpath, "r");
896 895
             if ($tpl) {
@@ -955,7 +954,7 @@  discard block
 block discarded – undo
955 954
     }
956 955
 }
957 956
 
958
-include $path . "src/sqlParser.class.php";
957
+include $path."src/sqlParser.class.php";
959 958
 $sqlParser = new SqlParser($database_server, $database_user, $database_password, str_replace("`", "", $dbase),
960 959
     $table_prefix, $adminname, $adminemail, $adminpass, $database_connection_charset, $managerlanguage,
961 960
     $database_connection_method, $auto_template_logic);
@@ -976,21 +975,21 @@  discard block
 block discarded – undo
976 975
     // display database results
977 976
     if ($sqlParser->installFailed == true) {
978 977
         $errors += 1;
979
-        echo $_lang['database_alerts'] . PHP_EOL;
980
-        echo $_lang['setup_couldnt_install'] . PHP_EOL;
981
-        echo $_lang['installation_error_occured'] . PHP_EOL;
978
+        echo $_lang['database_alerts'].PHP_EOL;
979
+        echo $_lang['setup_couldnt_install'].PHP_EOL;
980
+        echo $_lang['installation_error_occured'].PHP_EOL;
982 981
         for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) {
983
-            echo $sqlParser->mysqlErrors[$i]["error"] . " " . $_lang['during_execution_of_sql'] . " " . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . PHP_EOL;
982
+            echo $sqlParser->mysqlErrors[$i]["error"]." ".$_lang['during_execution_of_sql']." ".strip_tags($sqlParser->mysqlErrors[$i]["sql"]).PHP_EOL;
984 983
         }
985
-        echo $_lang['some_tables_not_updated'] . PHP_EOL;
984
+        echo $_lang['some_tables_not_updated'].PHP_EOL;
986 985
         die();
987 986
     } else {
988
-        echo $_lang['ok'] . PHP_EOL;
987
+        echo $_lang['ok'].PHP_EOL;
989 988
     }
990 989
 }
991 990
 
992 991
 // custom or not
993
-if (file_exists($path . "../assets/cache/siteManager.php")) {
992
+if (file_exists($path."../assets/cache/siteManager.php")) {
994 993
     $mgrdir = 'include_once(__DIR__."/../../assets/cache/siteManager.php");';
995 994
 } else {
996 995
     $mgrdir = 'define(\'MGR_DIR\', \'manager\');';
@@ -1010,10 +1009,10 @@  discard block
 block discarded – undo
1010 1009
 $confph['lastInstallTime'] = time();
1011 1010
 $confph['site_sessionname'] = $site_sessionname;
1012 1011
 
1013
-$configString = file_get_contents($path . 'src/stubs/config.tpl');
1012
+$configString = file_get_contents($path.'src/stubs/config.tpl');
1014 1013
 $configString = parse($configString, $confph);
1015 1014
 
1016
-$filename = $base_path . MGR_DIR . '/includes/config.inc.php';
1015
+$filename = $base_path.MGR_DIR.'/includes/config.inc.php';
1017 1016
 $configFileFailed = false;
1018 1017
 if (@ !$handle = fopen($filename, 'w')) {
1019 1018
     $configFileFailed = true;
@@ -1029,38 +1028,38 @@  discard block
 block discarded – undo
1029 1028
 $chmodSuccess = @chmod($filename, 0404);
1030 1029
 
1031 1030
 if ($configFileFailed == true) {
1032
-    echo $_lang['failed'] . PHP_EOL;
1031
+    echo $_lang['failed'].PHP_EOL;
1033 1032
     $errors += 1;
1034 1033
 
1035
-    echo $_lang['cant_write_config_file'] . ' ' . MGR_DIR . '/includes/config.inc.php' . PHP_EOL;
1036
-    echo ' ' . PHP_EOL;
1037
-    echo ' ' . PHP_EOL;
1034
+    echo $_lang['cant_write_config_file'].' '.MGR_DIR.'/includes/config.inc.php'.PHP_EOL;
1035
+    echo ' '.PHP_EOL;
1036
+    echo ' '.PHP_EOL;
1038 1037
     echo $configString;
1039
-    echo ' ' . PHP_EOL;
1040
-    echo ' ' . PHP_EOL;
1041
-    echo $_lang['cant_write_config_file_note'] . PHP_EOL;
1038
+    echo ' '.PHP_EOL;
1039
+    echo ' '.PHP_EOL;
1040
+    echo $_lang['cant_write_config_file_note'].PHP_EOL;
1042 1041
     die();
1043 1042
 
1044 1043
 } else {
1045
-    echo $_lang['ok'] . PHP_EOL;
1044
+    echo $_lang['ok'].PHP_EOL;
1046 1045
 }
1047 1046
 
1048 1047
 // generate new site_id and set manager theme to default
1049 1048
 if ($installMode == 0) {
1050 1049
     $siteid = uniqid('');
1051 1050
     mysqli_query($sqlParser->conn,
1052
-        "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')");
1051
+        "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')");
1053 1052
 } else {
1054 1053
     // update site_id if missing
1055 1054
     $ds = mysqli_query($sqlParser->conn,
1056
-        "SELECT setting_name,setting_value FROM $dbase.`" . $table_prefix . "system_settings` WHERE setting_name='site_id'");
1055
+        "SELECT setting_name,setting_value FROM $dbase.`".$table_prefix."system_settings` WHERE setting_name='site_id'");
1057 1056
     if ($ds) {
1058 1057
         $r = mysqli_fetch_assoc($ds);
1059 1058
         $siteid = $r['setting_value'];
1060 1059
         if ($siteid == '' || $siteid = 'MzGeQ2faT4Dw06+U49x3') {
1061 1060
             $siteid = uniqid('');
1062 1061
             mysqli_query($sqlParser->conn,
1063
-                "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')");
1062
+                "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')");
1064 1063
         }
1065 1064
     }
1066 1065
 }
@@ -1072,25 +1071,25 @@  discard block
 block discarded – undo
1072 1071
     // display database results
1073 1072
     if ($sqlParser->installFailed == true) {
1074 1073
         $errors += 1;
1075
-        echo $_lang['database_alerts'] . PHP_EOL;
1076
-        echo $_lang['setup_couldnt_install'] . PHP_EOL;
1077
-        echo $_lang['installation_error_occured'] . PHP_EOL . PHP_EOL;
1074
+        echo $_lang['database_alerts'].PHP_EOL;
1075
+        echo $_lang['setup_couldnt_install'].PHP_EOL;
1076
+        echo $_lang['installation_error_occured'].PHP_EOL.PHP_EOL;
1078 1077
         /*
1079 1078
         for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) {
1080 1079
             echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />";
1081 1080
         }
1082 1081
         echo "</p>";*/
1083
-        echo $_lang['some_tables_not_updated'] . PHP_EOL;
1082
+        echo $_lang['some_tables_not_updated'].PHP_EOL;
1084 1083
         die();
1085 1084
     } else {
1086
-        echo $_lang['ok'] . PHP_EOL;
1085
+        echo $_lang['ok'].PHP_EOL;
1087 1086
     }
1088 1087
 }
1089 1088
 
1090 1089
 // Install Templates
1091 1090
 $moduleTemplate = $mt;
1092 1091
 if (!empty($moduleTemplate) || $installData) {
1093
-    echo PHP_EOL . $_lang['templates'] . ":" . PHP_EOL;
1092
+    echo PHP_EOL.$_lang['templates'].":".PHP_EOL;
1094 1093
     //$selTemplates = $_POST['template'];
1095 1094
     foreach ($moduleTemplates as $k => $moduleTemplate) {
1096 1095
         $installSample = in_array('sample', $moduleTemplate[6]) && $installData == 1;
@@ -1102,7 +1101,7 @@  discard block
 block discarded – undo
1102 1101
             $filecontent = $moduleTemplate[3];
1103 1102
             $save_sql_id_as = $moduleTemplate[7]; // Nessecary for demo-site
1104 1103
             if (!file_exists($filecontent)) {
1105
-                echo "  $name: " . $_lang['unable_install_template'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1104
+                echo "  $name: ".$_lang['unable_install_template']." '$filecontent' ".$_lang['not_found'].PHP_EOL;
1106 1105
             } else {
1107 1106
                 // Create the category if it does not already exist
1108 1107
                 $category_id = getCreateDbCategory($category, $sqlParser);
@@ -1113,13 +1112,13 @@  discard block
 block discarded – undo
1113 1112
 
1114 1113
                 // See if the template already exists
1115 1114
                 $rs = mysqli_query($sqlParser->conn,
1116
-                    "SELECT * FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name'");
1115
+                    "SELECT * FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name'");
1117 1116
 
1118 1117
                 if (mysqli_num_rows($rs)) {
1119 1118
                     if (!mysqli_query($sqlParser->conn,
1120
-                        "UPDATE $dbase.`" . $table_prefix . "site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;")) {
1119
+                        "UPDATE $dbase.`".$table_prefix."site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;")) {
1121 1120
                         $errors += 1;
1122
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1121
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1123 1122
 
1124 1123
                         return;
1125 1124
                     }
@@ -1127,23 +1126,23 @@  discard block
 block discarded – undo
1127 1126
                         $sql_id = @mysqli_insert_id($sqlParser->conn);
1128 1127
                         if (!$sql_id) {
1129 1128
                             $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn,
1130
-                                "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name' LIMIT 1;"));
1129
+                                "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name' LIMIT 1;"));
1131 1130
                             $sql_id = $idQuery['id'];
1132 1131
                         }
1133 1132
                         $custom_placeholders[$save_sql_id_as] = $sql_id;
1134 1133
                     }
1135
-                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1134
+                    echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1136 1135
                 } else {
1137 1136
                     if (!@ mysqli_query($sqlParser->conn,
1138
-                        "INSERT INTO $dbase.`" . $table_prefix . "site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) {
1137
+                        "INSERT INTO $dbase.`".$table_prefix."site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) {
1139 1138
                         $errors += 1;
1140
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1139
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1141 1140
                         die();
1142 1141
                     }
1143 1142
                     if (!is_null($save_sql_id_as)) {
1144 1143
                         $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn);
1145 1144
                     }
1146
-                    echo "  $name: " . $_lang['installed'] . PHP_EOL;
1145
+                    echo "  $name: ".$_lang['installed'].PHP_EOL;
1147 1146
                 }
1148 1147
             }
1149 1148
         }
@@ -1153,7 +1152,7 @@  discard block
 block discarded – undo
1153 1152
 // Install Template Variables
1154 1153
 $moduleTVs = $mtv;
1155 1154
 if (is_array($moduleTVs) || $installData) {
1156
-    echo PHP_EOL . $_lang['tvs'] . ': ' . PHP_EOL;
1155
+    echo PHP_EOL.$_lang['tvs'].': '.PHP_EOL;
1157 1156
     //$selTVs = $_POST['tv'];
1158 1157
     foreach ($moduleTVs as $k => $moduleTV) {
1159 1158
         $installSample = in_array('sample', $moduleTV[12]) && $installData == 1;
@@ -1176,27 +1175,27 @@  discard block
 block discarded – undo
1176 1175
             $category = getCreateDbCategory($category, $sqlParser);
1177 1176
 
1178 1177
             $rs = mysqli_query($sqlParser->conn,
1179
-                "SELECT * FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name'");
1178
+                "SELECT * FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name'");
1180 1179
             if (mysqli_num_rows($rs)) {
1181 1180
                 $insert = true;
1182 1181
                 while ($row = mysqli_fetch_assoc($rs)) {
1183 1182
                     if (!mysqli_query($sqlParser->conn,
1184
-                        "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']};")) {
1185
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1183
+                        "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']};")) {
1184
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1186 1185
 
1187 1186
                         return;
1188 1187
                     }
1189 1188
                     $insert = false;
1190 1189
                 }
1191
-                echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1190
+                echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1192 1191
             } else {
1193
-                $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');";
1192
+                $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');";
1194 1193
                 if (!mysqli_query($sqlParser->conn, $q)) {
1195
-                    echo mysqli_error($sqlParser->conn) . PHP_EOL;
1194
+                    echo mysqli_error($sqlParser->conn).PHP_EOL;
1196 1195
 
1197 1196
                     return;
1198 1197
                 }
1199
-                echo "  $name: " . $_lang['installed'] . PHP_EOL;
1198
+                echo "  $name: ".$_lang['installed'].PHP_EOL;
1200 1199
             }
1201 1200
 
1202 1201
             // add template assignments
@@ -1206,22 +1205,22 @@  discard block
 block discarded – undo
1206 1205
 
1207 1206
                 // remove existing tv -> template assignments
1208 1207
                 $ds = mysqli_query($sqlParser->conn,
1209
-                    "SELECT id FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name' AND description='$desc';");
1208
+                    "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';");
1210 1209
                 $row = mysqli_fetch_assoc($ds);
1211 1210
                 $id = $row["id"];
1212 1211
                 mysqli_query($sqlParser->conn,
1213
-                    'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_tmplvar_templates` WHERE tmplvarid = \'' . $id . '\'');
1212
+                    'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_tmplvar_templates` WHERE tmplvarid = \''.$id.'\'');
1214 1213
 
1215 1214
                 // add tv -> template assignments
1216 1215
                 foreach ($assignments as $assignment) {
1217 1216
                     $template = mysqli_real_escape_string($conn, $assignment);
1218 1217
                     $ts = mysqli_query($sqlParser->conn,
1219
-                        "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$template';");
1218
+                        "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$template';");
1220 1219
                     if ($ds && $ts) {
1221 1220
                         $tRow = mysqli_fetch_assoc($ts);
1222 1221
                         $templateId = $tRow['id'];
1223 1222
                         mysqli_query($sqlParser->conn,
1224
-                            "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)");
1223
+                            "INSERT INTO $dbase.`".$table_prefix."site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)");
1225 1224
                     }
1226 1225
                 }
1227 1226
             }
@@ -1233,7 +1232,7 @@  discard block
 block discarded – undo
1233 1232
 $moduleChunks = $mc;
1234 1233
 // Install Chunks
1235 1234
 if (is_array($moduleChunks) || $installData) {
1236
-    echo PHP_EOL . $_lang['chunks'] . ": " . PHP_EOL;
1235
+    echo PHP_EOL.$_lang['chunks'].": ".PHP_EOL;
1237 1236
     foreach ($moduleChunks as $k => $moduleChunk) {
1238 1237
         $installSample = in_array('sample', $moduleChunk[5]) && $installData == 1;
1239 1238
         $count_new_name = 0;
@@ -1246,7 +1245,7 @@  discard block
 block discarded – undo
1246 1245
             $filecontent = $moduleChunk[2];
1247 1246
 
1248 1247
             if (!file_exists($filecontent)) {
1249
-                echo "  $name: " . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1248
+                echo "  $name: ".$_lang['unable_install_chunk']." '$filecontent' ".$_lang['not_found'].PHP_EOL;
1250 1249
             } else {
1251 1250
 
1252 1251
                 // Create the category if it does not already exist
@@ -1255,36 +1254,36 @@  discard block
 block discarded – undo
1255 1254
                 $chunk = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', file_get_contents($filecontent), 1);
1256 1255
                 $chunk = mysqli_real_escape_string($conn, $chunk);
1257 1256
                 $rs = mysqli_query($sqlParser->conn,
1258
-                    "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$name'");
1257
+                    "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$name'");
1259 1258
                 $count_original_name = mysqli_num_rows($rs);
1260 1259
                 if ($overwrite == 'false') {
1261
-                    $newname = $name . '-' . str_replace('.', '_', $modx_version);
1260
+                    $newname = $name.'-'.str_replace('.', '_', $modx_version);
1262 1261
                     $rs = mysqli_query($sqlParser->conn,
1263
-                        "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$newname'");
1262
+                        "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$newname'");
1264 1263
                     $count_new_name = mysqli_num_rows($rs);
1265 1264
                 }
1266 1265
                 $update = $count_original_name > 0 && $overwrite == 'true';
1267 1266
                 if ($update) {
1268 1267
                     if (!mysqli_query($sqlParser->conn,
1269
-                        "UPDATE $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
1268
+                        "UPDATE $dbase.`".$table_prefix."site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
1270 1269
                         $errors += 1;
1271
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1270
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1272 1271
 
1273 1272
                         return;
1274 1273
                     }
1275
-                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1274
+                    echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1276 1275
                 } elseif ($count_new_name == 0) {
1277 1276
                     if ($count_original_name > 0 && $overwrite == 'false') {
1278 1277
                         $name = $newname;
1279 1278
                     }
1280 1279
                     if (!mysqli_query($sqlParser->conn,
1281
-                        "INSERT INTO $dbase.`" . $table_prefix . "site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) {
1280
+                        "INSERT INTO $dbase.`".$table_prefix."site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) {
1282 1281
                         $errors += 1;
1283
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1282
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1284 1283
 
1285 1284
                         return;
1286 1285
                     }
1287
-                    echo "  $name: " . $_lang['installed'] . PHP_EOL;
1286
+                    echo "  $name: ".$_lang['installed'].PHP_EOL;
1288 1287
                 }
1289 1288
             }
1290 1289
         }
@@ -1294,7 +1293,7 @@  discard block
 block discarded – undo
1294 1293
 // Install Modules
1295 1294
 $moduleModules = $mm;
1296 1295
 if (is_array($moduleModules) || $installData) {
1297
-    echo PHP_EOL . $_lang['modules'] . ":" . PHP_EOL;
1296
+    echo PHP_EOL.$_lang['modules'].":".PHP_EOL;
1298 1297
     //$selModules = $_POST['module'];
1299 1298
     foreach ($moduleModules as $k => $moduleModule) {
1300 1299
         $installSample = in_array('sample', $moduleModule[7]) && $installData == 1;
@@ -1307,7 +1306,7 @@  discard block
 block discarded – undo
1307 1306
             $shared = mysqli_real_escape_string($conn, $moduleModule[5]);
1308 1307
             $category = mysqli_real_escape_string($conn, $moduleModule[6]);
1309 1308
             if (!file_exists($filecontent)) {
1310
-                echo "  $name: " . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1309
+                echo "  $name: ".$_lang['unable_install_module']." '$filecontent' ".$_lang['not_found'].PHP_EOL;
1311 1310
             } else {
1312 1311
 
1313 1312
                 // Create the category if it does not already exist
@@ -1317,28 +1316,28 @@  discard block
 block discarded – undo
1317 1316
                 // $module = removeDocblock($module, 'module'); // Modules have no fileBinding, keep docblock for info-tab
1318 1317
                 $module = mysqli_real_escape_string($conn, $module);
1319 1318
                 $rs = mysqli_query($sqlParser->conn,
1320
-                    "SELECT * FROM $dbase.`" . $table_prefix . "site_modules` WHERE name='$name'");
1319
+                    "SELECT * FROM $dbase.`".$table_prefix."site_modules` WHERE name='$name'");
1321 1320
                 if (mysqli_num_rows($rs)) {
1322 1321
                     $row = mysqli_fetch_assoc($rs);
1323 1322
                     $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
1324 1323
                     if (!mysqli_query($sqlParser->conn,
1325
-                        "UPDATE $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
1326
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1324
+                        "UPDATE $dbase.`".$table_prefix."site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
1325
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1327 1326
 
1328 1327
                         return;
1329 1328
                     }
1330
-                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1329
+                    echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1331 1330
                 } else {
1332 1331
                     if ($properties != null) {
1333 1332
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
1334 1333
                     }
1335 1334
                     if (!mysqli_query($sqlParser->conn,
1336
-                        "INSERT INTO $dbase.`" . $table_prefix . "site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) {
1337
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
1335
+                        "INSERT INTO $dbase.`".$table_prefix."site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) {
1336
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
1338 1337
 
1339 1338
                         return;
1340 1339
                     }
1341
-                    echo "  $name: " . $_lang['installed'] . PHP_EOL;
1340
+                    echo "  $name: ".$_lang['installed'].PHP_EOL;
1342 1341
                 }
1343 1342
             }
1344 1343
         }
@@ -1348,7 +1347,7 @@  discard block
 block discarded – undo
1348 1347
 // Install Plugins
1349 1348
 $modulePlugins = $mp;
1350 1349
 if (is_array($modulePlugins) || $installData) {
1351
-    echo PHP_EOL . $_lang['plugins'] . ":" . PHP_EOL;
1350
+    echo PHP_EOL.$_lang['plugins'].":".PHP_EOL;
1352 1351
     $selPlugs = $_POST['plugin'];
1353 1352
     foreach ($modulePlugins as $k => $modulePlugin) {
1354 1353
         //$installSample = in_array('sample', $modulePlugin[8]) && $installData == 1;
@@ -1364,16 +1363,16 @@  discard block
 block discarded – undo
1364 1363
             $disabled = $modulePlugin[9];
1365 1364
             if (array_key_exists(7, $modulePlugin)) {
1366 1365
                 // parse comma-separated legacy names and prepare them for sql IN clause
1367
-                $leg_names = "'" . implode("','",
1368
-                        preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))) . "'";
1366
+                $leg_names = "'".implode("','",
1367
+                        preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7])))."'";
1369 1368
             }
1370 1369
             if (!file_exists($filecontent)) {
1371
-                echo "  $name: " . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1370
+                echo "  $name: ".$_lang['unable_install_plugin']." '$filecontent' ".$_lang['not_found'].PHP_EOL;
1372 1371
             } else {
1373 1372
 
1374 1373
                 // disable legacy versions based on legacy_names provided
1375 1374
                 if (!empty($leg_names)) {
1376
-                    $update_query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
1375
+                    $update_query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
1377 1376
                     $rs = mysqli_query($sqlParser->conn, $update_query);
1378 1377
                 }
1379 1378
 
@@ -1384,23 +1383,23 @@  discard block
 block discarded – undo
1384 1383
                 $plugin = removeDocblock($plugin, 'plugin');
1385 1384
                 $plugin = mysqli_real_escape_string($conn, $plugin);
1386 1385
                 $rs = mysqli_query($sqlParser->conn,
1387
-                    "SELECT * FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='$name'");
1386
+                    "SELECT * FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name'");
1388 1387
                 if (mysqli_num_rows($rs)) {
1389 1388
                     $insert = true;
1390 1389
                     while ($row = mysqli_fetch_assoc($rs)) {
1391 1390
                         $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
1392 1391
                         if ($row['description'] == $desc) {
1393 1392
                             if (!mysqli_query($sqlParser->conn,
1394
-                                "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) {
1395
-                                echo mysqli_error($sqlParser->conn) . PHP_EOL;
1393
+                                "UPDATE $dbase.`".$table_prefix."site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) {
1394
+                                echo mysqli_error($sqlParser->conn).PHP_EOL;
1396 1395
 
1397 1396
                                 return;
1398 1397
                             }
1399 1398
                             $insert = false;
1400 1399
                         } else {
1401 1400
                             if (!mysqli_query($sqlParser->conn,
1402
-                                "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};")) {
1403
-                                echo mysqli_error($sqlParser->conn) . PHP_EOL;
1401
+                                "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE id={$row['id']};")) {
1402
+                                echo mysqli_error($sqlParser->conn).PHP_EOL;
1404 1403
 
1405 1404
                                 return;
1406 1405
                             }
@@ -1409,39 +1408,39 @@  discard block
 block discarded – undo
1409 1408
                     if ($insert === true) {
1410 1409
                         $properties = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
1411 1410
                         if (!mysqli_query($sqlParser->conn,
1412
-                            "INSERT INTO $dbase.`" . $table_prefix . "site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);")) {
1413
-                            echo mysqli_error($sqlParser->conn) . PHP_EOL;
1411
+                            "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);")) {
1412
+                            echo mysqli_error($sqlParser->conn).PHP_EOL;
1414 1413
 
1415 1414
                             return;
1416 1415
                         }
1417 1416
                     }
1418
-                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1417
+                    echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1419 1418
                 } else {
1420 1419
                     if ($properties != null) {
1421 1420
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
1422 1421
                     }
1423 1422
                     if (!mysqli_query($sqlParser->conn,
1424
-                        "INSERT INTO $dbase.`" . $table_prefix . "site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) {
1425
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1423
+                        "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) {
1424
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1426 1425
 
1427 1426
                         return;
1428 1427
                     }
1429
-                    echo "  $name: " . $_lang['installed'] . PHP_EOL;
1428
+                    echo "  $name: ".$_lang['installed'].PHP_EOL;
1430 1429
                 }
1431 1430
                 // add system events
1432 1431
                 if (count($events) > 0) {
1433 1432
                     $ds = mysqli_query($sqlParser->conn,
1434
-                        "SELECT id FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='$name' AND description='$desc';");
1433
+                        "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';");
1435 1434
                     if ($ds) {
1436 1435
                         $row = mysqli_fetch_assoc($ds);
1437 1436
                         $id = $row["id"];
1438 1437
                         // remove existing events
1439 1438
                         mysqli_query($sqlParser->conn,
1440
-                            'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_plugin_events` WHERE pluginid = \'' . $id . '\'');
1439
+                            'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_plugin_events` WHERE pluginid = \''.$id.'\'');
1441 1440
                         // add new events
1442 1441
                         mysqli_query($sqlParser->conn,
1443
-                            "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("','",
1444
-                                $events) . "')");
1442
+                            "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("','",
1443
+                                $events)."')");
1445 1444
                     }
1446 1445
                 }
1447 1446
             }
@@ -1452,7 +1451,7 @@  discard block
 block discarded – undo
1452 1451
 // Install Snippets
1453 1452
 $moduleSnippet = $ms;
1454 1453
 if (is_array($moduleSnippet) || $installData) {
1455
-    echo PHP_EOL . $_lang['snippets'] . ":" . PHP_EOL;
1454
+    echo PHP_EOL.$_lang['snippets'].":".PHP_EOL;
1456 1455
     //$selSnips = $_POST['snippet'];
1457 1456
     foreach ($moduleSnippets as $k => $moduleSnippet) {
1458 1457
         $installSample = in_array('sample', $moduleSnippet[5]) && $installData == 1;
@@ -1463,7 +1462,7 @@  discard block
 block discarded – undo
1463 1462
             $properties = $moduleSnippet[3];
1464 1463
             $category = mysqli_real_escape_string($conn, $moduleSnippet[4]);
1465 1464
             if (!file_exists($filecontent)) {
1466
-                echo "  $name: " . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1465
+                echo "  $name: ".$_lang['unable_install_snippet']." '$filecontent' ".$_lang['not_found'].PHP_EOL;
1467 1466
             } else {
1468 1467
 
1469 1468
                 // Create the category if it does not already exist
@@ -1473,28 +1472,28 @@  discard block
 block discarded – undo
1473 1472
                 $snippet = removeDocblock($snippet, 'snippet');
1474 1473
                 $snippet = mysqli_real_escape_string($conn, $snippet);
1475 1474
                 $rs = mysqli_query($sqlParser->conn,
1476
-                    "SELECT * FROM $dbase.`" . $table_prefix . "site_snippets` WHERE name='$name'");
1475
+                    "SELECT * FROM $dbase.`".$table_prefix."site_snippets` WHERE name='$name'");
1477 1476
                 if (mysqli_num_rows($rs)) {
1478 1477
                     $row = mysqli_fetch_assoc($rs);
1479 1478
                     $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
1480 1479
                     if (!mysqli_query($sqlParser->conn,
1481
-                        "UPDATE $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
1482
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1480
+                        "UPDATE $dbase.`".$table_prefix."site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
1481
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1483 1482
 
1484 1483
                         return;
1485 1484
                     }
1486
-                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1485
+                    echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1487 1486
                 } else {
1488 1487
                     if ($properties != null) {
1489 1488
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
1490 1489
                     }
1491 1490
                     if (!mysqli_query($sqlParser->conn,
1492
-                        "INSERT INTO $dbase.`" . $table_prefix . "site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) {
1493
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1491
+                        "INSERT INTO $dbase.`".$table_prefix."site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) {
1492
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1494 1493
 
1495 1494
                         return;
1496 1495
                     }
1497
-                    echo "  $name: " . $_lang['installed'] . PHP_EOL;
1496
+                    echo "  $name: ".$_lang['installed'].PHP_EOL;
1498 1497
                 }
1499 1498
             }
1500 1499
         }
@@ -1503,19 +1502,19 @@  discard block
 block discarded – undo
1503 1502
 
1504 1503
 // Install demo-site
1505 1504
 if ($installData && $moduleSQLDataFile) {
1506
-    echo PHP_EOL . $_lang['installing_demo_site'];
1505
+    echo PHP_EOL.$_lang['installing_demo_site'];
1507 1506
     $sqlParser->process($moduleSQLDataFile);
1508 1507
     // display database results
1509 1508
     if ($sqlParser->installFailed == true) {
1510 1509
         $errors += 1;
1511
-        echo $_lang['database_alerts'] . PHP_EOL;
1512
-        echo $_lang['setup_couldnt_install'] . PHP_EOL;
1513
-        echo $_lang['installation_error_occured'] . PHP_EOL . PHP_EOL;
1510
+        echo $_lang['database_alerts'].PHP_EOL;
1511
+        echo $_lang['setup_couldnt_install'].PHP_EOL;
1512
+        echo $_lang['installation_error_occured'].PHP_EOL.PHP_EOL;
1514 1513
         for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) {
1515
-            echo $sqlParser->mysqlErrors[$i]["error"] . " " . $_lang['during_execution_of_sql'] . " " . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . PHP_EOL;
1514
+            echo $sqlParser->mysqlErrors[$i]["error"]." ".$_lang['during_execution_of_sql']." ".strip_tags($sqlParser->mysqlErrors[$i]["sql"]).PHP_EOL;
1516 1515
         }
1517 1516
 
1518
-        echo $_lang['some_tables_not_updated'] . PHP_EOL;
1517
+        echo $_lang['some_tables_not_updated'].PHP_EOL;
1519 1518
 
1520 1519
         return;
1521 1520
     } else {
@@ -1527,7 +1526,7 @@  discard block
 block discarded – undo
1527 1526
             $sql = sprintf('UPDATE `%ssite_content` SET template=%s WHERE template=4', $sqlParser->prefix, $row['id']);
1528 1527
             mysqli_query($sqlParser->conn, $sql);
1529 1528
         }
1530
-        echo $_lang['ok'] . PHP_EOL;
1529
+        echo $_lang['ok'].PHP_EOL;
1531 1530
     }
1532 1531
 }
1533 1532
 
@@ -1535,9 +1534,9 @@  discard block
 block discarded – undo
1535 1534
 $moduleDependencies = $mdp;
1536 1535
 foreach ($moduleDependencies as $dependency) {
1537 1536
     $ds = mysqli_query($sqlParser->conn,
1538
-        'SELECT id, guid FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_modules` WHERE name="' . $dependency['module'] . '"');
1537
+        'SELECT id, guid FROM '.$dbase.'`'.$sqlParser->prefix.'site_modules` WHERE name="'.$dependency['module'].'"');
1539 1538
     if (!$ds) {
1540
-        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1539
+        echo mysqli_error($sqlParser->conn).PHP_EOL;
1541 1540
 
1542 1541
         return;
1543 1542
     } else {
@@ -1547,9 +1546,9 @@  discard block
 block discarded – undo
1547 1546
     }
1548 1547
     // get extra id
1549 1548
     $ds = mysqli_query($sqlParser->conn,
1550
-        'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE ' . $dependency['column'] . '="' . $dependency['name'] . '"');
1549
+        'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE '.$dependency['column'].'="'.$dependency['name'].'"');
1551 1550
     if (!$ds) {
1552
-        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1551
+        echo mysqli_error($sqlParser->conn).PHP_EOL;
1553 1552
 
1554 1553
         return;
1555 1554
     } else {
@@ -1558,34 +1557,34 @@  discard block
 block discarded – undo
1558 1557
     }
1559 1558
     // setup extra as module dependency
1560 1559
     $ds = mysqli_query($sqlParser->conn,
1561
-        'SELECT module FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type'] . ' LIMIT 1');
1560
+        'SELECT module FROM '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type'].' LIMIT 1');
1562 1561
     if (!$ds) {
1563
-        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1562
+        echo mysqli_error($sqlParser->conn).PHP_EOL;
1564 1563
 
1565 1564
         return;
1566 1565
     } else {
1567 1566
         if (mysqli_num_rows($ds) === 0) {
1568 1567
             mysqli_query($sqlParser->conn,
1569
-                'INSERT INTO ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` (module, resource, type) VALUES(' . $moduleId . ',' . $extraId . ',' . $dependency['type'] . ')');
1570
-            echo $dependency['module'] . ' Module: ' . $_lang['depedency_create'] . PHP_EOL;
1568
+                'INSERT INTO '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` (module, resource, type) VALUES('.$moduleId.','.$extraId.','.$dependency['type'].')');
1569
+            echo $dependency['module'].' Module: '.$_lang['depedency_create'].PHP_EOL;
1571 1570
         } else {
1572 1571
             mysqli_query($sqlParser->conn,
1573
-                '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']);
1574
-            echo $dependency['module'] . ' Module: ' . $_lang['depedency_update'] . PHP_EOL;
1572
+                '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']);
1573
+            echo $dependency['module'].' Module: '.$_lang['depedency_update'].PHP_EOL;
1575 1574
         }
1576 1575
         if ($dependency['type'] == 30 || $dependency['type'] == 40) {
1577 1576
             // set extra guid for plugins and snippets
1578 1577
             $ds = mysqli_query($sqlParser->conn,
1579
-                'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE id=' . $extraId . ' LIMIT 1');
1578
+                'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE id='.$extraId.' LIMIT 1');
1580 1579
             if (!$ds) {
1581
-                echo mysqli_error($sqlParser->conn) . PHP_EOL;
1580
+                echo mysqli_error($sqlParser->conn).PHP_EOL;
1582 1581
 
1583 1582
                 return;
1584 1583
             } else {
1585 1584
                 if (mysqli_num_rows($ds) != 0) {
1586 1585
                     mysqli_query($sqlParser->conn,
1587
-                        'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` SET moduleguid = ' . $moduleGuid . ' WHERE id=' . $extraId);
1588
-                    echo $dependency['name'] . ': ' . $_lang['guid_set'] . PHP_EOL;
1586
+                        'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` SET moduleguid = '.$moduleGuid.' WHERE id='.$extraId);
1587
+                    echo $dependency['name'].': '.$_lang['guid_set'].PHP_EOL;
1589 1588
                 }
1590 1589
             }
1591 1590
         }
@@ -1594,60 +1593,60 @@  discard block
 block discarded – undo
1594 1593
 
1595 1594
 // call back function
1596 1595
 if ($callBackFnc != "") {
1597
-    $callBackFnc ($sqlParser);
1596
+    $callBackFnc($sqlParser);
1598 1597
 }
1599 1598
 
1600 1599
 // Setup the MODX API -- needed for the cache processor
1601 1600
 if (!defined('MODX_MANAGER_PATH')) {
1602
-    define('MODX_MANAGER_PATH', $base_path . MGR_DIR . '/');
1601
+    define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/');
1603 1602
 }
1604 1603
 $database_type = 'mysqli';
1605 1604
 // initiate a new document parser
1606
-include_once($path . '../' . MGR_DIR . '/includes/document.parser.class.inc.php');
1605
+include_once($path.'../'.MGR_DIR.'/includes/document.parser.class.inc.php');
1607 1606
 $modx = new DocumentParser;
1608 1607
 $modx->db->connect();
1609 1608
 // always empty cache after install
1610 1609
 $sync = new EvolutionCMS\Cache();
1611
-$sync->setCachepath($path . "../assets/cache/");
1610
+$sync->setCachepath($path."../assets/cache/");
1612 1611
 $sync->setReport(false);
1613 1612
 $sync->emptyCache(); // first empty the cache
1614 1613
 
1615 1614
 // try to chmod the cache go-rwx (for suexeced php)
1616
-$chmodSuccess = @chmod($path . '../assets/cache/siteCache.idx.php', 0600);
1617
-$chmodSuccess = @chmod($path . '../assets/cache/sitePublishing.idx.php', 0600);
1615
+$chmodSuccess = @chmod($path.'../assets/cache/siteCache.idx.php', 0600);
1616
+$chmodSuccess = @chmod($path.'../assets/cache/sitePublishing.idx.php', 0600);
1618 1617
 
1619 1618
 // remove any locks on the manager functions so initial manager login is not blocked
1620
-mysqli_query($conn, "TRUNCATE TABLE `" . $table_prefix . "active_users`");
1619
+mysqli_query($conn, "TRUNCATE TABLE `".$table_prefix."active_users`");
1621 1620
 
1622 1621
 // close db connection
1623 1622
 $sqlParser->close();
1624 1623
 
1625 1624
 // andrazk 20070416 - release manager access
1626
-if (file_exists($path . '../assets/cache/installProc.inc.php')) {
1627
-    @chmod($path . '../assets/cache/installProc.inc.php', 0755);
1628
-    unlink($path . '../assets/cache/installProc.inc.php');
1625
+if (file_exists($path.'../assets/cache/installProc.inc.php')) {
1626
+    @chmod($path.'../assets/cache/installProc.inc.php', 0755);
1627
+    unlink($path.'../assets/cache/installProc.inc.php');
1629 1628
 }
1630 1629
 
1631 1630
 // setup completed!
1632
-echo PHP_EOL . $_lang['installation_successful'] . PHP_EOL . PHP_EOL;
1631
+echo PHP_EOL.$_lang['installation_successful'].PHP_EOL.PHP_EOL;
1633 1632
 //echo "<p>" . $_lang['to_log_into_content_manager'] . "</p>";
1634 1633
 if ($installMode == 0) {
1635
-    echo strip_tags($_lang['installation_note']) . PHP_EOL;
1634
+    echo strip_tags($_lang['installation_note']).PHP_EOL;
1636 1635
 } else {
1637
-    echo strip_tags($_lang['upgrade_note']) . PHP_EOL;
1636
+    echo strip_tags($_lang['upgrade_note']).PHP_EOL;
1638 1637
 }
1639 1638
 
1640 1639
 
1641 1640
 if (empty($args)) {
1642
-    echo PHP_EOL . 'Remove install folder?' . PHP_EOL;
1641
+    echo PHP_EOL.'Remove install folder?'.PHP_EOL;
1643 1642
     $removeInstall = readline("Type 'y' or 'n' to continue: ");
1644 1643
 }
1645 1644
 //remove installFolder
1646 1645
 if ($removeInstall == 'y') {
1647 1646
     removeFolder($path);
1648
-    removeFolder($base_path . '.tx');
1649
-    unlink($base_path . 'README.md');
1650
-    echo 'Install folder deleted!' . PHP_EOL . PHP_EOL;
1647
+    removeFolder($base_path.'.tx');
1648
+    unlink($base_path.'README.md');
1649
+    echo 'Install folder deleted!'.PHP_EOL.PHP_EOL;
1651 1650
 }
1652 1651
 
1653 1652
 if (!function_exists('removeFolder')) {
@@ -1801,17 +1800,17 @@  discard block
 block discarded – undo
1801 1800
     function getCreateDbCategory($category, $sqlParser)
1802 1801
     {
1803 1802
         $dbase = $sqlParser->dbname;
1804
-        $dbase = '`' . trim($dbase, '`') . '`';
1803
+        $dbase = '`'.trim($dbase, '`').'`';
1805 1804
         $table_prefix = $sqlParser->prefix;
1806 1805
         $category_id = 0;
1807 1806
         if (!empty($category)) {
1808 1807
             $category = mysqli_real_escape_string($sqlParser->conn, $category);
1809 1808
             $rs = mysqli_query($sqlParser->conn,
1810
-                "SELECT id FROM $dbase.`" . $table_prefix . "categories` WHERE category = '" . $category . "'");
1809
+                "SELECT id FROM $dbase.`".$table_prefix."categories` WHERE category = '".$category."'");
1811 1810
             if (mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) {
1812 1811
                 $category_id = $row['id'];
1813 1812
             } else {
1814
-                $q = "INSERT INTO $dbase.`" . $table_prefix . "categories` (`category`) VALUES ('{$category}');";
1813
+                $q = "INSERT INTO $dbase.`".$table_prefix."categories` (`category`) VALUES ('{$category}');";
1815 1814
                 $rs = mysqli_query($sqlParser->conn, $q);
1816 1815
                 if ($rs) {
1817 1816
                     $category_id = mysqli_insert_id($sqlParser->conn);
@@ -1853,7 +1852,7 @@  discard block
 block discarded – undo
1853 1852
             default:
1854 1853
                 return $cleaned;
1855 1854
         };
1856
-        if (substr(trim($cleaned), 0, $count) == $include . ' MODX_BASE_PATH.\'assets/' . $elm_name . '/') {
1855
+        if (substr(trim($cleaned), 0, $count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') {
1857 1856
             return $cleaned;
1858 1857
         }
1859 1858
 
Please login to merge, or discard this patch.
install/index.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -3,13 +3,13 @@  discard block
 block discarded – undo
3 3
  * EVO Installer
4 4
  */
5 5
 error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
6
-$base_path = dirname(__DIR__) . '/';
6
+$base_path = dirname(__DIR__).'/';
7 7
 
8
-if (is_file($base_path . 'assets/cache/siteManager.php')) {
9
-    include_once $base_path . 'assets/cache/siteManager.php';
8
+if (is_file($base_path.'assets/cache/siteManager.php')) {
9
+    include_once $base_path.'assets/cache/siteManager.php';
10 10
 }
11
-if (! defined('MGR_DIR')) {
12
-    if (is_dir($base_path . 'manager')) {
11
+if (!defined('MGR_DIR')) {
12
+    if (is_dir($base_path.'manager')) {
13 13
         define('MGR_DIR', 'manager');
14 14
     } else {
15 15
         die('MGR_DIR is not defined');
@@ -19,12 +19,12 @@  discard block
 block discarded – undo
19 19
 require_once 'src/functions.php';
20 20
 
21 21
 if (empty($_GET['self'])) {
22
-    $autoloader = realpath(__DIR__ . '/../vendor/autoload.php');
22
+    $autoloader = realpath(__DIR__.'/../vendor/autoload.php');
23 23
     if (file_exists($autoloader) && is_readable($autoloader)) {
24 24
         include_once $autoloader;
25 25
     }
26 26
 
27
-    require_once '../' . MGR_DIR . '/includes/version.inc.php';
27
+    require_once '../'.MGR_DIR.'/includes/version.inc.php';
28 28
     include_once '../'.MGR_DIR.'/includes/preload.functions.inc.php';
29 29
 
30 30
     // start session
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     install_sessionCheck();
34 34
 
35 35
     $moduleName = 'EVO';
36
-    $moduleVersion = $modx_branch . ' ' . $modx_version;
36
+    $moduleVersion = $modx_branch.' '.$modx_version;
37 37
     $moduleRelease = $modx_release_date;
38 38
     $moduleSQLBaseFile = 'src/stubs/sql/setup.sql';
39 39
     $moduleSQLDataFile = 'src/stubs/sql/setup.data.sql';
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
     $action = isset($_GET['action']) ? trim(strip_tags($_GET['action'])) : 'language';
75 75
     str_replace('.', '', $action);
76 76
 
77
-    $controller = 'src/controllers/' . $action . '.php';
78
-    if (! file_exists($controller)) {
77
+    $controller = 'src/controllers/'.$action.'.php';
78
+    if (!file_exists($controller)) {
79 79
         die("Invalid install action attempted. [action={$action}]");
80 80
     }
81 81
     require $controller;
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 } else {
88 88
     $action = isset($_GET['action']) && is_scalar($_GET['action']) ? trim($_GET['action']) : 'language';
89 89
     str_replace('.', '', $action);
90
-    $controller = 'src/controllers/' . $action . '.php';
91
-    if (! file_exists($controller)) {
90
+    $controller = 'src/controllers/'.$action.'.php';
91
+    if (!file_exists($controller)) {
92 92
         die("Invalid install action attempted. [action={$action}]");
93 93
     }
94 94
     require $controller;
Please login to merge, or discard this patch.
install/src/functions.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (! function_exists('getLangOptions')) {
2
+if (!function_exists('getLangOptions')) {
3 3
     /**
4 4
      * @param string $install_language
5 5
      * @return string
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
     function getLangOptions($install_language = 'english')
8 8
     {
9 9
         $langs = array();
10
-        if ($handle = opendir(__DIR__ . '/lang/')) {
10
+        if ($handle = opendir(__DIR__.'/lang/')) {
11 11
             while (false !== ($file = readdir($handle))) {
12 12
                 if (strpos($file, '.')) {
13 13
                     $langs[] = str_replace('.inc.php', '', $file);
@@ -21,14 +21,14 @@  discard block
 block discarded – undo
21 21
             $abrv_language = explode('-', $language);
22 22
             $selected = ($language === $install_language) ? 'selected' : '';
23 23
             $_[] = sprintf('<option value="%s" %s>%s</option>', $language, $selected,
24
-                    ucwords($abrv_language[0])) . "\n";
24
+                    ucwords($abrv_language[0]))."\n";
25 25
         }
26 26
 
27 27
         return implode("\n", $_);
28 28
     }
29 29
 }
30 30
 
31
-if (! function_exists('install_sessionCheck')) {
31
+if (!function_exists('install_sessionCheck')) {
32 32
     function install_sessionCheck()
33 33
     {
34 34
         global $_lang;
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 </head>
51 51
 <body>
52 52
 	<div class="install">
53
-		<p>' . $_lang["session_problem"] . '</p>
54
-		<p><a href="./">' . $_lang["session_problem_try_again"] . '</a></p>
53
+		<p>' . $_lang["session_problem"].'</p>
54
+		<p><a href="./">' . $_lang["session_problem_try_again"].'</a></p>
55 55
 	</div>
56 56
 </body>
57 57
 </html>';
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     function parse($src, $ph, $left = '[+', $right = '+]')
73 73
     {
74 74
         foreach ($ph as $k => $v) {
75
-            $k = $left . $k . $right;
75
+            $k = $left.$k.$right;
76 76
             $src = str_replace($k, $v, $src);
77 77
         }
78 78
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         $ph['textdir'] = $modx_textdir ? ' id="rtl"' : '';
100 100
         $ph['help_link'] = $installmode == 0 ? $_lang['help_link_new'] : $_lang['help_link_upd'];
101 101
         $ph['version'] = $moduleVersion;
102
-        $ph['release_date'] = ($modx_textdir ? '&rlm;' : '') . $modx_release_date;
102
+        $ph['release_date'] = ($modx_textdir ? '&rlm;' : '').$modx_release_date;
103 103
         $ph['footer1'] = $_lang['modx_footer1'];
104 104
         $ph['footer2'] = $_lang['modx_footer2'];
105 105
         $ph['current_year'] = date('Y');
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
             $manager_language = "english";
185 185
         }
186 186
         $langs = array();
187
-        if ($handle = opendir(dirname(dirname(__DIR__)) . '/' . MGR_DIR . '/includes/lang')) {
187
+        if ($handle = opendir(dirname(dirname(__DIR__)).'/'.MGR_DIR.'/includes/lang')) {
188 188
             while (false !== ($file = readdir($handle))) {
189 189
                 if (strpos($file, '.inc.') !== false) {
190 190
                     $langs[] = $file;
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
             $i++;
251 251
         }
252 252
 
253
-        return (0 < count($_)) ? '<h3>[%templates%]</h3>' . implode("\n", $_) : '';
253
+        return (0 < count($_)) ? '<h3>[%templates%]</h3>'.implode("\n", $_) : '';
254 254
     }
255 255
 }
256 256
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
             $i++;
281 281
         }
282 282
 
283
-        return (0 < count($_)) ? '<h3>[%tvs%]</h3>' . implode("\n", $_) : '';
283
+        return (0 < count($_)) ? '<h3>[%tvs%]</h3>'.implode("\n", $_) : '';
284 284
     }
285 285
 }
286 286
 
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
             $i++;
312 312
         }
313 313
 
314
-        return (0 < count($_)) ? '<h3>[%chunks%]</h3>' . implode("\n", $_) : '';
314
+        return (0 < count($_)) ? '<h3>[%chunks%]</h3>'.implode("\n", $_) : '';
315 315
     }
316 316
 }
317 317
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
             $i++;
343 343
         }
344 344
 
345
-        return (0 < count($_)) ? '<h3>[%modules%]</h3>' . implode("\n", $_) : '';
345
+        return (0 < count($_)) ? '<h3>[%modules%]</h3>'.implode("\n", $_) : '';
346 346
     }
347 347
 }
348 348
 
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
             $i++;
378 378
         }
379 379
 
380
-        return (0 < count($_)) ? '<h3>[%plugins%]</h3>' . implode("\n", $_) : '';
380
+        return (0 < count($_)) ? '<h3>[%plugins%]</h3>'.implode("\n", $_) : '';
381 381
     }
382 382
 }
383 383
 
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
             $i++;
409 409
         }
410 410
 
411
-        return (0 < count($_)) ? '<h3>[%snippets%]</h3>' . implode("\n", $_) : '';
411
+        return (0 < count($_)) ? '<h3>[%snippets%]</h3>'.implode("\n", $_) : '';
412 412
     }
413 413
 }
414 414
 
@@ -419,46 +419,46 @@  discard block
 block discarded – undo
419 419
 
420 420
         // secure web documents - privateweb
421 421
         mysqli_query($sqlParser->conn,
422
-            "UPDATE `" . $sqlParser->prefix . "site_content` SET privateweb = 0 WHERE privateweb = 1");
422
+            "UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 0 WHERE privateweb = 1");
423 423
         $sql = "SELECT DISTINCT sc.id
424
-             FROM `" . $sqlParser->prefix . "site_content` sc
425
-             LEFT JOIN `" . $sqlParser->prefix . "document_groups` dg ON dg.document = sc.id
426
-             LEFT JOIN `" . $sqlParser->prefix . "webgroup_access` wga ON wga.documentgroup = dg.document_group
424
+             FROM `" . $sqlParser->prefix."site_content` sc
425
+             LEFT JOIN `" . $sqlParser->prefix."document_groups` dg ON dg.document = sc.id
426
+             LEFT JOIN `" . $sqlParser->prefix."webgroup_access` wga ON wga.documentgroup = dg.document_group
427 427
              WHERE wga.id>0";
428 428
         $ds = mysqli_query($sqlParser->conn, $sql);
429 429
         if (!$ds) {
430
-            echo "An error occurred while executing a query: " . mysqli_error($sqlParser->conn);
430
+            echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn);
431 431
         } else {
432 432
             while ($r = mysqli_fetch_assoc($ds)) {
433 433
                 $ids[] = $r["id"];
434 434
             }
435 435
             if (count($ids) > 0) {
436 436
                 mysqli_query($sqlParser->conn,
437
-                    "UPDATE `" . $sqlParser->prefix . "site_content` SET privateweb = 1 WHERE id IN (" . implode(", ",
438
-                        $ids) . ")");
437
+                    "UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ",
438
+                        $ids).")");
439 439
                 unset($ids);
440 440
             }
441 441
         }
442 442
 
443 443
         // secure manager documents privatemgr
444 444
         mysqli_query($sqlParser->conn,
445
-            "UPDATE `" . $sqlParser->prefix . "site_content` SET privatemgr = 0 WHERE privatemgr = 1");
445
+            "UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 0 WHERE privatemgr = 1");
446 446
         $sql = "SELECT DISTINCT sc.id
447
-             FROM `" . $sqlParser->prefix . "site_content` sc
448
-             LEFT JOIN `" . $sqlParser->prefix . "document_groups` dg ON dg.document = sc.id
449
-             LEFT JOIN `" . $sqlParser->prefix . "membergroup_access` mga ON mga.documentgroup = dg.document_group
447
+             FROM `" . $sqlParser->prefix."site_content` sc
448
+             LEFT JOIN `" . $sqlParser->prefix."document_groups` dg ON dg.document = sc.id
449
+             LEFT JOIN `" . $sqlParser->prefix."membergroup_access` mga ON mga.documentgroup = dg.document_group
450 450
              WHERE mga.id>0";
451 451
         $ds = mysqli_query($sqlParser->conn, $sql);
452 452
         if (!$ds) {
453
-            echo "An error occurred while executing a query: " . mysqli_error($sqlParser->conn);
453
+            echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn);
454 454
         } else {
455 455
             while ($r = mysqli_fetch_assoc($ds)) {
456 456
                 $ids[] = $r["id"];
457 457
             }
458 458
             if (count($ids) > 0) {
459 459
                 mysqli_query($sqlParser->conn,
460
-                    "UPDATE `" . $sqlParser->prefix . "site_content` SET privatemgr = 1 WHERE id IN (" . implode(", ",
461
-                        $ids) . ")");
460
+                    "UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ",
461
+                        $ids).")");
462 462
                 unset($ids);
463 463
             }
464 464
         }
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
     function parse_docblock($element_dir, $filename)
470 470
     {
471 471
         $params = array();
472
-        $fullpath = $element_dir . '/' . $filename;
472
+        $fullpath = $element_dir.'/'.$filename;
473 473
         if (is_readable($fullpath)) {
474 474
             $tpl = @fopen($fullpath, "r");
475 475
             if ($tpl) {
@@ -688,17 +688,17 @@  discard block
 block discarded – undo
688 688
     function getCreateDbCategory($category, $sqlParser)
689 689
     {
690 690
         $dbase = $sqlParser->dbname;
691
-        $dbase = '`' . trim($dbase, '`') . '`';
691
+        $dbase = '`'.trim($dbase, '`').'`';
692 692
         $table_prefix = $sqlParser->prefix;
693 693
         $category_id = 0;
694 694
         if (!empty($category)) {
695 695
             $category = mysqli_real_escape_string($sqlParser->conn, $category);
696 696
             $rs = mysqli_query($sqlParser->conn,
697
-                "SELECT id FROM $dbase.`" . $table_prefix . "categories` WHERE category = '" . $category . "'");
697
+                "SELECT id FROM $dbase.`".$table_prefix."categories` WHERE category = '".$category."'");
698 698
             if (mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) {
699 699
                 $category_id = $row['id'];
700 700
             } else {
701
-                $q = "INSERT INTO $dbase.`" . $table_prefix . "categories` (`category`) VALUES ('{$category}');";
701
+                $q = "INSERT INTO $dbase.`".$table_prefix."categories` (`category`) VALUES ('{$category}');";
702 702
                 $rs = mysqli_query($sqlParser->conn, $q);
703 703
                 if ($rs) {
704 704
                     $category_id = mysqli_insert_id($sqlParser->conn);
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
             default:
741 741
                 return $cleaned;
742 742
         };
743
-        if (substr(trim($cleaned), 0, $count) == $include . ' MODX_BASE_PATH.\'assets/' . $elm_name . '/') {
743
+        if (substr(trim($cleaned), 0, $count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/') {
744 744
             return $cleaned;
745 745
         }
746 746
 
Please login to merge, or discard this patch.
install/src/controllers/mode.php 1 patch
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(dirname(__DIR__) . '/template/actions/mode.tpl');
30
+$tpl = file_get_contents(dirname(__DIR__).'/template/actions/mode.tpl');
31 31
 $content = parse($tpl, $ph);
32
-echo parse($content, $_lang,'[%','%]');
32
+echo parse($content, $_lang, '[%', '%]');
Please login to merge, or discard this patch.
install/src/controllers/options.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@  discard block
 block discarded – undo
1 1
 <?php
2
-$installMode = isset($_POST['installmode']) ? (int)$_POST['installmode'] : 0;
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']))
10
+        if (empty($_SESSION['databaseloginpassword']))
11 11
             $_SESSION['databaseloginpassword'] = $_POST['databaseloginpassword'];
12
-        if(empty($_SESSION['databaseloginname']))
12
+        if (empty($_SESSION['databaseloginname']))
13 13
             $_SESSION['databaseloginname'] = $_POST['databaseloginname'];
14 14
         break;
15 15
     case 1:
16
-        include $base_path . MGR_DIR . '/includes/config.inc.php';
16
+        include $base_path.MGR_DIR.'/includes/config.inc.php';
17 17
         if (@ $conn = mysqli_connect($database_server, $database_user, $database_password)) {
18 18
             if (@ mysqli_query($conn, "USE {$dbase}")) {
19 19
                 if (!$rs = mysqli_query($conn, "show session variables like 'collation_database'")) {
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 $ph['checked'] = isset ($_POST['installdata']) && $_POST['installdata'] == "1" ? 'checked' : '';
69 69
 
70 70
 # load setup information file
71
-include_once dirname(__DIR__) . '/processor/result.php';
71
+include_once dirname(__DIR__).'/processor/result.php';
72 72
 $ph['templates'] = getTemplates($moduleTemplates);
73 73
 $ph['tvs']       = getTVs($moduleTVs);
74 74
 $ph['chunks']    = getChunks($moduleChunks);
@@ -78,6 +78,6 @@  discard block
 block discarded – undo
78 78
 
79 79
 $ph['action'] = ($installMode == 1) ? 'mode' : 'connection';
80 80
 
81
-$tpl = file_get_contents(dirname(__DIR__) . '/template/actions/options.tpl');
81
+$tpl = file_get_contents(dirname(__DIR__).'/template/actions/options.tpl');
82 82
 $content = parse($tpl, $ph);
83 83
 echo parse($content, $_lang, '[%', '%]');
Please login to merge, or discard this patch.
install/src/controllers/connection/databasetest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 
8 8
 $output = $_lang["status_checking_database"];
9 9
 if (!$conn = mysqli_connect($host, $uid, $pwd)) {
10
-    $output .= '<span id="database_fail" style="color:#FF0000;">' . $_lang['status_failed'] . '</span>';
10
+    $output .= '<span id="database_fail" style="color:#FF0000;">'.$_lang['status_failed'].'</span>';
11 11
 } else {
12 12
     $database_name = mysqli_real_escape_string($conn, $_POST['database_name']);
13 13
     $database_name = str_replace("`", "", $database_name);
@@ -18,22 +18,22 @@  discard block
 block discarded – undo
18 18
     if (!@ mysqli_select_db($conn, $database_name)) {
19 19
         // create database
20 20
         $database_charset = substr($database_collation, 0, strpos($database_collation, '_'));
21
-        $query = "CREATE DATABASE `" . $database_name . "` CHARACTER SET " . $database_charset . " COLLATE " . $database_collation . ";";
21
+        $query = "CREATE DATABASE `".$database_name."` CHARACTER SET ".$database_charset." COLLATE ".$database_collation.";";
22 22
 
23 23
         if (!mysqli_query($conn, $query)) {
24
-            $output .= '<span id="database_fail" style="color:#FF0000;">' . $_lang['status_failed_could_not_create_database'] . '</span>';
24
+            $output .= '<span id="database_fail" style="color:#FF0000;">'.$_lang['status_failed_could_not_create_database'].'</span>';
25 25
         } else {
26
-            $output .= '<span id="database_pass" style="color:#80c000;">' . $_lang['status_passed_database_created'] . '</span>';
26
+            $output .= '<span id="database_pass" style="color:#80c000;">'.$_lang['status_passed_database_created'].'</span>';
27 27
         }
28 28
     } elseif (($installMode == 0) && (mysqli_query($conn,
29 29
             "SELECT COUNT(*) FROM {$database_name}.`{$tableprefix}site_content`"))) {
30
-        $output .= '<span id="database_fail" style="color:#FF0000;">' . $_lang['status_failed_table_prefix_already_in_use'] . '</span>';
30
+        $output .= '<span id="database_fail" style="color:#FF0000;">'.$_lang['status_failed_table_prefix_already_in_use'].'</span>';
31 31
     } elseif (($database_connection_method != 'SET NAMES') && ($rs = mysqli_query($conn,
32 32
             "show variables like 'collation_database'")) && ($row = mysqli_fetch_row($rs)) && ($row[1] != $database_collation)) {
33
-        $output .= '<span id="database_fail" style="color:#FF0000;">' . sprintf($_lang['status_failed_database_collation_does_not_match'],
34
-                $row[1]) . '</span>';
33
+        $output .= '<span id="database_fail" style="color:#FF0000;">'.sprintf($_lang['status_failed_database_collation_does_not_match'],
34
+                $row[1]).'</span>';
35 35
     } else {
36
-        $output .= '<span id="database_pass" style="color:#80c000;">' . $_lang['status_passed'] . '</span>';
36
+        $output .= '<span id="database_pass" style="color:#80c000;">'.$_lang['status_passed'].'</span>';
37 37
     }
38 38
 }
39 39
 
Please login to merge, or discard this patch.
install/src/controllers/connection/servertest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@  discard block
 block discarded – undo
7 7
 $output = $_lang["status_connecting"];
8 8
 if (function_exists('mysqli_connect')) {
9 9
     if (!$conn = @mysqli_connect($host, $uid, $pwd)) {
10
-        $output .= '<span id="server_fail" style="color:#FF0000;"> ' . $_lang['status_failed'] . '</span>';
10
+        $output .= '<span id="server_fail" style="color:#FF0000;"> '.$_lang['status_failed'].'</span>';
11 11
     } else {
12
-        $output .= '<span id="server_pass" style="color:#80c000;"> ' . $_lang['status_passed_server'] . '</span>';
12
+        $output .= '<span id="server_pass" style="color:#80c000;"> '.$_lang['status_passed_server'].'</span>';
13 13
 
14 14
         // Mysql version check
15 15
         if (version_compare(mysqli_get_server_info($conn), '5.0.51', '=')) {
16
-            $output .= '<br /><span style="color:#FF0000;"> ' . $_lang['mysql_5051'] . '</span>';
16
+            $output .= '<br /><span style="color:#FF0000;"> '.$_lang['mysql_5051'].'</span>';
17 17
         }
18 18
         // Mode check
19 19
         $mysqlmode = mysqli_query($conn, "SELECT @@session.sql_mode");
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
                 }
27 27
             }
28 28
             if ($strictMode) {
29
-                $output .= '<br /><span style="color:#FF0000;"> ' . $_lang['strict_mode'] . '</span>';
29
+                $output .= '<br /><span style="color:#FF0000;"> '.$_lang['strict_mode'].'</span>';
30 30
             }
31 31
         }
32 32
     }
33 33
 } else {
34
-    $output .= '<span id="server_fail" style="color:#FF0000;"> ' . $_lang['status_failed_mysqli'] . '</span>';
34
+    $output .= '<span id="server_fail" style="color:#FF0000;"> '.$_lang['status_failed_mysqli'].'</span>';
35 35
 }
36 36
 echo $output;
Please login to merge, or discard this patch.
install/src/controllers/language.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-$content = file_get_contents(dirname(__DIR__) . '/template/actions/language.tpl');
3
+$content = file_get_contents(dirname(__DIR__).'/template/actions/language.tpl');
4 4
 $content = parse($content, array(
5 5
     'langOptions' => getLangOptions($install_language))
6 6
 );
7
-$content = parse($content, $_lang,'[%','%]');
7
+$content = parse($content, $_lang, '[%', '%]');
8 8
 
9 9
 echo $content;
Please login to merge, or discard this patch.