Completed
Push — develop ( 8bfc17...dc55c3 )
by Maxim
14s
created
manager/actions/welcome.static.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.');
4 4
 }
5 5
 
6 6
 unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes
7 7
 
8
-if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
8
+if ($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
9 9
 	// seems to be a new install - send the user to the configuration page
10 10
 	exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
11 11
 }
@@ -16,16 +16,16 @@  discard block
 block discarded – undo
16 16
 $_SESSION['nrnewmessages'] = 0;
17 17
 
18 18
 // setup message info
19
-if($modx->hasPermission('messages')) {
20
-	include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php');
19
+if ($modx->hasPermission('messages')) {
20
+	include_once(MODX_MANAGER_PATH.'includes/messageCount.inc.php');
21 21
 	$_SESSION['nrtotalmessages'] = $nrtotalmessages;
22 22
 	$_SESSION['nrnewmessages'] = $nrnewmessages;
23 23
 
24 24
 	$msg = array();
25 25
 	$msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']);
26
-	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : '';
26
+	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">'.$_SESSION['nrnewmessages'].'</span>)' : '';
27 27
 	$msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold">&nbsp;<a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages);
28
-	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0';
28
+	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">'.$_SESSION['nrnewmessages'].'</span>' : '0';
29 29
 	$welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages);
30 30
 	$msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
31 31
 	$ph['MessageInfo'] = implode("\n", $msg);
@@ -33,56 +33,56 @@  discard block
 block discarded – undo
33 33
 
34 34
 $iconTpl = $modx->getChunk('manager#welcome\WrapIcon');
35 35
 // setup icons
36
-if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
36
+if ($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
37 37
 	$icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]';
38
-	$ph['SecurityIcon'] = sprintf($iconTpl,$icon, 75);
38
+	$ph['SecurityIcon'] = sprintf($iconTpl, $icon, 75);
39 39
 }
40
-if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
40
+if ($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
41 41
 	$icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]';
42
-	$ph['WebUserIcon'] = sprintf($iconTpl,$icon, 99);
42
+	$ph['WebUserIcon'] = sprintf($iconTpl, $icon, 99);
43 43
 }
44
-if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
44
+if ($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
45 45
 	$icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]';
46
-	$ph['ModulesIcon'] = sprintf($iconTpl,$icon, 106);
46
+	$ph['ModulesIcon'] = sprintf($iconTpl, $icon, 106);
47 47
 }
48
-if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
48
+if ($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
49 49
 	$icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]';
50
-	$ph['ResourcesIcon'] = sprintf($iconTpl,$icon, 76);
50
+	$ph['ResourcesIcon'] = sprintf($iconTpl, $icon, 76);
51 51
 }
52
-if($modx->hasPermission('bk_manager')) {
52
+if ($modx->hasPermission('bk_manager')) {
53 53
 	$icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]';
54
-	$ph['BackupIcon'] = sprintf($iconTpl,$icon, 93);
54
+	$ph['BackupIcon'] = sprintf($iconTpl, $icon, 93);
55 55
 }
56
-if($modx->hasPermission('help')) {
56
+if ($modx->hasPermission('help')) {
57 57
 	$icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]';
58
-	$ph['HelpIcon'] = sprintf($iconTpl,$icon, 9);
58
+	$ph['HelpIcon'] = sprintf($iconTpl, $icon, 9);
59 59
 }
60 60
 
