Completed
Pull Request — develop (#716)
by Agel_Nash
09:00
created
manager/index.php 2 patches
Spacing   +270 added lines, -270 removed lines patch added patch discarded remove patch
@@ -54,32 +54,32 @@  discard block
 block discarded – undo
54 54
 }
55 55
 
56 56
 // get start time
57
-$mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $tstart = $mtime;
57
+$mtime = microtime(); $mtime = explode(" ", $mtime); $mtime = $mtime[1] + $mtime[0]; $tstart = $mtime;
58 58
 $mstart = memory_get_usage();
59
-$self      = str_replace('\\','/',__FILE__);
60
-$self_dir  = str_replace('/index.php','',$self);
61
-$mgr_dir   = substr($self_dir,strrpos($self_dir,'/')+1);
62
-$base_path = str_replace($mgr_dir . '/index.php','',$self);
63
-$site_mgr_path = $base_path . 'assets/cache/siteManager.php';
64
-if(is_file($site_mgr_path)) include_once($site_mgr_path);
65
-$site_hostnames_path = $base_path . 'assets/cache/siteHostnames.php';
66
-if(is_file($site_hostnames_path)) include_once($site_hostnames_path);
67
-if(!defined('MGR_DIR') || MGR_DIR!==$mgr_dir) {
59
+$self      = str_replace('\\', '/', __FILE__);
60
+$self_dir  = str_replace('/index.php', '', $self);
61
+$mgr_dir   = substr($self_dir, strrpos($self_dir, '/') + 1);
62
+$base_path = str_replace($mgr_dir.'/index.php', '', $self);
63
+$site_mgr_path = $base_path.'assets/cache/siteManager.php';
64
+if (is_file($site_mgr_path)) include_once($site_mgr_path);
65
+$site_hostnames_path = $base_path.'assets/cache/siteHostnames.php';
66
+if (is_file($site_hostnames_path)) include_once($site_hostnames_path);
67
+if (!defined('MGR_DIR') || MGR_DIR !== $mgr_dir) {
68 68
 	$src = "<?php\n";
69 69
 	$src .= "define('MGR_DIR', '{$mgr_dir}');\n";
70
-	$rs = file_put_contents($site_mgr_path,$src);
71
-	if(!$rs) {
70
+	$rs = file_put_contents($site_mgr_path, $src);
71
+	if (!$rs) {
72 72
 		echo 'siteManager.php write error';
73 73
 		exit;
74 74
 	}
75 75
 	sleep(1);
76
-	header('Location:' . $_SERVER['REQUEST_URI']);
76
+	header('Location:'.$_SERVER['REQUEST_URI']);
77 77
 	exit;
78 78
 }
79 79
 
80 80
 // we use this to make sure files are accessed through
81 81
 // the manager instead of seperately.
82
-if ( ! defined('IN_MANAGER_MODE')) {
82
+if (!defined('IN_MANAGER_MODE')) {
83 83
 	define('IN_MANAGER_MODE', true);
84 84
 }
85 85
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 
89 89
 // send anti caching headers
90 90
 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
91
-header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
91
+header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
92 92
 header("Cache-Control: no-store, no-cache, must-revalidate");
93 93
 header("Cache-Control: post-check=0, pre-check=0", false);
94 94
 header("Pragma: no-cache");
@@ -100,29 +100,29 @@  discard block
 block discarded – undo
100 100
 include_once "includes/lang/english.inc.php";
101 101
 
102 102
 // check PHP version. EVO is compatible with php 5 (5.0.0+)
103
-$php_ver_comp =  version_compare(phpversion(), "5.0.0");
103
+$php_ver_comp = version_compare(phpversion(), "5.0.0");
104 104
 		// -1 if left is less, 0 if equal, +1 if left is higher
105
-if($php_ver_comp < 0) {
105
+if ($php_ver_comp < 0) {
106 106
 	echo sprintf($_lang['php_version_check'], phpversion());
107 107
 	exit;
108 108
 }
109 109
 
110 110
 // check if iconv is installed
111
-if(!function_exists('iconv')) {
111
+if (!function_exists('iconv')) {
112 112
 	echo $_lang['iconv_not_available'];
113 113
 	exit;
114 114
 }
115 115
 
116 116
 // set some runtime options
117
-$incPath = str_replace("\\","/",dirname(__FILE__)."/includes/"); // Mod by Raymond
118
-set_include_path(get_include_path() . PATH_SEPARATOR . $incPath);
117
+$incPath = str_replace("\\", "/", dirname(__FILE__)."/includes/"); // Mod by Raymond
118
+set_include_path(get_include_path().PATH_SEPARATOR.$incPath);
119 119
 
120 120
 if (!defined('ENT_COMPAT')) define('ENT_COMPAT', 2);
121 121
 if (!defined('ENT_NOQUOTES')) define('ENT_NOQUOTES', 0);
122 122
 if (!defined('ENT_QUOTES')) define('ENT_QUOTES', 3);
123 123
 
124 124
 // set the document_root :|
125
-if(!isset($_SERVER['DOCUMENT_ROOT']) || empty($_SERVER['DOCUMENT_ROOT'])) {
125
+if (!isset($_SERVER['DOCUMENT_ROOT']) || empty($_SERVER['DOCUMENT_ROOT'])) {
126 126
 	$_SERVER['DOCUMENT_ROOT'] = str_replace($_SERVER['PATH_INFO'], "", preg_replace("/\\\\/", "/", $_SERVER['PATH_TRANSLATED']))."/";
127 127
 }
128 128
 
@@ -161,30 +161,30 @@  discard block
 block discarded – undo
161 161
 // Now that session is given get user settings and merge into $modx->config
162 162
 $usersettings = $modx->getUserSettings();
163 163
 
164
-$settings =& $modx->config;
164
+$settings = & $modx->config;
165 165
 extract($modx->config, EXTR_OVERWRITE);
166 166
 
167 167
 // now include_once different language file as english
168
-if(!isset($manager_language) || !file_exists(MODX_MANAGER_PATH."includes/lang/".$manager_language.".inc.php")) {
168
+if (!isset($manager_language) || !file_exists(MODX_MANAGER_PATH."includes/lang/".$manager_language.".inc.php")) {
169 169
 	$manager_language = "english"; // if not set, get the english language file.
170 170
 }
171 171
 
172 172
 // $length_eng_lang = count($_lang); // Not used for now, required for difference-check with other languages than english (i.e. inside installer)
173 173
 
174
-if($manager_language!="english" && file_exists(MODX_MANAGER_PATH."includes/lang/".$manager_language.".inc.php")) {
174
+if ($manager_language != "english" && file_exists(MODX_MANAGER_PATH."includes/lang/".$manager_language.".inc.php")) {
175 175
 	include_once "lang/".$manager_language.".inc.php";
176 176
 }
177 177
 
178 178
 // allow custom language overrides not altered by future EVO-updates
179
-if(file_exists(MODX_MANAGER_PATH."includes/lang/override/".$manager_language.".inc.php")) {
179
+if (file_exists(MODX_MANAGER_PATH."includes/lang/override/".$manager_language.".inc.php")) {
180 180
 	include_once "lang/override/".$manager_language.".inc.php";
181 181
 }
182 182
 
183 183
 $s = array('[+MGR_DIR+]');
184 184
 $r = array(MGR_DIR);
185
-foreach($_lang as $k=>$v)
185
+foreach ($_lang as $k=>$v)
186 186
 {
187
-	if(strpos($v,'[+')!==false) $_lang[$k] = str_replace($s, $r, $v);
187
+	if (strpos($v, '[+') !== false) $_lang[$k] = str_replace($s, $r, $v);
188 188
 }
189 189
 
190 190
 // send the charset header
@@ -198,19 +198,19 @@  discard block
 block discarded – undo
198 198
 include_once "accesscontrol.inc.php";
199 199
 
200 200
 // double check the session
201
-if(!isset($_SESSION['mgrValidated'])){
201
+if (!isset($_SESSION['mgrValidated'])) {
202 202
 	echo "Not Logged In!";
203 203
 	exit;
204 204
 }
205 205
 
206 206
 // include_once the style variables file
207
-if(isset($manager_theme) && !isset($_style)) {
207
+if (isset($manager_theme) && !isset($_style)) {
208 208
 	$_style = array();
209 209
 	include_once "media/style/".$manager_theme."/style.php";
210 210
 }
211 211
 
212 212
 // check if user is allowed to access manager interface
213
-if(isset($allow_manager_access) && $allow_manager_access==0) {
213
+if (isset($allow_manager_access) && $allow_manager_access == 0) {
214 214
 	include_once "manager.lockout.inc.php";
215 215
 }
216 216
 
@@ -219,21 +219,21 @@  discard block
 block discarded – undo
219 219
 $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque'];
220 220
 
221 221
 // first we check to see if this is a frameset request
222
-if(!isset($_POST['a']) && !isset($_GET['a']) && !isset($_POST['updateMsgCount'])) {
222
+if (!isset($_POST['a']) && !isset($_GET['a']) && !isset($_POST['updateMsgCount'])) {
223 223
 	// this looks to be a top-level frameset request, so let's serve up a frameset
224
-	if(is_file(MODX_MANAGER_PATH."media/style/".$manager_theme."/frames/1.php")) {
224
+	if (is_file(MODX_MANAGER_PATH."media/style/".$manager_theme."/frames/1.php")) {
225 225
 		include_once "media/style/".$manager_theme."/frames/1.php";
226
-	}else{
226
+	} else {
227 227
 		include_once "frames/1.php";
228 228
 	}
229 229
 	exit;
230 230
 }
231 231
 
232 232
 // OK, let's retrieve the action directive from the request
233
-$option = array('min_range'=>1,'max_range'=>2000);
234
-if(isset($_GET['a']) && isset($_POST['a'])) $modx->webAlertAndQuit($_lang['error_double_action']);
235
-elseif(isset($_GET['a']))  $action = filter_input(INPUT_GET, 'a',FILTER_VALIDATE_INT,$option);
236
-elseif(isset($_POST['a'])) $action = filter_input(INPUT_POST,'a',FILTER_VALIDATE_INT,$option);
233
+$option = array('min_range'=>1, 'max_range'=>2000);
234
+if (isset($_GET['a']) && isset($_POST['a'])) $modx->webAlertAndQuit($_lang['error_double_action']);
235
+elseif (isset($_GET['a']))  $action = filter_input(INPUT_GET, 'a', FILTER_VALIDATE_INT, $option);
236
+elseif (isset($_POST['a'])) $action = filter_input(INPUT_POST, 'a', FILTER_VALIDATE_INT, $option);
237 237
 else                       $action = null;
238 238
 
239 239
 if (isset($_POST['updateMsgCount']) && $modx->hasPermission('messages')) {
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 $modx->manager->action = $action;
245 245
 
246 246
 // attempt to foil some simple types of CSRF attacks
247
-if (isset($modx->config['validate_referer']) && (int)$modx->config['validate_referer']) {
247
+if (isset($modx->config['validate_referer']) && (int) $modx->config['validate_referer']) {
248 248
 	if (isset($_SERVER['HTTP_REFERER'])) {
249 249
 		$referer = $_SERVER['HTTP_REFERER'];
250 250
 
@@ -264,11 +264,11 @@  discard block
 block discarded – undo
264 264
 $modx->invokeEvent("OnManagerPageInit", array("action" => $action));
265 265
 
266 266
 // return element filepath
267
-function includeFileProcessor ($filepath,$manager_theme) {
267
+function includeFileProcessor($filepath, $manager_theme){
268 268
 	$element = "";
269
-	if(is_file(MODX_MANAGER_PATH."media/style/".$manager_theme."/".$filepath)) {
269
+	if (is_file(MODX_MANAGER_PATH."media/style/".$manager_theme."/".$filepath)) {
270 270
 		$element = MODX_MANAGER_PATH."media/style/".$manager_theme."/".$filepath;
271
-	}else{
271
+	} else {
272 272
 		$element = $filepath;
273 273
 	}
274 274
 	return $element;
@@ -281,341 +281,341 @@  discard block
 block discarded – undo
281 281
 /********************************************************************/
282 282
 	case 1 :
283 283
 		// get the requested frame
284
-		$frame = preg_replace('/[^a-z0-9]/i','',$_REQUEST['f']);
285
-		if($frame>9) {
286
-			$enable_debug=false;    // this is to stop the debug thingy being attached to the framesets
284
+		$frame = preg_replace('/[^a-z0-9]/i', '', $_REQUEST['f']);
285
+		if ($frame > 9) {
286
+			$enable_debug = false; // this is to stop the debug thingy being attached to the framesets
287 287
 		}
288
-		include_once(includeFileProcessor("frames/".$frame.".php",$manager_theme));
288
+		include_once(includeFileProcessor("frames/".$frame.".php", $manager_theme));
289 289
 	break;
290 290
 /********************************************************************/
291 291
 /* show the homepage                                                */
292 292
 /********************************************************************/
293 293
 	case 2:
294 294
 		// get the home page
295
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
296
-		include_once(includeFileProcessor("actions/welcome.static.php",$manager_theme));
297
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
295
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
296
+		include_once(includeFileProcessor("actions/welcome.static.php", $manager_theme));
297
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
298 298
 	break;
299 299
 /********************************************************************/
300 300
 /* document data                                                    */
301 301
 /********************************************************************/
302 302
 	case 3:
303 303
 		// get the page to show document's data
304
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
305
-		include_once(includeFileProcessor("actions/document_data.static.php",$manager_theme));
306
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
304
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
305
+		include_once(includeFileProcessor("actions/document_data.static.php", $manager_theme));
306
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
307 307
 	break;
308 308
 /********************************************************************/
309 309
 /* content management                                               */
310 310
 /********************************************************************/
311 311
 	case 85:
312 312
 		// get the mutate page for adding a folder
313
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
314
-		include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme));
315
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
313
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
314
+		include_once(includeFileProcessor("actions/mutate_content.dynamic.php", $manager_theme));
315
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
316 316
 	break;
317 317
 	case 27:
318 318
 		// get the mutate page for changing content
319
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
320
-		include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme));
321
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
319
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
320
+		include_once(includeFileProcessor("actions/mutate_content.dynamic.php", $manager_theme));
321
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
322 322
 	break;
323 323
 	case 4:
324 324
 		// get the mutate page for adding content
325
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
326
-		include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme));
327
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
325
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
326
+		include_once(includeFileProcessor("actions/mutate_content.dynamic.php", $manager_theme));
327
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
328 328
 	break;
329 329
 	case 5:
330 330
 		// get the save processor
331
-		include_once(includeFileProcessor("processors/save_content.processor.php",$manager_theme));
331
+		include_once(includeFileProcessor("processors/save_content.processor.php", $manager_theme));
332 332
 	break;
333 333
 	case 6:
334 334
 		// get the delete processor
335
-		include_once(includeFileProcessor("processors/delete_content.processor.php",$manager_theme));
335
+		include_once(includeFileProcessor("processors/delete_content.processor.php", $manager_theme));
336 336
 	break;
337 337
 	case 63:
338 338
 		// get the undelete processor
339
-		include_once(includeFileProcessor("processors/undelete_content.processor.php",$manager_theme));
339
+		include_once(includeFileProcessor("processors/undelete_content.processor.php", $manager_theme));
340 340
 	break;
341 341
 	case 51:
342 342
 		// get the move action
343
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
344
-		include_once(includeFileProcessor("actions/move_document.dynamic.php",$manager_theme));
345
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
343
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
344
+		include_once(includeFileProcessor("actions/move_document.dynamic.php", $manager_theme));
345
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
346 346
 	break;
347 347
 	case 52:
348 348
 		// get the move document processor
349
-		include_once(includeFileProcessor("processors/move_document.processor.php",$manager_theme));
349
+		include_once(includeFileProcessor("processors/move_document.processor.php", $manager_theme));
350 350
 	break;
351 351
 	case 61:
352 352
 		// get the processor for publishing content
353
-		include_once(includeFileProcessor("processors/publish_content.processor.php",$manager_theme));
353
+		include_once(includeFileProcessor("processors/publish_content.processor.php", $manager_theme));
354 354
 	break;
355 355
 	case 62:
356 356
 		// get the processor for publishing content
357
-		include_once(includeFileProcessor("processors/unpublish_content.processor.php",$manager_theme));
357
+		include_once(includeFileProcessor("processors/unpublish_content.processor.php", $manager_theme));
358 358
 	break;
359 359
 	case 56:
360 360
 		// get the sort menuindex action
361
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
362
-		include_once(includeFileProcessor("actions/mutate_menuindex_sort.dynamic.php",$manager_theme));
363
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
361
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
362
+		include_once(includeFileProcessor("actions/mutate_menuindex_sort.dynamic.php", $manager_theme));
363
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
364 364
 		break;
365 365
 /********************************************************************/
366 366
 /* show the wait page - gives the tree time to refresh (hopefully)  */
367 367
 /********************************************************************/
368 368
 	case 7:
369 369
 		// get the wait page (so the tree can reload)
370
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
371
-		include_once(includeFileProcessor("actions/wait.static.php",$manager_theme));
372
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
370
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
371
+		include_once(includeFileProcessor("actions/wait.static.php", $manager_theme));
372
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
373 373
 	break;
374 374
 /********************************************************************/
375 375
 /* let the user log out                                             */
376 376
 /********************************************************************/
377 377
 	case 8:
378 378
 		// get the logout processor
379
-		include_once(includeFileProcessor("processors/logout.processor.php",$manager_theme));
379
+		include_once(includeFileProcessor("processors/logout.processor.php", $manager_theme));
380 380
 	break;
381 381
 /********************************************************************/
382 382
 /* user management                                                  */
383 383
 /********************************************************************/
384 384
 	case 87:
385 385
 		// get the new web user page
386
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
387
-		include_once(includeFileProcessor("actions/mutate_web_user.dynamic.php",$manager_theme));
388
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
386
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
387
+		include_once(includeFileProcessor("actions/mutate_web_user.dynamic.php", $manager_theme));
388
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
389 389
 	break;
390 390
 	case 88:
391 391
 		// get the edit web user page
392
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
393
-		include_once(includeFileProcessor("actions/mutate_web_user.dynamic.php",$manager_theme));
394
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
392
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
393
+		include_once(includeFileProcessor("actions/mutate_web_user.dynamic.php", $manager_theme));
394
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
395 395
 	break;
396 396
 	case 89:
397 397
 		// get the save web user processor
398
-		include_once(includeFileProcessor("processors/save_web_user.processor.php",$manager_theme));
398
+		include_once(includeFileProcessor("processors/save_web_user.processor.php", $manager_theme));
399 399
 	break;
400 400
 	case 90:
401 401
 		// get the delete web user page
402
-		include_once(includeFileProcessor("processors/delete_web_user.processor.php",$manager_theme));
402
+		include_once(includeFileProcessor("processors/delete_web_user.processor.php", $manager_theme));
403 403
 	break;
404 404
 	case 11:
405 405
 		// get the new user page
406
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
407
-		include_once(includeFileProcessor("actions/mutate_user.dynamic.php",$manager_theme));
408
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
406
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
407
+		include_once(includeFileProcessor("actions/mutate_user.dynamic.php", $manager_theme));
408
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
409 409
 	break;
410 410
 	case 12:
411 411
 		// get the edit user page
412
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
413
-		include_once(includeFileProcessor("actions/mutate_user.dynamic.php",$manager_theme));
414
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
412
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
413
+		include_once(includeFileProcessor("actions/mutate_user.dynamic.php", $manager_theme));
414
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
415 415
 	break;
416 416
 	case 32:
417 417
 		// get the save user processor
418
-		include_once(includeFileProcessor("processors/save_user.processor.php",$manager_theme));
418
+		include_once(includeFileProcessor("processors/save_user.processor.php", $manager_theme));
419 419
 	break;
420 420
 	case 28:
421 421
 		// get the change password page
422
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
423
-		include_once(includeFileProcessor("actions/mutate_password.dynamic.php",$manager_theme));
424
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
422
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
423
+		include_once(includeFileProcessor("actions/mutate_password.dynamic.php", $manager_theme));
424
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
425 425
 	break;
426 426
 	case 34:
427 427
 		// get the save new password page
428
-		include_once(includeFileProcessor("processors/save_password.processor.php",$manager_theme));
428
+		include_once(includeFileProcessor("processors/save_password.processor.php", $manager_theme));
429 429
 	break;
430 430
 	case 33:
431 431
 		// get the delete user page
432
-		include_once(includeFileProcessor("processors/delete_user.processor.php",$manager_theme));
432
+		include_once(includeFileProcessor("processors/delete_user.processor.php", $manager_theme));
433 433
 	break;
434 434
 /********************************************************************/
435 435
 /* role management                                                  */
436 436
 /********************************************************************/
437 437
 	case 38:
438 438
 		// get the new role page
439
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
440
-		include_once(includeFileProcessor("actions/mutate_role.dynamic.php",$manager_theme));
441
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
439
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
440
+		include_once(includeFileProcessor("actions/mutate_role.dynamic.php", $manager_theme));
441
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
442 442
 	break;
443 443
 	case 35:
444 444
 		// get the edit role page
445
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
446
-		include_once(includeFileProcessor("actions/mutate_role.dynamic.php",$manager_theme));
447
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
445
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
446
+		include_once(includeFileProcessor("actions/mutate_role.dynamic.php", $manager_theme));
447
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
448 448
 	break;
449 449
 	case 36:
450 450
 		// get the save role page
451
-		include_once(includeFileProcessor("processors/save_role.processor.php",$manager_theme));
451
+		include_once(includeFileProcessor("processors/save_role.processor.php", $manager_theme));
452 452
 	break;
453 453
 	case 37:
454 454
 		// get the delete role page
455
-		include_once(includeFileProcessor("processors/delete_role.processor.php",$manager_theme));
455
+		include_once(includeFileProcessor("processors/delete_role.processor.php", $manager_theme));
456 456
 	break;
457 457
 /********************************************************************/
458 458
 /* category management                                               */
459 459
 /********************************************************************/
460 460
 	case 120:
461 461
 		// get the edit category page
462
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
463
-		include_once(includeFileProcessor("actions/mutate_categories.dynamic.php",$manager_theme));
464
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
462
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
463
+		include_once(includeFileProcessor("actions/mutate_categories.dynamic.php", $manager_theme));
464
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
465 465
 	break;
466 466
 	case 121:
467 467
 		// for ajax-requests
468
-		include_once(includeFileProcessor("actions/mutate_categories.dynamic.php",$manager_theme));
468
+		include_once(includeFileProcessor("actions/mutate_categories.dynamic.php", $manager_theme));
469 469
 	break;
470 470
 /********************************************************************/
471 471
 /* template management                                              */
472 472
 /********************************************************************/
473 473
 	case 16:
474 474
 		// get the edit template action
475
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
476
-		include_once(includeFileProcessor("actions/mutate_templates.dynamic.php",$manager_theme));
477
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
475
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
476
+		include_once(includeFileProcessor("actions/mutate_templates.dynamic.php", $manager_theme));
477
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
478 478
 	break;
479 479
 	case 19:
480 480
 		// get the new template action
481
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
482
-		include_once(includeFileProcessor("actions/mutate_templates.dynamic.php",$manager_theme));
483
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
481
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
482
+		include_once(includeFileProcessor("actions/mutate_templates.dynamic.php", $manager_theme));
483
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
484 484
 	break;
485 485
 	case 20:
486 486
 		// get the save processor
487
-		include_once(includeFileProcessor("processors/save_template.processor.php",$manager_theme));
487
+		include_once(includeFileProcessor("processors/save_template.processor.php", $manager_theme));
488 488
 	break;
489 489
 	case 21:
490 490
 		// get the delete processor
491
-		include_once(includeFileProcessor("processors/delete_template.processor.php",$manager_theme));
491
+		include_once(includeFileProcessor("processors/delete_template.processor.php", $manager_theme));
492 492
 	break;
493 493
 	case 96:
494 494
 		// get the duplicate template processor
495
-		include_once(includeFileProcessor("processors/duplicate_template.processor.php",$manager_theme));
495
+		include_once(includeFileProcessor("processors/duplicate_template.processor.php", $manager_theme));
496 496
 	break;
497 497
 	case 117:
498 498
 		// change the tv rank for selected template
499
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
500
-		include_once(includeFileProcessor("actions/mutate_template_tv_rank.dynamic.php",$manager_theme));
501
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
499
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
500
+		include_once(includeFileProcessor("actions/mutate_template_tv_rank.dynamic.php", $manager_theme));
501
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
502 502
 		break;
503 503
 /********************************************************************/
504 504
 /* snippet management                                               */
505 505
 /********************************************************************/
506 506
 	case 22:
507 507
 		// get the edit snippet action
508
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
509
-		include_once(includeFileProcessor("actions/mutate_snippet.dynamic.php",$manager_theme));
510
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
508
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
509
+		include_once(includeFileProcessor("actions/mutate_snippet.dynamic.php", $manager_theme));
510
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
511 511
 	break;
512 512
 	case 23:
513 513
 		// get the new snippet action
514
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
515
-		include_once(includeFileProcessor("actions/mutate_snippet.dynamic.php",$manager_theme));
516
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
514
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
515
+		include_once(includeFileProcessor("actions/mutate_snippet.dynamic.php", $manager_theme));
516
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
517 517
 	break;
518 518
 	case 24:
519 519
 		// get the save processor
520
-		include_once(includeFileProcessor("processors/save_snippet.processor.php",$manager_theme));
520
+		include_once(includeFileProcessor("processors/save_snippet.processor.php", $manager_theme));
521 521
 	break;
522 522
 	case 25:
523 523
 		// get the delete processor
524
-		include_once(includeFileProcessor("processors/delete_snippet.processor.php",$manager_theme));
524
+		include_once(includeFileProcessor("processors/delete_snippet.processor.php", $manager_theme));
525 525
 	break;
526 526
 	case 98:
527 527
 		// get the duplicate processor
528
-		include_once(includeFileProcessor("processors/duplicate_snippet.processor.php",$manager_theme));
528
+		include_once(includeFileProcessor("processors/duplicate_snippet.processor.php", $manager_theme));
529 529
 	break;
530 530
 /********************************************************************/
531 531
 /* htmlsnippet management                                               */
532 532
 /********************************************************************/
533 533
 	case 78:
534 534
 		// get the edit snippet action
535
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
536
-		include_once(includeFileProcessor("actions/mutate_htmlsnippet.dynamic.php",$manager_theme));
537
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
535
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
536
+		include_once(includeFileProcessor("actions/mutate_htmlsnippet.dynamic.php", $manager_theme));
537
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
538 538
 	break;
539 539
 	case 77:
540 540
 		// get the new snippet action
541
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
542
-		include_once(includeFileProcessor("actions/mutate_htmlsnippet.dynamic.php",$manager_theme));
543
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
541
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
542
+		include_once(includeFileProcessor("actions/mutate_htmlsnippet.dynamic.php", $manager_theme));
543
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
544 544
 	break;
545 545
 	case 79:
546 546
 		// get the save processor
547
-		include_once(includeFileProcessor("processors/save_htmlsnippet.processor.php",$manager_theme));
547
+		include_once(includeFileProcessor("processors/save_htmlsnippet.processor.php", $manager_theme));
548 548
 	break;
549 549
 	case 80:
550 550
 		// get the delete processor
551
-		include_once(includeFileProcessor("processors/delete_htmlsnippet.processor.php",$manager_theme));
551
+		include_once(includeFileProcessor("processors/delete_htmlsnippet.processor.php", $manager_theme));
552 552
 	break;
553 553
 	case 97:
554 554
 		// get the duplicate processor
555
-		include_once(includeFileProcessor("processors/duplicate_htmlsnippet.processor.php",$manager_theme));
555
+		include_once(includeFileProcessor("processors/duplicate_htmlsnippet.processor.php", $manager_theme));
556 556
 	break;
557 557
 /********************************************************************/
558 558
 /* show the credits page                                            */
559 559
 /********************************************************************/
560 560
 	case 18:
561 561
 		// get the credits page
562
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
563
-		include_once(includeFileProcessor("actions/credits.static.php",$manager_theme));
564
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
562
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
563
+		include_once(includeFileProcessor("actions/credits.static.php", $manager_theme));
564
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
565 565
 	break;
566 566
 /********************************************************************/
567 567
 /* empty cache & synchronisation                                    */
568 568
 /********************************************************************/
569 569
 	case 26:
570 570
 		// get the cache emptying processor
571
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
572
-		include_once(includeFileProcessor("actions/refresh_site.dynamic.php",$manager_theme));
573
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
571
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
572
+		include_once(includeFileProcessor("actions/refresh_site.dynamic.php", $manager_theme));
573
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
574 574
 	break;
575 575
 /********************************************************************/
576 576
 /* Module management                                                */
577 577
 /********************************************************************/
578 578
 	case 106:
579 579
 		// get module management
580
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
581
-		include_once(includeFileProcessor("actions/modules.static.php",$manager_theme));
582
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
580
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
581
+		include_once(includeFileProcessor("actions/modules.static.php", $manager_theme));
582
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
583 583
 	break;
584 584
 	case 107:
585 585
 		// get the new module action
586
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
587
-		include_once(includeFileProcessor("actions/mutate_module.dynamic.php",$manager_theme));
588
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
586
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
587
+		include_once(includeFileProcessor("actions/mutate_module.dynamic.php", $manager_theme));
588
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
589 589
 	break;
590 590
 	case 108:
591 591
 		// get the edit module action
592
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
593
-		include_once(includeFileProcessor("actions/mutate_module.dynamic.php",$manager_theme));
594
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
592
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
593
+		include_once(includeFileProcessor("actions/mutate_module.dynamic.php", $manager_theme));
594
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
595 595
 	break;
596 596
 	case 109:
597 597
 		// get the save processor
598
-		include_once(includeFileProcessor("processors/save_module.processor.php",$manager_theme));
598
+		include_once(includeFileProcessor("processors/save_module.processor.php", $manager_theme));
599 599
 	break;
600 600
 	case 110:
601 601
 		// get the delete processor
602
-		include_once(includeFileProcessor("processors/delete_module.processor.php",$manager_theme));
602
+		include_once(includeFileProcessor("processors/delete_module.processor.php", $manager_theme));
603 603
 	break;
604 604
 	case 111:
605 605
 		// get the duplicate processor
606
-		include_once(includeFileProcessor("processors/duplicate_module.processor.php",$manager_theme));
606
+		include_once(includeFileProcessor("processors/duplicate_module.processor.php", $manager_theme));
607 607
 	break;
608 608
 	case 112:
609 609
 		// execute/run the module
610 610
 		//include_once "header.inc.php";
611
-		include_once(includeFileProcessor("processors/execute_module.processor.php",$manager_theme));
611
+		include_once(includeFileProcessor("processors/execute_module.processor.php", $manager_theme));
612 612
 		//include_once "footer.inc.php";
613 613
 		break;
614 614
 	case 113:
615 615
 		// get the module resources (dependencies) action
616
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
617
-		include_once(includeFileProcessor("actions/mutate_module_resources.dynamic.php",$manager_theme));
618
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
616
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
617
+		include_once(includeFileProcessor("actions/mutate_module_resources.dynamic.php", $manager_theme));
618
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
619 619
 	break;
620 620
 /********************************************************************/
621 621
 /* plugin management                                                */
@@ -623,46 +623,46 @@  discard block
 block discarded – undo
623 623
 	case 100:
624 624
 		// change the plugin priority
625 625
 		//include_once "header.inc.php"; - in action file
626
-		include_once(includeFileProcessor("actions/mutate_plugin_priority.dynamic.php",$manager_theme));
627
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
626
+		include_once(includeFileProcessor("actions/mutate_plugin_priority.dynamic.php", $manager_theme));
627
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
628 628
 	break;
629 629
 	case 101:
630 630
 		// get the new plugin action
631
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
632
-		include_once(includeFileProcessor("actions/mutate_plugin.dynamic.php",$manager_theme));
633
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
631
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
632
+		include_once(includeFileProcessor("actions/mutate_plugin.dynamic.php", $manager_theme));
633
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
634 634
 	break;
635 635
 	case 102:
636 636
 		// get the edit plugin action
637
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
638
-		include_once(includeFileProcessor("actions/mutate_plugin.dynamic.php",$manager_theme));
639
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
637
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
638
+		include_once(includeFileProcessor("actions/mutate_plugin.dynamic.php", $manager_theme));
639
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
640 640
 	break;
641 641
 	case 103:
642 642
 		// get the save processor
643
-		include_once(includeFileProcessor("processors/save_plugin.processor.php",$manager_theme));
643
+		include_once(includeFileProcessor("processors/save_plugin.processor.php", $manager_theme));
644 644
 	break;
645 645
 	case 104:
646 646
 		// get the delete processor
647
-		include_once(includeFileProcessor("processors/delete_plugin.processor.php",$manager_theme));
647
+		include_once(includeFileProcessor("processors/delete_plugin.processor.php", $manager_theme));
648 648
 	break;
649 649
 	case 105:
650 650
 		// get the duplicate processor
651
-		include_once(includeFileProcessor("processors/duplicate_plugin.processor.php",$manager_theme));
651
+		include_once(includeFileProcessor("processors/duplicate_plugin.processor.php", $manager_theme));
652 652
 	break;
653 653
 	case 119:
654 654
 		// get the purge processor
655
-		include_once(includeFileProcessor("processors/purge_plugin.processor.php",$manager_theme));
655
+		include_once(includeFileProcessor("processors/purge_plugin.processor.php", $manager_theme));
656 656
 	break;
657 657
 /********************************************************************/
658 658
 /* view phpinfo                                                     */
659 659
 /********************************************************************/
660 660
 	case 200:
661 661
 		// show phpInfo
662
-		if($modx->hasPermission('logs')) {
663
-			include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
664
-			include_once(includeFileProcessor("actions/phpinfo.static.php",$manager_theme));
665
-			include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
662
+		if ($modx->hasPermission('logs')) {
663
+			include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
664
+			include_once(includeFileProcessor("actions/phpinfo.static.php", $manager_theme));
665
+			include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
666 666
 		}
667 667
 	break;
668 668
 /********************************************************************/
@@ -670,320 +670,320 @@  discard block
 block discarded – undo
670 670
 /********************************************************************/
671 671
 	case 29:
672 672
 		// get the error page
673
-		include_once(includeFileProcessor("actions/error_dialog.static.php",$manager_theme));
673
+		include_once(includeFileProcessor("actions/error_dialog.static.php", $manager_theme));
674 674
 	break;
675 675
 /********************************************************************/
676 676
 /* file manager                                                     */
677 677
 /********************************************************************/
678 678
 	case 31:
679 679
 		// get the page to manage files
680
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
681
-		include_once(includeFileProcessor("actions/files.dynamic.php",$manager_theme));
682
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
680
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
681
+		include_once(includeFileProcessor("actions/files.dynamic.php", $manager_theme));
682
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
683 683
 	break;
684 684
 /********************************************************************/
685 685
 /* access permissions                                               */
686 686
 /********************************************************************/
687 687
 	case 40:
688
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
689
-		include_once(includeFileProcessor("actions/access_permissions.dynamic.php",$manager_theme));
690
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
688
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
689
+		include_once(includeFileProcessor("actions/access_permissions.dynamic.php", $manager_theme));
690
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
691 691
 	break;
692 692
 	case 91:
693
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
694
-		include_once(includeFileProcessor("actions/web_access_permissions.dynamic.php",$manager_theme));
695
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
693
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
694
+		include_once(includeFileProcessor("actions/web_access_permissions.dynamic.php", $manager_theme));
695
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
696 696
 	break;
697 697
 /********************************************************************/
698 698
 /* access groups processor                                          */
699 699
 /********************************************************************/
700 700
 	case 41:
701
-		include_once(includeFileProcessor("processors/access_groups.processor.php",$manager_theme));
701
+		include_once(includeFileProcessor("processors/access_groups.processor.php", $manager_theme));
702 702
 	break;
703 703
 	case 92:
704
-		include_once(includeFileProcessor("processors/web_access_groups.processor.php",$manager_theme));
704
+		include_once(includeFileProcessor("processors/web_access_groups.processor.php", $manager_theme));
705 705
 	break;
706 706
 /********************************************************************/
707 707
 /* settings editor                                                  */
708 708
 /********************************************************************/
709 709
 	case 17:
710 710
 		// get the settings editor
711
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
712
-		include_once(includeFileProcessor("actions/mutate_settings.dynamic.php",$manager_theme));
713
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
711
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
712
+		include_once(includeFileProcessor("actions/mutate_settings.dynamic.php", $manager_theme));
713
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
714 714
 	break;
715 715
 	case 118:
716 716
 		// call settings ajax include
717 717
 		ob_clean();
718
-		include_once(includeFileProcessor("includes/mutate_settings.ajax.php",$manager_theme));
718
+		include_once(includeFileProcessor("includes/mutate_settings.ajax.php", $manager_theme));
719 719
 	break;
720 720
 /********************************************************************/
721 721
 /* save settings                                                    */
722 722
 /********************************************************************/
723 723
 	case 30:
724 724
 		// get the save settings processor
725
-		include_once(includeFileProcessor("processors/save_settings.processor.php",$manager_theme));
725
+		include_once(includeFileProcessor("processors/save_settings.processor.php", $manager_theme));
726 726
 	break;
727 727
 /********************************************************************/
728 728
 /* system information                                               */
729 729
 /********************************************************************/
730 730
 	case 53:
731 731
 		// get the settings editor
732
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
733
-		include_once(includeFileProcessor("actions/sysinfo.static.php",$manager_theme));
734
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
732
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
733
+		include_once(includeFileProcessor("actions/sysinfo.static.php", $manager_theme));
734
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
735 735
 	break;
736 736
 /********************************************************************/
737 737
 /* optimise table                                               */
738 738
 /********************************************************************/
739 739
 	case 54:
740 740
 		// get the table optimizer/truncate processor
741
-		include_once(includeFileProcessor("processors/optimize_table.processor.php",$manager_theme));
741
+		include_once(includeFileProcessor("processors/optimize_table.processor.php", $manager_theme));
742 742
 	break;
743 743
 /********************************************************************/
744 744
 /* view logging                                                     */
745 745
 /********************************************************************/
746 746
 	case 13:
747 747
 		// view logging
748
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
749
-		include_once(includeFileProcessor("actions/logging.static.php",$manager_theme));
750
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
748
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
749
+		include_once(includeFileProcessor("actions/logging.static.php", $manager_theme));
750
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
751 751
 	break;
752 752
 /********************************************************************/
753 753
 /* empty logs                                                       */
754 754
 /********************************************************************/
755 755
 	case 55:
756 756
 		// get the settings editor
757
-		include_once(includeFileProcessor("processors/empty_table.processor.php",$manager_theme));
757
+		include_once(includeFileProcessor("processors/empty_table.processor.php", $manager_theme));
758 758
 	break;
759 759
 /********************************************************************/
760 760
 /* calls test page                                                      */
761 761
 /********************************************************************/
762 762
 	case 999:
763 763
 		// get the test page
764
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
765
-		include_once(includeFileProcessor("test_page.php",$manager_theme));
766
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
764
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
765
+		include_once(includeFileProcessor("test_page.php", $manager_theme));
766
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
767 767
 	break;
768 768
 /********************************************************************/
769 769
 /* Empty recycle bin                                                */
770 770
 /********************************************************************/
771 771
 	case 64:
772 772
 		// get the Recycle bin emptier
773
-		include_once(includeFileProcessor("processors/remove_content.processor.php",$manager_theme));
773
+		include_once(includeFileProcessor("processors/remove_content.processor.php", $manager_theme));
774 774
 	break;
775 775
 /********************************************************************/
776 776
 /* Messages                                                     */
777 777
 /********************************************************************/
778 778
 	case 10:
779 779
 		// get the messages page
780
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
781
-		include_once(includeFileProcessor("actions/messages.static.php",$manager_theme));
782
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
780
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
781
+		include_once(includeFileProcessor("actions/messages.static.php", $manager_theme));
782
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
783 783
 	break;
784 784
 /********************************************************************/
785 785
 /* Delete a message                                                 */
786 786
 /********************************************************************/
787 787
 	case 65:
788 788
 		// get the message deleter
789
-		include_once(includeFileProcessor("processors/delete_message.processor.php",$manager_theme));
789
+		include_once(includeFileProcessor("processors/delete_message.processor.php", $manager_theme));
790 790
 	break;
791 791
 /********************************************************************/
792 792
 /* Send a message                                                   */
793 793
 /********************************************************************/
794 794
 	case 66:
795 795
 		// get the message deleter
796
-		include_once(includeFileProcessor("processors/send_message.processor.php",$manager_theme));
796
+		include_once(includeFileProcessor("processors/send_message.processor.php", $manager_theme));
797 797
 	break;
798 798
 /********************************************************************/
799 799
 /* Remove locks                                                 */
800 800
 /********************************************************************/
801 801
 	case 67:
802 802
 		// get the lock remover
803
-		include_once(includeFileProcessor("processors/remove_locks.processor.php",$manager_theme));
803
+		include_once(includeFileProcessor("processors/remove_locks.processor.php", $manager_theme));
804 804
 	break;
805 805
 /********************************************************************/
806 806
 /* Site schedule                                                    */
807 807
 /********************************************************************/
808 808
 	case 70:
809 809
 		// get the schedule page
810
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
811
-		include_once(includeFileProcessor("actions/site_schedule.static.php",$manager_theme));
812
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
810
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
811
+		include_once(includeFileProcessor("actions/site_schedule.static.php", $manager_theme));
812
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
813 813
 	break;
814 814
 /********************************************************************/
815 815
 /* Search                                                           */
816 816
 /********************************************************************/
817 817
 	case 71:
818 818
 		// get the search page
819
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
820
-		include_once(includeFileProcessor("actions/search.static.php",$manager_theme));
821
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
819
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
820
+		include_once(includeFileProcessor("actions/search.static.php", $manager_theme));
821
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
822 822
 	break;
823 823
 /********************************************************************/
824 824
 /* About                                                            */
825 825
 /********************************************************************/
826 826
 	case 59:
827 827
 		// get the about page
828
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
829
-		include_once(includeFileProcessor("actions/about.static.php",$manager_theme));
830
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
828
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
829
+		include_once(includeFileProcessor("actions/about.static.php", $manager_theme));
830
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
831 831
 	break;
832 832
 /********************************************************************/
833 833
 /* Add weblink                                                          */
834 834
 /********************************************************************/
835 835
 	case 72:
836 836
 		// get the weblink page
837
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
838
-		include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme));
839
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
837
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
838
+		include_once(includeFileProcessor("actions/mutate_content.dynamic.php", $manager_theme));
839
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
840 840
 	break;
841 841
 /********************************************************************/
842 842
 /* User management                                                  */
843 843
 /********************************************************************/
844 844
 	case 75:
845
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
846
-		include_once(includeFileProcessor("actions/user_management.static.php",$manager_theme));
847
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
845
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
846
+		include_once(includeFileProcessor("actions/user_management.static.php", $manager_theme));
847
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
848 848
 	break;
849 849
 	case 99:
850
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
851
-		include_once(includeFileProcessor("actions/web_user_management.static.php",$manager_theme));
852
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
850
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
851
+		include_once(includeFileProcessor("actions/web_user_management.static.php", $manager_theme));
852
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
853 853
 	break;
854 854
 	case 86:
855
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
856
-		include_once(includeFileProcessor("actions/role_management.static.php",$manager_theme));
857
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
855
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
856
+		include_once(includeFileProcessor("actions/role_management.static.php", $manager_theme));
857
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
858 858
 	break;
859 859
 /********************************************************************/
860 860
 /* template/ snippet management                                                 */
861 861
 /********************************************************************/
862 862
 	case 76:
863
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
864
-		include_once(includeFileProcessor("actions/resources.static.php",$manager_theme));
865
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
863
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
864
+		include_once(includeFileProcessor("actions/resources.static.php", $manager_theme));
865
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
866 866
 	break;
867 867
 /********************************************************************/
868 868
 /* Export to file                                                   */
869 869
 /********************************************************************/
870 870
 	case 83:
871
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
872
-		include_once(includeFileProcessor("actions/export_site.static.php",$manager_theme));
873
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
871
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
872
+		include_once(includeFileProcessor("actions/export_site.static.php", $manager_theme));
873
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
874 874
 	break;
875 875
 /********************************************************************/
876 876
 /* Resource Selector                                                    */
877 877
 /********************************************************************/
878 878
 	case 84:
879
-		include_once(includeFileProcessor("actions/resource_selector.static.php",$manager_theme));
879
+		include_once(includeFileProcessor("actions/resource_selector.static.php", $manager_theme));
880 880
 	break;
881 881
 /********************************************************************/
882 882
 /* Backup Manager                                                   */
883 883
 /********************************************************************/
884 884
 	case 93:
885 885
 		# header and footer will be handled interally
886
-		include_once(includeFileProcessor("actions/bkmanager.static.php",$manager_theme));
886
+		include_once(includeFileProcessor("actions/bkmanager.static.php", $manager_theme));
887 887
 	break;
888 888
 /********************************************************************/
889 889
 /* Duplicate Document                                                   */
890 890
 /********************************************************************/
891 891
 	case 94:
892 892
 		// get the duplicate processor
893
-		include_once(includeFileProcessor("processors/duplicate_content.processor.php",$manager_theme));
893
+		include_once(includeFileProcessor("processors/duplicate_content.processor.php", $manager_theme));
894 894
 	break;
895 895
 /********************************************************************/
896 896
 /* Import Document from file                                        */
897 897
 /********************************************************************/
898 898
 	case 95:
899
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
900
-		include_once(includeFileProcessor("actions/import_site.static.php",$manager_theme));
901
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
899
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
900
+		include_once(includeFileProcessor("actions/import_site.static.php", $manager_theme));
901
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
902 902
 	break;
903 903
 /********************************************************************/
904 904
 /* Help                                                             */
905 905
 /********************************************************************/
906 906
 	case 9:
907 907
 		// get the help page
908
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
909
-		include_once(includeFileProcessor("actions/help.static.php",$manager_theme));
910
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
908
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
909
+		include_once(includeFileProcessor("actions/help.static.php", $manager_theme));
910
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
911 911
 	break;
912 912
 /********************************************************************/
913 913
 /* Template Variables - Based on Apodigm's Docvars                  */
914 914
 /********************************************************************/
915 915
 	case 300:
916 916
 		// get the new document variable action
917
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
918
-		include_once(includeFileProcessor("actions/mutate_tmplvars.dynamic.php",$manager_theme));
919
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
917
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
918
+		include_once(includeFileProcessor("actions/mutate_tmplvars.dynamic.php", $manager_theme));
919
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
920 920
 	break;
921 921
 	case 301:
922 922
 		// get the edit document variable action
923
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
924
-		include_once(includeFileProcessor("actions/mutate_tmplvars.dynamic.php",$manager_theme));
925
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
923
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
924
+		include_once(includeFileProcessor("actions/mutate_tmplvars.dynamic.php", $manager_theme));
925
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
926 926
 	break;
927 927
 	case 302:
928 928
 		// get the save processor
929
-		include_once(includeFileProcessor("processors/save_tmplvars.processor.php",$manager_theme));
929
+		include_once(includeFileProcessor("processors/save_tmplvars.processor.php", $manager_theme));
930 930
 	break;
931 931
 	case 303:
932 932
 		// get the delete processor
933
-		include_once(includeFileProcessor("processors/delete_tmplvars.processor.php",$manager_theme));
933
+		include_once(includeFileProcessor("processors/delete_tmplvars.processor.php", $manager_theme));
934 934
 	break;
935 935
 	case 304:
936 936
 		// get the duplicate processor
937
-		include_once(includeFileProcessor("processors/duplicate_tmplvars.processor.php",$manager_theme));
937
+		include_once(includeFileProcessor("processors/duplicate_tmplvars.processor.php", $manager_theme));
938 938
 	break;
939 939
 	case 305:
940 940
 		// get the tv-rank action
941
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
942
-		include_once(includeFileProcessor("actions/mutate_tv_rank.dynamic.php",$manager_theme));
943
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
941
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
942
+		include_once(includeFileProcessor("actions/mutate_tv_rank.dynamic.php", $manager_theme));
943
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
944 944
 	break;
945 945
 /********************************************************************/
946 946
 /* Event viewer: show event message log                             */
947 947
 /********************************************************************/
948 948
 	case 114:
949 949
 		// get event logs
950
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
951
-		include_once(includeFileProcessor("actions/eventlog.dynamic.php",$manager_theme));
952
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
950
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
951
+		include_once(includeFileProcessor("actions/eventlog.dynamic.php", $manager_theme));
952
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
953 953
 	break;
954 954
 	case 115:
955 955
 		// get event log details viewer
956
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
957
-		include_once(includeFileProcessor("actions/eventlog_details.dynamic.php",$manager_theme));
958
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
956
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
957
+		include_once(includeFileProcessor("actions/eventlog_details.dynamic.php", $manager_theme));
958
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
959 959
 	break;
960 960
 	case 116:
961 961
 		// get the event log delete processor
962
-		include_once(includeFileProcessor("processors/delete_eventlog.processor.php",$manager_theme));
962
+		include_once(includeFileProcessor("processors/delete_eventlog.processor.php", $manager_theme));
963 963
 	break;
964 964
 
965 965
 	case 501:
966 966
 		//delete category
967
-		include_once(includeFileProcessor("processors/delete_category.processor.php",$manager_theme));
967
+		include_once(includeFileProcessor("processors/delete_category.processor.php", $manager_theme));
968 968
 	break;
969 969
 /********************************************************************/
970 970
 /* default action: show not implemented message                     */
971 971
 /********************************************************************/
972 972
 	default :
973 973
 		// say that what was requested doesn't do anything yet
974
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
974
+		include_once(includeFileProcessor("includes/header.inc.php", $manager_theme));
975 975
 		echo "
976 976
 			<div class='sectionHeader'>".$_lang['functionnotimpl']."</div>
977 977
 			<div class='sectionBody'>
978 978
 				<p>".$_lang['functionnotimpl_message']."</p>
979 979
 			</div>
980 980
 		";
981
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
981
+		include_once(includeFileProcessor("includes/footer.inc.php", $manager_theme));
982 982
 }
983 983
 
984 984
 /********************************************************************/
985 985
 // log action, unless it's a frame request
986
-if($action!=1 && $action!=7 && $action!=2) {
986
+if ($action != 1 && $action != 7 && $action != 2) {
987 987
 	$log = new EvolutionCMS\Legacy\LogHandler;
988 988
 	$log->initAndWriteLog();
989 989
 }
Please login to merge, or discard this patch.
Indentation   +617 added lines, -617 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
 $autoloader = realpath(__DIR__.'/../vendor/autoload.php');
52 52
 if (file_exists($autoloader) && is_readable($autoloader)) {
53
-	include_once($autoloader);
53
+    include_once($autoloader);
54 54
 }
55 55
 
56 56
 // get start time
@@ -65,22 +65,22 @@  discard block
 block discarded – undo
65 65
 $site_hostnames_path = $base_path . 'assets/cache/siteHostnames.php';
66 66
 if(is_file($site_hostnames_path)) include_once($site_hostnames_path);
67 67
 if(!defined('MGR_DIR') || MGR_DIR!==$mgr_dir) {
68
-	$src = "<?php\n";
69
-	$src .= "define('MGR_DIR', '{$mgr_dir}');\n";
70
-	$rs = file_put_contents($site_mgr_path,$src);
71
-	if(!$rs) {
72
-		echo 'siteManager.php write error';
73
-		exit;
74
-	}
75
-	sleep(1);
76
-	header('Location:' . $_SERVER['REQUEST_URI']);
77
-	exit;
68
+    $src = "<?php\n";
69
+    $src .= "define('MGR_DIR', '{$mgr_dir}');\n";
70
+    $rs = file_put_contents($site_mgr_path,$src);
71
+    if(!$rs) {
72
+        echo 'siteManager.php write error';
73
+        exit;
74
+    }
75
+    sleep(1);
76
+    header('Location:' . $_SERVER['REQUEST_URI']);
77
+    exit;
78 78
 }
79 79
 
80 80
 // we use this to make sure files are accessed through
81 81
 // the manager instead of seperately.
82 82
 if ( ! defined('IN_MANAGER_MODE')) {
83
-	define('IN_MANAGER_MODE', true);
83
+    define('IN_MANAGER_MODE', true);
84 84
 }
85 85
 
86 86
 // harden it
@@ -101,16 +101,16 @@  discard block
 block discarded – undo
101 101
 
102 102
 // check PHP version. EVO is compatible with php 5 (5.0.0+)
103 103
 $php_ver_comp =  version_compare(phpversion(), "5.0.0");
104
-		// -1 if left is less, 0 if equal, +1 if left is higher
104
+        // -1 if left is less, 0 if equal, +1 if left is higher
105 105
 if($php_ver_comp < 0) {
106
-	echo sprintf($_lang['php_version_check'], phpversion());
107
-	exit;
106
+    echo sprintf($_lang['php_version_check'], phpversion());
107
+    exit;
108 108
 }
109 109
 
110 110
 // check if iconv is installed
111 111
 if(!function_exists('iconv')) {
112
-	echo $_lang['iconv_not_available'];
113
-	exit;
112
+    echo $_lang['iconv_not_available'];
113
+    exit;
114 114
 }
115 115
 
116 116
 // set some runtime options
@@ -123,15 +123,15 @@  discard block
 block discarded – undo
123 123
 
124 124
 // set the document_root :|
125 125
 if(!isset($_SERVER['DOCUMENT_ROOT']) || empty($_SERVER['DOCUMENT_ROOT'])) {
126
-	$_SERVER['DOCUMENT_ROOT'] = str_replace($_SERVER['PATH_INFO'], "", preg_replace("/\\\\/", "/", $_SERVER['PATH_TRANSLATED']))."/";
126
+    $_SERVER['DOCUMENT_ROOT'] = str_replace($_SERVER['PATH_INFO'], "", preg_replace("/\\\\/", "/", $_SERVER['PATH_TRANSLATED']))."/";
127 127
 }
128 128
 
129 129
 // include_once config file
130 130
 $config_filename = "./includes/config.inc.php";
131 131
 if (!file_exists($config_filename)) {
132
-	echo "<h3>Unable to load configuration settings</h3>";
133
-	echo "Please run the EVO <a href='../install'>install utility</a>";
134
-	exit;
132
+    echo "<h3>Unable to load configuration settings</h3>";
133
+    echo "Please run the EVO <a href='../install'>install utility</a>";
134
+    exit;
135 135
 }
136 136
 
137 137
 // include the database configuration file
@@ -139,11 +139,11 @@  discard block
 block discarded – undo
139 139
 
140 140
 // initiate the content manager class
141 141
 if (isset($coreClass) && class_exists($coreClass)) {
142
-	$modx = new $coreClass;
142
+    $modx = new $coreClass;
143 143
 }
144 144
 if (!isset($modx) || !($modx instanceof DocumentParser)) {
145
-	include_once(MODX_MANAGER_PATH.'includes/document.parser.class.inc.php');
146
-	$modx = evolutionCMS();
145
+    include_once(MODX_MANAGER_PATH.'includes/document.parser.class.inc.php');
146
+    $modx = evolutionCMS();
147 147
 }
148 148
 
149 149
 $modx->loadExtension("ManagerAPI");
@@ -166,25 +166,25 @@  discard block
 block discarded – undo
166 166
 
167 167
 // now include_once different language file as english
168 168
 if(!isset($manager_language) || !file_exists(MODX_MANAGER_PATH."includes/lang/".$manager_language.".inc.php")) {
169
-	$manager_language = "english"; // if not set, get the english language file.
169
+    $manager_language = "english"; // if not set, get the english language file.
170 170
 }
171 171
 
172 172
 // $length_eng_lang = count($_lang); // Not used for now, required for difference-check with other languages than english (i.e. inside installer)
173 173
 
174 174
 if($manager_language!="english" && file_exists(MODX_MANAGER_PATH."includes/lang/".$manager_language.".inc.php")) {
175
-	include_once "lang/".$manager_language.".inc.php";
175
+    include_once "lang/".$manager_language.".inc.php";
176 176
 }
177 177
 
178 178
 // allow custom language overrides not altered by future EVO-updates
179 179
 if(file_exists(MODX_MANAGER_PATH."includes/lang/override/".$manager_language.".inc.php")) {
180
-	include_once "lang/override/".$manager_language.".inc.php";
180
+    include_once "lang/override/".$manager_language.".inc.php";
181 181
 }
182 182
 
183 183
 $s = array('[+MGR_DIR+]');
184 184
 $r = array(MGR_DIR);
185 185
 foreach($_lang as $k=>$v)
186 186
 {
187
-	if(strpos($v,'[+')!==false) $_lang[$k] = str_replace($s, $r, $v);
187
+    if(strpos($v,'[+')!==false) $_lang[$k] = str_replace($s, $r, $v);
188 188
 }
189 189
 
190 190
 // send the charset header
@@ -199,19 +199,19 @@  discard block
 block discarded – undo
199 199
 
200 200
 // double check the session
201 201
 if(!isset($_SESSION['mgrValidated'])){
202
-	echo "Not Logged In!";
203
-	exit;
202
+    echo "Not Logged In!";
203
+    exit;
204 204
 }
205 205
 
206 206
 // include_once the style variables file
207 207
 if(isset($manager_theme) && !isset($_style)) {
208
-	$_style = array();
209
-	include_once "media/style/".$manager_theme."/style.php";
208
+    $_style = array();
209
+    include_once "media/style/".$manager_theme."/style.php";
210 210
 }
211 211
 
212 212
 // check if user is allowed to access manager interface
213 213
 if(isset($allow_manager_access) && $allow_manager_access==0) {
214
-	include_once "manager.lockout.inc.php";
214
+    include_once "manager.lockout.inc.php";
215 215
 }
216 216
 
217 217
 // Initialize System Alert Message Queque
@@ -220,13 +220,13 @@  discard block
 block discarded – undo
220 220
 
221 221
 // first we check to see if this is a frameset request
222 222
 if(!isset($_POST['a']) && !isset($_GET['a']) && !isset($_POST['updateMsgCount'])) {
223
-	// this looks to be a top-level frameset request, so let's serve up a frameset
224
-	if(is_file(MODX_MANAGER_PATH."media/style/".$manager_theme."/frames/1.php")) {
225
-		include_once "media/style/".$manager_theme."/frames/1.php";
226
-	}else{
227
-		include_once "frames/1.php";
228
-	}
229
-	exit;
223
+    // this looks to be a top-level frameset request, so let's serve up a frameset
224
+    if(is_file(MODX_MANAGER_PATH."media/style/".$manager_theme."/frames/1.php")) {
225
+        include_once "media/style/".$manager_theme."/frames/1.php";
226
+    }else{
227
+        include_once "frames/1.php";
228
+    }
229
+    exit;
230 230
 }
231 231
 
232 232
 // OK, let's retrieve the action directive from the request
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 else                       $action = null;
238 238
 
239 239
 if (isset($_POST['updateMsgCount']) && $modx->hasPermission('messages')) {
240
-	include_once 'messageCount.inc.php';
240
+    include_once 'messageCount.inc.php';
241 241
 }
242 242
 
243 243
 // save page to manager object
@@ -245,19 +245,19 @@  discard block
 block discarded – undo
245 245
 
246 246
 // attempt to foil some simple types of CSRF attacks
247 247
 if (isset($modx->config['validate_referer']) && (int)$modx->config['validate_referer']) {
248
-	if (isset($_SERVER['HTTP_REFERER'])) {
249
-		$referer = $_SERVER['HTTP_REFERER'];
250
-
251
-		if (!empty($referer)) {
252
-			if (!preg_match('/^'.preg_quote(MODX_SITE_URL, '/').'/i', $referer)) {
253
-				$modx->webAlertAndQuit("A possible CSRF attempt was detected from referer: {$referer}.", "index.php");
254
-			}
255
-		} else {
256
-				$modx->webAlertAndQuit("A possible CSRF attempt was detected. No referer was provided by the client.", "index.php");
257
-		}
258
-	} else {
259
-		$modx->webAlertAndQuit("A possible CSRF attempt was detected. No referer was provided by the server.", "index.php");
260
-	}
248
+    if (isset($_SERVER['HTTP_REFERER'])) {
249
+        $referer = $_SERVER['HTTP_REFERER'];
250
+
251
+        if (!empty($referer)) {
252
+            if (!preg_match('/^'.preg_quote(MODX_SITE_URL, '/').'/i', $referer)) {
253
+                $modx->webAlertAndQuit("A possible CSRF attempt was detected from referer: {$referer}.", "index.php");
254
+            }
255
+        } else {
256
+                $modx->webAlertAndQuit("A possible CSRF attempt was detected. No referer was provided by the client.", "index.php");
257
+        }
258
+    } else {
259
+        $modx->webAlertAndQuit("A possible CSRF attempt was detected. No referer was provided by the server.", "index.php");
260
+    }
261 261
 }
262 262
 
263 263
 // invoke OnManagerPageInit event
@@ -265,13 +265,13 @@  discard block
 block discarded – undo
265 265
 
266 266
 // return element filepath
267 267
 function includeFileProcessor ($filepath,$manager_theme) {
268
-	$element = "";
269
-	if(is_file(MODX_MANAGER_PATH."media/style/".$manager_theme."/".$filepath)) {
270
-		$element = MODX_MANAGER_PATH."media/style/".$manager_theme."/".$filepath;
271
-	}else{
272
-		$element = $filepath;
273
-	}
274
-	return $element;
268
+    $element = "";
269
+    if(is_file(MODX_MANAGER_PATH."media/style/".$manager_theme."/".$filepath)) {
270
+        $element = MODX_MANAGER_PATH."media/style/".$manager_theme."/".$filepath;
271
+    }else{
272
+        $element = $filepath;
273
+    }
274
+    return $element;
275 275
 }
276 276
 
277 277
 $managerTheme = new EvolutionCMS\ManagerTheme($modx, $manager_theme);
@@ -281,713 +281,713 @@  discard block
 block discarded – undo
281 281
 /********************************************************************/
282 282
 /* frame management - show the requested frame                      */
283 283
 /********************************************************************/
284
-	case 1 :
285
-		// get the requested frame
286
-		$frame = preg_replace('/[^a-z0-9]/i','',$_REQUEST['f']);
287
-		if($frame>9) {
288
-			$enable_debug=false;    // this is to stop the debug thingy being attached to the framesets
289
-		}
290
-		include_once(includeFileProcessor("frames/".$frame.".php",$manager_theme));
291
-	break;
284
+    case 1 :
285
+        // get the requested frame
286
+        $frame = preg_replace('/[^a-z0-9]/i','',$_REQUEST['f']);
287
+        if($frame>9) {
288
+            $enable_debug=false;    // this is to stop the debug thingy being attached to the framesets
289
+        }
290
+        include_once(includeFileProcessor("frames/".$frame.".php",$manager_theme));
291
+    break;
292 292
 /********************************************************************/
293 293
 /* show the homepage                                                */
294 294
 /********************************************************************/
295
-	case 2:
296
-		// get the home page
297
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
298
-		include_once(includeFileProcessor("actions/welcome.static.php",$manager_theme));
299
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
300
-	break;
295
+    case 2:
296
+        // get the home page
297
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
298
+        include_once(includeFileProcessor("actions/welcome.static.php",$manager_theme));
299
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
300
+    break;
301 301
 /********************************************************************/
302 302
 /* document data                                                    */
303 303
 /********************************************************************/
304
-	case 3:
305
-		// get the page to show document's data
306
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
307
-		include_once(includeFileProcessor("actions/document_data.static.php",$manager_theme));
308
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
309
-	break;
304
+    case 3:
305
+        // get the page to show document's data
306
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
307
+        include_once(includeFileProcessor("actions/document_data.static.php",$manager_theme));
308
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
309
+    break;
310 310
 /********************************************************************/
311 311
 /* content management                                               */
312 312
 /********************************************************************/
313
-	case 85:
314
-		// get the mutate page for adding a folder
315
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
316
-		include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme));
317
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
318
-	break;
319
-	case 27:
320
-		// get the mutate page for changing content
321
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
322
-		include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme));
323
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
324
-	break;
325
-	case 4:
326
-		// get the mutate page for adding content
327
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
328
-		include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme));
329
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
330
-	break;
331
-	case 5:
332
-		// get the save processor
333
-		include_once(includeFileProcessor("processors/save_content.processor.php",$manager_theme));
334
-	break;
335
-	case 6:
336
-		// get the delete processor
337
-		include_once(includeFileProcessor("processors/delete_content.processor.php",$manager_theme));
338
-	break;
339
-	case 63:
340
-		// get the undelete processor
341
-		include_once(includeFileProcessor("processors/undelete_content.processor.php",$manager_theme));
342
-	break;
343
-	case 51:
344
-		// get the move action
345
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
346
-		include_once(includeFileProcessor("actions/move_document.dynamic.php",$manager_theme));
347
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
348
-	break;
349
-	case 52:
350
-		// get the move document processor
351
-		include_once(includeFileProcessor("processors/move_document.processor.php",$manager_theme));
352
-	break;
353
-	case 61:
354
-		// get the processor for publishing content
355
-		include_once(includeFileProcessor("processors/publish_content.processor.php",$manager_theme));
356
-	break;
357
-	case 62:
358
-		// get the processor for publishing content
359
-		include_once(includeFileProcessor("processors/unpublish_content.processor.php",$manager_theme));
360
-	break;
361
-	case 56:
362
-		// get the sort menuindex action
363
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
364
-		include_once(includeFileProcessor("actions/mutate_menuindex_sort.dynamic.php",$manager_theme));
365
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
366
-		break;
313
+    case 85:
314
+        // get the mutate page for adding a folder
315
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
316
+        include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme));
317
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
318
+    break;
319
+    case 27:
320
+        // get the mutate page for changing content
321
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
322
+        include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme));
323
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
324
+    break;
325
+    case 4:
326
+        // get the mutate page for adding content
327
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
328
+        include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme));
329
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
330
+    break;
331
+    case 5:
332
+        // get the save processor
333
+        include_once(includeFileProcessor("processors/save_content.processor.php",$manager_theme));
334
+    break;
335
+    case 6:
336
+        // get the delete processor
337
+        include_once(includeFileProcessor("processors/delete_content.processor.php",$manager_theme));
338
+    break;
339
+    case 63:
340
+        // get the undelete processor
341
+        include_once(includeFileProcessor("processors/undelete_content.processor.php",$manager_theme));
342
+    break;
343
+    case 51:
344
+        // get the move action
345
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
346
+        include_once(includeFileProcessor("actions/move_document.dynamic.php",$manager_theme));
347
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
348
+    break;
349
+    case 52:
350
+        // get the move document processor
351
+        include_once(includeFileProcessor("processors/move_document.processor.php",$manager_theme));
352
+    break;
353
+    case 61:
354
+        // get the processor for publishing content
355
+        include_once(includeFileProcessor("processors/publish_content.processor.php",$manager_theme));
356
+    break;
357
+    case 62:
358
+        // get the processor for publishing content
359
+        include_once(includeFileProcessor("processors/unpublish_content.processor.php",$manager_theme));
360
+    break;
361
+    case 56:
362
+        // get the sort menuindex action
363
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
364
+        include_once(includeFileProcessor("actions/mutate_menuindex_sort.dynamic.php",$manager_theme));
365
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
366
+        break;
367 367
 /********************************************************************/
368 368
 /* show the wait page - gives the tree time to refresh (hopefully)  */
369 369
 /********************************************************************/
370
-	case 7:
371
-		// get the wait page (so the tree can reload)
372
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
373
-		include_once(includeFileProcessor("actions/wait.static.php",$manager_theme));
374
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
375
-	break;
370
+    case 7:
371
+        // get the wait page (so the tree can reload)
372
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
373
+        include_once(includeFileProcessor("actions/wait.static.php",$manager_theme));
374
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
375
+    break;
376 376
 /********************************************************************/
377 377
 /* let the user log out                                             */
378 378
 /********************************************************************/
379
-	case 8:
380
-		// get the logout processor
381
-		include_once(includeFileProcessor("processors/logout.processor.php",$manager_theme));
382
-	break;
379
+    case 8:
380
+        // get the logout processor
381
+        include_once(includeFileProcessor("processors/logout.processor.php",$manager_theme));
382
+    break;
383 383
 /********************************************************************/
384 384
 /* user management                                                  */
385 385
 /********************************************************************/
386
-	case 87:
387
-		// get the new web user page
388
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
389
-		include_once(includeFileProcessor("actions/mutate_web_user.dynamic.php",$manager_theme));
390
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
391
-	break;
392
-	case 88:
393
-		// get the edit web user page
394
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
395
-		include_once(includeFileProcessor("actions/mutate_web_user.dynamic.php",$manager_theme));
396
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
397
-	break;
398
-	case 89:
399
-		// get the save web user processor
400
-		include_once(includeFileProcessor("processors/save_web_user.processor.php",$manager_theme));
401
-	break;
402
-	case 90:
403
-		// get the delete web user page
404
-		include_once(includeFileProcessor("processors/delete_web_user.processor.php",$manager_theme));
405
-	break;
406
-	case 11:
407
-		// get the new user page
408
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
409
-		include_once(includeFileProcessor("actions/mutate_user.dynamic.php",$manager_theme));
410
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
411
-	break;
412
-	case 12:
413
-		// get the edit user page
414
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
415
-		include_once(includeFileProcessor("actions/mutate_user.dynamic.php",$manager_theme));
416
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
417
-	break;
418
-	case 32:
419
-		// get the save user processor
420
-		include_once(includeFileProcessor("processors/save_user.processor.php",$manager_theme));
421
-	break;
422
-	case 28:
423
-		// get the change password page
424
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
425
-		include_once(includeFileProcessor("actions/mutate_password.dynamic.php",$manager_theme));
426
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
427
-	break;
428
-	case 34:
429
-		// get the save new password page
430
-		include_once(includeFileProcessor("processors/save_password.processor.php",$manager_theme));
431
-	break;
432
-	case 33:
433
-		// get the delete user page
434
-		include_once(includeFileProcessor("processors/delete_user.processor.php",$manager_theme));
435
-	break;
386
+    case 87:
387
+        // get the new web user page
388
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
389
+        include_once(includeFileProcessor("actions/mutate_web_user.dynamic.php",$manager_theme));
390
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
391
+    break;
392
+    case 88:
393
+        // get the edit web user page
394
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
395
+        include_once(includeFileProcessor("actions/mutate_web_user.dynamic.php",$manager_theme));
396
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
397
+    break;
398
+    case 89:
399
+        // get the save web user processor
400
+        include_once(includeFileProcessor("processors/save_web_user.processor.php",$manager_theme));
401
+    break;
402
+    case 90:
403
+        // get the delete web user page
404
+        include_once(includeFileProcessor("processors/delete_web_user.processor.php",$manager_theme));
405
+    break;
406
+    case 11:
407
+        // get the new user page
408
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
409
+        include_once(includeFileProcessor("actions/mutate_user.dynamic.php",$manager_theme));
410
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
411
+    break;
412
+    case 12:
413
+        // get the edit user page
414
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
415
+        include_once(includeFileProcessor("actions/mutate_user.dynamic.php",$manager_theme));
416
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
417
+    break;
418
+    case 32:
419
+        // get the save user processor
420
+        include_once(includeFileProcessor("processors/save_user.processor.php",$manager_theme));
421
+    break;
422
+    case 28:
423
+        // get the change password page
424
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
425
+        include_once(includeFileProcessor("actions/mutate_password.dynamic.php",$manager_theme));
426
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
427
+    break;
428
+    case 34:
429
+        // get the save new password page
430
+        include_once(includeFileProcessor("processors/save_password.processor.php",$manager_theme));
431
+    break;
432
+    case 33:
433
+        // get the delete user page
434
+        include_once(includeFileProcessor("processors/delete_user.processor.php",$manager_theme));
435
+    break;
436 436
 /********************************************************************/
437 437
 /* role management                                                  */
438 438
 /********************************************************************/
439
-	case 38:
440
-		// get the new role page
441
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
442
-		include_once(includeFileProcessor("actions/mutate_role.dynamic.php",$manager_theme));
443
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
444
-	break;
445
-	case 35:
446
-		// get the edit role page
447
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
448
-		include_once(includeFileProcessor("actions/mutate_role.dynamic.php",$manager_theme));
449
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
450
-	break;
451
-	case 36:
452
-		// get the save role page
453
-		include_once(includeFileProcessor("processors/save_role.processor.php",$manager_theme));
454
-	break;
455
-	case 37:
456
-		// get the delete role page
457
-		include_once(includeFileProcessor("processors/delete_role.processor.php",$manager_theme));
458
-	break;
439
+    case 38:
440
+        // get the new role page
441
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
442
+        include_once(includeFileProcessor("actions/mutate_role.dynamic.php",$manager_theme));
443
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
444
+    break;
445
+    case 35:
446
+        // get the edit role page
447
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
448
+        include_once(includeFileProcessor("actions/mutate_role.dynamic.php",$manager_theme));
449
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
450
+    break;
451
+    case 36:
452
+        // get the save role page
453
+        include_once(includeFileProcessor("processors/save_role.processor.php",$manager_theme));
454
+    break;
455
+    case 37:
456
+        // get the delete role page
457
+        include_once(includeFileProcessor("processors/delete_role.processor.php",$manager_theme));
458
+    break;
459 459
 /********************************************************************/
460 460
 /* category management                                               */
461 461
 /********************************************************************/
462
-	case 120:
463
-		// get the edit category page
464
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
465
-		include_once(includeFileProcessor("actions/mutate_categories.dynamic.php",$manager_theme));
466
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
467
-	break;
468
-	case 121:
469
-		// for ajax-requests
470
-		include_once(includeFileProcessor("actions/mutate_categories.dynamic.php",$manager_theme));
471
-	break;
462
+    case 120:
463
+        // get the edit category page
464
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
465
+        include_once(includeFileProcessor("actions/mutate_categories.dynamic.php",$manager_theme));
466
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
467
+    break;
468
+    case 121:
469
+        // for ajax-requests
470
+        include_once(includeFileProcessor("actions/mutate_categories.dynamic.php",$manager_theme));
471
+    break;
472 472
 /********************************************************************/
473 473
 /* template management                                              */
474 474
 /********************************************************************/
475
-	case 16:
476
-		// get the edit template action
477
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
478
-		include_once(includeFileProcessor("actions/mutate_templates.dynamic.php",$manager_theme));
479
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
480
-	break;
481
-	case 19:
482
-		// get the new template action
483
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
484
-		include_once(includeFileProcessor("actions/mutate_templates.dynamic.php",$manager_theme));
485
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
486
-	break;
487
-	case 20:
488
-		// get the save processor
489
-		include_once(includeFileProcessor("processors/save_template.processor.php",$manager_theme));
490
-	break;
491
-	case 21:
492
-		// get the delete processor
493
-		include_once(includeFileProcessor("processors/delete_template.processor.php",$manager_theme));
494
-	break;
495
-	case 96:
496
-		// get the duplicate template processor
497
-		include_once(includeFileProcessor("processors/duplicate_template.processor.php",$manager_theme));
498
-	break;
499
-	case 117:
500
-		// change the tv rank for selected template
501
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
502
-		include_once(includeFileProcessor("actions/mutate_template_tv_rank.dynamic.php",$manager_theme));
503
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
504
-		break;
475
+    case 16:
476
+        // get the edit template action
477
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
478
+        include_once(includeFileProcessor("actions/mutate_templates.dynamic.php",$manager_theme));
479
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
480
+    break;
481
+    case 19:
482
+        // get the new template action
483
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
484
+        include_once(includeFileProcessor("actions/mutate_templates.dynamic.php",$manager_theme));
485
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
486
+    break;
487
+    case 20:
488
+        // get the save processor
489
+        include_once(includeFileProcessor("processors/save_template.processor.php",$manager_theme));
490
+    break;
491
+    case 21:
492
+        // get the delete processor
493
+        include_once(includeFileProcessor("processors/delete_template.processor.php",$manager_theme));
494
+    break;
495
+    case 96:
496
+        // get the duplicate template processor
497
+        include_once(includeFileProcessor("processors/duplicate_template.processor.php",$manager_theme));
498
+    break;
499
+    case 117:
500
+        // change the tv rank for selected template
501
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
502
+        include_once(includeFileProcessor("actions/mutate_template_tv_rank.dynamic.php",$manager_theme));
503
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
504
+        break;
505 505
 /********************************************************************/
506 506
 /* snippet management                                               */
507 507
 /********************************************************************/
508
-	case 22:
509
-		// get the edit snippet action
510
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
511
-		include_once(includeFileProcessor("actions/mutate_snippet.dynamic.php",$manager_theme));
512
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
513
-	break;
514
-	case 23:
515
-		// get the new snippet action
516
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
517
-		include_once(includeFileProcessor("actions/mutate_snippet.dynamic.php",$manager_theme));
518
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
519
-	break;
520
-	case 24:
521
-		// get the save processor
522
-		include_once(includeFileProcessor("processors/save_snippet.processor.php",$manager_theme));
523
-	break;
524
-	case 25:
525
-		// get the delete processor
526
-		include_once(includeFileProcessor("processors/delete_snippet.processor.php",$manager_theme));
527
-	break;
528
-	case 98:
529
-		// get the duplicate processor
530
-		include_once(includeFileProcessor("processors/duplicate_snippet.processor.php",$manager_theme));
531
-	break;
508
+    case 22:
509
+        // get the edit snippet action
510
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
511
+        include_once(includeFileProcessor("actions/mutate_snippet.dynamic.php",$manager_theme));
512
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
513
+    break;
514
+    case 23:
515
+        // get the new snippet action
516
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
517
+        include_once(includeFileProcessor("actions/mutate_snippet.dynamic.php",$manager_theme));
518
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
519
+    break;
520
+    case 24:
521
+        // get the save processor
522
+        include_once(includeFileProcessor("processors/save_snippet.processor.php",$manager_theme));
523
+    break;
524
+    case 25:
525
+        // get the delete processor
526
+        include_once(includeFileProcessor("processors/delete_snippet.processor.php",$manager_theme));
527
+    break;
528
+    case 98:
529
+        // get the duplicate processor
530
+        include_once(includeFileProcessor("processors/duplicate_snippet.processor.php",$manager_theme));
531
+    break;
532 532
 /********************************************************************/
533 533
 /* htmlsnippet management                                               */
534 534
 /********************************************************************/
535
-	case 78:
536
-		// get the edit snippet action
537
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
538
-		include_once(includeFileProcessor("actions/mutate_htmlsnippet.dynamic.php",$manager_theme));
539
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
540
-	break;
541
-	case 77:
542
-		// get the new snippet action
543
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
544
-		include_once(includeFileProcessor("actions/mutate_htmlsnippet.dynamic.php",$manager_theme));
545
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
546
-	break;
547
-	case 79:
548
-		// get the save processor
549
-		include_once(includeFileProcessor("processors/save_htmlsnippet.processor.php",$manager_theme));
550
-	break;
551
-	case 80:
552
-		// get the delete processor
553
-		include_once(includeFileProcessor("processors/delete_htmlsnippet.processor.php",$manager_theme));
554
-	break;
555
-	case 97:
556
-		// get the duplicate processor
557
-		include_once(includeFileProcessor("processors/duplicate_htmlsnippet.processor.php",$manager_theme));
558
-	break;
535
+    case 78:
536
+        // get the edit snippet action
537
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
538
+        include_once(includeFileProcessor("actions/mutate_htmlsnippet.dynamic.php",$manager_theme));
539
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
540
+    break;
541
+    case 77:
542
+        // get the new snippet action
543
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
544
+        include_once(includeFileProcessor("actions/mutate_htmlsnippet.dynamic.php",$manager_theme));
545
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
546
+    break;
547
+    case 79:
548
+        // get the save processor
549
+        include_once(includeFileProcessor("processors/save_htmlsnippet.processor.php",$manager_theme));
550
+    break;
551
+    case 80:
552
+        // get the delete processor
553
+        include_once(includeFileProcessor("processors/delete_htmlsnippet.processor.php",$manager_theme));
554
+    break;
555
+    case 97:
556
+        // get the duplicate processor
557
+        include_once(includeFileProcessor("processors/duplicate_htmlsnippet.processor.php",$manager_theme));
558
+    break;
559 559
 /********************************************************************/
560 560
 /* show the credits page                                            */
561 561
 /********************************************************************/
562
-	case 18:
563
-		// get the credits page
564
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
565
-		include_once(includeFileProcessor("actions/credits.static.php",$manager_theme));
566
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
567
-	break;
562
+    case 18:
563
+        // get the credits page
564
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
565
+        include_once(includeFileProcessor("actions/credits.static.php",$manager_theme));
566
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
567
+    break;
568 568
 /********************************************************************/
569 569
 /* empty cache & synchronisation                                    */
570 570
 /********************************************************************/
571
-	case 26:
572
-		// get the cache emptying processor
573
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
574
-		include_once(includeFileProcessor("actions/refresh_site.dynamic.php",$manager_theme));
575
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
576
-	break;
571
+    case 26:
572
+        // get the cache emptying processor
573
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
574
+        include_once(includeFileProcessor("actions/refresh_site.dynamic.php",$manager_theme));
575
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
576
+    break;
577 577
 /********************************************************************/
578 578
 /* Module management                                                */
579 579
 /********************************************************************/
580
-	case 106:
581
-		// get module management
582
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
583
-		include_once(includeFileProcessor("actions/modules.static.php",$manager_theme));
584
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
585
-	break;
586
-	case 107:
587
-		// get the new module action
588
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
589
-		include_once(includeFileProcessor("actions/mutate_module.dynamic.php",$manager_theme));
590
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
591
-	break;
592
-	case 108:
593
-		// get the edit module action
594
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
595
-		include_once(includeFileProcessor("actions/mutate_module.dynamic.php",$manager_theme));
596
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
597
-	break;
598
-	case 109:
599
-		// get the save processor
600
-		include_once(includeFileProcessor("processors/save_module.processor.php",$manager_theme));
601
-	break;
602
-	case 110:
603
-		// get the delete processor
604
-		include_once(includeFileProcessor("processors/delete_module.processor.php",$manager_theme));
605
-	break;
606
-	case 111:
607
-		// get the duplicate processor
608
-		include_once(includeFileProcessor("processors/duplicate_module.processor.php",$manager_theme));
609
-	break;
610
-	case 112:
611
-		// execute/run the module
612
-		//include_once "header.inc.php";
613
-		include_once(includeFileProcessor("processors/execute_module.processor.php",$manager_theme));
614
-		//include_once "footer.inc.php";
615
-		break;
616
-	case 113:
617
-		// get the module resources (dependencies) action
618
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
619
-		include_once(includeFileProcessor("actions/mutate_module_resources.dynamic.php",$manager_theme));
620
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
621
-	break;
580
+    case 106:
581
+        // get module management
582
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
583
+        include_once(includeFileProcessor("actions/modules.static.php",$manager_theme));
584
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
585
+    break;
586
+    case 107:
587
+        // get the new module action
588
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
589
+        include_once(includeFileProcessor("actions/mutate_module.dynamic.php",$manager_theme));
590
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
591
+    break;
592
+    case 108:
593
+        // get the edit module action
594
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
595
+        include_once(includeFileProcessor("actions/mutate_module.dynamic.php",$manager_theme));
596
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
597
+    break;
598
+    case 109:
599
+        // get the save processor
600
+        include_once(includeFileProcessor("processors/save_module.processor.php",$manager_theme));
601
+    break;
602
+    case 110:
603
+        // get the delete processor
604
+        include_once(includeFileProcessor("processors/delete_module.processor.php",$manager_theme));
605
+    break;
606
+    case 111:
607
+        // get the duplicate processor
608
+        include_once(includeFileProcessor("processors/duplicate_module.processor.php",$manager_theme));
609
+    break;
610
+    case 112:
611
+        // execute/run the module
612
+        //include_once "header.inc.php";
613
+        include_once(includeFileProcessor("processors/execute_module.processor.php",$manager_theme));
614
+        //include_once "footer.inc.php";
615
+        break;
616
+    case 113:
617
+        // get the module resources (dependencies) action
618
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
619
+        include_once(includeFileProcessor("actions/mutate_module_resources.dynamic.php",$manager_theme));
620
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
621
+    break;
622 622
 /********************************************************************/
623 623
 /* plugin management                                                */
624 624
 /********************************************************************/
625
-	case 100:
626
-		// change the plugin priority
627
-		//include_once "header.inc.php"; - in action file
628
-		include_once(includeFileProcessor("actions/mutate_plugin_priority.dynamic.php",$manager_theme));
629
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
630
-	break;
631
-	case 101:
632
-		// get the new plugin action
633
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
634
-		include_once(includeFileProcessor("actions/mutate_plugin.dynamic.php",$manager_theme));
635
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
636
-	break;
637
-	case 102:
638
-		// get the edit plugin action
639
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
640
-		include_once(includeFileProcessor("actions/mutate_plugin.dynamic.php",$manager_theme));
641
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
642
-	break;
643
-	case 103:
644
-		// get the save processor
645
-		include_once(includeFileProcessor("processors/save_plugin.processor.php",$manager_theme));
646
-	break;
647
-	case 104:
648
-		// get the delete processor
649
-		include_once(includeFileProcessor("processors/delete_plugin.processor.php",$manager_theme));
650
-	break;
651
-	case 105:
652
-		// get the duplicate processor
653
-		include_once(includeFileProcessor("processors/duplicate_plugin.processor.php",$manager_theme));
654
-	break;
655
-	case 119:
656
-		// get the purge processor
657
-		include_once(includeFileProcessor("processors/purge_plugin.processor.php",$manager_theme));
658
-	break;
625
+    case 100:
626
+        // change the plugin priority
627
+        //include_once "header.inc.php"; - in action file
628
+        include_once(includeFileProcessor("actions/mutate_plugin_priority.dynamic.php",$manager_theme));
629
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
630
+    break;
631
+    case 101:
632
+        // get the new plugin action
633
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
634
+        include_once(includeFileProcessor("actions/mutate_plugin.dynamic.php",$manager_theme));
635
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
636
+    break;
637
+    case 102:
638
+        // get the edit plugin action
639
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
640
+        include_once(includeFileProcessor("actions/mutate_plugin.dynamic.php",$manager_theme));
641
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
642
+    break;
643
+    case 103:
644
+        // get the save processor
645
+        include_once(includeFileProcessor("processors/save_plugin.processor.php",$manager_theme));
646
+    break;
647
+    case 104:
648
+        // get the delete processor
649
+        include_once(includeFileProcessor("processors/delete_plugin.processor.php",$manager_theme));
650
+    break;
651
+    case 105:
652
+        // get the duplicate processor
653
+        include_once(includeFileProcessor("processors/duplicate_plugin.processor.php",$manager_theme));
654
+    break;
655
+    case 119:
656
+        // get the purge processor
657
+        include_once(includeFileProcessor("processors/purge_plugin.processor.php",$manager_theme));
658
+    break;
659 659
 /********************************************************************/
660 660
 /* view phpinfo                                                     */
661 661
 /********************************************************************/
662
-	case 200:
663
-		// show phpInfo
664
-		if($modx->hasPermission('logs')) {
665
-			include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
666
-			include_once(includeFileProcessor("actions/phpinfo.static.php",$manager_theme));
667
-			include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
668
-		}
669
-	break;
662
+    case 200:
663
+        // show phpInfo
664
+        if($modx->hasPermission('logs')) {
665
+            include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
666
+            include_once(includeFileProcessor("actions/phpinfo.static.php",$manager_theme));
667
+            include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
668
+        }
669
+    break;
670 670
 /********************************************************************/
671 671
 /* errorpage                                            */
672 672
 /********************************************************************/
673
-	case 29:
674
-		// get the error page
675
-		include_once(includeFileProcessor("actions/error_dialog.static.php",$manager_theme));
676
-	break;
673
+    case 29:
674
+        // get the error page
675
+        include_once(includeFileProcessor("actions/error_dialog.static.php",$manager_theme));
676
+    break;
677 677
 /********************************************************************/
678 678
 /* file manager                                                     */
679 679
 /********************************************************************/
680
-	case 31:
681
-		// get the page to manage files
682
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
683
-		include_once(includeFileProcessor("actions/files.dynamic.php",$manager_theme));
684
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
685
-	break;
680
+    case 31:
681
+        // get the page to manage files
682
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
683
+        include_once(includeFileProcessor("actions/files.dynamic.php",$manager_theme));
684
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
685
+    break;
686 686
 /********************************************************************/
687 687
 /* access permissions                                               */
688 688
 /********************************************************************/
689
-	case 40:
690
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
691
-		include_once(includeFileProcessor("actions/access_permissions.dynamic.php",$manager_theme));
692
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
693
-	break;
694
-	case 91:
695
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
696
-		include_once(includeFileProcessor("actions/web_access_permissions.dynamic.php",$manager_theme));
697
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
698
-	break;
689
+    case 40:
690
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
691
+        include_once(includeFileProcessor("actions/access_permissions.dynamic.php",$manager_theme));
692
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
693
+    break;
694
+    case 91:
695
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
696
+        include_once(includeFileProcessor("actions/web_access_permissions.dynamic.php",$manager_theme));
697
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
698
+    break;
699 699
 /********************************************************************/
700 700
 /* access groups processor                                          */
701 701
 /********************************************************************/
702
-	case 41:
703
-		include_once(includeFileProcessor("processors/access_groups.processor.php",$manager_theme));
704
-	break;
705
-	case 92:
706
-		include_once(includeFileProcessor("processors/web_access_groups.processor.php",$manager_theme));
707
-	break;
702
+    case 41:
703
+        include_once(includeFileProcessor("processors/access_groups.processor.php",$manager_theme));
704
+    break;
705
+    case 92:
706
+        include_once(includeFileProcessor("processors/web_access_groups.processor.php",$manager_theme));
707
+    break;
708 708
 /********************************************************************/
709 709
 /* settings editor                                                  */
710 710
 /********************************************************************/
711
-	case 17:
712
-		// get the settings editor
713
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
714
-		include_once(includeFileProcessor("actions/mutate_settings.dynamic.php",$manager_theme));
715
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
716
-	break;
717
-	case 118:
718
-		// call settings ajax include
719
-		ob_clean();
720
-		include_once(includeFileProcessor("includes/mutate_settings.ajax.php",$manager_theme));
721
-	break;
711
+    case 17:
712
+        // get the settings editor
713
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
714
+        include_once(includeFileProcessor("actions/mutate_settings.dynamic.php",$manager_theme));
715
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
716
+    break;
717
+    case 118:
718
+        // call settings ajax include
719
+        ob_clean();
720
+        include_once(includeFileProcessor("includes/mutate_settings.ajax.php",$manager_theme));
721
+    break;
722 722
 /********************************************************************/
723 723
 /* save settings                                                    */
724 724
 /********************************************************************/
725
-	case 30:
726
-		// get the save settings processor
727
-		include_once(includeFileProcessor("processors/save_settings.processor.php",$manager_theme));
728
-	break;
725
+    case 30:
726
+        // get the save settings processor
727
+        include_once(includeFileProcessor("processors/save_settings.processor.php",$manager_theme));
728
+    break;
729 729
 /********************************************************************/
730 730
 /* system information                                               */
731 731
 /********************************************************************/
732
-	case 53:
733
-		// get the settings editor
734
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
735
-		include_once(includeFileProcessor("actions/sysinfo.static.php",$manager_theme));
736
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
737
-	break;
732
+    case 53:
733
+        // get the settings editor
734
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
735
+        include_once(includeFileProcessor("actions/sysinfo.static.php",$manager_theme));
736
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
737
+    break;
738 738
 /********************************************************************/
739 739
 /* optimise table                                               */
740 740
 /********************************************************************/
741
-	case 54:
742
-		// get the table optimizer/truncate processor
743
-		include_once(includeFileProcessor("processors/optimize_table.processor.php",$manager_theme));
744
-	break;
741
+    case 54:
742
+        // get the table optimizer/truncate processor
743
+        include_once(includeFileProcessor("processors/optimize_table.processor.php",$manager_theme));
744
+    break;
745 745
 /********************************************************************/
746 746
 /* view logging                                                     */
747 747
 /********************************************************************/
748
-	case 13:
749
-		// view logging
750
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
751
-		include_once(includeFileProcessor("actions/logging.static.php",$manager_theme));
752
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
753
-	break;
748
+    case 13:
749
+        // view logging
750
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
751
+        include_once(includeFileProcessor("actions/logging.static.php",$manager_theme));
752
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
753
+    break;
754 754
 /********************************************************************/
755 755
 /* empty logs                                                       */
756 756
 /********************************************************************/
757
-	case 55:
758
-		// get the settings editor
759
-		include_once(includeFileProcessor("processors/empty_table.processor.php",$manager_theme));
760
-	break;
757
+    case 55:
758
+        // get the settings editor
759
+        include_once(includeFileProcessor("processors/empty_table.processor.php",$manager_theme));
760
+    break;
761 761
 /********************************************************************/
762 762
 /* calls test page                                                      */
763 763
 /********************************************************************/
764
-	case 999:
765
-		// get the test page
766
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
767
-		include_once(includeFileProcessor("test_page.php",$manager_theme));
768
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
769
-	break;
764
+    case 999:
765
+        // get the test page
766
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
767
+        include_once(includeFileProcessor("test_page.php",$manager_theme));
768
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
769
+    break;
770 770
 /********************************************************************/
771 771
 /* Empty recycle bin                                                */
772 772
 /********************************************************************/
773
-	case 64:
774
-		// get the Recycle bin emptier
775
-		include_once(includeFileProcessor("processors/remove_content.processor.php",$manager_theme));
776
-	break;
773
+    case 64:
774
+        // get the Recycle bin emptier
775
+        include_once(includeFileProcessor("processors/remove_content.processor.php",$manager_theme));
776
+    break;
777 777
 /********************************************************************/
778 778
 /* Messages                                                     */
779 779
 /********************************************************************/
780
-	case 10:
781
-		// get the messages page
782
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
783
-		include_once(includeFileProcessor("actions/messages.static.php",$manager_theme));
784
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
785
-	break;
780
+    case 10:
781
+        // get the messages page
782
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
783
+        include_once(includeFileProcessor("actions/messages.static.php",$manager_theme));
784
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
785
+    break;
786 786
 /********************************************************************/
787 787
 /* Delete a message                                                 */
788 788
 /********************************************************************/
789
-	case 65:
790
-		// get the message deleter
791
-		include_once(includeFileProcessor("processors/delete_message.processor.php",$manager_theme));
792
-	break;
789
+    case 65:
790
+        // get the message deleter
791
+        include_once(includeFileProcessor("processors/delete_message.processor.php",$manager_theme));
792
+    break;
793 793
 /********************************************************************/
794 794
 /* Send a message                                                   */
795 795
 /********************************************************************/
796
-	case 66:
797
-		// get the message deleter
798
-		include_once(includeFileProcessor("processors/send_message.processor.php",$manager_theme));
799
-	break;
796
+    case 66:
797
+        // get the message deleter
798
+        include_once(includeFileProcessor("processors/send_message.processor.php",$manager_theme));
799
+    break;
800 800
 /********************************************************************/
801 801
 /* Remove locks                                                 */
802 802
 /********************************************************************/
803
-	case 67:
804
-		// get the lock remover
805
-		include_once(includeFileProcessor("processors/remove_locks.processor.php",$manager_theme));
806
-	break;
803
+    case 67:
804
+        // get the lock remover
805
+        include_once(includeFileProcessor("processors/remove_locks.processor.php",$manager_theme));
806
+    break;
807 807
 /********************************************************************/
808 808
 /* Site schedule                                                    */
809 809
 /********************************************************************/
810
-	case 70:
811
-		// get the schedule page
812
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
813
-		include_once(includeFileProcessor("actions/site_schedule.static.php",$manager_theme));
814
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
815
-	break;
810
+    case 70:
811
+        // get the schedule page
812
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
813
+        include_once(includeFileProcessor("actions/site_schedule.static.php",$manager_theme));
814
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
815
+    break;
816 816
 /********************************************************************/
817 817
 /* Search                                                           */
818 818
 /********************************************************************/
819
-	case 71:
820
-		// get the search page
821
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
822
-		include_once(includeFileProcessor("actions/search.static.php",$manager_theme));
823
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
824
-	break;
819
+    case 71:
820
+        // get the search page
821
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
822
+        include_once(includeFileProcessor("actions/search.static.php",$manager_theme));
823
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
824
+    break;
825 825
 /********************************************************************/
826 826
 /* About                                                            */
827 827
 /********************************************************************/
828
-	case 59:
829
-		// get the about page
830
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
831
-		include_once(includeFileProcessor("actions/about.static.php",$manager_theme));
832
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
833
-	break;
828
+    case 59:
829
+        // get the about page
830
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
831
+        include_once(includeFileProcessor("actions/about.static.php",$manager_theme));
832
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
833
+    break;
834 834
 /********************************************************************/
835 835
 /* Add weblink                                                          */
836 836
 /********************************************************************/
837
-	case 72:
838
-		// get the weblink page
839
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
840
-		include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme));
841
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
842
-	break;
837
+    case 72:
838
+        // get the weblink page
839
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
840
+        include_once(includeFileProcessor("actions/mutate_content.dynamic.php",$manager_theme));
841
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
842
+    break;
843 843
 /********************************************************************/
844 844
 /* User management                                                  */
845 845
 /********************************************************************/
846
-	case 75:
847
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
848
-		include_once(includeFileProcessor("actions/user_management.static.php",$manager_theme));
849
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
850
-	break;
851
-	case 99:
852
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
853
-		include_once(includeFileProcessor("actions/web_user_management.static.php",$manager_theme));
854
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
855
-	break;
856
-	case 86:
857
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
858
-		include_once(includeFileProcessor("actions/role_management.static.php",$manager_theme));
859
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
860
-	break;
846
+    case 75:
847
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
848
+        include_once(includeFileProcessor("actions/user_management.static.php",$manager_theme));
849
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
850
+    break;
851
+    case 99:
852
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
853
+        include_once(includeFileProcessor("actions/web_user_management.static.php",$manager_theme));
854
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
855
+    break;
856
+    case 86:
857
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
858
+        include_once(includeFileProcessor("actions/role_management.static.php",$manager_theme));
859
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
860
+    break;
861 861
 /********************************************************************/
862 862
 /* template/ snippet management                                                 */
863 863
 /********************************************************************/
864
-	case 76:
865
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
866
-		include_once(includeFileProcessor("actions/resources.static.php",$manager_theme));
867
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
868
-	break;
864
+    case 76:
865
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
866
+        include_once(includeFileProcessor("actions/resources.static.php",$manager_theme));
867
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
868
+    break;
869 869
 /********************************************************************/
870 870
 /* Export to file                                                   */
871 871
 /********************************************************************/
872
-	case 83:
873
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
874
-		include_once(includeFileProcessor("actions/export_site.static.php",$manager_theme));
875
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
876
-	break;
872
+    case 83:
873
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
874
+        include_once(includeFileProcessor("actions/export_site.static.php",$manager_theme));
875
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
876
+    break;
877 877
 /********************************************************************/
878 878
 /* Resource Selector                                                    */
879 879
 /********************************************************************/
880
-	case 84:
881
-		include_once(includeFileProcessor("actions/resource_selector.static.php",$manager_theme));
882
-	break;
880
+    case 84:
881
+        include_once(includeFileProcessor("actions/resource_selector.static.php",$manager_theme));
882
+    break;
883 883
 /********************************************************************/
884 884
 /* Backup Manager                                                   */
885 885
 /********************************************************************/
886
-	case 93:
887
-		# header and footer will be handled interally
888
-		include_once(includeFileProcessor("actions/bkmanager.static.php",$manager_theme));
889
-	break;
886
+    case 93:
887
+        # header and footer will be handled interally
888
+        include_once(includeFileProcessor("actions/bkmanager.static.php",$manager_theme));
889
+    break;
890 890
 /********************************************************************/
891 891
 /* Duplicate Document                                                   */
892 892
 /********************************************************************/
893
-	case 94:
894
-		// get the duplicate processor
895
-		include_once(includeFileProcessor("processors/duplicate_content.processor.php",$manager_theme));
896
-	break;
893
+    case 94:
894
+        // get the duplicate processor
895
+        include_once(includeFileProcessor("processors/duplicate_content.processor.php",$manager_theme));
896
+    break;
897 897
 /********************************************************************/
898 898
 /* Import Document from file                                        */
899 899
 /********************************************************************/
900
-	case 95:
901
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
902
-		include_once(includeFileProcessor("actions/import_site.static.php",$manager_theme));
903
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
904
-	break;
900
+    case 95:
901
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
902
+        include_once(includeFileProcessor("actions/import_site.static.php",$manager_theme));
903
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
904
+    break;
905 905
 /********************************************************************/
906 906
 /* Help                                                             */
907 907
 /********************************************************************/
908
-	case 9:
909
-		// get the help page
910
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
911
-		include_once(includeFileProcessor("actions/help.static.php",$manager_theme));
912
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
913
-	break;
908
+    case 9:
909
+        // get the help page
910
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
911
+        include_once(includeFileProcessor("actions/help.static.php",$manager_theme));
912
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
913
+    break;
914 914
 /********************************************************************/
915 915
 /* Template Variables - Based on Apodigm's Docvars                  */
916 916
 /********************************************************************/
917
-	case 300:
918
-		// get the new document variable action
919
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
920
-		include_once(includeFileProcessor("actions/mutate_tmplvars.dynamic.php",$manager_theme));
921
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
922
-	break;
923
-	case 301:
924
-		// get the edit document variable action
925
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
926
-		include_once(includeFileProcessor("actions/mutate_tmplvars.dynamic.php",$manager_theme));
927
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
928
-	break;
929
-	case 302:
930
-		// get the save processor
931
-		include_once(includeFileProcessor("processors/save_tmplvars.processor.php",$manager_theme));
932
-	break;
933
-	case 303:
934
-		// get the delete processor
935
-		include_once(includeFileProcessor("processors/delete_tmplvars.processor.php",$manager_theme));
936
-	break;
937
-	case 304:
938
-		// get the duplicate processor
939
-		include_once(includeFileProcessor("processors/duplicate_tmplvars.processor.php",$manager_theme));
940
-	break;
941
-	case 305:
942
-		// get the tv-rank action
943
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
944
-		include_once(includeFileProcessor("actions/mutate_tv_rank.dynamic.php",$manager_theme));
945
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
946
-	break;
917
+    case 300:
918
+        // get the new document variable action
919
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
920
+        include_once(includeFileProcessor("actions/mutate_tmplvars.dynamic.php",$manager_theme));
921
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
922
+    break;
923
+    case 301:
924
+        // get the edit document variable action
925
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
926
+        include_once(includeFileProcessor("actions/mutate_tmplvars.dynamic.php",$manager_theme));
927
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
928
+    break;
929
+    case 302:
930
+        // get the save processor
931
+        include_once(includeFileProcessor("processors/save_tmplvars.processor.php",$manager_theme));
932
+    break;
933
+    case 303:
934
+        // get the delete processor
935
+        include_once(includeFileProcessor("processors/delete_tmplvars.processor.php",$manager_theme));
936
+    break;
937
+    case 304:
938
+        // get the duplicate processor
939
+        include_once(includeFileProcessor("processors/duplicate_tmplvars.processor.php",$manager_theme));
940
+    break;
941
+    case 305:
942
+        // get the tv-rank action
943
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
944
+        include_once(includeFileProcessor("actions/mutate_tv_rank.dynamic.php",$manager_theme));
945
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
946
+    break;
947 947
 /********************************************************************/
948 948
 /* Event viewer: show event message log                             */
949 949
 /********************************************************************/
950
-	case 114:
951
-		// get event logs
952
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
953
-		include_once(includeFileProcessor("actions/eventlog.dynamic.php",$manager_theme));
954
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
955
-	break;
956
-	case 115:
957
-		// get event log details viewer
958
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
959
-		include_once(includeFileProcessor("actions/eventlog_details.dynamic.php",$manager_theme));
960
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
961
-	break;
962
-	case 116:
963
-		// get the event log delete processor
964
-		include_once(includeFileProcessor("processors/delete_eventlog.processor.php",$manager_theme));
965
-	break;
966
-
967
-	case 501:
968
-		//delete category
969
-		include_once(includeFileProcessor("processors/delete_category.processor.php",$manager_theme));
970
-	break;
950
+    case 114:
951
+        // get event logs
952
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
953
+        include_once(includeFileProcessor("actions/eventlog.dynamic.php",$manager_theme));
954
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
955
+    break;
956
+    case 115:
957
+        // get event log details viewer
958
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
959
+        include_once(includeFileProcessor("actions/eventlog_details.dynamic.php",$manager_theme));
960
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
961
+    break;
962
+    case 116:
963
+        // get the event log delete processor
964
+        include_once(includeFileProcessor("processors/delete_eventlog.processor.php",$manager_theme));
965
+    break;
966
+
967
+    case 501:
968
+        //delete category
969
+        include_once(includeFileProcessor("processors/delete_category.processor.php",$manager_theme));
970
+    break;
971 971
 /********************************************************************/
972 972
 /* default action: show not implemented message                     */
973 973
 /********************************************************************/
974
-	default :
975
-		// say that what was requested doesn't do anything yet
976
-		include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
977
-		echo "
974
+    default :
975
+        // say that what was requested doesn't do anything yet
976
+        include_once(includeFileProcessor("includes/header.inc.php",$manager_theme));
977
+        echo "
978 978
 			<div class='sectionHeader'>".$_lang['functionnotimpl']."</div>
979 979
 			<div class='sectionBody'>
980 980
 				<p>".$_lang['functionnotimpl_message']."</p>
981 981
 			</div>
982 982
 		";
983
-		include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
983
+        include_once(includeFileProcessor("includes/footer.inc.php",$manager_theme));
984 984
 }
