Completed
Push — develop ( 4e806c...6a553b )
by Agel_Nash
10:03
created
manager/actions/mutate_module.dynamic.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  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
-switch($modx->getManagerApi()->action) {
5
+switch ($modx->getManagerApi()->action) {
6 6
 	case 107:
7
-		if(!$modx->hasPermission('new_module')) {
7
+		if (!$modx->hasPermission('new_module')) {
8 8
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
9 9
 		}
10 10
 		break;
11 11
 	case 108:
12
-		if(!$modx->hasPermission('edit_module')) {
12
+		if (!$modx->hasPermission('edit_module')) {
13 13
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
14 14
 		}
15 15
 		break;
16 16
 	default:
17 17
 		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
18 18
 }
19
-$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
19
+$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
20 20
 // Get table names (alphabetical)
21 21
 $tbl_membergroup_names = $modx->getDatabase()->getFullTableName('membergroup_names');
22 22
 $tbl_site_content = $modx->getDatabase()->getFullTableName('site_content');
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 
33 33
 // check to see the module editor isn't locked
34
-if($lockedEl = $modx->elementIsLocked(6, $id)) {
34
+if ($lockedEl = $modx->elementIsLocked(6, $id)) {
35 35
 	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module']));
36 36
 }
37 37
 // end check for lock
@@ -39,29 +39,29 @@  discard block
 block discarded – undo
39 39
 // Lock snippet for other users to edit
40 40
 $modx->lockElement(6, $id);
41 41
 
42
-if(isset($_GET['id'])) {
42
+if (isset($_GET['id'])) {
43 43
 	$rs = $modx->getDatabase()->select('*', $tbl_site_modules, "id='{$id}'");
44 44
 	$content = $modx->getDatabase()->getRow($rs);
45
-	if(!$content) {
45
+	if (!$content) {
46 46
 		$modx->webAlertAndQuit("Module not found for id '{$id}'.");
47 47
 	}
48 48
 	$content['properties'] = str_replace("&", "&amp;", $content['properties']);
49 49
 	$_SESSION['itemname'] = $content['name'];
50
-	if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
50
+	if ($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
51 51
 		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
52 52
 	}
53 53
 } else {
54 54
 	$_SESSION['itemname'] = $_lang["new_module"];
55 55
 	$content['wrap'] = '1';
56 56
 }
57
-if($modx->getManagerApi()->hasFormValues()) {
57
+if ($modx->getManagerApi()->hasFormValues()) {
58 58
 	$modx->getManagerApi()->loadFormValues();
59 59
 }
60 60
 
61 61
 // Add lock-element JS-Script
62 62
 $lockElementId = $id;
63 63
 $lockElementType = 6;
64
-require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php');
64
+require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php');
65 65
 ?>
66 66
 <script type="text/javascript">
67 67
 	function loadDependencies() {
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 	function BrowseServer() {
409 409
 		var w = screen.width * 0.7;
410 410
 		var h = screen.height * 0.7;
411
-		OpenServerBrowser("<?= MODX_MANAGER_URL;?>media/browser/<?= $which_browser;?>/browser.php?Type=images", w, h);
411
+		OpenServerBrowser("<?= MODX_MANAGER_URL; ?>media/browser/<?= $which_browser; ?>/browser.php?Type=images", w, h);
412 412
 	}
413 413
 
414 414
 	function SetUrl(url, width, height, alt) {
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 	<?php
429 429
 	// invoke OnModFormPrerender event
430 430
 	$evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id));
431
-	if(is_array($evtOut)) {
431
+	if (is_array($evtOut)) {
432 432
 		echo implode('', $evtOut);
433 433
 	}
434 434
 
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 	<input type="hidden" name="mode" value="<?= $modx->getManagerApi()->action ?>">
443 443
 
444 444
 	<h1>
445
-		<i class="<?= ($content['icon'] != '' ? $content['icon'] : $_style['icons_module']) ?>"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['new_module']) ?><i class="fa fa-question-circle help"></i>
445
+		<i class="<?= ($content['icon'] != '' ? $content['icon'] : $_style['icons_module']) ?>"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['new_module']) ?><i class="fa fa-question-circle help"></i>
446 446
 	</h1>
447 447
 
448 448
 	<?= $_style['actionbuttons']['dynamic']['element'] ?>
@@ -467,8 +467,8 @@  discard block
 block discarded – undo
467 467
 						<div class="col-md-9 col-lg-10">
468 468
 							<div class="form-control-name clearfix">
469 469
 								<input name="name" type="text" maxlength="100" value="<?= $modx->getPhpCompat()->htmlspecialchars($content['name']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;" />
470
-								<?php if($modx->hasPermission('save_role')): ?>
471
-									<label class="custom-control" title="<?= $_lang['lock_module'] . "\n" . $_lang['lock_module_msg'] ?>" tooltip>
470
+								<?php if ($modx->hasPermission('save_role')): ?>
471
+									<label class="custom-control" title="<?= $_lang['lock_module']."\n".$_lang['lock_module_msg'] ?>" tooltip>
472 472
 										<input name="locked" type="checkbox"<?= ($content['locked'] == 1 ? ' checked="checked"' : '') ?> />
473 473
 										<i class="fa fa-lock"></i>
474 474
 									</label>
@@ -490,9 +490,9 @@  discard block
 block discarded – undo
490 490
 							<select name="categoryid" class="form-control" onchange="documentDirty=true;">
491 491
 								<option>&nbsp;</option>
492 492
 								<?php
493
-								include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
494
-								foreach(getCategories() as $n => $v) {
495
-									echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->getPhpCompat()->htmlspecialchars($v['category']) . "</option>\n";
493
+								include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
494
+								foreach (getCategories() as $n => $v) {
495
+									echo "\t\t\t".'<option value="'.$v['id'].'"'.($content['category'] == $v['id'] ? ' selected="selected"' : '').'>'.$modx->getPhpCompat()->htmlspecialchars($v['category'])."</option>\n";
496 496
 								}
497 497
 								?>
498 498
 							</select>
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 				<div class="form-group">
525 525
 					<div class="form-row">
526 526
 						<label for="disabled"><input name="disabled" id="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> />
527
-							<?= ($content['disabled'] == 1 ? '<span class="text-danger">' . $_lang['module_disabled'] . '</span>' : $_lang['module_disabled']) ?></label>
527
+							<?= ($content['disabled'] == 1 ? '<span class="text-danger">'.$_lang['module_disabled'].'</span>' : $_lang['module_disabled']) ?></label>
528 528
 					</div>
529 529
 					<div class="form-row">
530 530
 						<label for="parse_docblock">
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 			</div>
590 590
 			<!-- HTML text editor end -->
591 591
 		</div>
592
-		<?php if($modx->getManagerApi()->action == '108'): ?>
592
+		<?php if ($modx->getManagerApi()->action == '108'): ?>
593 593
 			<!-- Dependencies -->
594 594
 			<div class="tab-page" id="tabDepend">
595 595
 				<h2 class="tab"><?= $_lang['settings_dependencies'] ?></h2>
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 					$grd->columnHeaderClass = 'gridHeader';
624 624
 					$grd->itemClass = 'gridItem';
625 625
 					$grd->altItemClass = 'gridAltItem';
626
-					$grd->columns = $_lang['element_name'] . " ," . $_lang['type'];
626
+					$grd->columns = $_lang['element_name']." ,".$_lang['type'];
627 627
 					$grd->fields = "name,type";
628 628
 					echo $grd->render();
629 629
 					?>
@@ -636,13 +636,13 @@  discard block
 block discarded – undo
636 636
 			<h2 class="tab"><?= $_lang['access_permissions'] ?></h2>
637 637
 			<script type="text/javascript">tp.addTabPage(document.getElementById("tabPermissions"));</script>
638 638
 			<div class="container container-body">
639
-				<?php if($use_udperms == 1) : ?>
639
+				<?php if ($use_udperms == 1) : ?>
640 640
 					<?php
641 641
 					// fetch user access permissions for the module
642 642
 					$rs = $modx->getDatabase()->select('usergroup', $tbl_site_module_access, "module='{$id}'");
643 643
 					$groupsarray = $modx->getDatabase()->getColumn('usergroup', $rs);
644 644
 
645
-					if($modx->hasPermission('access_permissions')) {
645
+					if ($modx->hasPermission('access_permissions')) {
646 646
 						?>
647 647
 						<!-- User Group Access Permissions -->
648 648
 						<script type="text/javascript">
@@ -670,22 +670,22 @@  discard block
 block discarded – undo
670 670
 					}
671 671
 					$chk = '';
672 672
 					$rs = $modx->getDatabase()->select('name, id', $tbl_membergroup_names, '', 'name');
673
-					while($row = $modx->getDatabase()->getRow($rs)) {
673
+					while ($row = $modx->getDatabase()->getRow($rs)) {
674 674
 						$groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array();
675 675
 						$checked = in_array($row['id'], $groupsarray);
676
-						if($modx->hasPermission('access_permissions')) {
677
-							if($checked) {
676
+						if ($modx->hasPermission('access_permissions')) {
677
+							if ($checked) {
678 678
 								$notPublic = true;
679 679
 							}
680
-							$chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n";
680
+							$chks .= '<label><input type="checkbox" name="usrgroups[]" value="'.$row['id'].'"'.($checked ? ' checked="checked"' : '').' onclick="makePublic(false)" /> '.$row['name']."</label><br />\n";
681 681
 						} else {
682
-							if($checked) {
683
-								$chks = '<input type="hidden" name="usrgroups[]"  value="' . $row['id'] . '" />' . "\n" . $chks;
682
+							if ($checked) {
683
+								$chks = '<input type="hidden" name="usrgroups[]"  value="'.$row['id'].'" />'."\n".$chks;
684 684
 							}
685 685
 						}
686 686
 					}
687
-					if($modx->hasPermission('access_permissions')) {
688
-						$chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks;
687
+					if ($modx->hasPermission('access_permissions')) {
688
+						$chks = '<label><input type="checkbox" name="chkallgroups"'.(!$notPublic ? ' checked="checked"' : '').' onclick="makePublic(true)" /><span class="warning"> '.$_lang['all_usr_groups'].'</span></label><br />'."\n".$chks;
689 689
 					}
690 690
 					echo $chks;
691 691
 					?>
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
 		<?php
707 707
 		// invoke OnModFormRender event
708 708
 		$evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id));
709
-		if(is_array($evtOut)) {
709
+		if (is_array($evtOut)) {
710 710
 			echo implode('', $evtOut);
711 711
 		}
712 712
 		?>
Please login to merge, or discard this patch.
manager/actions/site_schedule.static.php 3 patches
Indentation   +38 added lines, -38 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('view_eventlog')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 ?>
9 9
 <script type="text/javascript" src="media/script/tablesort.js"></script>
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
 		<div class="form-group" id="lyr1">
18 18
 			<b><?= $_lang["publish_events"] ?></b>
19 19
 			<?php
20
-			$rs = $modx->getDatabase()->select('id, pagetitle, pub_date', $modx->getDatabase()->getFullTableName('site_content'), "pub_date > " . time() . "", 'pub_date ASC');
21
-			$limit = $modx->getDatabase()->getRecordCount($rs);
22
-			if($limit < 1) {
23
-				?>
20
+            $rs = $modx->getDatabase()->select('id, pagetitle, pub_date', $modx->getDatabase()->getFullTableName('site_content'), "pub_date > " . time() . "", 'pub_date ASC');
21
+            $limit = $modx->getDatabase()->getRecordCount($rs);
22
+            if($limit < 1) {
23
+                ?>
24 24
 				<p><?= $_lang["no_docs_pending_publishing"] ?></p>
25 25
 				<?php
26
-			} else {
27
-				?>
26
+            } else {
27
+                ?>
28 28
 				<div class="table-responsive">
29 29
 					<table class="grid sortabletable" id="table-1">
30 30
 						<thead>
@@ -36,34 +36,34 @@  discard block
 block discarded – undo
36 36
 						</thead>
37 37
 						<tbody>
38 38
 						<?php
39
-						while($row = $modx->getDatabase()->getRow($rs)) {
40
-							?>
39
+                        while($row = $modx->getDatabase()->getRow($rs)) {
40
+                            ?>
41 41
 							<tr>
42 42
 								<td class="text-right"><?= $row['id'] ?></td>
43 43
 								<td><a href="index.php?a=3&id=<?= $row['id'] ?>"><?= $row['pagetitle'] ?></a></td>
44 44
 								<td class="text-nowrap text-right"><?= $modx->toDateFormat($row['pub_date'] + $server_offset_time) ?></td>
45 45
 							</tr>
46 46
 							<?php
47
-						}
48
-						?>
47
+                        }
48
+                        ?>
49 49
 						</tbody>
50 50
 					</table>
51 51
 				</div>
52 52
 				<?php
53
-			}
54
-			?>
53
+            }
54
+            ?>
55 55
 		</div>
56 56
 		<div class="form-group" id="lyr2">
57 57
 			<b><?= $_lang["unpublish_events"] ?></b>
58 58
 			<?php
59
-			$rs = $modx->getDatabase()->select('id, pagetitle, unpub_date', $modx->getDatabase()->getFullTableName('site_content'), "unpub_date > " . time() . "", 'unpub_date ASC');
60
-			$limit = $modx->getDatabase()->getRecordCount($rs);
61
-			if($limit < 1) {
62
-				?>
59
+            $rs = $modx->getDatabase()->select('id, pagetitle, unpub_date', $modx->getDatabase()->getFullTableName('site_content'), "unpub_date > " . time() . "", 'unpub_date ASC');
60
+            $limit = $modx->getDatabase()->getRecordCount($rs);
61
+            if($limit < 1) {
62
+                ?>
63 63
 				<p><?= $_lang["no_docs_pending_unpublishing"] ?></p>
64 64
 				<?php
65
-			} else {
66
-				?>
65
+            } else {
66
+                ?>
67 67
 				<div class="table-responsive">
68 68
 					<table class="grid sortabletable" id="table-2">
69 69
 						<thead>
@@ -75,34 +75,34 @@  discard block
 block discarded – undo
75 75
 						</thead>
76 76
 						<tbody>
77 77
 						<?php
78
-						while($row = $modx->getDatabase()->getRow($rs)) {
79
-							?>
78
+                        while($row = $modx->getDatabase()->getRow($rs)) {
79
+                            ?>
80 80
 							<tr>
81 81
 								<td class="text-right"><?= $row['id'] ?></td>
82 82
 								<td><a href="index.php?a=3&id=<?= $row['id'] ?>"><?= $row['pagetitle'] ?></a></td>
83 83
 								<td class="text-nowrap text-right"><?= $modx->toDateFormat($row['unpub_date'] + $server_offset_time) ?></td>
84 84
 							</tr>
85 85
 							<?php
86
-						}
87
-						?>
86
+                        }
87
+                        ?>
88 88
 						</tbody>
89 89
 					</table>
90 90
 				</div>
91 91
 				<?php
92
-			}
93
-			?>
92
+            }
93
+            ?>
94 94
 		</div>
95 95
 		<div class="form-group">
96 96
 			<b><?= $_lang["all_events"] ?></b>
97 97
 			<?php
98
-			$rs = $modx->getDatabase()->select('id, pagetitle, pub_date, unpub_date', $modx->getDatabase()->getFullTableName('site_content'), "pub_date > 0 OR unpub_date > 0", "pub_date DESC");
99
-			$limit = $modx->getDatabase()->getRecordCount($rs);
100
-			if($limit < 1) {
101
-				?>
98
+            $rs = $modx->getDatabase()->select('id, pagetitle, pub_date, unpub_date', $modx->getDatabase()->getFullTableName('site_content'), "pub_date > 0 OR unpub_date > 0", "pub_date DESC");
99
+            $limit = $modx->getDatabase()->getRecordCount($rs);
100
+            if($limit < 1) {
101
+                ?>
102 102
 				<p><?= $_lang["no_docs_pending_pubunpub"] ?></p>
103 103
 				<?php
104
-			} else {
105
-				?>
104
+            } else {
105
+                ?>
106 106
 				<div class="table-responsive">
107 107
 					<table class="grid sortabletable" id="table-3">
108 108
 						<thead>
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 						</thead>
116 116
 						<tbody>
117 117
 						<?php
118
-						while($row = $modx->getDatabase()->getRow($rs)) {
119
-							?>
118
+                        while($row = $modx->getDatabase()->getRow($rs)) {
119
+                            ?>
120 120
 							<tr>
121 121
 								<td class="text-right"><?= $row['id'] ?></td>
122 122
 								<td><a href="index.php?a=3&id=<?= $row['id'] ?>"><?= $row['pagetitle'] ?></a></td>
@@ -124,14 +124,14 @@  discard block
 block discarded – undo
124 124
 								<td class="text-nowrap text-right"><?= $row['unpub_date'] == 0 ? "" : $modx->toDateFormat($row['unpub_date'] + $server_offset_time) ?></td>
125 125
 							</tr>
126 126
 							<?php
127
-						}
128
-						?>
127
+                        }
128
+                        ?>
129 129
 						</tbody>
130 130
 					</table>
131 131
 				</div>
132 132
 				<?php
133
-			}
134
-			?>
133
+            }
134
+            ?>
135 135
 		</div>
136 136
 	</div>
137 137
 </div>
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 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('view_eventlog')) {
5
+if (!$modx->hasPermission('view_eventlog')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 ?>
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
 		<div class="form-group" id="lyr1">
18 18
 			<b><?= $_lang["publish_events"] ?></b>
19 19
 			<?php
20
-			$rs = $modx->getDatabase()->select('id, pagetitle, pub_date', $modx->getDatabase()->getFullTableName('site_content'), "pub_date > " . time() . "", 'pub_date ASC');
20
+			$rs = $modx->getDatabase()->select('id, pagetitle, pub_date', $modx->getDatabase()->getFullTableName('site_content'), "pub_date > ".time()."", 'pub_date ASC');
21 21
 			$limit = $modx->getDatabase()->getRecordCount($rs);
22
-			if($limit < 1) {
22
+			if ($limit < 1) {
23 23
 				?>
24 24
 				<p><?= $_lang["no_docs_pending_publishing"] ?></p>
25 25
 				<?php
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 						</thead>
37 37
 						<tbody>
38 38
 						<?php
39
-						while($row = $modx->getDatabase()->getRow($rs)) {
39
+						while ($row = $modx->getDatabase()->getRow($rs)) {
40 40
 							?>
41 41
 							<tr>
42 42
 								<td class="text-right"><?= $row['id'] ?></td>
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
 		<div class="form-group" id="lyr2">
57 57
 			<b><?= $_lang["unpublish_events"] ?></b>
58 58
 			<?php
59
-			$rs = $modx->getDatabase()->select('id, pagetitle, unpub_date', $modx->getDatabase()->getFullTableName('site_content'), "unpub_date > " . time() . "", 'unpub_date ASC');
59
+			$rs = $modx->getDatabase()->select('id, pagetitle, unpub_date', $modx->getDatabase()->getFullTableName('site_content'), "unpub_date > ".time()."", 'unpub_date ASC');
60 60
 			$limit = $modx->getDatabase()->getRecordCount($rs);
61
-			if($limit < 1) {
61
+			if ($limit < 1) {
62 62
 				?>
63 63
 				<p><?= $_lang["no_docs_pending_unpublishing"] ?></p>
64 64
 				<?php
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 						</thead>
76 76
 						<tbody>
77 77
 						<?php
78
-						while($row = $modx->getDatabase()->getRow($rs)) {
78
+						while ($row = $modx->getDatabase()->getRow($rs)) {
79 79
 							?>
80 80
 							<tr>
81 81
 								<td class="text-right"><?= $row['id'] ?></td>
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 			<?php
98 98
 			$rs = $modx->getDatabase()->select('id, pagetitle, pub_date, unpub_date', $modx->getDatabase()->getFullTableName('site_content'), "pub_date > 0 OR unpub_date > 0", "pub_date DESC");
99 99
 			$limit = $modx->getDatabase()->getRecordCount($rs);
100
-			if($limit < 1) {
100
+			if ($limit < 1) {
101 101
 				?>
102 102
 				<p><?= $_lang["no_docs_pending_pubunpub"] ?></p>
103 103
 				<?php
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 						</thead>
116 116
 						<tbody>
117 117
 						<?php
118
-						while($row = $modx->getDatabase()->getRow($rs)) {
118
+						while ($row = $modx->getDatabase()->getRow($rs)) {
119 119
 							?>
120 120
 							<tr>
121 121
 								<td class="text-right"><?= $row['id'] ?></td>
Please login to merge, or discard this patch.
Braces   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2
-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('view_eventlog')) {
5
+if(!$modx->hasPermission('view_eventlog')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 ?>
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
 			<?php
20 20
 			$rs = $modx->getDatabase()->select('id, pagetitle, pub_date', $modx->getDatabase()->getFullTableName('site_content'), "pub_date > " . time() . "", 'pub_date ASC');
21 21
 			$limit = $modx->getDatabase()->getRecordCount($rs);
22
-			if($limit < 1) {
22
+			if($limit < 1) {
23 23
 				?>
24 24
 				<p><?= $_lang["no_docs_pending_publishing"] ?></p>
25 25
 				<?php
26
-			} else {
26
+			} else {
27 27
 				?>
28 28
 				<div class="table-responsive">
29 29
 					<table class="grid sortabletable" id="table-1">
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 						</thead>
37 37
 						<tbody>
38 38
 						<?php
39
-						while($row = $modx->getDatabase()->getRow($rs)) {
39
+						while($row = $modx->getDatabase()->getRow($rs)) {
40 40
 							?>
41 41
 							<tr>
42 42
 								<td class="text-right"><?= $row['id'] ?></td>
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
 			<?php
59 59
 			$rs = $modx->getDatabase()->select('id, pagetitle, unpub_date', $modx->getDatabase()->getFullTableName('site_content'), "unpub_date > " . time() . "", 'unpub_date ASC');
60 60
 			$limit = $modx->getDatabase()->getRecordCount($rs);
61
-			if($limit < 1) {
61
+			if($limit < 1) {
62 62
 				?>
63 63
 				<p><?= $_lang["no_docs_pending_unpublishing"] ?></p>
64 64
 				<?php
65
-			} else {
65
+			} else {
66 66
 				?>
67 67
 				<div class="table-responsive">
68 68
 					<table class="grid sortabletable" id="table-2">
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 						</thead>
76 76
 						<tbody>
77 77
 						<?php
78
-						while($row = $modx->getDatabase()->getRow($rs)) {
78
+						while($row = $modx->getDatabase()->getRow($rs)) {
79 79
 							?>
80 80
 							<tr>
81 81
 								<td class="text-right"><?= $row['id'] ?></td>
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
 			<?php
98 98
 			$rs = $modx->getDatabase()->select('id, pagetitle, pub_date, unpub_date', $modx->getDatabase()->getFullTableName('site_content'), "pub_date > 0 OR unpub_date > 0", "pub_date DESC");
99 99
 			$limit = $modx->getDatabase()->getRecordCount($rs);
100
-			if($limit < 1) {
100
+			if($limit < 1) {
101 101
 				?>
102 102
 				<p><?= $_lang["no_docs_pending_pubunpub"] ?></p>
103 103
 				<?php
104
-			} else {
104
+			} else {
105 105
 				?>
106 106
 				<div class="table-responsive">
107 107
 					<table class="grid sortabletable" id="table-3">
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 						</thead>
116 116
 						<tbody>
117 117
 						<?php
118
-						while($row = $modx->getDatabase()->getRow($rs)) {
118
+						while($row = $modx->getDatabase()->getRow($rs)) {
119 119
 							?>
120 120
 							<tr>
121 121
 								<td class="text-right"><?= $row['id'] ?></td>
Please login to merge, or discard this patch.
manager/actions/web_user_management.static.php 2 patches
Indentation   +29 added lines, -29 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('edit_web_user')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 // initialize page view state - the $_PAGE object
@@ -11,12 +11,12 @@  discard block
 block discarded – undo
11 11
 
12 12
 // get and save search string
13 13
 if($_REQUEST['op'] == 'reset') {
14
-	$query = '';
15
-	$_PAGE['vs']['search'] = '';
14
+    $query = '';
15
+    $_PAGE['vs']['search'] = '';
16 16
 } else {
17
-	$query = isset($_REQUEST['search']) ? $_REQUEST['search'] : $_PAGE['vs']['search'];
18
-	$sqlQuery = $modx->getDatabase()->escape($query);
19
-	$_PAGE['vs']['search'] = $query;
17
+    $query = isset($_REQUEST['search']) ? $_REQUEST['search'] : $_PAGE['vs']['search'];
18
+    $sqlQuery = $modx->getDatabase()->escape($query);
19
+    $_PAGE['vs']['search'] = $query;
20 20
 }
21 21
 
22 22
 // get & save listmode
@@ -119,29 +119,29 @@  discard block
 block discarded – undo
119 119
 			<div class="row">
120 120
 				<div class="table-responsive">
121 121
 					<?php
122
-					$ds = $modx->getDatabase()->select("wu.id, wu.username, wua.fullname, wua.email, wua.lastlogin, wua.logincount, IF(wua.blocked,'{$_lang['yes']}','-') as 'blocked'", $modx->getDatabase()->getFullTableName("web_users") . " wu 
122
+                    $ds = $modx->getDatabase()->select("wu.id, wu.username, wua.fullname, wua.email, wua.lastlogin, wua.logincount, IF(wua.blocked,'{$_lang['yes']}','-') as 'blocked'", $modx->getDatabase()->getFullTableName("web_users") . " wu 
123 123
 			INNER JOIN " . $modx->getDatabase()->getFullTableName("web_user_attributes") . " wua ON wua.internalKey=wu.id", ($sqlQuery ? "(wu.username LIKE '{$sqlQuery}%') OR (wua.fullname LIKE '%{$sqlQuery}%') OR (wua.email LIKE '%{$sqlQuery}%')" : ""), 'username');
124
-					$grd = new \EvolutionCMS\Support\DataGrid('', $ds, $number_of_results); // set page size to 0 t show all items
125
-					$grd->noRecordMsg = $_lang["no_records_found"];
126
-					$grd->cssClass = "table data";
127
-					$grd->columnHeaderClass = "tableHeader";
128
-					$grd->itemClass = "tableItem";
129
-					$grd->altItemClass = "tableAltItem";
130
-					$grd->fields = "id,username,fullname,email,lastlogin,logincount,blocked";
131
-					$grd->columns = $_lang["icon"] . " ," . $_lang["name"] . " ," . $_lang["user_full_name"] . " ," . $_lang["email"] . " ," . $_lang["user_prevlogin"] . " ," . $_lang["user_logincount"] . " ," . $_lang["user_block"];
132
-					$grd->colWidths = "1%,,,,1%,1%,1%";
133
-					$grd->colAligns = "center,,,,right' nowrap='nowrap,right,center";
134
-					$grd->colTypes = "template:<a class='gridRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='" . $_lang["click_to_context"] . "'><i class='" . $_style["icons_user"] . "'></i></a>||template:<a href='index.php?a=88&id=[+id+]' title='" . $_lang["click_to_edit_title"] . "'>[+value+]</a>||template:[+fullname+]||template:[+email+]||date: " . $modx->toDateFormat('[+thislogin+]', 'formatOnly') .
135
-					" %H:%M";
136
-					if($listmode == '1') {
137
-						$grd->pageSize = 0;
138
-					}
139
-					if($_REQUEST['op'] == 'reset') {
140
-						$grd->pageNumber = 1;
141
-					}
142
-					// render grid
143
-					echo $grd->render();
144
-					?>
124
+                    $grd = new \EvolutionCMS\Support\DataGrid('', $ds, $number_of_results); // set page size to 0 t show all items
125
+                    $grd->noRecordMsg = $_lang["no_records_found"];
126
+                    $grd->cssClass = "table data";
127
+                    $grd->columnHeaderClass = "tableHeader";
128
+                    $grd->itemClass = "tableItem";
129
+                    $grd->altItemClass = "tableAltItem";
130
+                    $grd->fields = "id,username,fullname,email,lastlogin,logincount,blocked";
131
+                    $grd->columns = $_lang["icon"] . " ," . $_lang["name"] . " ," . $_lang["user_full_name"] . " ," . $_lang["email"] . " ," . $_lang["user_prevlogin"] . " ," . $_lang["user_logincount"] . " ," . $_lang["user_block"];
132
+                    $grd->colWidths = "1%,,,,1%,1%,1%";
133
+                    $grd->colAligns = "center,,,,right' nowrap='nowrap,right,center";
134
+                    $grd->colTypes = "template:<a class='gridRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='" . $_lang["click_to_context"] . "'><i class='" . $_style["icons_user"] . "'></i></a>||template:<a href='index.php?a=88&id=[+id+]' title='" . $_lang["click_to_edit_title"] . "'>[+value+]</a>||template:[+fullname+]||template:[+email+]||date: " . $modx->toDateFormat('[+thislogin+]', 'formatOnly') .
135
+                    " %H:%M";
136
+                    if($listmode == '1') {
137
+                        $grd->pageSize = 0;
138
+                    }
139
+                    if($_REQUEST['op'] == 'reset') {
140
+                        $grd->pageNumber = 1;
141
+                    }
142
+                    // render grid
143
+                    echo $grd->render();
144
+                    ?>
145 145
 				</div>
146 146
 			</div>
147 147
 		</div>
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 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('edit_web_user')) {
5
+if (!$modx->hasPermission('edit_web_user')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 $modx->getManagerApi()->initPageViewState();
11 11
 
12 12
 // get and save search string
13
-if($_REQUEST['op'] == 'reset') {
13
+if ($_REQUEST['op'] == 'reset') {
14 14
 	$query = '';
15 15
 	$_PAGE['vs']['search'] = '';
16 16
 } else {
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 			<div class="row">
120 120
 				<div class="table-responsive">
121 121
 					<?php
122
-					$ds = $modx->getDatabase()->select("wu.id, wu.username, wua.fullname, wua.email, wua.lastlogin, wua.logincount, IF(wua.blocked,'{$_lang['yes']}','-') as 'blocked'", $modx->getDatabase()->getFullTableName("web_users") . " wu 
123
-			INNER JOIN " . $modx->getDatabase()->getFullTableName("web_user_attributes") . " wua ON wua.internalKey=wu.id", ($sqlQuery ? "(wu.username LIKE '{$sqlQuery}%') OR (wua.fullname LIKE '%{$sqlQuery}%') OR (wua.email LIKE '%{$sqlQuery}%')" : ""), 'username');
122
+					$ds = $modx->getDatabase()->select("wu.id, wu.username, wua.fullname, wua.email, wua.lastlogin, wua.logincount, IF(wua.blocked,'{$_lang['yes']}','-') as 'blocked'", $modx->getDatabase()->getFullTableName("web_users")." wu 
123
+			INNER JOIN " . $modx->getDatabase()->getFullTableName("web_user_attributes")." wua ON wua.internalKey=wu.id", ($sqlQuery ? "(wu.username LIKE '{$sqlQuery}%') OR (wua.fullname LIKE '%{$sqlQuery}%') OR (wua.email LIKE '%{$sqlQuery}%')" : ""), 'username');
124 124
 					$grd = new \EvolutionCMS\Support\DataGrid('', $ds, $number_of_results); // set page size to 0 t show all items
125 125
 					$grd->noRecordMsg = $_lang["no_records_found"];
126 126
 					$grd->cssClass = "table data";
@@ -128,15 +128,15 @@  discard block
 block discarded – undo
128 128
 					$grd->itemClass = "tableItem";
129 129
 					$grd->altItemClass = "tableAltItem";
130 130
 					$grd->fields = "id,username,fullname,email,lastlogin,logincount,blocked";
131
-					$grd->columns = $_lang["icon"] . " ," . $_lang["name"] . " ," . $_lang["user_full_name"] . " ," . $_lang["email"] . " ," . $_lang["user_prevlogin"] . " ," . $_lang["user_logincount"] . " ," . $_lang["user_block"];
131
+					$grd->columns = $_lang["icon"]." ,".$_lang["name"]." ,".$_lang["user_full_name"]." ,".$_lang["email"]." ,".$_lang["user_prevlogin"]." ,".$_lang["user_logincount"]." ,".$_lang["user_block"];
132 132
 					$grd->colWidths = "1%,,,,1%,1%,1%";
133 133
 					$grd->colAligns = "center,,,,right' nowrap='nowrap,right,center";
134
-					$grd->colTypes = "template:<a class='gridRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='" . $_lang["click_to_context"] . "'><i class='" . $_style["icons_user"] . "'></i></a>||template:<a href='index.php?a=88&id=[+id+]' title='" . $_lang["click_to_edit_title"] . "'>[+value+]</a>||template:[+fullname+]||template:[+email+]||date: " . $modx->toDateFormat('[+thislogin+]', 'formatOnly') .
134
+					$grd->colTypes = "template:<a class='gridRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='".$_lang["click_to_context"]."'><i class='".$_style["icons_user"]."'></i></a>||template:<a href='index.php?a=88&id=[+id+]' title='".$_lang["click_to_edit_title"]."'>[+value+]</a>||template:[+fullname+]||template:[+email+]||date: ".$modx->toDateFormat('[+thislogin+]', 'formatOnly').
135 135
 					" %H:%M";
136
-					if($listmode == '1') {
136
+					if ($listmode == '1') {
137 137
 						$grd->pageSize = 0;
138 138
 					}
139
-					if($_REQUEST['op'] == 'reset') {
139
+					if ($_REQUEST['op'] == 'reset') {
140 140
 						$grd->pageNumber = 1;
141 141
 					}
142 142
 					// render grid
Please login to merge, or discard this patch.
manager/actions/mutate_content.dynamic.php 2 patches
Indentation   +371 added lines, -371 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  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
 
6 6
 /********************/
@@ -12,29 +12,29 @@  discard block
 block discarded – undo
12 12
 
13 13
 // check permissions
14 14
 switch($modx->getManagerApi()->action) {
15
-	case 27:
16
-		if(!$modx->hasPermission('edit_document')) {
17
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
18
-		}
19
-		break;
20
-	case 85:
21
-	case 72:
22
-	case 4:
23
-		if(!$modx->hasPermission('new_document')) {
24
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
25
-		} elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') {
26
-			// check user has permissions for parent
27
-			$udperms = new EvolutionCMS\Legacy\Permissions();
28
-			$udperms->user = $modx->getLoginUserID();
29
-			$udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid'];
30
-			$udperms->role = $_SESSION['mgrRole'];
31
-			if(!$udperms->checkPermissions()) {
32
-				$modx->webAlertAndQuit($_lang["access_permission_denied"]);
33
-			}
34
-		}
35
-		break;
36
-	default:
37
-		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
15
+    case 27:
16
+        if(!$modx->hasPermission('edit_document')) {
17
+            $modx->webAlertAndQuit($_lang["error_no_privileges"]);
18
+        }
19
+        break;
20
+    case 85:
21
+    case 72:
22
+    case 4:
23
+        if(!$modx->hasPermission('new_document')) {
24
+            $modx->webAlertAndQuit($_lang["error_no_privileges"]);
25
+        } elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') {
26
+            // check user has permissions for parent
27
+            $udperms = new EvolutionCMS\Legacy\Permissions();
28
+            $udperms->user = $modx->getLoginUserID();
29
+            $udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid'];
30
+            $udperms->role = $_SESSION['mgrRole'];
31
+            if(!$udperms->checkPermissions()) {
32
+                $modx->webAlertAndQuit($_lang["access_permission_denied"]);
33
+            }
34
+        }
35
+        break;
36
+    default:
37
+        $modx->webAlertAndQuit($_lang["error_no_privileges"]);
38 38
 }
39 39
 
40 40
 $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
@@ -53,21 +53,21 @@  discard block
 block discarded – undo
53 53
 $tbl_site_tmplvars = $modx->getDatabase()->getFullTableName('site_tmplvars');
54 54
 
55 55
 if($modx->getManagerApi()->action == 27) {
56
-	//editing an existing document
57
-	// check permissions on the document
58
-	$udperms = new EvolutionCMS\Legacy\Permissions();
59
-	$udperms->user = $modx->getLoginUserID();
60
-	$udperms->document = $id;
61
-	$udperms->role = $_SESSION['mgrRole'];
62
-
63
-	if(!$udperms->checkPermissions()) {
64
-		$modx->webAlertAndQuit($_lang["access_permission_denied"]);
65
-	}
56
+    //editing an existing document
57
+    // check permissions on the document
58
+    $udperms = new EvolutionCMS\Legacy\Permissions();
59
+    $udperms->user = $modx->getLoginUserID();
60
+    $udperms->document = $id;
61
+    $udperms->role = $_SESSION['mgrRole'];
62
+
63
+    if(!$udperms->checkPermissions()) {
64
+        $modx->webAlertAndQuit($_lang["access_permission_denied"]);
65
+    }
66 66
 }
67 67
 
68 68
 // check to see if resource isn't locked
69 69
 if($lockedEl = $modx->elementIsLocked(7, $id)) {
70
-	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource']));
70
+    $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource']));
71 71
 }
72 72
 // end check for lock
73 73
 
@@ -76,74 +76,74 @@  discard block
 block discarded – undo
76 76
 
77 77
 // get document groups for current user
78 78
 if($_SESSION['mgrDocgroups']) {
79
-	$docgrp = implode(',', $_SESSION['mgrDocgroups']);
79
+    $docgrp = implode(',', $_SESSION['mgrDocgroups']);
80 80
 }
81 81
 
82 82
 if(!empty ($id)) {
83
-	$access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']);
84
-	if($docgrp) {
85
-		$access .= " OR dg.document_group IN ({$docgrp})";
86
-	}
87
-	$rs = $modx->getDatabase()->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})");
88
-	$content = array();
89
-	$content = $modx->getDatabase()->getRow($rs);
90
-	$modx->documentObject = &$content;
91
-	if(!$content) {
92
-		$modx->webAlertAndQuit($_lang["access_permission_denied"]);
93
-	}
94
-	$_SESSION['itemname'] = $content['pagetitle'];
83
+    $access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']);
84
+    if($docgrp) {
85
+        $access .= " OR dg.document_group IN ({$docgrp})";
86
+    }
87
+    $rs = $modx->getDatabase()->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})");
88
+    $content = array();
89
+    $content = $modx->getDatabase()->getRow($rs);
90
+    $modx->documentObject = &$content;
91
+    if(!$content) {
92
+        $modx->webAlertAndQuit($_lang["access_permission_denied"]);
93
+    }
94
+    $_SESSION['itemname'] = $content['pagetitle'];
95 95
 } else {
96
-	$content = array();
96
+    $content = array();
97 97
 
98
-	if(isset($_REQUEST['newtemplate'])) {
99
-		$content['template'] = $_REQUEST['newtemplate'];
100
-	} else {
101
-		$content['template'] = getDefaultTemplate();
102
-	}
98
+    if(isset($_REQUEST['newtemplate'])) {
99
+        $content['template'] = $_REQUEST['newtemplate'];
100
+    } else {
101
+        $content['template'] = getDefaultTemplate();
102
+    }
103 103
 
104
-	$_SESSION['itemname'] = $_lang["new_resource"];
104
+    $_SESSION['itemname'] = $_lang["new_resource"];
105 105
 }
106 106
 
107 107
 // restore saved form
108 108
 $formRestored = $modx->getManagerApi()->loadFormValues();
109 109
 if(isset($_REQUEST['newtemplate'])) {
110
-	$formRestored = true;
110
+    $formRestored = true;
111 111
 }
112 112
 
113 113
 // retain form values if template was changed
114 114
 // edited to convert pub_date and unpub_date
115 115
 // sottwell 02-09-2006
116 116
 if($formRestored == true) {
117
-	$content = array_merge($content, $_POST);
118
-	$content['content'] = $_POST['ta'];
119
-	if(empty ($content['pub_date'])) {
120
-		unset ($content['pub_date']);
121
-	} else {
122
-		$content['pub_date'] = $modx->toTimeStamp($content['pub_date']);
123
-	}
124
-	if(empty ($content['unpub_date'])) {
125
-		unset ($content['unpub_date']);
126
-	} else {
127
-		$content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']);
128
-	}
117
+    $content = array_merge($content, $_POST);
118
+    $content['content'] = $_POST['ta'];
119
+    if(empty ($content['pub_date'])) {
120
+        unset ($content['pub_date']);
121
+    } else {
122
+        $content['pub_date'] = $modx->toTimeStamp($content['pub_date']);
123
+    }
124
+    if(empty ($content['unpub_date'])) {
125
+        unset ($content['unpub_date']);
126
+    } else {
127
+        $content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']);
128
+    }
129 129
 }
130 130
 
131 131
 // increase menu index if this is a new document
132 132
 if(!isset ($_REQUEST['id'])) {
133
-	if(!isset ($modx->config['auto_menuindex'])) {
134
-		$modx->config['auto_menuindex'] = 1;
135
-	}
136
-	if($modx->config['auto_menuindex']) {
137
-		$pid = (int)$_REQUEST['pid'];
138
-		$rs = $modx->getDatabase()->select('count(*)', $tbl_site_content, "parent='{$pid}'");
139
-		$content['menuindex'] = $modx->getDatabase()->getValue($rs);
140
-	} else {
141
-		$content['menuindex'] = 0;
142
-	}
133
+    if(!isset ($modx->config['auto_menuindex'])) {
134
+        $modx->config['auto_menuindex'] = 1;
135
+    }
136
+    if($modx->config['auto_menuindex']) {
137
+        $pid = (int)$_REQUEST['pid'];
138
+        $rs = $modx->getDatabase()->select('count(*)', $tbl_site_content, "parent='{$pid}'");
139
+        $content['menuindex'] = $modx->getDatabase()->getValue($rs);
140
+    } else {
141
+        $content['menuindex'] = 0;
142
+    }
143 143
 }
144 144
 
145 145
 if(isset ($_POST['which_editor'])) {
146
-	$modx->config['which_editor'] = $_POST['which_editor'];
146
+    $modx->config['which_editor'] = $_POST['which_editor'];
147 147
 }
148 148
 
149 149
 // Add lock-element JS-Script
@@ -543,23 +543,23 @@  discard block
 block discarded – undo
543 543
 
544 544
 	<form name="mutate" id="mutate" class="content" method="post" enctype="multipart/form-data" action="index.php" onsubmit="documentDirty=false;">
545 545
 		<?php
546
-		// invoke OnDocFormPrerender event
547
-		$evtOut = $modx->invokeEvent('OnDocFormPrerender', array(
548
-			'id' => $id,
549
-			'template' => $content['template']
550
-		));
551
-
552
-		if(is_array($evtOut)) {
553
-			echo implode('', $evtOut);
554
-		}
555
-
556
-		/*************************/
557
-		$dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : '';
558
-		$sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon';
559
-		$page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : '';
560
-		/*************************/
561
-
562
-		?>
546
+        // invoke OnDocFormPrerender event
547
+        $evtOut = $modx->invokeEvent('OnDocFormPrerender', array(
548
+            'id' => $id,
549
+            'template' => $content['template']
550
+        ));
551
+
552
+        if(is_array($evtOut)) {
553
+            echo implode('', $evtOut);
554
+        }
555
+
556
+        /*************************/
557
+        $dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : '';
558
+        $sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : 'createdon';
559
+        $page = isset($_REQUEST['page']) ? (int) $_REQUEST['page'] : '';
560
+        /*************************/
561
+
562
+        ?>
563 563
 		<input type="hidden" name="a" value="5" />
564 564
 		<input type="hidden" name="id" value="<?= $content['id'] ?>" />
565 565
 		<input type="hidden" name="mode" value="<?= $modx->getManagerApi()->action ?>" />
@@ -574,54 +574,54 @@  discard block
 block discarded – undo
574 574
 
575 575
 			<h1>
576 576
 				<i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) {
577
-					echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>';
578
-				} else {
579
-				    if ($modx->getManagerApi()->action == '4') {
577
+                    echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>';
578
+                } else {
579
+                    if ($modx->getManagerApi()->action == '4') {
580 580
                         echo $_lang['add_resource'];
581 581
                     } else if ($modx->getManagerApi()->action == '72') {
582 582
                         echo $_lang['add_weblink'];
583 583
                     } else {
584 584
                         echo $_lang['create_resource_title'];
585 585
                     }
586
-				} ?>
586
+                } ?>
587 587
 			</h1>
588 588
 
589 589
 			<?= $_style['actionbuttons']['dynamic']['document'] ?>
590 590
 
591 591
 			<?php
592
-			// breadcrumbs
593
-			if($modx->config['use_breadcrumbs']) {
594
-				$temp = array();
595
-				$title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title'];
596
-
597
-				if(isset($_REQUEST['id']) && $content['parent'] != 0) {
598
-					$bID = (int) $_REQUEST['id'];
599
-					$temp = $modx->getParentIds($bID);
600
-				} else if(isset($_REQUEST['pid'])) {
601
-					$bID = (int) $_REQUEST['pid'];
602
-					$temp = $modx->getParentIds($bID);
603
-					array_unshift($temp, $bID);
604
-				}
605
-
606
-				if($temp) {
607
-					$parents = implode(',', $temp);
608
-
609
-					if(!empty($parents)) {
610
-						$where = "FIND_IN_SET(id,'{$parents}') DESC";
611
-						$rs = $modx->getDatabase()->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where);
612
-						while($row = $modx->getDatabase()->getRow($rs)) {
613
-							$out .= '<li class="breadcrumbs__li">
592
+            // breadcrumbs
593
+            if($modx->config['use_breadcrumbs']) {
594
+                $temp = array();
595
+                $title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title'];
596
+
597
+                if(isset($_REQUEST['id']) && $content['parent'] != 0) {
598
+                    $bID = (int) $_REQUEST['id'];
599
+                    $temp = $modx->getParentIds($bID);
600
+                } else if(isset($_REQUEST['pid'])) {
601
+                    $bID = (int) $_REQUEST['pid'];
602
+                    $temp = $modx->getParentIds($bID);
603
+                    array_unshift($temp, $bID);
604
+                }
605
+
606
+                if($temp) {
607
+                    $parents = implode(',', $temp);
608
+
609
+                    if(!empty($parents)) {
610
+                        $where = "FIND_IN_SET(id,'{$parents}') DESC";
611
+                        $rs = $modx->getDatabase()->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where);
612
+                        while($row = $modx->getDatabase()->getRow($rs)) {
613
+                            $out .= '<li class="breadcrumbs__li">
614 614
                                 <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a>
615 615
                                 <span class="breadcrumbs__sep">&gt;</span>
616 616
                             </li>';
617
-						}
618
-					}
619
-				}
617
+                        }
618
+                    }
619
+                }
620 620
 
621
-				$out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>';
622
-				echo '<ul class="breadcrumbs">' . $out . '</ul>';
623
-			}
624
-			?>
621
+                $out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>';
622
+                echo '<ul class="breadcrumbs">' . $out . '</ul>';
623
+            }
624
+            ?>
625 625
 
626 626
 			<!-- start main wrapper -->
627 627
 			<div class="sectionBody">
@@ -633,13 +633,13 @@  discard block
 block discarded – undo
633 633
 
634 634
 					<!-- General -->
635 635
 					<?php
636
-					$evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array(
637
-						'id' => $id
638
-					));
639
-					if(is_array($evtOut)) {
640
-						echo implode('', $evtOut);
641
-					} else {
642
-						?>
636
+                    $evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array(
637
+                        'id' => $id
638
+                    ));
639
+                    if(is_array($evtOut)) {
640
+                        echo implode('', $evtOut);
641
+                    } else {
642
+                        ?>
643 643
 						<div class="tab-page" id="tabGeneral">
644 644
 							<h2 class="tab"><?= $_lang['settings_general'] ?></h2>
645 645
 							<script type="text/javascript">tpSettings.addTabPage(document.getElementById("tabGeneral"));</script>
@@ -724,36 +724,36 @@  discard block
 block discarded – undo
724 724
 										<select id="template" name="template" class="inputBox" onchange="templateWarning();">
725 725
 											<option value="0">(blank)</option>
726 726
 											<?php
727
-											$field = "t.templatename, t.selectable, t.id, c.category";
728
-											$from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id";
729
-											$rs = $modx->getDatabase()->select($field, $from, '', 'c.category, t.templatename ASC');
730
-											$currentCategory = '';
731
-											while($row = $modx->getDatabase()->getRow($rs)) {
732
-												if($row['selectable'] != 1 && $row['id'] != $content['template']) {
733
-													continue;
734
-												};
735
-												// Skip if not selectable but show if selected!
736
-												$thisCategory = $row['category'];
737
-												if($thisCategory == null) {
738
-													$thisCategory = $_lang["no_category"];
739
-												}
740
-												if($thisCategory != $currentCategory) {
741
-													if($closeOptGroup) {
742
-														echo "\t\t\t\t\t</optgroup>\n";
743
-													}
744
-													echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n";
745
-													$closeOptGroup = true;
746
-												}
727
+                                            $field = "t.templatename, t.selectable, t.id, c.category";
728
+                                            $from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id";
729
+                                            $rs = $modx->getDatabase()->select($field, $from, '', 'c.category, t.templatename ASC');
730
+                                            $currentCategory = '';
731
+                                            while($row = $modx->getDatabase()->getRow($rs)) {
732
+                                                if($row['selectable'] != 1 && $row['id'] != $content['template']) {
733
+                                                    continue;
734
+                                                };
735
+                                                // Skip if not selectable but show if selected!
736
+                                                $thisCategory = $row['category'];
737
+                                                if($thisCategory == null) {
738
+                                                    $thisCategory = $_lang["no_category"];
739
+                                                }
740
+                                                if($thisCategory != $currentCategory) {
741
+                                                    if($closeOptGroup) {
742
+                                                        echo "\t\t\t\t\t</optgroup>\n";
743
+                                                    }
744
+                                                    echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n";
745
+                                                    $closeOptGroup = true;
746
+                                                }
747 747
 
748
-												$selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : '';
748
+                                                $selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : '';
749 749
 
750
-												echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n";
751
-												$currentCategory = $thisCategory;
752
-											}
753
-											if($thisCategory != '') {
754
-												echo "\t\t\t\t\t</optgroup>\n";
755
-											}
756
-											?>
750
+                                                echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n";
751
+                                                $currentCategory = $thisCategory;
752
+                                            }
753
+                                            if($thisCategory != '') {
754
+                                                echo "\t\t\t\t\t</optgroup>\n";
755
+                                            }
756
+                                            ?>
757 757
 										</select>
758 758
 									</td>
759 759
 								</tr>
@@ -793,37 +793,37 @@  discard block
 block discarded – undo
793 793
 									</td>
794 794
 									<td valign="top">
795 795
 										<?php
796
-										$parentlookup = false;
797
-										if(isset ($_REQUEST['id'])) {
798
-											if($content['parent'] == 0) {
799
-												$parentname = $site_name;
800
-											} else {
801
-												$parentlookup = $content['parent'];
802
-											}
803
-										} elseif(isset ($_REQUEST['pid'])) {
804
-											if($_REQUEST['pid'] == 0) {
805
-												$parentname = $site_name;
806
-											} else {
807
-												$parentlookup = $_REQUEST['pid'];
808
-											}
809
-										} elseif(isset($_POST['parent'])) {
810
-											if($_POST['parent'] == 0) {
811
-												$parentname = $site_name;
812
-											} else {
813
-												$parentlookup = $_POST['parent'];
814
-											}
815
-										} else {
816
-											$parentname = $site_name;
817
-											$content['parent'] = 0;
818
-										}
819
-										if($parentlookup !== false && is_numeric($parentlookup)) {
820
-											$rs = $modx->getDatabase()->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'");
821
-											$parentname = $modx->getDatabase()->getValue($rs);
822
-											if(!$parentname) {
823
-												$modx->webAlertAndQuit($_lang["error_no_parent"]);
824
-											}
825
-										}
826
-										?>
796
+                                        $parentlookup = false;
797
+                                        if(isset ($_REQUEST['id'])) {
798
+                                            if($content['parent'] == 0) {
799
+                                                $parentname = $site_name;
800
+                                            } else {
801
+                                                $parentlookup = $content['parent'];
802
+                                            }
803
+                                        } elseif(isset ($_REQUEST['pid'])) {
804
+                                            if($_REQUEST['pid'] == 0) {
805
+                                                $parentname = $site_name;
806
+                                            } else {
807
+                                                $parentlookup = $_REQUEST['pid'];
808
+                                            }
809
+                                        } elseif(isset($_POST['parent'])) {
810
+                                            if($_POST['parent'] == 0) {
811
+                                                $parentname = $site_name;
812
+                                            } else {
813
+                                                $parentlookup = $_POST['parent'];
814
+                                            }
815
+                                        } else {
816
+                                            $parentname = $site_name;
817
+                                            $content['parent'] = 0;
818
+                                        }
819
+                                        if($parentlookup !== false && is_numeric($parentlookup)) {
820
+                                            $rs = $modx->getDatabase()->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'");
821
+                                            $parentname = $modx->getDatabase()->getValue($rs);
822
+                                            if(!$parentname) {
823
+                                                $modx->webAlertAndQuit($_lang["error_no_parent"]);
824
+                                            }
825
+                                        }
826
+                                        ?>
827 827
 										<i id="plock" class="<?= $_style["actions_folder"] ?>" onclick="enableParentSelection(!allowParentSelection);"></i>
828 828
 										<b><span id="parentName"><?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?> (<?= $modx->getPhpCompat()->entities($parentname) ?>)</span></b>
829 829
 										<input type="hidden" name="parent" value="<?= (isset($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']) ?>" onchange="documentDirty=true;" />
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
 								</tr>
832 832
 								<tr></tr>
833 833
 								<?php
834
-								/*
834
+                                /*
835 835
 								if($content['type'] == 'reference' || $modx->getManagerApi()->action == '72') {
836 836
 									?>
837 837
 									<tr>
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
 									</tr>
860 860
 									<?php
861 861
 								}*/
862
-								?>
862
+                                ?>
863 863
 
864 864
 								<?php if($content['type'] == 'document' || $modx->getManagerApi()->action == '4') { ?>
865 865
 									<tr>
@@ -872,36 +872,36 @@  discard block
 block discarded – undo
872 872
 													<select id="which_editor" class="form-control form-control-sm" size="1" name="which_editor" onchange="changeRTE();">
873 873
 													<option value="none"><?= $_lang['none'] ?></option>
874 874
 														<?php
875
-														// invoke OnRichTextEditorRegister event
876
-														$evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
877
-														if(is_array($evtOut)) {
878
-															for($i = 0; $i < count($evtOut); $i++) {
879
-																$editor = $evtOut[$i];
880
-																echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n";
881
-															}
882
-														}
883
-														?>
875
+                                                        // invoke OnRichTextEditorRegister event
876
+                                                        $evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
877
+                                                        if(is_array($evtOut)) {
878
+                                                            for($i = 0; $i < count($evtOut); $i++) {
879
+                                                                $editor = $evtOut[$i];
880
+                                                                echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n";
881
+                                                            }
882
+                                                        }
883
+                                                        ?>
884 884
 													</select>
885 885
 												</label>
886 886
 											</div>
887 887
 											<div id="content_body">
888 888
 												<?php
889
-												if(($content['richtext'] == 1 || $modx->getManagerApi()->action == '4') && $use_editor == 1) {
890
-													$htmlContent = $content['content'];
891
-													?>
889
+                                                if(($content['richtext'] == 1 || $modx->getManagerApi()->action == '4') && $use_editor == 1) {
890
+                                                    $htmlContent = $content['content'];
891
+                                                    ?>
892 892
 													<div class="section-editor clearfix">
893 893
 														<textarea id="ta" name="ta" onchange="documentDirty=true;"><?= $modx->getPhpCompat()->htmlspecialchars($htmlContent) ?></textarea>
894 894
 													</div>
895 895
 													<?php
896
-													// Richtext-[*content*]
897
-													$richtexteditorIds = array();
898
-													$richtexteditorOptions = array();
899
-													$richtexteditorIds[$modx->config['which_editor']][] = 'ta';
900
-													$richtexteditorOptions[$modx->config['which_editor']]['ta'] = '';
901
-												} else {
902
-													echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->getPhpCompat()->htmlspecialchars($content['content']), '</textarea></div>' . "\n";
903
-												}
904
-												?>
896
+                                                    // Richtext-[*content*]
897
+                                                    $richtexteditorIds = array();
898
+                                                    $richtexteditorOptions = array();
899
+                                                    $richtexteditorIds[$modx->config['which_editor']][] = 'ta';
900
+                                                    $richtexteditorOptions[$modx->config['which_editor']]['ta'] = '';
901
+                                                } else {
902
+                                                    echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->getPhpCompat()->htmlspecialchars($content['content']), '</textarea></div>' . "\n";
903
+                                                }
904
+                                                ?>
905 905
 											</div>
906 906
 										</td>
907 907
 									</tr>
@@ -1208,8 +1208,8 @@  discard block
 block discarded – undo
1208 1208
 
1209 1209
 								<?php
1210 1210
 
1211
-								if($_SESSION['mgrRole'] == 1 || $modx->getManagerApi()->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) {
1212
-									?>
1211
+                                if($_SESSION['mgrRole'] == 1 || $modx->getManagerApi()->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) {
1212
+                                    ?>
1213 1213
 									<tr>
1214 1214
 										<td>
1215 1215
 											<span class="warning"><?= $_lang['resource_type'] ?></span>
@@ -1231,15 +1231,15 @@  discard block
 block discarded – undo
1231 1231
 										<td>
1232 1232
 											<select name="contentType" class="inputBox" onchange="documentDirty=true;">
1233 1233
 												<?php
1234
-												if(!$content['contentType']) {
1235
-													$content['contentType'] = 'text/html';
1236
-												}
1237
-												$custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml");
1238
-												$ct = explode(",", $custom_contenttype);
1239
-												for($i = 0; $i < count($ct); $i++) {
1240
-													echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n";
1241
-												}
1242
-												?>
1234
+                                                if(!$content['contentType']) {
1235
+                                                    $content['contentType'] = 'text/html';
1236
+                                                }
1237
+                                                $custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml");
1238
+                                                $ct = explode(",", $custom_contenttype);
1239
+                                                for($i = 0; $i < count($ct); $i++) {
1240
+                                                    echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n";
1241
+                                                }
1242
+                                                ?>
1243 1243
 											</select>
1244 1244
 										</td>
1245 1245
 									</tr>
@@ -1262,23 +1262,23 @@  discard block
 block discarded – undo
1262 1262
 										</td>
1263 1263
 									</tr>
1264 1264
 									<?php
1265
-								} else {
1266
-									if($content['type'] != 'reference' && $modx->getManagerApi()->action != '72') {
1267
-										// non-admin managers creating or editing a document resource
1268
-										?>
1265
+                                } else {
1266
+                                    if($content['type'] != 'reference' && $modx->getManagerApi()->action != '72') {
1267
+                                        // non-admin managers creating or editing a document resource
1268
+                                        ?>
1269 1269
 										<input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" />
1270 1270
 										<input type="hidden" name="type" value="document" />
1271 1271
 										<input type="hidden" name="content_dispo" value="<?= (isset($content['content_dispo']) ? $content['content_dispo'] : '0') ?>" />
1272 1272
 										<?php
1273
-									} else {
1274
-										// non-admin managers creating or editing a reference (weblink) resource
1275
-										?>
1273
+                                    } else {
1274
+                                        // non-admin managers creating or editing a reference (weblink) resource
1275
+                                        ?>
1276 1276
 										<input type="hidden" name="type" value="reference" />
1277 1277
 										<input type="hidden" name="contentType" value="text/html" />
1278 1278
 										<?php
1279
-									}
1280
-								}//if mgrRole
1281
-								?>
1279
+                                    }
1280
+                                }//if mgrRole
1281
+                                ?>
1282 1282
 
1283 1283
 								<tr>
1284 1284
 									<td>
@@ -1361,112 +1361,112 @@  discard block
 block discarded – undo
1361 1361
                     ?>
1362 1362
 
1363 1363
 						<?php
1364
-					/*******************************
1364
+                    /*******************************
1365 1365
 					 * Document Access Permissions */
1366
-					if($use_udperms == 1) {
1367
-						$groupsarray = array();
1368
-						$sql = '';
1369
-
1370
-						$documentId = ($modx->getManagerApi()->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']));
1371
-						if($documentId > 0) {
1372
-							// Load up, the permissions from the parent (if new document) or existing document
1373
-							$rs = $modx->getDatabase()->select('id, document_group', $tbl_document_groups, "document='{$documentId}'");
1374
-							while($currentgroup = $modx->getDatabase()->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id'];
1375
-
1376
-							// Load up the current permissions and names
1377
-							$vs = array(
1378
-								$tbl_document_group_names,
1379
-								$tbl_document_groups,
1380
-								$documentId
1381
-							);
1382
-							$from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs);
1383
-							$rs = $modx->getDatabase()->select('dgn.*, groups.id AS link_id', $from, '', 'name');
1384
-						} else {
1385
-							// Just load up the names, we're starting clean
1386
-							$rs = $modx->getDatabase()->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name');
1387
-						}
1388
-
1389
-						// retain selected doc groups between post
1390
-						if(isset($_POST['docgroups'])) {
1391
-							$groupsarray = array_merge($groupsarray, $_POST['docgroups']);
1392
-						}
1366
+                    if($use_udperms == 1) {
1367
+                        $groupsarray = array();
1368
+                        $sql = '';
1369
+
1370
+                        $documentId = ($modx->getManagerApi()->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']));
1371
+                        if($documentId > 0) {
1372
+                            // Load up, the permissions from the parent (if new document) or existing document
1373
+                            $rs = $modx->getDatabase()->select('id, document_group', $tbl_document_groups, "document='{$documentId}'");
1374
+                            while($currentgroup = $modx->getDatabase()->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id'];
1375
+
1376
+                            // Load up the current permissions and names
1377
+                            $vs = array(
1378
+                                $tbl_document_group_names,
1379
+                                $tbl_document_groups,
1380
+                                $documentId
1381
+                            );
1382
+                            $from = vsprintf("%s AS dgn LEFT JOIN %s AS groups ON groups.document_group=dgn.id AND groups.document='%s'", $vs);
1383
+                            $rs = $modx->getDatabase()->select('dgn.*, groups.id AS link_id', $from, '', 'name');
1384
+                        } else {
1385
+                            // Just load up the names, we're starting clean
1386
+                            $rs = $modx->getDatabase()->select('*, NULL AS link_id', $tbl_document_group_names, '', 'name');
1387
+                        }
1388
+
1389
+                        // retain selected doc groups between post
1390
+                        if(isset($_POST['docgroups'])) {
1391
+                            $groupsarray = array_merge($groupsarray, $_POST['docgroups']);
1392
+                        }
1393
+
1394
+                        $isManager = $modx->hasPermission('access_permissions');
1395
+                        $isWeb = $modx->hasPermission('web_access_permissions');
1396
+
1397
+                        // Setup Basic attributes for each Input box
1398
+                        $inputAttributes = array(
1399
+                            'type' => 'checkbox',
1400
+                            'class' => 'checkbox',
1401
+                            'name' => 'docgroups[]',
1402
+                            'onclick' => 'makePublic(false);',
1403
+                        );
1404
+                        $permissions = array(); // New Permissions array list (this contains the HTML)
1405
+                        $permissions_yes = 0; // count permissions the current mgr user has
1406
+                        $permissions_no = 0; // count permissions the current mgr user doesn't have
1407
+
1408
+                        // Loop through the permissions list
1409
+                        while($row = $modx->getDatabase()->getRow($rs)) {
1410
+
1411
+                            // Create an inputValue pair (group ID and group link (if it exists))
1412
+                            $inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new');
1413
+                            $inputId = 'group-' . $row['id'];
1414
+
1415
+                            $checked = in_array($inputValue, $groupsarray);
1416
+                            if($checked) {
1417
+                                $notPublic = true;
1418
+                            } // Mark as private access (either web or manager)
1419
+
1420
+                            // Skip the access permission if the user doesn't have access...
1421
+                            if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) {
1422
+                                continue;
1423
+                            }
1393 1424
 
1394
-						$isManager = $modx->hasPermission('access_permissions');
1395
-						$isWeb = $modx->hasPermission('web_access_permissions');
1396
-
1397
-						// Setup Basic attributes for each Input box
1398
-						$inputAttributes = array(
1399
-							'type' => 'checkbox',
1400
-							'class' => 'checkbox',
1401
-							'name' => 'docgroups[]',
1402
-							'onclick' => 'makePublic(false);',
1403
-						);
1404
-						$permissions = array(); // New Permissions array list (this contains the HTML)
1405
-						$permissions_yes = 0; // count permissions the current mgr user has
1406
-						$permissions_no = 0; // count permissions the current mgr user doesn't have
1407
-
1408
-						// Loop through the permissions list
1409
-						while($row = $modx->getDatabase()->getRow($rs)) {
1410
-
1411
-							// Create an inputValue pair (group ID and group link (if it exists))
1412
-							$inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new');
1413
-							$inputId = 'group-' . $row['id'];
1414
-
1415
-							$checked = in_array($inputValue, $groupsarray);
1416
-							if($checked) {
1417
-								$notPublic = true;
1418
-							} // Mark as private access (either web or manager)
1419
-
1420
-							// Skip the access permission if the user doesn't have access...
1421
-							if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) {
1422
-								continue;
1423
-							}
1424
-
1425
-							// Setup attributes for this Input box
1426
-							$inputAttributes['id'] = $inputId;
1427
-							$inputAttributes['value'] = $inputValue;
1428
-							if($checked) {
1429
-								$inputAttributes['checked'] = 'checked';
1430
-							} else {
1431
-								unset($inputAttributes['checked']);
1432
-							}
1433
-
1434
-							// Create attribute string list
1435
-							$inputString = array();
1436
-							foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"';
1437
-
1438
-							// Make the <input> HTML
1439
-							$inputHTML = '<input ' . implode(' ', $inputString) . ' />';
1440
-
1441
-							// does user have this permission?
1442
-							$from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg";
1443
-							$vs = array(
1444
-								$row['id'],
1445
-								$_SESSION['mgrInternalKey']
1446
-							);
1447
-							$where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs);
1448
-							$rsp = $modx->getDatabase()->select('COUNT(mg.id)', $from, $where);
1449
-							$count = $modx->getDatabase()->getValue($rsp);
1450
-							if($count > 0) {
1451
-								++$permissions_yes;
1452
-							} else {
1453
-								++$permissions_no;
1454
-							}
1455
-							$permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>';
1456
-						}
1457
-						// if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public
1458
-						if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) {
1459
-							$permissions = array();
1460
-						}
1425
+                            // Setup attributes for this Input box
1426
+                            $inputAttributes['id'] = $inputId;
1427
+                            $inputAttributes['value'] = $inputValue;
1428
+                            if($checked) {
1429
+                                $inputAttributes['checked'] = 'checked';
1430
+                            } else {
1431
+                                unset($inputAttributes['checked']);
1432
+                            }
1461 1433
 
1462
-						// See if the Access Permissions section is worth displaying...
1463
-						if(!empty($permissions)) {
1464
-							// Add the "All Document Groups" item if we have rights in both contexts
1465
-							if($isManager && $isWeb) {
1466
-								array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>');
1467
-							}
1468
-							// Output the permissions list...
1469
-							?>
1434
+                            // Create attribute string list
1435
+                            $inputString = array();
1436
+                            foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"';
1437
+
1438
+                            // Make the <input> HTML
1439
+                            $inputHTML = '<input ' . implode(' ', $inputString) . ' />';
1440
+
1441
+                            // does user have this permission?
1442
+                            $from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg";
1443
+                            $vs = array(
1444
+                                $row['id'],
1445
+                                $_SESSION['mgrInternalKey']
1446
+                            );
1447
+                            $where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs);
1448
+                            $rsp = $modx->getDatabase()->select('COUNT(mg.id)', $from, $where);
1449
+                            $count = $modx->getDatabase()->getValue($rsp);
1450
+                            if($count > 0) {
1451
+                                ++$permissions_yes;
1452
+                            } else {
1453
+                                ++$permissions_no;
1454
+                            }
1455
+                            $permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>';
1456
+                        }
1457
+                        // if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public
1458
+                        if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) {
1459
+                            $permissions = array();
1460
+                        }
1461
+
1462
+                        // See if the Access Permissions section is worth displaying...
1463
+                        if(!empty($permissions)) {
1464
+                            // Add the "All Document Groups" item if we have rights in both contexts
1465
+                            if($isManager && $isWeb) {
1466
+                                array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>');
1467
+                            }
1468
+                            // Output the permissions list...
1469
+                            ?>
1470 1470
 							<!-- Access Permissions -->
1471 1471
 							<div class="tab-page" id="tabAccess">
1472 1472
 								<h2 class="tab" id="tab_access_header"><?= $_lang['access_permissions'] ?></h2>
@@ -1500,31 +1500,31 @@  discard block
 block discarded – undo
1500 1500
 								</ul>
1501 1501
 							</div><!--div class="tab-page" id="tabAccess"-->
1502 1502
 							<?php
1503
-						} // !empty($permissions)
1504
-						elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) {
1505
-							?>
1503
+                        } // !empty($permissions)
1504
+                        elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) {
1505
+                            ?>
1506 1506
 							<p><?= $_lang["access_permissions_docs_collision"] ?></p>
1507 1507
 							<?php
1508 1508
 
1509
-						}
1510
-					}
1511
-					/* End Document Access Permissions *
1509
+                        }
1510
+                    }
1511
+                    /* End Document Access Permissions *
1512 1512
 					 ***********************************/
1513
-					?>
1513
+                    ?>
1514 1514
 
1515 1515
 					<input type="submit" name="save" style="display:none" />
1516 1516
 					<?php
1517 1517
 
1518
-					// invoke OnDocFormRender event
1519
-					$evtOut = $modx->invokeEvent('OnDocFormRender', array(
1520
-						'id' => $id,
1521
-						'template' => $content['template']
1522
-					));
1518
+                    // invoke OnDocFormRender event
1519
+                    $evtOut = $modx->invokeEvent('OnDocFormRender', array(
1520
+                        'id' => $id,
1521
+                        'template' => $content['template']
1522
+                    ));
1523 1523
 
1524
-					if(is_array($evtOut)) {
1525
-						echo implode('', $evtOut);
1526
-					}
1527
-					?>
1524
+                    if(is_array($evtOut)) {
1525
+                        echo implode('', $evtOut);
1526
+                    }
1527
+                    ?>
1528 1528
 				</div><!--div class="tab-pane" id="documentPane"-->
1529 1529
 			</div><!--div class="sectionBody"-->
1530 1530
 		</fieldset>
@@ -1535,17 +1535,17 @@  discard block
 block discarded – undo
1535 1535
 	</script>
1536 1536
 <?php
1537 1537
 if(($content['richtext'] == 1 || $modx->getManagerApi()->action == '4' || $modx->getManagerApi()->action == '72') && $use_editor == 1) {
1538
-	if(is_array($richtexteditorIds)) {
1539
-		foreach($richtexteditorIds as $editor => $elements) {
1540
-			// invoke OnRichTextEditorInit event
1541
-			$evtOut = $modx->invokeEvent('OnRichTextEditorInit', array(
1542
-				'editor' => $editor,
1543
-				'elements' => $elements,
1544
-				'options' => $richtexteditorOptions[$editor]
1545
-			));
1546
-			if(is_array($evtOut)) {
1547
-				echo implode('', $evtOut);
1548
-			}
1549
-		}
1550
-	}
1538
+    if(is_array($richtexteditorIds)) {
1539
+        foreach($richtexteditorIds as $editor => $elements) {
1540
+            // invoke OnRichTextEditorInit event
1541
+            $evtOut = $modx->invokeEvent('OnRichTextEditorInit', array(
1542
+                'editor' => $editor,
1543
+                'elements' => $elements,
1544
+                'options' => $richtexteditorOptions[$editor]
1545
+            ));
1546
+            if(is_array($evtOut)) {
1547
+                echo implode('', $evtOut);
1548
+            }
1549
+        }
1550
+    }
1551 1551
 }
Please login to merge, or discard this patch.
Spacing   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -1,34 +1,34 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
6 6
 /********************/
7
-$sd = isset($_REQUEST['dir']) ? '&dir=' . $_REQUEST['dir'] : '&dir=DESC';
8
-$sb = isset($_REQUEST['sort']) ? '&sort=' . $_REQUEST['sort'] : '&sort=createdon';
9
-$pg = isset($_REQUEST['page']) ? '&page=' . (int) $_REQUEST['page'] : '';
10
-$add_path = $sd . $sb . $pg;
7
+$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC';
8
+$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon';
9
+$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : '';
10
+$add_path = $sd.$sb.$pg;
11 11
 /*******************/
12 12
 
13 13
 // check permissions
14
-switch($modx->getManagerApi()->action) {
14
+switch ($modx->getManagerApi()->action) {
15 15
 	case 27:
16
-		if(!$modx->hasPermission('edit_document')) {
16
+		if (!$modx->hasPermission('edit_document')) {
17 17
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
18 18
 		}
19 19
 		break;
20 20
 	case 85:
21 21
 	case 72:
22 22
 	case 4:
23
-		if(!$modx->hasPermission('new_document')) {
23
+		if (!$modx->hasPermission('new_document')) {
24 24
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
25
-		} elseif(isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') {
25
+		} elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '0') {
26 26
 			// check user has permissions for parent
27 27
 			$udperms = new EvolutionCMS\Legacy\Permissions();
28 28
 			$udperms->user = $modx->getLoginUserID();
29 29
 			$udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid'];
30 30
 			$udperms->role = $_SESSION['mgrRole'];
31
-			if(!$udperms->checkPermissions()) {
31
+			if (!$udperms->checkPermissions()) {
32 32
 				$modx->webAlertAndQuit($_lang["access_permission_denied"]);
33 33
 			}
34 34
 		}
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
38 38
 }
39 39
 
40
-$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
40
+$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
41 41
 
42 42
 // Get table names (alphabetical)
43 43
 $tbl_categories = $modx->getDatabase()->getFullTableName('categories');
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 $tbl_site_tmplvar_templates = $modx->getDatabase()->getFullTableName('site_tmplvar_templates');
53 53
 $tbl_site_tmplvars = $modx->getDatabase()->getFullTableName('site_tmplvars');
54 54
 
55
-if($modx->getManagerApi()->action == 27) {
55
+if ($modx->getManagerApi()->action == 27) {
56 56
 	//editing an existing document
57 57
 	// check permissions on the document
58 58
 	$udperms = new EvolutionCMS\Legacy\Permissions();
@@ -60,13 +60,13 @@  discard block
 block discarded – undo
60 60
 	$udperms->document = $id;
61 61
 	$udperms->role = $_SESSION['mgrRole'];
62 62
 
63
-	if(!$udperms->checkPermissions()) {
63
+	if (!$udperms->checkPermissions()) {
64 64
 		$modx->webAlertAndQuit($_lang["access_permission_denied"]);
65 65
 	}
66 66
 }
67 67
 
68 68
 // check to see if resource isn't locked
69
-if($lockedEl = $modx->elementIsLocked(7, $id)) {
69
+if ($lockedEl = $modx->elementIsLocked(7, $id)) {
70 70
 	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource']));
71 71
 }
72 72
 // end check for lock
@@ -75,27 +75,27 @@  discard block
 block discarded – undo
75 75
 $modx->lockElement(7, $id);
76 76
 
77 77
 // get document groups for current user
78
-if($_SESSION['mgrDocgroups']) {
78
+if ($_SESSION['mgrDocgroups']) {
79 79
 	$docgrp = implode(',', $_SESSION['mgrDocgroups']);
80 80
 }
81 81
 
82
-if(!empty ($id)) {
82
+if (!empty ($id)) {
83 83
 	$access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']);
84
-	if($docgrp) {
84
+	if ($docgrp) {
85 85
 		$access .= " OR dg.document_group IN ({$docgrp})";
86 86
 	}
87 87
 	$rs = $modx->getDatabase()->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})");
88 88
 	$content = array();
89 89
 	$content = $modx->getDatabase()->getRow($rs);
90 90
 	$modx->documentObject = &$content;
91
-	if(!$content) {
91
+	if (!$content) {
92 92
 		$modx->webAlertAndQuit($_lang["access_permission_denied"]);
93 93
 	}
94 94
 	$_SESSION['itemname'] = $content['pagetitle'];
95 95
 } else {
96 96
 	$content = array();
97 97
 
98
-	if(isset($_REQUEST['newtemplate'])) {
98
+	if (isset($_REQUEST['newtemplate'])) {
99 99
 		$content['template'] = $_REQUEST['newtemplate'];
100 100
 	} else {
101 101
 		$content['template'] = getDefaultTemplate();
@@ -106,22 +106,22 @@  discard block
 block discarded – undo
106 106
 
107 107
 // restore saved form
108 108
 $formRestored = $modx->getManagerApi()->loadFormValues();
109
-if(isset($_REQUEST['newtemplate'])) {
109
+if (isset($_REQUEST['newtemplate'])) {
110 110
 	$formRestored = true;
111 111
 }
112 112
 
113 113
 // retain form values if template was changed
114 114
 // edited to convert pub_date and unpub_date
115 115
 // sottwell 02-09-2006
116
-if($formRestored == true) {
116
+if ($formRestored == true) {
117 117
 	$content = array_merge($content, $_POST);
118 118
 	$content['content'] = $_POST['ta'];
119
-	if(empty ($content['pub_date'])) {
119
+	if (empty ($content['pub_date'])) {
120 120
 		unset ($content['pub_date']);
121 121
 	} else {
122 122
 		$content['pub_date'] = $modx->toTimeStamp($content['pub_date']);
123 123
 	}
124
-	if(empty ($content['unpub_date'])) {
124
+	if (empty ($content['unpub_date'])) {
125 125
 		unset ($content['unpub_date']);
126 126
 	} else {
127 127
 		$content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']);
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
 }
130 130
 
131 131
 // increase menu index if this is a new document
132
-if(!isset ($_REQUEST['id'])) {
133
-	if(!isset ($modx->config['auto_menuindex'])) {
132
+if (!isset ($_REQUEST['id'])) {
133
+	if (!isset ($modx->config['auto_menuindex'])) {
134 134
 		$modx->config['auto_menuindex'] = 1;
135 135
 	}
136
-	if($modx->config['auto_menuindex']) {
137
-		$pid = (int)$_REQUEST['pid'];
136
+	if ($modx->config['auto_menuindex']) {
137
+		$pid = (int) $_REQUEST['pid'];
138 138
 		$rs = $modx->getDatabase()->select('count(*)', $tbl_site_content, "parent='{$pid}'");
139 139
 		$content['menuindex'] = $modx->getDatabase()->getValue($rs);
140 140
 	} else {
@@ -142,14 +142,14 @@  discard block
 block discarded – undo
142 142
 	}
143 143
 }
144 144
 
145
-if(isset ($_POST['which_editor'])) {
145
+if (isset ($_POST['which_editor'])) {
146 146
 	$modx->config['which_editor'] = $_POST['which_editor'];
147 147
 }
148 148
 
149 149
 // Add lock-element JS-Script
150 150
 $lockElementId = $id;
151 151
 $lockElementType = 7;
152
-require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php');
152
+require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php');
153 153
 ?>
154 154
 	<script type="text/javascript">
155 155
 		/* <![CDATA[ */
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 			},
180 180
 			cancel: function() {
181 181
 				documentDirty = false;
182
-				document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id=' . $id . $add_path) ?>';
182
+				document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id='.$id.$add_path) ?>';
183 183
 			},
184 184
 			duplicate: function() {
185 185
 				if(confirm("<?= $_lang['confirm_resource_duplicate']?>") === true) {
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 				}
188 188
 			},
189 189
 			view: function() {
190
-				window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'] . 'index.php?id=' . $id ?>', 'previeWin');
190
+				window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'].'index.php?id='.$id ?>', 'previeWin');
191 191
 			}
192 192
 		};
193 193
 
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 			'template' => $content['template']
550 550
 		));
551 551
 
552
-		if(is_array($evtOut)) {
552
+		if (is_array($evtOut)) {
553 553
 			echo implode('', $evtOut);
554 554
 		}
555 555
 
@@ -573,8 +573,8 @@  discard block
 block discarded – undo
573 573
 		<fieldset id="create_edit">
574 574
 
575 575
 			<h1>
576
-				<i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) {
577
-					echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']) . (iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '') . '<small>(' . $_REQUEST['id'] . ')</small>';
576
+				<i class="fa fa-pencil-square-o"></i><?php if (isset($_REQUEST['id'])) {
577
+					echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']).(iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '').'<small>('.$_REQUEST['id'].')</small>';
578 578
 				} else {
579 579
 				    if ($modx->getManagerApi()->action == '4') {
580 580
                         echo $_lang['add_resource'];
@@ -590,36 +590,36 @@  discard block
 block discarded – undo
590 590
 
591 591
 			<?php
592 592
 			// breadcrumbs
593
-			if($modx->config['use_breadcrumbs']) {
593
+			if ($modx->config['use_breadcrumbs']) {
594 594
 				$temp = array();
595 595
 				$title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title'];
596 596
 
597
-				if(isset($_REQUEST['id']) && $content['parent'] != 0) {
597
+				if (isset($_REQUEST['id']) && $content['parent'] != 0) {
598 598
 					$bID = (int) $_REQUEST['id'];
599 599
 					$temp = $modx->getParentIds($bID);
600
-				} else if(isset($_REQUEST['pid'])) {
600
+				} else if (isset($_REQUEST['pid'])) {
601 601
 					$bID = (int) $_REQUEST['pid'];
602 602
 					$temp = $modx->getParentIds($bID);
603 603
 					array_unshift($temp, $bID);
604 604
 				}
605 605
 
606
-				if($temp) {
606
+				if ($temp) {
607 607
 					$parents = implode(',', $temp);
608 608
 
609
-					if(!empty($parents)) {
609
+					if (!empty($parents)) {
610 610
 						$where = "FIND_IN_SET(id,'{$parents}') DESC";
611 611
 						$rs = $modx->getDatabase()->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where);
612
-						while($row = $modx->getDatabase()->getRow($rs)) {
612
+						while ($row = $modx->getDatabase()->getRow($rs)) {
613 613
 							$out .= '<li class="breadcrumbs__li">
614
-                                <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a>
614
+                                <a href="index.php?a=27&id=' . $row['id'].'" class="breadcrumbs__a">'.htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']).'</a>
615 615
                                 <span class="breadcrumbs__sep">&gt;</span>
616 616
                             </li>';
617 617
 						}
618 618
 					}
619 619
 				}
620 620
 
621
-				$out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>';
622
-				echo '<ul class="breadcrumbs">' . $out . '</ul>';
621
+				$out .= '<li class="breadcrumbs__li breadcrumbs__li_current">'.$title.'</li>';
622
+				echo '<ul class="breadcrumbs">'.$out.'</ul>';
623 623
 			}
624 624
 			?>
625 625
 
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
 					$evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array(
637 637
 						'id' => $id
638 638
 					));
639
-					if(is_array($evtOut)) {
639
+					if (is_array($evtOut)) {
640 640
 						echo implode('', $evtOut);
641 641
 					} else {
642 642
 						?>
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
 									</td>
693 693
 								</tr>
694 694
 
695
-								<?php if($content['type'] == 'reference' || $modx->getManagerApi()->action == '72') { // Web Link specific ?>
695
+								<?php if ($content['type'] == 'reference' || $modx->getManagerApi()->action == '72') { // Web Link specific ?>
696 696
 
697 697
 									<tr>
698 698
 										<td><span class="warning"><?= $_lang['weblink'] ?></span>
@@ -728,17 +728,17 @@  discard block
 block discarded – undo
728 728
 											$from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id";
729 729
 											$rs = $modx->getDatabase()->select($field, $from, '', 'c.category, t.templatename ASC');
730 730
 											$currentCategory = '';
731
-											while($row = $modx->getDatabase()->getRow($rs)) {
732
-												if($row['selectable'] != 1 && $row['id'] != $content['template']) {
731
+											while ($row = $modx->getDatabase()->getRow($rs)) {
732
+												if ($row['selectable'] != 1 && $row['id'] != $content['template']) {
733 733
 													continue;
734 734
 												};
735 735
 												// Skip if not selectable but show if selected!
736 736
 												$thisCategory = $row['category'];
737
-												if($thisCategory == null) {
737
+												if ($thisCategory == null) {
738 738
 													$thisCategory = $_lang["no_category"];
739 739
 												}
740
-												if($thisCategory != $currentCategory) {
741
-													if($closeOptGroup) {
740
+												if ($thisCategory != $currentCategory) {
741
+													if ($closeOptGroup) {
742 742
 														echo "\t\t\t\t\t</optgroup>\n";
743 743
 													}
744 744
 													echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n";
@@ -747,10 +747,10 @@  discard block
 block discarded – undo
747 747
 
748 748
 												$selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : '';
749 749
 
750
-												echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n";
750
+												echo "\t\t\t\t\t".'<option value="'.$row['id'].'"'.$selectedtext.'>'.$row['templatename']."</option>\n";
751 751
 												$currentCategory = $thisCategory;
752 752
 											}
753
-											if($thisCategory != '') {
753
+											if ($thisCategory != '') {
754 754
 												echo "\t\t\t\t\t</optgroup>\n";
755 755
 											}
756 756
 											?>
@@ -794,20 +794,20 @@  discard block
 block discarded – undo
794 794
 									<td valign="top">
795 795
 										<?php
796 796
 										$parentlookup = false;
797
-										if(isset ($_REQUEST['id'])) {
798
-											if($content['parent'] == 0) {
797
+										if (isset ($_REQUEST['id'])) {
798
+											if ($content['parent'] == 0) {
799 799
 												$parentname = $site_name;
800 800
 											} else {
801 801
 												$parentlookup = $content['parent'];
802 802
 											}
803
-										} elseif(isset ($_REQUEST['pid'])) {
804
-											if($_REQUEST['pid'] == 0) {
803
+										} elseif (isset ($_REQUEST['pid'])) {
804
+											if ($_REQUEST['pid'] == 0) {
805 805
 												$parentname = $site_name;
806 806
 											} else {
807 807
 												$parentlookup = $_REQUEST['pid'];
808 808
 											}
809
-										} elseif(isset($_POST['parent'])) {
810
-											if($_POST['parent'] == 0) {
809
+										} elseif (isset($_POST['parent'])) {
810
+											if ($_POST['parent'] == 0) {
811 811
 												$parentname = $site_name;
812 812
 											} else {
813 813
 												$parentlookup = $_POST['parent'];
@@ -816,10 +816,10 @@  discard block
 block discarded – undo
816 816
 											$parentname = $site_name;
817 817
 											$content['parent'] = 0;
818 818
 										}
819
-										if($parentlookup !== false && is_numeric($parentlookup)) {
819
+										if ($parentlookup !== false && is_numeric($parentlookup)) {
820 820
 											$rs = $modx->getDatabase()->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'");
821 821
 											$parentname = $modx->getDatabase()->getValue($rs);
822
-											if(!$parentname) {
822
+											if (!$parentname) {
823 823
 												$modx->webAlertAndQuit($_lang["error_no_parent"]);
824 824
 											}
825 825
 										}
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
 								}*/
862 862
 								?>
863 863
 
864
-								<?php if($content['type'] == 'document' || $modx->getManagerApi()->action == '4') { ?>
864
+								<?php if ($content['type'] == 'document' || $modx->getManagerApi()->action == '4') { ?>
865 865
 									<tr>
866 866
 										<td colspan="2">
867 867
 											<hr>
@@ -874,8 +874,8 @@  discard block
 block discarded – undo
874 874
 														<?php
875 875
 														// invoke OnRichTextEditorRegister event
876 876
 														$evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
877
-														if(is_array($evtOut)) {
878
-															for($i = 0; $i < count($evtOut); $i++) {
877
+														if (is_array($evtOut)) {
878
+															for ($i = 0; $i < count($evtOut); $i++) {
879 879
 																$editor = $evtOut[$i];
880 880
 																echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n";
881 881
 															}
@@ -886,7 +886,7 @@  discard block
 block discarded – undo
886 886
 											</div>
887 887
 											<div id="content_body">
888 888
 												<?php
889
-												if(($content['richtext'] == 1 || $modx->getManagerApi()->action == '4') && $use_editor == 1) {
889
+												if (($content['richtext'] == 1 || $modx->getManagerApi()->action == '4') && $use_editor == 1) {
890 890
 													$htmlContent = $content['content'];
891 891
 													?>
892 892
 													<div class="section-editor clearfix">
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
 													$richtexteditorIds[$modx->config['which_editor']][] = 'ta';
900 900
 													$richtexteditorOptions[$modx->config['which_editor']]['ta'] = '';
901 901
 												} else {
902
-													echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->getPhpCompat()->htmlspecialchars($content['content']), '</textarea></div>' . "\n";
902
+													echo "\t".'<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->getPhpCompat()->htmlspecialchars($content['content']), '</textarea></div>'."\n";
903 903
 												}
904 904
 												?>
905 905
 											</div>
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
 
916 916
                             if (($content['type'] == 'document' || $modx->getManagerApi()->action == '4') || ($content['type'] == 'reference' || $modx->getManagerApi()->action == 72)) {
917 917
                                 $template = $default_template;
918
-                                $group_tvs = empty($modx->config['group_tvs']) ? 0 : (int)$modx->config['group_tvs'];
918
+                                $group_tvs = empty($modx->config['group_tvs']) ? 0 : (int) $modx->config['group_tvs'];
919 919
                                 if (isset ($_REQUEST['newtemplate'])) {
920 920
                                     $template = $_REQUEST['newtemplate'];
921 921
                                 } else {
@@ -943,10 +943,10 @@  discard block
 block discarded – undo
943 943
                                 );
944 944
                                 $sort = 'tvtpl.rank,tv.rank, tv.id';
945 945
                                 if ($group_tvs) {
946
-                                    $field .= ', IFNULL(tv.category,0) as category_id, IFNULL(cat.category,"' . $_lang['no_category'] . '") AS category, IFNULL(cat.rank,0) AS category_rank';
946
+                                    $field .= ', IFNULL(tv.category,0) as category_id, IFNULL(cat.category,"'.$_lang['no_category'].'") AS category, IFNULL(cat.rank,0) AS category_rank';
947 947
                                     $from .= '
948
-                                    LEFT JOIN ' . $tbl_categories . ' AS cat ON cat.id=tv.category';
949
-                                    $sort = 'cat.rank,cat.id,' . $sort;
948
+                                    LEFT JOIN ' . $tbl_categories.' AS cat ON cat.id=tv.category';
949
+                                    $sort = 'cat.rank,cat.id,'.$sort;
950 950
                                 }
951 951
                                 $where = vsprintf("tvtpl.templateid='%s' AND (1='%s' OR ISNULL(tva.documentgroup) %s)", $vs);
952 952
                                 $rs = $modx->getDatabase()->select($field, $from, $where, $sort);
@@ -964,8 +964,8 @@  discard block
 block discarded – undo
964 964
                                                 if ($group_tvs == 1 || $group_tvs == 3) {
965 965
                                                     if ($i === 0) {
966 966
                                                         $templateVariablesOutput .= '
967
-                            <div class="tab-section" id="tabTV_' . $row['category_id'] . '">
968
-                                <div class="tab-header">' . $row['category'] . '</div>
967
+                            <div class="tab-section" id="tabTV_' . $row['category_id'].'">
968
+                                <div class="tab-header">' . $row['category'].'</div>
969 969
                                 <div class="tab-body tmplvars">
970 970
                                     <table>' . "\n";
971 971
                                                     } else {
@@ -974,17 +974,17 @@  discard block
 block discarded – undo
974 974
                                 </div>
975 975
                             </div>
976 976
                             
977
-                            <div class="tab-section" id="tabTV_' . $row['category_id'] . '">
978
-                                <div class="tab-header">' . $row['category'] . '</div>
977
+                            <div class="tab-section" id="tabTV_' . $row['category_id'].'">
978
+                                <div class="tab-header">' . $row['category'].'</div>
979 979
                                 <div class="tab-body tmplvars">
980 980
                                     <table>';
981 981
                                                     }
982 982
                                                 } else if ($group_tvs == 2 || $group_tvs == 4) {
983 983
                                                     if ($i === 0) {
984 984
                                                         $templateVariablesOutput .= '
985
-                            <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars">
986
-                                <h2 class="tab">' . $row['category'] . '</h2>
987
-                                <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script>
985
+                            <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars">
986
+                                <h2 class="tab">' . $row['category'].'</h2>
987
+                                <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script>
988 988
                                 
989 989
                                 <div class="tab-body tmplvars">
990 990
                                     <table>';
@@ -994,9 +994,9 @@  discard block
 block discarded – undo
994 994
                                 </div>
995 995
                             </div>
996 996
                             
997
-                            <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars">
998
-                                <h2 class="tab">' . $row['category'] . '</h2>
999
-                                <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script>
997
+                            <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars">
998
+                                <h2 class="tab">' . $row['category'].'</h2>
999
+                                <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script>
1000 1000
                                 
1001 1001
                                 <div class="tab-body tmplvars">
1002 1002
                                     <table>';
@@ -1004,18 +1004,18 @@  discard block
 block discarded – undo
1004 1004
                                                 } else if ($group_tvs == 5) {
1005 1005
                                                     if ($i === 0) {
1006 1006
                                                         $templateVariablesOutput .= '
1007
-                                <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars">
1008
-                                    <h2 class="tab">' . $row['category'] . '</h2>
1009
-                                    <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script>
1007
+                                <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars">
1008
+                                    <h2 class="tab">' . $row['category'].'</h2>
1009
+                                    <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script>
1010 1010
                                     <table>';
1011 1011
                                                     } else {
1012 1012
                                                         $templateVariablesOutput .= '
1013 1013
                                     </table>
1014 1014
                                 </div>
1015 1015
                                 
1016
-                                <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars">
1017
-                                    <h2 class="tab">' . $row['category'] . '</h2>
1018
-                                    <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script>
1016
+                                <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars">
1017
+                                    <h2 class="tab">' . $row['category'].'</h2>
1018
+                                    <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script>
1019 1019
                                     
1020 1020
                                     <table>';
1021 1021
                                                     }
@@ -1035,8 +1035,8 @@  discard block
 block discarded – undo
1035 1035
                                                 $editor = isset($tvOptions['editor']) ? $tvOptions['editor'] : $modx->config['which_editor'];
1036 1036
                                             };
1037 1037
                                             // Add richtext editor to the list
1038
-                                            $richtexteditorIds[$editor][] = "tv" . $row['id'];
1039
-                                            $richtexteditorOptions[$editor]["tv" . $row['id']] = $tvOptions;
1038
+                                            $richtexteditorIds[$editor][] = "tv".$row['id'];
1039
+                                            $richtexteditorOptions[$editor]["tv".$row['id']] = $tvOptions;
1040 1040
                                         }
1041 1041
 
1042 1042
                                         $templateVariablesTmp = '';
@@ -1053,24 +1053,24 @@  discard block
 block discarded – undo
1053 1053
                                         }
1054 1054
 
1055 1055
                                         // post back value
1056
-                                        if (array_key_exists('tv' . $row['id'], $_POST)) {
1057
-                                            if (is_array($_POST['tv' . $row['id']])) {
1058
-                                                $tvPBV = implode('||', $_POST['tv' . $row['id']]);
1056
+                                        if (array_key_exists('tv'.$row['id'], $_POST)) {
1057
+                                            if (is_array($_POST['tv'.$row['id']])) {
1058
+                                                $tvPBV = implode('||', $_POST['tv'.$row['id']]);
1059 1059
                                             } else {
1060
-                                                $tvPBV = $_POST['tv' . $row['id']];
1060
+                                                $tvPBV = $_POST['tv'.$row['id']];
1061 1061
                                             }
1062 1062
                                         } else {
1063 1063
                                             $tvPBV = $row['value'];
1064 1064
                                         }
1065 1065
 
1066
-                                        $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">' . $row['description'] . '</span>' : '';
1067
-                                        $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">(' . $_lang['tmplvars_inherited'] . ')</span>' : '';
1068
-                                        $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*' . $row['name'] . '*]</small>' : '';
1066
+                                        $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">'.$row['description'].'</span>' : '';
1067
+                                        $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">('.$_lang['tmplvars_inherited'].')</span>' : '';
1068
+                                        $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*'.$row['name'].'*]</small>' : '';
1069 1069
 
1070 1070
                                         $templateVariablesTmp .= '
1071 1071
                                         <tr>
1072
-                                            <td><span class="warning">' . $row['caption'] . $tvName . '</span>' . $tvDescription . $tvInherited . '</td>
1073
-                                            <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '') . '">' . renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray) . '</div></td>
1072
+                                            <td><span class="warning">' . $row['caption'].$tvName.'</span>'.$tvDescription.$tvInherited.'</td>
1073
+                                            <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '').'">'.renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray).'</div></td>
1074 1074
                                         </tr>';
1075 1075
 
1076 1076
                                         if ($group_tvs && $row['category_id'] == 0) {
@@ -1084,37 +1084,37 @@  discard block
 block discarded – undo
1084 1084
                                     }
1085 1085
 
1086 1086
                                     if ($templateVariablesGeneral) {
1087
-                                        echo '<table id="tabTV_0" class="tmplvars"><tbody>' . $templateVariablesGeneral . '</tbody></table>';
1087
+                                        echo '<table id="tabTV_0" class="tmplvars"><tbody>'.$templateVariablesGeneral.'</tbody></table>';
1088 1088
                                     }
1089 1089
 
1090 1090
                                     $templateVariables .= '
1091 1091
                         <!-- Template Variables -->' . "\n";
1092 1092
                                     if (!$group_tvs) {
1093 1093
                                         $templateVariables .= '
1094
-                                    <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'] . '</div>
1094
+                                    <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'].'</div>
1095 1095
                                         <div class="sectionBody tmplvars">
1096 1096
                                             <table>';
1097 1097
                                     } else if ($group_tvs == 2) {
1098 1098
                                         $templateVariables .= '
1099 1099
                     <div class="tab-section">
1100
-                        <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'] . '</div>
1100
+                        <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'].'</div>
1101 1101
                         <div class="tab-pane" id="paneTemplateVariables">
1102 1102
                             <script type="text/javascript">
1103
-                                tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . ');
1103
+                                tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').');
1104 1104
                             </script>';
1105 1105
                                     } else if ($group_tvs == 3) {
1106 1106
                                         $templateVariables .= '
1107 1107
                         <div id="templateVariables" class="tab-page tmplvars">
1108
-                            <h2 class="tab">' . $_lang['settings_templvars'] . '</h2>
1108
+                            <h2 class="tab">' . $_lang['settings_templvars'].'</h2>
1109 1109
                             <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script>';
1110 1110
                                     } else if ($group_tvs == 4) {
1111 1111
                                         $templateVariables .= '
1112 1112
                     <div id="templateVariables" class="tab-page tmplvars">
1113
-                        <h2 class="tab">' . $_lang['settings_templvars'] . '</h2>
1113
+                        <h2 class="tab">' . $_lang['settings_templvars'].'</h2>
1114 1114
                         <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script>
1115 1115
                         <div class="tab-pane" id="paneTemplateVariables">
1116 1116
                             <script type="text/javascript">
1117
-                                tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . ');
1117
+                                tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').');
1118 1118
                             </script>';
1119 1119
                                     }
1120 1120
                                     if ($templateVariablesOutput) {
@@ -1208,7 +1208,7 @@  discard block
 block discarded – undo
1208 1208
 
1209 1209
 								<?php
1210 1210
 
1211
-								if($_SESSION['mgrRole'] == 1 || $modx->getManagerApi()->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) {
1211
+								if ($_SESSION['mgrRole'] == 1 || $modx->getManagerApi()->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) {
1212 1212
 									?>
1213 1213
 									<tr>
1214 1214
 										<td>
@@ -1231,13 +1231,13 @@  discard block
 block discarded – undo
1231 1231
 										<td>
1232 1232
 											<select name="contentType" class="inputBox" onchange="documentDirty=true;">
1233 1233
 												<?php
1234
-												if(!$content['contentType']) {
1234
+												if (!$content['contentType']) {
1235 1235
 													$content['contentType'] = 'text/html';
1236 1236
 												}
1237 1237
 												$custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml");
1238 1238
 												$ct = explode(",", $custom_contenttype);
1239
-												for($i = 0; $i < count($ct); $i++) {
1240
-													echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n";
1239
+												for ($i = 0; $i < count($ct); $i++) {
1240
+													echo "\t\t\t\t\t".'<option value="'.$ct[$i].'"'.($content['contentType'] == $ct[$i] ? ' selected="selected"' : '').'>'.$ct[$i]."</option>\n";
1241 1241
 												}
1242 1242
 												?>
1243 1243
 											</select>
@@ -1263,7 +1263,7 @@  discard block
 block discarded – undo
1263 1263
 									</tr>
1264 1264
 									<?php
1265 1265
 								} else {
1266
-									if($content['type'] != 'reference' && $modx->getManagerApi()->action != '72') {
1266
+									if ($content['type'] != 'reference' && $modx->getManagerApi()->action != '72') {
1267 1267
 										// non-admin managers creating or editing a document resource
1268 1268
 										?>
1269 1269
 										<input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" />
@@ -1363,15 +1363,15 @@  discard block
 block discarded – undo
1363 1363
 						<?php
1364 1364
 					/*******************************
1365 1365
 					 * Document Access Permissions */
1366
-					if($use_udperms == 1) {
1366
+					if ($use_udperms == 1) {
1367 1367
 						$groupsarray = array();
1368 1368
 						$sql = '';
1369 1369
 
1370 1370
 						$documentId = ($modx->getManagerApi()->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']));
1371
-						if($documentId > 0) {
1371
+						if ($documentId > 0) {
1372 1372
 							// Load up, the permissions from the parent (if new document) or existing document
1373 1373
 							$rs = $modx->getDatabase()->select('id, document_group', $tbl_document_groups, "document='{$documentId}'");
1374
-							while($currentgroup = $modx->getDatabase()->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id'];
1374
+							while ($currentgroup = $modx->getDatabase()->getRow($rs)) $groupsarray[] = $currentgroup['document_group'].','.$currentgroup['id'];
1375 1375
 
1376 1376
 							// Load up the current permissions and names
1377 1377
 							$vs = array(
@@ -1387,7 +1387,7 @@  discard block
 block discarded – undo
1387 1387
 						}
1388 1388
 
1389 1389
 						// retain selected doc groups between post
1390
-						if(isset($_POST['docgroups'])) {
1390
+						if (isset($_POST['docgroups'])) {
1391 1391
 							$groupsarray = array_merge($groupsarray, $_POST['docgroups']);
1392 1392
 						}
1393 1393
 
@@ -1406,26 +1406,26 @@  discard block
 block discarded – undo
1406 1406
 						$permissions_no = 0; // count permissions the current mgr user doesn't have
1407 1407
 
1408 1408
 						// Loop through the permissions list
1409
-						while($row = $modx->getDatabase()->getRow($rs)) {
1409
+						while ($row = $modx->getDatabase()->getRow($rs)) {
1410 1410
 
1411 1411
 							// Create an inputValue pair (group ID and group link (if it exists))
1412
-							$inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new');
1413
-							$inputId = 'group-' . $row['id'];
1412
+							$inputValue = $row['id'].','.($row['link_id'] ? $row['link_id'] : 'new');
1413
+							$inputId = 'group-'.$row['id'];
1414 1414
 
1415 1415
 							$checked = in_array($inputValue, $groupsarray);
1416
-							if($checked) {
1416
+							if ($checked) {
1417 1417
 								$notPublic = true;
1418 1418
 							} // Mark as private access (either web or manager)
1419 1419
 
1420 1420
 							// Skip the access permission if the user doesn't have access...
1421
-							if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) {
1421
+							if ((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) {
1422 1422
 								continue;
1423 1423
 							}
1424 1424
 
1425 1425
 							// Setup attributes for this Input box
1426 1426
 							$inputAttributes['id'] = $inputId;
1427 1427
 							$inputAttributes['value'] = $inputValue;
1428
-							if($checked) {
1428
+							if ($checked) {
1429 1429
 								$inputAttributes['checked'] = 'checked';
1430 1430
 							} else {
1431 1431
 								unset($inputAttributes['checked']);
@@ -1433,10 +1433,10 @@  discard block
 block discarded – undo
1433 1433
 
1434 1434
 							// Create attribute string list
1435 1435
 							$inputString = array();
1436
-							foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"';
1436
+							foreach ($inputAttributes as $k => $v) $inputString[] = $k.'="'.$v.'"';
1437 1437
 
1438 1438
 							// Make the <input> HTML
1439
-							$inputHTML = '<input ' . implode(' ', $inputString) . ' />';
1439
+							$inputHTML = '<input '.implode(' ', $inputString).' />';
1440 1440
 
1441 1441
 							// does user have this permission?
1442 1442
 							$from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg";
@@ -1447,23 +1447,23 @@  discard block
 block discarded – undo
1447 1447
 							$where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs);
1448 1448
 							$rsp = $modx->getDatabase()->select('COUNT(mg.id)', $from, $where);
1449 1449
 							$count = $modx->getDatabase()->getValue($rsp);
1450
-							if($count > 0) {
1450
+							if ($count > 0) {
1451 1451
 								++$permissions_yes;
1452 1452
 							} else {
1453 1453
 								++$permissions_no;
1454 1454
 							}
1455
-							$permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>';
1455
+							$permissions[] = "\t\t".'<li>'.$inputHTML.'<label for="'.$inputId.'">'.$row['name'].'</label></li>';
1456 1456
 						}
1457 1457
 						// if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public
1458
-						if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) {
1458
+						if ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) {
1459 1459
 							$permissions = array();
1460 1460
 						}
1461 1461
 
1462 1462
 						// See if the Access Permissions section is worth displaying...
1463
-						if(!empty($permissions)) {
1463
+						if (!empty($permissions)) {
1464 1464
 							// Add the "All Document Groups" item if we have rights in both contexts
1465
-							if($isManager && $isWeb) {
1466
-								array_unshift($permissions, "\t\t" . '<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true);" /><label for="groupall" class="warning">' . $_lang['all_doc_groups'] . '</label></li>');
1465
+							if ($isManager && $isWeb) {
1466
+								array_unshift($permissions, "\t\t".'<li><input type="checkbox" class="checkbox" name="chkalldocs" id="groupall"'.(!$notPublic ? ' checked="checked"' : '').' onclick="makePublic(true);" /><label for="groupall" class="warning">'.$_lang['all_doc_groups'].'</label></li>');
1467 1467
 							}
1468 1468
 							// Output the permissions list...
1469 1469
 							?>
@@ -1496,12 +1496,12 @@  discard block
 block discarded – undo
1496 1496
 								</script>
1497 1497
 								<p><?= $_lang['access_permissions_docs_message'] ?></p>
1498 1498
 								<ul>
1499
-									<?= implode("\n", $permissions) . "\n" ?>
1499
+									<?= implode("\n", $permissions)."\n" ?>
1500 1500
 								</ul>
1501 1501
 							</div><!--div class="tab-page" id="tabAccess"-->
1502 1502
 							<?php
1503 1503
 						} // !empty($permissions)
1504
-						elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) {
1504
+						elseif ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) {
1505 1505
 							?>
1506 1506
 							<p><?= $_lang["access_permissions_docs_collision"] ?></p>
1507 1507
 							<?php
@@ -1521,7 +1521,7 @@  discard block
 block discarded – undo
1521 1521
 						'template' => $content['template']
1522 1522
 					));
1523 1523
 
1524
-					if(is_array($evtOut)) {
1524
+					if (is_array($evtOut)) {
1525 1525
 						echo implode('', $evtOut);
1526 1526
 					}
1527 1527
 					?>
@@ -1534,16 +1534,16 @@  discard block
 block discarded – undo
1534 1534
 		storeCurTemplate();
1535 1535
 	</script>
1536 1536
 <?php
1537
-if(($content['richtext'] == 1 || $modx->getManagerApi()->action == '4' || $modx->getManagerApi()->action == '72') && $use_editor == 1) {
1538
-	if(is_array($richtexteditorIds)) {
1539
-		foreach($richtexteditorIds as $editor => $elements) {
1537
+if (($content['richtext'] == 1 || $modx->getManagerApi()->action == '4' || $modx->getManagerApi()->action == '72') && $use_editor == 1) {
1538
+	if (is_array($richtexteditorIds)) {
1539
+		foreach ($richtexteditorIds as $editor => $elements) {
1540 1540
 			// invoke OnRichTextEditorInit event
1541 1541
 			$evtOut = $modx->invokeEvent('OnRichTextEditorInit', array(
1542 1542
 				'editor' => $editor,
1543 1543
 				'elements' => $elements,
1544 1544
 				'options' => $richtexteditorOptions[$editor]
1545 1545
 			));
1546
-			if(is_array($evtOut)) {
1546
+			if (is_array($evtOut)) {
1547 1547
 				echo implode('', $evtOut);
1548 1548
 			}
1549 1549
 		}
Please login to merge, or discard this patch.
manager/actions/eventlog_details.dynamic.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@  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('view_eventlog')) {
5
+if (!$modx->hasPermission('view_eventlog')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 // get id
10
-$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
10
+$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
11 11
 
12
-$ds = $modx->getDatabase()->select('el.*, IFNULL(wu.username,mu.username) as username', $modx->getDatabase()->getFullTableName("event_log") . " el 
13
-		LEFT JOIN " . $modx->getDatabase()->getFullTableName("manager_users") . " mu ON mu.id=el.user AND el.usertype=0
14
-		LEFT JOIN " . $modx->getDatabase()->getFullTableName("web_users") . " wu ON wu.id=el.user AND el.usertype=1", "el.id='{$id}'");
12
+$ds = $modx->getDatabase()->select('el.*, IFNULL(wu.username,mu.username) as username', $modx->getDatabase()->getFullTableName("event_log")." el 
13
+		LEFT JOIN " . $modx->getDatabase()->getFullTableName("manager_users")." mu ON mu.id=el.user AND el.usertype=0
14
+		LEFT JOIN " . $modx->getDatabase()->getFullTableName("web_users")." wu ON wu.id=el.user AND el.usertype=1", "el.id='{$id}'");
15 15
 $content = $modx->getDatabase()->getRow($ds);
16 16
 
17 17
 ?>
@@ -42,18 +42,18 @@  discard block
 block discarded – undo
42 42
 		<div class="container container-body">
43 43
 			<?php
44 44
 			$date = $modx->toDateFormat($content["createdon"]);
45
-			if($content["type"] == 1) {
46
-				$icon = $_style['actions_info'] . ' text-info';
45
+			if ($content["type"] == 1) {
46
+				$icon = $_style['actions_info'].' text-info';
47 47
 				$msgtype = $_lang["information"];
48
-			} else if($content["type"] == 2) {
49
-				$icon = $_style['actions_triangle'] . ' text-warning';
48
+			} else if ($content["type"] == 2) {
49
+				$icon = $_style['actions_triangle'].' text-warning';
50 50
 				$msgtype = $_lang["warning"];
51
-			} else if($content["type"] == 3) {
52
-				$icon = $_style['actions_error'] . ' text-danger';
51
+			} else if ($content["type"] == 3) {
52
+				$icon = $_style['actions_error'].' text-danger';
53 53
 				$msgtype = $_lang["error"];
54 54
 			}
55 55
 			?>
56
-			<p><b><?= $content['source'] . " - " . $_lang['eventlog_viewer'] ?></b></p>
56
+			<p><b><?= $content['source']." - ".$_lang['eventlog_viewer'] ?></b></p>
57 57
 			<p>
58 58
 				<i class="<?= $icon ?>"></i> <?= $msgtype ?>
59 59
 			</p>
Please login to merge, or discard this patch.
manager/actions/mutate_menuindex_sort.dynamic.php 1 patch
Spacing   +11 added lines, -11 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('edit_document') || !$modx->hasPermission('save_document')) {
6 6
     $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : null;
9
+$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : null;
10 10
 $reset = isset($_POST['reset']) && $_POST['reset'] == 'true' ? 1 : 0;
11 11
 $items = isset($_POST['list']) ? $_POST['list'] : '';
12 12
 $ressourcelist = '';
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 }
24 24
 
25 25
 if (isset($_POST['listSubmitted'])) {
26
-    $updateMsg .= '<div class="text-success" id="updated">' . $_lang['sort_updated'] . '</div>';
26
+    $updateMsg .= '<div class="text-success" id="updated">'.$_lang['sort_updated'].'</div>';
27 27
     if (strlen($items) > 0) {
28 28
         $items = explode(';', $items);
29 29
         foreach ($items as $key => $value) {
@@ -43,15 +43,15 @@  discard block
 block discarded – undo
43 43
     $tblsc = $modx->getDatabase()->getFullTableName('site_content');
44 44
     $tbldg = $modx->getDatabase()->getFullTableName('document_groups');
45 45
 
46
-    $rs = $modx->getDatabase()->select('pagetitle', $tblsc, 'id=' . $id . '');
46
+    $rs = $modx->getDatabase()->select('pagetitle', $tblsc, 'id='.$id.'');
47 47
     $pagetitle = $modx->getDatabase()->getValue($rs);
48 48
 
49 49
     $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : '';
50 50
     $docgrp_cond = $docgrp ? "OR dg.document_group IN ({$docgrp})" : '';
51
-    $mgrRole = (isset ($_SESSION['mgrRole']) && (string)$_SESSION['mgrRole'] === '1') ? '1' : '0';
52
-    $access = " AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))");
51
+    $mgrRole = (isset ($_SESSION['mgrRole']) && (string) $_SESSION['mgrRole'] === '1') ? '1' : '0';
52
+    $access = " AND (1={$mgrRole} OR sc.privatemgr=0".(!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))");
53 53
 
54
-    $rs = $modx->getDatabase()->select('sc.id, sc.pagetitle, sc.parent, sc.menuindex, sc.published, sc.hidemenu, sc.deleted, sc.isfolder', $tblsc . 'AS sc LEFT JOIN ' . $tbldg . ' dg ON dg.document=sc.id', 'sc.parent=' . $id . $access . ' GROUP BY sc.id', 'menuindex ASC');
54
+    $rs = $modx->getDatabase()->select('sc.id, sc.pagetitle, sc.parent, sc.menuindex, sc.published, sc.hidemenu, sc.deleted, sc.isfolder', $tblsc.'AS sc LEFT JOIN '.$tbldg.' dg ON dg.document=sc.id', 'sc.parent='.$id.$access.' GROUP BY sc.id', 'menuindex ASC');
55 55
 
56 56
     if ($modx->getDatabase()->getRecordCount($rs)) {
57 57
         $ressourcelist .= '<div class="clearfix"><ul id="sortlist" class="sortableList">';
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
             $classes .= ($row['hidemenu']) ? ' notInMenuNode ' : ' inMenuNode';
61 61
             $classes .= ($row['published']) ? ' publishedNode ' : ' unpublishedNode ';
62 62
             $classes = ($row['deleted']) ? ' deletedNode ' : $classes;
63
-            $icon = $row['isfolder'] ? '<i class="' . $_style['files_folder'] . '"></i> ' : ' <i class="' . $_style['files_page_html'] . '"></i> ';
64
-            $ressourcelist .= '<li id="item_' . $row['id'] . '" class="' . $classes . '">' . $icon . $row['pagetitle'] . ' <small>(' . $row['id'] . ')</small></li>';
63
+            $icon = $row['isfolder'] ? '<i class="'.$_style['files_folder'].'"></i> ' : ' <i class="'.$_style['files_page_html'].'"></i> ';
64
+            $ressourcelist .= '<li id="item_'.$row['id'].'" class="'.$classes.'">'.$icon.$row['pagetitle'].' <small>('.$row['id'].')</small></li>';
65 65
         }
66 66
         $ressourcelist .= '</ul></div>';
67 67
     } else {
68
-        $updateMsg = '<p class="text-danger">' . $_lang['sort_nochildren'] . '</p>';
68
+        $updateMsg = '<p class="text-danger">'.$_lang['sort_nochildren'].'</p>';
69 69
     }
70 70
 }
71 71
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 </script>
149 149
 
150 150
 <h1>
151
-    <i class="fa fa-sort-numeric-asc"></i><?= ($pagetitle ? $modx->getPhpCompat()->entities($pagetitle) . '<small>(' . $id . ')</small>' : $_lang['sort_menuindex']) ?>
151
+    <i class="fa fa-sort-numeric-asc"></i><?= ($pagetitle ? $modx->getPhpCompat()->entities($pagetitle).'<small>('.$id.')</small>' : $_lang['sort_menuindex']) ?>
152 152
 </h1>
153 153
 
154 154
 <?= $_style['actionbuttons']['dynamic']['save'] ?>
Please login to merge, or discard this patch.
manager/actions/mutate_plugin.dynamic.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  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
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
         $modx->webAlertAndQuit($_lang["error_no_privileges"]);
19 19
 }
20 20
 
21
-$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
21
+$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
22 22
 
23 23
 $tbl_site_plugins = $modx->getDatabase()->getFullTableName('site_plugins');
24 24
 $tbl_site_plugin_events = $modx->getDatabase()->getFullTableName('site_plugin_events');
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     $content['properties'] = str_replace("&", "&amp;", $content['properties']);
47 47
 } else {
48 48
     $_SESSION['itemname'] = $_lang["new_plugin"];
49
-    $content['category'] = (int)$_REQUEST['catid'];
49
+    $content['category'] = (int) $_REQUEST['catid'];
50 50
 }
51 51
 
52 52
 if ($modx->getManagerApi()->hasFormValues()) {
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 // Add lock-element JS-Script
57 57
 $lockElementId = $id;
58 58
 $lockElementType = 5;
59
-require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php');
59
+require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php');
60 60
 
61 61
 
62 62
 
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
     <input type="hidden" name="mode" value="<?= $modx->getManagerApi()->action ?>">
474 474
 
475 475
     <h1>
476
-        <i class="fa fa-plug"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['new_plugin']) ?><i class="fa fa-question-circle help"></i>
476
+        <i class="fa fa-plug"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['new_plugin']) ?><i class="fa fa-question-circle help"></i>
477 477
     </h1>
478 478
 
479 479
     <?= $_style['actionbuttons']['dynamic']['element'] ?>
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
                             <div class="form-control-name clearfix">
500 500
                                 <input name="name" type="text" maxlength="100" value="<?= $modx->getPhpCompat()->htmlspecialchars($content['name']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;" />
501 501
                                 <?php if ($modx->hasPermission('save_role')): ?>
502
-                                <label class="custom-control" title="<?= $_lang['lock_plugin'] . "\n" . $_lang['lock_plugin_msg'] ?>" tooltip>
502
+                                <label class="custom-control" title="<?= $_lang['lock_plugin']."\n".$_lang['lock_plugin_msg'] ?>" tooltip>
503 503
                                     <input name="locked" type="checkbox" value="on"<?= ($content['locked'] == 1 ? ' checked="checked"' : '') ?> />
504 504
                                     <i class="fa fa-lock"></i>
505 505
                                 </label>
@@ -523,9 +523,9 @@  discard block
 block discarded – undo
523 523
                             <select name="categoryid" class="form-control" onchange="documentDirty=true;">
524 524
                                 <option>&nbsp;</option>
525 525
                                 <?php
526
-                                include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
526
+                                include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
527 527
                                 foreach (getCategories() as $n => $v) {
528
-                                    echo '<option value="' . $v['id'] . '"' . ($content["category"] == $v["id"] ? ' selected="selected"' : '') . '>' . $modx->getPhpCompat()->htmlspecialchars($v["category"]) . "</option>";
528
+                                    echo '<option value="'.$v['id'].'"'.($content["category"] == $v["id"] ? ' selected="selected"' : '').'>'.$modx->getPhpCompat()->htmlspecialchars($v["category"])."</option>";
529 529
                                 }
530 530
                                 ?>
531 531
                             </select>
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
                 <?php if ($modx->hasPermission('save_role')): ?>
542 542
                 <div class="form-group">
543 543
                     <div class="form-row">
544
-                        <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>" . $_lang['plugin_disabled'] . "</span>" : $_lang['plugin_disabled']) ?></label>
544
+                        <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>".$_lang['plugin_disabled']."</span>" : $_lang['plugin_disabled']) ?></label>
545 545
                     </div>
546 546
                     <div class="form-row">
547 547
                         <label>
@@ -588,11 +588,11 @@  discard block
 block discarded – undo
588 588
                             <select name="moduleguid" class="form-control" onchange="documentDirty=true;">
589 589
                                 <option>&nbsp;</option>
590 590
                                 <?php
591
-                                $ds = $modx->getDatabase()->select('sm.id,sm.name,sm.guid', $modx->getDatabase()->getFullTableName("site_modules") . " sm 
592
-								INNER JOIN " . $modx->getDatabase()->getFullTableName("site_module_depobj") . " smd ON smd.module=sm.id AND smd.type=30
593
-								INNER JOIN " . $modx->getDatabase()->getFullTableName("site_plugins") . " sp ON sp.id=smd.resource", "smd.resource='{$id}' AND sm.enable_sharedparams='1'", 'sm.name');
591
+                                $ds = $modx->getDatabase()->select('sm.id,sm.name,sm.guid', $modx->getDatabase()->getFullTableName("site_modules")." sm 
592
+								INNER JOIN " . $modx->getDatabase()->getFullTableName("site_module_depobj")." smd ON smd.module=sm.id AND smd.type=30
593
+								INNER JOIN " . $modx->getDatabase()->getFullTableName("site_plugins")." sp ON sp.id=smd.resource", "smd.resource='{$id}' AND sm.enable_sharedparams='1'", 'sm.name');
594 594
                                 while ($row = $modx->getDatabase()->getRow($ds)) {
595
-                                    echo "<option value='" . $row['guid'] . "'" . ($content["moduleguid"] == $row["guid"] ? " selected='selected'" : "") . ">" . $modx->getPhpCompat()->htmlspecialchars($row["name"]) . "</option>";
595
+                                    echo "<option value='".$row['guid']."'".($content["moduleguid"] == $row["guid"] ? " selected='selected'" : "").">".$modx->getPhpCompat()->htmlspecialchars($row["name"])."</option>";
596 596
                                 }
597 597
                                 ?>
598 598
                             </select>
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
                                 echoEventRows($evtnames);
655 655
                             }
656 656
                             echo '<hr class="clear">';
657
-                            echo '<div class="form-group"><b>' . $services[$srv - 1] . '</b></div>';
657
+                            echo '<div class="form-group"><b>'.$services[$srv - 1].'</b></div>';
658 658
                         }
659 659
                         // display group name
660 660
                         if ($grp != $row['groupname']) {
@@ -663,9 +663,9 @@  discard block
 block discarded – undo
663 663
                                 echoEventRows($evtnames);
664 664
                             }
665 665
                             echo '<hr class="clear">';
666
-                            echo '<div class="form-group"><b>' . $row['groupname'] . '</b></div>';
666
+                            echo '<div class="form-group"><b>'.$row['groupname'].'</b></div>';
667 667
                         }
668
-                        $evtnames[] = '<input name="sysevents[]" id="' . $row['name'] . '" type="checkbox" ' . (in_array($row['id'], $evts) ? ' checked="checked" ' : '') . 'class="inputBox" value="' . $row['id'] . '" /> <label for="' . $row['name'] . '" ' . bold(in_array($row['id'], $evts)) . '> ' . $row['name'] . '</label>' . "\n";
668
+                        $evtnames[] = '<input name="sysevents[]" id="'.$row['name'].'" type="checkbox" '.(in_array($row['id'], $evts) ? ' checked="checked" ' : '').'class="inputBox" value="'.$row['id'].'" /> <label for="'.$row['name'].'" '.bold(in_array($row['id'], $evts)).'> '.$row['name'].'</label>'."\n";
669 669
                         if (count($evtnames) == 2) {
670 670
                             echoEventRows($evtnames);
671 671
                         }
Please login to merge, or discard this patch.
manager/actions/mutate_templates.dynamic.php 2 patches
Indentation   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@  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
 
6 6
 switch($modx->getManagerApi()->action) {
7
-	case 16:
8
-		if(!$modx->hasPermission('edit_template')) {
9
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
10
-		}
11
-		break;
12
-	case 19:
13
-		if(!$modx->hasPermission('new_template')) {
14
-			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
15
-		}
16
-		break;
17
-	default:
18
-		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7
+    case 16:
8
+        if(!$modx->hasPermission('edit_template')) {
9
+            $modx->webAlertAndQuit($_lang["error_no_privileges"]);
10
+        }
11
+        break;
12
+    case 19:
13
+        if(!$modx->hasPermission('new_template')) {
14
+            $modx->webAlertAndQuit($_lang["error_no_privileges"]);
15
+        }
16
+        break;
17
+    default:
18
+        $modx->webAlertAndQuit($_lang["error_no_privileges"]);
19 19
 }
20 20
 
21 21
 $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 // check to see the snippet editor isn't locked
26 26
 if($lockedEl = $modx->elementIsLocked(1, $id)) {
27
-	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['template']));
27
+    $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['template']));
28 28
 }
29 29
 // end check for lock
30 30
 
@@ -33,23 +33,23 @@  discard block
 block discarded – undo
33 33
 
34 34
 $content = array();
35 35
 if(!empty($id)) {
36
-	$rs = $modx->getDatabase()->select('*', $tbl_site_templates, "id='{$id}'");
37
-	$content = $modx->getDatabase()->getRow($rs);
38
-	if(!$content) {
39
-		$modx->webAlertAndQuit("No database record has been found for this template.");
40
-	}
41
-
42
-	$_SESSION['itemname'] = $content['templatename'];
43
-	if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
44
-		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
45
-	}
36
+    $rs = $modx->getDatabase()->select('*', $tbl_site_templates, "id='{$id}'");
37
+    $content = $modx->getDatabase()->getRow($rs);
38
+    if(!$content) {
39
+        $modx->webAlertAndQuit("No database record has been found for this template.");
40
+    }
41
+
42
+    $_SESSION['itemname'] = $content['templatename'];
43
+    if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
44
+        $modx->webAlertAndQuit($_lang["error_no_privileges"]);
45
+    }
46 46
 } else {
47
-	$_SESSION['itemname'] = $_lang["new_template"];
48
-	$content['category'] = (int)$_REQUEST['catid'];
47
+    $_SESSION['itemname'] = $_lang["new_template"];
48
+    $content['category'] = (int)$_REQUEST['catid'];
49 49
 }
50 50
 
51 51
 if($modx->getManagerApi()->hasFormValues()) {
52
-	$modx->getManagerApi()->loadFormValues();
52
+    $modx->getManagerApi()->loadFormValues();
53 53
 }
54 54
 
55 55
 $content = array_merge($content, $_POST);
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
 
99 99
 <form name="mutate" method="post" action="index.php">
100 100
 	<?php
101
-	// invoke OnTempFormPrerender event
102
-	$evtOut = $modx->invokeEvent("OnTempFormPrerender", array("id" => $id));
103
-	if(is_array($evtOut)) {
104
-		echo implode("", $evtOut);
105
-	}
106
-	?>
101
+    // invoke OnTempFormPrerender event
102
+    $evtOut = $modx->invokeEvent("OnTempFormPrerender", array("id" => $id));
103
+    if(is_array($evtOut)) {
104
+        echo implode("", $evtOut);
105
+    }
106
+    ?>
107 107
 	<input type="hidden" name="a" value="20">
108 108
 	<input type="hidden" name="id" value="<?= $_REQUEST['id'] ?>">
109 109
 	<input type="hidden" name="mode" value="<?= $modx->getManagerApi()->action ?>">
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
 						<label class="col-md-3 col-lg-2">
134 134
 							<?= $_lang['template_name'] ?>
135 135
 							<?php if($id == $modx->config['default_template']) {
136
-								echo '<small class="form-text text-danger">' . mb_strtolower(rtrim($_lang['defaulttemplate_title'], ':'), $modx_manager_charset) . '</small>';
137
-							} ?>
136
+                                echo '<small class="form-text text-danger">' . mb_strtolower(rtrim($_lang['defaulttemplate_title'], ':'), $modx_manager_charset) . '</small>';
137
+                            } ?>
138 138
 						</label>
139 139
 						<div class="col-md-9 col-lg-10">
140 140
 							<div class="form-control-name clearfix">
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
 							<select name="categoryid" class="form-control" onchange="documentDirty=true;">
163 163
 								<option>&nbsp;</option>
164 164
 								<?php
165
-								include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
166
-								foreach(getCategories() as $n => $v) {
167
-									echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->getPhpCompat()->htmlspecialchars($v["category"]) . "</option>";
168
-								}
169
-								?>
165
+                                include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
166
+                                foreach(getCategories() as $n => $v) {
167
+                                    echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->getPhpCompat()->htmlspecialchars($v["category"]) . "</option>";
168
+                                }
169
+                                ?>
170 170
 							</select>
171 171
 						</div>
172 172
 					</div>
@@ -197,38 +197,38 @@  discard block
 block discarded – undo
197 197
 			<input type="submit" name="save" style="display:none">
198 198
 
199 199
 			<?php
200
-			$selectedTvs = array();
201
-			if(!isset($_POST['assignedTv'])) {
202
-				$rs = $modx->getDatabase()->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category", $_lang['no_category']), sprintf("%s tv
200
+            $selectedTvs = array();
201
+            if(!isset($_POST['assignedTv'])) {
202
+                $rs = $modx->getDatabase()->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category", $_lang['no_category']), sprintf("%s tv
203 203
                 LEFT JOIN %s tr ON tv.id=tr.tmplvarid
204 204
                 LEFT JOIN %s cat ON tv.category=cat.id", $modx->getDatabase()->getFullTableName('site_tmplvars'), $modx->getDatabase()->getFullTableName('site_tmplvar_templates'), $modx->getDatabase()->getFullTableName('categories')), "templateid='{$id}'", "tr.rank DESC, tv.rank DESC, tvcaption DESC, tvid DESC"     // workaround for correct sort of none-existing ranks
205
-				);
206
-				while($row = $modx->getDatabase()->getRow($rs)) {
207
-					$selectedTvs[$row['tvid']] = $row;
208
-				}
209
-				$selectedTvs = array_reverse($selectedTvs, true);       // reverse ORDERBY DESC
210
-			}
211
-
212
-			$unselectedTvs = array();
213
-			$rs = $modx->getDatabase()->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category, cat.id as catid", $_lang['no_category']), sprintf("%s tv
205
+                );
206
+                while($row = $modx->getDatabase()->getRow($rs)) {
207
+                    $selectedTvs[$row['tvid']] = $row;
208
+                }
209
+                $selectedTvs = array_reverse($selectedTvs, true);       // reverse ORDERBY DESC
210
+            }
211
+
212
+            $unselectedTvs = array();
213
+            $rs = $modx->getDatabase()->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category, cat.id as catid", $_lang['no_category']), sprintf("%s tv
214 214
 	    LEFT JOIN %s tr ON tv.id=tr.tmplvarid
215 215
 	    LEFT JOIN %s cat ON tv.category=cat.id", $modx->getDatabase()->getFullTableName('site_tmplvars'), $modx->getDatabase()->getFullTableName('site_tmplvar_templates'), $modx->getDatabase()->getFullTableName('categories')), "", "category, tvcaption");
216
-			while($row = $modx->getDatabase()->getRow($rs)) {
217
-				$unselectedTvs[$row['tvid']] = $row;
218
-			}
219
-
220
-			// Catch checkboxes if form not validated
221
-			if(isset($_POST['assignedTv'])) {
222
-				$selectedTvs = array();
223
-				foreach($_POST['assignedTv'] as $tvid) {
224
-					if(isset($unselectedTvs[$tvid])) {
225
-						$selectedTvs[$tvid] = $unselectedTvs[$tvid];
226
-					}
227
-				};
228
-			}
229
-
230
-			$total = count($selectedTvs);
231
-			?>
216
+            while($row = $modx->getDatabase()->getRow($rs)) {
217
+                $unselectedTvs[$row['tvid']] = $row;
218
+            }
219
+
220
+            // Catch checkboxes if form not validated
221
+            if(isset($_POST['assignedTv'])) {
222
+                $selectedTvs = array();
223
+                foreach($_POST['assignedTv'] as $tvid) {
224
+                    if(isset($unselectedTvs[$tvid])) {
225
+                        $selectedTvs[$tvid] = $unselectedTvs[$tvid];
226
+                    }
227
+                };
228
+            }
229
+
230
+            $total = count($selectedTvs);
231
+            ?>
232 232
 		</div>
233 233
 
234 234
 		<div class="tab-page" id="tabAssignedTVs">
@@ -238,65 +238,65 @@  discard block
 block discarded – undo
238 238
 
239 239
 			<div class="container container-body">
240 240
 				<?php
241
-				if($total > 0) {
242
-					echo '<p>' . $_lang['template_tv_msg'] . '</p>';
243
-				}
244
-				if($modx->hasPermission('save_template') && $total > 1 && $id) {
245
-					echo sprintf('<div class="form-group"><a class="btn btn-primary" href="index.php?a=117&amp;id=%s">%s</a></div>', $id, $_lang['template_tv_edit']);
246
-				}
247
-
248
-				// Selected TVs
249
-				$tvList = '';
250
-				if($total > 0) {
251
-					$tvList .= '<ul>';
252
-					foreach($selectedTvs as $row) {
253
-						$desc = !empty($row['tvdescription']) ? '&nbsp;&nbsp;<small>(' . $row['tvdescription'] . ')</small>' : '';
254
-						$locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : "";
255
-						$tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" checked="checked" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->getManagerApi()->action, $id, $_lang['edit']);
256
-					}
257
-					$tvList .= '</ul>';
258
-
259
-				} else {
260
-					echo $_lang['template_no_tv'];
261
-				}
262
-				echo $tvList;
263
-
264
-				// Unselected TVs
265
-				$tvList = '<hr/><p>' . $_lang['template_notassigned_tv'] . '</p><ul>';
266
-				$preCat = '';
267
-				$insideUl = 0;
268
-				while($row = array_shift($unselectedTvs)) {
269
-					if(isset($selectedTvs[$row['tvid']])) {
270
-						continue;
271
-					} // Skip selected
272
-					$row['category'] = stripslashes($row['category']); //pixelchutes
273
-					if($preCat !== $row['category']) {
274
-						$tvList .= $insideUl ? '</ul>' : '';
275
-						$tvList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>';
276
-						$insideUl = 1;
277
-					}
278
-
279
-					$desc = !empty($row['tvdescription']) ? '&nbsp;&nbsp;<small>(' . $row['tvdescription'] . ')</small>' : '';
280
-					$locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : "";
281
-					$tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->getManagerApi()->action, $id, $_lang['edit']);
282
-					$tvList .= '</li>';
283
-
284
-					$preCat = $row['category'];
285
-				}
286
-				$tvList .= $insideUl ? '</ul>' : '';
287
-				$tvList .= '</ul>';
288
-				echo $tvList;
289
-
290
-				?>
241
+                if($total > 0) {
242
+                    echo '<p>' . $_lang['template_tv_msg'] . '</p>';
243
+                }
244
+                if($modx->hasPermission('save_template') && $total > 1 && $id) {
245
+                    echo sprintf('<div class="form-group"><a class="btn btn-primary" href="index.php?a=117&amp;id=%s">%s</a></div>', $id, $_lang['template_tv_edit']);
246
+                }
247
+
248
+                // Selected TVs
249
+                $tvList = '';
250
+                if($total > 0) {
251
+                    $tvList .= '<ul>';
252
+                    foreach($selectedTvs as $row) {
253
+                        $desc = !empty($row['tvdescription']) ? '&nbsp;&nbsp;<small>(' . $row['tvdescription'] . ')</small>' : '';
254
+                        $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : "";
255
+                        $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" checked="checked" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->getManagerApi()->action, $id, $_lang['edit']);
256
+                    }
257
+                    $tvList .= '</ul>';
258
+
259
+                } else {
260
+                    echo $_lang['template_no_tv'];
261
+                }
262
+                echo $tvList;
263
+
264
+                // Unselected TVs
265
+                $tvList = '<hr/><p>' . $_lang['template_notassigned_tv'] . '</p><ul>';
266
+                $preCat = '';
267
+                $insideUl = 0;
268
+                while($row = array_shift($unselectedTvs)) {
269
+                    if(isset($selectedTvs[$row['tvid']])) {
270
+                        continue;
271
+                    } // Skip selected
272
+                    $row['category'] = stripslashes($row['category']); //pixelchutes
273
+                    if($preCat !== $row['category']) {
274
+                        $tvList .= $insideUl ? '</ul>' : '';
275
+                        $tvList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>';
276
+                        $insideUl = 1;
277
+                    }
278
+
279
+                    $desc = !empty($row['tvdescription']) ? '&nbsp;&nbsp;<small>(' . $row['tvdescription'] . ')</small>' : '';
280
+                    $locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : "";
281
+                    $tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->getManagerApi()->action, $id, $_lang['edit']);
282
+                    $tvList .= '</li>';
283
+
284
+                    $preCat = $row['category'];
285
+                }
286
+                $tvList .= $insideUl ? '</ul>' : '';
287
+                $tvList .= '</ul>';
288
+                echo $tvList;
289
+
290
+                ?>
291 291
 			</div>
292 292
 		</div>
293 293
 
294 294
 		<?php
295
-		// invoke OnTempFormRender event
296
-		$evtOut = $modx->invokeEvent("OnTempFormRender", array("id" => $id));
297
-		if(is_array($evtOut)) {
298
-			echo implode("", $evtOut);
299
-		}
300
-		?>
295
+        // invoke OnTempFormRender event
296
+        $evtOut = $modx->invokeEvent("OnTempFormRender", array("id" => $id));
297
+        if(is_array($evtOut)) {
298
+            echo implode("", $evtOut);
299
+        }
300
+        ?>
301 301
 	</div>
302 302
 </form>
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
6
-switch($modx->getManagerApi()->action) {
6
+switch ($modx->getManagerApi()->action) {
7 7
 	case 16:
8
-		if(!$modx->hasPermission('edit_template')) {
8
+		if (!$modx->hasPermission('edit_template')) {
9 9
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
10 10
 		}
11 11
 		break;
12 12
 	case 19:
13
-		if(!$modx->hasPermission('new_template')) {
13
+		if (!$modx->hasPermission('new_template')) {
14 14
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
15 15
 		}
16 16
 		break;
@@ -18,12 +18,12 @@  discard block
 block discarded – undo
18 18
 		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
19 19
 }
20 20
 
21
-$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
21
+$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
22 22
 
23 23
 $tbl_site_templates = $modx->getDatabase()->getFullTableName('site_templates');
24 24
 
25 25
 // check to see the snippet editor isn't locked
26
-if($lockedEl = $modx->elementIsLocked(1, $id)) {
26
+if ($lockedEl = $modx->elementIsLocked(1, $id)) {
27 27
 	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['template']));
28 28
 }
29 29
 // end check for lock
@@ -32,23 +32,23 @@  discard block
 block discarded – undo
32 32
 $modx->lockElement(1, $id);
33 33
 
34 34
 $content = array();
35
-if(!empty($id)) {
35
+if (!empty($id)) {
36 36
 	$rs = $modx->getDatabase()->select('*', $tbl_site_templates, "id='{$id}'");
37 37
 	$content = $modx->getDatabase()->getRow($rs);
38
-	if(!$content) {
38
+	if (!$content) {
39 39
 		$modx->webAlertAndQuit("No database record has been found for this template.");
40 40
 	}
41 41
 
42 42
 	$_SESSION['itemname'] = $content['templatename'];
43
-	if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
43
+	if ($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
44 44
 		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
45 45
 	}
46 46
 } else {
47 47
 	$_SESSION['itemname'] = $_lang["new_template"];
48
-	$content['category'] = (int)$_REQUEST['catid'];
48
+	$content['category'] = (int) $_REQUEST['catid'];
49 49
 }
50 50
 
51
-if($modx->getManagerApi()->hasFormValues()) {
51
+if ($modx->getManagerApi()->hasFormValues()) {
52 52
 	$modx->getManagerApi()->loadFormValues();
53 53
 }
54 54
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 // Add lock-element JS-Script
59 59
 $lockElementId = $id;
60 60
 $lockElementType = 1;
61
-require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php');
61
+require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php');
62 62
 ?>
63 63
 <script type="text/javascript">
64 64
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	<?php
101 101
 	// invoke OnTempFormPrerender event
102 102
 	$evtOut = $modx->invokeEvent("OnTempFormPrerender", array("id" => $id));
103
-	if(is_array($evtOut)) {
103
+	if (is_array($evtOut)) {
104 104
 		echo implode("", $evtOut);
105 105
 	}
106 106
 	?>
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	<input type="hidden" name="mode" value="<?= $modx->getManagerApi()->action ?>">
110 110
 
111 111
 	<h1>
112
-		<i class="fa fa-newspaper-o"></i><?= ($content['templatename'] ? $content['templatename'] . '<small>(' . $content['id'] . ')</small>' : $_lang['new_template']) ?><i class="fa fa-question-circle help"></i>
112
+		<i class="fa fa-newspaper-o"></i><?= ($content['templatename'] ? $content['templatename'].'<small>('.$content['id'].')</small>' : $_lang['new_template']) ?><i class="fa fa-question-circle help"></i>
113 113
 	</h1>
114 114
 
115 115
 	<?= $_style['actionbuttons']['dynamic']['element'] ?>
@@ -132,15 +132,15 @@  discard block
 block discarded – undo
132 132
 					<div class="row form-row">
133 133
 						<label class="col-md-3 col-lg-2">
134 134
 							<?= $_lang['template_name'] ?>
135
-							<?php if($id == $modx->config['default_template']) {
136
-								echo '<small class="form-text text-danger">' . mb_strtolower(rtrim($_lang['defaulttemplate_title'], ':'), $modx_manager_charset) . '</small>';
135
+							<?php if ($id == $modx->config['default_template']) {
136
+								echo '<small class="form-text text-danger">'.mb_strtolower(rtrim($_lang['defaulttemplate_title'], ':'), $modx_manager_charset).'</small>';
137 137
 							} ?>
138 138
 						</label>
139 139
 						<div class="col-md-9 col-lg-10">
140 140
 							<div class="form-control-name clearfix">
141 141
 								<input name="templatename" type="text" maxlength="100" value="<?= $modx->getPhpCompat()->htmlspecialchars($content['templatename']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;">
142
-								<?php if($modx->hasPermission('save_role')): ?>
143
-									<label class="custom-control" title="<?= $_lang['lock_template'] . "\n" . $_lang['lock_template_msg'] ?>" tooltip>
142
+								<?php if ($modx->hasPermission('save_role')): ?>
143
+									<label class="custom-control" title="<?= $_lang['lock_template']."\n".$_lang['lock_template_msg'] ?>" tooltip>
144 144
 										<input name="locked" type="checkbox"<?= ($content['locked'] == 1 ? ' checked="checked"' : '') ?> />
145 145
 										<i class="fa fa-lock"></i>
146 146
 									</label>
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
 							<select name="categoryid" class="form-control" onchange="documentDirty=true;">
163 163
 								<option>&nbsp;</option>
164 164
 								<?php
165
-								include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
166
-								foreach(getCategories() as $n => $v) {
167
-									echo "<option value='" . $v['id'] . "'" . ($content["category"] == $v["id"] ? " selected='selected'" : "") . ">" . $modx->getPhpCompat()->htmlspecialchars($v["category"]) . "</option>";
165
+								include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
166
+								foreach (getCategories() as $n => $v) {
167
+									echo "<option value='".$v['id']."'".($content["category"] == $v["id"] ? " selected='selected'" : "").">".$modx->getPhpCompat()->htmlspecialchars($v["category"])."</option>";
168 168
 								}
169 169
 								?>
170 170
 							</select>
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 						</div>
178 178
 					</div>
179 179
 				</div>
180
-				<?php if($modx->hasPermission('save_role')): ?>
180
+				<?php if ($modx->hasPermission('save_role')): ?>
181 181
 					<div class="form-group">
182 182
 						<label>
183 183
 							<input name="selectable" type="checkbox"<?= ($selectable == 1 ? ' checked="checked"' : '') ?> /> <?= $_lang['template_selectable'] ?></label>
@@ -198,30 +198,30 @@  discard block
 block discarded – undo
198 198
 
199 199
 			<?php
200 200
 			$selectedTvs = array();
201
-			if(!isset($_POST['assignedTv'])) {
201
+			if (!isset($_POST['assignedTv'])) {
202 202
 				$rs = $modx->getDatabase()->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category", $_lang['no_category']), sprintf("%s tv
203 203
                 LEFT JOIN %s tr ON tv.id=tr.tmplvarid
204 204
                 LEFT JOIN %s cat ON tv.category=cat.id", $modx->getDatabase()->getFullTableName('site_tmplvars'), $modx->getDatabase()->getFullTableName('site_tmplvar_templates'), $modx->getDatabase()->getFullTableName('categories')), "templateid='{$id}'", "tr.rank DESC, tv.rank DESC, tvcaption DESC, tvid DESC"     // workaround for correct sort of none-existing ranks
205 205
 				);
206
-				while($row = $modx->getDatabase()->getRow($rs)) {
206
+				while ($row = $modx->getDatabase()->getRow($rs)) {
207 207
 					$selectedTvs[$row['tvid']] = $row;
208 208
 				}
209
-				$selectedTvs = array_reverse($selectedTvs, true);       // reverse ORDERBY DESC
209
+				$selectedTvs = array_reverse($selectedTvs, true); // reverse ORDERBY DESC
210 210
 			}
211 211
 
212 212
 			$unselectedTvs = array();
213 213
 			$rs = $modx->getDatabase()->select(sprintf("tv.name AS tvname, tv.id AS tvid, tr.templateid AS templateid, tv.description AS tvdescription, tv.caption AS tvcaption, tv.locked AS tvlocked, if(isnull(cat.category),'%s',cat.category) AS category, cat.id as catid", $_lang['no_category']), sprintf("%s tv
214 214
 	    LEFT JOIN %s tr ON tv.id=tr.tmplvarid
215 215
 	    LEFT JOIN %s cat ON tv.category=cat.id", $modx->getDatabase()->getFullTableName('site_tmplvars'), $modx->getDatabase()->getFullTableName('site_tmplvar_templates'), $modx->getDatabase()->getFullTableName('categories')), "", "category, tvcaption");
216
-			while($row = $modx->getDatabase()->getRow($rs)) {
216
+			while ($row = $modx->getDatabase()->getRow($rs)) {
217 217
 				$unselectedTvs[$row['tvid']] = $row;
218 218
 			}
219 219
 
220 220
 			// Catch checkboxes if form not validated
221
-			if(isset($_POST['assignedTv'])) {
221
+			if (isset($_POST['assignedTv'])) {
222 222
 				$selectedTvs = array();
223
-				foreach($_POST['assignedTv'] as $tvid) {
224
-					if(isset($unselectedTvs[$tvid])) {
223
+				foreach ($_POST['assignedTv'] as $tvid) {
224
+					if (isset($unselectedTvs[$tvid])) {
225 225
 						$selectedTvs[$tvid] = $unselectedTvs[$tvid];
226 226
 					}
227 227
 				};
@@ -238,20 +238,20 @@  discard block
 block discarded – undo
238 238
 
239 239
 			<div class="container container-body">
240 240
 				<?php
241
-				if($total > 0) {
242
-					echo '<p>' . $_lang['template_tv_msg'] . '</p>';
241
+				if ($total > 0) {
242
+					echo '<p>'.$_lang['template_tv_msg'].'</p>';
243 243
 				}
244
-				if($modx->hasPermission('save_template') && $total > 1 && $id) {
244
+				if ($modx->hasPermission('save_template') && $total > 1 && $id) {
245 245
 					echo sprintf('<div class="form-group"><a class="btn btn-primary" href="index.php?a=117&amp;id=%s">%s</a></div>', $id, $_lang['template_tv_edit']);
246 246
 				}
247 247
 
248 248
 				// Selected TVs
249 249
 				$tvList = '';
250
-				if($total > 0) {
250
+				if ($total > 0) {
251 251
 					$tvList .= '<ul>';
252
-					foreach($selectedTvs as $row) {
253
-						$desc = !empty($row['tvdescription']) ? '&nbsp;&nbsp;<small>(' . $row['tvdescription'] . ')</small>' : '';
254
-						$locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : "";
252
+					foreach ($selectedTvs as $row) {
253
+						$desc = !empty($row['tvdescription']) ? '&nbsp;&nbsp;<small>('.$row['tvdescription'].')</small>' : '';
254
+						$locked = $row['tvlocked'] ? ' <em>('.$_lang['locked'].')</em>' : "";
255 255
 						$tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" checked="checked" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->getManagerApi()->action, $id, $_lang['edit']);
256 256
 					}
257 257
 					$tvList .= '</ul>';
@@ -262,22 +262,22 @@  discard block
 block discarded – undo
262 262
 				echo $tvList;
263 263
 
264 264
 				// Unselected TVs
265
-				$tvList = '<hr/><p>' . $_lang['template_notassigned_tv'] . '</p><ul>';
265
+				$tvList = '<hr/><p>'.$_lang['template_notassigned_tv'].'</p><ul>';
266 266
 				$preCat = '';
267 267
 				$insideUl = 0;
268
-				while($row = array_shift($unselectedTvs)) {
269
-					if(isset($selectedTvs[$row['tvid']])) {
268
+				while ($row = array_shift($unselectedTvs)) {
269
+					if (isset($selectedTvs[$row['tvid']])) {
270 270
 						continue;
271 271
 					} // Skip selected
272 272
 					$row['category'] = stripslashes($row['category']); //pixelchutes
273
-					if($preCat !== $row['category']) {
273
+					if ($preCat !== $row['category']) {
274 274
 						$tvList .= $insideUl ? '</ul>' : '';
275
-						$tvList .= '<li><strong>' . $row['category'] . ($row['catid'] != '' ? ' <small>(' . $row['catid'] . ')</small>' : '') . '</strong><ul>';
275
+						$tvList .= '<li><strong>'.$row['category'].($row['catid'] != '' ? ' <small>('.$row['catid'].')</small>' : '').'</strong><ul>';
276 276
 						$insideUl = 1;
277 277
 					}
278 278
 
279
-					$desc = !empty($row['tvdescription']) ? '&nbsp;&nbsp;<small>(' . $row['tvdescription'] . ')</small>' : '';
280
-					$locked = $row['tvlocked'] ? ' <em>(' . $_lang['locked'] . ')</em>' : "";
279
+					$desc = !empty($row['tvdescription']) ? '&nbsp;&nbsp;<small>('.$row['tvdescription'].')</small>' : '';
280
+					$locked = $row['tvlocked'] ? ' <em>('.$_lang['locked'].')</em>' : "";
281 281
 					$tvList .= sprintf('<li><label><input name="assignedTv[]" value="%s" type="checkbox" onchange="documentDirty=true;jQuery(\'#tvsDirty\').val(\'1\');"> %s <small>(%s)</small> - %s%s</label>%s <a href="index.php?id=%s&a=301&or=%s&oid=%s">%s</a></li>', $row['tvid'], $row['tvname'], $row['tvid'], $row['tvcaption'], $desc, $locked, $row['tvid'], $modx->getManagerApi()->action, $id, $_lang['edit']);
282 282
 					$tvList .= '</li>';
283 283
 
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 		<?php
295 295
 		// invoke OnTempFormRender event
296 296
 		$evtOut = $modx->invokeEvent("OnTempFormRender", array("id" => $id));
297
-		if(is_array($evtOut)) {
297
+		if (is_array($evtOut)) {
298 298
 			echo implode("", $evtOut);
299 299
 		}
300 300
 		?>
Please login to merge, or discard this patch.
manager/actions/mutate_htmlsnippet.dynamic.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  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
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
         $modx->webAlertAndQuit($_lang["error_no_privileges"]);
19 19
 }
20 20
 
21
-$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
21
+$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
22 22
 
23 23
 // Get table names (alphabetical)
24 24
 $tbl_site_htmlsnippets = $modx->getDatabase()->getFullTableName('site_htmlsnippets');
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     $content['name'] = $_REQUEST['itemname'];
48 48
 } else {
49 49
     $_SESSION['itemname'] = $_lang["new_htmlsnippet"];
50
-    $content['category'] = (int)$_REQUEST['catid'];
50
+    $content['category'] = (int) $_REQUEST['catid'];
51 51
 }
52 52
 
53 53
 if ($modx->getManagerApi()->hasFormValues()) {
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 // Add lock-element JS-Script
66 66
 $lockElementId = $id;
67 67
 $lockElementType = 3;
68
-require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php');
68
+require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php');
69 69
 
70 70
 // Print RTE Javascript function
71 71
 ?>
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
         <input type="hidden" name="mode" value="<?= $modx->getManagerApi()->action ?>" />
137 137
 
138 138
         <h1>
139
-            <i class="fa fa-th-large"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['new_htmlsnippet']) ?><i class="fa fa-question-circle help"></i>
139
+            <i class="fa fa-th-large"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['new_htmlsnippet']) ?><i class="fa fa-question-circle help"></i>
140 140
         </h1>
141 141
 
142 142
         <?= $_style['actionbuttons']['dynamic']['element'] ?>
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
                             <div class="form-control-name clearfix">
161 161
                                 <input name="name" type="text" maxlength="100" value="<?= $modx->getPhpCompat()->htmlspecialchars($content['name']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;" />
162 162
                                 <?php if ($modx->hasPermission('save_role')): ?>
163
-                                    <label class="custom-control" title="<?= $_lang['lock_htmlsnippet'] . "\n" . $_lang['lock_htmlsnippet_msg'] ?>" tooltip>
163
+                                    <label class="custom-control" title="<?= $_lang['lock_htmlsnippet']."\n".$_lang['lock_htmlsnippet_msg'] ?>" tooltip>
164 164
                                         <input name="locked" type="checkbox" value="on"<?= ($content['locked'] == 1 || $content['locked'] == 'on' ? ' checked="checked"' : '') ?> />
165 165
                                         <i class="fa fa-lock"></i>
166 166
                                     </label>
@@ -184,9 +184,9 @@  discard block
 block discarded – undo
184 184
                             <select name="categoryid" class="form-control" onchange="documentDirty=true;">
185 185
                                 <option>&nbsp;</option>
186 186
                                 <?php
187
-                                include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
187
+                                include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
188 188
                                 foreach (getCategories() as $n => $v) {
189
-                                    echo "\t\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] || (empty($content['category']) && $_POST['categoryid'] == $v['id']) ? ' selected="selected"' : '') . '>' . $modx->getPhpCompat()->htmlspecialchars($v['category']) . "</option>\n";
189
+                                    echo "\t\t\t\t".'<option value="'.$v['id'].'"'.($content['category'] == $v['id'] || (empty($content['category']) && $_POST['categoryid'] == $v['id']) ? ' selected="selected"' : '').'>'.$modx->getPhpCompat()->htmlspecialchars($v['category'])."</option>\n";
190 190
                                 }
191 191
                                 ?>
192 192
                             </select>
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
                     </div>
201 201
                     <?php if ($_SESSION['mgrRole'] == 1): ?>
202 202
                         <div class="form-row">
203
-                            <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>" . $_lang['disabled'] . "</span>" : $_lang['disabled']) ?></label>
203
+                            <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>".$_lang['disabled']."</span>" : $_lang['disabled']) ?></label>
204 204
                         </div>
205 205
                     <?php endif; ?>
206 206
                 </div>
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
                             $evtOut = $modx->invokeEvent('OnRichTextEditorRegister');
217 217
                             if (is_array($evtOut)) {
218 218
                                 foreach ($evtOut as $i => $editor) {
219
-                                    echo "\t" . '<option value="' . $editor . '"' . ($which_editor == $editor ? ' selected="selected"' : '') . '>' . $editor . "</option>\n";
219
+                                    echo "\t".'<option value="'.$editor.'"'.($which_editor == $editor ? ' selected="selected"' : '').'>'.$editor."</option>\n";
220 220
                                 }
221 221
                             }
222 222
                             ?>
Please login to merge, or discard this patch.