61
-if($modx->hasPermission('new_document')) {
61
+if ($modx->hasPermission('new_document')) {
62 62
 	$icon = '<i class="[&icons_resource_large&]"></i>[%add_resource%]';
63
-	$ph['ResourceIcon'] = sprintf($iconTpl,$icon, 4);
63
+	$ph['ResourceIcon'] = sprintf($iconTpl, $icon, 4);
64 64
 	$icon = '<i class="[&icons_weblink_large&]"></i>[%add_weblink%]';
65
-	$ph['WeblinkIcon'] = sprintf($iconTpl,$icon, 72);
65
+	$ph['WeblinkIcon'] = sprintf($iconTpl, $icon, 72);
66 66
 }
67
-if($modx->hasPermission('assets_images')) {
67
+if ($modx->hasPermission('assets_images')) {
68 68
 	$icon = '<i class="[&icons_images_large&]"></i>[%images_management%]';
69
-	$ph['ImagesIcon'] = sprintf($iconTpl,$icon, 72);
69
+	$ph['ImagesIcon'] = sprintf($iconTpl, $icon, 72);
70 70
 }
71
-if($modx->hasPermission('assets_files')) {
71
+if ($modx->hasPermission('assets_files')) {
72 72
 	$icon = '<i class="[&icons_files_large&]"></i>[%files_management%]';
73
-	$ph['FilesIcon'] = sprintf($iconTpl,$icon, 72);
73
+	$ph['FilesIcon'] = sprintf($iconTpl, $icon, 72);
74 74
 }
75
-if($modx->hasPermission('change_password')) {
75
+if ($modx->hasPermission('change_password')) {
76 76
 	$icon = '<i class="[&icons_password_large&]"></i>[%change_password%]';
77
-	$ph['PasswordIcon'] = sprintf($iconTpl,$icon, 28);
77
+	$ph['PasswordIcon'] = sprintf($iconTpl, $icon, 28);
78 78
 }
79 79
 $icon = '<i class="[&icons_logout_large&]"></i>[%logout%]';
80
-$ph['LogoutIcon'] = sprintf($iconTpl,$icon, 8);
80
+$ph['LogoutIcon'] = sprintf($iconTpl, $icon, 8);
81 81
 
82 82
 // do some config checks
83
-if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
84
-	include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php');
85
-	if($config_check_results != $_lang['configcheck_ok']) {
83
+if (($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
84
+	include_once(MODX_MANAGER_PATH.'includes/config_check.inc.php');
85
+	if ($config_check_results != $_lang['configcheck_ok']) {
86 86
 		$ph['config_check_results'] = $config_check_results;
87 87
 		$ph['config_display'] = 'block';
88 88
 	} else {
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
 }
94 94
 
95 95
 // Check logout-reminder
96
-if(isset($_SESSION['show_logout_reminder'])) {
97
-	switch($_SESSION['show_logout_reminder']['type']) {
96
+if (isset($_SESSION['show_logout_reminder'])) {
97
+	switch ($_SESSION['show_logout_reminder']['type']) {
98 98
 		case 'logout_reminder':
99 99
 			$date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly');
100 100
 			$ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	</tr>
149 149
 </table>';
150 150
 
151
-$nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>';
151
+$nrnewmessages = '<span class="text-danger">'.$_SESSION['nrnewmessages'].'</span>';
152 152
 
153 153
 $ph['UserInfo'] = $modx->parseText($tpl, array(
154 154
 	'username' => $modx->getLoginUserName(),
@@ -163,10 +163,10 @@  discard block
 block discarded – undo
163 163
 $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'";
164 164
 $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
165 165
 
166
-if($modx->db->getRecordCount($rs) < 1) {
166
+if ($modx->db->getRecordCount($rs) < 1) {
167 167
 	$html = '<p>[%no_active_users_found%]</p>';
168 168
 } else {
169
-	include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
169
+	include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php');
170 170
 	$now = $_SERVER['REQUEST_TIME'] + $server_offset_time;
171 171
 	$ph['now'] = strftime('%H:%M:%S', $now);
172 172
 	$timetocheck = ($now - (60 * 20)); //+$server_offset_time;
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 	$userList = array();
192 192
 	$userCount = array();
193 193
 	// Create userlist with session-count first before output
194
-	while($activeusers = $modx->db->getRow($rs)) {
194
+	while ($activeusers = $modx->db->getRow($rs)) {
195 195
 		$userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1;
196 196
 
197 197
 		$idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : '';
@@ -209,9 +209,9 @@  discard block
 block discarded – undo
209 209
 			$currentaction
210 210
 		);
211 211
 	}
212
-	foreach($userList as $params) {
212
+	foreach ($userList as $params) {
213 213
 		$params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : '';
214
-		$html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
214
+		$html .= "\n\t\t".vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
215 215
 	}
216 216
 
217 217
 	$html .= '
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 $ph['OnlineInfo'] = $html;
224 224
 
225 225
 // include rss feeds for important forum topics
226
-include_once(MODX_MANAGER_PATH . 'includes/rss.inc.php');
226
+include_once(MODX_MANAGER_PATH.'includes/rss.inc.php');
227 227
 $ph['modx_security_notices_content'] = $feedData['modx_security_notices_content'];
228 228
 $ph['modx_news_content'] = $feedData['modx_news_content'];
229 229
 
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 
255 255
 // invoke event OnManagerWelcomePrerender
256 256
 $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
257
-if(is_array($evtOut)) {
257
+if (is_array($evtOut)) {
258 258
 	$output = implode('', $evtOut);
259 259
 	$ph['OnManagerWelcomePrerender'] = $output;
260 260
 }
@@ -384,57 +384,57 @@  discard block
 block discarded – undo
384 384
 
385 385
 // invoke OnManagerWelcomeHome event
386 386
 $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
387
-if(is_array($sitewidgets)) {
387
+if (is_array($sitewidgets)) {
388 388
 	$newwidgets = array();
389
-    foreach($sitewidgets as $widget){
389
+    foreach ($sitewidgets as $widget) {
390 390
         $newwidgets = array_merge($newwidgets, unserialize($widget));
391 391
     }
392 392
     $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets;
393 393
 }
394 394
 
395
-usort($widgets, function ($a, $b) {
395
+usort($widgets, function($a, $b){
396 396
 	return $a['menuindex'] - $b['menuindex'];
397 397
 });
398 398
 
399 399
 $tpl = $modx->getChunk('manager#welcome\Widget');
400 400
 $output = '';
401
-foreach($widgets as $widget) {
402
-	if ($widget['hide'] != '1'){
401
+foreach ($widgets as $widget) {
402
+	if ($widget['hide'] != '1') {
403 403
 		$output .= $modx->parseText($tpl, $widget);
404 404
 	}
405 405
 }
406 406
 $ph['widgets'] = $output;
407 407
 
408 408
 // load template
409
-if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
410
-	$modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl';
409
+if (!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
410
+	$modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH.'media/style/common/welcome.tpl';
411 411
 }
412 412
 
413 413
 $target = $modx->config['manager_welcome_tpl'];
414 414
 $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
415 415
 $target = $modx->mergeSettingsContent($target);
416 416
 
417
-if(substr($target, 0, 1) === '@') {
418
-	if(substr($target, 0, 6) === '@CHUNK') {
417
+if (substr($target, 0, 1) === '@') {
418
+	if (substr($target, 0, 6) === '@CHUNK') {
419 419
 		$content = $modx->getChunk(trim(substr($target, 7)));
420
-	} elseif(substr($target, 0, 5) === '@FILE') {
420
+	} elseif (substr($target, 0, 5) === '@FILE') {
421 421
 		$content = file_get_contents(trim(substr($target, 6)));
422 422
 	} else {
423 423
 		$content = '';
424 424
 	}
425 425
 } else {
426 426
 	$chunk = $modx->getChunk($target);
427
-	if($chunk !== false && !empty($chunk)) {
427
+	if ($chunk !== false && !empty($chunk)) {
428 428
 		$content = $chunk;
429
-	} elseif(is_file(MODX_BASE_PATH . $target)) {
430
-		$content = file_get_contents(MODX_BASE_PATH . $target);
431
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
432
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl');
433
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible
429
+	} elseif (is_file(MODX_BASE_PATH.$target)) {
430
+		$content = file_get_contents(MODX_BASE_PATH.$target);
431
+	} elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/welcome.tpl')) {
432
+		$content = file_get_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/welcome.tpl');
433
+	} elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/welcome.html')) // ClipperCMS compatible
434 434
 	{
435
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
435
+		$content = file_get_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/welcome.html');
436 436
 	} else {
437
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
437
+		$content = file_get_contents(MODX_MANAGER_PATH.'media/style/common/welcome.tpl');
438 438
 	}
439 439
 }
440 440
 
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 $content = $modx->mergeConditionalTagsContent($content);
443 443
 $content = $modx->mergeSettingsContent($content);
444 444
 $content = $modx->parseText($content, $ph);
445
-if(strpos($content, '[+') !== false) {
445
+if (strpos($content, '[+') !== false) {
446 446
 	$modx->toPlaceholders($ph);
447 447
 	$content = $modx->mergePlaceholderContent($content);
448 448
 }
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 $content = $modx->parseText($content, $_style, '[&', '&]');
452 452
 $content = $modx->cleanUpMODXTags($content); //cleanup
453 453
 
454
-if($js = $modx->getRegisteredClientScripts()) {
454
+if ($js = $modx->getRegisteredClientScripts()) {
455 455
 	$content .= $js;
456 456
 }
457 457
 
Please login to merge, or discard this patch.
manager/includes/src/Core.php 1 patch
Spacing   +268 added lines, -268 removed lines patch added patch discarded remove patch
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
      */
216 216
     function __call($method_name, $arguments)
217 217
     {
218
-        include_once(MODX_MANAGER_PATH . 'includes/extenders/deprecated.functions.inc.php');
218
+        include_once(MODX_MANAGER_PATH.'includes/extenders/deprecated.functions.inc.php');
219 219
         if (method_exists($this->old, $method_name)) {
220 220
             $error_type = 1;
221 221
         } else {
@@ -233,12 +233,12 @@  discard block
 block discarded – undo
233 233
             $info = debug_backtrace();
234 234
             $m[] = $msg;
235 235
             if (!empty($this->currentSnippet)) {
236
-                $m[] = 'Snippet - ' . $this->currentSnippet;
236
+                $m[] = 'Snippet - '.$this->currentSnippet;
237 237
             } elseif (!empty($this->event->activePlugin)) {
238
-                $m[] = 'Plugin - ' . $this->event->activePlugin;
238
+                $m[] = 'Plugin - '.$this->event->activePlugin;
239 239
             }
240 240
             $m[] = $this->decoded_request_uri;
241
-            $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')';
241
+            $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')';
242 242
             $msg = implode('<br />', $m);
243 243
             $this->logEvent(0, $error_type, $msg, $title);
244 244
         }
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
     {
256 256
         $flag = false;
257 257
         if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof DBAPI) {
258
-            $flag = (bool)$this->{$connector}->conn;
258
+            $flag = (bool) $this->{$connector}->conn;
259 259
         }
260 260
         return $flag;
261 261
     }
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
         }
283 283
         if (!$out && $flag) {
284 284
             $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname)));
285
-            $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php";
285
+            $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php";
286 286
             $out = is_file($filename) ? include $filename : false;
287 287
         }
288 288
         if ($out && !in_array($extname, $this->extensions)) {
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
     public function getMicroTime()
300 300
     {
301 301
         list ($usec, $sec) = explode(' ', microtime());
302
-        return ((float)$usec + (float)$sec);
302
+        return ((float) $usec + (float) $sec);
303 303
     }
304 304
 
305 305
     /**
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
             // append the redirect count string to the url
324 324
             $currentNumberOfRedirects = isset ($_REQUEST['err']) ? $_REQUEST['err'] : 0;
325 325
             if ($currentNumberOfRedirects > 3) {
326
-                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>');
326
+                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>');
327 327
             } else {
328 328
                 $currentNumberOfRedirects += 1;
329 329
                 if (strpos($url, "?") > 0) {
@@ -334,9 +334,9 @@  discard block
 block discarded – undo
334 334
             }
335 335
         }
336 336
         if ($type == 'REDIRECT_REFRESH') {
337
-            $header = 'Refresh: 0;URL=' . $url;
337
+            $header = 'Refresh: 0;URL='.$url;
338 338
         } elseif ($type == 'REDIRECT_META') {
339
-            $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />';
339
+            $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />';
340 340
             echo $header;
341 341
             exit;
342 342
         } elseif ($type == 'REDIRECT_HEADER' || empty ($type)) {
@@ -344,10 +344,10 @@  discard block
 block discarded – undo
344 344
             global $base_url, $site_url;
345 345
             if (substr($url, 0, strlen($base_url)) == $base_url) {
346 346
                 // append $site_url to make it work with Location:
347
-                $url = $site_url . substr($url, strlen($base_url));
347
+                $url = $site_url.substr($url, strlen($base_url));
348 348
             }
349 349
             if (strpos($url, "\n") === false) {
350
-                $header = 'Location: ' . $url;
350
+                $header = 'Location: '.$url;
351 351
             } else {
352 352
                 $this->messageQuit('No newline allowed in redirect url.');
353 353
             }
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
             header($responseCode);
357 357
         }
358 358
 
359
-        if(!empty($header)) {
359
+        if (!empty($header)) {
360 360
             header($header);
361 361
         }
362 362
 
@@ -461,8 +461,8 @@  discard block
 block discarded – undo
461 461
 
462 462
     private function recoverySiteCache()
463 463
     {
464
-        $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder();
465
-        $site_cache_path = $site_cache_dir . 'siteCache.idx.php';
464
+        $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder();
465
+        $site_cache_path = $site_cache_dir.'siteCache.idx.php';
466 466
 
467 467
         if (is_file($site_cache_path)) {
468 468
             include($site_cache_path);
@@ -522,8 +522,8 @@  discard block
 block discarded – undo
522 522
                 $this->invokeEvent("OnBeforeManagerPageInit");
523 523
             }
524 524
 
525
-            if (isset ($_SESSION[$usrType . 'UsrConfigSet'])) {
526
-                $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet'];
525
+            if (isset ($_SESSION[$usrType.'UsrConfigSet'])) {
526
+                $usrSettings = &$_SESSION[$usrType.'UsrConfigSet'];
527 527
             } else {
528 528
                 if ($usrType == 'web') {
529 529
                     $from = $tbl_web_user_settings;
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
                     $usrSettings[$row['setting_name']] = $row['setting_value'];
544 544
                 }
545 545
                 if (isset ($usrType)) {
546
-                    $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings;
546
+                    $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings;
547 547
                 } // store user settings in session
548 548
             }
549 549
         }
@@ -688,10 +688,10 @@  discard block
 block discarded – undo
688 688
         $suf = $this->config['friendly_url_suffix'];
689 689
         $pre = preg_quote($pre, '/');
690 690
         $suf = preg_quote($suf, '/');
691
-        if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) {
691
+        if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) {
692 692
             $q = $_[1];
693 693
         }
694
-        if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) {
694
+        if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) {
695 695
             $q = $_[1];
696 696
         }
697 697
 
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
         if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { /* we got an ID returned, check to make sure it's not an alias */
714 714
             /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */
715 715
             if ($this->config['use_alias_path'] == 1) {
716
-                if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir . '/' . $q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) {
716
+                if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir.'/'.$q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) {
717 717
                     $this->documentMethod = 'id';
718 718
                     return $q;
719 719
                 } else { /* not a valid id in terms of virtualDir, treat as alias */
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
      */
748 748
     public function getHashFile($key)
749 749
     {
750
-        return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php";
750
+        return $this->getCacheFolder()."docid_".$key.".pageCache.php";
751 751
     }
752 752
 
753 753
     /**
@@ -758,9 +758,9 @@  discard block
 block discarded – undo
758 758
         $hash = $id;
759 759
         $tmp = null;
760 760
         $params = array();
761
-        if(!empty($this->systemCacheKey)){
761
+        if (!empty($this->systemCacheKey)) {
762 762
             $hash = $this->systemCacheKey;
763
-        }else {
763
+        } else {
764 764
             if (!empty($_GET)) {
765 765
                 // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID.
766 766
                 $params = $_GET;
@@ -768,8 +768,8 @@  discard block
 block discarded – undo
768 768
                 $hash .= '_'.md5(http_build_query($params));
769 769
             }
770 770
         }
771
-        $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params));
772
-        if (is_array($evtOut) && count($evtOut) > 0){
771
+        $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params));
772
+        if (is_array($evtOut) && count($evtOut) > 0) {
773 773
             $tmp = array_pop($evtOut);
774 774
         }
775 775
         return empty($tmp) ? $hash : $tmp;
@@ -911,12 +911,12 @@  discard block
 block discarded – undo
911 911
         if ($js = $this->getRegisteredClientStartupScripts()) {
912 912
             // change to just before closing </head>
913 913
             // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent);
914
-            $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput);
914
+            $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput);
915 915
         }
916 916
 
917 917
         // Insert jscripts & html block into template - template must have a </body> tag
918 918
         if ($js = $this->getRegisteredClientScripts()) {
919
-            $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput);
919
+            $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput);
920 920
         }
921 921
         // End fix by sirlancelot
922 922
 
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
         // send out content-type and content-disposition headers
928 928
         if (IN_PARSER_MODE == "true") {
929 929
             $type = !empty ($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html";
930
-            header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']);
930
+            header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']);
931 931
             //            if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error)
932 932
             //                header('HTTP/1.0 404 Not Found');
933 933
             if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) {
@@ -945,7 +945,7 @@  discard block
 block discarded – undo
945 945
                     $name = preg_replace('|-+|', '-', $name);
946 946
                     $name = trim($name, '-');
947 947
                 }
948
-                $header = 'Content-Disposition: attachment; filename=' . $name;
948
+                $header = 'Content-Disposition: attachment; filename='.$name;
949 949
                 header($header);
950 950
             }
951 951
         }
@@ -953,7 +953,7 @@  discard block
 block discarded – undo
953 953
 
954 954
         $stats = $this->getTimerStats($this->tstart);
955 955
 
956
-        $out =& $this->documentOutput;
956
+        $out = & $this->documentOutput;
957 957
         $out = str_replace("[^q^]", $stats['queries'], $out);
958 958
         $out = str_replace("[^qt^]", $stats['queryTime'], $out);
959 959
         $out = str_replace("[^p^]", $stats['phpTime'], $out);
@@ -992,17 +992,17 @@  discard block
 block discarded – undo
992 992
                 $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet
993 993
                 $tt += $t;
994 994
             }
995
-            echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms", $tt) . ")</legend>{$sc}</fieldset><br />";
995
+            echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms", $tt).")</legend>{$sc}</fieldset><br />";
996 996
             echo $this->snippetsCode;
997 997
         }
998 998
         if ($this->dumpPlugins) {
999 999
             $ps = "";
1000 1000
             $tt = 0;
1001 1001
             foreach ($this->pluginsTime as $s => $t) {
1002
-                $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>";
1002
+                $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>";
1003 1003
                 $tt += $t;
1004 1004
             }
1005
-            echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms", $tt * 1000) . ")</legend>{$ps}</fieldset><br />";
1005
+            echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms", $tt * 1000).")</legend>{$ps}</fieldset><br />";
1006 1006
             echo $this->pluginsCode;
1007 1007
         }
1008 1008
 
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
         $srcTags = explode(',', $tags);
1029 1029
         $repTags = array();
1030 1030
         foreach ($srcTags as $tag) {
1031
-            $repTags[] = '\\' . $tag[0] . '\\' . $tag[1];
1031
+            $repTags[] = '\\'.$tag[0].'\\'.$tag[1];
1032 1032
         }
1033 1033
         return array($srcTags, $repTags);
1034 1034
     }
@@ -1050,7 +1050,7 @@  discard block
 block discarded – undo
1050 1050
         $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']);
1051 1051
         $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache";
1052 1052
         $stats['queries'] = isset ($this->executedQueries) ? $this->executedQueries : 0;
1053
-        $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb";
1053
+        $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb";
1054 1054
 
1055 1055
         return $stats;
1056 1056
     }
@@ -1083,7 +1083,7 @@  discard block
 block discarded – undo
1083 1083
     {
1084 1084
         $cacheRefreshTime = 0;
1085 1085
         $recent_update = 0;
1086
-        @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php');
1086
+        @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php');
1087 1087
         $this->recentUpdate = $recent_update;
1088 1088
 
1089 1089
         $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time'];
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
         // now, check for documents that need publishing
1095 1095
         $field = array('published' => 1, 'publishedon' => $timeNow);
1096 1096
         $where = "pub_date <= {$timeNow} AND pub_date!=0 AND published=0";
1097
-        $result_pub = $this->db->select( 'id', '[+prefix+]site_content',  $where);
1097
+        $result_pub = $this->db->select('id', '[+prefix+]site_content', $where);
1098 1098
         $this->db->update($field, '[+prefix+]site_content', $where);
1099 1099
         if ($this->db->getRecordCount($result_pub) >= 1) { //Event unPublished doc
1100 1100
             while ($row_pub = $this->db->getRow($result_pub)) {
@@ -1107,7 +1107,7 @@  discard block
 block discarded – undo
1107 1107
         // now, check for documents that need un-publishing
1108 1108
         $field = array('published' => 0, 'publishedon' => 0);
1109 1109
         $where = "unpub_date <= {$timeNow} AND unpub_date!=0 AND published=1";
1110
-        $result_unpub = $this->db->select( 'id', '[+prefix+]site_content',  $where);
1110
+        $result_unpub = $this->db->select('id', '[+prefix+]site_content', $where);
1111 1111
         $this->db->update($field, '[+prefix+]site_content', $where);
1112 1112
         if ($this->db->getRecordCount($result_unpub) >= 1) { //Event unPublished doc
1113 1113
             while ($row_unpub = $this->db->getRow($result_unpub)) {
@@ -1153,8 +1153,8 @@  discard block
 block discarded – undo
1153 1153
                 }
1154 1154
 
1155 1155
                 $docObjSerial = serialize($this->documentObject);
1156
-                $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent;
1157
-                $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey);
1156
+                $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent;
1157
+                $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey);
1158 1158
                 file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent");
1159 1159
             }
1160 1160
         }
@@ -1196,16 +1196,16 @@  discard block
 block discarded – undo
1196 1196
             return array();
1197 1197
         }
1198 1198
         $spacer = md5('<<<EVO>>>');
1199
-        if($left==='{{' && strpos($content,';}}')!==false)  $content = str_replace(';}}', sprintf(';}%s}',   $spacer),$content);
1200
-        if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content);
1201
-        if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]',  $spacer),$content);
1202
-        if($left==='[[' && strpos($content,']]]')!==false)  $content = str_replace(']]]', sprintf(']%s]]',   $spacer),$content);
1199
+        if ($left === '{{' && strpos($content, ';}}') !== false)  $content = str_replace(';}}', sprintf(';}%s}', $spacer), $content);
1200
+        if ($left === '{{' && strpos($content, '{{}}') !== false) $content = str_replace('{{}}', sprintf('{%$1s{}%$1s}', $spacer), $content);
1201
+        if ($left === '[[' && strpos($content, ']]]]') !== false) $content = str_replace(']]]]', sprintf(']]%s]]', $spacer), $content);
1202
+        if ($left === '[[' && strpos($content, ']]]') !== false)  $content = str_replace(']]]', sprintf(']%s]]', $spacer), $content);
1203 1203
 
1204 1204
         $pos['<![CDATA['] = strpos($content, '<![CDATA[');
1205 1205
         $pos[']]>'] = strpos($content, ']]>');
1206 1206
 
1207 1207
         if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) {
1208
-            $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3);
1208
+            $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3);
1209 1209
         }
1210 1210
 
1211 1211
         $lp = explode($left, $content);
@@ -1269,8 +1269,8 @@  discard block
 block discarded – undo
1269 1269
                 }
1270 1270
             }
1271 1271
         }
1272
-        foreach($tags as $i=>$tag) {
1273
-            if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag);
1272
+        foreach ($tags as $i=>$tag) {
1273
+            if (strpos($tag, $spacer) !== false) $tags[$i] = str_replace($spacer, '', $tag);
1274 1274
         }
1275 1275
         return $tags;
1276 1276
     }
@@ -1310,7 +1310,7 @@  discard block
 block discarded – undo
1310 1310
         }
1311 1311
 
1312 1312
         foreach ($matches[1] as $i => $key) {
1313
-            if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1313
+            if (strpos($key, '[+') !== false) continue; // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1314 1314
             if (substr($key, 0, 1) == '#') {
1315 1315
                 $key = substr($key, 1);
1316 1316
             } // remove # for QuickEdit format
@@ -1340,8 +1340,8 @@  discard block
 block discarded – undo
1340 1340
 
1341 1341
             if (strpos($content, $s) !== false) {
1342 1342
                 $content = str_replace($s, $value, $content);
1343
-            } elseif($this->debug) {
1344
-                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1343
+            } elseif ($this->debug) {
1344
+                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1345 1345
             }
1346 1346
         }
1347 1347
 
@@ -1508,8 +1508,8 @@  discard block
 block discarded – undo
1508 1508
             $s = &$matches[0][$i];
1509 1509
             if (strpos($content, $s) !== false) {
1510 1510
                 $content = str_replace($s, $value, $content);
1511
-            } elseif($this->debug) {
1512
-                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1511
+            } elseif ($this->debug) {
1512
+                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1513 1513
             }
1514 1514
         }
1515 1515
         return $content;
@@ -1562,7 +1562,7 @@  discard block
 block discarded – undo
1562 1562
             }
1563 1563
 
1564 1564
             $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags
1565
-            $value = $this->mergePlaceholderContent($value, $params);  // parse page global placeholers
1565
+            $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers
1566 1566
             if ($this->config['enable_at_syntax']) {
1567 1567
                 $value = $this->mergeConditionalTagsContent($value);
1568 1568
             }
@@ -1577,8 +1577,8 @@  discard block
 block discarded – undo
1577 1577
             $s = &$matches[0][$i];
1578 1578
             if (strpos($content, $s) !== false) {
1579 1579
                 $content = str_replace($s, $value, $content);
1580
-            } elseif($this->debug) {
1581
-                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1580
+            } elseif ($this->debug) {
1581
+                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1582 1582
             }
1583 1583
         }
1584 1584
         return $content;
@@ -1636,8 +1636,8 @@  discard block
 block discarded – undo
1636 1636
             $s = &$matches[0][$i];
1637 1637
             if (strpos($content, $s) !== false) {
1638 1638
                 $content = str_replace($s, $value, $content);
1639
-            } elseif($this->debug) {
1640
-                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1639
+            } elseif ($this->debug) {
1640
+                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1641 1641
             }
1642 1642
         }
1643 1643
         return $content;
@@ -1661,7 +1661,7 @@  discard block
 block discarded – undo
1661 1661
             return $content;
1662 1662
         }
1663 1663
 
1664
-        $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#';
1664
+        $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#';
1665 1665
         $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), $content);
1666 1666
 
1667 1667
         $pieces = explode('<@IF:', $content);
@@ -1672,7 +1672,7 @@  discard block
 block discarded – undo
1672 1672
             }
1673 1673
             list($cmd, $text) = explode('>', $split, 2);
1674 1674
             $cmd = str_replace("'", "\'", $cmd);
1675
-            $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>";
1675
+            $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>";
1676 1676
             $content .= $text;
1677 1677
         }
1678 1678
         $pieces = explode('<@ELSEIF:', $content);
@@ -1683,13 +1683,13 @@  discard block
 block discarded – undo
1683 1683
             }
1684 1684
             list($cmd, $text) = explode('>', $split, 2);
1685 1685
             $cmd = str_replace("'", "\'", $cmd);
1686
-            $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>";
1686
+            $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>";
1687 1687
             $content .= $text;
1688 1688
         }
1689 1689
 
1690 1690
         $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content);
1691 1691
         ob_start();
1692
-        $content = eval('?>' . $content);
1692
+        $content = eval('?>'.$content);
1693 1693
         $content = ob_get_clean();
1694 1694
         $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'), $content);
1695 1695
 
@@ -1814,7 +1814,7 @@  discard block
 block discarded – undo
1814 1814
         $matches = $this->getTagsFromContent($content, $left, $right);
1815 1815
         if (!empty($matches)) {
1816 1816
             foreach ($matches[0] as $i => $v) {
1817
-                $addBreakMatches[$i] = $v . "\n";
1817
+                $addBreakMatches[$i] = $v."\n";
1818 1818
             }
1819 1819
             $content = str_replace($addBreakMatches, '', $content);
1820 1820
             if (strpos($content, $left) !== false) {
@@ -1847,8 +1847,8 @@  discard block
 block discarded – undo
1847 1847
             $s = &$matches[0][$i];
1848 1848
             if (strpos($content, $s) !== false) {
1849 1849
                 $content = str_replace($s, $v, $content);
1850
-            } elseif($this->debug) {
1851
-                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1850
+            } elseif ($this->debug) {
1851
+                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1852 1852
             }
1853 1853
         }
1854 1854
         return $content;
@@ -1912,7 +1912,7 @@  discard block
 block discarded – undo
1912 1912
                 $msg = ($msg === false) ? 'ob_get_contents() error' : $msg;
1913 1913
                 $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin', $error_info['message'], $error_info['line'], $msg);
1914 1914
                 if ($this->isBackend()) {
1915
-                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>');
1915
+                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>');
1916 1916
                 }
1917 1917
             }
1918 1918
         } else {
@@ -1958,7 +1958,7 @@  discard block
 block discarded – undo
1958 1958
                 $echo = ($echo === false) ? 'ob_get_contents() error' : $echo;
1959 1959
                 $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet', $error_info['message'], $error_info['line'], $echo);
1960 1960
                 if ($this->isBackend()) {
1961
-                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>');
1961
+                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>');
1962 1962
                 }
1963 1963
             }
1964 1964
         }
@@ -1966,7 +1966,7 @@  discard block
 block discarded – undo
1966 1966
         if (is_array($return) || is_object($return)) {
1967 1967
             return $return;
1968 1968
         } else {
1969
-            return $echo . $return;
1969
+            return $echo.$return;
1970 1970
         }
1971 1971
     }
1972 1972
 
@@ -2004,8 +2004,8 @@  discard block
 block discarded – undo
2004 2004
                 }
2005 2005
                 if (strpos($content, $s) !== false) {
2006 2006
                     $content = str_replace($s, $value, $content);
2007
-                } elseif($this->debug) {
2008
-                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2);
2007
+                } elseif ($this->debug) {
2008
+                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2);
2009 2009
                 }
2010 2010
                 continue;
2011 2011
             }
@@ -2016,8 +2016,8 @@  discard block
 block discarded – undo
2016 2016
 
2017 2017
             if (strpos($content, $s) !== false) {
2018 2018
                 $content = str_replace($s, $value, $content);
2019
-            } elseif($this->debug) {
2020
-                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2);
2019
+            } elseif ($this->debug) {
2020
+                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2);
2021 2021
             }
2022 2022
         }
2023 2023
 
@@ -2108,7 +2108,7 @@  discard block
 block discarded – undo
2108 2108
             $eventtime = sprintf('%2.2f ms', $eventtime * 1000);
2109 2109
             $code = str_replace("\t", '  ', $this->htmlspecialchars($value));
2110 2110
             $piece = str_replace("\t", '  ', $this->htmlspecialchars($piece));
2111
-            $print_r_params = str_replace("\t", '  ', $this->htmlspecialchars('$modx->event->params = ' . print_r($params, true)));
2111
+            $print_r_params = str_replace("\t", '  ', $this->htmlspecialchars('$modx->event->params = '.print_r($params, true)));
2112 2112
             $this->snippetsCode .= sprintf('<fieldset style="margin:1em;"><legend><b>%s</b>(%s)</legend><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">[[%s]]</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre></fieldset>', $snippetObject['name'], $eventtime, $piece, $print_r_params, $code);
2113 2113
             $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime);
2114 2114
         }
@@ -2353,7 +2353,7 @@  discard block
 block discarded – undo
2353 2353
             $rs = $this->db->select('name,snippet,properties', '[+prefix+]site_snippets', $where);
2354 2354
             $count = $this->db->getRecordCount($rs);
2355 2355
             if (1 < $count) {
2356
-                exit('Error $modx->_getSnippetObject()' . $snip_name);
2356
+                exit('Error $modx->_getSnippetObject()'.$snip_name);
2357 2357
             }
2358 2358
             if ($count) {
2359 2359
                 $row = $this->db->getRow($rs);
@@ -2379,7 +2379,7 @@  discard block
 block discarded – undo
2379 2379
     public function toAlias($text)
2380 2380
     {
2381 2381
         $suff = $this->config['friendly_url_suffix'];
2382
-        return str_replace(array('.xml' . $suff, '.rss' . $suff, '.js' . $suff, '.css' . $suff, '.txt' . $suff, '.json' . $suff, '.pdf' . $suff), array('.xml', '.rss', '.js', '.css', '.txt', '.json', '.pdf'), $text);
2382
+        return str_replace(array('.xml'.$suff, '.rss'.$suff, '.js'.$suff, '.css'.$suff, '.txt'.$suff, '.json'.$suff, '.pdf'.$suff), array('.xml', '.rss', '.js', '.css', '.txt', '.json', '.pdf'), $text);
2383 2383
     }
2384 2384
 
2385 2385
     /**
@@ -2411,7 +2411,7 @@  discard block
 block discarded – undo
2411 2411
                 $suff = '/';
2412 2412
             }
2413 2413
 
2414
-            $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff;
2414
+            $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff;
2415 2415
         }
2416 2416
 
2417 2417
         $evtOut = $this->invokeEvent('OnMakeDocUrl', array(
@@ -2448,7 +2448,7 @@  discard block
 block discarded – undo
2448 2448
                 preg_match_all('!\[\~([0-9]+)\~\]!ise', $documentSource, $match);
2449 2449
                 $ids = implode(',', array_unique($match['1']));
2450 2450
                 if ($ids) {
2451
-                    $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'");
2451
+                    $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'");
2452 2452
                     while ($row = $this->db->getRow($res)) {
2453 2453
                         if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) {
2454 2454
                             $parent = $row['parent'];
@@ -2459,7 +2459,7 @@  discard block
 block discarded – undo
2459 2459
                                 $parent = $this->aliasListing[$parent]['parent'];
2460 2460
                             }
2461 2461
 
2462
-                            $aliases[$row['id']] = $path . '/' . $row['alias'];
2462
+                            $aliases[$row['id']] = $path.'/'.$row['alias'];
2463 2463
                         } else {
2464 2464
                             $aliases[$row['id']] = $row['alias'];
2465 2465
                         }
@@ -2471,7 +2471,7 @@  discard block
 block discarded – undo
2471 2471
             $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0);
2472 2472
             $pref = $this->config['friendly_url_prefix'];
2473 2473
             $suff = $this->config['friendly_url_suffix'];
2474
-            $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2474
+            $documentSource = preg_replace_callback($in, function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2475 2475
                 global $modx;
2476 2476
                 $thealias = $aliases[$m[1]];
2477 2477
                 $thefolder = $isfolder[$m[1]];
@@ -2487,7 +2487,7 @@  discard block
 block discarded – undo
2487 2487
 
2488 2488
         } else {
2489 2489
             $in = '!\[\~([0-9]+)\~\]!is';
2490
-            $out = "index.php?id=" . '\1';
2490
+            $out = "index.php?id=".'\1';
2491 2491
             $documentSource = preg_replace($in, $out, $documentSource);
2492 2492
         }
2493 2493
 
@@ -2508,7 +2508,7 @@  discard block
 block discarded – undo
2508 2508
         $scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
2509 2509
         $len_base_url = strlen($this->config['base_url']);
2510 2510
 
2511
-        $url_path = $q;//LANG
2511
+        $url_path = $q; //LANG
2512 2512
 
2513 2513
         if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) {
2514 2514
             $url_path = substr($url_path, $len_base_url);
@@ -2520,7 +2520,7 @@  discard block
 block discarded – undo
2520 2520
             $strictURL = substr($strictURL, $len_base_url);
2521 2521
         }
2522 2522
         $http_host = $_SERVER['HTTP_HOST'];
2523
-        $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG
2523
+        $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG
2524 2524
 
2525 2525
         $site_url = $this->config['site_url'];
2526 2526
         $url_query_string = explode('?', $_SERVER['REQUEST_URI']);
@@ -2538,7 +2538,7 @@  discard block
 block discarded – undo
2538 2538
                 }
2539 2539
                 if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) {
2540 2540
                     if (empty($_POST)) {
2541
-                        if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) {
2541
+                        if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) {
2542 2542
                             $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently');
2543 2543
                             exit(0);
2544 2544
                         }
@@ -2597,7 +2597,7 @@  discard block
 block discarded – undo
2597 2597
                 $docgrp = implode(",", $docgrp);
2598 2598
             }
2599 2599
             // get document
2600
-            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
2600
+            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
2601 2601
             $rs = $this->db->select('sc.*', "{$tblsc} sc
2602 2602
                 LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1);
2603 2603
             if ($this->db->getRecordCount($rs) < 1) {
@@ -2633,9 +2633,9 @@  discard block
 block discarded – undo
2633 2633
             }
2634 2634
             if ($documentObject['template']) {
2635 2635
                 // load TVs and merge with document - Orig by Apodigm - Docvars
2636
-                $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars") . " tv
2637
-                INNER JOIN " . $this->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id
2638
-                LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'");
2636
+                $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars")." tv
2637
+                INNER JOIN " . $this->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id
2638
+                LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'");
2639 2639
                 $tmplvars = array();
2640 2640
                 while ($row = $this->db->getRow($rs)) {
2641 2641
                     $tmplvars[$row['name']] = array(
@@ -2681,7 +2681,7 @@  discard block
 block discarded – undo
2681 2681
                 $st = md5($source);
2682 2682
             }
2683 2683
             if ($this->dumpSnippets == 1) {
2684
-                $this->snippetsCode .= "<fieldset><legend><b style='color: #821517;'>PARSE PASS " . ($i + 1) . "</b></legend><p>The following snippets (if any) were parsed during this pass.</p>";
2684
+                $this->snippetsCode .= "<fieldset><legend><b style='color: #821517;'>PARSE PASS ".($i + 1)."</b></legend><p>The following snippets (if any) were parsed during this pass.</p>";
2685 2685
             }
2686 2686
 
2687 2687
             // invoke OnParseDocument event
@@ -2723,7 +2723,7 @@  discard block
 block discarded – undo
2723 2723
      */
2724 2724
     public function executeParser()
2725 2725
     {
2726
-        if(MODX_CLI) {
2726
+        if (MODX_CLI) {
2727 2727
             throw new \RuntimeException('Call DocumentParser::executeParser on CLI mode');
2728 2728
         }
2729 2729
 
@@ -2769,7 +2769,7 @@  discard block
 block discarded – undo
2769 2769
 
2770 2770
             // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path
2771 2771
             if ($this->config['use_alias_path'] == 1) {
2772
-                $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier;
2772
+                $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier;
2773 2773
                 if (isset($this->documentListing[$alias])) {
2774 2774
                     $this->documentIdentifier = $this->documentListing[$alias];
2775 2775
                 } else {
@@ -2830,7 +2830,7 @@  discard block
 block discarded – undo
2830 2830
                 } else {
2831 2831
                     $docAlias = $this->db->escape($this->documentIdentifier);
2832 2832
                     $rs = $this->db->select('id', $this->getFullTableName('site_content'), "deleted=0 and alias='{$docAlias}'");
2833
-                    $this->documentIdentifier = (int)$this->db->getValue($rs);
2833
+                    $this->documentIdentifier = (int) $this->db->getValue($rs);
2834 2834
                 }
2835 2835
             }
2836 2836
             $this->documentMethod = 'id';
@@ -2887,7 +2887,7 @@  discard block
 block discarded – undo
2887 2887
                 $_REQUEST[$n] = $_GET[$n] = $v;
2888 2888
             }
2889 2889
         }
2890
-        $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path'];
2890
+        $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path'];
2891 2891
         $this->q = $qp['path'];
2892 2892
         return $qp['path'];
2893 2893
     }
@@ -3033,7 +3033,7 @@  discard block
 block discarded – undo
3033 3033
         while ($id && $height--) {
3034 3034
             $thisid = $id;
3035 3035
             if ($this->config['aliaslistingfolder'] == 1) {
3036
-                $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM " . $this->getFullTableName("site_content") . " WHERE `id` = '{$id}' LIMIT 0,1");
3036
+                $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM ".$this->getFullTableName("site_content")." WHERE `id` = '{$id}' LIMIT 0,1");
3037 3037
                 if (!$id || $id == '0') {
3038 3038
                     break;
3039 3039
                 }
@@ -3084,15 +3084,15 @@  discard block
 block discarded – undo
3084 3084
 
3085 3085
         if ($this->config['aliaslistingfolder'] == 1) {
3086 3086
 
3087
-            $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (" . $id . ") AND deleted = '0'");
3087
+            $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (".$id.") AND deleted = '0'");
3088 3088
             $idx = array();
3089 3089
             while ($row = $this->db->getRow($res)) {
3090 3090
                 $pAlias = '';
3091 3091
                 if (isset($this->aliasListing[$row['parent']])) {
3092
-                    $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : '';
3093
-                    $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : '';
3092
+                    $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : '';
3093
+                    $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : '';
3094 3094
                 };
3095
-                $children[$pAlias . $row['alias']] = $row['id'];
3095
+                $children[$pAlias.$row['alias']] = $row['id'];
3096 3096
                 if ($row['isfolder'] == 1) {
3097 3097
                     $idx[] = $row['id'];
3098 3098
                 }
@@ -3124,7 +3124,7 @@  discard block
 block discarded – undo
3124 3124
                 $depth--;
3125 3125
 
3126 3126
                 foreach ($documentMap_cache[$id] as $childId) {
3127
-                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias'];
3127
+                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias'];
3128 3128
                     if (!strlen($pkey)) {
3129 3129
                         $pkey = "{$childId}";
3130 3130
                     }
@@ -3161,7 +3161,7 @@  discard block
 block discarded – undo
3161 3161
                 $fnc = 'history.back(-1);';
3162 3162
                 break;
3163 3163
             default:
3164
-                $fnc = "window.location.href='" . addslashes($url) . "';";
3164
+                $fnc = "window.location.href='".addslashes($url)."';";
3165 3165
         }
3166 3166
 
3167 3167
         echo "<html><head>
@@ -3193,9 +3193,9 @@  discard block
 block discarded – undo
3193 3193
         $state = 0;
3194 3194
         $pms = $_SESSION['mgrPermissions'];
3195 3195
         if ($pms) {
3196
-            $state = ((bool)$pms[$pm] === true);
3196
+            $state = ((bool) $pms[$pm] === true);
3197 3197
         }
3198
-        return (int)$state;
3198
+        return (int) $state;
3199 3199
     }
3200 3200
 
3201 3201
     /**
@@ -3208,8 +3208,8 @@  discard block
 block discarded – undo
3208 3208
      */
3209 3209
     public function elementIsLocked($type, $id, $includeThisUser = false)
3210 3210
     {
3211
-        $id = (int)$id;
3212
-        $type = (int)$type;
3211
+        $id = (int) $id;
3212
+        $type = (int) $type;
3213 3213
         if (!$type || !$id) {
3214 3214
             return null;
3215 3215
         }
@@ -3259,7 +3259,7 @@  discard block
 block discarded – undo
3259 3259
             return $lockedElements;
3260 3260
         }
3261 3261
 
3262
-        $type = (int)$type;
3262
+        $type = (int) $type;
3263 3263
         if (isset($lockedElements[$type])) {
3264 3264
             return $lockedElements[$type];
3265 3265
         } else {
@@ -3276,7 +3276,7 @@  discard block
 block discarded – undo
3276 3276
             $this->lockedElements = array();
3277 3277
             $this->cleanupExpiredLocks();
3278 3278
 
3279
-            $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks') . " ul
3279
+            $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks')." ul
3280 3280
                 LEFT JOIN {$this->getFullTableName('manager_users')} mu on ul.internalKey = mu.id");
3281 3281
             while ($row = $this->db->getRow($rs)) {
3282 3282
                 $this->lockedElements[$row['elementType']][$row['elementId']] = array(
@@ -3299,7 +3299,7 @@  discard block
 block discarded – undo
3299 3299
     public function cleanupExpiredLocks()
3300 3300
     {
3301 3301
         // Clean-up active_user_sessions first
3302
-        $timeout = (int)$this->config['session_timeout'] < 2 ? 120 : $this->config['session_timeout'] * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum
3302
+        $timeout = (int) $this->config['session_timeout'] < 2 ? 120 : $this->config['session_timeout'] * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum
3303 3303
         $validSessionTimeLimit = $this->time - $timeout;
3304 3304
         $this->db->delete($this->getFullTableName('active_user_sessions'), "lasthit < {$validSessionTimeLimit}");
3305 3305
 
@@ -3312,7 +3312,7 @@  discard block
 block discarded – undo
3312 3312
             foreach ($rs as $row) {
3313 3313
                 $userSids[] = $row['sid'];
3314 3314
             }
3315
-            $userSids = "'" . implode("','", $userSids) . "'";
3315
+            $userSids = "'".implode("','", $userSids)."'";
3316 3316
             $this->db->delete($this->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})");
3317 3317
         } else {
3318 3318
             $this->db->delete($this->getFullTableName('active_user_locks'));
@@ -3396,8 +3396,8 @@  discard block
 block discarded – undo
3396 3396
     public function lockElement($type, $id)
3397 3397
     {
3398 3398
         $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0;
3399
-        $type = (int)$type;
3400
-        $id = (int)$id;
3399
+        $type = (int) $type;
3400
+        $id = (int) $id;
3401 3401
         if (!$type || !$id || !$userId) {
3402 3402
             return false;
3403 3403
         }
@@ -3418,8 +3418,8 @@  discard block
 block discarded – undo
3418 3418
     public function unlockElement($type, $id, $includeAllUsers = false)
3419 3419
     {
3420 3420
         $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0;
3421
-        $type = (int)$type;
3422
-        $id = (int)$id;
3421
+        $type = (int) $type;
3422
+        $id = (int) $id;
3423 3423
         if (!$type || !$id) {
3424 3424
             return false;
3425 3425
         }
@@ -3486,8 +3486,8 @@  discard block
 block discarded – undo
3486 3486
         }
3487 3487
 
3488 3488
         $usertype = $this->isFrontend() ? 1 : 0;
3489
-        $evtid = (int)$evtid;
3490
-        $type = (int)$type;
3489
+        $evtid = (int) $evtid;
3490
+        $type = (int) $type;
3491 3491
 
3492 3492
         // Types: 1 = information, 2 = warning, 3 = error
3493 3493
         if ($type < 1) {
@@ -3509,8 +3509,8 @@  discard block
 block discarded – undo
3509 3509
         if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') {
3510 3510
             if ($this->config['send_errormail'] <= $type) {
3511 3511
                 $this->sendmail(array(
3512
-                    'subject' => 'MODX System Error on ' . $this->config['site_name'],
3513
-                    'body' => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.',
3512
+                    'subject' => 'MODX System Error on '.$this->config['site_name'],
3513
+                    'body' => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.',
3514 3514
                     'type' => 'text'
3515 3515
                 ));
3516 3516
             }
@@ -3559,7 +3559,7 @@  discard block
 block discarded – undo
3559 3559
             $p['fromname'] = $userinfo['username'];
3560 3560
         }
3561 3561
         if ($msg === '' && !isset($p['body'])) {
3562
-            $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER'];
3562
+            $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER'];
3563 3563
         } elseif (is_string($msg) && 0 < strlen($msg)) {
3564 3564
             $p['body'] = $msg;
3565 3565
         }
@@ -3601,8 +3601,8 @@  discard block
 block discarded – undo
3601 3601
             $files = array();
3602 3602
         }
3603 3603
         foreach ($files as $f) {
3604
-            if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) {
3605
-                $this->mail->AddAttachment(MODX_BASE_PATH . $f);
3604
+            if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) {
3605
+                $this->mail->AddAttachment(MODX_BASE_PATH.$f);
3606 3606
             }
3607 3607
         }
3608 3608
         return $this->mail->send();
@@ -3646,7 +3646,7 @@  discard block
 block discarded – undo
3646 3646
      */
3647 3647
     public function isFrontend()
3648 3648
     {
3649
-        return ! $this->isBackend();
3649
+        return !$this->isBackend();
3650 3650
     }
3651 3651
 
3652 3652
     /**
@@ -3671,14 +3671,14 @@  discard block
 block discarded – undo
3671 3671
         $tblsc = $this->getFullTableName("site_content");
3672 3672
         $tbldg = $this->getFullTableName("document_groups");
3673 3673
         // modify field names to use sc. table reference
3674
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3675
-        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3674
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3675
+        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3676 3676
         // get document groups for current user
3677 3677
         if ($docgrp = $this->getUserDocGroups()) {
3678 3678
             $docgrp = implode(",", $docgrp);
3679 3679
         }
3680 3680
         // build query
3681
-        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3681
+        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3682 3682
         $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3683 3683
                 LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}");
3684 3684
         $resourceArray = $this->db->makeArray($result);
@@ -3708,14 +3708,14 @@  discard block
 block discarded – undo
3708 3708
         $tbldg = $this->getFullTableName("document_groups");
3709 3709
 
3710 3710
         // modify field names to use sc. table reference
3711
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3712
-        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3711
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3712
+        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3713 3713
         // get document groups for current user
3714 3714
         if ($docgrp = $this->getUserDocGroups()) {
3715 3715
             $docgrp = implode(",", $docgrp);
3716 3716
         }
3717 3717
         // build query
3718
-        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3718
+        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3719 3719
         $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3720 3720
                 LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND sc.published=1 AND sc.deleted=0 AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}");
3721 3721
         $resourceArray = $this->db->makeArray($result);
@@ -3750,16 +3750,16 @@  discard block
 block discarded – undo
3750 3750
             return $this->tmpCache[__FUNCTION__][$cacheKey];
3751 3751
         }
3752 3752
 
3753
-        $published = ($published !== 'all') ? 'AND sc.published = ' . $published : '';
3754
-        $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : '';
3753
+        $published = ($published !== 'all') ? 'AND sc.published = '.$published : '';
3754
+        $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : '';
3755 3755
 
3756 3756
         if ($where != '') {
3757
-            $where = 'AND ' . $where;
3757
+            $where = 'AND '.$where;
3758 3758
         }
3759 3759
 
3760 3760
         // modify field names to use sc. table reference
3761
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3762
-        $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3761
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3762
+        $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3763 3763
 
3764 3764
         // get document groups for current user
3765 3765
         if ($docgrp = $this->getUserDocGroups()) {
@@ -3767,7 +3767,7 @@  discard block
 block discarded – undo
3767 3767
         }
3768 3768
 
3769 3769
         // build query
3770
-        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
3770
+        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')');
3771 3771
 
3772 3772
         $tblsc = $this->getFullTableName('site_content');
3773 3773
         $tbldg = $this->getFullTableName('document_groups');
@@ -3819,10 +3819,10 @@  discard block
 block discarded – undo
3819 3819
             return false;
3820 3820
         } else {
3821 3821
             // modify field names to use sc. table reference
3822
-            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3823
-            $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3822
+            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3823
+            $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3824 3824
             if ($where != '') {
3825
-                $where = 'AND ' . $where;
3825
+                $where = 'AND '.$where;
3826 3826
             }
3827 3827
 
3828 3828
             $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : '';
@@ -3833,13 +3833,13 @@  discard block
 block discarded – undo
3833 3833
                 $docgrp = implode(',', $docgrp);
3834 3834
             }
3835 3835
 
3836
-            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
3836
+            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')');
3837 3837
 
3838 3838
             $tblsc = $this->getFullTableName('site_content');
3839 3839
             $tbldg = $this->getFullTableName('document_groups');
3840 3840
 
3841 3841
             $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3842
-                    LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (" . implode(',', $ids) . ") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit);
3842
+                    LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (".implode(',', $ids).") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit);
3843 3843
 
3844 3844
             $resourceArray = $this->db->makeArray($result);
3845 3845
 
@@ -3944,12 +3944,12 @@  discard block
 block discarded – undo
3944 3944
             $tbldg = $this->getFullTableName("document_groups");
3945 3945
             $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : "";
3946 3946
             // modify field names to use sc. table reference
3947
-            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3947
+            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3948 3948
             // get document groups for current user
3949 3949
             if ($docgrp = $this->getUserDocGroups()) {
3950 3950
                 $docgrp = implode(",", $docgrp);
3951 3951
             }
3952
-            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3952
+            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3953 3953
             $result = $this->db->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1);
3954 3954
             $pageInfo = $this->db->getRow($result);
3955 3955
 
@@ -3996,7 +3996,7 @@  discard block
 block discarded – undo
3996 3996
     {
3997 3997
         if ($this->currentSnippet) {
3998 3998
             $tbl = $this->getFullTableName("site_snippets");
3999
-            $rs = $this->db->select('id', $tbl, "name='" . $this->db->escape($this->currentSnippet) . "'", '', 1);
3999
+            $rs = $this->db->select('id', $tbl, "name='".$this->db->escape($this->currentSnippet)."'", '', 1);
4000 4000
             if ($snippetId = $this->db->getValue($rs)) {
4001 4001
                 return $snippetId;
4002 4002
             }
@@ -4023,7 +4023,7 @@  discard block
 block discarded – undo
4023 4023
      */
4024 4024
     public function clearCache($type = '', $report = false)
4025 4025
     {
4026
-        $cache_dir = MODX_BASE_PATH . $this->getCacheFolder();
4026
+        $cache_dir = MODX_BASE_PATH.$this->getCacheFolder();
4027 4027
         if (is_array($type)) {
4028 4028
             foreach ($type as $_) {
4029 4029
                 $this->clearCache($_, $report);
@@ -4035,10 +4035,10 @@  discard block
 block discarded – undo
4035 4035
             $sync->emptyCache();
4036 4036
         } elseif (preg_match('@^[1-9][0-9]*$@', $type)) {
4037 4037
             $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type;
4038
-            $file_name = "docid_" . $key . "_*.pageCache.php";
4039
-            $cache_path = $cache_dir . $file_name;
4038
+            $file_name = "docid_".$key."_*.pageCache.php";
4039
+            $cache_path = $cache_dir.$file_name;
4040 4040
             $files = glob($cache_path);
4041
-            $files[] = $cache_dir . "docid_" . $key . ".pageCache.php";
4041
+            $files[] = $cache_dir."docid_".$key.".pageCache.php";
4042 4042
             foreach ($files as $file) {
4043 4043
                 if (!is_file($file)) {
4044 4044
                     continue;
@@ -4046,7 +4046,7 @@  discard block
 block discarded – undo
4046 4046
                 unlink($file);
4047 4047
             }
4048 4048
         } else {
4049
-            $files = glob($cache_dir . '*');
4049
+            $files = glob($cache_dir.'*');
4050 4050
             foreach ($files as $file) {
4051 4051
                 $name = basename($file);
4052 4052
                 if (strpos($name, '.pageCache.php') === false) {
@@ -4115,7 +4115,7 @@  discard block
 block discarded – undo
4115 4115
                         $f_url_suffix = '/';
4116 4116
                     }
4117 4117
 
4118
-                    $alPath = !empty ($al['path']) ? $al['path'] . '/' : '';
4118
+                    $alPath = !empty ($al['path']) ? $al['path'].'/' : '';
4119 4119
 
4120 4120
                     if ($al && $al['alias']) {
4121 4121
                         $alias = $al['alias'];
@@ -4123,7 +4123,7 @@  discard block
 block discarded – undo
4123 4123
 
4124 4124
                 }
4125 4125
 
4126
-                $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix;
4126
+                $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix;
4127 4127
                 $url = "{$alias}{$args}";
4128 4128
             } else {
4129 4129
                 $url = "index.php?id={$id}{$args}";
@@ -4142,7 +4142,7 @@  discard block
 block discarded – undo
4142 4142
             }
4143 4143
 
4144 4144
             //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080)
4145
-            $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host;
4145
+            $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host;
4146 4146
         }
4147 4147
 
4148 4148
         //fix strictUrl by Bumkaka
@@ -4151,9 +4151,9 @@  discard block
 block discarded – undo
4151 4151
         }
4152 4152
 
4153 4153
         if ($this->config['xhtml_urls']) {
4154
-            $url = preg_replace("/&(?!amp;)/", "&amp;", $host . $virtualDir . $url);
4154
+            $url = preg_replace("/&(?!amp;)/", "&amp;", $host.$virtualDir.$url);
4155 4155
         } else {
4156
-            $url = $host . $virtualDir . $url;
4156
+            $url = $host.$virtualDir.$url;
4157 4157
         }
4158 4158
 
4159 4159
         $evtOut = $this->invokeEvent('OnMakeDocUrl', array(
@@ -4177,21 +4177,21 @@  discard block
 block discarded – undo
4177 4177
         if (isset($this->aliasListing[$id])) {
4178 4178
             $out = $this->aliasListing[$id];
4179 4179
         } else {
4180
-            $q = $this->db->query("SELECT id,alias,isfolder,parent FROM " . $this->getFullTableName("site_content") . " WHERE id=" . (int)$id);
4180
+            $q = $this->db->query("SELECT id,alias,isfolder,parent FROM ".$this->getFullTableName("site_content")." WHERE id=".(int) $id);
4181 4181
             if ($this->db->getRecordCount($q) == '1') {
4182 4182
                 $q = $this->db->getRow($q);
4183 4183
                 $this->aliasListing[$id] = array(
4184
-                    'id' => (int)$q['id'],
4184
+                    'id' => (int) $q['id'],
4185 4185
                     'alias' => $q['alias'] == '' ? $q['id'] : $q['alias'],
4186
-                    'parent' => (int)$q['parent'],
4187
-                    'isfolder' => (int)$q['isfolder'],
4186
+                    'parent' => (int) $q['parent'],
4187
+                    'isfolder' => (int) $q['isfolder'],
4188 4188
                 );
4189 4189
                 if ($this->aliasListing[$id]['parent'] > 0) {
4190 4190
                     //fix alias_path_usage
4191 4191
                     if ($this->config['use_alias_path'] == '1') {
4192 4192
                         //&& $tmp['path'] != '' - fix error slash with epty path
4193 4193
                         $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']);
4194
-                        $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : '');
4194
+                        $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : '');
4195 4195
                     } else {
4196 4196
                         $this->aliasListing[$id]['path'] = '';
4197 4197
                     }
@@ -4232,7 +4232,7 @@  discard block
 block discarded – undo
4232 4232
         $out = array();
4233 4233
         if (empty($this->version) || !is_array($this->version)) {
4234 4234
             //include for compatibility modx version < 1.0.10
4235
-            include MODX_MANAGER_PATH . "includes/version.inc.php";
4235
+            include MODX_MANAGER_PATH."includes/version.inc.php";
4236 4236
             $this->version = array();
4237 4237
             $this->version['version'] = isset($modx_version) ? $modx_version : '';
4238 4238
             $this->version['branch'] = isset($modx_branch) ? $modx_branch : '';
@@ -4254,18 +4254,18 @@  discard block
 block discarded – undo
4254 4254
     {
4255 4255
         if (isset ($this->snippetCache[$snippetName])) {
4256 4256
             $snippet = $this->snippetCache[$snippetName];
4257
-            $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : '';
4257
+            $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : '';
4258 4258
         } else { // not in cache so let's check the db
4259
-            $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->db->escape($snippetName) . "'  AND ss.disabled=0;";
4259
+            $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM ".$this->getFullTableName("site_snippets")." as ss LEFT JOIN ".$this->getFullTableName('site_modules')." as sm on sm.guid=ss.moduleguid WHERE ss.`name`='".$this->db->escape($snippetName)."'  AND ss.disabled=0;";
4260 4260
             $result = $this->db->query($sql);
4261 4261
             if ($this->db->getRecordCount($result) == 1) {
4262 4262
                 $row = $this->db->getRow($result);
4263 4263
                 $snippet = $this->snippetCache[$snippetName] = $row['snippet'];
4264 4264
                 $mergedProperties = array_merge($this->parseProperties($row['properties']), $this->parseProperties($row['sharedproperties']));
4265
-                $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties);
4265
+                $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties);
4266 4266
             } else {
4267 4267
                 $snippet = $this->snippetCache[$snippetName] = "return false;";
4268
-                $properties = $this->snippetCache[$snippetName . "Props"] = '';
4268
+                $properties = $this->snippetCache[$snippetName."Props"] = '';
4269 4269
             }
4270 4270
         }
4271 4271
         // load default params/properties
@@ -4365,8 +4365,8 @@  discard block
 block discarded – undo
4365 4365
             }
4366 4366
             if (strpos($tpl, $s) !== false) {
4367 4367
                 $tpl = str_replace($s, $value, $tpl);
4368
-            } elseif($this->debug) {
4369
-                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2);
4368
+            } elseif ($this->debug) {
4369
+                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2);
4370 4370
             }
4371 4371
         }
4372 4372
 
@@ -4415,7 +4415,7 @@  discard block
 block discarded – undo
4415 4415
             case 'CODE':
4416 4416
                 break;
4417 4417
             case 'FILE':
4418
-                $template = file_get_contents(MODX_BASE_PATH . $template);
4418
+                $template = file_get_contents(MODX_BASE_PATH.$template);
4419 4419
                 break;
4420 4420
             case 'CHUNK':
4421 4421
                 $template = $this->getChunk($template);
@@ -4448,7 +4448,7 @@  discard block
 block discarded – undo
4448 4448
         if ($mode !== 'formatOnly' && empty($timestamp)) {
4449 4449
             return '-';
4450 4450
         }
4451
-        $timestamp = (int)$timestamp;
4451
+        $timestamp = (int) $timestamp;
4452 4452
 
4453 4453
         switch ($this->config['datetime_format']) {
4454 4454
             case 'YYYY/mm/dd':
@@ -4468,7 +4468,7 @@  discard block
 block discarded – undo
4468 4468
         }
4469 4469
 
4470 4470
         if (empty($mode)) {
4471
-            $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp);
4471
+            $strTime = strftime($dateFormat." %H:%M:%S", $timestamp);
4472 4472
         } elseif ($mode == 'dateOnly') {
4473 4473
             $strTime = strftime($dateFormat, $timestamp);
4474 4474
         } elseif ($mode == 'formatOnly') {
@@ -4522,7 +4522,7 @@  discard block
 block discarded – undo
4522 4522
             $S = 0;
4523 4523
         }
4524 4524
         $timeStamp = mktime($H, $M, $S, $m, $d, $Y);
4525
-        $timeStamp = (int)$timeStamp;
4525
+        $timeStamp = (int) $timeStamp;
4526 4526
         return $timeStamp;
4527 4527
     }
4528 4528
 
@@ -4564,7 +4564,7 @@  discard block
 block discarded – undo
4564 4564
                     if ($v === 'value') {
4565 4565
                         unset($_[$i]);
4566 4566
                     } else {
4567
-                        $_[$i] = 'tv.' . $v;
4567
+                        $_[$i] = 'tv.'.$v;
4568 4568
                     }
4569 4569
                 }
4570 4570
                 $fields = implode(',', $_);
@@ -4573,12 +4573,12 @@  discard block
 block discarded – undo
4573 4573
             }
4574 4574
 
4575 4575
             if ($tvsort != '') {
4576
-                $tvsort = 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort))));
4576
+                $tvsort = 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort))));
4577 4577
             }
4578 4578
             if ($tvidnames == "*") {
4579 4579
                 $query = "tv.id<>0";
4580 4580
             } else {
4581
-                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . implode("','", $tvidnames) . "')";
4581
+                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".implode("','", $tvidnames)."')";
4582 4582
             }
4583 4583
 
4584 4584
             $this->getUserDocGroups();
@@ -4722,7 +4722,7 @@  discard block
 block discarded – undo
4722 4722
             return $this->tmpCache[__FUNCTION__][$cacheKey];
4723 4723
         }
4724 4724
 
4725
-        if (($idnames != '*' && !is_array($idnames)) || empty($idnames) ) {
4725
+        if (($idnames != '*' && !is_array($idnames)) || empty($idnames)) {
4726 4726
             return false;
4727 4727
         } else {
4728 4728
 
@@ -4740,23 +4740,23 @@  discard block
 block discarded – undo
4740 4740
             }
4741 4741
 
4742 4742
             // get user defined template variables
4743
-            $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $fields))));
4744
-            $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
4743
+            $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $fields))));
4744
+            $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
4745 4745
 
4746 4746
             if ($idnames == '*') {
4747 4747
                 $query = 'tv.id<>0';
4748 4748
             } else {
4749
-                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')";
4749
+                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')";
4750 4750
             }
4751 4751
 
4752
-            $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars') . " tv
4753
-                    INNER JOIN " . $this->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id
4754
-                    LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues') . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : ""));
4752
+            $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars')." tv
4753
+                    INNER JOIN " . $this->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id
4754
+                    LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues')." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : ""));
4755 4755
 
4756 4756
             $result = $this->db->makeArray($rs);
4757 4757
 
4758 4758
             // get default/built-in template variables
4759
-            if(is_array($docRow)){
4759
+            if (is_array($docRow)) {
4760 4760
                 ksort($docRow);
4761 4761
 
4762 4762
                 foreach ($docRow as $key => $value) {
@@ -4794,13 +4794,13 @@  discard block
 block discarded – undo
4794 4794
      */
4795 4795
     public function getTemplateVarOutput($idnames = array(), $docid = '', $published = 1, $sep = '')
4796 4796
     {
4797
-        if (is_array($idnames) && empty($idnames) ) {
4797
+        if (is_array($idnames) && empty($idnames)) {
4798 4798
             return false;
4799 4799
         } else {
4800 4800
             $output = array();
4801 4801
             $vars = ($idnames == '*' || is_array($idnames)) ? $idnames : array($idnames);
4802 4802
 
4803
-            $docid = (int)$docid > 0 ? (int)$docid : $this->documentIdentifier;
4803
+            $docid = (int) $docid > 0 ? (int) $docid : $this->documentIdentifier;
4804 4804
             // remove sort for speed
4805 4805
             $result = $this->getTemplateVars($vars, '*', $docid, $published, '', '');
4806 4806
 
@@ -4830,7 +4830,7 @@  discard block
 block discarded – undo
4830 4830
      */
4831 4831
     public function getFullTableName($tbl)
4832 4832
     {
4833
-        return $this->db->config['dbase'] . ".`" . $this->db->config['table_prefix'] . $tbl . "`";
4833
+        return $this->db->config['dbase'].".`".$this->db->config['table_prefix'].$tbl."`";
4834 4834
     }
4835 4835
 
4836 4836
     /**
@@ -4909,7 +4909,7 @@  discard block
 block discarded – undo
4909 4909
     public function getCachePath()
4910 4910
     {
4911 4911
         global $base_url;
4912
-        $pth = $base_url . $this->getCacheFolder();
4912
+        $pth = $base_url.$this->getCacheFolder();
4913 4913
         return $pth;
4914 4914
     }
4915 4915
 
@@ -4961,8 +4961,8 @@  discard block
 block discarded – undo
4961 4961
         $out = false;
4962 4962
 
4963 4963
         if (!empty($context)) {
4964
-            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
4965
-                $out = $_SESSION[$context . 'InternalKey'];
4964
+            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) {
4965
+                $out = $_SESSION[$context.'InternalKey'];
4966 4966
             }
4967 4967
         } else {
4968 4968
             switch (true) {
@@ -4990,8 +4990,8 @@  discard block
 block discarded – undo
4990 4990
         $out = false;
4991 4991
 
4992 4992
         if (!empty($context)) {
4993
-            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
4994
-                $out = $_SESSION[$context . 'Shortname'];
4993
+            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) {
4994
+                $out = $_SESSION[$context.'Shortname'];
4995 4995
             }
4996 4996
         } else {
4997 4997
             switch (true) {
@@ -5062,8 +5062,8 @@  discard block
 block discarded – undo
5062 5062
      */
5063 5063
     public function getWebUserInfo($uid)
5064 5064
     {
5065
-        $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users") . " wu
5066
-                INNER JOIN " . $this->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id", "wu.id='{$uid}'");
5065
+        $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users")." wu
5066
+                INNER JOIN " . $this->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id", "wu.id='{$uid}'");
5067 5067
         if ($row = $this->db->getRow($rs)) {
5068 5068
             if (!isset($row['usertype']) or !$row["usertype"]) {
5069 5069
                 $row["usertype"] = "web";
@@ -5099,7 +5099,7 @@  discard block
 block discarded – undo
5099 5099
         } else if (is_array($dg)) {
5100 5100
             // resolve ids to names
5101 5101
             $dgn = array();
5102
-            $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (" . implode(",", $dg) . ")");
5102
+            $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (".implode(",", $dg).")");
5103 5103
             while ($row = $this->db->getRow($ds)) {
5104 5104
                 $dgn[] = $row['name'];
5105 5105
             }
@@ -5127,7 +5127,7 @@  discard block
 block discarded – undo
5127 5127
         $rt = false;
5128 5128
         if ($_SESSION["webValidated"] == 1) {
5129 5129
             $tbl = $this->getFullTableName("web_users");
5130
-            $ds = $this->db->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'");
5130
+            $ds = $this->db->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'");
5131 5131
             if ($row = $this->db->getRow($ds)) {
5132 5132
                 if ($row["password"] == md5($oldPwd)) {
5133 5133
                     if (strlen($newPwd) < 6) {
@@ -5137,7 +5137,7 @@  discard block
 block discarded – undo
5137 5137
                     } else {
5138 5138
                         $this->db->update(array(
5139 5139
                             'password' => $this->db->escape($newPwd),
5140
-                        ), $tbl, "id='" . $this->getLoginUserID() . "'");
5140
+                        ), $tbl, "id='".$this->getLoginUserID()."'");
5141 5141
                         // invoke OnWebChangePassword event
5142 5142
                         $this->invokeEvent("OnWebChangePassword", array(
5143 5143
                             "userid" => $row["id"],
@@ -5168,8 +5168,8 @@  discard block
 block discarded – undo
5168 5168
         // check cache
5169 5169
         $grpNames = isset ($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false;
5170 5170
         if (!is_array($grpNames)) {
5171
-            $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names") . " wgn
5172
-                    INNER JOIN " . $this->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'");
5171
+            $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names")." wgn
5172
+                    INNER JOIN " . $this->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'");
5173 5173
             $grpNames = $this->db->getColumn("name", $rs);
5174 5174
             // save to cache
5175 5175
             $_SESSION['webUserGroupNames'] = $grpNames;
@@ -5202,7 +5202,7 @@  discard block
 block discarded – undo
5202 5202
         if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) {
5203 5203
             $this->sjscripts[$nextpos] = $src;
5204 5204
         } else {
5205
-            $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>';
5205
+            $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>';
5206 5206
         }
5207 5207
     }
5208 5208
 
@@ -5281,7 +5281,7 @@  discard block
 block discarded – undo
5281 5281
         }
5282 5282
 
5283 5283
         if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) {
5284
-            $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>';
5284
+            $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>';
5285 5285
         }
5286 5286
         if ($startup) {
5287 5287
             $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1;
@@ -5428,7 +5428,7 @@  discard block
 block discarded – undo
5428 5428
                 $eventtime = $this->getMicroTime() - $eventtime;
5429 5429
                 $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName, $pluginName, $eventtime * 1000);
5430 5430
                 foreach ($parameter as $k => $v) {
5431
-                    $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>';
5431
+                    $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>';
5432 5432
                 }
5433 5433
                 $this->pluginsCode .= '</fieldset><br />';
5434 5434
                 $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime;
@@ -5456,13 +5456,13 @@  discard block
 block discarded – undo
5456 5456
         $plugin = array();
5457 5457
         if (isset ($this->pluginCache[$pluginName])) {
5458 5458
             $pluginCode = $this->pluginCache[$pluginName];
5459
-            $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : '';
5459
+            $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : '';
5460 5460
         } else {
5461 5461
             $pluginName = $this->db->escape($pluginName);
5462 5462
             $result = $this->db->select('name, plugincode, properties', $this->getFullTableName("site_plugins"), "name='{$pluginName}' AND disabled=0");
5463 5463
             if ($row = $this->db->getRow($result)) {
5464 5464
                 $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode'];
5465
-                $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties'];
5465
+                $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties'];
5466 5466
             } else {
5467 5467
                 $pluginCode = $this->pluginCache[$pluginName] = "return false;";
5468 5468
                 $pluginProperties = '';
@@ -5486,7 +5486,7 @@  discard block
 block discarded – undo
5486 5486
     {
5487 5487
         $property = array();
5488 5488
 
5489
-        if(\is_scalar($propertyString)) {
5489
+        if (\is_scalar($propertyString)) {
5490 5490
             $propertyString = trim($propertyString);
5491 5491
             $propertyString = str_replace('{}', '', $propertyString);
5492 5492
             $propertyString = str_replace('} {', ',', $propertyString);
@@ -5540,7 +5540,7 @@  discard block
 block discarded – undo
5540 5540
                 }
5541 5541
             }
5542 5542
         }
5543
-        elseif(\is_array($propertyString)) {
5543
+        elseif (\is_array($propertyString)) {
5544 5544
             $property = $propertyString;
5545 5545
         }
5546 5546
         if (!empty($elementName) && !empty($elementType)) {
@@ -5571,7 +5571,7 @@  discard block
 block discarded – undo
5571 5571
     public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false)
5572 5572
     {
5573 5573
         $params = array();
5574
-        $fullpath = $element_dir . '/' . $filename;
5574
+        $fullpath = $element_dir.'/'.$filename;
5575 5575
         if (is_readable($fullpath)) {
5576 5576
             $tpl = @fopen($fullpath, "r");
5577 5577
             if ($tpl) {
@@ -5738,8 +5738,8 @@  discard block
 block discarded – undo
5738 5738
         $ph = array('site_url' => MODX_SITE_URL);
5739 5739
         $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/";
5740 5740
         $regexEmail = '#([0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-wyz][a-z](fo|g|l|m|mes|o|op|pa|ro|seum|t|u|v|z)?)#i';
5741
-        $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : '';
5742
-        $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : '';
5741
+        $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : '';
5742
+        $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : '';
5743 5743
         foreach ($parsed as $key => $val) {
5744 5744
             if (is_array($val)) {
5745 5745
                 foreach ($val as $key2 => $val2) {
@@ -5748,7 +5748,7 @@  discard block
 block discarded – undo
5748 5748
                         $val2 = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val2);
5749 5749
                     }
5750 5750
                     if (preg_match($regexEmail, $val2, $url)) {
5751
-                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2);
5751
+                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2);
5752 5752
                     }
5753 5753
                     $parsed[$key][$key2] = $val2;
5754 5754
                 }
@@ -5758,7 +5758,7 @@  discard block
 block discarded – undo
5758 5758
                     $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val);
5759 5759
                 }
5760 5760
                 if (preg_match($regexEmail, $val, $url)) {
5761
-                    $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val);
5761
+                    $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val);
5762 5762
                 }
5763 5763
                 $parsed[$key] = $val;
5764 5764
             }
@@ -5772,32 +5772,32 @@  discard block
 block discarded – undo
5772 5772
         );
5773 5773
 
5774 5774
         $nl = "\n";
5775
-        $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'], "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : '';
5776
-        $list .= '<p>' . $nl;
5777
-        $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : '';
5778
-        $list .= isset($parsed['description']) ? $parsed['description'] . $nl : '';
5779
-        $list .= '</p><br/>' . $nl;
5780
-        $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : '';
5781
-        $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : '';
5782
-        $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : '';
5783
-        $list .= '<br/>' . $nl;
5775
+        $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'], "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : '';
5776
+        $list .= '<p>'.$nl;
5777
+        $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : '';
5778
+        $list .= isset($parsed['description']) ? $parsed['description'].$nl : '';
5779
+        $list .= '</p><br/>'.$nl;
5780
+        $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : '';
5781
+        $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : '';
5782
+        $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : '';
5783
+        $list .= '<br/>'.$nl;
5784 5784
         $first = true;
5785 5785
         foreach ($arrayParams as $param => $label) {
5786 5786
             if (isset($parsed[$param])) {
5787 5787
                 if ($first) {
5788
-                    $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl;
5789
-                    $list .= '<ul class="docBlockList">' . $nl;
5788
+                    $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl;
5789
+                    $list .= '<ul class="docBlockList">'.$nl;
5790 5790
                     $first = false;
5791 5791
                 }
5792
-                $list .= '    <li><strong>' . $label . '</strong>' . $nl;
5793
-                $list .= '        <ul>' . $nl;
5792
+                $list .= '    <li><strong>'.$label.'</strong>'.$nl;
5793
+                $list .= '        <ul>'.$nl;
5794 5794
                 foreach ($parsed[$param] as $val) {
5795
-                    $list .= '            <li>' . $val . '</li>' . $nl;
5795
+                    $list .= '            <li>'.$val.'</li>'.$nl;
5796 5796
                 }
5797
-                $list .= '        </ul></li>' . $nl;
5797
+                $list .= '        </ul></li>'.$nl;
5798 5798
             }
5799 5799
         }
5800
-        $list .= !$first ? '</ul>' . $nl : '';
5800
+        $list .= !$first ? '</ul>'.$nl : '';
5801 5801
 
5802 5802
         return $list;
5803 5803
     }
@@ -5872,8 +5872,8 @@  discard block
 block discarded – undo
5872 5872
      */
5873 5873
     public function addSnippet($name, $phpCode, $namespace = '#', array $defaultParams = array())
5874 5874
     {
5875
-        $this->snippetCache[$namespace . $name] = $phpCode;
5876
-        $this->snippetCache[$namespace . $name . 'Props'] = $defaultParams;
5875
+        $this->snippetCache[$namespace.$name] = $phpCode;
5876
+        $this->snippetCache[$namespace.$name.'Props'] = $defaultParams;
5877 5877
     }
5878 5878
 
5879 5879
     /**
@@ -5881,7 +5881,7 @@  discard block
 block discarded – undo
5881 5881
      */
5882 5882
     public function addChunk($name, $text, $namespace = '#')
5883 5883
     {
5884
-        $this->chunkCache[$namespace . $name] = $text;
5884
+        $this->chunkCache[$namespace.$name] = $text;
5885 5885
     }
5886 5886
 
5887 5887
     /**
@@ -5891,7 +5891,7 @@  discard block
 block discarded – undo
5891 5891
     {
5892 5892
         $out = array();
5893 5893
 
5894
-        if (! is_dir($scanPath) || empty($ext)) {
5894
+        if (!is_dir($scanPath) || empty($ext)) {
5895 5895
             return $out;
5896 5896
         }
5897 5897
         $iterator = new \RecursiveIteratorIterator(
@@ -5903,22 +5903,22 @@  discard block
 block discarded – undo
5903 5903
              * @var \SplFileInfo $item
5904 5904
              */
5905 5905
             if ($item->isFile() && $item->isReadable() && \in_array($item->getExtension(), $ext)) {
5906
-                $name = $item->getBasename('.' . $item->getExtension());
5906
+                $name = $item->getBasename('.'.$item->getExtension());
5907 5907
                 $path = ltrim(str_replace(
5908 5908
                     array(rtrim($scanPath, '//'), '/'),
5909 5909
                     array('', '\\'),
5910
-                    $item->getPath() . '/'
5910
+                    $item->getPath().'/'
5911 5911
                 ), '\\');
5912 5912
 
5913 5913
                 if (!empty($path)) {
5914
-                    $name = $path . $name;
5914
+                    $name = $path.$name;
5915 5915
                 }
5916 5916
                 switch ($type) {
5917 5917
                     case 'chunk':
5918 5918
                         $out[$name] = file_get_contents($item->getRealPath());
5919 5919
                         break;
5920 5920
                     case 'snippet':
5921
-                        $out[$name] = "return require '" . $item->getRealPath() . "';";
5921
+                        $out[$name] = "return require '".$item->getRealPath()."';";
5922 5922
                         break;
5923 5923
                     default:
5924 5924
                         throw new \Exception;
@@ -5962,7 +5962,7 @@  discard block
 block discarded – undo
5962 5962
         }
5963 5963
 
5964 5964
         if (!$isSafe) {
5965
-            $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true);
5965
+            $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true);
5966 5966
             $title = sprintf('Unknown eval was executed (%s)', $this->htmlspecialchars(substr(trim($phpcode), 0, 50)));
5967 5967
             $this->messageQuit($title, '', true, '', '', 'Parser', $msg);
5968 5968
             return;
@@ -5976,7 +5976,7 @@  discard block
 block discarded – undo
5976 5976
             return 'array()';
5977 5977
         }
5978 5978
 
5979
-        $output = $echo . $return;
5979
+        $output = $echo.$return;
5980 5980
         modx_sanitize_gpc($output);
5981 5981
         return $this->htmlspecialchars($output); // Maybe, all html tags are dangerous
5982 5982
     }
@@ -5994,8 +5994,8 @@  discard block
 block discarded – undo
5994 5994
 
5995 5995
         $safe = explode(',', $safe_functions);
5996 5996
 
5997
-        $phpcode = rtrim($phpcode, ';') . ';';
5998
-        $tokens = token_get_all('<?php ' . $phpcode);
5997
+        $phpcode = rtrim($phpcode, ';').';';
5998
+        $tokens = token_get_all('<?php '.$phpcode);
5999 5999
         foreach ($tokens as $i => $token) {
6000 6000
             if (!is_array($token)) {
6001 6001
                 continue;
@@ -6031,7 +6031,7 @@  discard block
 block discarded – undo
6031 6031
     public function atBindFileContent($str = '')
6032 6032
     {
6033 6033
 
6034
-        $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'] . 'files/', '');
6034
+        $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'].'files/', '');
6035 6035
 
6036 6036
         if (stripos($str, '@FILE') !== 0) {
6037 6037
             return $str;
@@ -6054,7 +6054,7 @@  discard block
 block discarded – undo
6054 6054
         $errorMsg = sprintf("Could not retrieve string '%s'.", $str);
6055 6055
 
6056 6056
         foreach ($search_path as $path) {
6057
-            $file_path = MODX_BASE_PATH . $path . $str;
6057
+            $file_path = MODX_BASE_PATH.$path.$str;
6058 6058
             if (strpos($file_path, MODX_MANAGER_PATH) === 0) {
6059 6059
                 return $errorMsg;
6060 6060
             } elseif (is_file($file_path)) {
@@ -6068,7 +6068,7 @@  discard block
 block discarded – undo
6068 6068
             return $errorMsg;
6069 6069
         }
6070 6070
 
6071
-        $content = (string)file_get_contents($file_path);
6071
+        $content = (string) file_get_contents($file_path);
6072 6072
         if ($content === false) {
6073 6073
             return $errorMsg;
6074 6074
         }
@@ -6177,22 +6177,22 @@  discard block
 block discarded – undo
6177 6177
 
6178 6178
         $version = isset ($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : '';
6179 6179
         $release_date = isset ($GLOBALS['release_date']) ? $GLOBALS['release_date'] : '';
6180
-        $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI'];
6180
+        $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI'];
6181 6181
         $request_uri = $this->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']);
6182 6182
         $ua = $this->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']);
6183 6183
         $referer = $this->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']);
6184 6184
         if ($is_error) {
6185 6185
             $str = '<h2 style="color:red">&laquo; Evo Parse Error &raquo;</h2>';
6186 6186
             if ($msg != 'PHP Parse Error') {
6187
-                $str .= '<h3 style="color:red">' . $msg . '</h3>';
6187
+                $str .= '<h3 style="color:red">'.$msg.'</h3>';
6188 6188
             }
6189 6189
         } else {
6190 6190
             $str = '<h2 style="color:#003399">&laquo; Evo Debug/ stop message &raquo;</h2>';
6191
-            $str .= '<h3 style="color:#003399">' . $msg . '</h3>';
6191
+            $str .= '<h3 style="color:#003399">'.$msg.'</h3>';
6192 6192
         }
6193 6193
 
6194 6194
         if (!empty ($query)) {
6195
-            $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL &gt; <span id="sqlHolder">' . $query . '</span></div>';
6195
+            $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL &gt; <span id="sqlHolder">'.$query.'</span></div>';
6196 6196
         }
6197 6197
 
6198 6198
         $errortype = array(
@@ -6215,13 +6215,13 @@  discard block
 block discarded – undo
6215 6215
 
6216 6216
         if (!empty($nr) || !empty($file)) {
6217 6217
             if ($text != '') {
6218
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>';
6218
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>';
6219 6219
             }
6220 6220
             if ($output != '') {
6221
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>';
6221
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>';
6222 6222
             }
6223 6223
             if ($nr !== '') {
6224
-                $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]");
6224
+                $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]");
6225 6225
             }
6226 6226
             if ($file) {
6227 6227
                 $table[] = array('File', $file);
@@ -6241,7 +6241,7 @@  discard block
 block discarded – undo
6241 6241
         }
6242 6242
 
6243 6243
         if (!empty($this->event->activePlugin)) {
6244
-            $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')');
6244
+            $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')');
6245 6245
         }
6246 6246
 
6247 6247
         $str .= $MakeTable->create($table, array('Error information', ''));
@@ -6251,17 +6251,17 @@  discard block
 block discarded – undo
6251 6251
         $table[] = array('REQUEST_URI', $request_uri);
6252 6252
 
6253 6253
         if ($this->manager->action) {
6254
-            include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
6254
+            include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php');
6255 6255
             global $action_list;
6256 6256
             $actionName = (isset($action_list[$this->manager->action])) ? " - {$action_list[$this->manager->action]}" : '';
6257 6257
 
6258
-            $table[] = array('Manager action', $this->manager->action . $actionName);
6258
+            $table[] = array('Manager action', $this->manager->action.$actionName);
6259 6259
         }
6260 6260
 
6261 6261
         if (preg_match('@^[0-9]+@', $this->documentIdentifier)) {
6262 6262
             $resource = $this->getDocumentObject('id', $this->documentIdentifier);
6263 6263
             $url = $this->makeUrl($this->documentIdentifier, '', '', 'full');
6264
-            $table[] = array('Resource', '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>');
6264
+            $table[] = array('Resource', '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>');
6265 6265
         }
6266 6266
         $table[] = array('Referer', $referer);
6267 6267
         $table[] = array('User Agent', $ua);
@@ -6282,7 +6282,7 @@  discard block
 block discarded – undo
6282 6282
 
6283 6283
         $mem = memory_get_peak_usage(true);
6284 6284
         $total_mem = $mem - $this->mstart;
6285
-        $total_mem = ($total_mem / 1024 / 1024) . ' mb';
6285
+        $total_mem = ($total_mem / 1024 / 1024).' mb';
6286 6286
 
6287 6287
         $queryTime = $this->queryTime;
6288 6288
         $phpTime = $totalTime - $queryTime;
@@ -6303,18 +6303,18 @@  discard block
 block discarded – undo
6303 6303
         $str .= $this->get_backtrace(debug_backtrace());
6304 6304
         // Log error
6305 6305
         if (!empty($this->currentSnippet)) {
6306
-            $source = 'Snippet - ' . $this->currentSnippet;
6306
+            $source = 'Snippet - '.$this->currentSnippet;
6307 6307
         } elseif (!empty($this->event->activePlugin)) {
6308
-            $source = 'Plugin - ' . $this->event->activePlugin;
6308
+            $source = 'Plugin - '.$this->event->activePlugin;
6309 6309
         } elseif ($source !== '') {
6310
-            $source = 'Parser - ' . $source;
6310
+            $source = 'Parser - '.$source;
6311 6311
         } elseif ($query !== '') {
6312 6312
             $source = 'SQL Query';
6313 6313
         } else {
6314 6314
             $source = 'Parser';
6315 6315
         }
6316 6316
         if ($msg) {
6317
-            $source .= ' / ' . $msg;
6317
+            $source .= ' / '.$msg;
6318 6318
         }
6319 6319
         if (isset($actionName) && !empty($actionName)) {
6320 6320
             $source .= $actionName;
@@ -6346,12 +6346,12 @@  discard block
 block discarded – undo
6346 6346
 
6347 6347
         // Display error
6348 6348
         if (isset($_SESSION['mgrValidated'])) {
6349
-            echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>EVO Content Manager ' . $version . ' &raquo; ' . $release_date . '</title>
6349
+            echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>EVO Content Manager '.$version.' &raquo; '.$release_date.'</title>
6350 6350
                  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6351
-                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" />
6351
+                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" />
6352 6352
                  <style type="text/css">body { padding:10px; } td {font:inherit;}</style>
6353 6353
                  </head><body>
6354
-                 ' . $str . '</body></html>';
6354
+                 ' . $str.'</body></html>';
6355 6355
 
6356 6356
         } else {
6357 6357
             echo 'Error';
@@ -6386,7 +6386,7 @@  discard block
 block discarded – undo
6386 6386
             switch ($val['type']) {
6387 6387
                 case '->':
6388 6388
                 case '::':
6389
-                    $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function'];
6389
+                    $functionName = $val['function'] = $val['class'].$val['type'].$val['function'];
6390 6390
                     break;
6391 6391
                 default:
6392 6392
                     $functionName = $val['function'];
@@ -6396,7 +6396,7 @@  discard block
 block discarded – undo
6396 6396
             $args = array_pad(array(), $_, '$var');
6397 6397
             $args = implode(", ", $args);
6398 6398
             $modx = &$this;
6399
-            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) {
6399
+            $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) {
6400 6400
                 $arg = $val['args'][$tmp - 1];
6401 6401
                 switch (true) {
6402 6402
                     case is_null($arg): {
@@ -6408,7 +6408,7 @@  discard block
 block discarded – undo
6408 6408
                         break;
6409 6409
                     }
6410 6410
                     case is_scalar($arg): {
6411
-                        $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->htmlspecialchars(str_replace("'", "\\'", $arg)) . "'");
6411
+                        $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->htmlspecialchars(str_replace("'", "\\'", $arg))."'");
6412 6412
                         break;
6413 6413
                     }
6414 6414
                     case is_bool($arg): {
@@ -6416,23 +6416,23 @@  discard block
 block discarded – undo
6416 6416
                         break;
6417 6417
                     }
6418 6418
                     case is_array($arg): {
6419
-                        $out = 'array $var' . $tmp;
6419
+                        $out = 'array $var'.$tmp;
6420 6420
                         break;
6421 6421
                     }
6422 6422
                     case is_object($arg): {
6423
-                        $out = get_class($arg) . ' $var' . $tmp;
6423
+                        $out = get_class($arg).' $var'.$tmp;
6424 6424
                         break;
6425 6425
                     }
6426 6426
                     default: {
6427
-                        $out = '$var' . $tmp;
6427
+                        $out = '$var'.$tmp;
6428 6428
                     }
6429 6429
                 }
6430 6430
                 $tmp++;
6431 6431
                 return $out;
6432 6432
             }, $args);
6433 6433
             $line = array(
6434
-                "<strong>" . $functionName . "</strong>(" . $args . ")",
6435
-                $path . " on line " . $val['line']
6434
+                "<strong>".$functionName."</strong>(".$args.")",
6435
+                $path." on line ".$val['line']
6436 6436
             );
6437 6437
             $table[] = array(implode("<br />", $line));
6438 6438
         }
@@ -6473,7 +6473,7 @@  discard block
 block discarded – undo
6473 6473
             $alias = strip_tags($alias); // strip HTML
6474 6474
             $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters
6475 6475
             $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash
6476
-            $alias = preg_replace('/-+/', '-', $alias);  // convert multiple dashes to one
6476
+            $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one
6477 6477
             $alias = trim($alias, '-'); // trim excess
6478 6478
             return $alias;
6479 6479
         }
@@ -6489,7 +6489,7 @@  discard block
 block discarded – undo
6489 6489
         $precisions = count($sizes) - 1;
6490 6490
         foreach ($sizes as $unit => $bytes) {
6491 6491
             if ($size >= $bytes) {
6492
-                return number_format($size / $bytes, $precisions) . ' ' . $unit;
6492
+                return number_format($size / $bytes, $precisions).' '.$unit;
6493 6493
             }
6494 6494
             $precisions--;
6495 6495
         }
@@ -6593,10 +6593,10 @@  discard block
 block discarded – undo
6593 6593
 
6594 6594
         if (strpos($str, MODX_MANAGER_PATH) === 0) {
6595 6595
             return false;
6596
-        } elseif (is_file(MODX_BASE_PATH . $str)) {
6597
-            $file_path = MODX_BASE_PATH . $str;
6598
-        } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) {
6599
-            $file_path = MODX_BASE_PATH . $tpl_dir . $str;
6596
+        } elseif (is_file(MODX_BASE_PATH.$str)) {
6597
+            $file_path = MODX_BASE_PATH.$str;
6598
+        } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) {
6599
+            $file_path = MODX_BASE_PATH.$tpl_dir.$str;
6600 6600
         } else {
6601 6601
             return false;
6602 6602
         }
@@ -6722,7 +6722,7 @@  discard block
 block discarded – undo
6722 6722
             $title = 'no title';
6723 6723
         }
6724 6724
         if (is_array($msg)) {
6725
-            $msg = '<pre>' . print_r($msg, true) . '</pre>';
6725
+            $msg = '<pre>'.print_r($msg, true).'</pre>';
6726 6726
         } elseif ($msg === '') {
6727 6727
             $msg = $_SERVER['REQUEST_URI'];
6728 6728
         }
Please login to merge, or discard this patch.
manager/includes/src/ManagerTheme.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     {
38 38
         $found = $this->core->findElements(
39 39
             'chunk',
40
-            MODX_MANAGER_PATH . 'media/style/' . $this->theme . '/snippets/',
40
+            MODX_MANAGER_PATH.'media/style/'.$this->theme.'/snippets/',
41 41
             array('php')
42 42
         );
43 43
         foreach ($found as $name => $code) {
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     {
50 50
         $found = $this->core->findElements(
51 51
             'chunk',
52
-            MODX_MANAGER_PATH . 'media/style/' . $this->theme . '/chunks/',
52
+            MODX_MANAGER_PATH.'media/style/'.$this->theme.'/chunks/',
53 53
             array('tpl', 'html')
54 54
         );
55 55
         foreach ($found as $name => $code) {
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         $this->core->addSnippet(
63 63
             $name,
64 64
             $code,
65
-            $this->templateNamespace . '#',
65
+            $this->templateNamespace.'#',
66 66
             array(
67 67
                 'managerTheme' => $this
68 68
             )
@@ -71,6 +71,6 @@  discard block
 block discarded – undo
71 71
 
72 72
     public function addChunk($name, $code)
73 73
     {
74
-        $this->core->addChunk($name, $code, $this->templateNamespace . '#');
74
+        $this->core->addChunk($name, $code, $this->templateNamespace.'#');
75 75
     }
76 76
 }
Please login to merge, or discard this patch.
manager/actions/mutate_settings/tab4_manager_settings.inc.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
                             }
57 57
                             $themename = $file;
58 58
                             $selectedtext = $themename == $manager_theme ? "selected='selected'" : "";
59
-                            echo "<option value='$themename' $selectedtext>" . ucwords(str_replace("_", " ", $themename)) . "</option>";
59
+                            echo "<option value='$themename' $selectedtext>".ucwords(str_replace("_", " ", $themename))."</option>";
60 60
                         }
61 61
                     }
62 62
                     $dir->close();
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
       <tr>
131 131
         <th><?php echo $_lang['login_form_position_title'] ?><br><small>[(login_form_position)]</small></th>
132 132
         <td>
133
-            <?php echo wrap_label($_lang['login_form_position_left'],form_radio('login_form_position', 'left'));?><br />
134
-            <?php echo wrap_label($_lang['login_form_position_center'], form_radio('login_form_position', 'center'));?><br />
135
-            <?php echo wrap_label($_lang['login_form_position_right'], form_radio('login_form_position', 'right'));?>
133
+            <?php echo wrap_label($_lang['login_form_position_left'], form_radio('login_form_position', 'left')); ?><br />
134
+            <?php echo wrap_label($_lang['login_form_position_center'], form_radio('login_form_position', 'center')); ?><br />
135
+            <?php echo wrap_label($_lang['login_form_position_right'], form_radio('login_form_position', 'right')); ?>
136 136
         </td>
137 137
       </tr>
138 138
          <tr>
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
       <tr>
145 145
         <th><?php echo $_lang['manager_menu_position_title'] ?><br><small>[(manager_menu_position)]</small></th>
146 146
         <td>
147
-            <?php echo wrap_label($_lang['manager_menu_position_top'],form_radio('manager_menu_position', 'top'));?><br />
148
-            <?php echo wrap_label($_lang['manager_menu_position_left'], form_radio('manager_menu_position', 'left'));?><br />
147
+            <?php echo wrap_label($_lang['manager_menu_position_top'], form_radio('manager_menu_position', 'top')); ?><br />
148
+            <?php echo wrap_label($_lang['manager_menu_position_left'], form_radio('manager_menu_position', 'left')); ?><br />
149 149
         </td>
150 150
       </tr>
151 151
 
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
             <td>
288 288
                 <select name="group_tvs" size="1" class="form-control">
289 289
                     <?php
290
-                    $tpl = '<option value="[+value+]" [+selected+]>[+title+]</option>' . "\n";
290
+                    $tpl = '<option value="[+value+]" [+selected+]>[+title+]</option>'."\n";
291 291
                     $option = explode(',', $_lang['settings_group_tv_options']);
292 292
                     $output = array();
293 293
                     foreach ($option as $k => $v) {
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
             <td>
361 361
                 <select name="resource_tree_node_name" size="1" class="inputBox">
362 362
                     <?php
363
-                    $tpl = '<option value="[+value+]" [+selected+]>[*[+value+]*]</option>' . "\n";
363
+                    $tpl = '<option value="[+value+]" [+selected+]>[*[+value+]*]</option>'."\n";
364 364
                     $option = array('pagetitle', 'longtitle', 'menutitle', 'alias', 'createdon', 'editedon', 'publishedon');
365 365
                     $output = array();
366 366
                     foreach ($option as $v) {
@@ -446,8 +446,8 @@  discard block
 block discarded – undo
446 446
                     $str = '';
447 447
                     foreach ($datetime_format_list as $value) {
448 448
                         $selectedtext = ($datetime_format == $value) ? ' selected' : '';
449
-                        $str .= '<option value="' . $value . '"' . $selectedtext . '>';
450
-                        $str .= $value . '</option>' . PHP_EOL;
449
+                        $str .= '<option value="'.$value.'"'.$selectedtext.'>';
450
+                        $str .= $value.'</option>'.PHP_EOL;
451 451
                     }
452 452
                     echo $str;
453 453
                     ?>
@@ -557,10 +557,10 @@  discard block
 block discarded – undo
557 557
                 <select name="which_editor" onChange="documentDirty=true;">
558 558
                     <?php
559 559
                     // invoke OnRichTextEditorRegister event
560
-                    echo "<option value='none'" . ($which_editor == 'none' ? " selected='selected'" : "") . ">" . $_lang['none'] . "</option>\n";
560
+                    echo "<option value='none'".($which_editor == 'none' ? " selected='selected'" : "").">".$_lang['none']."</option>\n";
561 561
                     if (is_array($evtOut)) {
562 562
                         foreach ($evtOut as $editor) {
563
-                            echo "<option value='$editor'" . ($which_editor == $editor ? " selected='selected'" : "") . ">$editor</option>\n";
563
+                            echo "<option value='$editor'".($which_editor == $editor ? " selected='selected'" : "").">$editor</option>\n";
564 564
                         }
565 565
                     }
566 566
                     ?>
@@ -644,14 +644,14 @@  discard block
 block discarded – undo
644 644
     lastImageCtrl = ctrl;
645 645
     var w = screen.width * 0.7;
646 646
     var h = screen.height * 0.7;
647
-    OpenServerBrowser("<?php echo MODX_MANAGER_URL; ?>media/browser/<?php echo $which_browser;?>/browser.php?Type=images", w, h);
647
+    OpenServerBrowser("<?php echo MODX_MANAGER_URL; ?>media/browser/<?php echo $which_browser; ?>/browser.php?Type=images", w, h);
648 648
   }
649 649
 
650 650
   function BrowseFileServer(ctrl) {
651 651
     lastFileCtrl = ctrl;
652 652
     var w = screen.width * 0.7;
653 653
     var h = screen.height * 0.7;
654
-    OpenServerBrowser("<?php echo MODX_MANAGER_URL; ?>media/browser/<?php echo $which_browser;?>/browser.php?Type=files", w, h);
654
+    OpenServerBrowser("<?php echo MODX_MANAGER_URL; ?>media/browser/<?php echo $which_browser; ?>/browser.php?Type=files", w, h);
655 655
   }
656 656
 
657 657
   function SetUrlChange(el) {
Please login to merge, or discard this patch.
manager/media/style/default/ajax.php 1 patch
Spacing   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
 $modx->loadExtension("ManagerAPI");
20 20
 
21 21
 $_lang = array();
22
-include_once MODX_MANAGER_PATH . '/includes/lang/english.inc.php';
22
+include_once MODX_MANAGER_PATH.'/includes/lang/english.inc.php';
23 23
 if ($modx->config['manager_language'] != 'english') {
24
-    include_once MODX_MANAGER_PATH . '/includes/lang/' . $modx->config['manager_language'] . '.inc.php';
24
+    include_once MODX_MANAGER_PATH.'/includes/lang/'.$modx->config['manager_language'].'.inc.php';
25 25
 }
26
-include_once MODX_MANAGER_PATH . '/media/style/' . $modx->config['manager_theme'] . '/style.php';
26
+include_once MODX_MANAGER_PATH.'/media/style/'.$modx->config['manager_theme'].'/style.php';
27 27
 
28 28
 $action = isset($_REQUEST['a']) ? $_REQUEST['a'] : '';
29 29
 $frame = isset($_REQUEST['f']) ? $_REQUEST['f'] : '';
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
             switch ($frame) {
42 42
                 case 'nodes':
43
-                    include_once MODX_MANAGER_PATH . '/frames/nodes.php';
43
+                    include_once MODX_MANAGER_PATH.'/frames/nodes.php';
44 44
 
45 45
                     break;
46 46
             }
@@ -58,21 +58,21 @@  discard block
 block discarded – undo
58 58
                 $sql = '';
59 59
                 $a = '';
60 60
                 $filter = !empty($_REQUEST['filter']) && is_scalar($_REQUEST['filter']) ? addcslashes(trim($_REQUEST['filter']), '%*_') : '';
61
-                $sqlLike = $filter ? 'WHERE t1.name LIKE "' . $modx->db->escape($filter) . '%"' : '';
62
-                $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit;
61
+                $sqlLike = $filter ? 'WHERE t1.name LIKE "'.$modx->db->escape($filter).'%"' : '';
62
+                $sqlLimit = $sqlLike ? '' : 'LIMIT '.$limit;
63 63
 
64 64
                 switch ($elements) {
65 65
                     case 'element_templates':
66 66
                         $a = 16;
67
-                        $sqlLike = $filter ? 'WHERE t1.templatename LIKE "' . $modx->db->escape($filter) . '%"' : '';
67
+                        $sqlLike = $filter ? 'WHERE t1.templatename LIKE "'.$modx->db->escape($filter).'%"' : '';
68 68
                         $sql = $modx->db->query('SELECT t1.id, t1.templatename AS name, t1.locked, 0 AS disabled
69
-                        FROM ' . $modx->getFullTableName('site_templates') . ' AS t1
70
-                        ' . $sqlLike . '
69
+                        FROM ' . $modx->getFullTableName('site_templates').' AS t1
70
+                        ' . $sqlLike.'
71 71
                         ORDER BY t1.templatename ASC
72 72
                         ' . $sqlLimit);
73 73
 
74 74
                         if ($modx->hasPermission('new_template')) {
75
-                            $output .= '<li><a id="a_19" href="index.php?a=19" target="main"><i class="fa fa-plus"></i>' . $_lang['new_template'] . '</a></li>';
75
+                            $output .= '<li><a id="a_19" href="index.php?a=19" target="main"><i class="fa fa-plus"></i>'.$_lang['new_template'].'</a></li>';
76 76
                         }
77 77
 
78 78
                         break;
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
                     case 'element_tplvars':
81 81
                         $a = 301;
82 82
                         $sql = $modx->db->query('SELECT t1.id, t1.name, t1.locked, IF(MIN(t2.tmplvarid),0,1) AS disabled
83
-                        FROM ' . $modx->getFullTableName('site_tmplvars') . ' AS t1
84
-                        LEFT JOIN ' . $modx->getFullTableName('site_tmplvar_templates') . ' AS t2 ON t1.id=t2.tmplvarid
85
-                        ' . $sqlLike . '
83
+                        FROM ' . $modx->getFullTableName('site_tmplvars').' AS t1
84
+                        LEFT JOIN ' . $modx->getFullTableName('site_tmplvar_templates').' AS t2 ON t1.id=t2.tmplvarid
85
+                        ' . $sqlLike.'
86 86
                         GROUP BY t1.id
87 87
                         ORDER BY t1.name ASC
88 88
                         ' . $sqlLimit);
89 89
 
90 90
                         if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
91
-                            $output .= '<li><a id="a_300" href="index.php?a=300" target="main"><i class="fa fa-plus"></i>' . $_lang['new_tmplvars'] . '</a></li>';
91
+                            $output .= '<li><a id="a_300" href="index.php?a=300" target="main"><i class="fa fa-plus"></i>'.$_lang['new_tmplvars'].'</a></li>';
92 92
                         }
93 93
 
94 94
                         break;
@@ -96,13 +96,13 @@  discard block
 block discarded – undo
96 96
                     case 'element_htmlsnippets':
97 97
                         $a = 78;
98 98
                         $sql = $modx->db->query('SELECT t1.id, t1.name, t1.locked, t1.disabled
99
-                        FROM ' . $modx->getFullTableName('site_htmlsnippets') . ' AS t1
100
-                        ' . $sqlLike . '
99
+                        FROM ' . $modx->getFullTableName('site_htmlsnippets').' AS t1
100
+                        ' . $sqlLike.'
101 101
                         ORDER BY t1.name ASC
102 102
                         ' . $sqlLimit);
103 103
 
104 104
                         if ($modx->hasPermission('new_chunk')) {
105
-                            $output .= '<li><a id="a_77" href="index.php?a=77" target="main"><i class="fa fa-plus"></i>' . $_lang['new_htmlsnippet'] . '</a></li>';
105
+                            $output .= '<li><a id="a_77" href="index.php?a=77" target="main"><i class="fa fa-plus"></i>'.$_lang['new_htmlsnippet'].'</a></li>';
106 106
                         }
107 107
 
108 108
                         break;
@@ -110,13 +110,13 @@  discard block
 block discarded – undo
110 110
                     case 'element_snippets':
111 111
                         $a = 22;
112 112
                         $sql = $modx->db->query('SELECT t1.id, t1.name, t1.locked, t1.disabled
113
-                        FROM ' . $modx->getFullTableName('site_snippets') . ' AS t1
114
-                        ' . $sqlLike . '
113
+                        FROM ' . $modx->getFullTableName('site_snippets').' AS t1
114
+                        ' . $sqlLike.'
115 115
                         ORDER BY t1.name ASC
116 116
                         ' . $sqlLimit);
117 117
 
118 118
                         if ($modx->hasPermission('new_snippet')) {
119
-                            $output .= '<li><a id="a_23" href="index.php?a=23" target="main"><i class="fa fa-plus"></i>' . $_lang['new_snippet'] . '</a></li>';
119
+                            $output .= '<li><a id="a_23" href="index.php?a=23" target="main"><i class="fa fa-plus"></i>'.$_lang['new_snippet'].'</a></li>';
120 120
                         }
121 121
 
122 122
                         break;
@@ -124,13 +124,13 @@  discard block
 block discarded – undo
124 124
                     case 'element_plugins':
125 125
                         $a = 102;
126 126
                         $sql = $modx->db->query('SELECT t1.id, t1.name, t1.locked, t1.disabled
127
-                        FROM ' . $modx->getFullTableName('site_plugins') . ' AS t1
128
-                        ' . $sqlLike . '
127
+                        FROM ' . $modx->getFullTableName('site_plugins').' AS t1
128
+                        ' . $sqlLike.'
129 129
                         ORDER BY t1.name ASC
130 130
                         ' . $sqlLimit);
131 131
 
132 132
                         if ($modx->hasPermission('new_plugin')) {
133
-                            $output .= '<li><a id="a_101" href="index.php?a=101" target="main"><i class="fa fa-plus"></i>' . $_lang['new_plugin'] . '</a></li>';
133
+                            $output .= '<li><a id="a_101" href="index.php?a=101" target="main"><i class="fa fa-plus"></i>'.$_lang['new_plugin'].'</a></li>';
134 134
                         }
135 135
 
136 136
                         break;
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
                             continue;
146 146
                         }
147 147
 
148
-                        $items .= '<li class="item ' . ($row['disabled'] ? 'disabled' : '') . ($row['locked'] ? ' locked' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main" data-parent-id="a_76__elements_' . $elements . '">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>' . "\n";
148
+                        $items .= '<li class="item '.($row['disabled'] ? 'disabled' : '').($row['locked'] ? ' locked' : '').'"><a id="a_'.$a.'__id_'.$row['id'].'" href="index.php?a='.$a.'&id='.$row['id'].'" target="main" data-parent-id="a_76__elements_'.$elements.'">'.$row['name'].' <small>('.$row['id'].')</small></a></li>'."\n";
149 149
                     }
150 150
                 }
151 151
 
@@ -166,18 +166,18 @@  discard block
 block discarded – undo
166 166
             $output = '';
167 167
             $items = '';
168 168
             $filter = !empty($_REQUEST['filter']) && is_scalar($_REQUEST['filter']) ? addcslashes(trim($_REQUEST['filter']), '\%*_') : '';
169
-            $sqlLike = $filter ? 'WHERE t1.username LIKE "' . $modx->db->escape($filter) . '%"' : '';
170
-            $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit;
169
+            $sqlLike = $filter ? 'WHERE t1.username LIKE "'.$modx->db->escape($filter).'%"' : '';
170
+            $sqlLimit = $sqlLike ? '' : 'LIMIT '.$limit;
171 171
 
172 172
             $sql = $modx->db->query('SELECT t1.*, t1.username AS name, t2.blocked
173
-				FROM ' . $modx->getFullTableName('manager_users') . ' AS t1
174
-				LEFT JOIN ' . $modx->getFullTableName('user_attributes') . ' AS t2 ON t1.id=t2.internalKey
175
-				' . $sqlLike . '
173
+				FROM ' . $modx->getFullTableName('manager_users').' AS t1
174
+				LEFT JOIN ' . $modx->getFullTableName('user_attributes').' AS t2 ON t1.id=t2.internalKey
175
+				' . $sqlLike.'
176 176
 				ORDER BY t1.username ASC
177 177
 				' . $sqlLimit);
178 178
 
179 179
             if ($modx->hasPermission('new_user')) {
180
-                $output .= '<li><a id="a_11" href="index.php?a=11" target="main"><i class="fa fa-plus"></i>' . $_lang['new_user'] . '</a></li>';
180
+                $output .= '<li><a id="a_11" href="index.php?a=11" target="main"><i class="fa fa-plus"></i>'.$_lang['new_user'].'</a></li>';
181 181
             }
182 182
 
183 183
             if ($count = $modx->db->getRecordCount($sql)) {
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
                     $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>';
186 186
                 }
187 187
                 while ($row = $modx->db->getRow($sql)) {
188
-                    $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>';
188
+                    $items .= '<li class="item '.($row['blocked'] ? 'disabled' : '').'"><a id="a_'.$a.'__id_'.$row['id'].'" href="index.php?a='.$a.'&id='.$row['id'].'" target="main">'.$row['name'].' <small>('.$row['id'].')</small></a></li>';
189 189
                 }
190 190
             }
191 191
 
@@ -205,18 +205,18 @@  discard block
 block discarded – undo
205 205
             $output = '';
206 206
             $items = '';
207 207
             $filter = !empty($_REQUEST['filter']) && is_scalar($_REQUEST['filter']) ? addcslashes(trim($_REQUEST['filter']), '\%*_') : '';
208
-            $sqlLike = $filter ? 'WHERE t1.username LIKE "' . $modx->db->escape($filter) . '%"' : '';
209
-            $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit;
208
+            $sqlLike = $filter ? 'WHERE t1.username LIKE "'.$modx->db->escape($filter).'%"' : '';
209
+            $sqlLimit = $sqlLike ? '' : 'LIMIT '.$limit;
210 210
 
211 211
             $sql = $modx->db->query('SELECT t1.*, t1.username AS name, t2.blocked
212
-				FROM ' . $modx->getFullTableName('web_users') . ' AS t1
213
-				LEFT JOIN ' . $modx->getFullTableName('web_user_attributes') . ' AS t2 ON t1.id=t2.internalKey
214
-				' . $sqlLike . '
212
+				FROM ' . $modx->getFullTableName('web_users').' AS t1
213
+				LEFT JOIN ' . $modx->getFullTableName('web_user_attributes').' AS t2 ON t1.id=t2.internalKey
214
+				' . $sqlLike.'
215 215
 				ORDER BY t1.username ASC
216 216
 				' . $sqlLimit);
217 217
 
218 218
             if ($modx->hasPermission('new_web_user')) {
219
-                $output .= '<li><a id="a_87" href="index.php?a=87" target="main"><i class="fa fa-plus"></i>' . $_lang['new_web_user'] . '</a></li>';
219
+                $output .= '<li><a id="a_87" href="index.php?a=87" target="main"><i class="fa fa-plus"></i>'.$_lang['new_web_user'].'</a></li>';
220 220
             }
221 221
 
222 222
             if ($count = $modx->db->getRecordCount($sql)) {
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
                     $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>';
225 225
                 }
226 226
                 while ($row = $modx->db->getRow($sql)) {
227
-                    $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . $row['name'] . ' <small>(' . $row['id'] . ')</small></a></li>';
227
+                    $items .= '<li class="item '.($row['blocked'] ? 'disabled' : '').'"><a id="a_'.$a.'__id_'.$row['id'].'" href="index.php?a='.$a.'&id='.$row['id'].'" target="main">'.$row['name'].' <small>('.$row['id'].')</small></a></li>';
228 228
                 }
229 229
             }
230 230
 
@@ -250,35 +250,35 @@  discard block
 block discarded – undo
250 250
                     case 'SnippetNoCache': {
251 251
 
252 252
                         $sql = $modx->db->query('SELECT *
253
-						FROM ' . $modx->getFullTableName('site_snippets') . '
254
-						WHERE name="' . $name . '"
253
+						FROM ' . $modx->getFullTableName('site_snippets').'
254
+						WHERE name="' . $name.'"
255 255
 						LIMIT 1');
256 256
 
257 257
                         if ($modx->db->getRecordCount($sql)) {
258 258
                             $row = $modx->db->getRow($sql);
259 259
                             $contextmenu = array(
260 260
                                 'header' => array(
261
-                                    'innerHTML' => '<i class="fa fa-code"></i> ' . $row['name']
261
+                                    'innerHTML' => '<i class="fa fa-code"></i> '.$row['name']
262 262
                                 ),
263 263
                                 'item' => array(
264
-                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'],
265
-                                    'url' => "index.php?a=22&id=" . $row['id']
264
+                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'],
265
+                                    'url' => "index.php?a=22&id=".$row['id']
266 266
                                 )
267 267
                             );
268 268
                             if (!empty($row['description'])) {
269 269
                                 $contextmenu['seperator'] = '';
270 270
                                 $contextmenu['description'] = array(
271
-                                    'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
271
+                                    'innerHTML' => '<i class="fa fa-info"></i> '.$row['description']
272 272
                                 );
273 273
                             }
274 274
                         } else {
275 275
                             $contextmenu = array(
276 276
                                 'header' => array(
277
-                                    'innerHTML' => '<i class="fa fa-code"></i> ' . $name
277
+                                    'innerHTML' => '<i class="fa fa-code"></i> '.$name
278 278
                                 ),
279 279
                                 'item' => array(
280
-                                    'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_snippet'],
281
-                                    'url' => "index.php?a=23&itemname=" . $name
280
+                                    'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_snippet'],
281
+                                    'url' => "index.php?a=23&itemname=".$name
282 282
                                 )
283 283
                             );
284 284
                         }
@@ -288,35 +288,35 @@  discard block
 block discarded – undo
288 288
                     case 'Chunk' : {
289 289
 
290 290
                         $sql = $modx->db->query('SELECT *
291
-						FROM ' . $modx->getFullTableName('site_htmlsnippets') . '
292
-						WHERE name="' . $name . '"
291
+						FROM ' . $modx->getFullTableName('site_htmlsnippets').'
292
+						WHERE name="' . $name.'"
293 293
 						LIMIT 1');
294 294
 
295 295
                         if ($modx->db->getRecordCount($sql)) {
296 296
                             $row = $modx->db->getRow($sql);
297 297
                             $contextmenu = array(
298 298
                                 'header' => array(
299
-                                    'innerHTML' => '<i class="fa fa-th-large"></i> ' . $row['name']
299
+                                    'innerHTML' => '<i class="fa fa-th-large"></i> '.$row['name']
300 300
                                 ),
301 301
                                 'item' => array(
302
-                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'],
303
-                                    'url' => "index.php?a=78&id=" . $row['id']
302
+                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'],
303
+                                    'url' => "index.php?a=78&id=".$row['id']
304 304
                                 )
305 305
                             );
306 306
                             if (!empty($row['description'])) {
307 307
                                 $contextmenu['seperator'] = '';
308 308
                                 $contextmenu['description'] = array(
309
-                                    'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
309
+                                    'innerHTML' => '<i class="fa fa-info"></i> '.$row['description']
310 310
                                 );
311 311
                             }
312 312
                         } else {
313 313
                             $contextmenu = array(
314 314
                                 'header' => array(
315
-                                    'innerHTML' => '<i class="fa fa-th-large"></i> ' . $name
315
+                                    'innerHTML' => '<i class="fa fa-th-large"></i> '.$name
316 316
                                 ),
317 317
                                 'item' => array(
318
-                                    'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_htmlsnippet'],
319
-                                    'url' => "index.php?a=77&itemname=" . $name
318
+                                    'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_htmlsnippet'],
319
+                                    'url' => "index.php?a=77&itemname=".$name
320 320
                                 )
321 321
                             );
322 322
                         }
@@ -325,8 +325,8 @@  discard block
 block discarded – undo
325 325
                     }
326 326
                     case 'AttributeValue': {
327 327
                         $sql = $modx->db->query('SELECT *
328
-						FROM ' . $modx->getFullTableName('site_htmlsnippets') . '
329
-						WHERE name="' . $name . '"
328
+						FROM ' . $modx->getFullTableName('site_htmlsnippets').'
329
+						WHERE name="' . $name.'"
330 330
 						LIMIT 1');
331 331
 
332 332
                         if ($modx->db->getRecordCount($sql)) {
@@ -336,52 +336,52 @@  discard block
 block discarded – undo
336 336
                                     'innerText' => $row['name']
337 337
                                 ),
338 338
                                 'item' => array(
339
-                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'],
340
-                                    'url' => "index.php?a=78&id=" . $row['id']
339
+                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'],
340
+                                    'url' => "index.php?a=78&id=".$row['id']
341 341
                                 )
342 342
                             );
343 343
                             if (!empty($row['description'])) {
344 344
                                 $contextmenu['seperator'] = '';
345 345
                                 $contextmenu['description'] = array(
346
-                                    'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
346
+                                    'innerHTML' => '<i class="fa fa-info"></i> '.$row['description']
347 347
                                 );
348 348
                             }
349 349
                         } else {
350 350
 
351 351
                             $sql = $modx->db->query('SELECT *
352
-							FROM ' . $modx->getFullTableName('site_snippets') . '
353
-							WHERE name="' . $name . '"
352
+							FROM ' . $modx->getFullTableName('site_snippets').'
353
+							WHERE name="' . $name.'"
354 354
 							LIMIT 1');
355 355
 
356 356
                             if ($modx->db->getRecordCount($sql)) {
357 357
                                 $row = $modx->db->getRow($sql);
358 358
                                 $contextmenu = array(
359 359
                                     'header' => array(
360
-                                        'innerHTML' => '<i class="fa fa-code"></i> ' . $row['name']
360
+                                        'innerHTML' => '<i class="fa fa-code"></i> '.$row['name']
361 361
                                     ),
362 362
                                     'item' => array(
363
-                                        'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'],
364
-                                        'url' => "index.php?a=22&id=" . $row['id']
363
+                                        'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'],
364
+                                        'url' => "index.php?a=22&id=".$row['id']
365 365
                                     )
366 366
                                 );
367 367
                                 if (!empty($row['description'])) {
368 368
                                     $contextmenu['seperator'] = '';
369 369
                                     $contextmenu['description'] = array(
370
-                                        'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
370
+                                        'innerHTML' => '<i class="fa fa-info"></i> '.$row['description']
371 371
                                     );
372 372
                                 }
373 373
                             } else {
374 374
                                 $contextmenu = array(
375 375
                                     'header' => array(
376
-                                        'innerHTML' => '<i class="fa fa-code"></i> ' . $name
376
+                                        'innerHTML' => '<i class="fa fa-code"></i> '.$name
377 377
                                     ),
378 378
                                     'item' => array(
379
-                                        'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_htmlsnippet'],
380
-                                        'url' => "index.php?a=77&itemname=" . $name
379
+                                        'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_htmlsnippet'],
380
+                                        'url' => "index.php?a=77&itemname=".$name
381 381
                                     ),
382 382
                                     'item2' => array(
383
-                                        'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_snippet'],
384
-                                        'url' => "index.php?a=23&itemname=" . $name
383
+                                        'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_snippet'],
384
+                                        'url' => "index.php?a=23&itemname=".$name
385 385
                                     )
386 386
                                 );
387 387
                             }
@@ -437,35 +437,35 @@  discard block
 block discarded – undo
437 437
                         }
438 438
 
439 439
                         $sql = $modx->db->query('SELECT *
440
-						FROM ' . $modx->getFullTableName('site_tmplvars') . '
441
-						WHERE name="' . $name . '"
440
+						FROM ' . $modx->getFullTableName('site_tmplvars').'
441
+						WHERE name="' . $name.'"
442 442
 						LIMIT 1');
443 443
 
444 444
                         if ($modx->db->getRecordCount($sql)) {
445 445
                             $row = $modx->db->getRow($sql);
446 446
                             $contextmenu = array(
447 447
                                 'header' => array(
448
-                                    'innerHTML' => '<i class="fa fa-list-alt"></i> ' . $row['name']
448
+                                    'innerHTML' => '<i class="fa fa-list-alt"></i> '.$row['name']
449 449
                                 ),
450 450
                                 'item' => array(
451
-                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> ' . $_lang['edit'],
452
-                                    'url' => "index.php?a=301&id=" . $row['id']
451
+                                    'innerHTML' => '<i class="fa fa-pencil-square-o"></i> '.$_lang['edit'],
452
+                                    'url' => "index.php?a=301&id=".$row['id']
453 453
                                 )
454 454
                             );
455 455
                             if (!empty($row['description'])) {
456 456
                                 $contextmenu['seperator'] = '';
457 457
                                 $contextmenu['description'] = array(
458
-                                    'innerHTML' => '<i class="fa fa-info"></i> ' . $row['description']
458
+                                    'innerHTML' => '<i class="fa fa-info"></i> '.$row['description']
459 459
                                 );
460 460
                             }
461 461
                         } else {
462 462
                             $contextmenu = array(
463 463
                                 'header' => array(
464
-                                    'innerHTML' => '<i class="fa fa-list-alt"></i> ' . $name
464
+                                    'innerHTML' => '<i class="fa fa-list-alt"></i> '.$name
465 465
                                 ),
466 466
                                 'item' => array(
467
-                                    'innerHTML' => '<i class="fa fa-plus"></i> ' . $_lang['new_tmplvars'],
468
-                                    'url' => "index.php?a=300&itemname=" . $name
467
+                                    'innerHTML' => '<i class="fa fa-plus"></i> '.$_lang['new_tmplvars'],
468
+                                    'url' => "index.php?a=300&itemname=".$name
469 469
                                 )
470 470
                             );
471 471
                         }
@@ -484,15 +484,15 @@  discard block
 block discarded – undo
484 484
             $json = array();
485 485
 
486 486
             if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) {
487
-                $id = !empty($_REQUEST['id']) ? (int)$_REQUEST['id'] : '';
488
-                $parent = isset($_REQUEST['parent']) ? (int)$_REQUEST['parent'] : 0;
487
+                $id = !empty($_REQUEST['id']) ? (int) $_REQUEST['id'] : '';
488
+                $parent = isset($_REQUEST['parent']) ? (int) $_REQUEST['parent'] : 0;
489 489
                 $menuindex = isset($_REQUEST['menuindex']) && is_scalar($_REQUEST['menuindex']) ? $_REQUEST['menuindex'] : 0;
490 490
 
491 491
                 // set parent
492 492
                 if ($id && $parent >= 0) {
493 493
 
494 494
                     // find older parent
495
-                    $parentOld = $modx->db->getValue($modx->db->select('parent', $modx->getFullTableName('site_content'), 'id=' . $id));
495
+                    $parentOld = $modx->db->getValue($modx->db->select('parent', $modx->getFullTableName('site_content'), 'id='.$id));
496 496
 
497 497
                     $eventOut = $modx->invokeEvent('onBeforeMoveDocument', [
498 498
                         'id_document' => $id,
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
                     if (empty($json['errors'])) {
514 514
                         // check privileges user for move docs
515 515
                         if (!empty($modx->config['tree_show_protected']) && $role != 1) {
516
-                            $sql = $modx->db->select('*', $modx->getFullTableName('document_groups'), 'document IN(' . $id . ',' . $parent . ',' . $parentOld . ')');
516
+                            $sql = $modx->db->select('*', $modx->getFullTableName('document_groups'), 'document IN('.$id.','.$parent.','.$parentOld.')');
517 517
                             if ($modx->db->getRecordCount($sql)) {
518 518
                                 $document_groups = array();
519 519
                                 while ($row = $modx->db->getRow($sql)) {
@@ -538,22 +538,22 @@  discard block
 block discarded – undo
538 538
                             // set new parent
539 539
                             $modx->db->update(array(
540 540
                                 'parent' => $parent
541
-                            ), $modx->getFullTableName('site_content'), 'id=' . $id);
541
+                            ), $modx->getFullTableName('site_content'), 'id='.$id);
542 542
                             // set parent isfolder = 1
543 543
                             $modx->db->update(array(
544 544
                                 'isfolder' => 1
545
-                            ), $modx->getFullTableName('site_content'), 'id=' . $parent);
545
+                            ), $modx->getFullTableName('site_content'), 'id='.$parent);
546 546
 
547 547
                             if ($parent != $parentOld) {
548 548
                                 // check children docs and set parent isfolder
549
-                                if ($modx->db->getRecordCount($modx->db->select('id', $modx->getFullTableName('site_content'), 'parent=' . $parentOld))) {
549
+                                if ($modx->db->getRecordCount($modx->db->select('id', $modx->getFullTableName('site_content'), 'parent='.$parentOld))) {
550 550
                                     $modx->db->update(array(
551 551
                                         'isfolder' => 1
552
-                                    ), $modx->getFullTableName('site_content'), 'id=' . $parentOld);
552
+                                    ), $modx->getFullTableName('site_content'), 'id='.$parentOld);
553 553
                                 } else {
554 554
                                     $modx->db->update(array(
555 555
                                         'isfolder' => 0
556
-                                    ), $modx->getFullTableName('site_content'), 'id=' . $parentOld);
556
+                                    ), $modx->getFullTableName('site_content'), 'id='.$parentOld);
557 557
                                 }
558 558
                             }
559 559
 
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
                             if (!empty($menuindex)) {
562 562
                                 $menuindex = explode(',', $menuindex);
563 563
                                 foreach ($menuindex as $key => $value) {
564
-                                    $modx->db->query('UPDATE ' . $modx->getFullTableName('site_content') . ' SET menuindex=' . $key . ' WHERE id=' . $value);
564
+                                    $modx->db->query('UPDATE '.$modx->getFullTableName('site_content').' SET menuindex='.$key.' WHERE id='.$value);
565 565
                                 }
566 566
                             } else {
567 567
                                 // TODO: max(*) menuindex
@@ -590,19 +590,19 @@  discard block
 block discarded – undo
590 590
         }
591 591
 
592 592
         case 'getLockedElements': {
593
-            $type = isset($_REQUEST['type']) ? (int)$_REQUEST['type'] : 0;
594
-            $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
593
+            $type = isset($_REQUEST['type']) ? (int) $_REQUEST['type'] : 0;
594
+            $id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
595 595
 
596 596
             $output = !!$modx->elementIsLocked($type, $id, true);
597 597
 
598 598
             if (!$output) {
599 599
                 $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : '';
600
-                $docgrp_cond = $docgrp ? ' OR dg.document_group IN (' . $docgrp . ')' : '';
600
+                $docgrp_cond = $docgrp ? ' OR dg.document_group IN ('.$docgrp.')' : '';
601 601
                 $sql = '
602
-                    SELECT MAX(IF(1=' . $role . ' OR sc.privatemgr=0' . $docgrp_cond . ', 0, 1)) AS locked
603
-                    FROM ' . $modx->getFullTableName('site_content') . ' AS sc 
604
-                    LEFT JOIN ' . $modx->getFullTableName('document_groups') . ' dg ON dg.document=sc.id
605
-                    WHERE sc.id=' . $id . ' GROUP BY sc.id';
602
+                    SELECT MAX(IF(1=' . $role.' OR sc.privatemgr=0'.$docgrp_cond.', 0, 1)) AS locked
603
+                    FROM ' . $modx->getFullTableName('site_content').' AS sc 
604
+                    LEFT JOIN ' . $modx->getFullTableName('document_groups').' dg ON dg.document=sc.id
605
+                    WHERE sc.id=' . $id.' GROUP BY sc.id';
606 606
                 $sql = $modx->db->query($sql);
607 607
                 if ($modx->db->getRecordCount($sql)) {
608 608
                     $row = $modx->db->getRow($sql);
Please login to merge, or discard this patch.
install/src/template/actions/install.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     <?php endif; ?>
66 66
 <?php endif; ?>
67 67
 
68
-<?php if ($installLevel >=  2 && $moduleSQLBaseFile) : ?>
68
+<?php if ($installLevel >= 2 && $moduleSQLBaseFile) : ?>
69 69
     <?php if ($sqlParser->installFailed === false) : ?>
70 70
         <p>
71 71
             <?=$_lang['setup_database_creating_tables']?>
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         <?php $sqlErrors = count($sqlParser->mysqlErrors); ?>
77 77
         <?php for ($i = 0; $i < $sqlErrors; $i++) : ?>
78 78
             <em><?=$sqlParser->mysqlErrors[$i]["error"]?></em>
79
-            <?=$_lang['during_execution_of_sql'];?>
79
+            <?=$_lang['during_execution_of_sql']; ?>
80 80
             <span class="mono"><?=strip_tags($sqlParser->mysqlErrors[$i]["sql"])?></span>
81 81
             <hr />
82 82
         <?php endfor; ?>
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         <?php $sqlErrors = count($sqlParser->mysqlErrors); ?>
113 113
         <?php for ($i = 0; $i < $sqlErrors; $i++) : ?>
114 114
             <em><?=$sqlParser->mysqlErrors[$i]["error"]?></em> <?=$_lang['during_execution_of_sql']?>
115
-            <span class='mono'><?=strip_tags($sqlParser->mysqlErrors[$i]["sql"]);?></span>
115
+            <span class='mono'><?=strip_tags($sqlParser->mysqlErrors[$i]["sql"]); ?></span>
116 116
             <hr />
117 117
         <?php endfor; ?>
118 118
         </p>
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
         <h3><?=$_lang['templates']?>:</h3>
131 131
         <?php foreach ($installDataLevel['templates'] as $itemName => $itemData) : ?>
132 132
             <?php if (empty($itemData['error'])) : ?>
133
-                <?php if($itemData['type'] === 'create') : ?>
133
+                <?php if ($itemData['type'] === 'create') : ?>
134 134
                     <p>&nbsp;&nbsp;&#10003;&nbsp;&nbsp;<?=$itemName?>: <span class="ok"><?=$_lang['installed']?></span></p>
135
-                <?php elseif($itemData['type'] === 'update') : ?>
135
+                <?php elseif ($itemData['type'] === 'update') : ?>
136 136
                     <p>&nbsp;&nbsp;&#10003;&nbsp;&nbsp;<?=$itemName?>: <span class="ok"><?=$_lang['upgraded']?></span></p>
137 137
                 <?php endif; ?>
138 138
             <?php else : ?>
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
         <h3><?=$_lang['tvs']?>:</h3>
155 155
         <?php foreach ($installDataLevel['tvs'] as $itemName => $itemData) : ?>
156 156
             <?php if (empty($itemData['error'])) : ?>
157
-                <?php if($itemData['type'] === 'create') : ?>
157
+                <?php if ($itemData['type'] === 'create') : ?>
158 158
                     <p>&nbsp;&nbsp;&#10003;&nbsp;&nbsp;<?=$itemName?>: <span class="ok"><?=$_lang['installed']?></span></p>
159
-                <?php elseif($itemData['type'] === 'update') : ?>
159
+                <?php elseif ($itemData['type'] === 'update') : ?>
160 160
                     <p>&nbsp;&nbsp;&#10003;&nbsp;&nbsp;<?=$itemName?>: <span class="ok"><?=$_lang['upgraded']?></span></p>
161
-                <?php elseif($itemData['type'] === 'skip') : ?>
161
+                <?php elseif ($itemData['type'] === 'skip') : ?>
162 162
                     <!-- SKIP -->
163 163
                 <?php endif; ?>
164 164
             <?php else : ?>
@@ -173,13 +173,13 @@  discard block
 block discarded – undo
173 173
         <h3><?=$_lang['chunks']?>:</h3>
174 174
         <?php foreach ($installDataLevel['chunks'] as $itemName => $itemData) : ?>
175 175
             <?php if (empty($itemData['error'])) : ?>
176
-                <?php if($itemData['type'] === 'create') : ?>
176
+                <?php if ($itemData['type'] === 'create') : ?>
177 177
                     <p>&nbsp;&nbsp;&#10003;&nbsp;&nbsp;<?=$itemName?>: <span class="ok"><?=$_lang['installed']?></span></p>
178
-                <?php elseif($itemData['type'] === 'overwrite') : ?>
178
+                <?php elseif ($itemData['type'] === 'overwrite') : ?>
179 179
                     <p>&nbsp;&nbsp;&#10003;&nbsp;&nbsp;<?=$itemName?>: <span class="ok"><?=$_lang['installed']?></span></p>
180
-                <?php elseif($itemData['type'] === 'update') : ?>
180
+                <?php elseif ($itemData['type'] === 'update') : ?>
181 181
                     <p>&nbsp;&nbsp;&#10003;&nbsp;&nbsp;<?=$itemName?>: <span class="ok"><?=$_lang['upgraded']?></span></p>
182
-                <?php elseif($itemData['type'] === 'skip') : ?>
182
+                <?php elseif ($itemData['type'] === 'skip') : ?>
183 183
                     <!-- SKIP -->
184 184
                 <?php endif; ?>
185 185
             <?php else : ?>
@@ -201,11 +201,11 @@  discard block
 block discarded – undo
201 201
         <h3><?=$_lang['modules']?>:</h3>
202 202
         <?php foreach ($installDataLevel['modules'] as $itemName => $itemData) : ?>
203 203
             <?php if (empty($itemData['error'])) : ?>
204
-                <?php if($itemData['type'] === 'create') : ?>
204
+                <?php if ($itemData['type'] === 'create') : ?>
205 205
                     <p>&nbsp;&nbsp;&#10003;&nbsp;&nbsp;<?=$itemName?>: <span class="ok"><?=$_lang['installed']?></span></p>
206
-                <?php elseif($itemData['type'] === 'update') : ?>
206
+                <?php elseif ($itemData['type'] === 'update') : ?>
207 207
                     <p>&nbsp;&nbsp;&#10003;&nbsp;&nbsp;<?=$itemName?>: <span class="ok"><?=$_lang['upgraded']?></span></p>
208
-                <?php elseif($itemData['type'] === 'skip') : ?>
208
+                <?php elseif ($itemData['type'] === 'skip') : ?>
209 209
                     <!-- SKIP -->
210 210
                 <?php endif; ?>
211 211
             <?php else : ?>
@@ -227,11 +227,11 @@  discard block
 block discarded – undo
227 227
         <h3><?=$_lang['plugins']?>:</h3>
228 228
         <?php foreach ($installDataLevel['plugins'] as $itemName => $itemData) : ?>
229 229
             <?php if (empty($itemData['error'])) : ?>
230
-                <?php if($itemData['type'] === 'create') : ?>
230
+                <?php if ($itemData['type'] === 'create') : ?>
231 231
                     <p>&nbsp;&nbsp;&#10003;&nbsp;&nbsp;<?=$itemName?>: <span class="ok"><?=$_lang['installed']?></span></p>
232
-                <?php elseif($itemData['type'] === 'update') : ?>
232
+                <?php elseif ($itemData['type'] === 'update') : ?>
233 233
                     <p>&nbsp;&nbsp;&#10003;&nbsp;&nbsp;<?=$itemName?>: <span class="ok"><?=$_lang['upgraded']?></span></p>
234
-                <?php elseif($itemData['type'] === 'skip') : ?>
234
+                <?php elseif ($itemData['type'] === 'skip') : ?>
235 235
                     <!-- SKIP -->
236 236
                 <?php endif; ?>
237 237
             <?php else : ?>
@@ -253,13 +253,13 @@  discard block
 block discarded – undo
253 253
         <h3><?=$_lang['snippets']?>:</h3>
254 254
         <?php foreach ($installDataLevel['snippets'] as $itemName => $itemData) : ?>
255 255
             <?php if (empty($itemData['error'])) : ?>
256
-                <?php if($itemData['type'] === 'create') : ?>
256
+                <?php if ($itemData['type'] === 'create') : ?>
257 257
                     <p>&nbsp;&nbsp;&#10003;&nbsp;&nbsp;<?=$itemName?>: <span class="ok"><?=$_lang['installed']?></span></p>
258
-                <?php elseif($itemData['type'] === 'overwrite') : ?>
258
+                <?php elseif ($itemData['type'] === 'overwrite') : ?>
259 259
                     <p>&nbsp;&nbsp;&#10003;&nbsp;&nbsp;<?=$itemName?>: <span class="ok"><?=$_lang['installed']?></span></p>
260
-                <?php elseif($itemData['type'] === 'update') : ?>
260
+                <?php elseif ($itemData['type'] === 'update') : ?>
261 261
                     <p>&nbsp;&nbsp;&#10003;&nbsp;&nbsp;<?=$itemName?>: <span class="ok"><?=$_lang['upgraded']?></span></p>
262
-                <?php elseif($itemData['type'] === 'skip') : ?>
262
+                <?php elseif ($itemData['type'] === 'skip') : ?>
263 263
                     <!-- SKIP -->
264 264
                 <?php endif; ?>
265 265
             <?php else : ?>
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
             <p><?=$_lang['setup_couldnt_install']?></p>
287 287
             <p><?=$_lang['installation_error_occured']?></p>
288 288
             <br /><br />
289
-            <?php foreach($installDataLevel['demo']['error'] as $error): ?>
289
+            <?php foreach ($installDataLevel['demo']['error'] as $error): ?>
290 290
                 <em><?=$error['content']?></em>
291 291
                 <?=$_lang['during_execution_of_sql']?>
292 292
                 <span class="mono"><?=htmlspecialchars($error['sql'])?></span>
@@ -300,9 +300,9 @@  discard block
 block discarded – undo
300 300
 <?php if ($installLevel >= 6): ?>
301 301
     <?php foreach ($installDependencyLevel as $itemName => $itemData) : ?>
302 302
         <?php if (empty($itemData['error'])) : ?>
303
-            <?php if($itemData['type'] === 'create') : ?>
303
+            <?php if ($itemData['type'] === 'create') : ?>
304 304
                 <p>&nbsp;&nbsp;&#10003;&nbsp;&nbsp;<?=$itemName?>Module: <span class="ok"><?=$_lang['depedency_create']?></span></p>
305
-            <?php elseif($itemData['type'] === 'update') : ?>
305
+            <?php elseif ($itemData['type'] === 'update') : ?>
306 306
                 <p>&nbsp;&nbsp;&#10003;&nbsp;&nbsp;<?=$itemName?>Module: <span class="ok"><?=$_lang['depedency_update']?></span></p>
307 307
             <?php endif; ?>
308 308
 
@@ -370,10 +370,10 @@  discard block
 block discarded – undo
370 370
                 var chk = document.install.rminstaller;
371 371
                 if (chk && chk.checked) {
372 372
                     // remove install folder and files
373
-                    window.location.href = "../<?=MGR_DIR;?>/processors/remove_installer.processor.php?rminstall=1";
373
+                    window.location.href = "../<?=MGR_DIR; ?>/processors/remove_installer.processor.php?rminstall=1";
374 374
                 }
375 375
                 else {
376
-                    window.location.href = "../<?=MGR_DIR;?>/";
376
+                    window.location.href = "../<?=MGR_DIR; ?>/";
377 377
                 }
378 378
             }
379 379
             /* ]]> */
Please login to merge, or discard this patch.
install/index.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -3,13 +3,13 @@  discard block
 block discarded – undo
3 3
  * EVO Installer
4 4
  */
5 5
 error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
6
-$base_path = dirname(__DIR__) . '/';
6
+$base_path = dirname(__DIR__).'/';
7 7
 
8
-if (is_file($base_path . 'assets/cache/siteManager.php')) {
9
-    include_once $base_path . 'assets/cache/siteManager.php';
8
+if (is_file($base_path.'assets/cache/siteManager.php')) {
9
+    include_once $base_path.'assets/cache/siteManager.php';
10 10
 }
11
-if (! defined('MGR_DIR')) {
12
-    if (is_dir($base_path . 'manager')) {
11
+if (!defined('MGR_DIR')) {
12
+    if (is_dir($base_path.'manager')) {
13 13
         define('MGR_DIR', 'manager');
14 14
     } else {
15 15
         die('MGR_DIR is not defined');
@@ -19,12 +19,12 @@  discard block
 block discarded – undo
19 19
 require_once 'src/functions.php';
20 20
 
21 21
 if (empty($_GET['self'])) {
22
-    $autoloader = realpath(__DIR__ . '/../vendor/autoload.php');
22
+    $autoloader = realpath(__DIR__.'/../vendor/autoload.php');
23 23
     if (file_exists($autoloader) && is_readable($autoloader)) {
24 24
         include_once $autoloader;
25 25
     }
26 26
 
27
-    require_once '../' . MGR_DIR . '/includes/version.inc.php';
27
+    require_once '../'.MGR_DIR.'/includes/version.inc.php';
28 28
 
29 29
     // start session
30 30
     session_start();
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     install_sessionCheck();
33 33
 
34 34
     $moduleName = 'EVO';
35
-    $moduleVersion = $modx_branch . ' ' . $modx_version;
35
+    $moduleVersion = $modx_branch.' '.$modx_version;
36 36
     $moduleRelease = $modx_release_date;
37 37
     $moduleSQLBaseFile = 'stubs/sql/setup.sql';
38 38
     $moduleSQLDataFile = 'stubs/sql/setup.data.sql';
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
     $action = isset($_GET['action']) ? trim(strip_tags($_GET['action'])) : 'language';
74 74
     str_replace('.', '', $action);
75 75
 
76
-    $controller = 'src/controllers/' . $action . '.php';
77
-    if (! file_exists($controller)) {
76
+    $controller = 'src/controllers/'.$action.'.php';
77
+    if (!file_exists($controller)) {
78 78
         die("Invalid install action attempted. [action={$action}]");
79 79
     }
80 80
     require $controller;
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 } else {
87 87
     $action = isset($_GET['action']) && is_scalar($_GET['action']) ? trim($_GET['action']) : 'language';
88 88
     str_replace('.', '', $action);
89
-    $controller = 'src/controllers/' . $action . '.php';
90
-    if (! file_exists($controller)) {
89
+    $controller = 'src/controllers/'.$action.'.php';
90
+    if (!file_exists($controller)) {
91 91
         die("Invalid install action attempted. [action={$action}]");
92 92
     }
93 93
     require $controller;
Please login to merge, or discard this patch.
install/cli-install.php 1 patch
Spacing   +257 added lines, -258 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 . 'stubs/sql/setup.sql';
35
-$moduleSQLDataFile = $path . 'stubs/sql/setup.data.sql';
36
-$moduleSQLResetFile = $path . 'stubs/sql/setup.data.reset.sql';
34
+$moduleSQLBaseFile = $path.'stubs/sql/setup.sql';
35
+$moduleSQLDataFile = $path.'stubs/sql/setup.data.sql';
36
+$moduleSQLResetFile = $path.'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);
@@ -833,7 +832,7 @@  discard block
 block discarded – undo
833 832
 // setup callback function
834 833
 $callBackFnc = "clean_up";
835 834
 
836
-include $path . "src/sqlParser.class.php";
835
+include $path."src/sqlParser.class.php";
837 836
 $sqlParser = new SqlParser($database_server, $database_user, $database_password, str_replace("`", "", $dbase),
838 837
     $table_prefix, $adminname, $adminemail, $adminpass, $database_connection_charset, $managerlanguage,
839 838
     $database_connection_method, $auto_template_logic);
@@ -854,21 +853,21 @@  discard block
 block discarded – undo
854 853
     // display database results
855 854
     if ($sqlParser->installFailed == true) {
856 855
         $errors += 1;
857
-        echo $_lang['database_alerts'] . PHP_EOL;
858
-        echo $_lang['setup_couldnt_install'] . PHP_EOL;
859
-        echo $_lang['installation_error_occured'] . PHP_EOL;
856
+        echo $_lang['database_alerts'].PHP_EOL;
857
+        echo $_lang['setup_couldnt_install'].PHP_EOL;
858
+        echo $_lang['installation_error_occured'].PHP_EOL;
860 859
         for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) {
861
-            echo $sqlParser->mysqlErrors[$i]["error"] . " " . $_lang['during_execution_of_sql'] . " " . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . PHP_EOL;
860
+            echo $sqlParser->mysqlErrors[$i]["error"]." ".$_lang['during_execution_of_sql']." ".strip_tags($sqlParser->mysqlErrors[$i]["sql"]).PHP_EOL;
862 861
         }
863
-        echo $_lang['some_tables_not_updated'] . PHP_EOL;
862
+        echo $_lang['some_tables_not_updated'].PHP_EOL;
864 863
         die();
865 864
     } else {
866
-        echo $_lang['ok'] . PHP_EOL;
865
+        echo $_lang['ok'].PHP_EOL;
867 866
     }
868 867
 }
869 868
 
870 869
 // custom or not
871
-if (file_exists($path . "../assets/cache/siteManager.php")) {
870
+if (file_exists($path."../assets/cache/siteManager.php")) {
872 871
     $mgrdir = 'include_once(__DIR__."/../../assets/cache/siteManager.php");';
873 872
 } else {
874 873
     $mgrdir = 'define(\'MGR_DIR\', \'manager\');';
@@ -888,10 +887,10 @@  discard block
 block discarded – undo
888 887
 $confph['lastInstallTime'] = time();
889 888
 $confph['site_sessionname'] = $site_sessionname;
890 889
 
891
-$configString = file_get_contents($path . 'stubs/config.tpl');
890
+$configString = file_get_contents($path.'stubs/config.tpl');
892 891
 $configString = parse($configString, $confph);
893 892
 
894
-$filename = $base_path . MGR_DIR . '/includes/config.inc.php';
893
+$filename = $base_path.MGR_DIR.'/includes/config.inc.php';
895 894
 $configFileFailed = false;
896 895
 if (@ !$handle = fopen($filename, 'w')) {
897 896
     $configFileFailed = true;
@@ -907,38 +906,38 @@  discard block
 block discarded – undo
907 906
 $chmodSuccess = @chmod($filename, 0404);
908 907
 
909 908
 if ($configFileFailed == true) {
910
-    echo $_lang['failed'] . PHP_EOL;
909
+    echo $_lang['failed'].PHP_EOL;
911 910
     $errors += 1;
912 911
 
913
-    echo $_lang['cant_write_config_file'] . ' ' . MGR_DIR . '/includes/config.inc.php' . PHP_EOL;
914
-    echo ' ' . PHP_EOL;
915
-    echo ' ' . PHP_EOL;
912
+    echo $_lang['cant_write_config_file'].' '.MGR_DIR.'/includes/config.inc.php'.PHP_EOL;
913
+    echo ' '.PHP_EOL;
914
+    echo ' '.PHP_EOL;
916 915
     echo $configString;
917
-    echo ' ' . PHP_EOL;
918
-    echo ' ' . PHP_EOL;
919
-    echo $_lang['cant_write_config_file_note'] . PHP_EOL;
916
+    echo ' '.PHP_EOL;
917
+    echo ' '.PHP_EOL;
918
+    echo $_lang['cant_write_config_file_note'].PHP_EOL;
920 919
     die();
921 920
 
922 921
 } else {
923
-    echo $_lang['ok'] . PHP_EOL;
922
+    echo $_lang['ok'].PHP_EOL;
924 923
 }
925 924
 
926 925
 // generate new site_id and set manager theme to default
927 926
 if ($installMode == 0) {
928 927
     $siteid = uniqid('');
929 928
     mysqli_query($sqlParser->conn,
930
-        "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')");
929
+        "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')");
931 930
 } else {
932 931
     // update site_id if missing
933 932
     $ds = mysqli_query($sqlParser->conn,
934
-        "SELECT setting_name,setting_value FROM $dbase.`" . $table_prefix . "system_settings` WHERE setting_name='site_id'");
933
+        "SELECT setting_name,setting_value FROM $dbase.`".$table_prefix."system_settings` WHERE setting_name='site_id'");
935 934
     if ($ds) {
936 935
         $r = mysqli_fetch_assoc($ds);
937 936
         $siteid = $r['setting_value'];
938 937
         if ($siteid == '' || $siteid = 'MzGeQ2faT4Dw06+U49x3') {
939 938
             $siteid = uniqid('');
940 939
             mysqli_query($sqlParser->conn,
941
-                "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')");
940
+                "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')");
942 941
         }
943 942
     }
944 943
 }
@@ -950,25 +949,25 @@  discard block
 block discarded – undo
950 949
     // display database results
951 950
     if ($sqlParser->installFailed == true) {
952 951
         $errors += 1;
953
-        echo $_lang['database_alerts'] . PHP_EOL;
954
-        echo $_lang['setup_couldnt_install'] . PHP_EOL;
955
-        echo $_lang['installation_error_occured'] . PHP_EOL . PHP_EOL;
952
+        echo $_lang['database_alerts'].PHP_EOL;
953
+        echo $_lang['setup_couldnt_install'].PHP_EOL;
954
+        echo $_lang['installation_error_occured'].PHP_EOL.PHP_EOL;
956 955
         /*
957 956
         for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) {
958 957
             echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />";
959 958
         }
960 959
         echo "</p>";*/
961
-        echo $_lang['some_tables_not_updated'] . PHP_EOL;
960
+        echo $_lang['some_tables_not_updated'].PHP_EOL;
962 961
         die();
963 962
     } else {
964
-        echo $_lang['ok'] . PHP_EOL;
963
+        echo $_lang['ok'].PHP_EOL;
965 964
     }
966 965
 }
967 966
 
968 967
 // Install Templates
969 968
 $moduleTemplate = $mt;
970 969
 if (!empty($moduleTemplate) || $installData) {
971
-    echo PHP_EOL . $_lang['templates'] . ":" . PHP_EOL;
970
+    echo PHP_EOL.$_lang['templates'].":".PHP_EOL;
972 971
     //$selTemplates = $_POST['template'];
973 972
     foreach ($moduleTemplates as $k => $moduleTemplate) {
974 973
         $installSample = in_array('sample', $moduleTemplate[6]) && $installData == 1;
@@ -980,7 +979,7 @@  discard block
 block discarded – undo
980 979
             $filecontent = $moduleTemplate[3];
981 980
             $save_sql_id_as = $moduleTemplate[7]; // Nessecary for demo-site
982 981
             if (!file_exists($filecontent)) {
983
-                echo "  $name: " . $_lang['unable_install_template'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
982
+                echo "  $name: ".$_lang['unable_install_template']." '$filecontent' ".$_lang['not_found'].PHP_EOL;
984 983
             } else {
985 984
                 // Create the category if it does not already exist
986 985
                 $category_id = getCreateDbCategory($category, $sqlParser);
@@ -991,13 +990,13 @@  discard block
 block discarded – undo
991 990
 
992 991
                 // See if the template already exists
993 992
                 $rs = mysqli_query($sqlParser->conn,
994
-                    "SELECT * FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name'");
993
+                    "SELECT * FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name'");
995 994
 
996 995
                 if (mysqli_num_rows($rs)) {
997 996
                     if (!mysqli_query($sqlParser->conn,
998
-                        "UPDATE $dbase.`" . $table_prefix . "site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;")) {
997
+                        "UPDATE $dbase.`".$table_prefix."site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;")) {
999 998
                         $errors += 1;
1000
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
999
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1001 1000
 
1002 1001
                         return;
1003 1002
                     }
@@ -1005,23 +1004,23 @@  discard block
 block discarded – undo
1005 1004
                         $sql_id = @mysqli_insert_id($sqlParser->conn);
1006 1005
                         if (!$sql_id) {
1007 1006
                             $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn,
1008
-                                "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name' LIMIT 1;"));
1007
+                                "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name' LIMIT 1;"));
1009 1008
                             $sql_id = $idQuery['id'];
1010 1009
                         }
1011 1010
                         $custom_placeholders[$save_sql_id_as] = $sql_id;
1012 1011
                     }
1013
-                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1012
+                    echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1014 1013
                 } else {
1015 1014
                     if (!@ mysqli_query($sqlParser->conn,
1016
-                        "INSERT INTO $dbase.`" . $table_prefix . "site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) {
1015
+                        "INSERT INTO $dbase.`".$table_prefix."site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) {
1017 1016
                         $errors += 1;
1018
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1017
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1019 1018
                         die();
1020 1019
                     }
1021 1020
                     if (!is_null($save_sql_id_as)) {
1022 1021
                         $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn);
1023 1022
                     }
1024
-                    echo "  $name: " . $_lang['installed'] . PHP_EOL;
1023
+                    echo "  $name: ".$_lang['installed'].PHP_EOL;
1025 1024
                 }
1026 1025
             }
1027 1026
         }
@@ -1031,7 +1030,7 @@  discard block
 block discarded – undo
1031 1030
 // Install Template Variables
1032 1031
 $moduleTVs = $mtv;
1033 1032
 if (is_array($moduleTVs) || $installData) {
1034
-    echo PHP_EOL . $_lang['tvs'] . ': ' . PHP_EOL;
1033
+    echo PHP_EOL.$_lang['tvs'].': '.PHP_EOL;
1035 1034
     //$selTVs = $_POST['tv'];
1036 1035
     foreach ($moduleTVs as $k => $moduleTV) {
1037 1036
         $installSample = in_array('sample', $moduleTV[12]) && $installData == 1;
@@ -1054,27 +1053,27 @@  discard block
 block discarded – undo
1054 1053
             $category = getCreateDbCategory($category, $sqlParser);
1055 1054
 
1056 1055
             $rs = mysqli_query($sqlParser->conn,
1057
-                "SELECT * FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name'");
1056
+                "SELECT * FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name'");
1058 1057
             if (mysqli_num_rows($rs)) {
1059 1058
                 $insert = true;
1060 1059
                 while ($row = mysqli_fetch_assoc($rs)) {
1061 1060
                     if (!mysqli_query($sqlParser->conn,
1062
-                        "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']};")) {
1063
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1061
+                        "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']};")) {
1062
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1064 1063
 
1065 1064
                         return;
1066 1065
                     }
1067 1066
                     $insert = false;
1068 1067
                 }
1069
-                echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1068
+                echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1070 1069
             } else {
1071
-                $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');";
1070
+                $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');";
1072 1071
                 if (!mysqli_query($sqlParser->conn, $q)) {
1073
-                    echo mysqli_error($sqlParser->conn) . PHP_EOL;
1072
+                    echo mysqli_error($sqlParser->conn).PHP_EOL;
1074 1073
 
1075 1074
                     return;
1076 1075
                 }
1077
-                echo "  $name: " . $_lang['installed'] . PHP_EOL;
1076
+                echo "  $name: ".$_lang['installed'].PHP_EOL;
1078 1077
             }
1079 1078
 
1080 1079
             // add template assignments
@@ -1084,22 +1083,22 @@  discard block
 block discarded – undo
1084 1083
 
1085 1084
                 // remove existing tv -> template assignments
1086 1085
                 $ds = mysqli_query($sqlParser->conn,
1087
-                    "SELECT id FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name' AND description='$desc';");
1086
+                    "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';");
1088 1087
                 $row = mysqli_fetch_assoc($ds);
1089 1088
                 $id = $row["id"];
1090 1089
                 mysqli_query($sqlParser->conn,
1091
-                    'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_tmplvar_templates` WHERE tmplvarid = \'' . $id . '\'');
1090
+                    'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_tmplvar_templates` WHERE tmplvarid = \''.$id.'\'');
1092 1091
 
1093 1092
                 // add tv -> template assignments
1094 1093
                 foreach ($assignments as $assignment) {
1095 1094
                     $template = mysqli_real_escape_string($conn, $assignment);
1096 1095
                     $ts = mysqli_query($sqlParser->conn,
1097
-                        "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$template';");
1096
+                        "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$template';");
1098 1097
                     if ($ds && $ts) {
1099 1098
                         $tRow = mysqli_fetch_assoc($ts);
1100 1099
                         $templateId = $tRow['id'];
1101 1100
                         mysqli_query($sqlParser->conn,
1102
-                            "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)");
1101
+                            "INSERT INTO $dbase.`".$table_prefix."site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)");
1103 1102
                     }
1104 1103
                 }
1105 1104
             }
@@ -1111,7 +1110,7 @@  discard block
 block discarded – undo
1111 1110
 $moduleChunks = $mc;
1112 1111
 // Install Chunks
1113 1112
 if (is_array($moduleChunks) || $installData) {
1114
-    echo PHP_EOL . $_lang['chunks'] . ": " . PHP_EOL;
1113
+    echo PHP_EOL.$_lang['chunks'].": ".PHP_EOL;
1115 1114
     foreach ($moduleChunks as $k => $moduleChunk) {
1116 1115
         $installSample = in_array('sample', $moduleChunk[5]) && $installData == 1;
1117 1116
         $count_new_name = 0;
@@ -1124,7 +1123,7 @@  discard block
 block discarded – undo
1124 1123
             $filecontent = $moduleChunk[2];
1125 1124
 
1126 1125
             if (!file_exists($filecontent)) {
1127
-                echo "  $name: " . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1126
+                echo "  $name: ".$_lang['unable_install_chunk']." '$filecontent' ".$_lang['not_found'].PHP_EOL;
1128 1127
             } else {
1129 1128
 
1130 1129
                 // Create the category if it does not already exist
@@ -1133,36 +1132,36 @@  discard block
 block discarded – undo
1133 1132
                 $chunk = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', file_get_contents($filecontent), 1);
1134 1133
                 $chunk = mysqli_real_escape_string($conn, $chunk);
1135 1134
                 $rs = mysqli_query($sqlParser->conn,
1136
-                    "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$name'");
1135
+                    "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$name'");
1137 1136
                 $count_original_name = mysqli_num_rows($rs);
1138 1137
                 if ($overwrite == 'false') {
1139
-                    $newname = $name . '-' . str_replace('.', '_', $modx_version);
1138
+                    $newname = $name.'-'.str_replace('.', '_', $modx_version);
1140 1139
                     $rs = mysqli_query($sqlParser->conn,
1141
-                        "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$newname'");
1140
+                        "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$newname'");
1142 1141
                     $count_new_name = mysqli_num_rows($rs);
1143 1142
                 }
1144 1143
                 $update = $count_original_name > 0 && $overwrite == 'true';
1145 1144
                 if ($update) {
1146 1145
                     if (!mysqli_query($sqlParser->conn,
1147
-                        "UPDATE $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
1146
+                        "UPDATE $dbase.`".$table_prefix."site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
1148 1147
                         $errors += 1;
1149
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1148
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1150 1149
 
1151 1150
                         return;
1152 1151
                     }
1153
-                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1152
+                    echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1154 1153
                 } elseif ($count_new_name == 0) {
1155 1154
                     if ($count_original_name > 0 && $overwrite == 'false') {
1156 1155
                         $name = $newname;
1157 1156
                     }
1158 1157
                     if (!mysqli_query($sqlParser->conn,
1159
-                        "INSERT INTO $dbase.`" . $table_prefix . "site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) {
1158
+                        "INSERT INTO $dbase.`".$table_prefix."site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) {
1160 1159
                         $errors += 1;
1161
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1160
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1162 1161
 
1163 1162
                         return;
1164 1163
                     }
1165
-                    echo "  $name: " . $_lang['installed'] . PHP_EOL;
1164
+                    echo "  $name: ".$_lang['installed'].PHP_EOL;
1166 1165
                 }
1167 1166
             }
1168 1167
         }
@@ -1172,7 +1171,7 @@  discard block
 block discarded – undo
1172 1171
 // Install Modules
1173 1172
 $moduleModules = $mm;
1174 1173
 if (is_array($moduleModules) || $installData) {
1175
-    echo PHP_EOL . $_lang['modules'] . ":" . PHP_EOL;
1174
+    echo PHP_EOL.$_lang['modules'].":".PHP_EOL;
1176 1175
     //$selModules = $_POST['module'];
1177 1176
     foreach ($moduleModules as $k => $moduleModule) {
1178 1177
         $installSample = in_array('sample', $moduleModule[7]) && $installData == 1;
@@ -1185,7 +1184,7 @@  discard block
 block discarded – undo
1185 1184
             $shared = mysqli_real_escape_string($conn, $moduleModule[5]);
1186 1185
             $category = mysqli_real_escape_string($conn, $moduleModule[6]);
1187 1186
             if (!file_exists($filecontent)) {
1188
-                echo "  $name: " . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1187
+                echo "  $name: ".$_lang['unable_install_module']." '$filecontent' ".$_lang['not_found'].PHP_EOL;
1189 1188
             } else {
1190 1189
 
1191 1190
                 // Create the category if it does not already exist
@@ -1195,28 +1194,28 @@  discard block
 block discarded – undo
1195 1194
                 // $module = removeDocblock($module, 'module'); // Modules have no fileBinding, keep docblock for info-tab
1196 1195
                 $module = mysqli_real_escape_string($conn, $module);
1197 1196
                 $rs = mysqli_query($sqlParser->conn,
1198
-                    "SELECT * FROM $dbase.`" . $table_prefix . "site_modules` WHERE name='$name'");
1197
+                    "SELECT * FROM $dbase.`".$table_prefix."site_modules` WHERE name='$name'");
1199 1198
                 if (mysqli_num_rows($rs)) {
1200 1199
                     $row = mysqli_fetch_assoc($rs);
1201 1200
                     $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
1202 1201
                     if (!mysqli_query($sqlParser->conn,
1203
-                        "UPDATE $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
1204
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1202
+                        "UPDATE $dbase.`".$table_prefix."site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
1203
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1205 1204
 
1206 1205
                         return;
1207 1206
                     }
1208
-                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1207
+                    echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1209 1208
                 } else {
1210 1209
                     if ($properties != null) {
1211 1210
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
1212 1211
                     }
1213 1212
                     if (!mysqli_query($sqlParser->conn,
1214
-                        "INSERT INTO $dbase.`" . $table_prefix . "site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) {
1215
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
1213
+                        "INSERT INTO $dbase.`".$table_prefix."site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) {
1214
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
1216 1215
 
1217 1216
                         return;
1218 1217
                     }
1219
-                    echo "  $name: " . $_lang['installed'] . PHP_EOL;
1218
+                    echo "  $name: ".$_lang['installed'].PHP_EOL;
1220 1219
                 }
1221 1220
             }
1222 1221
         }
@@ -1226,7 +1225,7 @@  discard block
 block discarded – undo
1226 1225
 // Install Plugins
1227 1226
 $modulePlugins = $mp;
1228 1227
 if (is_array($modulePlugins) || $installData) {
1229
-    echo PHP_EOL . $_lang['plugins'] . ":" . PHP_EOL;
1228
+    echo PHP_EOL.$_lang['plugins'].":".PHP_EOL;
1230 1229
     $selPlugs = $_POST['plugin'];
1231 1230
     foreach ($modulePlugins as $k => $modulePlugin) {
1232 1231
         //$installSample = in_array('sample', $modulePlugin[8]) && $installData == 1;
@@ -1242,16 +1241,16 @@  discard block
 block discarded – undo
1242 1241
             $disabled = $modulePlugin[9];
1243 1242
             if (array_key_exists(7, $modulePlugin)) {
1244 1243
                 // parse comma-separated legacy names and prepare them for sql IN clause
1245
-                $leg_names = "'" . implode("','",
1246
-                        preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))) . "'";
1244
+                $leg_names = "'".implode("','",
1245
+                        preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7])))."'";
1247 1246
             }
1248 1247
             if (!file_exists($filecontent)) {
1249
-                echo "  $name: " . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1248
+                echo "  $name: ".$_lang['unable_install_plugin']." '$filecontent' ".$_lang['not_found'].PHP_EOL;
1250 1249
             } else {
1251 1250
 
1252 1251
                 // disable legacy versions based on legacy_names provided
1253 1252
                 if (!empty($leg_names)) {
1254
-                    $update_query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
1253
+                    $update_query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
1255 1254
                     $rs = mysqli_query($sqlParser->conn, $update_query);
1256 1255
                 }
1257 1256
 
@@ -1262,23 +1261,23 @@  discard block
 block discarded – undo
1262 1261
                 $plugin = removeDocblock($plugin, 'plugin');
1263 1262
                 $plugin = mysqli_real_escape_string($conn, $plugin);
1264 1263
                 $rs = mysqli_query($sqlParser->conn,
1265
-                    "SELECT * FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='$name'");
1264
+                    "SELECT * FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name'");
1266 1265
                 if (mysqli_num_rows($rs)) {
1267 1266
                     $insert = true;
1268 1267
                     while ($row = mysqli_fetch_assoc($rs)) {
1269 1268
                         $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
1270 1269
                         if ($row['description'] == $desc) {
1271 1270
                             if (!mysqli_query($sqlParser->conn,
1272
-                                "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) {
1273
-                                echo mysqli_error($sqlParser->conn) . PHP_EOL;
1271
+                                "UPDATE $dbase.`".$table_prefix."site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) {
1272
+                                echo mysqli_error($sqlParser->conn).PHP_EOL;
1274 1273
 
1275 1274
                                 return;
1276 1275
                             }
1277 1276
                             $insert = false;
1278 1277
                         } else {
1279 1278
                             if (!mysqli_query($sqlParser->conn,
1280
-                                "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};")) {
1281
-                                echo mysqli_error($sqlParser->conn) . PHP_EOL;
1279
+                                "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE id={$row['id']};")) {
1280
+                                echo mysqli_error($sqlParser->conn).PHP_EOL;
1282 1281
 
1283 1282
                                 return;
1284 1283
                             }
@@ -1287,39 +1286,39 @@  discard block
 block discarded – undo
1287 1286
                     if ($insert === true) {
1288 1287
                         $properties = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
1289 1288
                         if (!mysqli_query($sqlParser->conn,
1290
-                            "INSERT INTO $dbase.`" . $table_prefix . "site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);")) {
1291
-                            echo mysqli_error($sqlParser->conn) . PHP_EOL;
1289
+                            "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);")) {
1290
+                            echo mysqli_error($sqlParser->conn).PHP_EOL;
1292 1291
 
1293 1292
                             return;
1294 1293
                         }
1295 1294
                     }
1296
-                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1295
+                    echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1297 1296
                 } else {
1298 1297
                     if ($properties != null) {
1299 1298
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
1300 1299
                     }
1301 1300
                     if (!mysqli_query($sqlParser->conn,
1302
-                        "INSERT INTO $dbase.`" . $table_prefix . "site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) {
1303
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1301
+                        "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) {
1302
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1304 1303
 
1305 1304
                         return;
1306 1305
                     }
1307
-                    echo "  $name: " . $_lang['installed'] . PHP_EOL;
1306
+                    echo "  $name: ".$_lang['installed'].PHP_EOL;
1308 1307
                 }
1309 1308
                 // add system events
1310 1309
                 if (count($events) > 0) {
1311 1310
                     $ds = mysqli_query($sqlParser->conn,
1312
-                        "SELECT id FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='$name' AND description='$desc';");
1311
+                        "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';");
1313 1312
                     if ($ds) {
1314 1313
                         $row = mysqli_fetch_assoc($ds);
1315 1314
                         $id = $row["id"];
1316 1315
                         // remove existing events
1317 1316
                         mysqli_query($sqlParser->conn,
1318
-                            'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_plugin_events` WHERE pluginid = \'' . $id . '\'');
1317
+                            'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_plugin_events` WHERE pluginid = \''.$id.'\'');
1319 1318
                         // add new events
1320 1319
                         mysqli_query($sqlParser->conn,
1321
-                            "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("','",
1322
-                                $events) . "')");
1320
+                            "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("','",
1321
+                                $events)."')");
1323 1322
                     }
1324 1323
                 }
1325 1324
             }
@@ -1330,7 +1329,7 @@  discard block
 block discarded – undo
1330 1329
 // Install Snippets
1331 1330
 $moduleSnippet = $ms;
1332 1331
 if (is_array($moduleSnippet) || $installData) {
1333
-    echo PHP_EOL . $_lang['snippets'] . ":" . PHP_EOL;
1332
+    echo PHP_EOL.$_lang['snippets'].":".PHP_EOL;
1334 1333
     //$selSnips = $_POST['snippet'];
1335 1334
     foreach ($moduleSnippets as $k => $moduleSnippet) {
1336 1335
         $installSample = in_array('sample', $moduleSnippet[5]) && $installData == 1;
@@ -1341,7 +1340,7 @@  discard block
 block discarded – undo
1341 1340
             $properties = $moduleSnippet[3];
1342 1341
             $category = mysqli_real_escape_string($conn, $moduleSnippet[4]);
1343 1342
             if (!file_exists($filecontent)) {
1344
-                echo "  $name: " . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1343
+                echo "  $name: ".$_lang['unable_install_snippet']." '$filecontent' ".$_lang['not_found'].PHP_EOL;
1345 1344
             } else {
1346 1345
 
1347 1346
                 // Create the category if it does not already exist
@@ -1351,28 +1350,28 @@  discard block
 block discarded – undo
1351 1350
                 $snippet = removeDocblock($snippet, 'snippet');
1352 1351
                 $snippet = mysqli_real_escape_string($conn, $snippet);
1353 1352
                 $rs = mysqli_query($sqlParser->conn,
1354
-                    "SELECT * FROM $dbase.`" . $table_prefix . "site_snippets` WHERE name='$name'");
1353
+                    "SELECT * FROM $dbase.`".$table_prefix."site_snippets` WHERE name='$name'");
1355 1354
                 if (mysqli_num_rows($rs)) {
1356 1355
                     $row = mysqli_fetch_assoc($rs);
1357 1356
                     $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
1358 1357
                     if (!mysqli_query($sqlParser->conn,
1359
-                        "UPDATE $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
1360
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1358
+                        "UPDATE $dbase.`".$table_prefix."site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
1359
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1361 1360
 
1362 1361
                         return;
1363 1362
                     }
1364
-                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1363
+                    echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1365 1364
                 } else {
1366 1365
                     if ($properties != null) {
1367 1366
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
1368 1367
                     }
1369 1368
                     if (!mysqli_query($sqlParser->conn,
1370
-                        "INSERT INTO $dbase.`" . $table_prefix . "site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) {
1371
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1369
+                        "INSERT INTO $dbase.`".$table_prefix."site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) {
1370
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1372 1371
 
1373 1372
                         return;
1374 1373
                     }
1375
-                    echo "  $name: " . $_lang['installed'] . PHP_EOL;
1374
+                    echo "  $name: ".$_lang['installed'].PHP_EOL;
1376 1375
                 }
1377 1376
             }
1378 1377
         }
@@ -1381,19 +1380,19 @@  discard block
 block discarded – undo
1381 1380
 
1382 1381
 // Install demo-site
1383 1382
 if ($installData && $moduleSQLDataFile) {
1384
-    echo PHP_EOL . $_lang['installing_demo_site'];
1383
+    echo PHP_EOL.$_lang['installing_demo_site'];
1385 1384
     $sqlParser->process($moduleSQLDataFile);
1386 1385
     // display database results
1387 1386
     if ($sqlParser->installFailed == true) {
1388 1387
         $errors += 1;
1389
-        echo $_lang['database_alerts'] . PHP_EOL;
1390
-        echo $_lang['setup_couldnt_install'] . PHP_EOL;
1391
-        echo $_lang['installation_error_occured'] . PHP_EOL . PHP_EOL;
1388
+        echo $_lang['database_alerts'].PHP_EOL;
1389
+        echo $_lang['setup_couldnt_install'].PHP_EOL;
1390
+        echo $_lang['installation_error_occured'].PHP_EOL.PHP_EOL;
1392 1391
         for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) {
1393
-            echo $sqlParser->mysqlErrors[$i]["error"] . " " . $_lang['during_execution_of_sql'] . " " . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . PHP_EOL;
1392
+            echo $sqlParser->mysqlErrors[$i]["error"]." ".$_lang['during_execution_of_sql']." ".strip_tags($sqlParser->mysqlErrors[$i]["sql"]).PHP_EOL;
1394 1393
         }
1395 1394
 
1396
-        echo $_lang['some_tables_not_updated'] . PHP_EOL;
1395
+        echo $_lang['some_tables_not_updated'].PHP_EOL;
1397 1396
 
1398 1397
         return;
1399 1398
     } else {
@@ -1405,7 +1404,7 @@  discard block
 block discarded – undo
1405 1404
             $sql = sprintf('UPDATE `%ssite_content` SET template=%s WHERE template=4', $sqlParser->prefix, $row['id']);
1406 1405
             mysqli_query($sqlParser->conn, $sql);
1407 1406
         }
1408
-        echo $_lang['ok'] . PHP_EOL;
1407
+        echo $_lang['ok'].PHP_EOL;
1409 1408
     }
1410 1409
 }
1411 1410
 
@@ -1413,9 +1412,9 @@  discard block
 block discarded – undo
1413 1412
 $moduleDependencies = $mdp;
1414 1413
 foreach ($moduleDependencies as $dependency) {
1415 1414
     $ds = mysqli_query($sqlParser->conn,
1416
-        'SELECT id, guid FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_modules` WHERE name="' . $dependency['module'] . '"');
1415
+        'SELECT id, guid FROM '.$dbase.'`'.$sqlParser->prefix.'site_modules` WHERE name="'.$dependency['module'].'"');
1417 1416
     if (!$ds) {
1418
-        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1417
+        echo mysqli_error($sqlParser->conn).PHP_EOL;
1419 1418
 
1420 1419
         return;
1421 1420
     } else {
@@ -1425,9 +1424,9 @@  discard block
 block discarded – undo
1425 1424
     }
1426 1425
     // get extra id
1427 1426
     $ds = mysqli_query($sqlParser->conn,
1428
-        'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE ' . $dependency['column'] . '="' . $dependency['name'] . '"');
1427
+        'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE '.$dependency['column'].'="'.$dependency['name'].'"');
1429 1428
     if (!$ds) {
1430
-        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1429
+        echo mysqli_error($sqlParser->conn).PHP_EOL;
1431 1430
 
1432 1431
         return;
1433 1432
     } else {
@@ -1436,34 +1435,34 @@  discard block
 block discarded – undo
1436 1435
     }
1437 1436
     // setup extra as module dependency
1438 1437
     $ds = mysqli_query($sqlParser->conn,
1439
-        'SELECT module FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type'] . ' LIMIT 1');
1438
+        'SELECT module FROM '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type'].' LIMIT 1');
1440 1439
     if (!$ds) {
1441
-        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1440
+        echo mysqli_error($sqlParser->conn).PHP_EOL;
1442 1441
 
1443 1442
         return;
1444 1443
     } else {
1445 1444
         if (mysqli_num_rows($ds) === 0) {
1446 1445
             mysqli_query($sqlParser->conn,
1447
-                'INSERT INTO ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` (module, resource, type) VALUES(' . $moduleId . ',' . $extraId . ',' . $dependency['type'] . ')');
1448
-            echo $dependency['module'] . ' Module: ' . $_lang['depedency_create'] . PHP_EOL;
1446
+                'INSERT INTO '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` (module, resource, type) VALUES('.$moduleId.','.$extraId.','.$dependency['type'].')');
1447
+            echo $dependency['module'].' Module: '.$_lang['depedency_create'].PHP_EOL;
1449 1448
         } else {
1450 1449
             mysqli_query($sqlParser->conn,
1451
-                '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']);
1452
-            echo $dependency['module'] . ' Module: ' . $_lang['depedency_update'] . PHP_EOL;
1450
+                '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']);
1451
+            echo $dependency['module'].' Module: '.$_lang['depedency_update'].PHP_EOL;
1453 1452
         }
1454 1453
         if ($dependency['type'] == 30 || $dependency['type'] == 40) {
1455 1454
             // set extra guid for plugins and snippets
1456 1455
             $ds = mysqli_query($sqlParser->conn,
1457
-                'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE id=' . $extraId . ' LIMIT 1');
1456
+                'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE id='.$extraId.' LIMIT 1');
1458 1457
             if (!$ds) {
1459
-                echo mysqli_error($sqlParser->conn) . PHP_EOL;
1458
+                echo mysqli_error($sqlParser->conn).PHP_EOL;
1460 1459
 
1461 1460
                 return;
1462 1461
             } else {
1463 1462
                 if (mysqli_num_rows($ds) != 0) {
1464 1463
                     mysqli_query($sqlParser->conn,
1465
-                        'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` SET moduleguid = ' . $moduleGuid . ' WHERE id=' . $extraId);
1466
-                    echo $dependency['name'] . ': ' . $_lang['guid_set'] . PHP_EOL;
1464
+                        'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` SET moduleguid = '.$moduleGuid.' WHERE id='.$extraId);
1465
+                    echo $dependency['name'].': '.$_lang['guid_set'].PHP_EOL;
1467 1466
                 }
1468 1467
             }
1469 1468
         }