985 985
 
986 986
 /********************************************************************/
987 987
 // log action, unless it's a frame request
988 988
 if($action!=1 && $action!=7 && $action!=2) {
989
-	$log = new EvolutionCMS\Legacy\LogHandler;
990
-	$log->initAndWriteLog();
989
+    $log = new EvolutionCMS\Legacy\LogHandler;
990
+    $log->initAndWriteLog();
991 991
 }
992 992
 /********************************************************************/
993 993
 // show debug
Please login to merge, or discard this patch.
manager/includes/extenders/phpcompat.class.inc.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
      * @param int $flags
11 11
      * @param string $encode
12 12
      * @param int $safecount
13
-     * @return string|array
13
+     * @return null|string
14 14
      */
15 15
     public function htmlspecialchars($str = '', $flags = ENT_COMPAT, $encode = '', $safecount = 0)
16 16
     {
Please login to merge, or discard this patch.
manager/includes/functions/actions/import.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -357,7 +357,7 @@
 block discarded – undo
357 357
 if(!function_exists('getFileContent')) {
358 358
     /**
359 359
      * @param string $filepath
360
-     * @return bool|string
360
+     * @return null|string
361 361
      */
362 362
     function getFileContent($filepath)
363 363
     {
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -114,9 +114,9 @@
 block discarded – undo
114 114
                 $field['menuindex'] = 1;
115 115
                 $find = false;
116 116
                 foreach (array(
117
-                             'index.html',
118
-                             'index.htm'
119
-                         ) as $filename) {
117
+                                'index.html',
118
+                                'index.htm'
119
+                            ) as $filename) {
120 120
                     $filepath = $filedir . $alias . '/' . $filename;
121 121
                     if ($find === false && file_exists($filepath)) {
122 122
                         $file = getFileContent($filepath);
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!function_exists('run')) {
2
+if (!function_exists('run')) {
3 3
     /**
4 4
      * @return string
5 5
      */
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
             $modx->db->query("ALTER TABLE {$tbl_site_content} AUTO_INCREMENT = 1");
29 29
         }
30 30
 
31
-        $parent = (int)$_POST['parent'];
31
+        $parent = (int) $_POST['parent'];
32 32
 
33
-        if (is_dir(MODX_BASE_PATH . 'temp/import')) {
34
-            $filedir = MODX_BASE_PATH . 'temp/import/';
35
-        } elseif (is_dir(MODX_BASE_PATH . 'assets/import')) {
36
-            $filedir = MODX_BASE_PATH . 'assets/import/';
33
+        if (is_dir(MODX_BASE_PATH.'temp/import')) {
34
+            $filedir = MODX_BASE_PATH.'temp/import/';
35
+        } elseif (is_dir(MODX_BASE_PATH.'assets/import')) {
36
+            $filedir = MODX_BASE_PATH.'assets/import/';
37 37
         } else {
38 38
             $filedir = '';
39 39
         }
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         $files = pop_index($files);
45 45
 
46 46
         // no. of files to import
47
-        $output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound);
47
+        $output .= sprintf('<p>'.$_lang['import_files_found'].'</p>', $filesfound);
48 48
 
49 49
         // import files
50 50
         if (0 < count($files)) {
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         $mtime = $mtime[1] + $mtime[0];
58 58
         $importend = $mtime;
59 59
         $totaltime = ($importend - $importstart);
60
-        $output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3));
60
+        $output .= sprintf('<p>'.$_lang['import_site_time'].'</p>', round($totaltime, 3));
61 61
 
62 62
         if ($_POST['convert_link'] == 'on') {
63 63
             convertLink();
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     }
68 68
 }
69 69
 
70
-if(!function_exists('importFiles')) {
70
+if (!function_exists('importFiles')) {
71 71
     /**
72 72
      * @param int $parent
73 73
      * @param string $filedir
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             if (is_array($value)) {
99 99
                 // create folder
100 100
                 $alias = $id;
101
-                printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias);
101
+                printf('<span>'.$_lang['import_site_importing_document'].'</span>', $alias);
102 102
                 $field = array();
103 103
                 $field['type'] = 'document';
104 104
                 $field['contentType'] = 'text/html';
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
                              'index.html',
118 118
                              'index.htm'
119 119
                          ) as $filename) {
120
-                    $filepath = $filedir . $alias . '/' . $filename;
120
+                    $filepath = $filedir.$alias.'/'.$filename;
121 121
                     if ($find === false && file_exists($filepath)) {
122 122
                         $file = getFileContent($filepath);
123 123
                         list($pagetitle, $content, $description) = treatContent($file, $filename, $alias);
@@ -132,10 +132,10 @@  discard block
 block discarded – undo
132 132
                         $newid = $modx->db->insert($field, $tbl_site_content);
133 133
                         if ($newid) {
134 134
                             $find = true;
135
-                            echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
136
-                            importFiles($newid, $filedir . $alias . '/', $value, 'sub');
135
+                            echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n";
136
+                            importFiles($newid, $filedir.$alias.'/', $value, 'sub');
137 137
                         } else {
138
-                            echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError();
138
+                            echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError();
139 139
                             exit;
140 140
                         }
141 141
                     }
@@ -150,10 +150,10 @@  discard block
 block discarded – undo
150 150
                     $newid = $modx->db->insert($field, $tbl_site_content);
151 151
                     if ($newid) {
152 152
                         $find = true;
153
-                        echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
154
-                        importFiles($newid, $filedir . $alias . '/', $value, 'sub');
153
+                        echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n";
154
+                        importFiles($newid, $filedir.$alias.'/', $value, 'sub');
155 155
                     } else {
156
-                        echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError();
156
+                        echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError();
157 157
                         exit;
158 158
                     }
159 159
                 }
@@ -166,12 +166,12 @@  discard block
 block discarded – undo
166 166
                 $fparts = explode('.', $value);
167 167
                 $alias = $fparts[0];
168 168
                 $ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : "";
169
-                printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename);
169
+                printf("<span>".$_lang['import_site_importing_document']."</span>", $filename);
170 170
 
171 171
                 if (!in_array($ext, $allowedfiles)) {
172
-                    echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n";
172
+                    echo ' - <span class="fail">'.$_lang["import_site_skip"].'</span><br />'."\n";
173 173
                 } else {
174
-                    $filepath = $filedir . $filename;
174
+                    $filepath = $filedir.$filename;
175 175
                     $file = getFileContent($filepath);
176 176
                     list($pagetitle, $content, $description) = treatContent($file, $filename, $alias);
177 177
 
@@ -197,9 +197,9 @@  discard block
 block discarded – undo
197 197
                     $field['menuindex'] = ($alias == 'index') ? 0 : 2;
198 198
                     $newid = $modx->db->insert($field, $tbl_site_content);
199 199
                     if ($newid) {
200
-                        echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
200
+                        echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n";
201 201
                     } else {
202
-                        echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError();
202
+                        echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError();
203 203
                         exit;
204 204
                     }
205 205
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
     }
219 219
 }
220 220
 
221
-if(!function_exists('getFiles')) {
221
+if (!function_exists('getFiles')) {
222 222
     /**
223 223
      * @param string $directory
224 224
      * @param array $listing
@@ -234,10 +234,10 @@  discard block
 block discarded – undo
234 234
             foreach ($files as $file) {
235 235
                 if ($file == '.' || $file == '..') {
236 236
                     continue;
237
-                } elseif ($h = @opendir($directory . $file . "/")) {
237
+                } elseif ($h = @opendir($directory.$file."/")) {
238 238
                     closedir($h);
239 239
                     $count = -1;
240
-                    $listing[$file] = getFiles($directory . $file . "/", array(), $count + 1);
240
+                    $listing[$file] = getFiles($directory.$file."/", array(), $count + 1);
241 241
                 } elseif (strpos($file, '.htm') !== false) {
242 242
                     $listing[$dummy] = $file;
243 243
                     $dummy = $dummy + 1;
@@ -245,14 +245,14 @@  discard block
 block discarded – undo
245 245
                 }
246 246
             }
247 247
         } else {
248
-            echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>";
248
+            echo '<p><span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_no_open_dir"].$directory.".</p>";
249 249
         }
250 250
 
251 251
         return ($listing);
252 252
     }
253 253
 }
254 254
 
255
-if(!function_exists('getFileContent')) {
255
+if (!function_exists('getFileContent')) {
256 256
     /**
257 257
      * @param string $filepath
258 258
      * @return bool|string
@@ -262,14 +262,14 @@  discard block
 block discarded – undo
262 262
         global $_lang;
263 263
         // get the file
264 264
         if (!$buffer = file_get_contents($filepath)) {
265
-            echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>";
265
+            echo '<p><span class="fail">'.$_lang['import_site_failed']."</span> ".$_lang["import_site_failed_no_retrieve_file"].$filepath.".</p>";
266 266
         } else {
267 267
             return $buffer;
268 268
         }
269 269
     }
270 270
 }
271 271
 
272
-if(!function_exists('pop_index')) {
272
+if (!function_exists('pop_index')) {
273 273
     /**
274 274
      * @param array $array
275 275
      * @return array
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
     }
295 295
 }
296 296
 
297
-if(!function_exists('treatContent')) {
297
+if (!function_exists('treatContent')) {
298 298
     /**
299 299
      * @param string $src
300 300
      * @param string $filename
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
         } else {
330 330
             $content = $src;
331 331
             $s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i';
332
-            $r = '$1' . $modx->config['modx_charset'] . '$2';
332
+            $r = '$1'.$modx->config['modx_charset'].'$2';
333 333
             $content = preg_replace($s, $r, $content);
334 334
             $content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content);
335 335
         }
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
     }
346 346
 }
347 347
 
348
-if(!function_exists('convertLink')) {
348
+if (!function_exists('convertLink')) {
349 349
     /**
350 350
      * @return void
351 351
      */
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
                     list($href, $v) = explode('"', $v, 2);
369 369
                     $_ = $href;
370 370
                     if (strpos($_, $modx->config['site_url']) !== false) {
371
-                        $_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_);
371
+                        $_ = $modx->config['base_url'].str_replace($modx->config['site_url'], '', $_);
372 372
                     }
373 373
                     if ($_[0] === '/') {
374 374
                         $_ = substr($_, 1);
@@ -395,15 +395,15 @@  discard block
 block discarded – undo
395 395
                     if (strpos($_, '/') !== false) {
396 396
                         $_ = substr($_, strrpos($_, '/'));
397 397
                     }
398
-                    $_ = $dir . str_replace('.html', '', $_);
398
+                    $_ = $dir.str_replace('.html', '', $_);
399 399
                     if (!isset($target[$_])) {
400 400
                         $target[$_] = $modx->getIdFromAlias($_);
401 401
                     }
402 402
                     $target[$_] = trim($target[$_]);
403 403
                     if (!empty($target[$_])) {
404
-                        $href = '[~' . $target[$_] . '~]';
404
+                        $href = '[~'.$target[$_].'~]';
405 405
                     }
406
-                    $array[$c] = '<a href="' . $href . '"' . $v;
406
+                    $array[$c] = '<a href="'.$href.'"'.$v;
407 407
                 }
408 408
                 $c++;
409 409
             }
Please login to merge, or discard this patch.
manager/includes/src/Core.php 3 patches
Doc Comments   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
      * MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php"
267 267
      * $extname - extension name in lowercase
268 268
      *
269
-     * @param $extname
269
+     * @param string $extname
270 270
      * @param bool $reload
271 271
      * @return bool
272 272
      */
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
      * @param int $count_attempts
310 310
      * @param string $type $type
311 311
      * @param string $responseCode
312
-     * @return bool|null
312
+     * @return false|null
313 313
      * @global string $base_url
314 314
      * @global string $site_url
315 315
      */
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
     }
1011 1011
 
1012 1012
     /**
1013
-     * @param $contents
1013
+     * @param string $contents
1014 1014
      * @return mixed
1015 1015
      */
1016 1016
     public function RecoveryEscapedTags($contents)
@@ -1034,7 +1034,7 @@  discard block
 block discarded – undo
1034 1034
     }
1035 1035
 
1036 1036
     /**
1037
-     * @param $tstart
1037
+     * @param double $tstart
1038 1038
      * @return array
1039 1039
      */
1040 1040
     public function getTimerStats($tstart)
@@ -1800,7 +1800,7 @@  discard block
 block discarded – undo
1800 1800
 
1801 1801
     /**
1802 1802
      * Remove Comment-Tags from output like <!--@- Comment -@-->
1803
-     * @param $content
1803
+     * @param string $content
1804 1804
      * @param string $left
1805 1805
      * @param string $right
1806 1806
      * @return mixed
@@ -1973,7 +1973,7 @@  discard block
 block discarded – undo
1973 1973
     /**
1974 1974
      * Run snippets as per the tags in $documentSource and replace the tags with the returned values.
1975 1975
      *
1976
-     * @param $content
1976
+     * @param string $content
1977 1977
      * @return string
1978 1978
      * @internal param string $documentSource
1979 1979
      */
@@ -3008,7 +3008,7 @@  discard block
 block discarded – undo
3008 3008
 
3009 3009
     /**
3010 3010
      * @param $templateID
3011
-     * @return mixed
3011
+     * @return string
3012 3012
      */
3013 3013
     public function _getTemplateCodeFromDB($templateID)
3014 3014
     {
@@ -3051,7 +3051,7 @@  discard block
 block discarded – undo
3051 3051
     /**
3052 3052
      * @param $id
3053 3053
      * @param int $top
3054
-     * @return mixed
3054
+     * @return string
3055 3055
      */
3056 3056
     public function getUltimateParentId($id, $top = 0)
3057 3057
     {
@@ -3391,7 +3391,7 @@  discard block
 block discarded – undo
3391 3391
      *
3392 3392
      * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role
3393 3393
      * @param int $id Element- / Resource-id
3394
-     * @return bool
3394
+     * @return false|null
3395 3395
      */
3396 3396
     public function lockElement($type, $id)
3397 3397
     {
@@ -3413,7 +3413,7 @@  discard block
 block discarded – undo
3413 3413
      * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role
3414 3414
      * @param int $id Element- / Resource-id
3415 3415
      * @param bool $includeAllUsers true = Deletes not only own user-locks
3416
-     * @return bool
3416
+     * @return false|null
3417 3417
      */
3418 3418
     public function unlockElement($type, $id, $includeAllUsers = false)
3419 3419
     {
@@ -3927,7 +3927,7 @@  discard block
 block discarded – undo
3927 3927
      *                     Default: 1
3928 3928
      * @param string $fields List of fields
3929 3929
      *                       Default: id, pagetitle, description, alias
3930
-     * @return boolean|array
3930
+     * @return string
3931 3931
      */
3932 3932
     public function getPageInfo($pageid = -1, $active = 1, $fields = 'id, pagetitle, description, alias')
3933 3933
     {
@@ -4019,7 +4019,7 @@  discard block
 block discarded – undo
4019 4019
      *
4020 4020
      * @param string $type
4021 4021
      * @param bool $report
4022
-     * @return bool
4022
+     * @return boolean|null
4023 4023
      */
4024 4024
     public function clearCache($type = '', $report = false)
4025 4025
     {
@@ -4385,7 +4385,7 @@  discard block
 block discarded – undo
4385 4385
      * - Placeholders prefix. Default: '{'.
4386 4386
      * @param string $suffix {string}
4387 4387
      * - Placeholders suffix. Default: '}'.
4388
-     * @return bool|mixed|string {string; false} - Parsed chunk or false if $chunkArr is not array.
4388
+     * @return false|string {string; false} - Parsed chunk or false if $chunkArr is not array.
4389 4389
      * - Parsed chunk or false if $chunkArr is not array.
4390 4390
      */
4391 4391
     public function parseChunk($chunkName, $chunkArr, $prefix = '{', $suffix = '}')
@@ -5357,7 +5357,7 @@  discard block
 block discarded – undo
5357 5357
      * Remove event listener - only for use within the current execution cycle
5358 5358
      *
5359 5359
      * @param string $evtName
5360
-     * @return boolean
5360
+     * @return false|null
5361 5361
      */
5362 5362
     public function removeEventListener($evtName)
5363 5363
     {
@@ -5381,7 +5381,7 @@  discard block
 block discarded – undo
5381 5381
      *
5382 5382
      * @param string $evtName
5383 5383
      * @param array $extParams Parameters available to plugins. Each array key will be the PHP variable name, and the array value will be the variable value.
5384
-     * @return boolean|array
5384
+     * @return false|null
5385 5385
      */
5386 5386
     public function invokeEvent($evtName, $extParams = array())
5387 5387
     {
@@ -5976,7 +5976,7 @@  discard block
 block discarded – undo
5976 5976
 
5977 5977
     /**
5978 5978
      * @param string $str
5979
-     * @return bool|mixed|string
5979
+     * @return string
5980 5980
      */
5981 5981
     public function atBindFileContent($str = '')
5982 5982
     {
@@ -6027,8 +6027,8 @@  discard block
 block discarded – undo
6027 6027
     }
6028 6028
 
6029 6029
     /**
6030
-     * @param $str
6031
-     * @return bool|string
6030
+     * @param string $str
6031
+     * @return false|string
6032 6032
      */
6033 6033
     public function getExtFromFilename($str)
6034 6034
     {
@@ -6056,7 +6056,7 @@  discard block
 block discarded – undo
6056 6056
      * @param string $text Error message
6057 6057
      * @param string $file File where the error was detected
6058 6058
      * @param string $line Line number within $file
6059
-     * @return boolean
6059
+     * @return boolean|null
6060 6060
      */
6061 6061
     public function phpError($nr, $text, $file, $line)
6062 6062
     {
@@ -6108,7 +6108,7 @@  discard block
 block discarded – undo
6108 6108
      * @param string $text
6109 6109
      * @param string $line
6110 6110
      * @param string $output
6111
-     * @return bool
6111
+     * @return null|boolean
6112 6112
      */
6113 6113
     public function messageQuit($msg = 'unspecified error', $query = '', $is_error = true, $nr = '', $file = '', $source = '', $text = '', $line = '', $output = '')
6114 6114
     {
@@ -6523,7 +6523,7 @@  discard block
 block discarded – undo
6523 6523
 
6524 6524
     /**
6525 6525
      * @param string $str
6526
-     * @return bool|mixed|string
6526
+     * @return string
6527 6527
      */
6528 6528
     public function atBindInclude($str = '')
6529 6529
     {
@@ -6574,7 +6574,7 @@  discard block
 block discarded – undo
6574 6574
      * @param $str
6575 6575
      * @param int $flags
6576 6576
      * @param string $encode
6577
-     * @return mixed
6577
+     * @return null|string
6578 6578
      */
6579 6579
     public function htmlspecialchars($str, $flags = ENT_COMPAT, $encode = '')
6580 6580
     {
@@ -6583,7 +6583,7 @@  discard block
 block discarded – undo
6583 6583
     }
6584 6584
 
6585 6585
     /**
6586
-     * @param $string
6586
+     * @param string $string
6587 6587
      * @param bool $returnData
6588 6588
      * @return bool|mixed
6589 6589
      */
Please login to merge, or discard this patch.
Braces   +60 added lines, -30 removed lines patch added patch discarded remove patch
@@ -710,13 +710,15 @@  discard block
 block discarded – undo
710 710
             $this->virtualDir = '';
711 711
         }
712 712
 
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 */
713
+        if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) {
714
+/* we got an ID returned, check to make sure it's not an alias */
714 715
             /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */
715 716
             if ($this->config['use_alias_path'] == 1) {
716 717
                 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 718
                     $this->documentMethod = 'id';
718 719
                     return $q;
719
-                } else { /* not a valid id in terms of virtualDir, treat as alias */
720
+                } else {
721
+/* not a valid id in terms of virtualDir, treat as alias */
720 722
                     $this->documentMethod = 'alias';
721 723
                     return $q;
722 724
                 }
@@ -724,7 +726,8 @@  discard block
 block discarded – undo
724 726
                 $this->documentMethod = 'id';
725 727
                 return $q;
726 728
             }
727
-        } else { /* we didn't get an ID back, so instead we assume it's an alias */
729
+        } else {
730
+/* we didn't get an ID back, so instead we assume it's an alias */
728 731
             if ($this->config['friendly_alias_urls'] != 1) {
729 732
                 $q = $qOrig;
730 733
             }
@@ -754,13 +757,14 @@  discard block
 block discarded – undo
754 757
      * @param $id
755 758
      * @return array|mixed|null|string
756 759
      */
757
-    public function makePageCacheKey($id){
760
+    public function makePageCacheKey($id)
761
+    {
758 762
         $hash = $id;
759 763
         $tmp = null;
760 764
         $params = array();
761
-        if(!empty($this->systemCacheKey)){
765
+        if(!empty($this->systemCacheKey)) {
762 766
             $hash = $this->systemCacheKey;
763
-        }else {
767
+        } else {
764 768
             if (!empty($_GET)) {
765 769
                 // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID.
766 770
                 $params = $_GET;
@@ -769,7 +773,7 @@  discard block
 block discarded – undo
769 773
             }
770 774
         }
771 775
         $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params));
772
-        if (is_array($evtOut) && count($evtOut) > 0){
776
+        if (is_array($evtOut) && count($evtOut) > 0) {
773 777
             $tmp = array_pop($evtOut);
774 778
         }
775 779
         return empty($tmp) ? $hash : $tmp;
@@ -1096,7 +1100,8 @@  discard block
 block discarded – undo
1096 1100
         $where = "pub_date <= {$timeNow} AND pub_date!=0 AND published=0";
1097 1101
         $result_pub = $this->db->select( 'id', '[+prefix+]site_content',  $where);
1098 1102
         $this->db->update($field, '[+prefix+]site_content', $where);
1099
-        if ($this->db->getRecordCount($result_pub) >= 1) { //Event unPublished doc
1103
+        if ($this->db->getRecordCount($result_pub) >= 1) {
1104
+//Event unPublished doc
1100 1105
             while ($row_pub = $this->db->getRow($result_pub)) {
1101 1106
                 $this->invokeEvent("OnDocUnPublished", array(
1102 1107
                     "docid" => $row_pub['id']
@@ -1109,7 +1114,8 @@  discard block
 block discarded – undo
1109 1114
         $where = "unpub_date <= {$timeNow} AND unpub_date!=0 AND published=1";
1110 1115
         $result_unpub = $this->db->select( 'id', '[+prefix+]site_content',  $where);
1111 1116
         $this->db->update($field, '[+prefix+]site_content', $where);
1112
-        if ($this->db->getRecordCount($result_unpub) >= 1) { //Event unPublished doc
1117
+        if ($this->db->getRecordCount($result_unpub) >= 1) {
1118
+//Event unPublished doc
1113 1119
             while ($row_unpub = $this->db->getRow($result_unpub)) {
1114 1120
                 $this->invokeEvent("OnDocUnPublished", array(
1115 1121
                     "docid" => $row_unpub['id']
@@ -1196,10 +1202,18 @@  discard block
 block discarded – undo
1196 1202
             return array();
1197 1203
         }
1198 1204
         $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);
1205
+        if($left==='{{' && strpos($content,';}}')!==false) {
1206
+            $content = str_replace(';}}', sprintf(';}%s}',   $spacer),$content);
1207
+        }
1208
+        if($left==='{{' && strpos($content,'{{}}')!==false) {
1209
+            $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content);
1210
+        }
1211
+        if($left==='[[' && strpos($content,']]]]')!==false) {
1212
+            $content = str_replace(']]]]',sprintf(']]%s]]',  $spacer),$content);
1213
+        }
1214
+        if($left==='[[' && strpos($content,']]]')!==false) {
1215
+            $content = str_replace(']]]', sprintf(']%s]]',   $spacer),$content);
1216
+        }
1203 1217
 
1204 1218
         $pos['<![CDATA['] = strpos($content, '<![CDATA[');
1205 1219
         $pos[']]>'] = strpos($content, ']]>');
@@ -1252,7 +1266,8 @@  discard block
 block discarded – undo
1252 1266
                         }
1253 1267
                     }
1254 1268
 
1255
-                    if (!in_array($fetch, $tags)) {  // Avoid double Matches
1269
+                    if (!in_array($fetch, $tags)) {
1270
+// Avoid double Matches
1256 1271
                         $tags[] = $fetch; // Fetch
1257 1272
                     };
1258 1273
                     $fetch = ''; // and reset
@@ -1270,7 +1285,9 @@  discard block
 block discarded – undo
1270 1285
             }
1271 1286
         }
1272 1287
         foreach($tags as $i=>$tag) {
1273
-            if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag);
1288
+            if(strpos($tag,$spacer)!==false) {
1289
+                $tags[$i] = str_replace($spacer, '', $tag);
1290
+            }
1274 1291
         }
1275 1292
         return $tags;
1276 1293
     }
@@ -1310,7 +1327,10 @@  discard block
 block discarded – undo
1310 1327
         }
1311 1328
 
1312 1329
         foreach ($matches[1] as $i => $key) {
1313
-            if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1330
+            if(strpos($key,'[+')!==false) {
1331
+                continue;
1332
+            }
1333
+            // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1314 1334
             if (substr($key, 0, 1) == '#') {
1315 1335
                 $key = substr($key, 1);
1316 1336
             } // remove # for QuickEdit format
@@ -2033,7 +2053,8 @@  discard block
 block discarded – undo
2033 2053
      * @return mixed|string
2034 2054
      */
2035 2055
     public function _getSGVar($value)
2036
-    { // Get super globals
2056
+    {
2057
+// Get super globals
2037 2058
         $key = $value;
2038 2059
         $_ = $this->config['enable_filter'];
2039 2060
         $this->config['enable_filter'] = 1;
@@ -2438,7 +2459,8 @@  discard block
 block discarded – undo
2438 2459
         if ($this->config['friendly_urls'] == 1) {
2439 2460
             $aliases = array();
2440 2461
             if (is_array($this->documentListing)) {
2441
-                foreach ($this->documentListing as $path => $docid) { // This is big Loop on large site!
2462
+                foreach ($this->documentListing as $path => $docid) {
2463
+// This is big Loop on large site!
2442 2464
                     $aliases[$docid] = $path;
2443 2465
                     $isfolder[$docid] = $this->aliasListing[$docid]['isfolder'];
2444 2466
                 }
@@ -2471,7 +2493,7 @@  discard block
 block discarded – undo
2471 2493
             $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0);
2472 2494
             $pref = $this->config['friendly_url_prefix'];
2473 2495
             $suff = $this->config['friendly_url_suffix'];
2474
-            $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2496
+            $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff){
2475 2497
                 global $modx;
2476 2498
                 $thealias = $aliases[$m[1]];
2477 2499
                 $thefolder = $isfolder[$m[1]];
@@ -4255,7 +4277,8 @@  discard block
 block discarded – undo
4255 4277
         if (isset ($this->snippetCache[$snippetName])) {
4256 4278
             $snippet = $this->snippetCache[$snippetName];
4257 4279
             $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : '';
4258
-        } else { // not in cache so let's check the db
4280
+        } else {
4281
+// not in cache so let's check the db
4259 4282
             $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 4283
             $result = $this->db->query($sql);
4261 4284
             if ($this->db->getRecordCount($result) == 1) {
@@ -4756,7 +4779,7 @@  discard block
 block discarded – undo
4756 4779
             $result = $this->db->makeArray($rs);
4757 4780
 
4758 4781
             // get default/built-in template variables
4759
-            if(is_array($docRow)){
4782
+            if(is_array($docRow)) {
4760 4783
                 ksort($docRow);
4761 4784
 
4762 4785
                 foreach ($docRow as $key => $value) {
@@ -5231,12 +5254,16 @@  discard block
 block discarded – undo
5231 5254
             return '';
5232 5255
         } // nothing to register
5233 5256
         if (!is_array($options)) {
5234
-            if (is_bool($options))  // backward compatibility with old plaintext parameter
5257
+            if (is_bool($options)) {
5258
+                // backward compatibility with old plaintext parameter
5235 5259
             {
5236 5260
                 $options = array('plaintext' => $options);
5237
-            } elseif (is_string($options)) // Also allow script name as 2nd param
5261
+            }
5262
+            } elseif (is_string($options)) {
5263
+                // Also allow script name as 2nd param
5238 5264
             {
5239 5265
                 $options = array('name' => $options);
5266
+            }
5240 5267
             } else {
5241 5268
                 $options = array();
5242 5269
             }
@@ -5248,7 +5275,8 @@  discard block
 block discarded – undo
5248 5275
         unset($overwritepos); // probably unnecessary--just making sure
5249 5276
 
5250 5277
         $useThisVer = true;
5251
-        if (isset($this->loadedjscripts[$key])) { // a matching script was found
5278
+        if (isset($this->loadedjscripts[$key])) {
5279
+// a matching script was found
5252 5280
             // if existing script is a startup script, make sure the candidate is also a startup script
5253 5281
             if ($this->loadedjscripts[$key]['startup']) {
5254 5282
                 $startup = true;
@@ -5268,7 +5296,8 @@  discard block
 block discarded – undo
5268 5296
                     // overwrite the old script (the position may be important for dependent scripts)
5269 5297
                     $overwritepos = $this->loadedjscripts[$key]['pos'];
5270 5298
                 }
5271
-            } else { // Use the original version
5299
+            } else {
5300
+// Use the original version
5272 5301
                 if ($startup == true && $this->loadedjscripts[$key]['startup'] == false) {
5273 5302
                     // need to move the exisiting script to the head
5274 5303
                     $version = $this->loadedjscripts[$key][$version];
@@ -5393,7 +5422,8 @@  discard block
 block discarded – undo
5393 5422
         }
5394 5423
 
5395 5424
         $results = null;
5396
-        foreach ($this->pluginEvent[$evtName] as $pluginName) { // start for loop
5425
+        foreach ($this->pluginEvent[$evtName] as $pluginName) {
5426
+// start for loop
5397 5427
             if ($this->dumpPlugins) {
5398 5428
                 $eventtime = $this->getMicroTime();
5399 5429
             }
@@ -5538,8 +5568,7 @@  discard block
 block discarded – undo
5538 5568
                     }
5539 5569
                 }
5540 5570
             }
5541
-        }
5542
-        elseif(\is_array($propertyString)) {
5571
+        } elseif(\is_array($propertyString)) {
5543 5572
             $property = $propertyString;
5544 5573
         }
5545 5574
         if (!empty($elementName) && !empty($elementType)) {
@@ -5946,7 +5975,8 @@  discard block
 block discarded – undo
5946 5975
      * @return bool
5947 5976
      */
5948 5977
     public function isSafeCode($phpcode = '', $safe_functions = '')
5949
-    { // return true or false
5978
+    {
5979
+// return true or false
5950 5980
         if ($safe_functions == '') {
5951 5981
             return false;
5952 5982
         }
@@ -6355,7 +6385,7 @@  discard block
 block discarded – undo
6355 6385
             $args = array_pad(array(), $_, '$var');
6356 6386
             $args = implode(", ", $args);
6357 6387
             $modx = &$this;
6358
-            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) {
6388
+            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val){
6359 6389
                 $arg = $val['args'][$tmp - 1];
6360 6390
                 switch (true) {
6361 6391
                     case is_null($arg): {
Please login to merge, or discard this 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 = '';
@@ -5484,7 +5484,7 @@  discard block
 block discarded – undo
5484 5484
      */
5485 5485
     public function parseProperties($propertyString, $elementName = null, $elementType = null)
5486 5486
     {
5487
-        if(\is_scalar($propertyString)) {
5487
+        if (\is_scalar($propertyString)) {
5488 5488
             $property = array();
5489 5489
             $propertyString = trim($propertyString);
5490 5490
             $propertyString = str_replace('{}', '', $propertyString);
@@ -5539,7 +5539,7 @@  discard block
 block discarded – undo
5539 5539
                 }
5540 5540
             }
5541 5541
         }
5542
-        elseif(\is_array($propertyString)) {
5542
+        elseif (\is_array($propertyString)) {
5543 5543
             $property = $propertyString;
5544 5544
         }
5545 5545
         if (!empty($elementName) && !empty($elementType)) {
@@ -5570,7 +5570,7 @@  discard block
 block discarded – undo
5570 5570
     public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false)
5571 5571
     {
5572 5572
         $params = array();
5573
-        $fullpath = $element_dir . '/' . $filename;
5573
+        $fullpath = $element_dir.'/'.$filename;
5574 5574
         if (is_readable($fullpath)) {
5575 5575
             $tpl = @fopen($fullpath, "r");
5576 5576
             if ($tpl) {
@@ -5737,8 +5737,8 @@  discard block
 block discarded – undo
5737 5737
         $ph = array('site_url' => MODX_SITE_URL);
5738 5738
         $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/";
5739 5739
         $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';
5740
-        $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : '';
5741
-        $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : '';
5740
+        $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : '';
5741
+        $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : '';
5742 5742
         foreach ($parsed as $key => $val) {
5743 5743
             if (is_array($val)) {
5744 5744
                 foreach ($val as $key2 => $val2) {
@@ -5747,7 +5747,7 @@  discard block
 block discarded – undo
5747 5747
                         $val2 = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val2);
5748 5748
                     }
5749 5749
                     if (preg_match($regexEmail, $val2, $url)) {
5750
-                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2);
5750
+                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2);
5751 5751
                     }
5752 5752
                     $parsed[$key][$key2] = $val2;
5753 5753
                 }
@@ -5757,7 +5757,7 @@  discard block
 block discarded – undo
5757 5757
                     $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val);
5758 5758
                 }
5759 5759
                 if (preg_match($regexEmail, $val, $url)) {
5760
-                    $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val);
5760
+                    $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val);
5761 5761
                 }
5762 5762
                 $parsed[$key] = $val;
5763 5763
             }
@@ -5771,32 +5771,32 @@  discard block
 block discarded – undo
5771 5771
         );
5772 5772
 
5773 5773
         $nl = "\n";
5774
-        $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'], "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : '';
5775
-        $list .= '<p>' . $nl;
5776
-        $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : '';
5777
-        $list .= isset($parsed['description']) ? $parsed['description'] . $nl : '';
5778
-        $list .= '</p><br/>' . $nl;
5779
-        $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : '';
5780
-        $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : '';
5781
-        $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : '';
5782
-        $list .= '<br/>' . $nl;
5774
+        $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'], "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : '';
5775
+        $list .= '<p>'.$nl;
5776
+        $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : '';
5777
+        $list .= isset($parsed['description']) ? $parsed['description'].$nl : '';
5778
+        $list .= '</p><br/>'.$nl;
5779
+        $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : '';
5780
+        $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : '';
5781
+        $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : '';
5782
+        $list .= '<br/>'.$nl;
5783 5783
         $first = true;
5784 5784
         foreach ($arrayParams as $param => $label) {
5785 5785
             if (isset($parsed[$param])) {
5786 5786
                 if ($first) {
5787
-                    $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl;
5788
-                    $list .= '<ul class="docBlockList">' . $nl;
5787
+                    $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl;
5788
+                    $list .= '<ul class="docBlockList">'.$nl;
5789 5789
                     $first = false;
5790 5790
                 }
5791
-                $list .= '    <li><strong>' . $label . '</strong>' . $nl;
5792
-                $list .= '        <ul>' . $nl;
5791
+                $list .= '    <li><strong>'.$label.'</strong>'.$nl;
5792
+                $list .= '        <ul>'.$nl;
5793 5793
                 foreach ($parsed[$param] as $val) {
5794
-                    $list .= '            <li>' . $val . '</li>' . $nl;
5794
+                    $list .= '            <li>'.$val.'</li>'.$nl;
5795 5795
                 }
5796
-                $list .= '        </ul></li>' . $nl;
5796
+                $list .= '        </ul></li>'.$nl;
5797 5797
             }
5798 5798
         }
5799
-        $list .= !$first ? '</ul>' . $nl : '';
5799
+        $list .= !$first ? '</ul>'.$nl : '';
5800 5800
 
5801 5801
         return $list;
5802 5802
     }
@@ -5874,8 +5874,8 @@  discard block
 block discarded – undo
5874 5874
      */
5875 5875
     public function addSnippet($name, $phpCode, $namespace = '#', array $defaultParams = array())
5876 5876
     {
5877
-        $this->snippetCache[$namespace . $name] = $phpCode;
5878
-        $this->snippetCache[$namespace . $name . 'Props'] = $defaultParams;
5877
+        $this->snippetCache[$namespace.$name] = $phpCode;
5878
+        $this->snippetCache[$namespace.$name.'Props'] = $defaultParams;
5879 5879
     }
5880 5880
 
5881 5881
     /**
@@ -5885,7 +5885,7 @@  discard block
 block discarded – undo
5885 5885
      */
5886 5886
     public function addChunk($name, $text, $namespace = '#')
5887 5887
     {
5888
-        $this->chunkCache[$namespace . $name] = $text;
5888
+        $this->chunkCache[$namespace.$name] = $text;
5889 5889
     }
5890 5890
 
5891 5891
     /**
@@ -5899,7 +5899,7 @@  discard block
 block discarded – undo
5899 5899
     {
5900 5900
         $out = array();
5901 5901
 
5902
-        if (! is_dir($scanPath) || empty($ext)) {
5902
+        if (!is_dir($scanPath) || empty($ext)) {
5903 5903
             return $out;
5904 5904
         }
5905 5905
         $iterator = new \RecursiveIteratorIterator(
@@ -5911,17 +5911,17 @@  discard block
 block discarded – undo
5911 5911
              * @var \SplFileInfo $item
5912 5912
              */
5913 5913
             if ($item->isFile() && $item->isReadable() && \in_array($item->getExtension(), $ext)) {
5914
-                $name = $item->getBasename('.' . $item->getExtension());
5915
-                $path = str_replace($scanPath, '', $item->getPath() . '/');
5914
+                $name = $item->getBasename('.'.$item->getExtension());
5915
+                $path = str_replace($scanPath, '', $item->getPath().'/');
5916 5916
                 if (!empty($path)) {
5917
-                    $name = str_replace('/', '\\', $path) . $name;
5917
+                    $name = str_replace('/', '\\', $path).$name;
5918 5918
                 }
5919 5919
                 switch ($type) {
5920 5920
                     case 'chunk':
5921 5921
                         $out[$name] = file_get_contents($item->getRealPath());
5922 5922
                         break;
5923 5923
                     case 'snippet':
5924
-                        $out[$name] = "return require '" . $item->getRealPath() . "';";
5924
+                        $out[$name] = "return require '".$item->getRealPath()."';";
5925 5925
                         break;
5926 5926
                     default:
5927 5927
                         throw new \Exception;
@@ -5965,7 +5965,7 @@  discard block
 block discarded – undo
5965 5965
         }
5966 5966
 
5967 5967
         if (!$isSafe) {
5968
-            $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true);
5968
+            $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true);
5969 5969
             $title = sprintf('Unknown eval was executed (%s)', $this->htmlspecialchars(substr(trim($phpcode), 0, 50)));
5970 5970
             $this->messageQuit($title, '', true, '', '', 'Parser', $msg);
5971 5971
             return;
@@ -5979,7 +5979,7 @@  discard block
 block discarded – undo
5979 5979
             return 'array()';
5980 5980
         }
5981 5981
 
5982
-        $output = $echo . $return;
5982
+        $output = $echo.$return;
5983 5983
         modx_sanitize_gpc($output);
5984 5984
         return $this->htmlspecialchars($output); // Maybe, all html tags are dangerous
5985 5985
     }
@@ -5997,8 +5997,8 @@  discard block
 block discarded – undo
5997 5997
 
5998 5998
         $safe = explode(',', $safe_functions);
5999 5999
 
6000
-        $phpcode = rtrim($phpcode, ';') . ';';
6001
-        $tokens = token_get_all('<?php ' . $phpcode);
6000
+        $phpcode = rtrim($phpcode, ';').';';
6001
+        $tokens = token_get_all('<?php '.$phpcode);
6002 6002
         foreach ($tokens as $i => $token) {
6003 6003
             if (!is_array($token)) {
6004 6004
                 continue;
@@ -6034,7 +6034,7 @@  discard block
 block discarded – undo
6034 6034
     public function atBindFileContent($str = '')
6035 6035
     {
6036 6036
 
6037
-        $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'] . 'files/', '');
6037
+        $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'].'files/', '');
6038 6038
 
6039 6039
         if (stripos($str, '@FILE') !== 0) {
6040 6040
             return $str;
@@ -6057,7 +6057,7 @@  discard block
 block discarded – undo
6057 6057
         $errorMsg = sprintf("Could not retrieve string '%s'.", $str);
6058 6058
 
6059 6059
         foreach ($search_path as $path) {
6060
-            $file_path = MODX_BASE_PATH . $path . $str;
6060
+            $file_path = MODX_BASE_PATH.$path.$str;
6061 6061
             if (strpos($file_path, MODX_MANAGER_PATH) === 0) {
6062 6062
                 return $errorMsg;
6063 6063
             } elseif (is_file($file_path)) {
@@ -6071,7 +6071,7 @@  discard block
 block discarded – undo
6071 6071
             return $errorMsg;
6072 6072
         }
6073 6073
 
6074
-        $content = (string)file_get_contents($file_path);
6074
+        $content = (string) file_get_contents($file_path);
6075 6075
         if ($content === false) {
6076 6076
             return $errorMsg;
6077 6077
         }
@@ -6180,22 +6180,22 @@  discard block
 block discarded – undo
6180 6180
 
6181 6181
         $version = isset ($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : '';
6182 6182
         $release_date = isset ($GLOBALS['release_date']) ? $GLOBALS['release_date'] : '';
6183
-        $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI'];
6183
+        $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI'];
6184 6184
         $request_uri = $this->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']);
6185 6185
         $ua = $this->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']);
6186 6186
         $referer = $this->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']);
6187 6187
         if ($is_error) {
6188 6188
             $str = '<h2 style="color:red">&laquo; Evo Parse Error &raquo;</h2>';
6189 6189
             if ($msg != 'PHP Parse Error') {
6190
-                $str .= '<h3 style="color:red">' . $msg . '</h3>';
6190
+                $str .= '<h3 style="color:red">'.$msg.'</h3>';
6191 6191
             }
6192 6192
         } else {
6193 6193
             $str = '<h2 style="color:#003399">&laquo; Evo Debug/ stop message &raquo;</h2>';
6194
-            $str .= '<h3 style="color:#003399">' . $msg . '</h3>';
6194
+            $str .= '<h3 style="color:#003399">'.$msg.'</h3>';
6195 6195
         }
6196 6196
 
6197 6197
         if (!empty ($query)) {
6198
-            $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>';
6198
+            $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>';
6199 6199
         }
6200 6200
 
6201 6201
         $errortype = array(
@@ -6218,13 +6218,13 @@  discard block
 block discarded – undo
6218 6218
 
6219 6219
         if (!empty($nr) || !empty($file)) {
6220 6220
             if ($text != '') {
6221
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>';
6221
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>';
6222 6222
             }
6223 6223
             if ($output != '') {
6224
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>';
6224
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>';
6225 6225
             }
6226 6226
             if ($nr !== '') {
6227
-                $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]");
6227
+                $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]");
6228 6228
             }
6229 6229
             if ($file) {
6230 6230
                 $table[] = array('File', $file);
@@ -6244,7 +6244,7 @@  discard block
 block discarded – undo
6244 6244
         }
6245 6245
 
6246 6246
         if (!empty($this->event->activePlugin)) {
6247
-            $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')');
6247
+            $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')');
6248 6248
         }
6249 6249
 
6250 6250
         $str .= $MakeTable->create($table, array('Error information', ''));
@@ -6254,17 +6254,17 @@  discard block
 block discarded – undo
6254 6254
         $table[] = array('REQUEST_URI', $request_uri);
6255 6255
 
6256 6256
         if ($this->manager->action) {
6257
-            include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
6257
+            include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php');
6258 6258
             global $action_list;
6259 6259
             $actionName = (isset($action_list[$this->manager->action])) ? " - {$action_list[$this->manager->action]}" : '';
6260 6260
 
6261
-            $table[] = array('Manager action', $this->manager->action . $actionName);
6261
+            $table[] = array('Manager action', $this->manager->action.$actionName);
6262 6262
         }
6263 6263
 
6264 6264
         if (preg_match('@^[0-9]+@', $this->documentIdentifier)) {
6265 6265
             $resource = $this->getDocumentObject('id', $this->documentIdentifier);
6266 6266
             $url = $this->makeUrl($this->documentIdentifier, '', '', 'full');
6267
-            $table[] = array('Resource', '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>');
6267
+            $table[] = array('Resource', '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>');
6268 6268
         }
6269 6269
         $table[] = array('Referer', $referer);
6270 6270
         $table[] = array('User Agent', $ua);
@@ -6285,7 +6285,7 @@  discard block
 block discarded – undo
6285 6285
 
6286 6286
         $mem = memory_get_peak_usage(true);
6287 6287
         $total_mem = $mem - $this->mstart;
6288
-        $total_mem = ($total_mem / 1024 / 1024) . ' mb';
6288
+        $total_mem = ($total_mem / 1024 / 1024).' mb';
6289 6289
 
6290 6290
         $queryTime = $this->queryTime;
6291 6291
         $phpTime = $totalTime - $queryTime;
@@ -6306,18 +6306,18 @@  discard block
 block discarded – undo
6306 6306
         $str .= $this->get_backtrace(debug_backtrace());
6307 6307
         // Log error
6308 6308
         if (!empty($this->currentSnippet)) {
6309
-            $source = 'Snippet - ' . $this->currentSnippet;
6309
+            $source = 'Snippet - '.$this->currentSnippet;
6310 6310
         } elseif (!empty($this->event->activePlugin)) {
6311
-            $source = 'Plugin - ' . $this->event->activePlugin;
6311
+            $source = 'Plugin - '.$this->event->activePlugin;
6312 6312
         } elseif ($source !== '') {
6313
-            $source = 'Parser - ' . $source;
6313
+            $source = 'Parser - '.$source;
6314 6314
         } elseif ($query !== '') {
6315 6315
             $source = 'SQL Query';
6316 6316
         } else {
6317 6317
             $source = 'Parser';
6318 6318
         }
6319 6319
         if ($msg) {
6320
-            $source .= ' / ' . $msg;
6320
+            $source .= ' / '.$msg;
6321 6321
         }
6322 6322
         if (isset($actionName) && !empty($actionName)) {
6323 6323
             $source .= $actionName;
@@ -6349,12 +6349,12 @@  discard block
 block discarded – undo
6349 6349
 
6350 6350
         // Display error
6351 6351
         if (isset($_SESSION['mgrValidated'])) {
6352
-            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>
6352
+            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>
6353 6353
                  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6354
-                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" />
6354
+                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" />
6355 6355
                  <style type="text/css">body { padding:10px; } td {font:inherit;}</style>
6356 6356
                  </head><body>
6357
-                 ' . $str . '</body></html>';
6357
+                 ' . $str.'</body></html>';
6358 6358
 
6359 6359
         } else {
6360 6360
             echo 'Error';
@@ -6389,7 +6389,7 @@  discard block
 block discarded – undo
6389 6389
             switch ($val['type']) {
6390 6390
                 case '->':
6391 6391
                 case '::':
6392
-                    $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function'];
6392
+                    $functionName = $val['function'] = $val['class'].$val['type'].$val['function'];
6393 6393
                     break;
6394 6394
                 default:
6395 6395
                     $functionName = $val['function'];
@@ -6399,7 +6399,7 @@  discard block
 block discarded – undo
6399 6399
             $args = array_pad(array(), $_, '$var');
6400 6400
             $args = implode(", ", $args);
6401 6401
             $modx = &$this;
6402
-            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) {
6402
+            $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) {
6403 6403
                 $arg = $val['args'][$tmp - 1];
6404 6404
                 switch (true) {
6405 6405
                     case is_null($arg): {
@@ -6411,7 +6411,7 @@  discard block
 block discarded – undo
6411 6411
                         break;
6412 6412
                     }
6413 6413
                     case is_scalar($arg): {
6414
-                        $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->htmlspecialchars(str_replace("'", "\\'", $arg)) . "'");
6414
+                        $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->htmlspecialchars(str_replace("'", "\\'", $arg))."'");
6415 6415
                         break;
6416 6416
                     }
6417 6417
                     case is_bool($arg): {
@@ -6419,23 +6419,23 @@  discard block
 block discarded – undo
6419 6419
                         break;
6420 6420
                     }
6421 6421
                     case is_array($arg): {
6422
-                        $out = 'array $var' . $tmp;
6422
+                        $out = 'array $var'.$tmp;
6423 6423
                         break;
6424 6424
                     }
6425 6425
                     case is_object($arg): {
6426
-                        $out = get_class($arg) . ' $var' . $tmp;
6426
+                        $out = get_class($arg).' $var'.$tmp;
6427 6427
                         break;
6428 6428
                     }
6429 6429
                     default: {
6430
-                        $out = '$var' . $tmp;
6430
+                        $out = '$var'.$tmp;
6431 6431
                     }
6432 6432
                 }
6433 6433
                 $tmp++;
6434 6434
                 return $out;
6435 6435
             }, $args);
6436 6436
             $line = array(
6437
-                "<strong>" . $functionName . "</strong>(" . $args . ")",
6438
-                $path . " on line " . $val['line']
6437
+                "<strong>".$functionName."</strong>(".$args.")",
6438
+                $path." on line ".$val['line']
6439 6439
             );
6440 6440
             $table[] = array(implode("<br />", $line));
6441 6441
         }
@@ -6476,7 +6476,7 @@  discard block
 block discarded – undo
6476 6476
             $alias = strip_tags($alias); // strip HTML
6477 6477
             $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters
6478 6478
             $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash
6479
-            $alias = preg_replace('/-+/', '-', $alias);  // convert multiple dashes to one
6479
+            $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one
6480 6480
             $alias = trim($alias, '-'); // trim excess
6481 6481
             return $alias;
6482 6482
         }
@@ -6492,7 +6492,7 @@  discard block
 block discarded – undo
6492 6492
         $precisions = count($sizes) - 1;
6493 6493
         foreach ($sizes as $unit => $bytes) {
6494 6494
             if ($size >= $bytes) {
6495
-                return number_format($size / $bytes, $precisions) . ' ' . $unit;
6495
+                return number_format($size / $bytes, $precisions).' '.$unit;
6496 6496
             }
6497 6497
             $precisions--;
6498 6498
         }
@@ -6596,10 +6596,10 @@  discard block
 block discarded – undo
6596 6596
 
6597 6597
         if (strpos($str, MODX_MANAGER_PATH) === 0) {
6598 6598
             return false;
6599
-        } elseif (is_file(MODX_BASE_PATH . $str)) {
6600
-            $file_path = MODX_BASE_PATH . $str;
6601
-        } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) {
6602
-            $file_path = MODX_BASE_PATH . $tpl_dir . $str;
6599
+        } elseif (is_file(MODX_BASE_PATH.$str)) {
6600
+            $file_path = MODX_BASE_PATH.$str;
6601
+        } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) {
6602
+            $file_path = MODX_BASE_PATH.$tpl_dir.$str;
6603 6603
         } else {
6604 6604
             return false;
6605 6605
         }
@@ -6725,7 +6725,7 @@  discard block
 block discarded – undo
6725 6725
             $title = 'no title';
6726 6726
         }
6727 6727
         if (is_array($msg)) {
6728
-            $msg = '<pre>' . print_r($msg, true) . '</pre>';
6728
+            $msg = '<pre>'.print_r($msg, true).'</pre>';
6729 6729
         } elseif ($msg === '') {
6730 6730
             $msg = $_SERVER['REQUEST_URI'];
6731 6731
         }
Please login to merge, or discard this patch.
manager/processors/login.processor.php 2 patches
Indentation   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if(!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
3
-	header('HTTP/1.0 404 Not Found');
4
-	exit('error');
3
+    header('HTTP/1.0 404 Not Found');
4
+    exit('error');
5 5
 }
6 6
 define('IN_MANAGER_MODE', true);  // we use this to make sure files are accessed through
7 7
 define('MODX_API_MODE', true);
@@ -18,12 +18,12 @@  discard block
 block discarded – undo
18 18
 include_once("{$core_path}lang/english.inc.php");
19 19
 
20 20
 if($manager_language !== 'english' && is_file("{$core_path}lang/{$manager_language}.inc.php")) {
21
-	include_once("{$core_path}lang/{$manager_language}.inc.php");
21
+    include_once("{$core_path}lang/{$manager_language}.inc.php");
22 22
 }
23 23
 
24 24
 // Initialize System Alert Message Queque
25 25
 if(!isset($_SESSION['SystemAlertMsgQueque'])) {
26
-	$_SESSION['SystemAlertMsgQueque'] = array();
26
+    $_SESSION['SystemAlertMsgQueque'] = array();
27 27
 }
28 28
 $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque'];
29 29
 
@@ -38,10 +38,10 @@  discard block
 block discarded – undo
38 38
 
39 39
 // invoke OnBeforeManagerLogin event
40 40
 $modx->invokeEvent('OnBeforeManagerLogin', array(
41
-		'username' => $username,
42
-		'userpassword' => $givenPassword,
43
-		'rememberme' => $rememberme
44
-	));
41
+        'username' => $username,
42
+        'userpassword' => $givenPassword,
43
+        'rememberme' => $rememberme
44
+    ));
45 45
 $fields = 'mu.*, ua.*';
46 46
 $from = '[+prefix+]manager_users AS mu, [+prefix+]user_attributes AS ua';
47 47
 $where = "BINARY mu.username='{$username}' and ua.internalKey=mu.id";
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 $limit = $modx->db->getRecordCount($rs);
50 50
 
51 51
 if($limit == 0 || $limit > 1) {
52
-	jsAlert($_lang['login_processor_unknown_user']);
53
-	return;
52
+    jsAlert($_lang['login_processor_unknown_user']);
53
+    return;
54 54
 }
55 55
 
56 56
 $row = $modx->db->getRow($rs);
@@ -71,127 +71,127 @@  discard block
 block discarded – undo
71 71
 // get the user settings from the database
72 72
 $rs = $modx->db->select('setting_name, setting_value', '[+prefix+]user_settings', "user='{$internalKey}' AND setting_value!=''");
73 73
 while($row = $modx->db->getRow($rs)) {
74
-	extract($row);
75
-	${$setting_name} = $setting_value;
74
+    extract($row);
75
+    ${$setting_name} = $setting_value;
76 76
 }
77 77
 
78 78
 // blocked due to number of login errors.
79 79
 if($failedlogins >= $failed_allowed && $blockeduntildate > time()) {
80
-	@session_destroy();
81
-	session_unset();
82
-	if($cip = getenv("HTTP_CLIENT_IP")) {
83
-		$ip = $cip;
84
-	} elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) {
85
-		$ip = $cip;
86
-	} elseif($cip = getenv("REMOTE_ADDR")) {
87
-		$ip = $cip;
88
-	} else {
89
-		$ip = "UNKNOWN";
90
-	}
91
-	$log = new EvolutionCMS\Legacy\LogHandler();
92
-	$log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: " . $ip);
93
-	jsAlert($_lang['login_processor_many_failed_logins']);
94
-	return;
80
+    @session_destroy();
81
+    session_unset();
82
+    if($cip = getenv("HTTP_CLIENT_IP")) {
83
+        $ip = $cip;
84
+    } elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) {
85
+        $ip = $cip;
86
+    } elseif($cip = getenv("REMOTE_ADDR")) {
87
+        $ip = $cip;
88
+    } else {
89
+        $ip = "UNKNOWN";
90
+    }
91
+    $log = new EvolutionCMS\Legacy\LogHandler();
92
+    $log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: " . $ip);
93
+    jsAlert($_lang['login_processor_many_failed_logins']);
94
+    return;
95 95
 }
96 96
 
97 97
 // blocked due to number of login errors, but get to try again
98 98
 if($failedlogins >= $failed_allowed && $blockeduntildate < time()) {
99
-	$fields = array();
100
-	$fields['failedlogincount'] = '0';
101
-	$fields['blockeduntil'] = time() - 1;
102
-	$modx->db->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'");
99
+    $fields = array();
100
+    $fields['failedlogincount'] = '0';
101
+    $fields['blockeduntil'] = time() - 1;
102
+    $modx->db->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'");
103 103
 }
104 104
 
105 105
 // this user has been blocked by an admin, so no way he's loggin in!
106 106
 if($blocked == '1') {
107
-	@session_destroy();
108
-	session_unset();
109
-	jsAlert($_lang['login_processor_blocked1']);
110
-	return;
107
+    @session_destroy();
108
+    session_unset();
109
+    jsAlert($_lang['login_processor_blocked1']);
110
+    return;
111 111
 }
112 112
 
113 113
 // blockuntil: this user has a block until date
114 114
 if($blockeduntildate > time()) {
115
-	@session_destroy();
116
-	session_unset();
117
-	jsAlert($_lang['login_processor_blocked2']);
118
-	return;
115
+    @session_destroy();
116
+    session_unset();
117
+    jsAlert($_lang['login_processor_blocked2']);
118
+    return;
119 119
 }
120 120
 
121 121
 // blockafter: this user has a block after date
122 122
 if($blockedafterdate > 0 && $blockedafterdate < time()) {
123
-	@session_destroy();
124
-	session_unset();
125
-	jsAlert($_lang['login_processor_blocked3']);
126
-	return;
123
+    @session_destroy();
124
+    session_unset();
125
+    jsAlert($_lang['login_processor_blocked3']);
126
+    return;
127 127
 }
128 128
 
129 129
 // allowed ip
130 130
 if($allowed_ip) {
131
-	if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) {
132
-		if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) {
133
-			jsAlert($_lang['login_processor_remotehost_ip']);
134
-			return;
135
-		}
136
-	}
137
-	if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) {
138
-		jsAlert($_lang['login_processor_remote_ip']);
139
-		return;
140
-	}
131
+    if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) {
132
+        if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) {
133
+            jsAlert($_lang['login_processor_remotehost_ip']);
134
+            return;
135
+        }
136
+    }
137
+    if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) {
138
+        jsAlert($_lang['login_processor_remote_ip']);
139
+        return;
140
+    }
141 141
 }
142 142
 
143 143
 // allowed days
144 144
 if($allowed_days) {
145
-	$date = getdate();
146
-	$day = $date['wday'] + 1;
147
-	if(!in_array($day,explode(',',$allowed_days))) {
148
-		jsAlert($_lang['login_processor_date']);
149
-		return;
150
-	}
145
+    $date = getdate();
146
+    $day = $date['wday'] + 1;
147
+    if(!in_array($day,explode(',',$allowed_days))) {
148
+        jsAlert($_lang['login_processor_date']);
149
+        return;
150
+    }
151 151
 }
152 152
 
153 153
 // invoke OnManagerAuthentication event
154 154
 $rt = $modx->invokeEvent('OnManagerAuthentication', array(
155
-		'userid' => $internalKey,
156
-		'username' => $username,
157
-		'userpassword' => $givenPassword,
158
-		'savedpassword' => $dbasePassword,
159
-		'rememberme' => $rememberme
160
-	));
155
+        'userid' => $internalKey,
156
+        'username' => $username,
157
+        'userpassword' => $givenPassword,
158
+        'savedpassword' => $dbasePassword,
159
+        'rememberme' => $rememberme
160
+    ));
161 161
 
162 162
 // check if plugin authenticated the user
163 163
 $matchPassword = false;
164 164
 if(!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) {
165
-	// check user password - local authentication
166
-	$hashType = $modx->manager->getHashType($dbasePassword);
167
-	if($hashType == 'phpass') {
168
-		$matchPassword = login($username, $_REQUEST['password'], $dbasePassword);
169
-	} elseif($hashType == 'md5') {
170
-		$matchPassword = loginMD5($internalKey, $_REQUEST['password'], $dbasePassword, $username);
171
-	} elseif($hashType == 'v1') {
172
-		$matchPassword = loginV1($internalKey, $_REQUEST['password'], $dbasePassword, $username);
173
-	} else {
174
-		$matchPassword = false;
175
-	}
165
+    // check user password - local authentication
166
+    $hashType = $modx->manager->getHashType($dbasePassword);
167
+    if($hashType == 'phpass') {
168
+        $matchPassword = login($username, $_REQUEST['password'], $dbasePassword);
169
+    } elseif($hashType == 'md5') {
170
+        $matchPassword = loginMD5($internalKey, $_REQUEST['password'], $dbasePassword, $username);
171
+    } elseif($hashType == 'v1') {
172
+        $matchPassword = loginV1($internalKey, $_REQUEST['password'], $dbasePassword, $username);
173
+    } else {
174
+        $matchPassword = false;
175
+    }
176 176
 } else if($rt === true || (is_array($rt) && in_array(true, $rt))) {
177
-	$matchPassword = true;
177
+    $matchPassword = true;
178 178
 }
179 179
 
180 180
 if(!$matchPassword) {
181
-	jsAlert($_lang['login_processor_wrong_password']);
182
-	incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes);
183
-	return;
181
+    jsAlert($_lang['login_processor_wrong_password']);
182
+    incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes);
183
+    return;
184 184
 }
185 185
 
186 186
 if($modx->config['use_captcha'] == 1) {
187
-	if(!isset ($_SESSION['veriword'])) {
188
-		jsAlert($_lang['login_processor_captcha_config']);
189
-		return;
190
-	} elseif($_SESSION['veriword'] != $captcha_code) {
191
-		jsAlert($_lang['login_processor_bad_code']);
192
-		incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes);
193
-		return;
194
-	}
187
+    if(!isset ($_SESSION['veriword'])) {
188
+        jsAlert($_lang['login_processor_captcha_config']);
189
+        return;
190
+    } elseif($_SESSION['veriword'] != $captcha_code) {
191
+        jsAlert($_lang['login_processor_bad_code']);
192
+        incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes);
193
+        return;
194
+    }
195 195
 }
196 196
 
197 197
 $modx->cleanupExpiredLocks();
@@ -226,36 +226,36 @@  discard block
 block discarded – undo
226 226
 $_SESSION['mgrToken'] = md5($currentsessionid);
227 227
 
228 228
 if($rememberme == '1') {
229
-	$_SESSION['modx.mgr.session.cookie.lifetime'] = (int)$modx->config['session.cookie.lifetime'];
230
-
231
-	// Set a cookie separate from the session cookie with the username in it.
232
-	// Are we using secure connection? If so, make sure the cookie is secure
233
-	global $https_port;
234
-
235
-	$secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port);
236
-	if(version_compare(PHP_VERSION, '5.2', '<')) {
237
-		setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure);
238
-	} else {
239
-		setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true);
240
-	}
229
+    $_SESSION['modx.mgr.session.cookie.lifetime'] = (int)$modx->config['session.cookie.lifetime'];
230
+
231
+    // Set a cookie separate from the session cookie with the username in it.
232
+    // Are we using secure connection? If so, make sure the cookie is secure
233
+    global $https_port;
234
+
235
+    $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port);
236
+    if(version_compare(PHP_VERSION, '5.2', '<')) {
237
+        setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure);
238
+    } else {
239
+        setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true);
240
+    }
241 241
 } else {
242
-	$_SESSION['modx.mgr.session.cookie.lifetime'] = 0;
242
+    $_SESSION['modx.mgr.session.cookie.lifetime'] = 0;
243 243
 
244
-	// Remove the Remember Me cookie
245
-	setcookie('modx_remember_manager', '', time() - 3600, MODX_BASE_URL);
244
+    // Remove the Remember Me cookie
245
+    setcookie('modx_remember_manager', '', time() - 3600, MODX_BASE_URL);
246 246
 }