@@ -1472,58 +1471,58 @@  discard block
 block discarded – undo
1472 1471
 
1473 1472
 // call back function
1474 1473
 if ($callBackFnc != "") {
1475
-    $callBackFnc ($sqlParser);
1474
+    $callBackFnc($sqlParser);
1476 1475
 }
1477 1476
 
1478 1477
 // Setup the MODX API -- needed for the cache processor
1479 1478
 if (!defined('MODX_MANAGER_PATH')) {
1480
-    define('MODX_MANAGER_PATH', $base_path . MGR_DIR . '/');
1479
+    define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/');
1481 1480
 }
1482 1481
 $database_type = 'mysqli';
1483 1482
 // initiate a new document parser
1484
-include_once($path . '../' . MGR_DIR . '/includes/document.parser.class.inc.php');
1483
+include_once($path.'../'.MGR_DIR.'/includes/document.parser.class.inc.php');
1485 1484
 $modx = new DocumentParser;
1486 1485
 $modx->db->connect();
1487 1486
 // always empty cache after install
1488 1487
 $sync = new EvolutionCMS\Cache();
1489
-$sync->setCachepath($path . "../assets/cache/");
1488
+$sync->setCachepath($path."../assets/cache/");
1490 1489
 $sync->setReport(false);
1491 1490
 $sync->emptyCache(); // first empty the cache