247 247
 
248 248
 // Check if user already has an active session, if not check if user pressed logout end of last session
249 249
 $rs = $modx->db->select('lasthit', $modx->getFullTableName('active_user_sessions'), "internalKey='{$internalKey}'");
250 250
 $activeSession = $modx->db->getValue($rs);
251 251
 if(!$activeSession) {
252
-	$rs = $modx->db->select('lasthit', $modx->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8");
253
-	if($lastHit = $modx->db->getValue($rs)) {
254
-		$_SESSION['show_logout_reminder'] = array(
255
-			'type' => 'logout_reminder',
256
-			'lastHit' => $lastHit
257
-		);
258
-	}
252
+    $rs = $modx->db->select('lasthit', $modx->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8");
253
+    if($lastHit = $modx->db->getValue($rs)) {
254
+        $_SESSION['show_logout_reminder'] = array(
255
+            'type' => 'logout_reminder',
256
+            'lastHit' => $lastHit
257
+        );
258
+    }
259 259
 }
260 260
 
261 261
 $log = new EvolutionCMS\Legacy\LogHandler();
@@ -263,27 +263,27 @@  discard block
 block discarded – undo
263 263
 
264 264
 // invoke OnManagerLogin event
265 265
 $modx->invokeEvent('OnManagerLogin', array(
266
-		'userid' => $internalKey,
267
-		'username' => $username,
268
-		'userpassword' => $givenPassword,
269
-		'rememberme' => $rememberme
270
-	));
266
+        'userid' => $internalKey,
267
+        'username' => $username,
268
+        'userpassword' => $givenPassword,
269
+        'rememberme' => $rememberme
270
+    ));
271 271
 
272 272
 // check if we should redirect user to a web page
273 273
 $rs = $modx->db->select('setting_value', '[+prefix+]user_settings', "user='{$internalKey}' AND setting_name='manager_login_startup'");
274 274
 $id = (int)$modx->db->getValue($rs);
275 275
 if($id > 0) {
276
-	$header = 'Location: ' . $modx->makeUrl($id, '', '', 'full');
277
-	if($_POST['ajax'] == 1) {
278
-		echo $header;
279
-	} else {
280
-		header($header);
281
-	}
276
+    $header = 'Location: ' . $modx->makeUrl($id, '', '', 'full');
277
+    if($_POST['ajax'] == 1) {
278
+        echo $header;
279
+    } else {
280
+        header($header);
281
+    }
282 282
 } else {
283
-	$header = 'Location: ' . MODX_MANAGER_URL;
284
-	if($_POST['ajax'] == 1) {
285
-		echo $header;
286
-	} else {
287
-		header($header);
288
-	}
283
+    $header = 'Location: ' . MODX_MANAGER_URL;
284
+    if($_POST['ajax'] == 1) {
285
+        echo $header;
286
+    } else {
287
+        header($header);
288
+    }
289 289
 }
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -1,28 +1,28 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
2
+if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
3 3
 	header('HTTP/1.0 404 Not Found');