1492 1491
 
1493 1492
 // try to chmod the cache go-rwx (for suexeced php)
1494
-$chmodSuccess = @chmod($path . '../assets/cache/siteCache.idx.php', 0600);
1495
-$chmodSuccess = @chmod($path . '../assets/cache/sitePublishing.idx.php', 0600);
1493
+$chmodSuccess = @chmod($path.'../assets/cache/siteCache.idx.php', 0600);
1494
+$chmodSuccess = @chmod($path.'../assets/cache/sitePublishing.idx.php', 0600);
1496 1495
 
1497 1496
 // remove any locks on the manager functions so initial manager login is not blocked
1498
-mysqli_query($conn, "TRUNCATE TABLE `" . $table_prefix . "active_users`");
1497
+mysqli_query($conn, "TRUNCATE TABLE `".$table_prefix."active_users`");
1499 1498
 
1500 1499
 // close db connection
1501 1500
 $sqlParser->close();
1502 1501
 
1503 1502
 // andrazk 20070416 - release manager access
1504
-if (file_exists($path . '../assets/cache/installProc.inc.php')) {
1505
-    @chmod($path . '../assets/cache/installProc.inc.php', 0755);
1506
-    unlink($path . '../assets/cache/installProc.inc.php');
1503
+if (file_exists($path.'../assets/cache/installProc.inc.php')) {
1504
+    @chmod($path.'../assets/cache/installProc.inc.php', 0755);
1505
+    unlink($path.'../assets/cache/installProc.inc.php');
1507 1506
 }
1508 1507
 
1509 1508
 // setup completed!
1510
-echo PHP_EOL . $_lang['installation_successful'] . PHP_EOL . PHP_EOL;
1509
+echo PHP_EOL.$_lang['installation_successful'].PHP_EOL.PHP_EOL;
1511 1510
 //echo "<p>" . $_lang['to_log_into_content_manager'] . "</p>";
1512 1511
 if ($installMode == 0) {
1513
-    echo strip_tags($_lang['installation_note']) . PHP_EOL;
1512
+    echo strip_tags($_lang['installation_note']).PHP_EOL;
1514 1513
 } else {
1515
-    echo strip_tags($_lang['upgrade_note']) . PHP_EOL;
1514
+    echo strip_tags($_lang['upgrade_note']).PHP_EOL;
1516 1515
 }
1517 1516
 
1518 1517
 
1519 1518
 if (empty($args)) {
1520
-    echo PHP_EOL . 'Remove install folder?' . PHP_EOL;
1519
+    echo PHP_EOL.'Remove install folder?'.PHP_EOL;
1521 1520
     $removeInstall = readline("Type 'y' or 'n' to continue: ");
1522 1521
 }
1523 1522
 //remove installFolder
1524 1523
 if ($removeInstall === 'y') {
1525 1524
     removeFolder($path);
1526
-    removeFolder($base_path . '.tx');
1527
-    unlink($base_path . 'README.md');
1528
-    echo 'Install folder deleted!' . PHP_EOL . PHP_EOL;
1525
+    removeFolder($base_path.'.tx');
1526
+    unlink($base_path.'README.md');
1527
+    echo 'Install folder deleted!'.PHP_EOL.PHP_EOL;
1529 1528
 }
Please login to merge, or discard this patch.
install/src/controllers/install.php 1 patch
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (file_exists(dirname(dirname(dirname(__DIR__))) . "/assets/cache/siteManager.php")) {
3
-    include_once(dirname(dirname(dirname(__DIR__))) . "/assets/cache/siteManager.php");
2
+if (file_exists(dirname(dirname(dirname(__DIR__)))."/assets/cache/siteManager.php")) {
3
+    include_once(dirname(dirname(dirname(__DIR__)))."/assets/cache/siteManager.php");
4 4
 } else {
5 5
     define('MGR_DIR', 'manager');
6 6
 }
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
 // set timout limit
26 26
 @ set_time_limit(120); // used @ to prevent warning when using safe mode?
27 27
 
28
-$installMode = (int)$_POST['installmode'];
29
-$installData = (int)empty($_POST['installdata']);
28
+$installMode = (int) $_POST['installmode'];
29
+$installData = (int) empty($_POST['installdata']);
30 30
 
31 31
 // get db info from post
32 32
 $database_server = $_POST['databasehost'];
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 $database_charset = substr($database_collation, 0, strpos($database_collation, '_'));
37 37
 $database_connection_charset = $_POST['database_connection_charset'];
38 38
 $database_connection_method = $_POST['database_connection_method'];
39
-$dbase = "`" . $_POST['database_name'] . "`";
39
+$dbase = "`".$_POST['database_name']."`";
40 40
 $table_prefix = $_POST['tableprefix'];
41 41
 $adminname = $_POST['cmsadmin'];
42 42
 $adminemail = $_POST['cmsadminemail'];
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
 // set session name variable
48 48
 if (!isset ($site_sessionname)) {
49
-    $site_sessionname = 'SN' . uniqid('');
49
+    $site_sessionname = 'SN'.uniqid('');
50 50
 }
51 51
 
52 52
 // get base path and url
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 }
63 63
 $pth = implode('install', $a);
64 64
 unset ($a);
65
-$base_url = $url . (substr($url, -1) != '/' ? '/' : '');
66
-$base_path = $pth . (substr($pth, -1) != '/' ? '/' : '');
65
+$base_url = $url.(substr($url, -1) != '/' ? '/' : '');
66
+$base_path = $pth.(substr($pth, -1) != '/' ? '/' : '');
67 67
 
68 68
 // connect to the database
69 69
 $conn = @mysqli_connect($database_server, $database_user, $database_password);
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     if ($installLevel === 1) {
93 93
         // check table prefix
94 94
         if ($installMode === 0) {
95
-            $query = "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`";
95
+            $query = "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`";
96 96
             if (@mysqli_query($conn, $query)) {
97 97
                 $errors += 1;
98 98
             } else {
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         // check status of Inherit Parent Template plugin
108 108
         $auto_template_logic = 'parent';
109 109
         if ($installMode !== 0) {
110
-            $query = "SELECT properties, disabled FROM " . $dbase . ".`" . $table_prefix . "site_plugins` WHERE name='Inherit Parent Template'";
110
+            $query = "SELECT properties, disabled FROM ".$dbase.".`".$table_prefix."site_plugins` WHERE name='Inherit Parent Template'";
111 111
             $rs = mysqli_query($conn, $query);
112 112
             $row = mysqli_fetch_row($rs);
113 113
             if (!$row) {
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
         }
131 131
 
132 132
         // open db connection
133
-        include dirname(__DIR__) . '/processor/result.php';
134
-        include_once dirname(__DIR__) . '/sqlParser.class.php';
133
+        include dirname(__DIR__).'/processor/result.php';
134
+        include_once dirname(__DIR__).'/sqlParser.class.php';
135 135
         $sqlParser = new SqlParser(
136 136
             $database_server,
137 137
             $database_user,
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
         $confph['lastInstallTime'] = time();
178 178
         $confph['site_sessionname'] = $site_sessionname;
179 179
 
180
-        $configString = file_get_contents(dirname(dirname(__DIR__)) . '/stubs/config.tpl');
180
+        $configString = file_get_contents(dirname(dirname(__DIR__)).'/stubs/config.tpl');
181 181
         $configString = parse($configString, $confph);
182 182
 
183
-        $filename = dirname(dirname(dirname(__DIR__))) . '/' . MGR_DIR . '/includes/config.inc.php';
183
+        $filename = dirname(dirname(dirname(__DIR__))).'/'.MGR_DIR.'/includes/config.inc.php';
184 184
         $configFileFailed = false;
185 185
         if (@ !$handle = fopen($filename, 'w')) {
186 186
             $configFileFailed = true;
@@ -208,13 +208,13 @@  discard block
 block discarded – undo
208 208
             $siteid = uniqid('');
209 209
             mysqli_query(
210 210
                     $sqlParser->conn,
211
-                "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')"
211
+                "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')"
212 212
             );
213 213
         } else {
214 214
             // update site_id if missing
215 215
             $ds = mysqli_query(
216 216
                     $sqlParser->conn,
217
-                "SELECT setting_name,setting_value FROM $dbase.`" . $table_prefix . "system_settings` WHERE setting_name='site_id'"
217
+                "SELECT setting_name,setting_value FROM $dbase.`".$table_prefix."system_settings` WHERE setting_name='site_id'"
218 218
             );
219 219
             if ($ds) {
220 220
                 $r = mysqli_fetch_assoc($ds);
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
                     $siteid = uniqid('');
224 224
                     mysqli_query(
225 225
                             $sqlParser->conn,
226
-                        "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')"
226
+                        "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')"
227 227
                     );
228 228
                 }
229 229
             }
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
     if ($installLevel === 5 && (isset ($_POST['template']) || $installData)) {
250 250
         $selTemplates = $_POST['template'];
251 251
         foreach ($moduleTemplates as $k => $moduleTemplate) {
252
-            if (! is_array($moduleTemplate)) {
252
+            if (!is_array($moduleTemplate)) {
253 253
                 continue;
254 254
             }
255 255
             $installDataLevel['templates'][$moduleTemplate[0]] = array(
@@ -287,12 +287,12 @@  discard block
 block discarded – undo
287 287
                     $template = mysqli_real_escape_string($conn, $template);
288 288
 
289 289
                     // See if the template already exists
290
-                    $query = "SELECT * FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name'";
290
+                    $query = "SELECT * FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name'";
291 291
                     $rs = mysqli_query($sqlParser->conn, $query);
292 292
 
293 293
                     if (mysqli_num_rows($rs)) {
294 294
                         $installDataLevel['templates'][$moduleTemplate[0]]['type'] = 'update';
295
-                        $query = "UPDATE $dbase.`" . $table_prefix . "site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;";
295
+                        $query = "UPDATE $dbase.`".$table_prefix."site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;";
296 296
                         if (!mysqli_query($sqlParser->conn, $query)) {
297 297
                             $errors += 1;
298 298
                             $installDataLevel['templates'][$moduleTemplate[0]]['error'] = array(
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
                         if (!is_null($save_sql_id_as)) {
306 306
                             $sql_id = @mysqli_insert_id($sqlParser->conn);
307 307
                             if (!$sql_id) {
308
-                                $query = "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name' LIMIT 1;";
308
+                                $query = "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name' LIMIT 1;";
309 309
                                 $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, $query));
310 310
                                 $sql_id = $idQuery['id'];
311 311
                             }
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
                         }
314 314
                     } else {
315 315
                         $installDataLevel['templates'][$moduleTemplate[0]]['type'] = 'create';
316
-                        $query = "INSERT INTO $dbase.`" . $table_prefix . "site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');";
316
+                        $query = "INSERT INTO $dbase.`".$table_prefix."site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');";
317 317
                         if (!@mysqli_query($sqlParser->conn, $query)) {
318 318
                             $errors += 1;
319 319
                             $installDataLevel['templates'][$moduleTemplate[0]]['error'] = array(
@@ -378,12 +378,12 @@  discard block
 block discarded – undo
378 378
                 // Create the category if it does not already exist
379 379
                 $category = getCreateDbCategory($category, $sqlParser);
380 380
 
381
-                $query = "SELECT * FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name'";
382
-                $rs = mysqli_query($sqlParser->conn,$query);
381
+                $query = "SELECT * FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name'";
382
+                $rs = mysqli_query($sqlParser->conn, $query);
383 383
                 if (mysqli_num_rows($rs)) {
384 384
                     $installDataLevel['tvs'][$moduleTV[0]]['type'] = 'update';
385 385
                     while ($row = mysqli_fetch_assoc($rs)) {
386
-                        $query = "UPDATE $dbase.`" . $table_prefix . "site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};";
386
+                        $query = "UPDATE $dbase.`".$table_prefix."site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};";
387 387
                         if (!mysqli_query($sqlParser->conn, $query)) {
388 388
                             $installDataLevel['tvs'][$moduleTV[0]]['error'] = array(
389 389
                                 'type' => 'sql',
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
                     }
397 397
                 } else {
398 398
                     $installDataLevel['tvs'][$moduleTV[0]]['type'] = 'create';
399
-                    $q = "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',$category,$locked,'$input_options','$output_widget','$output_widget_params','$input_default');";
399
+                    $q = "INSERT INTO $dbase.`".$table_prefix."site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',$category,$locked,'$input_options','$output_widget','$output_widget_params','$input_default');";
400 400
                     if (!mysqli_query($sqlParser->conn, $q)) {
401 401
                         $installDataLevel['tvs'][$moduleTV[0]]['error'] = array(
402 402
                             'type' => 'sql',
@@ -413,23 +413,23 @@  discard block
 block discarded – undo
413 413
                 if (count($assignments) > 0) {
414 414
 
415 415
                     // remove existing tv -> template assignments
416
-                    $query = "SELECT id FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name' AND description='$desc';";
416
+                    $query = "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';";
417 417
                     $ds = mysqli_query($sqlParser->conn, $query);
418 418
                     $row = mysqli_fetch_assoc($ds);
419 419
                     $id = $row["id"];
420
-                    $query = 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_tmplvar_templates` WHERE tmplvarid = \'' . $id . '\'';
420
+                    $query = 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_tmplvar_templates` WHERE tmplvarid = \''.$id.'\'';
421 421
                     mysqli_query($sqlParser->conn, $query);
422 422
 
423 423
                     // add tv -> template assignments
424 424
                     foreach ($assignments as $assignment) {
425 425
                         $template = mysqli_real_escape_string($conn, $assignment);
426
-                        $query = "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$template';";
426
+                        $query = "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$template';";
427 427
                         $ts = mysqli_query($sqlParser->conn, $query);
428 428
                         if ($ds && $ts) {
429 429
                             $tRow = mysqli_fetch_assoc($ts);
430 430
                             $templateId = $tRow['id'];
431
-                            $query = "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)";
432
-                            mysqli_query($sqlParser->conn,$query);
431
+                            $query = "INSERT INTO $dbase.`".$table_prefix."site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)";
432
+                            mysqli_query($sqlParser->conn, $query);
433 433
                         }
434 434
                     }
435 435
                 }
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
     if ($installLevel === 5 && $errorData === false && (isset ($_POST['chunk']) || $installData)) {
442 442
         $selChunks = $_POST['chunk'];
443 443
         foreach ($moduleChunks as $k => $moduleChunk) {
444
-            if (! is_array($moduleChunk)) {
444
+            if (!is_array($moduleChunk)) {
445 445
                 continue;
446 446
             }
447 447
             $installDataLevel['chunks'][$moduleChunk[0]] = array(
@@ -479,14 +479,14 @@  discard block
 block discarded – undo
479 479
                     $chunk = mysqli_real_escape_string($conn, $chunk);
480 480
                     $rs = mysqli_query(
481 481
                         $sqlParser->conn,
482
-                        "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$name'"
482
+                        "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$name'"
483 483
                     );
484 484
                     $count_original_name = mysqli_num_rows($rs);
485 485
                     if ($overwrite == 'false') {
486
-                        $newname = $name . '-' . str_replace('.', '_', $modx_version);
486
+                        $newname = $name.'-'.str_replace('.', '_', $modx_version);
487 487
                         $rs = mysqli_query(
488 488
                             $sqlParser->conn,
489
-                            "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$newname'"
489
+                            "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$newname'"
490 490
                         );
491 491
                         $count_new_name = mysqli_num_rows($rs);
492 492
                     }
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
                     if ($update) {
495 495
                         $installDataLevel['chunks'][$moduleChunk[0]]['type'] = 'update';
496 496
                         if (!mysqli_query($sqlParser->conn,
497
-                            "UPDATE $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
497
+                            "UPDATE $dbase.`".$table_prefix."site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
498 498
                             $errors += 1;
499 499
                             $installDataLevel['chunks'][$moduleChunk[0]]['error'] = array(
500 500
                                 'type' => 'sql',
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
                         } else {
512 512
                             $installDataLevel['chunks'][$moduleChunk[0]]['type'] = 'create';
513 513
                         }
514
-                        $query = "INSERT INTO $dbase.`" . $table_prefix . "site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);";
514
+                        $query = "INSERT INTO $dbase.`".$table_prefix."site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);";
515 515
                         if (!mysqli_query($sqlParser->conn, $query)) {
516 516
                             $errors += 1;
517 517
                             $installDataLevel['chunks'][$moduleChunk[0]]['error'] = array(
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
     if ($installLevel === 5 && $errorData === false && (isset ($_POST['module']) || $installData)) {
535 535
         $selModules = $_POST['module'];
536 536
         foreach ($moduleModules as $k => $moduleModule) {
537
-            if (! is_array($moduleModule)) {
537
+            if (!is_array($moduleModule)) {
538 538
                 continue;
539 539
             }
540 540
             $installDataLevel['modules'][$moduleModule[0]] = array(
@@ -573,13 +573,13 @@  discard block
 block discarded – undo
573 573
                     // $module = removeDocblock($module, 'module'); // Modules have no fileBinding, keep docblock for info-tab
574 574
                     $module = mysqli_real_escape_string($conn, $module);
575 575
                     $rs = mysqli_query($sqlParser->conn,
576
-                        "SELECT * FROM $dbase.`" . $table_prefix . "site_modules` WHERE name='$name'");
576
+                        "SELECT * FROM $dbase.`".$table_prefix."site_modules` WHERE name='$name'");
577 577
                     if (mysqli_num_rows($rs)) {
578 578
                         $installDataLevel['modules'][$moduleModule[0]]['type'] = 'update';
579 579
                         $row = mysqli_fetch_assoc($rs);
580 580
                         $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
581 581
                         if (!mysqli_query($sqlParser->conn,
582
-                            "UPDATE $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
582
+                            "UPDATE $dbase.`".$table_prefix."site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
583 583
                             $installDataLevel['modules'][$moduleModule[0]]['error'] = array(
584 584
                                 'type' => 'sql',
585 585
                                 'content' => mysqli_error($sqlParser->conn)
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
                         $installDataLevel['modules'][$moduleModule[0]]['type'] = 'create';
592 592
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
593 593
                         if (!mysqli_query($sqlParser->conn,
594
-                            "INSERT INTO $dbase.`" . $table_prefix . "site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) {
594
+                            "INSERT INTO $dbase.`".$table_prefix."site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) {
595 595
                             $installDataLevel['modules'][$moduleModule[0]]['error'] = array(
596 596
                                 'type' => 'sql',
597 597
                                 'content' => mysqli_error($sqlParser->conn)
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
     if ($installLevel === 5 && $errorData === false && (isset ($_POST['plugin']) || $installData)) {
612 612
         $selPlugs = $_POST['plugin'];
613 613
         foreach ($modulePlugins as $k => $modulePlugin) {
614
-            if (! is_array($modulePlugin)) {
614
+            if (!is_array($modulePlugin)) {
615 615
                 continue;
616 616
             }
617 617
             $installDataLevel['plugins'][$modulePlugin[0]] = array(
@@ -645,12 +645,12 @@  discard block
 block discarded – undo
645 645
                 $disabled = $modulePlugin[9];
646 646
                 if (array_key_exists(7, $modulePlugin)) {
647 647
                     // parse comma-separated legacy names and prepare them for sql IN clause
648
-                    $leg_names = "'" . implode(
648
+                    $leg_names = "'".implode(
649 649
                             "','",
650 650
                             preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))
651
-                        ) . "'";
651
+                        )."'";
652 652
                 }
653
-                if (! file_exists($filecontent)) {
653
+                if (!file_exists($filecontent)) {
654 654
                     $installDataLevel['plugins'][$modulePlugin[0]]['error'] = array(
655 655
                         'type' => 'file_not_found'
656 656
                     );
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 
659 659
                     // disable legacy versions based on legacy_names provided
660 660
                     if (!empty($leg_names)) {
661
-                        $update_query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
661
+                        $update_query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
662 662
                         $rs = mysqli_query($sqlParser->conn, $update_query);
663 663
                     }
664 664
 
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
                     $plugin = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2));
669 669
                     $plugin = removeDocblock($plugin, 'plugin');
670 670
                     $plugin = mysqli_real_escape_string($conn, $plugin);
671
-                    $query = "SELECT * FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='$name'";
671
+                    $query = "SELECT * FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name'";
672 672
                     $rs = mysqli_query($sqlParser->conn, $query);
673 673
                     if (mysqli_num_rows($rs)) {
674 674
                         $installDataLevel['plugins'][$modulePlugin[0]]['type'] = 'update';
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
                         while ($row = mysqli_fetch_assoc($rs)) {
677 677
                             $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
678 678
                             if ($row['description'] == $desc) {
679
-                                $query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};";
679
+                                $query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};";
680 680
                                 if (!mysqli_query($sqlParser->conn, $query)) {
681 681
                                     $installDataLevel['plugins'][$modulePlugin[0]]['error'] = array(
682 682
                                         'type' => 'sql',
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
                                 }
688 688
                                 $insert = false;
689 689
                             } else {
690
-                                $query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};";
690
+                                $query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE id={$row['id']};";
691 691
                                 if (!mysqli_query($sqlParser->conn, $query)) {
692 692
                                     $installDataLevel['plugins'][$modulePlugin[0]]['error'] = array(
693 693
                                         'type' => 'sql',
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
                         }
701 701
                         if ($insert === true) {
702 702
                             $properties = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
703
-                            $query = "INSERT INTO $dbase.`" . $table_prefix . "site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);";
703
+                            $query = "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);";
704 704
                             if (!mysqli_query($sqlParser->conn, $query)) {
705 705
                                 $installDataLevel['plugins'][$modulePlugin[0]]['error'] = array(
706 706
                                     'type' => 'sql',
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
                     } else {
714 714
                         $installDataLevel['plugins'][$modulePlugin[0]]['type'] = 'create';
715 715
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
716
-                        $query = "INSERT INTO $dbase.`" . $table_prefix . "site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);";
716
+                        $query = "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);";
717 717
                         if (!mysqli_query($sqlParser->conn, $query)) {
718 718
                             $installDataLevel['plugins'][$modulePlugin[0]]['error'] = array(
719 719
                                 'type' => 'sql',
@@ -725,17 +725,17 @@  discard block
 block discarded – undo
725 725
                     }
726 726
                     // add system events
727 727
                     if (count($events) > 0) {
728
-                        $query = "SELECT id FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='$name' AND description='$desc';";
728
+                        $query = "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';";
729 729
                         $ds = mysqli_query($sqlParser->conn, $query);
730 730
                         if ($ds) {
731 731
                             $row = mysqli_fetch_assoc($ds);
732 732
                             $id = $row["id"];
733 733
                             // remove existing events
734
-                            $query = 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_plugin_events` WHERE pluginid = \'' . $id . '\'';
734
+                            $query = 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_plugin_events` WHERE pluginid = \''.$id.'\'';
735 735
                             mysqli_query($sqlParser->conn, $query);
736 736
                             // add new events
737
-                            $query = "INSERT INTO $dbase.`" . $table_prefix . "site_plugin_events` (pluginid, evtid) SELECT '$id' as 'pluginid',se.id as 'evtid' FROM $dbase.`" . $table_prefix . "system_eventnames` se WHERE name IN ('" . implode("','", $events) . "')";
738
-                            mysqli_query($sqlParser->conn,$query);
737
+                            $query = "INSERT INTO $dbase.`".$table_prefix."site_plugin_events` (pluginid, evtid) SELECT '$id' as 'pluginid',se.id as 'evtid' FROM $dbase.`".$table_prefix."system_eventnames` se WHERE name IN ('".implode("','", $events)."')";
738
+                            mysqli_query($sqlParser->conn, $query);
739 739
                         }
740 740
                     }
741 741
                 }
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
     if ($installLevel === 5 && $errorData === false && (isset ($_POST['snippet']) || $installData)) {
750 750
         $selSnips = $_POST['snippet'];
751 751
         foreach ($moduleSnippets as $k => $moduleSnippet) {
752
-            if (! is_array($moduleSnippet)) {
752
+            if (!is_array($moduleSnippet)) {
753 753
                 continue;
754 754
             }
755 755
             $installDataLevel['snippets'][$moduleSnippet[0]] = array(
@@ -784,13 +784,13 @@  discard block
 block discarded – undo
784 784
                     $snippet = removeDocblock($snippet, 'snippet');
785 785
                     $snippet = mysqli_real_escape_string($conn, $snippet);
786 786
                     $rs = mysqli_query($sqlParser->conn,
787
-                        "SELECT * FROM $dbase.`" . $table_prefix . "site_snippets` WHERE name='$name'");
787
+                        "SELECT * FROM $dbase.`".$table_prefix."site_snippets` WHERE name='$name'");
788 788
                     if (mysqli_num_rows($rs)) {
789 789
                         $installDataLevel['snippets'][$moduleSnippet[0]]['type'] = 'update';
790 790
                         $row = mysqli_fetch_assoc($rs);
791 791
                         $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
792 792
                         if (!mysqli_query($sqlParser->conn,
793
-                            "UPDATE $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
793
+                            "UPDATE $dbase.`".$table_prefix."site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
794 794
                             $installDataLevel['snippets'][$moduleSnippet[0]]['error'] = array(
795 795
                                 'type' => 'sql',
796 796
                                 'content' => mysqli_error($sqlParser->conn)
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
                         $installDataLevel['snippets'][$moduleSnippet[0]]['type'] = 'create';
803 803
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
804 804
                         if (!mysqli_query($sqlParser->conn,
805
-                            "INSERT INTO $dbase.`" . $table_prefix . "site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) {
805
+                            "INSERT INTO $dbase.`".$table_prefix."site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) {
806 806
                             $installDataLevel['snippets'][$moduleSnippet[0]]['error'] = array(
807 807
                                 'type' => 'sql',
808 808
                                 'content' => mysqli_error($sqlParser->conn)
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
                     'content' => '' //dependency name or error message
870 870
                 )*/
871 871
             );
872
-            $query = 'SELECT id, guid FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_modules` WHERE name="' . $dependency['module'] . '"';
872
+            $query = 'SELECT id, guid FROM '.$dbase.'`'.$sqlParser->prefix.'site_modules` WHERE name="'.$dependency['module'].'"';
873 873
             $ds = mysqli_query($sqlParser->conn, $query);
874 874
             if (!$ds) {
875 875
                 $installDependencyLevel[$dependency['module']]['error'] = array(
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
                 $moduleGuid = $row["guid"];
885 885
             }
886 886
             // get extra id
887
-            $query = 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE ' . $dependency['column'] . '="' . $dependency['name'] . '"';
887
+            $query = 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE '.$dependency['column'].'="'.$dependency['name'].'"';
888 888
             $ds = mysqli_query($sqlParser->conn, $query);
889 889
             if (!$ds) {
890 890
                 $installDependencyLevel[$dependency['module']]['error'] = array(
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
                 $extraId = $row["id"];
899 899
             }
900 900
             // setup extra as module dependency
901
-            $query = 'SELECT module FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type'] . ' LIMIT 1';
901
+            $query = 'SELECT module FROM '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type'].' LIMIT 1';
902 902
             $ds = mysqli_query($sqlParser->conn, $query);
903 903
             if (!$ds) {
904 904
                 $installDependencyLevel[$dependency['module']]['error'] = array(
@@ -909,17 +909,17 @@  discard block
 block discarded – undo
909 909
                 break;
910 910
             } else {
911 911
                 if (mysqli_num_rows($ds) === 0) {
912
-                    $query = 'INSERT INTO ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` (module, resource, type) VALUES(' . $moduleId . ',' . $extraId . ',' . $dependency['type'] . ')';
912
+                    $query = 'INSERT INTO '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` (module, resource, type) VALUES('.$moduleId.','.$extraId.','.$dependency['type'].')';
913 913
                     mysqli_query($sqlParser->conn, $query);
914 914
                     $installDependencyLevel[$dependency['module']]['type'] = 'create';
915 915
                 } else {
916
-                    $query = 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` SET module = ' . $moduleId . ', resource = ' . $extraId . ', type = ' . $dependency['type'] . ' WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type'];
916
+                    $query = 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` SET module = '.$moduleId.', resource = '.$extraId.', type = '.$dependency['type'].' WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type'];
917 917
                     mysqli_query($sqlParser->conn, $query);
918 918
                     $installDependencyLevel[$dependency['module']]['type'] = 'update';
919 919
                 }
920 920
                 if ($dependency['type'] == 30 || $dependency['type'] == 40) {
921 921
                     // set extra guid for plugins and snippets
922
-                    $query = 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE id=' . $extraId . ' LIMIT 1';
922
+                    $query = 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE id='.$extraId.' LIMIT 1';
923 923
                     $ds = mysqli_query($sqlParser->conn, $query);
924 924
                     if (!$ds) {
925 925
                         $installDependencyLevel[$dependency['module']]['extra'] = array(
@@ -930,8 +930,8 @@  discard block
 block discarded – undo
930 930
                         break;
931 931
                     } else {
932 932
                         if (mysqli_num_rows($ds) != 0) {
933
-                            $query = 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` SET moduleguid = ' . $moduleGuid . ' WHERE id=' . $extraId;
934
-                            $ds= mysqli_query($sqlParser->conn, $query);
933
+                            $query = 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` SET moduleguid = '.$moduleGuid.' WHERE id='.$extraId;
934
+                            $ds = mysqli_query($sqlParser->conn, $query);
935 935
                             $installDependencyLevel[$dependency['module']]['extra'] = array(
936 936
                                 'type' => 'done',
937 937
                                 'content' => $dependency['name']
@@ -953,48 +953,48 @@  discard block
 block discarded – undo
953 953
         }
954 954
 
955 955
         // Setup the MODX API -- needed for the cache processor
956
-        if (file_exists(dirname(dirname(dirname(__DIR__))) . '/' . MGR_DIR . '/includes/config_mutator.php')) {
957
-            require_once dirname(dirname(dirname(__DIR__))) . '/' . MGR_DIR . '/includes/config_mutator.php';
956
+        if (file_exists(dirname(dirname(dirname(__DIR__))).'/'.MGR_DIR.'/includes/config_mutator.php')) {
957
+            require_once dirname(dirname(dirname(__DIR__))).'/'.MGR_DIR.'/includes/config_mutator.php';
958 958
         }
959 959
         define('MODX_API_MODE', true);
960 960
         if (!defined('MODX_BASE_PATH')) {
961 961
             define('MODX_BASE_PATH', $base_path);
962 962
         }
963 963
         if (!defined('MODX_MANAGER_PATH')) {
964
-            define('MODX_MANAGER_PATH', $base_path . MGR_DIR . '/');
964
+            define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/');
965 965
         }
966 966
         $database_type = 'mysqli';
967 967
         // initiate a new document parser
968 968
         if (!defined('EVO_BOOTSTRAP_FILE')) {
969 969
             define('EVO_BOOTSTRAP_FILE',
970
-                dirname(dirname(dirname(__DIR__))) . '/' . MGR_DIR . '/includes/bootstrap.php');
971
-            require_once dirname(dirname(dirname(__DIR__))) . '/' . MGR_DIR . '/includes/bootstrap.php';
970
+                dirname(dirname(dirname(__DIR__))).'/'.MGR_DIR.'/includes/bootstrap.php');
971
+            require_once dirname(dirname(dirname(__DIR__))).'/'.MGR_DIR.'/includes/bootstrap.php';
972 972
         }
973 973
 
974
-        include_once(dirname(dirname(dirname(__DIR__))) . '/' . MGR_DIR . '/includes/document.parser.class.inc.php');
974
+        include_once(dirname(dirname(dirname(__DIR__))).'/'.MGR_DIR.'/includes/document.parser.class.inc.php');
975 975
         $modx = new DocumentParser;
976 976
         $modx->db->connect();
977 977
         // always empty cache after install
978 978
         $sync = new EvolutionCMS\Cache();
979
-        $sync->setCachepath(dirname(dirname(dirname(__DIR__))) . '/assets/cache/');
979
+        $sync->setCachepath(dirname(dirname(dirname(__DIR__))).'/assets/cache/');
980 980
         $sync->setReport(false);
981 981
         $sync->emptyCache(); // first empty the cache
982 982
 
983 983
         // try to chmod the cache go-rwx (for suexeced php)
984
-        @chmod(dirname(dirname(dirname(__DIR__))) . '/assets/cache/siteCache.idx.php', 0600);
985
-        @chmod(dirname(dirname(dirname(__DIR__))) . '/assets/cache/sitePublishing.idx.php', 0600);
984
+        @chmod(dirname(dirname(dirname(__DIR__))).'/assets/cache/siteCache.idx.php', 0600);
985
+        @chmod(dirname(dirname(dirname(__DIR__))).'/assets/cache/sitePublishing.idx.php', 0600);
986 986
 
987 987
         // remove any locks on the manager functions so initial manager login is not blocked
988
-        mysqli_query($conn, "TRUNCATE TABLE `" . $table_prefix . "active_users`");
988
+        mysqli_query($conn, "TRUNCATE TABLE `".$table_prefix."active_users`");
989 989
 
990 990
         // close db connection
991 991
         $sqlParser->close();
992 992
 
993 993
         // andrazk 20070416 - release manager access
994
-        if (file_exists(dirname(dirname(dirname(__DIR__))) . '/assets/cache/installProc.inc.php')) {
995
-            @chmod(dirname(dirname(dirname(__DIR__))) . '/assets/cache/installProc.inc.php', 0755);
996
-            unlink(dirname(dirname(dirname(__DIR__))) . '/assets/cache/installProc.inc.php');
994
+        if (file_exists(dirname(dirname(dirname(__DIR__))).'/assets/cache/installProc.inc.php')) {
995
+            @chmod(dirname(dirname(dirname(__DIR__))).'/assets/cache/installProc.inc.php', 0755);
996
+            unlink(dirname(dirname(dirname(__DIR__))).'/assets/cache/installProc.inc.php');
997 997
         }
998 998
     }
999 999
 }
1000
-include_once dirname(__DIR__) . '/template/actions/install.php';
1000
+include_once dirname(__DIR__).'/template/actions/install.php';
Please login to merge, or discard this patch.