4 4
 	exit('error');
5 5
 }
6
-define('IN_MANAGER_MODE', true);  // we use this to make sure files are accessed through
6
+define('IN_MANAGER_MODE', true); // we use this to make sure files are accessed through
7 7
 define('MODX_API_MODE', true);
8
-include_once(__DIR__ . '/../../index.php');
8
+include_once(__DIR__.'/../../index.php');
9 9
 $modx->db->connect();
10 10
 $modx->getSettings();
11 11
 $modx->invokeEvent('OnManagerPageInit');
12 12
 $modx->loadExtension('ManagerAPI');
13 13
 $modx->loadExtension('phpass');
14 14
 
15
-$core_path = MODX_MANAGER_PATH . 'includes/';
15
+$core_path = MODX_MANAGER_PATH.'includes/';
16 16
 // include_once the language file
17 17
 $_lang = array();
18 18
 include_once("{$core_path}lang/english.inc.php");
19 19
 
20
-if($manager_language !== 'english' && is_file("{$core_path}lang/{$manager_language}.inc.php")) {
20
+if ($manager_language !== 'english' && is_file("{$core_path}lang/{$manager_language}.inc.php")) {
21 21
 	include_once("{$core_path}lang/{$manager_language}.inc.php");
22 22
 }
23 23
 
24 24
 // Initialize System Alert Message Queque
25
-if(!isset($_SESSION['SystemAlertMsgQueque'])) {
25
+if (!isset($_SESSION['SystemAlertMsgQueque'])) {
26 26
 	$_SESSION['SystemAlertMsgQueque'] = array();
27 27
 }
28 28
 $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque'];
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 $rs = $modx->db->select($fields, $from, $where);
49 49
 $limit = $modx->db->getRecordCount($rs);
50 50
 
51
-if($limit == 0 || $limit > 1) {
51
+if ($limit == 0 || $limit > 1) {
52 52
 	jsAlert($_lang['login_processor_unknown_user']);
53 53
 	return;
54 54
 }
@@ -70,32 +70,32 @@  discard block
 block discarded – undo
70 70
 
71 71
 // get the user settings from the database
72 72
 $rs = $modx->db->select('setting_name, setting_value', '[+prefix+]user_settings', "user='{$internalKey}' AND setting_value!=''");
73
-while($row = $modx->db->getRow($rs)) {
73
+while ($row = $modx->db->getRow($rs)) {
74 74
 	extract($row);
75 75
 	${$setting_name} = $setting_value;
76 76
 }
77 77
 
78 78
 // blocked due to number of login errors.
79
-if($failedlogins >= $failed_allowed && $blockeduntildate > time()) {
79
+if ($failedlogins >= $failed_allowed && $blockeduntildate > time()) {
80 80
 	@session_destroy();
81 81
 	session_unset();
82
-	if($cip = getenv("HTTP_CLIENT_IP")) {
82
+	if ($cip = getenv("HTTP_CLIENT_IP")) {
83 83
 		$ip = $cip;
84
-	} elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) {
84
+	} elseif ($cip = getenv("HTTP_X_FORWARDED_FOR")) {
85 85
 		$ip = $cip;
86
-	} elseif($cip = getenv("REMOTE_ADDR")) {
86
+	} elseif ($cip = getenv("REMOTE_ADDR")) {
87 87
 		$ip = $cip;
88 88
 	} else {
89 89
 		$ip = "UNKNOWN";
90 90
 	}
91 91
 	$log = new EvolutionCMS\Legacy\LogHandler();
92
-	$log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: " . $ip);
92
+	$log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: ".$ip);
93 93
 	jsAlert($_lang['login_processor_many_failed_logins']);
94 94
 	return;
95 95
 }
96 96
 
97 97
 // blocked due to number of login errors, but get to try again
98
-if($failedlogins >= $failed_allowed && $blockeduntildate < time()) {
98
+if ($failedlogins >= $failed_allowed && $blockeduntildate < time()) {
99 99
 	$fields = array();
100 100
 	$fields['failedlogincount'] = '0';
101 101
 	$fields['blockeduntil'] = time() - 1;
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 }
104 104
 
105 105
 // this user has been blocked by an admin, so no way he's loggin in!
106
-if($blocked == '1') {
106
+if ($blocked == '1') {
107 107
 	@session_destroy();
108 108
 	session_unset();
109 109
 	jsAlert($_lang['login_processor_blocked1']);
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 }
112 112
 
113 113
 // blockuntil: this user has a block until date
114
-if($blockeduntildate > time()) {
114
+if ($blockeduntildate > time()) {
115 115
 	@session_destroy();
116 116
 	session_unset();
117 117
 	jsAlert($_lang['login_processor_blocked2']);
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 }
120 120
 
121 121
 // blockafter: this user has a block after date
122
-if($blockedafterdate > 0 && $blockedafterdate < time()) {
122
+if ($blockedafterdate > 0 && $blockedafterdate < time()) {
123 123
 	@session_destroy();
124 124
 	session_unset();
125 125
 	jsAlert($_lang['login_processor_blocked3']);
@@ -127,24 +127,24 @@  discard block
 block discarded – undo
127 127
 }
128 128
 
129 129
 // allowed ip
130
-if($allowed_ip) {
131
-	if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) {
132
-		if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) {
130
+if ($allowed_ip) {
131
+	if (($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) {
132
+		if (gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) {
133 133
 			jsAlert($_lang['login_processor_remotehost_ip']);
134 134
 			return;
135 135
 		}
136 136
 	}
137
-	if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) {
137
+	if (!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) {
138 138
 		jsAlert($_lang['login_processor_remote_ip']);
139 139
 		return;
140 140
 	}
141 141
 }
142 142
 
143 143
 // allowed days
144
-if($allowed_days) {
144
+if ($allowed_days) {
145 145
 	$date = getdate();
146 146
 	$day = $date['wday'] + 1;
147
-	if(!in_array($day,explode(',',$allowed_days))) {
147
+	if (!in_array($day, explode(',', $allowed_days))) {
148 148
 		jsAlert($_lang['login_processor_date']);
149 149
 		return;
150 150
 	}
@@ -161,33 +161,33 @@  discard block
 block discarded – undo
161 161
 
162 162
 // check if plugin authenticated the user
163 163
 $matchPassword = false;
164
-if(!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) {
164
+if (!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) {
165 165
 	// check user password - local authentication
166 166
 	$hashType = $modx->manager->getHashType($dbasePassword);
167
-	if($hashType == 'phpass') {
167
+	if ($hashType == 'phpass') {
168 168
 		$matchPassword = login($username, $_REQUEST['password'], $dbasePassword);
169
-	} elseif($hashType == 'md5') {
169
+	} elseif ($hashType == 'md5') {
170 170
 		$matchPassword = loginMD5($internalKey, $_REQUEST['password'], $dbasePassword, $username);
171
-	} elseif($hashType == 'v1') {
171
+	} elseif ($hashType == 'v1') {
172 172
 		$matchPassword = loginV1($internalKey, $_REQUEST['password'], $dbasePassword, $username);
173 173
 	} else {
174 174
 		$matchPassword = false;
175 175
 	}
176
-} else if($rt === true || (is_array($rt) && in_array(true, $rt))) {
176
+} else if ($rt === true || (is_array($rt) && in_array(true, $rt))) {
177 177
 	$matchPassword = true;
178 178
 }
179 179
 
180
-if(!$matchPassword) {
180
+if (!$matchPassword) {
181 181
 	jsAlert($_lang['login_processor_wrong_password']);
182 182
 	incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes);
183 183
 	return;
184 184
 }
185 185
 
186
-if($modx->config['use_captcha'] == 1) {
187
-	if(!isset ($_SESSION['veriword'])) {
186
+if ($modx->config['use_captcha'] == 1) {
187
+	if (!isset ($_SESSION['veriword'])) {
188 188
 		jsAlert($_lang['login_processor_captcha_config']);
189 189
 		return;
190
-	} elseif($_SESSION['veriword'] != $captcha_code) {
190
+	} elseif ($_SESSION['veriword'] != $captcha_code) {
191 191
 		jsAlert($_lang['login_processor_bad_code']);
192 192
 		incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes);
193 193
 		return;
@@ -215,25 +215,25 @@  discard block
 block discarded – undo
215 215
 $_SESSION['mgrPermissions'] = $modx->db->getRow($rs);
216 216
 
217 217
 // successful login so reset fail count and update key values
218
-$modx->db->update('failedlogincount=0, ' . 'logincount=logincount+1, ' . 'lastlogin=thislogin, ' . 'thislogin=' . time() . ', ' . "sessionid='{$currentsessionid}'", '[+prefix+]user_attributes', "internalKey='{$internalKey}'");
218
+$modx->db->update('failedlogincount=0, '.'logincount=logincount+1, '.'lastlogin=thislogin, '.'thislogin='.time().', '."sessionid='{$currentsessionid}'", '[+prefix+]user_attributes', "internalKey='{$internalKey}'");
219 219
 
220 220
 // get user's document groups
221 221
 $i = 0;
222
-$rs = $modx->db->select('uga.documentgroup', $modx->getFullTableName('member_groups') . ' ug
223
-		INNER JOIN ' . $modx->getFullTableName('membergroup_access') . ' uga ON uga.membergroup=ug.user_group', "ug.member='{$internalKey}'");
222
+$rs = $modx->db->select('uga.documentgroup', $modx->getFullTableName('member_groups').' ug
223
+		INNER JOIN ' . $modx->getFullTableName('membergroup_access').' uga ON uga.membergroup=ug.user_group', "ug.member='{$internalKey}'");
224 224
 $_SESSION['mgrDocgroups'] = $modx->db->getColumn('documentgroup', $rs);
225 225
 
226 226
 $_SESSION['mgrToken'] = md5($currentsessionid);
227 227
 
228
-if($rememberme == '1') {
229
-	$_SESSION['modx.mgr.session.cookie.lifetime'] = (int)$modx->config['session.cookie.lifetime'];
228
+if ($rememberme == '1') {
229
+	$_SESSION['modx.mgr.session.cookie.lifetime'] = (int) $modx->config['session.cookie.lifetime'];
230 230
 
231 231
 	// Set a cookie separate from the session cookie with the username in it.
232 232
 	// Are we using secure connection? If so, make sure the cookie is secure
233 233
 	global $https_port;
234 234
 
235 235
 	$secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port);
236
-	if(version_compare(PHP_VERSION, '5.2', '<')) {
236
+	if (version_compare(PHP_VERSION, '5.2', '<')) {
237 237
 		setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure);
238 238
 	} else {
239 239
 		setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true);
@@ -248,9 +248,9 @@  discard block
 block discarded – undo
248 248
 // Check if user already has an active session, if not check if user pressed logout end of last session
249 249
 $rs = $modx->db->select('lasthit', $modx->getFullTableName('active_user_sessions'), "internalKey='{$internalKey}'");
250 250
 $activeSession = $modx->db->getValue($rs);
251
-if(!$activeSession) {
251
+if (!$activeSession) {
252 252
 	$rs = $modx->db->select('lasthit', $modx->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8");
253
-	if($lastHit = $modx->db->getValue($rs)) {
253
+	if ($lastHit = $modx->db->getValue($rs)) {
254 254
 		$_SESSION['show_logout_reminder'] = array(
255 255
 			'type' => 'logout_reminder',
256 256
 			'lastHit' => $lastHit
@@ -271,17 +271,17 @@  discard block
 block discarded – undo
271 271
 
272 272
 // check if we should redirect user to a web page
273 273
 $rs = $modx->db->select('setting_value', '[+prefix+]user_settings', "user='{$internalKey}' AND setting_name='manager_login_startup'");
274
-$id = (int)$modx->db->getValue($rs);
275
-if($id > 0) {
276
-	$header = 'Location: ' . $modx->makeUrl($id, '', '', 'full');
277
-	if($_POST['ajax'] == 1) {
274
+$id = (int) $modx->db->getValue($rs);
275
+if ($id > 0) {
276
+	$header = 'Location: '.$modx->makeUrl($id, '', '', 'full');
277
+	if ($_POST['ajax'] == 1) {
278 278
 		echo $header;
279 279
 	} else {
280 280
 		header($header);
281 281
 	}
282 282
 } else {
283
-	$header = 'Location: ' . MODX_MANAGER_URL;
284
-	if($_POST['ajax'] == 1) {
283
+	$header = 'Location: '.MODX_MANAGER_URL;
284
+	if ($_POST['ajax'] == 1) {
285 285
 		echo $header;
286 286
 	} else {
287 287
 		header($header);
Please login to merge, or discard this patch.
manager/processors/save_template.processor.php 1 patch
Switch Indentation   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -33,113 +33,113 @@
 block discarded – undo
33 33
 }
34 34
 
35 35
 switch ($_POST['mode']) {
36
-    case '19':
37
-
38
-        // invoke OnBeforeTempFormSave event
39
-        $modx->invokeEvent("OnBeforeTempFormSave", array(
40
-            "mode" => "new",
41
-            "id" => $id
42
-        ));
43
-
44
-        // disallow duplicate names for new templates
45
-        $rs = $modx->db->select('COUNT(id)', $modx->getFullTableName('site_templates'), "templatename='{$templatename}'");
46
-        $count = $modx->db->getValue($rs);
47
-        if ($count > 0) {
48
-            $modx->manager->saveFormValues(19);
49
-            $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['template'], $templatename), "index.php?a=19");
50
-        }
51
-
52
-        //do stuff to save the new doc
53
-        $newid = $modx->db->insert(array(
54
-            'templatename' => $templatename,
55
-            'description' => $description,
56
-            'content' => $template,
57
-            'locked' => $locked,
58
-            'selectable' => $selectable,
59
-            'category' => $categoryid,
60
-            'createdon' => $currentdate,
61
-            'editedon' => $currentdate
62
-        ), $modx->getFullTableName('site_templates'));
63
-
64
-        // invoke OnTempFormSave event
65
-        $modx->invokeEvent("OnTempFormSave", array(
66
-            "mode" => "new",
67
-            "id" => $newid
68
-        ));
69
-        // Set new assigned Tvs
70
-        saveTemplateAccess($newid);
71
-
72
-        // Set the item name for logger
73
-        $_SESSION['itemname'] = $templatename;
74
-
75
-        // empty cache
76
-        $modx->clearCache('full');
77
-
78
-        // finished emptying cache - redirect
79
-        if ($_POST['stay'] != '') {
80
-            $a = ($_POST['stay'] == '2') ? "16&id=$newid" : "19";
81
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
82
-            header($header);
83
-        } else {
84
-            $header = "Location: index.php?a=76&r=2";
85
-            header($header);
86
-        }
87
-
88
-        break;
89
-    case '16':
90
-
91
-        // invoke OnBeforeTempFormSave event
92
-        $modx->invokeEvent("OnBeforeTempFormSave", array(
93
-            "mode" => "upd",
94
-            "id" => $id
95
-        ));
96
-
97
-        // disallow duplicate names for templates
98
-        $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_templates'), "templatename='{$templatename}' AND id!='{$id}'");
99
-        $count = $modx->db->getValue($rs);
100
-        if ($count > 0) {
101
-            $modx->manager->saveFormValues(16);
102
-            $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['template'], $templatename), "index.php?a=16&id={$id}");
103
-        }
104
-
105
-        //do stuff to save the edited doc
106
-        $modx->db->update(array(
107
-            'templatename' => $templatename,
108
-            'description' => $description,
109
-            'content' => $template,
110
-            'locked' => $locked,
111
-            'selectable' => $selectable,
112
-            'category' => $categoryid,
113
-            'editedon' => $currentdate
114
-        ), $modx->getFullTableName('site_templates'), "id='{$id}'");
115
-        // Set new assigned Tvs
116
-        saveTemplateAccess($id);
117
-
118
-        // invoke OnTempFormSave event
119
-        $modx->invokeEvent("OnTempFormSave", array(
120
-            "mode" => "upd",
121
-            "id" => $id
122
-        ));
123
-
124
-        // Set the item name for logger
125
-        $_SESSION['itemname'] = $templatename;
126
-
127
-        // first empty the cache
128
-        $modx->clearCache('full');
129
-
130
-        // finished emptying cache - redirect
131
-        if ($_POST['stay'] != '') {
132
-            $a = ($_POST['stay'] == '2') ? "16&id=$id" : "19";
133
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
134
-            header($header);
135
-        } else {
136
-            $modx->unlockElement(1, $id);
137
-            $header = "Location: index.php?a=76&r=2";
138
-            header($header);
139
-        }
140
-
141
-
142
-        break;
143
-    default:
144
-        $modx->webAlertAndQuit("No operation set in request.");
36
+        case '19':
37
+
38
+            // invoke OnBeforeTempFormSave event
39
+            $modx->invokeEvent("OnBeforeTempFormSave", array(
40
+                "mode" => "new",
41
+                "id" => $id
42
+            ));
43
+
44
+            // disallow duplicate names for new templates
45
+            $rs = $modx->db->select('COUNT(id)', $modx->getFullTableName('site_templates'), "templatename='{$templatename}'");
46
+            $count = $modx->db->getValue($rs);
47
+            if ($count > 0) {
48
+                $modx->manager->saveFormValues(19);
49
+                $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['template'], $templatename), "index.php?a=19");
50
+            }
51
+
52
+            //do stuff to save the new doc
53
+            $newid = $modx->db->insert(array(
54
+                'templatename' => $templatename,
55
+                'description' => $description,
56
+                'content' => $template,
57
+                'locked' => $locked,
58
+                'selectable' => $selectable,
59
+                'category' => $categoryid,
60
+                'createdon' => $currentdate,
61
+                'editedon' => $currentdate
62
+            ), $modx->getFullTableName('site_templates'));
63
+
64
+            // invoke OnTempFormSave event
65
+            $modx->invokeEvent("OnTempFormSave", array(
66
+                "mode" => "new",
67
+                "id" => $newid
68
+            ));
69
+            // Set new assigned Tvs
70
+            saveTemplateAccess($newid);
71
+
72
+            // Set the item name for logger
73
+            $_SESSION['itemname'] = $templatename;
74
+
75
+            // empty cache
76
+            $modx->clearCache('full');
77
+
78
+            // finished emptying cache - redirect
79
+            if ($_POST['stay'] != '') {
80
+                $a = ($_POST['stay'] == '2') ? "16&id=$newid" : "19";
81
+                $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
82
+                header($header);
83
+            } else {
84
+                $header = "Location: index.php?a=76&r=2";
85
+                header($header);
86
+            }
87
+
88
+            break;
89
+        case '16':
90
+
91
+            // invoke OnBeforeTempFormSave event
92
+            $modx->invokeEvent("OnBeforeTempFormSave", array(
93
+                "mode" => "upd",
94
+                "id" => $id
95
+            ));
96
+
97
+            // disallow duplicate names for templates
98
+            $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_templates'), "templatename='{$templatename}' AND id!='{$id}'");
99
+            $count = $modx->db->getValue($rs);
100
+            if ($count > 0) {
101
+                $modx->manager->saveFormValues(16);
102
+                $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['template'], $templatename), "index.php?a=16&id={$id}");
103
+            }
104
+
105
+            //do stuff to save the edited doc
106
+            $modx->db->update(array(
107
+                'templatename' => $templatename,
108
+                'description' => $description,
109
+                'content' => $template,
110
+                'locked' => $locked,
111
+                'selectable' => $selectable,
112
+                'category' => $categoryid,
113
+                'editedon' => $currentdate
114
+            ), $modx->getFullTableName('site_templates'), "id='{$id}'");
115
+            // Set new assigned Tvs
116
+            saveTemplateAccess($id);
117
+
118
+            // invoke OnTempFormSave event
119
+            $modx->invokeEvent("OnTempFormSave", array(
120
+                "mode" => "upd",
121
+                "id" => $id
122
+            ));
123
+
124
+            // Set the item name for logger
125
+            $_SESSION['itemname'] = $templatename;
126
+
127
+            // first empty the cache
128
+            $modx->clearCache('full');
129
+
130
+            // finished emptying cache - redirect
131
+            if ($_POST['stay'] != '') {
132
+                $a = ($_POST['stay'] == '2') ? "16&id=$id" : "19";
133
+                $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
134
+                header($header);
135
+            } else {
136
+                $modx->unlockElement(1, $id);
137
+                $header = "Location: index.php?a=76&r=2";
138
+                header($header);
139
+            }
140
+
141
+
142
+            break;
143
+        default:
144
+            $modx->webAlertAndQuit("No operation set in request.");
145 145
 }
Please login to merge, or discard this patch.
manager/processors/save_plugin.processor.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  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
 if (!$modx->hasPermission('save_plugin')) {
6 6
     $modx->webAlertAndQuit($_lang['error_no_privileges']);
7 7
 }
8 8
 
9
-$id = (int)$_POST['id'];
9
+$id = (int) $_POST['id'];
10 10
 $name = $modx->db->escape(trim($_POST['name']));
11 11
 $description = $modx->db->escape($_POST['description']);
12 12
 $locked = $_POST['locked'] == 'on' ? '1' : '0';
@@ -20,11 +20,11 @@  discard block
 block discarded – undo
20 20
 
21 21
 //Kyle Jaebker - added category support
22 22
 if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) {
23
-    $categoryid = (int)$_POST['categoryid'];
23
+    $categoryid = (int) $_POST['categoryid'];
24 24
 } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) {
25 25
     $categoryid = 0;
26 26
 } else {
27
-    include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
27
+    include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
28 28
     $categoryid = getCategory($_POST['newcategory']);
29 29
 }
30 30
 
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
     $moduleguid = isset($parsed['guid']) ? $parsed['guid'] : $moduleguid;
41 41
 
42 42
     $description = isset($parsed['description']) ? $parsed['description'] : $description;
43
-    $version = isset($parsed['version']) ? '<b>' . $parsed['version'] . '</b> ' : '';
43
+    $version = isset($parsed['version']) ? '<b>'.$parsed['version'].'</b> ' : '';
44 44
     if ($version) {
45
-        $description = $version . trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description));
45
+        $description = $version.trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description));
46 46
     }
47 47
     if (isset($parsed['modx_category'])) {
48
-        include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
48
+        include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
49 49
         $categoryid = getCategory($parsed['modx_category']);
50 50
     }
51 51
 }
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
         // finished emptying cache - redirect
104 104
         if ($_POST['stay'] != '') {
105 105
             $a = ($_POST['stay'] == '2') ? "102&id=$newid" : '101';
106
-            $header = 'Location: index.php?a=' . $a . '&r=2&stay=' . $_POST['stay'];
106
+            $header = 'Location: index.php?a='.$a.'&r=2&stay='.$_POST['stay'];
107 107
             header($header);
108 108
         } else {
109 109
             $header = 'Location: index.php?a=76&r=2';
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         // finished emptying cache - redirect
159 159
         if ($_POST['stay'] != '') {
160 160
             $a = ($_POST['stay'] == '2') ? "102&id=$id" : '101';
161
-            $header = 'Location: index.php?a=' . $a . '&r=2&stay=' . $_POST['stay'];
161
+            $header = 'Location: index.php?a='.$a.'&r=2&stay='.$_POST['stay'];
162 162
             header($header);
163 163
         } else {
164 164
             $modx->unlockElement(5, $id);
Please login to merge, or discard this patch.
manager/processors/undelete_content.processor.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -3,12 +3,12 @@  discard block
 block discarded – undo
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
 if(!$modx->hasPermission('delete_document')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $id = isset($_REQUEST['id'])? (int)$_REQUEST['id'] : 0;
10 10
 if($id==0) {
11
-	$modx->webAlertAndQuit($_lang["error_no_id"]);
11
+    $modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
14 14
 /************ webber ********/
@@ -31,14 +31,14 @@  discard block
 block discarded – undo
31 31
 $udperms->role = $_SESSION['mgrRole'];
32 32
 
33 33
 if(!$udperms->checkPermissions()) {
34
-	$modx->webAlertAndQuit($_lang["access_permission_denied"]);
34
+    $modx->webAlertAndQuit($_lang["access_permission_denied"]);
35 35
 }
36 36
 
37 37
 // get the timestamp on which the document was deleted.
38 38
 $rs = $modx->db->select('deletedon', $modx->getFullTableName('site_content'), "id='{$id}' AND deleted=1");
39 39
 $deltime = $modx->db->getValue($rs);
40 40
 if(!$deltime) {
41
-	$modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!");
41
+    $modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!");
42 42
 }
43 43
 
44 44
 $children = array();
@@ -46,20 +46,20 @@  discard block
 block discarded – undo
46 46
 getChildrenForUnDelete($id);
47 47
 
48 48
 if(count($children)>0) {
49
-	$modx->db->update(
50
-		array(
51
-			'deleted'   => 0,
52
-			'deletedby' => 0,
53
-			'deletedon' => 0,
54
-		), $modx->getFullTableName('site_content'), "id IN(".implode(", ", $children).")");
49
+    $modx->db->update(
50
+        array(
51
+            'deleted'   => 0,
52
+            'deletedby' => 0,
53
+            'deletedon' => 0,
54
+        ), $modx->getFullTableName('site_content'), "id IN(".implode(", ", $children).")");
55 55
 }
56 56
 //'undelete' the document.
57 57
 $modx->db->update(
58
-	array(
59
-		'deleted'   => 0,
60
-		'deletedby' => 0,
61
-		'deletedon' => 0,
62
-	), $modx->getFullTableName('site_content'), "id='{$id}'");
58
+    array(
59
+        'deleted'   => 0,
60
+        'deletedby' => 0,
61
+        'deletedon' => 0,
62
+    ), $modx->getFullTableName('site_content'), "id='{$id}'");
63 63
 
64 64
 $modx->invokeEvent("OnDocFormUnDelete",
65 65
     array(
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,25 +1,25 @@  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
-if(!$modx->hasPermission('delete_document')) {
5
+if (!$modx->hasPermission('delete_document')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$id = isset($_REQUEST['id'])? (int)$_REQUEST['id'] : 0;
10
-if($id==0) {
9
+$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
10
+if ($id == 0) {
11 11
 	$modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
14 14
 /************ webber ********/
15
-$content=$modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'"));
16
-$pid=($content['parent']==0?$id:$content['parent']);
15
+$content = $modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'"));
16
+$pid = ($content['parent'] == 0 ? $id : $content['parent']);
17 17
 
18 18
 /************** webber *************/
19
-$sd=isset($_REQUEST['dir'])?'&dir='.$_REQUEST['dir']:'&dir=DESC';
20
-$sb=isset($_REQUEST['sort'])?'&sort='.$_REQUEST['sort']:'&sort=createdon';
21
-$pg=isset($_REQUEST['page'])?'&page='.(int)$_REQUEST['page']:'';
22
-$add_path=$sd.$sb.$pg;
19
+$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC';
20
+$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon';
21
+$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : '';
22
+$add_path = $sd.$sb.$pg;
23 23
 
24 24
 /***********************************/
25 25
 
@@ -30,14 +30,14 @@  discard block
 block discarded – undo
30 30
 $udperms->document = $id;
31 31
 $udperms->role = $_SESSION['mgrRole'];
32 32
 
33
-if(!$udperms->checkPermissions()) {
33
+if (!$udperms->checkPermissions()) {
34 34
 	$modx->webAlertAndQuit($_lang["access_permission_denied"]);
35 35
 }
36 36
 
37 37
 // get the timestamp on which the document was deleted.
38 38
 $rs = $modx->db->select('deletedon', $modx->getFullTableName('site_content'), "id='{$id}' AND deleted=1");
39 39
 $deltime = $modx->db->getValue($rs);
40
-if(!$deltime) {
40
+if (!$deltime) {
41 41
 	$modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!");
42 42
 }
43 43
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 getChildrenForUnDelete($id);
47 47
 
48
-if(count($children)>0) {
48
+if (count($children) > 0) {
49 49
 	$modx->db->update(
50 50
 		array(
51 51
 			'deleted'   => 0,
@@ -74,5 +74,5 @@  discard block
 block discarded – undo
74 74
 $modx->clearCache('full');
75 75
 
76 76
 // finished emptying cache - redirect
77
-$header="Location: index.php?a=3&id=$pid&r=1".$add_path;
77
+$header = "Location: index.php?a=3&id=$pid&r=1".$add_path;
78 78
 header($header);
Please login to merge, or discard this patch.
manager/processors/save_user.processor.php 3 patches
Indentation   +245 added lines, -245 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3
-	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
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
 if(!$modx->hasPermission('save_user')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $modx->loadExtension('phpass');
@@ -45,134 +45,134 @@  discard block
 block discarded – undo
45 45
 
46 46
 // verify password
47 47
 if($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) {
48
-	webAlertAndQuit("Password typed is mismatched", 12);
48
+    webAlertAndQuit("Password typed is mismatched", 12);
49 49
 }
50 50
 
51 51
 // verify email
52 52
 if($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) {
53
-	webAlertAndQuit("E-mail address doesn't seem to be valid!", 12);
53
+    webAlertAndQuit("E-mail address doesn't seem to be valid!", 12);
54 54
 }
55 55
 
56 56
 // verify admin security
57 57
 if($_SESSION['mgrRole'] != 1) {
58
-	// Check to see if user tried to spoof a "1" (admin) role
59
-	if(!$modx->hasPermission('save_role')) {
60
-		webAlertAndQuit("Illegal attempt to create/modify administrator by non-administrator!", 12);
61
-	}
62
-	// Verify that the user being edited wasn't an admin and the user ID got spoofed
63
-	$rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, "internalKey='{$id}' AND role=1");
64
-	$limit = $modx->db->getValue($rs);
65
-	if($limit > 0) {
66
-		webAlertAndQuit("You cannot alter an administrative user.", 12);
67
-	}
58
+    // Check to see if user tried to spoof a "1" (admin) role
59
+    if(!$modx->hasPermission('save_role')) {
60
+        webAlertAndQuit("Illegal attempt to create/modify administrator by non-administrator!", 12);
61
+    }
62
+    // Verify that the user being edited wasn't an admin and the user ID got spoofed
63
+    $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, "internalKey='{$id}' AND role=1");
64
+    $limit = $modx->db->getValue($rs);
65
+    if($limit > 0) {
66
+        webAlertAndQuit("You cannot alter an administrative user.", 12);
67
+    }
68 68
 
69 69
 }
70 70
 
71 71
 switch($input['mode']) {
72
-	case '11' : // new user
73
-		// check if this user name already exist
74
-		$rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s'", $modx->db->escape($newusername)));
75
-		$limit = $modx->db->getValue($rs);
76
-		if($limit > 0) {
77
-			webAlertAndQuit("User name is already in use!", 12);
78
-		}
79
-
80
-		// check if the email address already exist
81
-		$rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND id!='%s'", $modx->db->escape($email), $id));
82
-		$limit = $modx->db->getValue($rs);
83
-		if($limit > 0) {
84
-			webAlertAndQuit("Email is already in use!", 12);
85
-		}
86
-
87
-		// generate a new password for this user
88
-		if($specifiedpassword != "" && $passwordgenmethod == "spec") {
89
-			if(strlen($specifiedpassword) < 6) {
90
-				webAlertAndQuit("Password is too short!", 12);
91
-			} else {
92
-				$newpassword = $specifiedpassword;
93
-			}
94
-		} elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
95
-			webAlertAndQuit("You didn't specify a password for this user!", 12);
96
-		} elseif($passwordgenmethod == 'g') {
97
-			$newpassword = generate_password(8);
98
-		} else {
99
-			webAlertAndQuit("No password generation method specified!", 12);
100
-		}
101
-
102
-		// invoke OnBeforeUserFormSave event
103
-		$modx->invokeEvent("OnBeforeUserFormSave", array(
104
-			"mode" => "new",
105
-		));
106
-
107
-		// create the user account
108
-		$internalKey = $modx->db->insert(array('username' => $modx->db->escape($newusername)), $tbl_manager_users);
109
-
110
-		$field = array();
111
-		$field['password'] = $modx->phpass->HashPassword($newpassword);
112
-		$modx->db->update($field, $tbl_manager_users, "id='{$internalKey}'");
113
-
114
-		$field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter');
115
-		$field = $modx->db->escape($field);
116
-		$modx->db->insert($field, $tbl_user_attributes);
117
-
118
-		// Save user settings
72
+    case '11' : // new user
73
+        // check if this user name already exist
74
+        $rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s'", $modx->db->escape($newusername)));
75
+        $limit = $modx->db->getValue($rs);
76
+        if($limit > 0) {
77
+            webAlertAndQuit("User name is already in use!", 12);
78
+        }
79
+
80
+        // check if the email address already exist
81
+        $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND id!='%s'", $modx->db->escape($email), $id));
82
+        $limit = $modx->db->getValue($rs);
83
+        if($limit > 0) {
84
+            webAlertAndQuit("Email is already in use!", 12);
85
+        }
86
+
87
+        // generate a new password for this user
88
+        if($specifiedpassword != "" && $passwordgenmethod == "spec") {
89
+            if(strlen($specifiedpassword) < 6) {
90
+                webAlertAndQuit("Password is too short!", 12);
91
+            } else {
92
+                $newpassword = $specifiedpassword;
93
+            }
94
+        } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
95
+            webAlertAndQuit("You didn't specify a password for this user!", 12);
96
+        } elseif($passwordgenmethod == 'g') {
97
+            $newpassword = generate_password(8);
98
+        } else {
99
+            webAlertAndQuit("No password generation method specified!", 12);
100
+        }
101
+
102
+        // invoke OnBeforeUserFormSave event
103
+        $modx->invokeEvent("OnBeforeUserFormSave", array(
104
+            "mode" => "new",
105
+        ));
106
+
107
+        // create the user account
108
+        $internalKey = $modx->db->insert(array('username' => $modx->db->escape($newusername)), $tbl_manager_users);
109
+
110
+        $field = array();
111
+        $field['password'] = $modx->phpass->HashPassword($newpassword);
112
+        $modx->db->update($field, $tbl_manager_users, "id='{$internalKey}'");
113
+
114
+        $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter');
115
+        $field = $modx->db->escape($field);
116
+        $modx->db->insert($field, $tbl_user_attributes);
117
+
118
+        // Save user settings
119 119
         saveManagerUserSettings($internalKey);
120 120
 
121
-		// invoke OnManagerSaveUser event
122
-		$modx->invokeEvent("OnManagerSaveUser", array(
123
-			"mode" => "new",
124
-			"userid" => $internalKey,
125
-			"username" => $newusername,
126
-			"userpassword" => $newpassword,
127
-			"useremail" => $email,
128
-			"userfullname" => $fullname,
129
-			"userroleid" => $role
130
-		));
131
-
132
-		// invoke OnUserFormSave event
133
-		$modx->invokeEvent("OnUserFormSave", array(
134
-			"mode" => "new",
135
-			"id" => $internalKey
136
-		));
137
-
138
-		// Set the item name for logger
139
-		$_SESSION['itemname'] = $newusername;
140
-
141
-		/*******************************************************************************/
142
-		// put the user in the user_groups he/ she should be in
143
-		// first, check that up_perms are switched on!
144
-		if($use_udperms == 1) {
145
-			if(!empty($user_groups)) {
146
-				for($i = 0; $i < count($user_groups); $i++) {
147
-					$f = array();
148
-					$f['user_group'] = (int)$user_groups[$i];
149
-					$f['member'] = $internalKey;
150
-					$modx->db->insert($f, $tbl_member_groups);
151
-				}
152
-			}
153
-		}
154
-		// end of user_groups stuff!
155
-
156
-		if($passwordnotifymethod == 'e') {
121
+        // invoke OnManagerSaveUser event
122
+        $modx->invokeEvent("OnManagerSaveUser", array(
123
+            "mode" => "new",
124
+            "userid" => $internalKey,
125
+            "username" => $newusername,
126
+            "userpassword" => $newpassword,
127
+            "useremail" => $email,
128
+            "userfullname" => $fullname,
129
+            "userroleid" => $role
130
+        ));
131
+
132
+        // invoke OnUserFormSave event
133
+        $modx->invokeEvent("OnUserFormSave", array(
134
+            "mode" => "new",
135
+            "id" => $internalKey
136
+        ));
137
+
138
+        // Set the item name for logger
139
+        $_SESSION['itemname'] = $newusername;
140
+
141
+        /*******************************************************************************/
142
+        // put the user in the user_groups he/ she should be in
143
+        // first, check that up_perms are switched on!
144
+        if($use_udperms == 1) {
145
+            if(!empty($user_groups)) {
146
+                for($i = 0; $i < count($user_groups); $i++) {
147
+                    $f = array();
148
+                    $f['user_group'] = (int)$user_groups[$i];
149
+                    $f['member'] = $internalKey;
150
+                    $modx->db->insert($f, $tbl_member_groups);
151
+                }
152
+            }
153
+        }
154
+        // end of user_groups stuff!
155
+
156
+        if($passwordnotifymethod == 'e') {
157 157
             sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL);
158
-			if($input['stay'] != '') {
159
-				$a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11";
160
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
161
-				header($header);
162
-			} else {
163
-				$header = "Location: index.php?a=75&r=2";
164
-				header($header);
165
-			}
166
-		} else {
167
-			if($input['stay'] != '') {
168
-				$a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11";
169
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
170
-			} else {
171
-				$stayUrl = "index.php?a=75&r=2";
172
-			}
173
-
174
-			include_once "header.inc.php";
175
-			?>
158
+            if($input['stay'] != '') {
159
+                $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11";
160
+                $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
161
+                header($header);
162
+            } else {
163
+                $header = "Location: index.php?a=75&r=2";
164
+                header($header);
165
+            }
166
+        } else {
167
+            if($input['stay'] != '') {
168
+                $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11";
169
+                $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
170
+            } else {
171
+                $stayUrl = "index.php?a=75&r=2";
172
+            }
173
+
174
+            include_once "header.inc.php";
175
+            ?>
176 176
 
177 177
 			<h1><?php echo $_lang['user_title']; ?></h1>
178 178
 
@@ -194,125 +194,125 @@  discard block
 block discarded – undo
194 194
 			</div>
195 195
 			<?php
196 196
 
197
-			include_once "footer.inc.php";
198
-		}
199
-		break;
200
-	case '12' : // edit user
201
-		// generate a new password for this user
202
-		if($genpassword == 1) {
203
-			if($specifiedpassword != "" && $passwordgenmethod == "spec") {
204
-				if(strlen($specifiedpassword) < 6) {
205
-					webAlertAndQuit("Password is too short!", 12);
206
-				} else {
207
-					$newpassword = $specifiedpassword;
208
-				}
209
-			} elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
210
-				webAlertAndQuit("You didn't specify a password for this user!", 12);
211
-			} elseif($passwordgenmethod == 'g') {
212
-				$newpassword = generate_password(8);
213
-			} else {
214
-				webAlertAndQuit("No password generation method specified!", 12);
215
-			}
216
-		}
217
-		if($passwordnotifymethod == 'e') {
197
+            include_once "footer.inc.php";
198
+        }
199
+        break;
200
+    case '12' : // edit user
201
+        // generate a new password for this user
202
+        if($genpassword == 1) {
203
+            if($specifiedpassword != "" && $passwordgenmethod == "spec") {
204
+                if(strlen($specifiedpassword) < 6) {
205
+                    webAlertAndQuit("Password is too short!", 12);
206
+                } else {
207
+                    $newpassword = $specifiedpassword;
208
+                }
209
+            } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
210
+                webAlertAndQuit("You didn't specify a password for this user!", 12);
211
+            } elseif($passwordgenmethod == 'g') {
212
+                $newpassword = generate_password(8);
213
+            } else {
214
+                webAlertAndQuit("No password generation method specified!", 12);
215
+            }
216
+        }
217
+        if($passwordnotifymethod == 'e') {
218 218
             sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL);
219
-		}
220
-
221
-		// check if the username already exist
222
-		$rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s' AND id!='%s'", $modx->db->escape($newusername), $id));
223
-		$limit = $modx->db->getValue($rs);
224
-		if($limit > 0) {
225
-			webAlertAndQuit("User name is already in use!", 12);
226
-		}
227
-
228
-		// check if the email address already exists
229
-		$rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND internalKey!='%s'", $modx->db->escape($email), $id));
230
-		$limit = $modx->db->getValue($rs);
231
-		if($limit > 0) {
232
-			webAlertAndQuit("Email is already in use!", 12);
233
-		}
234
-
235
-		// invoke OnBeforeUserFormSave event
236
-		$modx->invokeEvent("OnBeforeUserFormSave", array(
237
-			"mode" => "upd",
238
-			"id" => $id
239
-		));
240
-
241
-		// update user name and password
242
-		$field = array();
243
-		$field['username'] = $modx->db->escape($newusername);
244
-		if($genpassword == 1) {
245
-			$field['password'] = $modx->phpass->HashPassword($newpassword);
246
-		}
247
-		$modx->db->update($field, $tbl_manager_users, "id='{$id}'");
248
-		$field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter');
249
-		$field = $modx->db->escape($field);
250
-		$modx->db->update($field, $tbl_user_attributes, "internalKey='{$id}'");
251
-
252
-		// Save user settings
219
+        }
220
+
221
+        // check if the username already exist
222
+        $rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s' AND id!='%s'", $modx->db->escape($newusername), $id));
223
+        $limit = $modx->db->getValue($rs);
224
+        if($limit > 0) {
225
+            webAlertAndQuit("User name is already in use!", 12);
226
+        }
227
+
228
+        // check if the email address already exists
229
+        $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND internalKey!='%s'", $modx->db->escape($email), $id));
230
+        $limit = $modx->db->getValue($rs);
231
+        if($limit > 0) {
232
+            webAlertAndQuit("Email is already in use!", 12);
233
+        }
234
+
235
+        // invoke OnBeforeUserFormSave event
236
+        $modx->invokeEvent("OnBeforeUserFormSave", array(
237
+            "mode" => "upd",
238
+            "id" => $id
239
+        ));
240
+
241
+        // update user name and password
242
+        $field = array();
243
+        $field['username'] = $modx->db->escape($newusername);
244
+        if($genpassword == 1) {
245
+            $field['password'] = $modx->phpass->HashPassword($newpassword);
246
+        }
247
+        $modx->db->update($field, $tbl_manager_users, "id='{$id}'");
248
+        $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter');
249
+        $field = $modx->db->escape($field);
250
+        $modx->db->update($field, $tbl_user_attributes, "internalKey='{$id}'");
251
+
252
+        // Save user settings
253 253
         saveManagerUserSettings($id);
254 254
 
255
-		// Set the item name for logger
256
-		$_SESSION['itemname'] = $newusername;
257
-
258
-		// invoke OnManagerSaveUser event
259
-		$modx->invokeEvent("OnManagerSaveUser", array(
260
-			"mode" => "upd",
261
-			"userid" => $id,
262
-			"username" => $newusername,
263
-			"userpassword" => $newpassword,
264
-			"useremail" => $email,
265
-			"userfullname" => $fullname,
266
-			"userroleid" => $role,
267
-			"oldusername" => (($oldusername != $newusername) ? $oldusername : ""),
268
-			"olduseremail" => (($oldemail != $email) ? $oldemail : "")
269
-		));
270
-
271
-		// invoke OnManagerChangePassword event
272
-		if($genpassword == 1) {
273
-			$modx->invokeEvent("OnManagerChangePassword", array(
274
-				"userid" => $id,
275
-				"username" => $newusername,
276
-				"userpassword" => $newpassword
277
-			));
278
-		}
279
-
280
-		// invoke OnUserFormSave event
281
-		$modx->invokeEvent("OnUserFormSave", array(
282
-			"mode" => "upd",
283
-			"id" => $id
284
-		));
285
-
286
-		/*******************************************************************************/
287
-		// put the user in the user_groups he/ she should be in
288
-		// first, check that up_perms are switched on!
289
-		if($use_udperms == 1) {
290
-			// as this is an existing user, delete his/ her entries in the groups before saving the new groups
291
-			$modx->db->delete($tbl_member_groups, "member='{$id}'");
292
-			if(!empty($user_groups)) {
293
-				for($i = 0; $i < count($user_groups); $i++) {
294
-					$field = array();
295
-					$field['user_group'] = (int)$user_groups[$i];
296
-					$field['member'] = $id;
297
-					$modx->db->insert($field, $tbl_member_groups);
298
-				}
299
-			}
300
-		}
301
-		// end of user_groups stuff!
302
-		/*******************************************************************************/
303
-		if($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) {
304
-			$modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";');
305
-		}
306
-		if($genpassword == 1 && $passwordnotifymethod == 's') {
307
-			if($input['stay'] != '') {
308
-				$a = ($input['stay'] == '2') ? "12&id={$id}" : "11";
309
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
310
-			} else {
311
-				$stayUrl = "index.php?a=75&r=2";
312
-			}
313
-
314
-			include_once "header.inc.php";
315
-			?>
255
+        // Set the item name for logger
256
+        $_SESSION['itemname'] = $newusername;
257
+
258
+        // invoke OnManagerSaveUser event
259
+        $modx->invokeEvent("OnManagerSaveUser", array(
260
+            "mode" => "upd",
261
+            "userid" => $id,
262
+            "username" => $newusername,
263
+            "userpassword" => $newpassword,
264
+            "useremail" => $email,
265
+            "userfullname" => $fullname,
266
+            "userroleid" => $role,
267
+            "oldusername" => (($oldusername != $newusername) ? $oldusername : ""),
268
+            "olduseremail" => (($oldemail != $email) ? $oldemail : "")
269
+        ));
270
+
271
+        // invoke OnManagerChangePassword event
272
+        if($genpassword == 1) {
273
+            $modx->invokeEvent("OnManagerChangePassword", array(
274
+                "userid" => $id,
275
+                "username" => $newusername,
276
+                "userpassword" => $newpassword
277
+            ));
278
+        }
279
+
280
+        // invoke OnUserFormSave event
281
+        $modx->invokeEvent("OnUserFormSave", array(
282
+            "mode" => "upd",
283
+            "id" => $id
284
+        ));
285
+
286
+        /*******************************************************************************/
287
+        // put the user in the user_groups he/ she should be in
288
+        // first, check that up_perms are switched on!
289
+        if($use_udperms == 1) {
290
+            // as this is an existing user, delete his/ her entries in the groups before saving the new groups
291
+            $modx->db->delete($tbl_member_groups, "member='{$id}'");
292
+            if(!empty($user_groups)) {
293
+                for($i = 0; $i < count($user_groups); $i++) {
294
+                    $field = array();
295
+                    $field['user_group'] = (int)$user_groups[$i];
296
+                    $field['member'] = $id;
297
+                    $modx->db->insert($field, $tbl_member_groups);
298
+                }
299
+            }
300
+        }
301
+        // end of user_groups stuff!
302
+        /*******************************************************************************/
303
+        if($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) {
304
+            $modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";');
305
+        }
306
+        if($genpassword == 1 && $passwordnotifymethod == 's') {
307
+            if($input['stay'] != '') {
308
+                $a = ($input['stay'] == '2') ? "12&id={$id}" : "11";
309
+                $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
310
+            } else {
311
+                $stayUrl = "index.php?a=75&r=2";
312
+            }
313
+
314
+            include_once "header.inc.php";
315
+            ?>
316 316
 
317 317
 			<h1><?php echo $_lang['user_title']; ?></h1>
318 318
 
@@ -332,18 +332,18 @@  discard block
 block discarded – undo
332 332
 			</div>
333 333
 			<?php
334 334
 
335
-			include_once "footer.inc.php";
336
-		} else {
337
-			if($input['stay'] != '') {
338
-				$a = ($input['stay'] == '2') ? "12&id={$id}" : "11";
339
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
340
-				header($header);
341
-			} else {
342
-				$header = "Location: index.php?a=75&r=2";
343
-				header($header);
344
-			}
345
-		}
346
-		break;
347
-	default:
348
-		webAlertAndQuit("No operation set in request.", 12);
335
+            include_once "footer.inc.php";
336
+        } else {
337
+            if($input['stay'] != '') {
338
+                $a = ($input['stay'] == '2') ? "12&id={$id}" : "11";
339
+                $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
340
+                header($header);
341
+            } else {
342
+                $header = "Location: index.php?a=75&r=2";
343
+                header($header);
344
+            }
345
+        }
346
+        break;
347
+    default:
348
+        webAlertAndQuit("No operation set in request.", 12);
349 349
 }
Please login to merge, or discard this patch.
Switch Indentation   +237 added lines, -237 removed lines patch added patch discarded remove patch
@@ -69,110 +69,110 @@  discard block
 block discarded – undo
69 69
 }
70 70
 
71 71
 switch($input['mode']) {
72
-	case '11' : // new user
73
-		// check if this user name already exist
74
-		$rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s'", $modx->db->escape($newusername)));
75
-		$limit = $modx->db->getValue($rs);
76
-		if($limit > 0) {
77
-			webAlertAndQuit("User name is already in use!", 12);
78
-		}
79
-
80
-		// check if the email address already exist
81
-		$rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND id!='%s'", $modx->db->escape($email), $id));
82
-		$limit = $modx->db->getValue($rs);
83
-		if($limit > 0) {
84
-			webAlertAndQuit("Email is already in use!", 12);
85
-		}
86
-
87
-		// generate a new password for this user
88
-		if($specifiedpassword != "" && $passwordgenmethod == "spec") {
89
-			if(strlen($specifiedpassword) < 6) {
90
-				webAlertAndQuit("Password is too short!", 12);
91
-			} else {
92
-				$newpassword = $specifiedpassword;
93
-			}
94
-		} elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
95
-			webAlertAndQuit("You didn't specify a password for this user!", 12);
96
-		} elseif($passwordgenmethod == 'g') {
97
-			$newpassword = generate_password(8);
98
-		} else {
99
-			webAlertAndQuit("No password generation method specified!", 12);
100
-		}
101
-
102
-		// invoke OnBeforeUserFormSave event
103
-		$modx->invokeEvent("OnBeforeUserFormSave", array(
104
-			"mode" => "new",
105
-		));
106
-
107
-		// create the user account
108
-		$internalKey = $modx->db->insert(array('username' => $modx->db->escape($newusername)), $tbl_manager_users);
109
-
110
-		$field = array();
111
-		$field['password'] = $modx->phpass->HashPassword($newpassword);
112
-		$modx->db->update($field, $tbl_manager_users, "id='{$internalKey}'");
113
-
114
-		$field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter');
115
-		$field = $modx->db->escape($field);
116
-		$modx->db->insert($field, $tbl_user_attributes);
117
-
118
-		// Save user settings
119
-        saveManagerUserSettings($internalKey);
120
-
121
-		// invoke OnManagerSaveUser event
122
-		$modx->invokeEvent("OnManagerSaveUser", array(
123
-			"mode" => "new",
124
-			"userid" => $internalKey,
125
-			"username" => $newusername,
126
-			"userpassword" => $newpassword,
127
-			"useremail" => $email,
128
-			"userfullname" => $fullname,
129
-			"userroleid" => $role
130
-		));
131
-
132
-		// invoke OnUserFormSave event
133
-		$modx->invokeEvent("OnUserFormSave", array(
134
-			"mode" => "new",
135
-			"id" => $internalKey
136
-		));
137
-
138
-		// Set the item name for logger
139
-		$_SESSION['itemname'] = $newusername;
140
-
141
-		/*******************************************************************************/
142
-		// put the user in the user_groups he/ she should be in
143
-		// first, check that up_perms are switched on!
144
-		if($use_udperms == 1) {
145
-			if(!empty($user_groups)) {
146
-				for($i = 0; $i < count($user_groups); $i++) {
147
-					$f = array();
148
-					$f['user_group'] = (int)$user_groups[$i];
149
-					$f['member'] = $internalKey;
150
-					$modx->db->insert($f, $tbl_member_groups);
151
-				}
152
-			}
153
-		}
154
-		// end of user_groups stuff!
155
-
156
-		if($passwordnotifymethod == 'e') {
157
-            sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL);
158
-			if($input['stay'] != '') {
159
-				$a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11";
160
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
161
-				header($header);
162
-			} else {
163
-				$header = "Location: index.php?a=75&r=2";
164
-				header($header);
165
-			}
166
-		} else {
167
-			if($input['stay'] != '') {
168
-				$a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11";
169
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
170
-			} else {
171
-				$stayUrl = "index.php?a=75&r=2";
172
-			}
173
-
174
-			include_once "header.inc.php";
175
-			?>
72
+	    case '11' : // new user
73
+		    // check if this user name already exist
74
+		    $rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s'", $modx->db->escape($newusername)));
75
+		    $limit = $modx->db->getValue($rs);
76
+		    if($limit > 0) {
77
+			    webAlertAndQuit("User name is already in use!", 12);
78
+		    }
79
+
80
+		    // check if the email address already exist
81
+		    $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND id!='%s'", $modx->db->escape($email), $id));
82
+		    $limit = $modx->db->getValue($rs);
83
+		    if($limit > 0) {
84
+			    webAlertAndQuit("Email is already in use!", 12);
85
+		    }
86
+
87
+		    // generate a new password for this user
88
+		    if($specifiedpassword != "" && $passwordgenmethod == "spec") {
89
+			    if(strlen($specifiedpassword) < 6) {
90
+				    webAlertAndQuit("Password is too short!", 12);
91
+			    } else {
92
+				    $newpassword = $specifiedpassword;
93
+			    }
94
+		    } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
95
+			    webAlertAndQuit("You didn't specify a password for this user!", 12);
96
+		    } elseif($passwordgenmethod == 'g') {
97
+			    $newpassword = generate_password(8);
98
+		    } else {
99
+			    webAlertAndQuit("No password generation method specified!", 12);
100
+		    }
101
+
102
+		    // invoke OnBeforeUserFormSave event
103
+		    $modx->invokeEvent("OnBeforeUserFormSave", array(
104
+			    "mode" => "new",
105
+		    ));
106
+
107
+		    // create the user account
108
+		    $internalKey = $modx->db->insert(array('username' => $modx->db->escape($newusername)), $tbl_manager_users);
109
+
110
+		    $field = array();
111
+		    $field['password'] = $modx->phpass->HashPassword($newpassword);
112
+		    $modx->db->update($field, $tbl_manager_users, "id='{$internalKey}'");
113
+
114
+		    $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter');
115
+		    $field = $modx->db->escape($field);
116
+		    $modx->db->insert($field, $tbl_user_attributes);
117
+
118
+		    // Save user settings
119
+            saveManagerUserSettings($internalKey);
120
+
121
+		    // invoke OnManagerSaveUser event
122
+		    $modx->invokeEvent("OnManagerSaveUser", array(
123
+			    "mode" => "new",
124
+			    "userid" => $internalKey,
125
+			    "username" => $newusername,
126
+			    "userpassword" => $newpassword,
127
+			    "useremail" => $email,
128
+			    "userfullname" => $fullname,
129
+			    "userroleid" => $role
130
+		    ));
131
+
132
+		    // invoke OnUserFormSave event
133
+		    $modx->invokeEvent("OnUserFormSave", array(
134
+			    "mode" => "new",
135
+			    "id" => $internalKey
136
+		    ));
137
+
138
+		    // Set the item name for logger
139
+		    $_SESSION['itemname'] = $newusername;
140
+
141
+		    /*******************************************************************************/
142
+		    // put the user in the user_groups he/ she should be in
143
+		    // first, check that up_perms are switched on!
144
+		    if($use_udperms == 1) {
145
+			    if(!empty($user_groups)) {
146
+				    for($i = 0; $i < count($user_groups); $i++) {
147
+					    $f = array();
148
+					    $f['user_group'] = (int)$user_groups[$i];
149
+					    $f['member'] = $internalKey;
150
+					    $modx->db->insert($f, $tbl_member_groups);
151
+				    }
152
+			    }
153
+		    }
154
+		    // end of user_groups stuff!
155
+
156
+		    if($passwordnotifymethod == 'e') {
157
+                sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL);
158
+			    if($input['stay'] != '') {
159
+				    $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11";
160
+				    $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
161
+				    header($header);
162
+			    } else {
163
+				    $header = "Location: index.php?a=75&r=2";
164
+				    header($header);
165
+			    }
166
+		    } else {
167
+			    if($input['stay'] != '') {
168
+				    $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11";
169
+				    $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
170
+			    } else {
171
+				    $stayUrl = "index.php?a=75&r=2";
172
+			    }
173
+
174
+			    include_once "header.inc.php";
175
+			    ?>
176 176
 
177 177
 			<h1><?php echo $_lang['user_title']; ?></h1>
178 178
 
@@ -194,125 +194,125 @@  discard block
 block discarded – undo
194 194
 			</div>
195 195
 			<?php
196 196
 
197
-			include_once "footer.inc.php";
198
-		}
199
-		break;
200
-	case '12' : // edit user
201
-		// generate a new password for this user
202
-		if($genpassword == 1) {
203
-			if($specifiedpassword != "" && $passwordgenmethod == "spec") {
204
-				if(strlen($specifiedpassword) < 6) {
205
-					webAlertAndQuit("Password is too short!", 12);
206
-				} else {
207
-					$newpassword = $specifiedpassword;
208
-				}
209
-			} elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
210
-				webAlertAndQuit("You didn't specify a password for this user!", 12);
211
-			} elseif($passwordgenmethod == 'g') {
212
-				$newpassword = generate_password(8);
213
-			} else {
214
-				webAlertAndQuit("No password generation method specified!", 12);
215
-			}
216
-		}
217
-		if($passwordnotifymethod == 'e') {
218
-            sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL);
219
-		}
220
-
221
-		// check if the username already exist
222
-		$rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s' AND id!='%s'", $modx->db->escape($newusername), $id));
223
-		$limit = $modx->db->getValue($rs);
224
-		if($limit > 0) {
225
-			webAlertAndQuit("User name is already in use!", 12);
226
-		}
227
-
228
-		// check if the email address already exists
229
-		$rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND internalKey!='%s'", $modx->db->escape($email), $id));
230
-		$limit = $modx->db->getValue($rs);
231
-		if($limit > 0) {
232
-			webAlertAndQuit("Email is already in use!", 12);
233
-		}
234
-
235
-		// invoke OnBeforeUserFormSave event
236
-		$modx->invokeEvent("OnBeforeUserFormSave", array(
237
-			"mode" => "upd",
238
-			"id" => $id
239
-		));
240
-
241
-		// update user name and password
242
-		$field = array();
243
-		$field['username'] = $modx->db->escape($newusername);
244
-		if($genpassword == 1) {
245
-			$field['password'] = $modx->phpass->HashPassword($newpassword);
246
-		}
247
-		$modx->db->update($field, $tbl_manager_users, "id='{$id}'");
248
-		$field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter');
249
-		$field = $modx->db->escape($field);
250
-		$modx->db->update($field, $tbl_user_attributes, "internalKey='{$id}'");
251
-
252
-		// Save user settings
253
-        saveManagerUserSettings($id);
254
-
255
-		// Set the item name for logger
256
-		$_SESSION['itemname'] = $newusername;
257
-
258
-		// invoke OnManagerSaveUser event
259
-		$modx->invokeEvent("OnManagerSaveUser", array(
260
-			"mode" => "upd",
261
-			"userid" => $id,
262
-			"username" => $newusername,
263
-			"userpassword" => $newpassword,
264
-			"useremail" => $email,
265
-			"userfullname" => $fullname,
266
-			"userroleid" => $role,
267
-			"oldusername" => (($oldusername != $newusername) ? $oldusername : ""),
268
-			"olduseremail" => (($oldemail != $email) ? $oldemail : "")
269
-		));
270
-
271
-		// invoke OnManagerChangePassword event
272
-		if($genpassword == 1) {
273
-			$modx->invokeEvent("OnManagerChangePassword", array(
274
-				"userid" => $id,
275
-				"username" => $newusername,
276
-				"userpassword" => $newpassword
277
-			));
278
-		}
279
-
280
-		// invoke OnUserFormSave event
281
-		$modx->invokeEvent("OnUserFormSave", array(
282
-			"mode" => "upd",
283
-			"id" => $id
284
-		));
285
-
286
-		/*******************************************************************************/
287
-		// put the user in the user_groups he/ she should be in
288
-		// first, check that up_perms are switched on!
289
-		if($use_udperms == 1) {
290
-			// as this is an existing user, delete his/ her entries in the groups before saving the new groups
291
-			$modx->db->delete($tbl_member_groups, "member='{$id}'");
292
-			if(!empty($user_groups)) {
293
-				for($i = 0; $i < count($user_groups); $i++) {
294
-					$field = array();
295
-					$field['user_group'] = (int)$user_groups[$i];
296
-					$field['member'] = $id;
297
-					$modx->db->insert($field, $tbl_member_groups);
298
-				}
299
-			}
300
-		}
301
-		// end of user_groups stuff!
302
-		/*******************************************************************************/
303
-		if($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) {
304
-			$modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";');
305
-		}
306
-		if($genpassword == 1 && $passwordnotifymethod == 's') {
307
-			if($input['stay'] != '') {
308
-				$a = ($input['stay'] == '2') ? "12&id={$id}" : "11";
309
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
310
-			} else {
311
-				$stayUrl = "index.php?a=75&r=2";
312
-			}
313
-
314
-			include_once "header.inc.php";
315
-			?>
197
+			    include_once "footer.inc.php";
198
+		    }
199
+		    break;
200
+	    case '12' : // edit user
201
+		    // generate a new password for this user
202
+		    if($genpassword == 1) {
203
+			    if($specifiedpassword != "" && $passwordgenmethod == "spec") {
204
+				    if(strlen($specifiedpassword) < 6) {
205
+					    webAlertAndQuit("Password is too short!", 12);
206
+				    } else {
207
+					    $newpassword = $specifiedpassword;
208
+				    }
209
+			    } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
210
+				    webAlertAndQuit("You didn't specify a password for this user!", 12);
211
+			    } elseif($passwordgenmethod == 'g') {
212
+				    $newpassword = generate_password(8);
213
+			    } else {
214
+				    webAlertAndQuit("No password generation method specified!", 12);
215
+			    }
216
+		    }
217
+		    if($passwordnotifymethod == 'e') {
218
+                sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL);
219
+		    }
220
+
221
+		    // check if the username already exist
222
+		    $rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s' AND id!='%s'", $modx->db->escape($newusername), $id));
223
+		    $limit = $modx->db->getValue($rs);
224
+		    if($limit > 0) {
225
+			    webAlertAndQuit("User name is already in use!", 12);
226
+		    }
227
+
228
+		    // check if the email address already exists
229
+		    $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND internalKey!='%s'", $modx->db->escape($email), $id));
230
+		    $limit = $modx->db->getValue($rs);
231
+		    if($limit > 0) {
232
+			    webAlertAndQuit("Email is already in use!", 12);
233
+		    }
234
+
235
+		    // invoke OnBeforeUserFormSave event
236
+		    $modx->invokeEvent("OnBeforeUserFormSave", array(
237
+			    "mode" => "upd",
238
+			    "id" => $id
239
+		    ));
240
+
241
+		    // update user name and password
242
+		    $field = array();
243
+		    $field['username'] = $modx->db->escape($newusername);
244
+		    if($genpassword == 1) {
245
+			    $field['password'] = $modx->phpass->HashPassword($newpassword);
246
+		    }
247
+		    $modx->db->update($field, $tbl_manager_users, "id='{$id}'");
248
+		    $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter');
249
+		    $field = $modx->db->escape($field);
250
+		    $modx->db->update($field, $tbl_user_attributes, "internalKey='{$id}'");
251
+
252
+		    // Save user settings
253
+            saveManagerUserSettings($id);
254
+
255
+		    // Set the item name for logger
256
+		    $_SESSION['itemname'] = $newusername;
257
+
258
+		    // invoke OnManagerSaveUser event
259
+		    $modx->invokeEvent("OnManagerSaveUser", array(
260
+			    "mode" => "upd",
261
+			    "userid" => $id,
262
+			    "username" => $newusername,
263
+			    "userpassword" => $newpassword,
264
+			    "useremail" => $email,
265
+			    "userfullname" => $fullname,
266
+			    "userroleid" => $role,
267
+			    "oldusername" => (($oldusername != $newusername) ? $oldusername : ""),
268
+			    "olduseremail" => (($oldemail != $email) ? $oldemail : "")
269
+		    ));
270
+
271
+		    // invoke OnManagerChangePassword event
272
+		    if($genpassword == 1) {
273
+			    $modx->invokeEvent("OnManagerChangePassword", array(
274
+				    "userid" => $id,
275
+				    "username" => $newusername,
276
+				    "userpassword" => $newpassword
277
+			    ));
278
+		    }
279
+
280
+		    // invoke OnUserFormSave event
281
+		    $modx->invokeEvent("OnUserFormSave", array(
282
+			    "mode" => "upd",
283
+			    "id" => $id
284
+		    ));
285
+
286
+		    /*******************************************************************************/
287
+		    // put the user in the user_groups he/ she should be in
288
+		    // first, check that up_perms are switched on!
289
+		    if($use_udperms == 1) {
290
+			    // as this is an existing user, delete his/ her entries in the groups before saving the new groups
291
+			    $modx->db->delete($tbl_member_groups, "member='{$id}'");
292
+			    if(!empty($user_groups)) {
293
+				    for($i = 0; $i < count($user_groups); $i++) {
294
+					    $field = array();
295
+					    $field['user_group'] = (int)$user_groups[$i];
296
+					    $field['member'] = $id;
297
+					    $modx->db->insert($field, $tbl_member_groups);
298
+				    }
299
+			    }
300
+		    }
301
+		    // end of user_groups stuff!
302
+		    /*******************************************************************************/
303
+		    if($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) {
304
+			    $modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";');
305
+		    }
306
+		    if($genpassword == 1 && $passwordnotifymethod == 's') {
307
+			    if($input['stay'] != '') {
308
+				    $a = ($input['stay'] == '2') ? "12&id={$id}" : "11";
309
+				    $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
310
+			    } else {
311
+				    $stayUrl = "index.php?a=75&r=2";
312
+			    }
313
+
314
+			    include_once "header.inc.php";
315
+			    ?>
316 316
 
317 317
 			<h1><?php echo $_lang['user_title']; ?></h1>
318 318
 
@@ -332,18 +332,18 @@  discard block
 block discarded – undo
332 332
 			</div>
333 333
 			<?php
334 334
 
335
-			include_once "footer.inc.php";
336
-		} else {
337
-			if($input['stay'] != '') {
338
-				$a = ($input['stay'] == '2') ? "12&id={$id}" : "11";
339
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
340
-				header($header);
341
-			} else {
342
-				$header = "Location: index.php?a=75&r=2";
343
-				header($header);
344
-			}
345
-		}
346
-		break;
347
-	default:
348
-		webAlertAndQuit("No operation set in request.", 12);
335
+			    include_once "footer.inc.php";
336
+		    } else {
337
+			    if($input['stay'] != '') {
338
+				    $a = ($input['stay'] == '2') ? "12&id={$id}" : "11";
339
+				    $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
340
+				    header($header);
341
+			    } else {
342
+				    $header = "Location: index.php?a=75&r=2";
343
+				    header($header);
344
+			    }
345
+		    }
346
+		    break;
347
+	    default:
348
+		    webAlertAndQuit("No operation set in request.", 12);
349 349
 }
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  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
-if(!$modx->hasPermission('save_user')) {
5
+if (!$modx->hasPermission('save_user')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 $input = $_POST;
16 16
 
17
-$id = (int)$input['id'];
17
+$id = (int) $input['id'];
18 18
 $oldusername = $input['oldusername'];
19 19
 $newusername = !empty ($input['newusername']) ? trim($input['newusername']) : "New User";
20 20
 $fullname = $input['fullname'];
@@ -44,56 +44,56 @@  discard block
 block discarded – undo
44 44
 $user_groups = $input['user_groups'];
45 45
 
46 46
 // verify password
47
-if($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) {
47
+if ($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) {
48 48
 	webAlertAndQuit("Password typed is mismatched", 12);
49 49
 }
50 50
 
51 51
 // verify email
52
-if($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) {
52
+if ($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) {
53 53
 	webAlertAndQuit("E-mail address doesn't seem to be valid!", 12);
54 54
 }
55 55
 
56 56
 // verify admin security
57
-if($_SESSION['mgrRole'] != 1) {
57
+if ($_SESSION['mgrRole'] != 1) {
58 58
 	// Check to see if user tried to spoof a "1" (admin) role
59
-	if(!$modx->hasPermission('save_role')) {
59
+	if (!$modx->hasPermission('save_role')) {
60 60
 		webAlertAndQuit("Illegal attempt to create/modify administrator by non-administrator!", 12);
61 61
 	}
62 62
 	// Verify that the user being edited wasn't an admin and the user ID got spoofed
63 63
 	$rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, "internalKey='{$id}' AND role=1");
64 64
 	$limit = $modx->db->getValue($rs);
65
-	if($limit > 0) {
65
+	if ($limit > 0) {
66 66
 		webAlertAndQuit("You cannot alter an administrative user.", 12);
67 67
 	}
68 68
 
69 69
 }
70 70
 
71
-switch($input['mode']) {
71
+switch ($input['mode']) {
72 72
 	case '11' : // new user
73 73
 		// check if this user name already exist
74 74
 		$rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s'", $modx->db->escape($newusername)));
75 75
 		$limit = $modx->db->getValue($rs);
76
-		if($limit > 0) {
76
+		if ($limit > 0) {
77 77
 			webAlertAndQuit("User name is already in use!", 12);
78 78
 		}
79 79
 
80 80
 		// check if the email address already exist
81 81
 		$rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND id!='%s'", $modx->db->escape($email), $id));
82 82
 		$limit = $modx->db->getValue($rs);
83
-		if($limit > 0) {
83
+		if ($limit > 0) {
84 84
 			webAlertAndQuit("Email is already in use!", 12);
85 85
 		}
86 86
 
87 87
 		// generate a new password for this user
88
-		if($specifiedpassword != "" && $passwordgenmethod == "spec") {
89
-			if(strlen($specifiedpassword) < 6) {
88
+		if ($specifiedpassword != "" && $passwordgenmethod == "spec") {
89
+			if (strlen($specifiedpassword) < 6) {
90 90
 				webAlertAndQuit("Password is too short!", 12);
91 91
 			} else {
92 92
 				$newpassword = $specifiedpassword;
93 93
 			}
94
-		} elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
94
+		} elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") {
95 95
 			webAlertAndQuit("You didn't specify a password for this user!", 12);
96
-		} elseif($passwordgenmethod == 'g') {
96
+		} elseif ($passwordgenmethod == 'g') {
97 97
 			$newpassword = generate_password(8);
98 98
 		} else {
99 99
 			webAlertAndQuit("No password generation method specified!", 12);
@@ -141,11 +141,11 @@  discard block
 block discarded – undo
141 141
 		/*******************************************************************************/
142 142
 		// put the user in the user_groups he/ she should be in
143 143
 		// first, check that up_perms are switched on!
144
-		if($use_udperms == 1) {
145
-			if(!empty($user_groups)) {
146
-				for($i = 0; $i < count($user_groups); $i++) {
144
+		if ($use_udperms == 1) {
145
+			if (!empty($user_groups)) {
146
+				for ($i = 0; $i < count($user_groups); $i++) {
147 147
 					$f = array();
148
-					$f['user_group'] = (int)$user_groups[$i];
148
+					$f['user_group'] = (int) $user_groups[$i];
149 149
 					$f['member'] = $internalKey;
150 150
 					$modx->db->insert($f, $tbl_member_groups);
151 151
 				}
@@ -153,20 +153,20 @@  discard block
 block discarded – undo
153 153
 		}
154 154
 		// end of user_groups stuff!
155 155
 
156
-		if($passwordnotifymethod == 'e') {
156
+		if ($passwordnotifymethod == 'e') {
157 157
             sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL);
158
-			if($input['stay'] != '') {
158
+			if ($input['stay'] != '') {
159 159
 				$a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11";
160
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
160
+				$header = "Location: index.php?a={$a}&r=2&stay=".$input['stay'];
161 161
 				header($header);
162 162
 			} else {
163 163
 				$header = "Location: index.php?a=75&r=2";
164 164
 				header($header);
165 165
 			}
166 166
 		} else {
167
-			if($input['stay'] != '') {
167
+			if ($input['stay'] != '') {
168 168
 				$a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11";
169
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
169
+				$stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay'];
170 170
 			} else {
171 171
 				$stayUrl = "index.php?a=75&r=2";
172 172
 			}
@@ -199,36 +199,36 @@  discard block
 block discarded – undo
199 199
 		break;
200 200
 	case '12' : // edit user
201 201
 		// generate a new password for this user
202
-		if($genpassword == 1) {
203
-			if($specifiedpassword != "" && $passwordgenmethod == "spec") {
204
-				if(strlen($specifiedpassword) < 6) {
202
+		if ($genpassword == 1) {
203
+			if ($specifiedpassword != "" && $passwordgenmethod == "spec") {
204
+				if (strlen($specifiedpassword) < 6) {
205 205
 					webAlertAndQuit("Password is too short!", 12);
206 206
 				} else {
207 207
 					$newpassword = $specifiedpassword;
208 208
 				}
209
-			} elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
209
+			} elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") {
210 210
 				webAlertAndQuit("You didn't specify a password for this user!", 12);
211
-			} elseif($passwordgenmethod == 'g') {
211
+			} elseif ($passwordgenmethod == 'g') {
212 212
 				$newpassword = generate_password(8);
213 213
 			} else {
214 214
 				webAlertAndQuit("No password generation method specified!", 12);
215 215
 			}
216 216
 		}
217
-		if($passwordnotifymethod == 'e') {
217
+		if ($passwordnotifymethod == 'e') {
218 218
             sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL);
219 219
 		}
220 220
 
221 221
 		// check if the username already exist
222 222
 		$rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s' AND id!='%s'", $modx->db->escape($newusername), $id));
223 223
 		$limit = $modx->db->getValue($rs);
224
-		if($limit > 0) {
224
+		if ($limit > 0) {
225 225
 			webAlertAndQuit("User name is already in use!", 12);
226 226
 		}
227 227
 
228 228
 		// check if the email address already exists
229 229
 		$rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND internalKey!='%s'", $modx->db->escape($email), $id));
230 230
 		$limit = $modx->db->getValue($rs);
231
-		if($limit > 0) {
231
+		if ($limit > 0) {
232 232
 			webAlertAndQuit("Email is already in use!", 12);
233 233
 		}
234 234
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 		// update user name and password
242 242
 		$field = array();
243 243
 		$field['username'] = $modx->db->escape($newusername);
244
-		if($genpassword == 1) {
244
+		if ($genpassword == 1) {
245 245
 			$field['password'] = $modx->phpass->HashPassword($newpassword);
246 246
 		}
247 247
 		$modx->db->update($field, $tbl_manager_users, "id='{$id}'");
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 		));
270 270
 
271 271
 		// invoke OnManagerChangePassword event
272
-		if($genpassword == 1) {
272
+		if ($genpassword == 1) {
273 273
 			$modx->invokeEvent("OnManagerChangePassword", array(
274 274
 				"userid" => $id,
275 275
 				"username" => $newusername,
@@ -286,13 +286,13 @@  discard block
 block discarded – undo
286 286
 		/*******************************************************************************/
287 287
 		// put the user in the user_groups he/ she should be in
288 288
 		// first, check that up_perms are switched on!
289
-		if($use_udperms == 1) {
289
+		if ($use_udperms == 1) {
290 290
 			// as this is an existing user, delete his/ her entries in the groups before saving the new groups
291 291
 			$modx->db->delete($tbl_member_groups, "member='{$id}'");
292
-			if(!empty($user_groups)) {
293
-				for($i = 0; $i < count($user_groups); $i++) {
292
+			if (!empty($user_groups)) {
293
+				for ($i = 0; $i < count($user_groups); $i++) {
294 294
 					$field = array();
295
-					$field['user_group'] = (int)$user_groups[$i];
295
+					$field['user_group'] = (int) $user_groups[$i];
296 296
 					$field['member'] = $id;
297 297
 					$modx->db->insert($field, $tbl_member_groups);
298 298
 				}
@@ -300,13 +300,13 @@  discard block
 block discarded – undo
300 300
 		}
301 301
 		// end of user_groups stuff!
302 302
 		/*******************************************************************************/
303
-		if($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) {
303
+		if ($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) {
304 304
 			$modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";');
305 305
 		}
306
-		if($genpassword == 1 && $passwordnotifymethod == 's') {
307
-			if($input['stay'] != '') {
306
+		if ($genpassword == 1 && $passwordnotifymethod == 's') {
307
+			if ($input['stay'] != '') {
308 308
 				$a = ($input['stay'] == '2') ? "12&id={$id}" : "11";
309
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
309
+				$stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay'];
310 310
 			} else {
311 311
 				$stayUrl = "index.php?a=75&r=2";
312 312
 			}
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 				<div class="sectionHeader"><?php echo $_lang['user_title']; ?></div>
327 327
 				<div class="sectionBody">
328 328
 					<div id="disp">
329
-						<p><?php echo sprintf($_lang["password_msg"], $modx->htmlspecialchars($newusername), $modx->htmlspecialchars($newpassword)) . (($id == $modx->getLoginUserID()) ? ' ' . $_lang['user_changeddata'] : ''); ?></p>
329
+						<p><?php echo sprintf($_lang["password_msg"], $modx->htmlspecialchars($newusername), $modx->htmlspecialchars($newpassword)).(($id == $modx->getLoginUserID()) ? ' '.$_lang['user_changeddata'] : ''); ?></p>
330 330
 					</div>
331 331
 				</div>
332 332
 			</div>
@@ -334,9 +334,9 @@  discard block
 block discarded – undo
334 334
 
335 335
 			include_once "footer.inc.php";
336 336
 		} else {
337
-			if($input['stay'] != '') {
337
+			if ($input['stay'] != '') {
338 338
 				$a = ($input['stay'] == '2') ? "12&id={$id}" : "11";
339
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
339
+				$header = "Location: index.php?a={$a}&r=2&stay=".$input['stay'];
340 340
 				header($header);
341 341
 			} else {
342 342
 				$header = "Location: index.php?a=75&r=2";
Please login to merge, or discard this patch.