Completed
Pull Request — develop (#718)
by
unknown
10:49
created
manager/actions/mutate_content.dynamic.php 1 patch
Spacing   +146 added lines, -146 removed lines patch added patch discarded remove patch
@@ -1,35 +1,35 @@  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->manager->action) {
14
+switch ($modx->manager->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
-			include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php');
27
+			include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php');
28 28
 			$udperms = new udperms();
29 29
 			$udperms->user = $modx->getLoginUserID();
30 30
 			$udperms->document = empty($_REQUEST['pid']) ? 0 : $_REQUEST['pid'];
31 31
 			$udperms->role = $_SESSION['mgrRole'];
32
-			if(!$udperms->checkPermissions()) {
32
+			if (!$udperms->checkPermissions()) {
33 33
 				$modx->webAlertAndQuit($_lang["access_permission_denied"]);
34 34
 			}
35 35
 		}
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
39 39
 }
40 40
 
41
-$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
41
+$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
42 42
 
43 43
 // Get table names (alphabetical)
44 44
 $tbl_categories = $modx->getFullTableName('categories');
@@ -53,22 +53,22 @@  discard block
 block discarded – undo
53 53
 $tbl_site_tmplvar_templates = $modx->getFullTableName('site_tmplvar_templates');
54 54
 $tbl_site_tmplvars = $modx->getFullTableName('site_tmplvars');
55 55
 
56
-if($modx->manager->action == 27) {
56
+if ($modx->manager->action == 27) {
57 57
 	//editing an existing document
58 58
 	// check permissions on the document
59
-	include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php');
59
+	include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php');
60 60
 	$udperms = new udperms();
61 61
 	$udperms->user = $modx->getLoginUserID();
62 62
 	$udperms->document = $id;
63 63
 	$udperms->role = $_SESSION['mgrRole'];
64 64
 
65
-	if(!$udperms->checkPermissions()) {
65
+	if (!$udperms->checkPermissions()) {
66 66
 		$modx->webAlertAndQuit($_lang["access_permission_denied"]);
67 67
 	}
68 68
 }
69 69
 
70 70
 // check to see if resource isn't locked
71
-if($lockedEl = $modx->elementIsLocked(7, $id)) {
71
+if ($lockedEl = $modx->elementIsLocked(7, $id)) {
72 72
 	$modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['resource']));
73 73
 }
74 74
 // end check for lock
@@ -77,27 +77,27 @@  discard block
 block discarded – undo
77 77
 $modx->lockElement(7, $id);
78 78
 
79 79
 // get document groups for current user
80
-if($_SESSION['mgrDocgroups']) {
80
+if ($_SESSION['mgrDocgroups']) {
81 81
 	$docgrp = implode(',', $_SESSION['mgrDocgroups']);
82 82
 }
83 83
 
84
-if(!empty ($id)) {
84
+if (!empty ($id)) {
85 85
 	$access = sprintf("1='%s' OR sc.privatemgr=0", $_SESSION['mgrRole']);
86
-	if($docgrp) {
86
+	if ($docgrp) {
87 87
 		$access .= " OR dg.document_group IN ({$docgrp})";
88 88
 	}
89 89
 	$rs = $modx->db->select('sc.*', "{$tbl_site_content} AS sc LEFT JOIN {$tbl_document_groups} AS dg ON dg.document=sc.id", "sc.id='{$id}' AND ({$access})");
90 90
 	$content = array();
91 91
 	$content = $modx->db->getRow($rs);
92 92
 	$modx->documentObject = &$content;
93
-	if(!$content) {
93
+	if (!$content) {
94 94
 		$modx->webAlertAndQuit($_lang["access_permission_denied"]);
95 95
 	}
96 96
 	$_SESSION['itemname'] = $content['pagetitle'];
97 97
 } else {
98 98
 	$content = array();
99 99
 
100
-	if(isset($_REQUEST['newtemplate'])) {
100
+	if (isset($_REQUEST['newtemplate'])) {
101 101
 		$content['template'] = $_REQUEST['newtemplate'];
102 102
 	} else {
103 103
 		$content['template'] = getDefaultTemplate();
@@ -108,22 +108,22 @@  discard block
 block discarded – undo
108 108
 
109 109
 // restore saved form
110 110
 $formRestored = $modx->manager->loadFormValues();
111
-if(isset($_REQUEST['newtemplate'])) {
111
+if (isset($_REQUEST['newtemplate'])) {
112 112
 	$formRestored = true;
113 113
 }
114 114
 
115 115
 // retain form values if template was changed
116 116
 // edited to convert pub_date and unpub_date
117 117
 // sottwell 02-09-2006
118
-if($formRestored == true) {
118
+if ($formRestored == true) {
119 119
 	$content = array_merge($content, $_POST);
120 120
 	$content['content'] = $_POST['ta'];
121
-	if(empty ($content['pub_date'])) {
121
+	if (empty ($content['pub_date'])) {
122 122
 		unset ($content['pub_date']);
123 123
 	} else {
124 124
 		$content['pub_date'] = $modx->toTimeStamp($content['pub_date']);
125 125
 	}
126
-	if(empty ($content['unpub_date'])) {
126
+	if (empty ($content['unpub_date'])) {
127 127
 		unset ($content['unpub_date']);
128 128
 	} else {
129 129
 		$content['unpub_date'] = $modx->toTimeStamp($content['unpub_date']);
@@ -131,12 +131,12 @@  discard block
 block discarded – undo
131 131
 }
132 132
 
133 133
 // increase menu index if this is a new document
134
-if(!isset ($_REQUEST['id'])) {
135
-	if(!isset ($modx->config['auto_menuindex'])) {
134
+if (!isset ($_REQUEST['id'])) {
135
+	if (!isset ($modx->config['auto_menuindex'])) {
136 136
 		$modx->config['auto_menuindex'] = 1;
137 137
 	}
138
-	if($modx->config['auto_menuindex']) {
139
-		$pid = (int)$_REQUEST['pid'];
138
+	if ($modx->config['auto_menuindex']) {
139
+		$pid = (int) $_REQUEST['pid'];
140 140
 		$rs = $modx->db->select('count(*)', $tbl_site_content, "parent='{$pid}'");
141 141
 		$content['menuindex'] = $modx->db->getValue($rs);
142 142
 	} else {
@@ -144,14 +144,14 @@  discard block
 block discarded – undo
144 144
 	}
145 145
 }
146 146
 
147
-if(isset ($_POST['which_editor'])) {
147
+if (isset ($_POST['which_editor'])) {
148 148
 	$modx->config['which_editor'] = $_POST['which_editor'];
149 149
 }
150 150
 
151 151
 // Add lock-element JS-Script
152 152
 $lockElementId = $id;
153 153
 $lockElementType = 7;
154
-require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php');
154
+require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php');
155 155
 ?>
156 156
 	<script type="text/javascript">
157 157
 		/* <![CDATA[ */
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 			},
182 182
 			cancel: function() {
183 183
 				documentDirty = false;
184
-				document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id=' . $id . $add_path) ?>';
184
+				document.location.href = 'index.php?<?=($id == 0 ? 'a=2' : 'a=3&r=1&id='.$id.$add_path) ?>';
185 185
 			},
186 186
 			duplicate: function() {
187 187
 				if(confirm("<?= $_lang['confirm_resource_duplicate']?>") === true) {
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 				}
190 190
 			},
191 191
 			view: function() {
192
-				window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'] . 'index.php?id=' . $id ?>', 'previeWin');
192
+				window.open('<?= ($modx->config['friendly_urls'] == '1') ? $modx->makeUrl($id) : $modx->config['site_url'].'index.php?id='.$id ?>', 'previeWin');
193 193
 			}
194 194
 		};
195 195
 
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 			'template' => $content['template']
552 552
 		));
553 553
 
554
-		if(is_array($evtOut)) {
554
+		if (is_array($evtOut)) {
555 555
 			echo implode('', $evtOut);
556 556
 		}
557 557
 
@@ -575,8 +575,8 @@  discard block
 block discarded – undo
575 575
 		<fieldset id="create_edit">
576 576
 
577 577
 			<h1>
578
-				<i class="fa fa-pencil-square-o"></i><?php if(isset($_REQUEST['id'])) {
579
-					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
+				<i class="fa fa-pencil-square-o"></i><?php if (isset($_REQUEST['id'])) {
579
+					echo iconv_substr($content['pagetitle'], 0, 50, $modx->config['modx_charset']).(iconv_strlen($content['pagetitle'], $modx->config['modx_charset']) > 50 ? '...' : '').'<small>('.$_REQUEST['id'].')</small>';
580 580
 				} else {
581 581
 				    if ($modx->manager->action == '4') {
582 582
                         echo $_lang['add_resource'];
@@ -592,36 +592,36 @@  discard block
 block discarded – undo
592 592
 
593 593
 			<?php
594 594
 			// breadcrumbs
595
-			if($modx->config['use_breadcrumbs']) {
595
+			if ($modx->config['use_breadcrumbs']) {
596 596
 				$temp = array();
597 597
 				$title = isset($content['pagetitle']) ? $content['pagetitle'] : $_lang['create_resource_title'];
598 598
 
599
-				if(isset($_REQUEST['id']) && $content['parent'] != 0) {
599
+				if (isset($_REQUEST['id']) && $content['parent'] != 0) {
600 600
 					$bID = (int) $_REQUEST['id'];
601 601
 					$temp = $modx->getParentIds($bID);
602
-				} else if(isset($_REQUEST['pid'])) {
602
+				} else if (isset($_REQUEST['pid'])) {
603 603
 					$bID = (int) $_REQUEST['pid'];
604 604
 					$temp = $modx->getParentIds($bID);
605 605
 					array_unshift($temp, $bID);
606 606
 				}
607 607
 
608
-				if($temp) {
608
+				if ($temp) {
609 609
 					$parents = implode(',', $temp);
610 610
 
611
-					if(!empty($parents)) {
611
+					if (!empty($parents)) {
612 612
 						$where = "FIND_IN_SET(id,'{$parents}') DESC";
613 613
 						$rs = $modx->db->select('id, pagetitle', $tbl_site_content, "id IN ({$parents})", $where);
614
-						while($row = $modx->db->getRow($rs)) {
614
+						while ($row = $modx->db->getRow($rs)) {
615 615
 							$out .= '<li class="breadcrumbs__li">
616
-                                <a href="index.php?a=27&id=' . $row['id'] . '" class="breadcrumbs__a">' . htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']) . '</a>
616
+                                <a href="index.php?a=27&id=' . $row['id'].'" class="breadcrumbs__a">'.htmlspecialchars($row['pagetitle'], ENT_QUOTES, $modx->config['modx_charset']).'</a>
617 617
                                 <span class="breadcrumbs__sep">&gt;</span>
618 618
                             </li>';
619 619
 						}
620 620
 					}
621 621
 				}
622 622
 
623
-				$out .= '<li class="breadcrumbs__li breadcrumbs__li_current">' . $title . '</li>';
624
-				echo '<ul class="breadcrumbs">' . $out . '</ul>';
623
+				$out .= '<li class="breadcrumbs__li breadcrumbs__li_current">'.$title.'</li>';
624
+				echo '<ul class="breadcrumbs">'.$out.'</ul>';
625 625
 			}
626 626
 			?>
627 627
 
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
 					$evtOut = $modx->invokeEvent('OnDocFormTemplateRender', array(
639 639
 						'id' => $id
640 640
 					));
641
-					if(is_array($evtOut)) {
641
+					if (is_array($evtOut)) {
642 642
 						echo implode('', $evtOut);
643 643
 					} else {
644 644
 						?>
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
 									</td>
695 695
 								</tr>
696 696
 
697
-								<?php if($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?>
697
+								<?php if ($content['type'] == 'reference' || $modx->manager->action == '72') { // Web Link specific ?>
698 698
 
699 699
 									<tr>
700 700
 										<td><span class="warning"><?= $_lang['weblink'] ?></span>
@@ -730,17 +730,17 @@  discard block
 block discarded – undo
730 730
 											$from = "{$tbl_site_templates} AS t LEFT JOIN {$tbl_categories} AS c ON t.category = c.id";
731 731
 											$rs = $modx->db->select($field, $from, '', 'c.category, t.templatename ASC');
732 732
 											$currentCategory = '';
733
-											while($row = $modx->db->getRow($rs)) {
734
-												if($row['selectable'] != 1 && $row['id'] != $content['template']) {
733
+											while ($row = $modx->db->getRow($rs)) {
734
+												if ($row['selectable'] != 1 && $row['id'] != $content['template']) {
735 735
 													continue;
736 736
 												};
737 737
 												// Skip if not selectable but show if selected!
738 738
 												$thisCategory = $row['category'];
739
-												if($thisCategory == null) {
739
+												if ($thisCategory == null) {
740 740
 													$thisCategory = $_lang["no_category"];
741 741
 												}
742
-												if($thisCategory != $currentCategory) {
743
-													if($closeOptGroup) {
742
+												if ($thisCategory != $currentCategory) {
743
+													if ($closeOptGroup) {
744 744
 														echo "\t\t\t\t\t</optgroup>\n";
745 745
 													}
746 746
 													echo "\t\t\t\t\t<optgroup label=\"$thisCategory\">\n";
@@ -749,10 +749,10 @@  discard block
 block discarded – undo
749 749
 
750 750
 												$selectedtext = ($row['id'] == $content['template']) ? ' selected="selected"' : '';
751 751
 
752
-												echo "\t\t\t\t\t" . '<option value="' . $row['id'] . '"' . $selectedtext . '>' . $row['templatename'] . "</option>\n";
752
+												echo "\t\t\t\t\t".'<option value="'.$row['id'].'"'.$selectedtext.'>'.$row['templatename']."</option>\n";
753 753
 												$currentCategory = $thisCategory;
754 754
 											}
755
-											if($thisCategory != '') {
755
+											if ($thisCategory != '') {
756 756
 												echo "\t\t\t\t\t</optgroup>\n";
757 757
 											}
758 758
 											?>
@@ -796,20 +796,20 @@  discard block
 block discarded – undo
796 796
 									<td valign="top">
797 797
 										<?php
798 798
 										$parentlookup = false;
799
-										if(isset ($_REQUEST['id'])) {
800
-											if($content['parent'] == 0) {
799
+										if (isset ($_REQUEST['id'])) {
800
+											if ($content['parent'] == 0) {
801 801
 												$parentname = $site_name;
802 802
 											} else {
803 803
 												$parentlookup = $content['parent'];
804 804
 											}
805
-										} elseif(isset ($_REQUEST['pid'])) {
806
-											if($_REQUEST['pid'] == 0) {
805
+										} elseif (isset ($_REQUEST['pid'])) {
806
+											if ($_REQUEST['pid'] == 0) {
807 807
 												$parentname = $site_name;
808 808
 											} else {
809 809
 												$parentlookup = $_REQUEST['pid'];
810 810
 											}
811
-										} elseif(isset($_POST['parent'])) {
812
-											if($_POST['parent'] == 0) {
811
+										} elseif (isset($_POST['parent'])) {
812
+											if ($_POST['parent'] == 0) {
813 813
 												$parentname = $site_name;
814 814
 											} else {
815 815
 												$parentlookup = $_POST['parent'];
@@ -818,10 +818,10 @@  discard block
 block discarded – undo
818 818
 											$parentname = $site_name;
819 819
 											$content['parent'] = 0;
820 820
 										}
821
-										if($parentlookup !== false && is_numeric($parentlookup)) {
821
+										if ($parentlookup !== false && is_numeric($parentlookup)) {
822 822
 											$rs = $modx->db->select('pagetitle', $tbl_site_content, "id='{$parentlookup}'");
823 823
 											$parentname = $modx->db->getValue($rs);
824
-											if(!$parentname) {
824
+											if (!$parentname) {
825 825
 												$modx->webAlertAndQuit($_lang["error_no_parent"]);
826 826
 											}
827 827
 										}
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
 								}*/
864 864
 								?>
865 865
 
866
-								<?php if($content['type'] == 'document' || $modx->manager->action == '4') { ?>
866
+								<?php if ($content['type'] == 'document' || $modx->manager->action == '4') { ?>
867 867
 									<tr>
868 868
 										<td colspan="2">
869 869
 											<hr>
@@ -876,8 +876,8 @@  discard block
 block discarded – undo
876 876
 														<?php
877 877
 														// invoke OnRichTextEditorRegister event
878 878
 														$evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
879
-														if(is_array($evtOut)) {
880
-															for($i = 0; $i < count($evtOut); $i++) {
879
+														if (is_array($evtOut)) {
880
+															for ($i = 0; $i < count($evtOut); $i++) {
881 881
 																$editor = $evtOut[$i];
882 882
 																echo "\t\t\t", '<option value="', $editor, '"', ($modx->config['which_editor'] == $editor ? ' selected="selected"' : ''), '>', $editor, "</option>\n";
883 883
 															}
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
 											</div>
889 889
 											<div id="content_body">
890 890
 												<?php
891
-												if(($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) {
891
+												if (($content['richtext'] == 1 || $modx->manager->action == '4') && $use_editor == 1) {
892 892
 													$htmlContent = $content['content'];
893 893
 													?>
894 894
 													<div class="section-editor clearfix">
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
 													$richtexteditorIds[$modx->config['which_editor']][] = 'ta';
902 902
 													$richtexteditorOptions[$modx->config['which_editor']]['ta'] = '';
903 903
 												} else {
904
-													echo "\t" . '<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>' . "\n";
904
+													echo "\t".'<div><textarea class="phptextarea" id="ta" name="ta" rows="20" wrap="soft" onchange="documentDirty=true;">', $modx->htmlspecialchars($content['content']), '</textarea></div>'."\n";
905 905
 												}
906 906
 												?>
907 907
 											</div>
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
 
918 918
                             if (($content['type'] == 'document' || $modx->manager->action == '4') || ($content['type'] == 'reference' || $modx->manager->action == 72)) {
919 919
                                 $template = $default_template;
920
-                                $group_tvs = empty($modx->config['group_tvs']) ? 0 : (int)$modx->config['group_tvs'];
920
+                                $group_tvs = empty($modx->config['group_tvs']) ? 0 : (int) $modx->config['group_tvs'];
921 921
                                 if (isset ($_REQUEST['newtemplate'])) {
922 922
                                     $template = $_REQUEST['newtemplate'];
923 923
                                 } else {
@@ -945,17 +945,17 @@  discard block
 block discarded – undo
945 945
                                 );
946 946
                                 $sort = 'tvtpl.rank,tv.rank, tv.id';
947 947
                                 if ($group_tvs) {
948
-                                    $field .= ', IFNULL(tv.category,0) as category_id, IFNULL(cat.category,"' . $_lang['no_category'] . '") AS category, IFNULL(cat.rank,0) AS category_rank';
948
+                                    $field .= ', IFNULL(tv.category,0) as category_id, IFNULL(cat.category,"'.$_lang['no_category'].'") AS category, IFNULL(cat.rank,0) AS category_rank';
949 949
                                     $from .= '
950
-                                    LEFT JOIN ' . $tbl_categories . ' AS cat ON cat.id=tv.category';
951
-                                    $sort = 'cat.rank,cat.id,' . $sort;
950
+                                    LEFT JOIN ' . $tbl_categories.' AS cat ON cat.id=tv.category';
951
+                                    $sort = 'cat.rank,cat.id,'.$sort;
952 952
                                 }
953 953
                                 $where = vsprintf("tvtpl.templateid='%s' AND (1='%s' OR ISNULL(tva.documentgroup) %s)", $vs);
954 954
                                 $rs = $modx->db->select($field, $from, $where, $sort);
955 955
                                 if ($modx->db->getRecordCount($rs)) {
956 956
                                     $tvsArray = $modx->db->makeArray($rs, 'name');
957
-                                    require_once(MODX_MANAGER_PATH . 'includes/tmplvars.inc.php');
958
-                                    require_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php');
957
+                                    require_once(MODX_MANAGER_PATH.'includes/tmplvars.inc.php');
958
+                                    require_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php');
959 959
 
960 960
                                     $templateVariablesOutput = '';
961 961
                                     $templateVariablesGeneral = '';
@@ -969,8 +969,8 @@  discard block
 block discarded – undo
969 969
                                                 if ($group_tvs == 1 || $group_tvs == 3) {
970 970
                                                     if ($i === 0) {
971 971
                                                         $templateVariablesOutput .= '
972
-                            <div class="tab-section" id="tabTV_' . $row['category_id'] . '">
973
-                                <div class="tab-header">' . $row['category'] . '</div>
972
+                            <div class="tab-section" id="tabTV_' . $row['category_id'].'">
973
+                                <div class="tab-header">' . $row['category'].'</div>
974 974
                                 <div class="tab-body tmplvars">
975 975
                                     <table>' . "\n";
976 976
                                                     } else {
@@ -979,17 +979,17 @@  discard block
 block discarded – undo
979 979
                                 </div>
980 980
                             </div>
981 981
                             
982
-                            <div class="tab-section" id="tabTV_' . $row['category_id'] . '">
983
-                                <div class="tab-header">' . $row['category'] . '</div>
982
+                            <div class="tab-section" id="tabTV_' . $row['category_id'].'">
983
+                                <div class="tab-header">' . $row['category'].'</div>
984 984
                                 <div class="tab-body tmplvars">
985 985
                                     <table>';
986 986
                                                     }
987 987
                                                 } else if ($group_tvs == 2 || $group_tvs == 4) {
988 988
                                                     if ($i === 0) {
989 989
                                                         $templateVariablesOutput .= '
990
-                            <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars">
991
-                                <h2 class="tab">' . $row['category'] . '</h2>
992
-                                <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script>
990
+                            <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars">
991
+                                <h2 class="tab">' . $row['category'].'</h2>
992
+                                <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script>
993 993
                                 
994 994
                                 <div class="tab-body tmplvars">
995 995
                                     <table>';
@@ -999,9 +999,9 @@  discard block
 block discarded – undo
999 999
                                 </div>
1000 1000
                             </div>
1001 1001
                             
1002
-                            <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars">
1003
-                                <h2 class="tab">' . $row['category'] . '</h2>
1004
-                                <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script>
1002
+                            <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars">
1003
+                                <h2 class="tab">' . $row['category'].'</h2>
1004
+                                <script type="text/javascript">tpTemplateVariables.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script>
1005 1005
                                 
1006 1006
                                 <div class="tab-body tmplvars">
1007 1007
                                     <table>';
@@ -1009,18 +1009,18 @@  discard block
 block discarded – undo
1009 1009
                                                 } else if ($group_tvs == 5) {
1010 1010
                                                     if ($i === 0) {
1011 1011
                                                         $templateVariablesOutput .= '
1012
-                                <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars">
1013
-                                    <h2 class="tab">' . $row['category'] . '</h2>
1014
-                                    <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script>
1012
+                                <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars">
1013
+                                    <h2 class="tab">' . $row['category'].'</h2>
1014
+                                    <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script>
1015 1015
                                     <table>';
1016 1016
                                                     } else {
1017 1017
                                                         $templateVariablesOutput .= '
1018 1018
                                     </table>
1019 1019
                                 </div>
1020 1020
                                 
1021
-                                <div id="tabTV_' . $row['category_id'] . '" class="tab-page tmplvars">
1022
-                                    <h2 class="tab">' . $row['category'] . '</h2>
1023
-                                    <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'] . '\'));</script>
1021
+                                <div id="tabTV_' . $row['category_id'].'" class="tab-page tmplvars">
1022
+                                    <h2 class="tab">' . $row['category'].'</h2>
1023
+                                    <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'tabTV_' . $row['category_id'].'\'));</script>
1024 1024
                                     
1025 1025
                                     <table>';
1026 1026
                                                     }
@@ -1040,8 +1040,8 @@  discard block
 block discarded – undo
1040 1040
                                                 $editor = isset($tvOptions['editor']) ? $tvOptions['editor'] : $modx->config['which_editor'];
1041 1041
                                             };
1042 1042
                                             // Add richtext editor to the list
1043
-                                            $richtexteditorIds[$editor][] = "tv" . $row['id'];
1044
-                                            $richtexteditorOptions[$editor]["tv" . $row['id']] = $tvOptions;
1043
+                                            $richtexteditorIds[$editor][] = "tv".$row['id'];
1044
+                                            $richtexteditorOptions[$editor]["tv".$row['id']] = $tvOptions;
1045 1045
                                         }
1046 1046
 
1047 1047
                                         $templateVariablesTmp = '';
@@ -1058,24 +1058,24 @@  discard block
 block discarded – undo
1058 1058
                                         }
1059 1059
 
1060 1060
                                         // post back value
1061
-                                        if (array_key_exists('tv' . $row['id'], $_POST)) {
1062
-                                            if (is_array($_POST['tv' . $row['id']])) {
1063
-                                                $tvPBV = implode('||', $_POST['tv' . $row['id']]);
1061
+                                        if (array_key_exists('tv'.$row['id'], $_POST)) {
1062
+                                            if (is_array($_POST['tv'.$row['id']])) {
1063
+                                                $tvPBV = implode('||', $_POST['tv'.$row['id']]);
1064 1064
                                             } else {
1065
-                                                $tvPBV = $_POST['tv' . $row['id']];
1065
+                                                $tvPBV = $_POST['tv'.$row['id']];
1066 1066
                                             }
1067 1067
                                         } else {
1068 1068
                                             $tvPBV = $row['value'];
1069 1069
                                         }
1070 1070
 
1071
-                                        $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">' . $row['description'] . '</span>' : '';
1072
-                                        $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">(' . $_lang['tmplvars_inherited'] . ')</span>' : '';
1073
-                                        $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*' . $row['name'] . '*]</small>' : '';
1071
+                                        $tvDescription = (!empty($row['description'])) ? '<br /><span class="comment">'.$row['description'].'</span>' : '';
1072
+                                        $tvInherited = (substr($tvPBV, 0, 8) == '@INHERIT') ? '<br /><span class="comment inherited">('.$_lang['tmplvars_inherited'].')</span>' : '';
1073
+                                        $tvName = $modx->hasPermission('edit_template') ? '<br/><small class="protectedNode">[*'.$row['name'].'*]</small>' : '';
1074 1074
 
1075 1075
                                         $templateVariablesTmp .= '
1076 1076
                                         <tr>
1077
-                                            <td><span class="warning">' . $row['caption'] . $tvName . '</span>' . $tvDescription . $tvInherited . '</td>
1078
-                                            <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '') . '">' . renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray) . '</div></td>
1077
+                                            <td><span class="warning">' . $row['caption'].$tvName.'</span>'.$tvDescription.$tvInherited.'</td>
1078
+                                            <td><div style="position:relative;' . ($row['type'] == 'date' ? '' : '').'">'.renderFormElement($row['type'], $row['id'], $row['default_text'], $row['elements'], $tvPBV, '', $row, $tvsArray).'</div></td>
1079 1079
                                         </tr>';
1080 1080
 
1081 1081
                                         if ($group_tvs && $row['category_id'] == 0) {
@@ -1089,38 +1089,38 @@  discard block
 block discarded – undo
1089 1089
                                     }
1090 1090
 
1091 1091
                                     if ($templateVariablesGeneral) {
1092
-                                        echo '<table id="tabTV_0" class="tmplvars"><tbody>' . $templateVariablesGeneral . '</tbody></table>';
1092
+                                        echo '<table id="tabTV_0" class="tmplvars"><tbody>'.$templateVariablesGeneral.'</tbody></table>';
1093 1093
                                     }
1094 1094
 
1095 1095
                                     $templateVariables .= '
1096 1096
                         <!-- Template Variables -->' . "\n";
1097 1097
                                     if (!$group_tvs) {
1098 1098
                                         $templateVariables .= '
1099
-                                    <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'] . '</div>
1099
+                                    <div class="sectionHeader" id="tv_header">' . $_lang['settings_templvars'].'</div>
1100 1100
                                         <div class="sectionBody tmplvars">
1101 1101
                                             <table>';
1102 1102
                                     } else if ($group_tvs == 2) {
1103 1103
                                         $templateVariables .= '
1104 1104
                     <div class="tab-section">
1105
-                        <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'] . '</div>
1105
+                        <div class="tab-header" id="tv_header">' . $_lang['settings_templvars'].'</div>
1106 1106
                         <div class="tab-pane" id="paneTemplateVariables">
1107 1107
                             <script type="text/javascript">
1108
-                                tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . ');
1108
+                                tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').');
1109 1109
                             </script>';
1110 1110
                                     } else if ($group_tvs == 3) {
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
                                     } else if ($group_tvs == 4) {
1116 1116
                                         $templateVariables .= '
1117 1117
                     <div id="templateVariables" class="tab-page tmplvars">
1118
-                        <h2 class="tab">' . $_lang['settings_templvars'] . '</h2>
1118
+                        <h2 class="tab">' . $_lang['settings_templvars'].'</h2>
1119 1119
                         <script type="text/javascript">tpSettings.addTabPage(document.getElementById(\'templateVariables\'));</script>
1120 1120
                         
1121 1121
                         <div class="tab-pane" id="paneTemplateVariables">
1122 1122
                             <script type="text/javascript">
1123
-                                tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . ');
1123
+                                tpTemplateVariables = new WebFXTabPane(document.getElementById(\'paneTemplateVariables\'), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').');
1124 1124
                             </script>';
1125 1125
                                     }
1126 1126
                                     $templateVariables .= $templateVariablesOutput;
@@ -1212,7 +1212,7 @@  discard block
 block discarded – undo
1212 1212
 
1213 1213
 								<?php
1214 1214
 
1215
-								if($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) {
1215
+								if ($_SESSION['mgrRole'] == 1 || $modx->manager->action != '27' || $_SESSION['mgrInternalKey'] == $content['createdby'] || $modx->hasPermission('change_resourcetype')) {
1216 1216
 									?>
1217 1217
 									<tr>
1218 1218
 										<td>
@@ -1235,13 +1235,13 @@  discard block
 block discarded – undo
1235 1235
 										<td>
1236 1236
 											<select name="contentType" class="inputBox" onchange="documentDirty=true;">
1237 1237
 												<?php
1238
-												if(!$content['contentType']) {
1238
+												if (!$content['contentType']) {
1239 1239
 													$content['contentType'] = 'text/html';
1240 1240
 												}
1241 1241
 												$custom_contenttype = (isset ($custom_contenttype) ? $custom_contenttype : "text/html,text/plain,text/xml");
1242 1242
 												$ct = explode(",", $custom_contenttype);
1243
-												for($i = 0; $i < count($ct); $i++) {
1244
-													echo "\t\t\t\t\t" . '<option value="' . $ct[$i] . '"' . ($content['contentType'] == $ct[$i] ? ' selected="selected"' : '') . '>' . $ct[$i] . "</option>\n";
1243
+												for ($i = 0; $i < count($ct); $i++) {
1244
+													echo "\t\t\t\t\t".'<option value="'.$ct[$i].'"'.($content['contentType'] == $ct[$i] ? ' selected="selected"' : '').'>'.$ct[$i]."</option>\n";
1245 1245
 												}
1246 1246
 												?>
1247 1247
 											</select>
@@ -1267,7 +1267,7 @@  discard block
 block discarded – undo
1267 1267
 									</tr>
1268 1268
 									<?php
1269 1269
 								} else {
1270
-									if($content['type'] != 'reference' && $modx->manager->action != '72') {
1270
+									if ($content['type'] != 'reference' && $modx->manager->action != '72') {
1271 1271
 										// non-admin managers creating or editing a document resource
1272 1272
 										?>
1273 1273
 										<input type="hidden" name="contentType" value="<?= (isset($content['contentType']) ? $content['contentType'] : "text/html") ?>" />
@@ -1367,15 +1367,15 @@  discard block
 block discarded – undo
1367 1367
 						<?php
1368 1368
 					/*******************************
1369 1369
 					 * Document Access Permissions */
1370
-					if($use_udperms == 1) {
1370
+					if ($use_udperms == 1) {
1371 1371
 						$groupsarray = array();
1372 1372
 						$sql = '';
1373 1373
 
1374 1374
 						$documentId = ($modx->manager->action == '27' ? $id : (!empty($_REQUEST['pid']) ? $_REQUEST['pid'] : $content['parent']));
1375
-						if($documentId > 0) {
1375
+						if ($documentId > 0) {
1376 1376
 							// Load up, the permissions from the parent (if new document) or existing document
1377 1377
 							$rs = $modx->db->select('id, document_group', $tbl_document_groups, "document='{$documentId}'");
1378
-							while($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'] . ',' . $currentgroup['id'];
1378
+							while ($currentgroup = $modx->db->getRow($rs)) $groupsarray[] = $currentgroup['document_group'].','.$currentgroup['id'];
1379 1379
 
1380 1380
 							// Load up the current permissions and names
1381 1381
 							$vs = array(
@@ -1391,7 +1391,7 @@  discard block
 block discarded – undo
1391 1391
 						}
1392 1392
 
1393 1393
 						// retain selected doc groups between post
1394
-						if(isset($_POST['docgroups'])) {
1394
+						if (isset($_POST['docgroups'])) {
1395 1395
 							$groupsarray = array_merge($groupsarray, $_POST['docgroups']);
1396 1396
 						}
1397 1397
 
@@ -1410,26 +1410,26 @@  discard block
 block discarded – undo
1410 1410
 						$permissions_no = 0; // count permissions the current mgr user doesn't have
1411 1411
 
1412 1412
 						// Loop through the permissions list
1413
-						while($row = $modx->db->getRow($rs)) {
1413
+						while ($row = $modx->db->getRow($rs)) {
1414 1414
 
1415 1415
 							// Create an inputValue pair (group ID and group link (if it exists))
1416
-							$inputValue = $row['id'] . ',' . ($row['link_id'] ? $row['link_id'] : 'new');
1417
-							$inputId = 'group-' . $row['id'];
1416
+							$inputValue = $row['id'].','.($row['link_id'] ? $row['link_id'] : 'new');
1417
+							$inputId = 'group-'.$row['id'];
1418 1418
 
1419 1419
 							$checked = in_array($inputValue, $groupsarray);
1420
-							if($checked) {
1420
+							if ($checked) {
1421 1421
 								$notPublic = true;
1422 1422
 							} // Mark as private access (either web or manager)
1423 1423
 
1424 1424
 							// Skip the access permission if the user doesn't have access...
1425
-							if((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) {
1425
+							if ((!$isManager && $row['private_memgroup'] == '1') || (!$isWeb && $row['private_webgroup'] == '1')) {
1426 1426
 								continue;
1427 1427
 							}
1428 1428
 
1429 1429
 							// Setup attributes for this Input box
1430 1430
 							$inputAttributes['id'] = $inputId;
1431 1431
 							$inputAttributes['value'] = $inputValue;
1432
-							if($checked) {
1432
+							if ($checked) {
1433 1433
 								$inputAttributes['checked'] = 'checked';
1434 1434
 							} else {
1435 1435
 								unset($inputAttributes['checked']);
@@ -1437,10 +1437,10 @@  discard block
 block discarded – undo
1437 1437
 
1438 1438
 							// Create attribute string list
1439 1439
 							$inputString = array();
1440
-							foreach($inputAttributes as $k => $v) $inputString[] = $k . '="' . $v . '"';
1440
+							foreach ($inputAttributes as $k => $v) $inputString[] = $k.'="'.$v.'"';
1441 1441
 
1442 1442
 							// Make the <input> HTML
1443
-							$inputHTML = '<input ' . implode(' ', $inputString) . ' />';
1443
+							$inputHTML = '<input '.implode(' ', $inputString).' />';
1444 1444
 
1445 1445
 							// does user have this permission?
1446 1446
 							$from = "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg";
@@ -1451,23 +1451,23 @@  discard block
 block discarded – undo
1451 1451
 							$where = vsprintf("mga.membergroup=mg.user_group AND mga.documentgroup=%s AND mg.member=%s", $vs);
1452 1452
 							$rsp = $modx->db->select('COUNT(mg.id)', $from, $where);
1453 1453
 							$count = $modx->db->getValue($rsp);
1454
-							if($count > 0) {
1454
+							if ($count > 0) {
1455 1455
 								++$permissions_yes;
1456 1456
 							} else {
1457 1457
 								++$permissions_no;
1458 1458
 							}
1459
-							$permissions[] = "\t\t" . '<li>' . $inputHTML . '<label for="' . $inputId . '">' . $row['name'] . '</label></li>';
1459
+							$permissions[] = "\t\t".'<li>'.$inputHTML.'<label for="'.$inputId.'">'.$row['name'].'</label></li>';
1460 1460
 						}
1461 1461
 						// if mgr user doesn't have access to any of the displayable permissions, forget about them and make doc public
1462
-						if($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) {
1462
+						if ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0)) {
1463 1463
 							$permissions = array();
1464 1464
 						}
1465 1465
 
1466 1466
 						// See if the Access Permissions section is worth displaying...
1467
-						if(!empty($permissions)) {
1467
+						if (!empty($permissions)) {
1468 1468
 							// Add the "All Document Groups" item if we have rights in both contexts
1469
-							if($isManager && $isWeb) {
1470
-								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>');
1469
+							if ($isManager && $isWeb) {
1470
+								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>');
1471 1471
 							}
1472 1472
 							// Output the permissions list...
1473 1473
 							?>
@@ -1500,12 +1500,12 @@  discard block
 block discarded – undo
1500 1500
 								</script>
1501 1501
 								<p><?= $_lang['access_permissions_docs_message'] ?></p>
1502 1502
 								<ul>
1503
-									<?= implode("\n", $permissions) . "\n" ?>
1503
+									<?= implode("\n", $permissions)."\n" ?>
1504 1504
 								</ul>
1505 1505
 							</div><!--div class="tab-page" id="tabAccess"-->
1506 1506
 							<?php
1507 1507
 						} // !empty($permissions)
1508
-						elseif($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) {
1508
+						elseif ($_SESSION['mgrRole'] != 1 && ($permissions_yes == 0 && $permissions_no > 0) && ($_SESSION['mgrPermissions']['access_permissions'] == 1 || $_SESSION['mgrPermissions']['web_access_permissions'] == 1)) {
1509 1509
 							?>
1510 1510
 							<p><?= $_lang["access_permissions_docs_collision"] ?></p>
1511 1511
 							<?php
@@ -1525,7 +1525,7 @@  discard block
 block discarded – undo
1525 1525
 						'template' => $content['template']
1526 1526
 					));
1527 1527
 
1528
-					if(is_array($evtOut)) {
1528
+					if (is_array($evtOut)) {
1529 1529
 						echo implode('', $evtOut);
1530 1530
 					}
1531 1531
 					?>
@@ -1538,16 +1538,16 @@  discard block
 block discarded – undo
1538 1538
 		storeCurTemplate();
1539 1539
 	</script>
1540 1540
 <?php
1541
-if(($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) {
1542
-	if(is_array($richtexteditorIds)) {
1543
-		foreach($richtexteditorIds as $editor => $elements) {
1541
+if (($content['richtext'] == 1 || $modx->manager->action == '4' || $modx->manager->action == '72') && $use_editor == 1) {
1542
+	if (is_array($richtexteditorIds)) {
1543
+		foreach ($richtexteditorIds as $editor => $elements) {
1544 1544
 			// invoke OnRichTextEditorInit event
1545 1545
 			$evtOut = $modx->invokeEvent('OnRichTextEditorInit', array(
1546 1546
 				'editor' => $editor,
1547 1547
 				'elements' => $elements,
1548 1548
 				'options' => $richtexteditorOptions[$editor]
1549 1549
 			));
1550
-			if(is_array($evtOut)) {
1550
+			if (is_array($evtOut)) {
1551 1551
 				echo implode('', $evtOut);
1552 1552
 			}
1553 1553
 		}
@@ -1557,37 +1557,37 @@  discard block
 block discarded – undo
1557 1557
 /**
1558 1558
  * @return string
1559 1559
  */
1560
-function getDefaultTemplate() {
1560
+function getDefaultTemplate(){
1561 1561
 	$modx = evolutionCMS();
1562 1562
 
1563 1563
     $default_template = '';
1564
-	switch($modx->config['auto_template_logic']) {
1564
+	switch ($modx->config['auto_template_logic']) {
1565 1565
 		case 'sibling':
1566
-			if(!isset($_GET['pid']) || empty($_GET['pid'])) {
1566
+			if (!isset($_GET['pid']) || empty($_GET['pid'])) {
1567 1567
 				$site_start = $modx->config['site_start'];
1568 1568
 				$where = "sc.isfolder=0 AND sc.id!='{$site_start}'";
1569 1569
 				$sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', $where, 'menuindex', 'ASC', 1);
1570
-				if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') {
1570
+				if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') {
1571 1571
 					$default_template = $sibl[0]['template'];
1572 1572
 				}
1573 1573
 			} else {
1574 1574
 				$sibl = $modx->getDocumentChildren($_REQUEST['pid'], 1, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1);
1575
-				if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') {
1575
+				if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') {
1576 1576
 					$default_template = $sibl[0]['template'];
1577 1577
 				} else {
1578 1578
 					$sibl = $modx->getDocumentChildren($_REQUEST['pid'], 0, 0, 'template', 'isfolder=0', 'menuindex', 'ASC', 1);
1579
-					if(isset($sibl[0]['template']) && $sibl[0]['template'] !== '') {
1579
+					if (isset($sibl[0]['template']) && $sibl[0]['template'] !== '') {
1580 1580
 						$default_template = $sibl[0]['template'];
1581 1581
 					}
1582 1582
 				}
1583 1583
 			}
1584
-			if(isset($default_template)) {
1584
+			if (isset($default_template)) {
1585 1585
 				break;
1586 1586
 			} // If $default_template could not be determined, fall back / through to "parent"-mode
1587 1587
 		case 'parent':
1588
-			if(isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) {
1588
+			if (isset($_REQUEST['pid']) && !empty($_REQUEST['pid'])) {
1589 1589
 				$parent = $modx->getPageInfo($_REQUEST['pid'], 0, 'template');
1590
-				if(isset($parent['template'])) {
1590
+				if (isset($parent['template'])) {
1591 1591
 					$default_template = $parent['template'];
1592 1592
 				}
1593 1593
 			}
Please login to merge, or discard this patch.
manager/processors/save_settings.processor.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -1,46 +1,46 @@  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('settings')) {
5
+if (!$modx->hasPermission('settings')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 $data = $_POST;
9 9
 // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972
10 10
 unset($_POST);
11 11
 
12
-if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false)
12
+if ($data['friendly_urls'] === '1' && strpos($_SERVER['SERVER_SOFTWARE'], 'IIS') === false)
13 13
 {
14
-	$htaccess        = $modx->config['base_path'] . '.htaccess';
15
-	$sample_htaccess = $modx->config['base_path'] . 'ht.access';
16
-	$dir = '/' . trim($modx->config['base_url'],'/');
17
-	if(is_file($htaccess))
14
+	$htaccess        = $modx->config['base_path'].'.htaccess';
15
+	$sample_htaccess = $modx->config['base_path'].'ht.access';
16
+	$dir = '/'.trim($modx->config['base_url'], '/');
17
+	if (is_file($htaccess))
18 18
 	{
19 19
 		$_ = file_get_contents($htaccess);
20
-		if(strpos($_,'RewriteBase')===false)
20
+		if (strpos($_, 'RewriteBase') === false)
21 21
 		{
22 22
 			$warnings[] = $_lang["settings_friendlyurls_alert2"];
23 23
 		}
24
-		elseif(is_writable($htaccess))
24
+		elseif (is_writable($htaccess))
25 25
 		{
26
-			$_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_);
27
-			if(!@file_put_contents($htaccess,$_))
26
+			$_ = preg_replace('@RewriteBase.+@', "RewriteBase {$dir}", $_);
27
+			if (!@file_put_contents($htaccess, $_))
28 28
 			{
29 29
 				$warnings[] = $_lang["settings_friendlyurls_alert2"];
30 30
 			}
31 31
 		}
32 32
 	}
33
-	elseif(is_file($sample_htaccess))
33
+	elseif (is_file($sample_htaccess))
34 34
 	{
35
-		if(!@rename($sample_htaccess,$htaccess))
35
+		if (!@rename($sample_htaccess, $htaccess))
36 36
         {
37 37
         	$warnings[] = $_lang["settings_friendlyurls_alert"];
38 38
 		}
39
-		elseif($modx->config['base_url']!=='/')
39
+		elseif ($modx->config['base_url'] !== '/')
40 40
 		{
41 41
 			$_ = file_get_contents($htaccess);
42
-			$_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_);
43
-			if(!@file_put_contents($htaccess,$_))
42
+			$_ = preg_replace('@RewriteBase.+@', "RewriteBase {$dir}", $_);
43
+			if (!@file_put_contents($htaccess, $_))
44 44
 			{
45 45
 				$warnings[] = $_lang["settings_friendlyurls_alert2"];
46 46
 			}
@@ -48,17 +48,17 @@  discard block
 block discarded – undo
48 48
 	}
49 49
 }
50 50
 
51
-if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) {
52
-    unlink(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css');
51
+if (file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css')) {
52
+    unlink(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css');
53 53
 }
54 54
 
55
-$data['filemanager_path'] = str_replace('[(base_path)]',MODX_BASE_PATH,$data['filemanager_path']);
56
-$data['rb_base_dir']      = str_replace('[(base_path)]',MODX_BASE_PATH,$data['rb_base_dir']);
55
+$data['filemanager_path'] = str_replace('[(base_path)]', MODX_BASE_PATH, $data['filemanager_path']);
56
+$data['rb_base_dir']      = str_replace('[(base_path)]', MODX_BASE_PATH, $data['rb_base_dir']);
57 57
 
58 58
 if (isset($data) && count($data) > 0) {
59
-	if(isset($data['manager_language'])) {
60
-		$lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php';
61
-		if(is_file($lang_path)) {
59
+	if (isset($data['manager_language'])) {
60
+		$lang_path = MODX_MANAGER_PATH.'includes/lang/'.$data['manager_language'].'.inc.php';
61
+		if (is_file($lang_path)) {
62 62
 			include($lang_path);
63 63
             global $modx_lang_attribute;
64 64
             $data['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute;
@@ -66,15 +66,15 @@  discard block
 block discarded – undo
66 66
 	}
67 67
 	$savethese = array();
68 68
 	$data['sys_files_checksum'] = $modx->manager->getSystemChecksum($data['check_files_onlogin']);
69
-	$data['mail_check_timeperiod'] = (int)$data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute
69
+	$data['mail_check_timeperiod'] = (int) $data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute
70 70
 	foreach ($data as $k => $v) {
71 71
 		switch ($k) {
72 72
 			case 'site_name':
73 73
 				$v = htmlspecialchars($v);
74 74
 				break;
75 75
             case 'settings_version':{
76
-                if($modx->getVersionData('version')!=$data['settings_version']){
77
-                    $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version');
76
+                if ($modx->getVersionData('version') != $data['settings_version']) {
77
+                    $modx->logEvent(17, 2, '<pre>'.var_export($data['settings_version'], true).'</pre>', 'fake settings_version');
78 78
                     $v = $modx->getVersionData('version');
79 79
                 }
80 80
                 break;
@@ -95,21 +95,21 @@  discard block
 block discarded – undo
95 95
 			case 'rb_base_url':
96 96
 			case 'filemanager_path':
97 97
 				$v = trim($v);
98
-				$v = rtrim($v,'/') . '/';
98
+				$v = rtrim($v, '/').'/';
99 99
 				break;
100 100
             case 'manager_language':
101
-                $langDir = realpath(MODX_MANAGER_PATH . 'includes/lang');
102
-                $langFile = realpath(MODX_MANAGER_PATH . 'includes/lang/' . $v . '.inc.php');
101
+                $langDir = realpath(MODX_MANAGER_PATH.'includes/lang');
102
+                $langFile = realpath(MODX_MANAGER_PATH.'includes/lang/'.$v.'.inc.php');
103 103
                 $langFileDir = dirname($langFile);
104
-                if($langDir !== $langFileDir || !file_exists($langFile)) {
104
+                if ($langDir !== $langFileDir || !file_exists($langFile)) {
105 105
                     $v = 'english';
106 106
                 }
107 107
 				break;
108 108
 			case 'smtppw':
109 109
 				if ($v !== '********************' && $v !== '') {
110 110
 					$v = trim($v);
111
-					$v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7);
112
-					$v = str_replace('=','%',$v);
111
+					$v = base64_encode($v).substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7);
112
+					$v = str_replace('=', '%', $v);
113 113
 				} elseif ($v === '********************') {
114 114
 					$k = '';
115 115
 				}
@@ -118,14 +118,14 @@  discard block
 block discarded – undo
118 118
 				$v = str_replace(array(' ,', ', '), ',', $v);
119 119
 				if ($v !== ',') {
120 120
 					$v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : '';
121
-					$configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n";
122
-					@file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString);
121
+					$configString = '<?php'."\n".'define(\'MODX_SITE_HOSTNAMES\', \''.$v.'\');'."\n";
122
+					@file_put_contents(MODX_BASE_PATH.'assets/cache/siteHostnames.php', $configString);
123 123
 				}
124 124
 				$k = '';
125 125
 				break;
126 126
 			case 'session_timeout':
127 127
 				$mail_check_timeperiod = $data['mail_check_timeperiod'];
128
-				$v = (int)$v < ($data['mail_check_timeperiod']/60+1) ? ($data['mail_check_timeperiod']/60+1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum
128
+				$v = (int) $v < ($data['mail_check_timeperiod'] / 60 + 1) ? ($data['mail_check_timeperiod'] / 60 + 1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum
129 129
 				break;
130 130
 			default:
131 131
 			break;
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 
135 135
 		$modx->config[$k] = $v;
136 136
 
137
-		if(!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')';
137
+		if (!empty($k)) $savethese[] = '(\''.$modx->db->escape($k).'\', \''.$modx->db->escape($v).'\')';
138 138
 	}
139 139
 
140 140
 	// Run a single query to save all the values
@@ -144,16 +144,16 @@  discard block
 block discarded – undo
144 144
 
145 145
 	// Reset Template Pages
146 146
 	if (isset($data['reset_template'])) {
147
-		$newtemplate = (int)$data['default_template'];
148
-		$oldtemplate = (int)$data['old_template'];
147
+		$newtemplate = (int) $data['default_template'];
148
+		$oldtemplate = (int) $data['old_template'];
149 149
 		$tbl = $modx->getFullTableName('site_content');
150 150
 		$reset = $data['reset_template'];
151
-		if($reset==1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'");
152
-		else if($reset==2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'");
151
+		if ($reset == 1) $modx->db->update(array('template' => $newtemplate), $tbl, "type='document'");
152
+		else if ($reset == 2) $modx->db->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'");
153 153
 	}
154 154
 
155 155
 	// empty cache
156 156
 	$modx->clearCache('full');
157 157
 }
158
-$header="Location: index.php?a=7&r=10";
158
+$header = "Location: index.php?a=7&r=10";
159 159
 header($header);
Please login to merge, or discard this patch.
manager/actions/mutate_user.dynamic.php 1 patch
Spacing   +58 added lines, -58 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->manager->action) {
6
+switch ($modx->manager->action) {
7 7
 	case 12:
8
-		if(!$modx->hasPermission('edit_user')) {
8
+		if (!$modx->hasPermission('edit_user')) {
9 9
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
10 10
 		}
11 11
 		break;
12 12
 	case 11:
13
-		if(!$modx->hasPermission('new_user')) {
13
+		if (!$modx->hasPermission('new_user')) {
14 14
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
15 15
 		}
16 16
 		break;
@@ -18,20 +18,20 @@  discard block
 block discarded – undo
18 18
 		$modx->webAlertAndQuit($_lang["error_no_privileges"]);
19 19
 }
20 20
 
21
-$user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
21
+$user = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
22 22
 
23 23
 // check to see the snippet editor isn't locked
24
-$rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'");
25
-if($username = $modx->db->getValue($rs)) {
24
+$rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=12 AND id='{$user}' AND internalKey!='".$modx->getLoginUserID()."'");
25
+if ($username = $modx->db->getValue($rs)) {
26 26
 	$modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "user"));
27 27
 }
28 28
 // end check for lock
29 29
 
30
-if($modx->manager->action == '12') {
30
+if ($modx->manager->action == '12') {
31 31
 	// get user attribute
32 32
 	$rs = $modx->db->select('*', $modx->getFullTableName('user_attributes'), "internalKey = '{$user}'");
33 33
 	$userdata = $modx->db->getRow($rs);
34
-	if(!$userdata) {
34
+	if (!$userdata) {
35 35
 		$modx->webAlertAndQuit("No user returned!");
36 36
 	}
37 37
 
@@ -39,10 +39,10 @@  discard block
 block discarded – undo
39 39
 	// get user settings
40 40
 	$rs = $modx->db->select('*', $modx->getFullTableName('user_settings'), "user = '{$user}'");
41 41
 	$usersettings = array();
42
-	while($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value'];
42
+	while ($row = $modx->db->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value'];
43 43
 	// manually extract so that user display settings are not overwritten
44
-	foreach($usersettings as $k => $v) {
45
-		if($k != 'manager_language' && $k != 'manager_theme') {
44
+	foreach ($usersettings as $k => $v) {
45
+		if ($k != 'manager_language' && $k != 'manager_theme') {
46 46
 			${$k} = $v;
47 47
 		}
48 48
 	}
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	// get user name
51 51
 	$rs = $modx->db->select('*', $modx->getFullTableName('manager_users'), "id = '{$user}'");
52 52
 	$usernamedata = $modx->db->getRow($rs);
53
-	if(!$usernamedata) {
53
+	if (!$usernamedata) {
54 54
 		$modx->webAlertAndQuit("No user returned while getting username!");
55 55
 	}
56 56
 	$_SESSION['itemname'] = $usernamedata['username'];
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
 }
63 63
 
64 64
 // avoid doubling htmlspecialchars (already encoded in DB)
65
-foreach($userdata as $key => $val) {
65
+foreach ($userdata as $key => $val) {
66 66
 	$userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']);
67 67
 };
68 68
 $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']);
69 69
 
70 70
 // restore saved form
71 71
 $formRestored = false;
72
-if($modx->manager->hasFormValues()) {
72
+if ($modx->manager->hasFormValues()) {
73 73
 	$modx->manager->loadFormValues();
74 74
 	// restore post values
75 75
 	$userdata = array_merge($userdata, $_POST);
@@ -84,13 +84,13 @@  discard block
 block discarded – undo
84 84
 // include the country list language file
85 85
 $_country_lang = array();
86 86
 include_once "lang/country/english_country.inc.php";
87
-if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) {
88
-	include_once "lang/country/" . $manager_language . "_country.inc.php";
87
+if ($manager_language != "english" && file_exists($modx->config['site_manager_path']."includes/lang/country/".$manager_language."_country.inc.php")) {
88
+	include_once "lang/country/".$manager_language."_country.inc.php";
89 89
 }
90 90
 asort($_country_lang);
91 91
 
92 92
 $displayStyle = ($_SESSION['browser'] === 'modern') ? 'table-row' : 'block';
93
-if($which_browser == 'default') {
93
+if ($which_browser == 'default') {
94 94
 	$which_browser = $modx->configGlobal['which_browser'] ? $modx->configGlobal['which_browser'] : $modx->config['which_browser'];
95 95
 }
96 96
 ?>
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 			document.userform.save.click();
183 183
 		},
184 184
 		delete: function() {
185
-			<?php if($_GET['id'] == $modx->getLoginUserID()) { ?>
185
+			<?php if ($_GET['id'] == $modx->getLoginUserID()) { ?>
186 186
 			alert("<?php echo $_lang['alert_delete_self']; ?>");
187 187
 			<?php } else { ?>
188 188
 			if(confirm("<?php echo $_lang['confirm_delete_user']; ?>") === true) {
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 	$evtOut = $modx->invokeEvent("OnUserFormPrerender", array(
206 206
 		"id" => $user
207 207
 	));
208
-	if(is_array($evtOut)) {
208
+	if (is_array($evtOut)) {
209 209
 		echo implode("", $evtOut);
210 210
 	}
211 211
 	?>
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	<input type="hidden" name="blockedmode" value="<?php echo ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) ? "1" : "0" ?>" />
215 215
 
216 216
 	<h1>
217
-        <i class="fa fa fa-user"></i><?= ($usernamedata['username'] ? $usernamedata['username'] . '<small>(' . $usernamedata['id'] . ')</small>' : $_lang['user_title']) ?>
217
+        <i class="fa fa fa-user"></i><?= ($usernamedata['username'] ? $usernamedata['username'].'<small>('.$usernamedata['id'].')</small>' : $_lang['user_title']) ?>
218 218
     </h1>
219 219
 
220 220
 	<?php echo $_style['actionbuttons']['dynamic']['user'] ?>
@@ -232,13 +232,13 @@  discard block
 block discarded – undo
232 232
 				<table border="0" cellspacing="0" cellpadding="3" class="table table--edit table--editUser">
233 233
 					<tr>
234 234
 						<td colspan="3"><span id="blocked" class="warning">
235
-							<?php if($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || $userdata['failedlogins'] > 3) { ?>
235
+							<?php if ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || $userdata['failedlogins'] > 3) { ?>
236 236
 								<?php echo $_lang['user_is_blocked']; ?>
237 237
 							<?php } ?>
238 238
 							</span>
239 239
 							<br /></td>
240 240
 					</tr>
241
-					<?php if(!empty($userdata['id'])) { ?>
241
+					<?php if (!empty($userdata['id'])) { ?>
242 242
 						<tr id="showname" style="display: <?php echo ($modx->manager->action == '12' && (!isset($usernamedata['oldusername']) || $usernamedata['oldusername'] == $usernamedata['username'])) ? $displayStyle : 'none'; ?> ">
243 243
 							<td colspan="3"><i class="<?php echo $_style["icons_user"] ?>"></i>&nbsp;<b><?php echo $modx->htmlspecialchars(!empty($usernamedata['oldusername']) ? $usernamedata['oldusername'] : $usernamedata['username']); ?></b> - <span class="comment"><a href="javascript:;" onClick="changeName();return false;"><?php echo $_lang["change_name"]; ?></a></span>
244 244
 								<input type="hidden" name="oldusername" value="<?php echo $modx->htmlspecialchars(!empty($usernamedata['oldusername']) ? $usernamedata['oldusername'] : $usernamedata['username']); ?>" />
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 						<td><input type="text" name="newusername" class="inputBox" value="<?php echo $modx->htmlspecialchars($usernamedata['username']); ?>" onChange='documentDirty=true;' maxlength="100" /></td>
252 252
 					</tr>
253 253
 					<tr>
254
-						<th><?php echo $modx->manager->action == '11' ? $_lang['password'] . ":" : $_lang['change_password_new'] . ":"; ?></th>
254
+						<th><?php echo $modx->manager->action == '11' ? $_lang['password'].":" : $_lang['change_password_new'].":"; ?></th>
255 255
 						<td>&nbsp;</td>
256 256
 						<td><input name="newpasswordcheck" type="checkbox" onClick="changestate(document.userform.newpassword);changePasswordState(document.userform.newpassword);"<?php echo $modx->manager->action == "11" ? " checked disabled" : ""; ?>>
257 257
 							<input type="hidden" name="newpassword" value="<?php echo $modx->manager->action == "11" ? 1 : 0; ?>" onChange="documentDirty=true;" />
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
 							?>
306 306
 							<select name="role" class="inputBox" onChange='documentDirty=true;' style="width:300px">
307 307
 								<?php
308
-								while($row = $modx->db->getRow($rs)) {
309
-									if($modx->manager->action == '11') {
308
+								while ($row = $modx->db->getRow($rs)) {
309
+									if ($modx->manager->action == '11') {
310 310
 										$selectedtext = $row['id'] == '1' ? ' selected="selected"' : '';
311 311
 									} else {
312 312
 										$selectedtext = $row['id'] == $userdata['role'] ? "selected='selected'" : '';
@@ -360,8 +360,8 @@  discard block
 block discarded – undo
360 360
 								<?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?>
361 361
 								<option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> >&nbsp;</option>
362 362
 								<?php
363
-								foreach($_country_lang as $key => $country) {
364
-									echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>";
363
+								foreach ($_country_lang as $key => $country) {
364
+									echo "<option value=\"$key\"".(isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '').">$country</option>";
365 365
 								}
366 366
 								?>
367 367
 							</select></td>
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 						<td>&nbsp;</td>
388 388
 						<td><textarea type="text" name="comment" class="inputBox" rows="5" onChange="documentDirty=true;"><?php echo $modx->htmlspecialchars($userdata['comment']); ?></textarea></td>
389 389
 					</tr>
390
-					<?php if($modx->manager->action == '12') { ?>
390
+					<?php if ($modx->manager->action == '12') { ?>
391 391
 						<tr>
392 392
 							<th><?php echo $_lang['user_logincount']; ?>:</th>
393 393
 							<td>&nbsp;</td>
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 						</tr>
425 425
 					<?php } ?>
426 426
 				</table>
427
-				<?php if($_GET['id'] == $modx->getLoginUserID()) { ?>
427
+				<?php if ($_GET['id'] == $modx->getLoginUserID()) { ?>
428 428
 					<p><?php echo $_lang['user_edit_self_msg']; ?></p>
429 429
 				<?php } ?>
430 430
 			</div>
@@ -441,8 +441,8 @@  discard block
 block discarded – undo
441 441
 								<?php
442 442
 								$activelang = !empty($usersettings['manager_language']) ? $usersettings['manager_language'] : '';
443 443
 								$dir = dir("includes/lang");
444
-								while($file = $dir->read()) {
445
-									if(strpos($file, ".inc.php") > 0) {
444
+								while ($file = $dir->read()) {
445
+									if (strpos($file, ".inc.php") > 0) {
446 446
 										$endpos = strpos($file, ".");
447 447
 										$languagename = substr($file, 0, $endpos);
448 448
 										$selectedtext = $languagename == $activelang ? "selected='selected'" : "";
@@ -529,17 +529,17 @@  discard block
 block discarded – undo
529 529
 								<option value=""></option>
530 530
 								<?php
531 531
 								$dir = dir("media/style/");
532
-								while($file = $dir->read()) {
533
-									if($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') {
532
+								while ($file = $dir->read()) {
533
+									if ($file != "." && $file != ".." && is_dir("media/style/$file") && substr($file, 0, 1) != '.') {
534 534
 										$themename = $file;
535
-										if($themename === 'common') {
535
+										if ($themename === 'common') {
536 536
 											continue;
537 537
 										}
538
-										$attr = 'value="' . $themename . '" ';
539
-										if(isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) {
538
+										$attr = 'value="'.$themename.'" ';
539
+										if (isset($usersettings['manager_theme']) && $themename == $usersettings['manager_theme']) {
540 540
 											$attr .= 'selected="selected" ';
541 541
 										}
542
-										echo "\t\t<option " . rtrim($attr) . '>' . ucwords(str_replace("_", " ", $themename)) . "</option>\n";
542
+										echo "\t\t<option ".rtrim($attr).'>'.ucwords(str_replace("_", " ", $themename))."</option>\n";
543 543
 									}
544 544
 								}
545 545
 								$dir->close();
@@ -580,12 +580,12 @@  discard block
 block discarded – undo
580 580
 						<td><select name="which_browser" class="inputBox" onChange="documentDirty=true;">
581 581
 								<?php
582 582
 								$selected = 'default' == $usersettings['which_browser'] || !$usersettings['which_browser'] ? ' selected="selected"' : '';
583
-								echo '<option value="default"' . $selected . '>' . $_lang['option_default'] . "</option>\n";
584
-								foreach(glob("media/browser/*", GLOB_ONLYDIR) as $dir) {
583
+								echo '<option value="default"'.$selected.'>'.$_lang['option_default']."</option>\n";
584
+								foreach (glob("media/browser/*", GLOB_ONLYDIR) as $dir) {
585 585
 									$dir = str_replace('\\', '/', $dir);
586 586
 									$browser_name = substr($dir, strrpos($dir, '/') + 1);
587 587
 									$selected = $browser_name == $usersettings['which_browser'] ? ' selected="selected"' : '';
588
-									echo '<option value="' . $browser_name . '"' . $selected . '>' . "{$browser_name}</option>\n";
588
+									echo '<option value="'.$browser_name.'"'.$selected.'>'."{$browser_name}</option>\n";
589 589
 								}
590 590
 								?>
591 591
 							</select></td>
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 					</tr>
613 613
 					<tr>
614 614
 						<td>&nbsp;</td>
615
-						<td class='comment'><?php echo $_lang["uploadable_images_message"] . $_lang["user_upload_message"] ?></td>
615
+						<td class='comment'><?php echo $_lang["uploadable_images_message"].$_lang["user_upload_message"] ?></td>
616 616
 					</tr>
617 617
 					<tr>
618 618
 						<th><?php echo $_lang["uploadable_media_title"] ?></th>
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 					</tr>
625 625
 					<tr>
626 626
 						<td>&nbsp;</td>
627
-						<td class='comment'><?php echo $_lang["uploadable_media_message"] . $_lang["user_upload_message"] ?></td>
627
+						<td class='comment'><?php echo $_lang["uploadable_media_message"].$_lang["user_upload_message"] ?></td>
628 628
 					</tr>
629 629
 					<tr>
630 630
 						<th><?php echo $_lang["uploadable_flash_title"] ?></th>
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
 					</tr>
637 637
 					<tr>
638 638
 						<td>&nbsp;</td>
639
-						<td class='comment'><?php echo $_lang["uploadable_flash_message"] . $_lang["user_upload_message"] ?></td>
639
+						<td class='comment'><?php echo $_lang["uploadable_flash_message"].$_lang["user_upload_message"] ?></td>
640 640
 					</tr>
641 641
 					<tr>
642 642
 						<th><?php echo $_lang["uploadable_files_title"] ?></th>
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 					</tr>
649 649
 					<tr>
650 650
 						<td>&nbsp;</td>
651
-						<td class='comment'><?php echo $_lang["uploadable_files_message"] . $_lang["user_upload_message"] ?></td>
651
+						<td class='comment'><?php echo $_lang["uploadable_files_message"].$_lang["user_upload_message"] ?></td>
652 652
 					</tr>
653 653
 					<tr class='row2'>
654 654
 						<th><?php echo $_lang["upload_maxsize_title"] ?></th>
@@ -667,11 +667,11 @@  discard block
 block discarded – undo
667 667
 								$edt = isset ($usersettings["which_editor"]) ? $usersettings["which_editor"] : '';
668 668
 								// invoke OnRichTextEditorRegister event
669 669
 								$evtOut = $modx->invokeEvent("OnRichTextEditorRegister");
670
-								echo "<option value='none'" . ($edt == 'none' ? " selected='selected'" : "") . ">" . $_lang["none"] . "</option>\n";
671
-								if(is_array($evtOut)) {
672
-									for($i = 0; $i < count($evtOut); $i++) {
670
+								echo "<option value='none'".($edt == 'none' ? " selected='selected'" : "").">".$_lang["none"]."</option>\n";
671
+								if (is_array($evtOut)) {
672
+									for ($i = 0; $i < count($evtOut); $i++) {
673 673
 										$editor = $evtOut[$i];
674
-										echo "<option value='$editor'" . ($edt == $editor ? " selected='selected'" : "") . ">$editor</option>\n";
674
+										echo "<option value='$editor'".($edt == $editor ? " selected='selected'" : "").">$editor</option>\n";
675 675
 									}
676 676
 								}
677 677
 								?>
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 				<?php
710 710
 				// invoke OnInterfaceSettingsRender event
711 711
 				$evtOut = $modx->invokeEvent("OnInterfaceSettingsRender");
712
-				if(is_array($evtOut)) {
712
+				if (is_array($evtOut)) {
713 713
 					echo implode("", $evtOut);
714 714
 				}
715 715
 				?>
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
 					function BrowseServer() {
737 737
 						var w = screen.width * 0.7;
738 738
 						var h = screen.height * 0.7;
739
-						OpenServerBrowser("<?php echo MODX_MANAGER_URL; ?>media/browser/<?php echo $which_browser;?>/browser.php?Type=images", w, h);
739
+						OpenServerBrowser("<?php echo MODX_MANAGER_URL; ?>media/browser/<?php echo $which_browser; ?>/browser.php?Type=images", w, h);
740 740
 					}
741 741
 
742 742
 					function SetUrl(url, width, height, alt) {
@@ -759,17 +759,17 @@  discard block
 block discarded – undo
759 759
 					</tr>
760 760
 				</table>
761 761
 			</div>
762
-			<?php if($use_udperms == 1) {
762
+			<?php if ($use_udperms == 1) {
763 763
 
764 764
 			$groupsarray = array();
765 765
 
766
-			if($modx->manager->action == '12') { // only do this bit if the user is being edited
766
+			if ($modx->manager->action == '12') { // only do this bit if the user is being edited
767 767
 				$rs = $modx->db->select('user_group', $modx->getFullTableName('member_groups'), "member='{$user}'");
768 768
 				$groupsarray = $modx->db->getColumn('user_group', $rs);
769 769
 			}
770 770
 			// retain selected doc groups between post
771
-			if(is_array($_POST['user_groups'])) {
772
-				foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
771
+			if (is_array($_POST['user_groups'])) {
772
+				foreach ($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
773 773
 			}
774 774
 			?>
775 775
 			<div class="tab-page" id="tabAccess">
@@ -778,8 +778,8 @@  discard block
 block discarded – undo
778 778
 				<p><?php echo $_lang['access_permissions_user_message'] ?></p>
779 779
 				<?php
780 780
 				$rs = $modx->db->select('name, id', $modx->getFullTableName('membergroup_names'), '', 'name');
781
-				while($row = $modx->db->getRow($rs)) {
782
-					echo "<label><input type='checkbox' name='user_groups[]' value='" . $row['id'] . "'" . (in_array($row['id'], $groupsarray) ? " checked='checked'" : "") . " />" . $row['name'] . "</label><br />";
781
+				while ($row = $modx->db->getRow($rs)) {
782
+					echo "<label><input type='checkbox' name='user_groups[]' value='".$row['id']."'".(in_array($row['id'], $groupsarray) ? " checked='checked'" : "")." />".$row['name']."</label><br />";
783 783
 				}
784 784
 				}
785 785
 				?>
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
 	$evtOut = $modx->invokeEvent("OnUserFormRender", array(
793 793
 		"id" => $user
794 794
 	));
795
-	if(is_array($evtOut)) {
795
+	if (is_array($evtOut)) {
796 796
 		echo implode("", $evtOut);
797 797
 	}
798 798
 	?>
Please login to merge, or discard this patch.
manager/includes/header.inc.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -20,28 +20,28 @@  discard block
 block discarded – undo
20 20
 $body_class = '';
21 21
 $theme_modes = array('', 'lightness', 'light', 'dark', 'darkness');
22 22
 if (!empty($theme_modes[$_COOKIE['MODX_themeMode']])) {
23
-    $body_class .= ' ' . $theme_modes[$_COOKIE['MODX_themeMode']];
23
+    $body_class .= ' '.$theme_modes[$_COOKIE['MODX_themeMode']];
24 24
 } elseif (!empty($theme_modes[$modx->config['manager_theme_mode']])) {
25
-    $body_class .= ' ' . $theme_modes[$modx->config['manager_theme_mode']];
25
+    $body_class .= ' '.$theme_modes[$modx->config['manager_theme_mode']];
26 26
 }
27 27
 
28
-$css = 'media/style/' . $modx->config['manager_theme'] . '/style.css?v=' . $lastInstallTime;
28
+$css = 'media/style/'.$modx->config['manager_theme'].'/style.css?v='.$lastInstallTime;
29 29
 
30 30
 if ($modx->config['manager_theme'] == 'default') {
31
-    if (!file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')
32
-        && is_writable(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css')) {
31
+    if (!file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css')
32
+        && is_writable(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css')) {
33 33
         $files = array(
34
-            'bootstrap' => MODX_MANAGER_PATH . 'media/style/common/bootstrap/css/bootstrap.min.css',
35
-            'font-awesome' => MODX_MANAGER_PATH . 'media/style/common/font-awesome/css/font-awesome.min.css',
36
-            'fonts' => MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/fonts.css',
37
-            'forms' => MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/forms.css',
38
-            'mainmenu' => MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/mainmenu.css',
39
-            'tree' => MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/tree.css',
40
-            'custom' => MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/custom.css',
41
-            'tabpane' => MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/tabpane.css',
42
-            'contextmenu' => MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/contextmenu.css',
43
-            'index' => MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/index.css',
44
-            'main' => MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/main.css'
34
+            'bootstrap' => MODX_MANAGER_PATH.'media/style/common/bootstrap/css/bootstrap.min.css',
35
+            'font-awesome' => MODX_MANAGER_PATH.'media/style/common/font-awesome/css/font-awesome.min.css',
36
+            'fonts' => MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/fonts.css',
37
+            'forms' => MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/forms.css',
38
+            'mainmenu' => MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/mainmenu.css',
39
+            'tree' => MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/tree.css',
40
+            'custom' => MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/custom.css',
41
+            'tabpane' => MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/tabpane.css',
42
+            'contextmenu' => MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/contextmenu.css',
43
+            'index' => MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/index.css',
44
+            'main' => MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/main.css'
45 45
         );
46 46
         $evtOut = $modx->invokeEvent('OnBeforeMinifyCss', array(
47 47
             'files' => $files,
@@ -58,16 +58,16 @@  discard block
 block discarded – undo
58 58
             default:
59 59
                 $modx->webAlertAndQuit(sprintf($_lang['invalid_event_response'], 'OnBeforeMinifyManagerCss'));
60 60
         }
61
-        require_once MODX_BASE_PATH . 'assets/lib/Formatter/CSSMinify.php';
61
+        require_once MODX_BASE_PATH.'assets/lib/Formatter/CSSMinify.php';
62 62
         $minifier = new Formatter\CSSMinify($files);
63 63
         $css = $minifier->minify();
64 64
         file_put_contents(
65
-            MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css',
65
+            MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css',
66 66
             $css
67 67
         );
68 68
     }
69
-    if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) {
70
-        $css = 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css?v=' . $lastInstallTime;
69
+    if (file_exists(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css')) {
70
+        $css = 'media/style/'.$modx->config['manager_theme'].'/css/styles.min.css?v='.$lastInstallTime;
71 71
     }
72 72
 }
73 73
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
83 83
     <link rel="stylesheet" type="text/css" href="<?= $css ?>"/>
84 84
     <script type="text/javascript" src="media/script/tabpane.js"></script>
85
-    <?= sprintf('<script type="text/javascript" src="%s"></script>' . "\n", $modx->config['mgr_jquery_path']) ?>
85
+    <?= sprintf('<script type="text/javascript" src="%s"></script>'."\n", $modx->config['mgr_jquery_path']) ?>
86 86
     <?php if ($modx->config['show_picker'] != "0") { ?>
87 87
         <script src="media/style/<?= $modx->config['manager_theme'] ?>/js/color.switcher.js"
88 88
                 type="text/javascript"></script>
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     <?php } ?>
96 96
 
97 97
     <!-- OnManagerMainFrameHeaderHTMLBlock -->
98
-    <?= $onManagerMainFrameHeaderHTMLBlock . "\n" ?>
98
+    <?= $onManagerMainFrameHeaderHTMLBlock."\n" ?>
99 99
 
100 100
     <script type="text/javascript">
101 101
       if (!evo) {
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     <script>
126 126
         <?php
127 127
         if (isset($_REQUEST['r']) && preg_match('@^[0-9]+$@', $_REQUEST['r'])) {
128
-            echo 'doRefresh(' . $_REQUEST['r'] . ");\n";
128
+            echo 'doRefresh('.$_REQUEST['r'].");\n";
129 129
         }
130 130
         ?>
131 131
     </script>
Please login to merge, or discard this patch.
manager/includes/document.parser.class.inc.php 1 patch
Spacing   +269 added lines, -269 removed lines patch added patch discarded remove patch
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
      */
226 226
     function __call($method_name, $arguments)
227 227
     {
228
-        include_once(MODX_MANAGER_PATH . 'includes/extenders/deprecated.functions.inc.php');
228
+        include_once(MODX_MANAGER_PATH.'includes/extenders/deprecated.functions.inc.php');
229 229
         if (method_exists($this->old, $method_name)) {
230 230
             $error_type = 1;
231 231
         } else {
@@ -243,12 +243,12 @@  discard block
 block discarded – undo
243 243
             $info = debug_backtrace();
244 244
             $m[] = $msg;
245 245
             if (!empty($this->currentSnippet)) {
246
-                $m[] = 'Snippet - ' . $this->currentSnippet;
246
+                $m[] = 'Snippet - '.$this->currentSnippet;
247 247
             } elseif (!empty($this->event->activePlugin)) {
248
-                $m[] = 'Plugin - ' . $this->event->activePlugin;
248
+                $m[] = 'Plugin - '.$this->event->activePlugin;
249 249
             }
250 250
             $m[] = $this->decoded_request_uri;
251
-            $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')';
251
+            $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')';
252 252
             $msg = implode('<br />', $m);
253 253
             $this->logEvent(0, $error_type, $msg, $title);
254 254
         }
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
     {
266 266
         $flag = false;
267 267
         if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof DBAPI) {
268
-            $flag = (bool)$this->{$connector}->conn;
268
+            $flag = (bool) $this->{$connector}->conn;
269 269
         }
270 270
         return $flag;
271 271
     }
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
         }
293 293
         if (!$out && $flag) {
294 294
             $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname)));
295
-            $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php";
295
+            $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php";
296 296
             $out = is_file($filename) ? include $filename : false;
297 297
         }
298 298
         if ($out && !in_array($extname, $this->extensions)) {
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
     public function getMicroTime()
310 310
     {
311 311
         list ($usec, $sec) = explode(' ', microtime());
312
-        return ((float)$usec + (float)$sec);
312
+        return ((float) $usec + (float) $sec);
313 313
     }
314 314
 
315 315
     /**
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
             // append the redirect count string to the url
334 334
             $currentNumberOfRedirects = isset ($_REQUEST['err']) ? $_REQUEST['err'] : 0;
335 335
             if ($currentNumberOfRedirects > 3) {
336
-                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>');
336
+                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>');
337 337
             } else {
338 338
                 $currentNumberOfRedirects += 1;
339 339
                 if (strpos($url, "?") > 0) {
@@ -344,9 +344,9 @@  discard block
 block discarded – undo
344 344
             }
345 345
         }
346 346
         if ($type == 'REDIRECT_REFRESH') {
347
-            $header = 'Refresh: 0;URL=' . $url;
347
+            $header = 'Refresh: 0;URL='.$url;
348 348
         } elseif ($type == 'REDIRECT_META') {
349
-            $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />';
349
+            $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />';
350 350
             echo $header;
351 351
             exit;
352 352
         } elseif ($type == 'REDIRECT_HEADER' || empty ($type)) {
@@ -354,10 +354,10 @@  discard block
 block discarded – undo
354 354
             global $base_url, $site_url;
355 355
             if (substr($url, 0, strlen($base_url)) == $base_url) {
356 356
                 // append $site_url to make it work with Location:
357
-                $url = $site_url . substr($url, strlen($base_url));
357
+                $url = $site_url.substr($url, strlen($base_url));
358 358
             }
359 359
             if (strpos($url, "\n") === false) {
360
-                $header = 'Location: ' . $url;
360
+                $header = 'Location: '.$url;
361 361
             } else {
362 362
                 $this->messageQuit('No newline allowed in redirect url.');
363 363
             }
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
             header($responseCode);
367 367
         }
368 368
 
369
-        if(!empty($header)) {
369
+        if (!empty($header)) {
370 370
             header($header);
371 371
         }
372 372
 
@@ -471,8 +471,8 @@  discard block
 block discarded – undo
471 471
 
472 472
     private function recoverySiteCache()
473 473
     {
474
-        $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder();
475
-        $site_cache_path = $site_cache_dir . 'siteCache.idx.php';
474
+        $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder();
475
+        $site_cache_path = $site_cache_dir.'siteCache.idx.php';
476 476
 
477 477
         if (is_file($site_cache_path)) {
478 478
             include($site_cache_path);
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
             return;
482 482
         }
483 483
 
484
-        include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php');
484
+        include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php');
485 485
         $cache = new synccache();
486 486
         $cache->setCachepath($site_cache_dir);
487 487
         $cache->setReport(false);
@@ -533,8 +533,8 @@  discard block
 block discarded – undo
533 533
                 $this->invokeEvent("OnBeforeManagerPageInit");
534 534
             }
535 535
 
536
-            if (isset ($_SESSION[$usrType . 'UsrConfigSet'])) {
537
-                $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet'];
536
+            if (isset ($_SESSION[$usrType.'UsrConfigSet'])) {
537
+                $usrSettings = &$_SESSION[$usrType.'UsrConfigSet'];
538 538
             } else {
539 539
                 if ($usrType == 'web') {
540 540
                     $from = $tbl_web_user_settings;
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
                     $usrSettings[$row['setting_name']] = $row['setting_value'];
555 555
                 }
556 556
                 if (isset ($usrType)) {
557
-                    $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings;
557
+                    $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings;
558 558
                 } // store user settings in session
559 559
             }
560 560
         }
@@ -699,10 +699,10 @@  discard block
 block discarded – undo
699 699
         $suf = $this->config['friendly_url_suffix'];
700 700
         $pre = preg_quote($pre, '/');
701 701
         $suf = preg_quote($suf, '/');
702
-        if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) {
702
+        if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) {
703 703
             $q = $_[1];
704 704
         }
705
-        if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) {
705
+        if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) {
706 706
             $q = $_[1];
707 707
         }
708 708
 
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
         if (preg_match('@^[1-9][0-9]*$@', $q) && !isset($this->documentListing[$q])) { /* we got an ID returned, check to make sure it's not an alias */
725 725
             /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */
726 726
             if ($this->config['use_alias_path'] == 1) {
727
-                if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir . '/' . $q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) {
727
+                if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir.'/'.$q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q, $this->getChildIds($this->documentListing[$this->virtualDir], 1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) {
728 728
                     $this->documentMethod = 'id';
729 729
                     return $q;
730 730
                 } else { /* not a valid id in terms of virtualDir, treat as alias */
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
      */
759 759
     public function getHashFile($key)
760 760
     {
761
-        return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php";
761
+        return $this->getCacheFolder()."docid_".$key.".pageCache.php";
762 762
     }
763 763
 
764 764
     /**
@@ -769,9 +769,9 @@  discard block
 block discarded – undo
769 769
         $hash = $id;
770 770
         $tmp = null;
771 771
         $params = array();
772
-        if(!empty($this->systemCacheKey)){
772
+        if (!empty($this->systemCacheKey)) {
773 773
             $hash = $this->systemCacheKey;
774
-        }else {
774
+        } else {
775 775
             if (!empty($_GET)) {
776 776
                 // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID.
777 777
                 $params = $_GET;
@@ -779,8 +779,8 @@  discard block
 block discarded – undo
779 779
                 $hash .= '_'.md5(http_build_query($params));
780 780
             }
781 781
         }
782
-        $evtOut = $this->invokeEvent("OnMakePageCacheKey", array ("hash" => $hash, "id" => $id, 'params' => $params));
783
-        if (is_array($evtOut) && count($evtOut) > 0){
782
+        $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params));
783
+        if (is_array($evtOut) && count($evtOut) > 0) {
784 784
             $tmp = array_pop($evtOut);
785 785
         }
786 786
         return empty($tmp) ? $hash : $tmp;
@@ -922,12 +922,12 @@  discard block
 block discarded – undo
922 922
         if ($js = $this->getRegisteredClientStartupScripts()) {
923 923
             // change to just before closing </head>
924 924
             // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent);
925
-            $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput);
925
+            $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput);
926 926
         }
927 927
 
928 928
         // Insert jscripts & html block into template - template must have a </body> tag
929 929
         if ($js = $this->getRegisteredClientScripts()) {
930
-            $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput);
930
+            $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput);
931 931
         }
932 932
         // End fix by sirlancelot
933 933
 
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
         // send out content-type and content-disposition headers
939 939
         if (IN_PARSER_MODE == "true") {
940 940
             $type = !empty ($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html";
941
-            header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']);
941
+            header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']);
942 942
             //            if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error)
943 943
             //                header('HTTP/1.0 404 Not Found');
944 944
             if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) {
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
                     $name = preg_replace('|-+|', '-', $name);
957 957
                     $name = trim($name, '-');
958 958
                 }
959
-                $header = 'Content-Disposition: attachment; filename=' . $name;
959
+                $header = 'Content-Disposition: attachment; filename='.$name;
960 960
                 header($header);
961 961
             }
962 962
         }
@@ -964,7 +964,7 @@  discard block
 block discarded – undo
964 964
 
965 965
         $stats = $this->getTimerStats($this->tstart);
966 966
 
967
-        $out =& $this->documentOutput;
967
+        $out = & $this->documentOutput;
968 968
         $out = str_replace("[^q^]", $stats['queries'], $out);
969 969
         $out = str_replace("[^qt^]", $stats['queryTime'], $out);
970 970
         $out = str_replace("[^p^]", $stats['phpTime'], $out);
@@ -1003,17 +1003,17 @@  discard block
 block discarded – undo
1003 1003
                 $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet
1004 1004
                 $tt += $t;
1005 1005
             }
1006
-            echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms", $tt) . ")</legend>{$sc}</fieldset><br />";
1006
+            echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms", $tt).")</legend>{$sc}</fieldset><br />";
1007 1007
             echo $this->snippetsCode;
1008 1008
         }
1009 1009
         if ($this->dumpPlugins) {
1010 1010
             $ps = "";
1011 1011
             $tt = 0;
1012 1012
             foreach ($this->pluginsTime as $s => $t) {
1013
-                $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>";
1013
+                $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>";
1014 1014
                 $tt += $t;
1015 1015
             }
1016
-            echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms", $tt * 1000) . ")</legend>{$ps}</fieldset><br />";
1016
+            echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms", $tt * 1000).")</legend>{$ps}</fieldset><br />";
1017 1017
             echo $this->pluginsCode;
1018 1018
         }
1019 1019
 
@@ -1039,7 +1039,7 @@  discard block
 block discarded – undo
1039 1039
         $srcTags = explode(',', $tags);
1040 1040
         $repTags = array();
1041 1041
         foreach ($srcTags as $tag) {
1042
-            $repTags[] = '\\' . $tag[0] . '\\' . $tag[1];
1042
+            $repTags[] = '\\'.$tag[0].'\\'.$tag[1];
1043 1043
         }
1044 1044
         return array($srcTags, $repTags);
1045 1045
     }
@@ -1061,7 +1061,7 @@  discard block
 block discarded – undo
1061 1061
         $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']);
1062 1062
         $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache";
1063 1063
         $stats['queries'] = isset ($this->executedQueries) ? $this->executedQueries : 0;
1064
-        $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb";
1064
+        $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb";
1065 1065
 
1066 1066
         return $stats;
1067 1067
     }
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
     {
1095 1095
         $cacheRefreshTime = 0;
1096 1096
         $recent_update = 0;
1097
-        @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php');
1097
+        @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php');
1098 1098
         $this->recentUpdate = $recent_update;
1099 1099
 
1100 1100
         $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time'];
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
         // now, check for documents that need publishing
1106 1106
         $field = array('published' => 1, 'publishedon' => $timeNow);
1107 1107
         $where = "pub_date <= {$timeNow} AND pub_date!=0 AND published=0";
1108
-        $result_pub = $this->db->select( 'id', '[+prefix+]site_content',  $where);
1108
+        $result_pub = $this->db->select('id', '[+prefix+]site_content', $where);
1109 1109
         $this->db->update($field, '[+prefix+]site_content', $where);
1110 1110
         if ($this->db->getRecordCount($result_pub) >= 1) { //Event unPublished doc
1111 1111
             while ($row_pub = $this->db->getRow($result_pub)) {
@@ -1118,7 +1118,7 @@  discard block
 block discarded – undo
1118 1118
         // now, check for documents that need un-publishing
1119 1119
         $field = array('published' => 0, 'publishedon' => 0);
1120 1120
         $where = "unpub_date <= {$timeNow} AND unpub_date!=0 AND published=1";
1121
-        $result_unpub = $this->db->select( 'id', '[+prefix+]site_content',  $where);
1121
+        $result_unpub = $this->db->select('id', '[+prefix+]site_content', $where);
1122 1122
         $this->db->update($field, '[+prefix+]site_content', $where);
1123 1123
         if ($this->db->getRecordCount($result_unpub) >= 1) { //Event unPublished doc
1124 1124
             while ($row_unpub = $this->db->getRow($result_unpub)) {
@@ -1164,8 +1164,8 @@  discard block
 block discarded – undo
1164 1164
                 }
1165 1165
 
1166 1166
                 $docObjSerial = serialize($this->documentObject);
1167
-                $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent;
1168
-                $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey);
1167
+                $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent;
1168
+                $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey);
1169 1169
                 file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent");
1170 1170
             }
1171 1171
         }
@@ -1207,16 +1207,16 @@  discard block
 block discarded – undo
1207 1207
             return array();
1208 1208
         }
1209 1209
         $spacer = md5('<<<EVO>>>');
1210
-        if($left==='{{' && strpos($content,';}}')!==false)  $content = str_replace(';}}', sprintf(';}%s}',   $spacer),$content);
1211
-        if($left==='{{' && strpos($content,'{{}}')!==false) $content = str_replace('{{}}',sprintf('{%$1s{}%$1s}',$spacer),$content);
1212
-        if($left==='[[' && strpos($content,']]]]')!==false) $content = str_replace(']]]]',sprintf(']]%s]]',  $spacer),$content);
1213
-        if($left==='[[' && strpos($content,']]]')!==false)  $content = str_replace(']]]', sprintf(']%s]]',   $spacer),$content);
1210
+        if ($left === '{{' && strpos($content, ';}}') !== false)  $content = str_replace(';}}', sprintf(';}%s}', $spacer), $content);
1211
+        if ($left === '{{' && strpos($content, '{{}}') !== false) $content = str_replace('{{}}', sprintf('{%$1s{}%$1s}', $spacer), $content);
1212
+        if ($left === '[[' && strpos($content, ']]]]') !== false) $content = str_replace(']]]]', sprintf(']]%s]]', $spacer), $content);
1213
+        if ($left === '[[' && strpos($content, ']]]') !== false)  $content = str_replace(']]]', sprintf(']%s]]', $spacer), $content);
1214 1214
 
1215 1215
         $pos['<![CDATA['] = strpos($content, '<![CDATA[');
1216 1216
         $pos[']]>'] = strpos($content, ']]>');
1217 1217
 
1218 1218
         if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) {
1219
-            $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3);
1219
+            $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3);
1220 1220
         }
1221 1221
 
1222 1222
         $lp = explode($left, $content);
@@ -1280,8 +1280,8 @@  discard block
 block discarded – undo
1280 1280
                 }
1281 1281
             }
1282 1282
         }
1283
-        foreach($tags as $i=>$tag) {
1284
-            if(strpos($tag,$spacer)!==false) $tags[$i] = str_replace($spacer, '', $tag);
1283
+        foreach ($tags as $i=>$tag) {
1284
+            if (strpos($tag, $spacer) !== false) $tags[$i] = str_replace($spacer, '', $tag);
1285 1285
         }
1286 1286
         return $tags;
1287 1287
     }
@@ -1321,7 +1321,7 @@  discard block
 block discarded – undo
1321 1321
         }
1322 1322
 
1323 1323
         foreach ($matches[1] as $i => $key) {
1324
-            if(strpos($key,'[+')!==false) continue; // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1324
+            if (strpos($key, '[+') !== false) continue; // Allow chunk {{chunk?&param=`xxx`}} with [*tv_name_[+param+]*] as content
1325 1325
             if (substr($key, 0, 1) == '#') {
1326 1326
                 $key = substr($key, 1);
1327 1327
             } // remove # for QuickEdit format
@@ -1341,8 +1341,8 @@  discard block
 block discarded – undo
1341 1341
             }
1342 1342
 
1343 1343
             if (is_array($value)) {
1344
-                include_once(MODX_MANAGER_PATH . 'includes/tmplvars.format.inc.php');
1345
-                include_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php');
1344
+                include_once(MODX_MANAGER_PATH.'includes/tmplvars.format.inc.php');
1345
+                include_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php');
1346 1346
                 $value = getTVDisplayFormat($value[0], $value[1], $value[2], $value[3], $value[4]);
1347 1347
             }
1348 1348
 
@@ -1353,8 +1353,8 @@  discard block
 block discarded – undo
1353 1353
 
1354 1354
             if (strpos($content, $s) !== false) {
1355 1355
                 $content = str_replace($s, $value, $content);
1356
-            } elseif($this->debug) {
1357
-                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1356
+            } elseif ($this->debug) {
1357
+                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1358 1358
             }
1359 1359
         }
1360 1360
 
@@ -1521,8 +1521,8 @@  discard block
 block discarded – undo
1521 1521
             $s = &$matches[0][$i];
1522 1522
             if (strpos($content, $s) !== false) {
1523 1523
                 $content = str_replace($s, $value, $content);
1524
-            } elseif($this->debug) {
1525
-                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1524
+            } elseif ($this->debug) {
1525
+                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1526 1526
             }
1527 1527
         }
1528 1528
         return $content;
@@ -1575,7 +1575,7 @@  discard block
 block discarded – undo
1575 1575
             }
1576 1576
 
1577 1577
             $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags
1578
-            $value = $this->mergePlaceholderContent($value, $params);  // parse page global placeholers
1578
+            $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers
1579 1579
             if ($this->config['enable_at_syntax']) {
1580 1580
                 $value = $this->mergeConditionalTagsContent($value);
1581 1581
             }
@@ -1590,8 +1590,8 @@  discard block
 block discarded – undo
1590 1590
             $s = &$matches[0][$i];
1591 1591
             if (strpos($content, $s) !== false) {
1592 1592
                 $content = str_replace($s, $value, $content);
1593
-            } elseif($this->debug) {
1594
-                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1593
+            } elseif ($this->debug) {
1594
+                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1595 1595
             }
1596 1596
         }
1597 1597
         return $content;
@@ -1649,8 +1649,8 @@  discard block
 block discarded – undo
1649 1649
             $s = &$matches[0][$i];
1650 1650
             if (strpos($content, $s) !== false) {
1651 1651
                 $content = str_replace($s, $value, $content);
1652
-            } elseif($this->debug) {
1653
-                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1652
+            } elseif ($this->debug) {
1653
+                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1654 1654
             }
1655 1655
         }
1656 1656
         return $content;
@@ -1674,7 +1674,7 @@  discard block
 block discarded – undo
1674 1674
             return $content;
1675 1675
         }
1676 1676
 
1677
-        $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#';
1677
+        $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#';
1678 1678
         $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), $content);
1679 1679
 
1680 1680
         $pieces = explode('<@IF:', $content);
@@ -1685,7 +1685,7 @@  discard block
 block discarded – undo
1685 1685
             }
1686 1686
             list($cmd, $text) = explode('>', $split, 2);
1687 1687
             $cmd = str_replace("'", "\'", $cmd);
1688
-            $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>";
1688
+            $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>";
1689 1689
             $content .= $text;
1690 1690
         }
1691 1691
         $pieces = explode('<@ELSEIF:', $content);
@@ -1696,13 +1696,13 @@  discard block
 block discarded – undo
1696 1696
             }
1697 1697
             list($cmd, $text) = explode('>', $split, 2);
1698 1698
             $cmd = str_replace("'", "\'", $cmd);
1699
-            $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>";
1699
+            $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>";
1700 1700
             $content .= $text;
1701 1701
         }
1702 1702
 
1703 1703
         $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content);
1704 1704
         ob_start();
1705
-        $content = eval('?>' . $content);
1705
+        $content = eval('?>'.$content);
1706 1706
         $content = ob_get_clean();
1707 1707
         $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'), $content);
1708 1708
 
@@ -1827,7 +1827,7 @@  discard block
 block discarded – undo
1827 1827
         $matches = $this->getTagsFromContent($content, $left, $right);
1828 1828
         if (!empty($matches)) {
1829 1829
             foreach ($matches[0] as $i => $v) {
1830
-                $addBreakMatches[$i] = $v . "\n";
1830
+                $addBreakMatches[$i] = $v."\n";
1831 1831
             }
1832 1832
             $content = str_replace($addBreakMatches, '', $content);
1833 1833
             if (strpos($content, $left) !== false) {
@@ -1860,8 +1860,8 @@  discard block
 block discarded – undo
1860 1860
             $s = &$matches[0][$i];
1861 1861
             if (strpos($content, $s) !== false) {
1862 1862
                 $content = str_replace($s, $v, $content);
1863
-            } elseif($this->debug) {
1864
-                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1863
+            } elseif ($this->debug) {
1864
+                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1865 1865
             }
1866 1866
         }
1867 1867
         return $content;
@@ -1925,7 +1925,7 @@  discard block
 block discarded – undo
1925 1925
                 $msg = ($msg === false) ? 'ob_get_contents() error' : $msg;
1926 1926
                 $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin', $error_info['message'], $error_info['line'], $msg);
1927 1927
                 if ($this->isBackend()) {
1928
-                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>');
1928
+                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>');
1929 1929
                 }
1930 1930
             }
1931 1931
         } else {
@@ -1971,7 +1971,7 @@  discard block
 block discarded – undo
1971 1971
                 $echo = ($echo === false) ? 'ob_get_contents() error' : $echo;
1972 1972
                 $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet', $error_info['message'], $error_info['line'], $echo);
1973 1973
                 if ($this->isBackend()) {
1974
-                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>');
1974
+                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>');
1975 1975
                 }
1976 1976
             }
1977 1977
         }
@@ -1979,7 +1979,7 @@  discard block
 block discarded – undo
1979 1979
         if (is_array($return) || is_object($return)) {
1980 1980
             return $return;
1981 1981
         } else {
1982
-            return $echo . $return;
1982
+            return $echo.$return;
1983 1983
         }
1984 1984
     }
1985 1985
 
@@ -2017,8 +2017,8 @@  discard block
 block discarded – undo
2017 2017
                 }
2018 2018
                 if (strpos($content, $s) !== false) {
2019 2019
                     $content = str_replace($s, $value, $content);
2020
-                } elseif($this->debug) {
2021
-                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2);
2020
+                } elseif ($this->debug) {
2021
+                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2);
2022 2022
                 }
2023 2023
                 continue;
2024 2024
             }
@@ -2029,8 +2029,8 @@  discard block
 block discarded – undo
2029 2029
 
2030 2030
             if (strpos($content, $s) !== false) {
2031 2031
                 $content = str_replace($s, $value, $content);
2032
-            } elseif($this->debug) {
2033
-                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2);
2032
+            } elseif ($this->debug) {
2033
+                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2);
2034 2034
             }
2035 2035
         }
2036 2036
 
@@ -2121,7 +2121,7 @@  discard block
 block discarded – undo
2121 2121
             $eventtime = sprintf('%2.2f ms', $eventtime * 1000);
2122 2122
             $code = str_replace("\t", '  ', $this->htmlspecialchars($value));
2123 2123
             $piece = str_replace("\t", '  ', $this->htmlspecialchars($piece));
2124
-            $print_r_params = str_replace("\t", '  ', $this->htmlspecialchars('$modx->event->params = ' . print_r($params, true)));
2124
+            $print_r_params = str_replace("\t", '  ', $this->htmlspecialchars('$modx->event->params = '.print_r($params, true)));
2125 2125
             $this->snippetsCode .= sprintf('<fieldset style="margin:1em;"><legend><b>%s</b>(%s)</legend><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">[[%s]]</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre></fieldset>', $snippetObject['name'], $eventtime, $piece, $print_r_params, $code);
2126 2126
             $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime);
2127 2127
         }
@@ -2366,7 +2366,7 @@  discard block
 block discarded – undo
2366 2366
             $rs = $this->db->select('name,snippet,properties', '[+prefix+]site_snippets', $where);
2367 2367
             $count = $this->db->getRecordCount($rs);
2368 2368
             if (1 < $count) {
2369
-                exit('Error $modx->_getSnippetObject()' . $snip_name);
2369
+                exit('Error $modx->_getSnippetObject()'.$snip_name);
2370 2370
             }
2371 2371
             if ($count) {
2372 2372
                 $row = $this->db->getRow($rs);
@@ -2392,7 +2392,7 @@  discard block
 block discarded – undo
2392 2392
     public function toAlias($text)
2393 2393
     {
2394 2394
         $suff = $this->config['friendly_url_suffix'];
2395
-        return str_replace(array('.xml' . $suff, '.rss' . $suff, '.js' . $suff, '.css' . $suff, '.txt' . $suff, '.json' . $suff, '.pdf' . $suff), array('.xml', '.rss', '.js', '.css', '.txt', '.json', '.pdf'), $text);
2395
+        return str_replace(array('.xml'.$suff, '.rss'.$suff, '.js'.$suff, '.css'.$suff, '.txt'.$suff, '.json'.$suff, '.pdf'.$suff), array('.xml', '.rss', '.js', '.css', '.txt', '.json', '.pdf'), $text);
2396 2396
     }
2397 2397
 
2398 2398
     /**
@@ -2424,7 +2424,7 @@  discard block
 block discarded – undo
2424 2424
                 $suff = '/';
2425 2425
             }
2426 2426
 
2427
-            $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff;
2427
+            $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff;
2428 2428
         }
2429 2429
 
2430 2430
         $evtOut = $this->invokeEvent('OnMakeDocUrl', array(
@@ -2461,7 +2461,7 @@  discard block
 block discarded – undo
2461 2461
                 preg_match_all('!\[\~([0-9]+)\~\]!ise', $documentSource, $match);
2462 2462
                 $ids = implode(',', array_unique($match['1']));
2463 2463
                 if ($ids) {
2464
-                    $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'");
2464
+                    $res = $this->db->select("id,alias,isfolder,parent,alias_visible", $this->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'");
2465 2465
                     while ($row = $this->db->getRow($res)) {
2466 2466
                         if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) {
2467 2467
                             $parent = $row['parent'];
@@ -2472,7 +2472,7 @@  discard block
 block discarded – undo
2472 2472
                                 $parent = $this->aliasListing[$parent]['parent'];
2473 2473
                             }
2474 2474
 
2475
-                            $aliases[$row['id']] = $path . '/' . $row['alias'];
2475
+                            $aliases[$row['id']] = $path.'/'.$row['alias'];
2476 2476
                         } else {
2477 2477
                             $aliases[$row['id']] = $row['alias'];
2478 2478
                         }
@@ -2484,7 +2484,7 @@  discard block
 block discarded – undo
2484 2484
             $isfriendly = ($this->config['friendly_alias_urls'] == 1 ? 1 : 0);
2485 2485
             $pref = $this->config['friendly_url_prefix'];
2486 2486
             $suff = $this->config['friendly_url_suffix'];
2487
-            $documentSource = preg_replace_callback($in, function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2487
+            $documentSource = preg_replace_callback($in, function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2488 2488
                 global $modx;
2489 2489
                 $thealias = $aliases[$m[1]];
2490 2490
                 $thefolder = $isfolder[$m[1]];
@@ -2500,7 +2500,7 @@  discard block
 block discarded – undo
2500 2500
 
2501 2501
         } else {
2502 2502
             $in = '!\[\~([0-9]+)\~\]!is';
2503
-            $out = "index.php?id=" . '\1';
2503
+            $out = "index.php?id=".'\1';
2504 2504
             $documentSource = preg_replace($in, $out, $documentSource);
2505 2505
         }
2506 2506
 
@@ -2521,7 +2521,7 @@  discard block
 block discarded – undo
2521 2521
         $scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
2522 2522
         $len_base_url = strlen($this->config['base_url']);
2523 2523
 
2524
-        $url_path = $q;//LANG
2524
+        $url_path = $q; //LANG
2525 2525
 
2526 2526
         if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) {
2527 2527
             $url_path = substr($url_path, $len_base_url);
@@ -2533,7 +2533,7 @@  discard block
 block discarded – undo
2533 2533
             $strictURL = substr($strictURL, $len_base_url);
2534 2534
         }
2535 2535
         $http_host = $_SERVER['HTTP_HOST'];
2536
-        $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG
2536
+        $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG
2537 2537
 
2538 2538
         $site_url = $this->config['site_url'];
2539 2539
         $url_query_string = explode('?', $_SERVER['REQUEST_URI']);
@@ -2551,7 +2551,7 @@  discard block
 block discarded – undo
2551 2551
                 }
2552 2552
                 if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) {
2553 2553
                     if (empty($_POST)) {
2554
-                        if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) {
2554
+                        if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) {
2555 2555
                             $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently');
2556 2556
                             exit(0);
2557 2557
                         }
@@ -2610,7 +2610,7 @@  discard block
 block discarded – undo
2610 2610
                 $docgrp = implode(",", $docgrp);
2611 2611
             }
2612 2612
             // get document
2613
-            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
2613
+            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
2614 2614
             $rs = $this->db->select('sc.*', "{$tblsc} sc
2615 2615
                 LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1);
2616 2616
             if ($this->db->getRecordCount($rs) < 1) {
@@ -2646,9 +2646,9 @@  discard block
 block discarded – undo
2646 2646
             }
2647 2647
             if ($documentObject['template']) {
2648 2648
                 // load TVs and merge with document - Orig by Apodigm - Docvars
2649
-                $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars") . " tv
2650
-                INNER JOIN " . $this->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id
2651
-                LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'");
2649
+                $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value", $this->getFullTableName("site_tmplvars")." tv
2650
+                INNER JOIN " . $this->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id
2651
+                LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'", "tvtpl.templateid = '{$documentObject['template']}'");
2652 2652
                 $tmplvars = array();
2653 2653
                 while ($row = $this->db->getRow($rs)) {
2654 2654
                     $tmplvars[$row['name']] = array(
@@ -2694,7 +2694,7 @@  discard block
 block discarded – undo
2694 2694
                 $st = md5($source);
2695 2695
             }
2696 2696
             if ($this->dumpSnippets == 1) {
2697
-                $this->snippetsCode .= "<fieldset><legend><b style='color: #821517;'>PARSE PASS " . ($i + 1) . "</b></legend><p>The following snippets (if any) were parsed during this pass.</p>";
2697
+                $this->snippetsCode .= "<fieldset><legend><b style='color: #821517;'>PARSE PASS ".($i + 1)."</b></legend><p>The following snippets (if any) were parsed during this pass.</p>";
2698 2698
             }
2699 2699
 
2700 2700
             // invoke OnParseDocument event
@@ -2736,7 +2736,7 @@  discard block
 block discarded – undo
2736 2736
      */
2737 2737
     public function executeParser()
2738 2738
     {
2739
-        if(MODX_CLI) {
2739
+        if (MODX_CLI) {
2740 2740
             throw new RuntimeException('Call DocumentParser::executeParser on CLI mode');
2741 2741
         }
2742 2742
 
@@ -2782,7 +2782,7 @@  discard block
 block discarded – undo
2782 2782
 
2783 2783
             // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path
2784 2784
             if ($this->config['use_alias_path'] == 1) {
2785
-                $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier;
2785
+                $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier;
2786 2786
                 if (isset($this->documentListing[$alias])) {
2787 2787
                     $this->documentIdentifier = $this->documentListing[$alias];
2788 2788
                 } else {
@@ -2843,7 +2843,7 @@  discard block
 block discarded – undo
2843 2843
                 } else {
2844 2844
                     $docAlias = $this->db->escape($this->documentIdentifier);
2845 2845
                     $rs = $this->db->select('id', $this->getFullTableName('site_content'), "deleted=0 and alias='{$docAlias}'");
2846
-                    $this->documentIdentifier = (int)$this->db->getValue($rs);
2846
+                    $this->documentIdentifier = (int) $this->db->getValue($rs);
2847 2847
                 }
2848 2848
             }
2849 2849
             $this->documentMethod = 'id';
@@ -2900,7 +2900,7 @@  discard block
 block discarded – undo
2900 2900
                 $_REQUEST[$n] = $_GET[$n] = $v;
2901 2901
             }
2902 2902
         }
2903
-        $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path'];
2903
+        $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path'];
2904 2904
         $this->q = $qp['path'];
2905 2905
         return $qp['path'];
2906 2906
     }
@@ -2994,7 +2994,7 @@  discard block
 block discarded – undo
2994 2994
             $this->sendErrorPage();
2995 2995
         } else {
2996 2996
             // Inculde the necessary files to check document permissions
2997
-            include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php');
2997
+            include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php');
2998 2998
             $udperms = new udperms();
2999 2999
             $udperms->user = $this->getLoginUserID();
3000 3000
             $udperms->document = $this->documentIdentifier;
@@ -3048,7 +3048,7 @@  discard block
 block discarded – undo
3048 3048
         while ($id && $height--) {
3049 3049
             $thisid = $id;
3050 3050
             if ($this->config['aliaslistingfolder'] == 1) {
3051
-                $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM " . $this->getFullTableName("site_content") . " WHERE `id` = '{$id}' LIMIT 0,1");
3051
+                $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM ".$this->getFullTableName("site_content")." WHERE `id` = '{$id}' LIMIT 0,1");
3052 3052
                 if (!$id || $id == '0') {
3053 3053
                     break;
3054 3054
                 }
@@ -3099,15 +3099,15 @@  discard block
 block discarded – undo
3099 3099
 
3100 3100
         if ($this->config['aliaslistingfolder'] == 1) {
3101 3101
 
3102
-            $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (" . $id . ") AND deleted = '0'");
3102
+            $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'), "parent IN (".$id.") AND deleted = '0'");
3103 3103
             $idx = array();
3104 3104
             while ($row = $this->db->getRow($res)) {
3105 3105
                 $pAlias = '';
3106 3106
                 if (isset($this->aliasListing[$row['parent']])) {
3107
-                    $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : '';
3108
-                    $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : '';
3107
+                    $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : '';
3108
+                    $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : '';
3109 3109
                 };
3110
-                $children[$pAlias . $row['alias']] = $row['id'];
3110
+                $children[$pAlias.$row['alias']] = $row['id'];
3111 3111
                 if ($row['isfolder'] == 1) {
3112 3112
                     $idx[] = $row['id'];
3113 3113
                 }
@@ -3139,7 +3139,7 @@  discard block
 block discarded – undo
3139 3139
                 $depth--;
3140 3140
 
3141 3141
                 foreach ($documentMap_cache[$id] as $childId) {
3142
-                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias'];
3142
+                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias'];
3143 3143
                     if (!strlen($pkey)) {
3144 3144
                         $pkey = "{$childId}";
3145 3145
                     }
@@ -3176,7 +3176,7 @@  discard block
 block discarded – undo
3176 3176
                 $fnc = 'history.back(-1);';
3177 3177
                 break;
3178 3178
             default:
3179
-                $fnc = "window.location.href='" . addslashes($url) . "';";
3179
+                $fnc = "window.location.href='".addslashes($url)."';";
3180 3180
         }
3181 3181
 
3182 3182
         echo "<html><head>
@@ -3208,9 +3208,9 @@  discard block
 block discarded – undo
3208 3208
         $state = 0;
3209 3209
         $pms = $_SESSION['mgrPermissions'];
3210 3210
         if ($pms) {
3211
-            $state = ((bool)$pms[$pm] === true);
3211
+            $state = ((bool) $pms[$pm] === true);
3212 3212
         }
3213
-        return (int)$state;
3213
+        return (int) $state;
3214 3214
     }
3215 3215
 
3216 3216
     /**
@@ -3223,8 +3223,8 @@  discard block
 block discarded – undo
3223 3223
      */
3224 3224
     public function elementIsLocked($type, $id, $includeThisUser = false)
3225 3225
     {
3226
-        $id = (int)$id;
3227
-        $type = (int)$type;
3226
+        $id = (int) $id;
3227
+        $type = (int) $type;
3228 3228
         if (!$type || !$id) {
3229 3229
             return null;
3230 3230
         }
@@ -3274,7 +3274,7 @@  discard block
 block discarded – undo
3274 3274
             return $lockedElements;
3275 3275
         }
3276 3276
 
3277
-        $type = (int)$type;
3277
+        $type = (int) $type;
3278 3278
         if (isset($lockedElements[$type])) {
3279 3279
             return $lockedElements[$type];
3280 3280
         } else {
@@ -3291,7 +3291,7 @@  discard block
 block discarded – undo
3291 3291
             $this->lockedElements = array();
3292 3292
             $this->cleanupExpiredLocks();
3293 3293
 
3294
-            $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks') . " ul
3294
+            $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username', $this->getFullTableName('active_user_locks')." ul
3295 3295
                 LEFT JOIN {$this->getFullTableName('manager_users')} mu on ul.internalKey = mu.id");
3296 3296
             while ($row = $this->db->getRow($rs)) {
3297 3297
                 $this->lockedElements[$row['elementType']][$row['elementId']] = array(
@@ -3314,7 +3314,7 @@  discard block
 block discarded – undo
3314 3314
     public function cleanupExpiredLocks()
3315 3315
     {
3316 3316
         // Clean-up active_user_sessions first
3317
-        $timeout = (int)$this->config['session_timeout'] < 2 ? 120 : $this->config['session_timeout'] * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum
3317
+        $timeout = (int) $this->config['session_timeout'] < 2 ? 120 : $this->config['session_timeout'] * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum
3318 3318
         $validSessionTimeLimit = $this->time - $timeout;
3319 3319
         $this->db->delete($this->getFullTableName('active_user_sessions'), "lasthit < {$validSessionTimeLimit}");
3320 3320
 
@@ -3327,7 +3327,7 @@  discard block
 block discarded – undo
3327 3327
             foreach ($rs as $row) {
3328 3328
                 $userSids[] = $row['sid'];
3329 3329
             }
3330
-            $userSids = "'" . implode("','", $userSids) . "'";
3330
+            $userSids = "'".implode("','", $userSids)."'";
3331 3331
             $this->db->delete($this->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})");
3332 3332
         } else {
3333 3333
             $this->db->delete($this->getFullTableName('active_user_locks'));
@@ -3411,8 +3411,8 @@  discard block
 block discarded – undo
3411 3411
     public function lockElement($type, $id)
3412 3412
     {
3413 3413
         $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0;
3414
-        $type = (int)$type;
3415
-        $id = (int)$id;
3414
+        $type = (int) $type;
3415
+        $id = (int) $id;
3416 3416
         if (!$type || !$id || !$userId) {
3417 3417
             return false;
3418 3418
         }
@@ -3433,8 +3433,8 @@  discard block
 block discarded – undo
3433 3433
     public function unlockElement($type, $id, $includeAllUsers = false)
3434 3434
     {
3435 3435
         $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0;
3436
-        $type = (int)$type;
3437
-        $id = (int)$id;
3436
+        $type = (int) $type;
3437
+        $id = (int) $id;
3438 3438
         if (!$type || !$id) {
3439 3439
             return false;
3440 3440
         }
@@ -3501,8 +3501,8 @@  discard block
 block discarded – undo
3501 3501
         }
3502 3502
 
3503 3503
         $usertype = $this->isFrontend() ? 1 : 0;
3504
-        $evtid = (int)$evtid;
3505
-        $type = (int)$type;
3504
+        $evtid = (int) $evtid;
3505
+        $type = (int) $type;
3506 3506
 
3507 3507
         // Types: 1 = information, 2 = warning, 3 = error
3508 3508
         if ($type < 1) {
@@ -3524,8 +3524,8 @@  discard block
 block discarded – undo
3524 3524
         if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') {
3525 3525
             if ($this->config['send_errormail'] <= $type) {
3526 3526
                 $this->sendmail(array(
3527
-                    'subject' => 'MODX System Error on ' . $this->config['site_name'],
3528
-                    'body' => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.',
3527
+                    'subject' => 'MODX System Error on '.$this->config['site_name'],
3528
+                    'body' => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.',
3529 3529
                     'type' => 'text'
3530 3530
                 ));
3531 3531
             }
@@ -3573,7 +3573,7 @@  discard block
 block discarded – undo
3573 3573
             $p['fromname'] = $userinfo['username'];
3574 3574
         }
3575 3575
         if ($msg === '' && !isset($p['body'])) {
3576
-            $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER'];
3576
+            $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER'];
3577 3577
         } elseif (is_string($msg) && 0 < strlen($msg)) {
3578 3578
             $p['body'] = $msg;
3579 3579
         }
@@ -3613,8 +3613,8 @@  discard block
 block discarded – undo
3613 3613
             $files = array();
3614 3614
         }
3615 3615
         foreach ($files as $f) {
3616
-            if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) {
3617
-                $this->mail->AddAttachment(MODX_BASE_PATH . $f);
3616
+            if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) {
3617
+                $this->mail->AddAttachment(MODX_BASE_PATH.$f);
3618 3618
             }
3619 3619
         }
3620 3620
         $rs = $this->mail->send();
@@ -3659,7 +3659,7 @@  discard block
 block discarded – undo
3659 3659
      */
3660 3660
     public function isFrontend()
3661 3661
     {
3662
-        return ! $this->isBackend();
3662
+        return !$this->isBackend();
3663 3663
     }
3664 3664
 
3665 3665
     /**
@@ -3684,14 +3684,14 @@  discard block
 block discarded – undo
3684 3684
         $tblsc = $this->getFullTableName("site_content");
3685 3685
         $tbldg = $this->getFullTableName("document_groups");
3686 3686
         // modify field names to use sc. table reference
3687
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3688
-        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3687
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3688
+        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3689 3689
         // get document groups for current user
3690 3690
         if ($docgrp = $this->getUserDocGroups()) {
3691 3691
             $docgrp = implode(",", $docgrp);
3692 3692
         }
3693 3693
         // build query
3694
-        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3694
+        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3695 3695
         $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3696 3696
                 LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}");
3697 3697
         $resourceArray = $this->db->makeArray($result);
@@ -3721,14 +3721,14 @@  discard block
 block discarded – undo
3721 3721
         $tbldg = $this->getFullTableName("document_groups");
3722 3722
 
3723 3723
         // modify field names to use sc. table reference
3724
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3725
-        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3724
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3725
+        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3726 3726
         // get document groups for current user
3727 3727
         if ($docgrp = $this->getUserDocGroups()) {
3728 3728
             $docgrp = implode(",", $docgrp);
3729 3729
         }
3730 3730
         // build query
3731
-        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3731
+        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3732 3732
         $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3733 3733
                 LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND sc.published=1 AND sc.deleted=0 AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}");
3734 3734
         $resourceArray = $this->db->makeArray($result);
@@ -3763,16 +3763,16 @@  discard block
 block discarded – undo
3763 3763
             return $this->tmpCache[__FUNCTION__][$cacheKey];
3764 3764
         }
3765 3765
 
3766
-        $published = ($published !== 'all') ? 'AND sc.published = ' . $published : '';
3767
-        $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : '';
3766
+        $published = ($published !== 'all') ? 'AND sc.published = '.$published : '';
3767
+        $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : '';
3768 3768
 
3769 3769
         if ($where != '') {
3770
-            $where = 'AND ' . $where;
3770
+            $where = 'AND '.$where;
3771 3771
         }
3772 3772
 
3773 3773
         // modify field names to use sc. table reference
3774
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3775
-        $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3774
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3775
+        $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3776 3776
 
3777 3777
         // get document groups for current user
3778 3778
         if ($docgrp = $this->getUserDocGroups()) {
@@ -3780,7 +3780,7 @@  discard block
 block discarded – undo
3780 3780
         }
3781 3781
 
3782 3782
         // build query
3783
-        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
3783
+        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')');
3784 3784
 
3785 3785
         $tblsc = $this->getFullTableName('site_content');
3786 3786
         $tbldg = $this->getFullTableName('document_groups');
@@ -3832,10 +3832,10 @@  discard block
 block discarded – undo
3832 3832
             return false;
3833 3833
         } else {
3834 3834
             // modify field names to use sc. table reference
3835
-            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3836
-            $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3835
+            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3836
+            $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3837 3837
             if ($where != '') {
3838
-                $where = 'AND ' . $where;
3838
+                $where = 'AND '.$where;
3839 3839
             }
3840 3840
 
3841 3841
             $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : '';
@@ -3846,13 +3846,13 @@  discard block
 block discarded – undo
3846 3846
                 $docgrp = implode(',', $docgrp);
3847 3847
             }
3848 3848
 
3849
-            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
3849
+            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')');
3850 3850
 
3851 3851
             $tblsc = $this->getFullTableName('site_content');
3852 3852
             $tbldg = $this->getFullTableName('document_groups');
3853 3853
 
3854 3854
             $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3855
-                    LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (" . implode(',', $ids) . ") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit);
3855
+                    LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (".implode(',', $ids).") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id", ($sort ? "{$sort} {$dir}" : ""), $limit);
3856 3856
 
3857 3857
             $resourceArray = $this->db->makeArray($result);
3858 3858
 
@@ -3957,12 +3957,12 @@  discard block
 block discarded – undo
3957 3957
             $tbldg = $this->getFullTableName("document_groups");
3958 3958
             $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : "";
3959 3959
             // modify field names to use sc. table reference
3960
-            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3960
+            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3961 3961
             // get document groups for current user
3962 3962
             if ($docgrp = $this->getUserDocGroups()) {
3963 3963
                 $docgrp = implode(",", $docgrp);
3964 3964
             }
3965
-            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3965
+            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3966 3966
             $result = $this->db->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1);
3967 3967
             $pageInfo = $this->db->getRow($result);
3968 3968
 
@@ -4009,7 +4009,7 @@  discard block
 block discarded – undo
4009 4009
     {
4010 4010
         if ($this->currentSnippet) {
4011 4011
             $tbl = $this->getFullTableName("site_snippets");
4012
-            $rs = $this->db->select('id', $tbl, "name='" . $this->db->escape($this->currentSnippet) . "'", '', 1);
4012
+            $rs = $this->db->select('id', $tbl, "name='".$this->db->escape($this->currentSnippet)."'", '', 1);
4013 4013
             if ($snippetId = $this->db->getValue($rs)) {
4014 4014
                 return $snippetId;
4015 4015
             }
@@ -4036,23 +4036,23 @@  discard block
 block discarded – undo
4036 4036
      */
4037 4037
     public function clearCache($type = '', $report = false)
4038 4038
     {
4039
-        $cache_dir = MODX_BASE_PATH . $this->getCacheFolder();
4039
+        $cache_dir = MODX_BASE_PATH.$this->getCacheFolder();
4040 4040
         if (is_array($type)) {
4041 4041
             foreach ($type as $_) {
4042 4042
                 $this->clearCache($_, $report);
4043 4043
             }
4044 4044
         } elseif ($type == 'full') {
4045
-            include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php');
4045
+            include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php');
4046 4046
             $sync = new synccache();
4047 4047
             $sync->setCachepath($cache_dir);
4048 4048
             $sync->setReport($report);
4049 4049
             $sync->emptyCache();
4050 4050
         } elseif (preg_match('@^[1-9][0-9]*$@', $type)) {
4051 4051
             $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type;
4052
-            $file_name = "docid_" . $key . "_*.pageCache.php";
4053
-            $cache_path = $cache_dir . $file_name;
4052
+            $file_name = "docid_".$key."_*.pageCache.php";
4053
+            $cache_path = $cache_dir.$file_name;
4054 4054
             $files = glob($cache_path);
4055
-            $files[] = $cache_dir . "docid_" . $key . ".pageCache.php";
4055
+            $files[] = $cache_dir."docid_".$key.".pageCache.php";
4056 4056
             foreach ($files as $file) {
4057 4057
                 if (!is_file($file)) {
4058 4058
                     continue;
@@ -4060,7 +4060,7 @@  discard block
 block discarded – undo
4060 4060
                 unlink($file);
4061 4061
             }
4062 4062
         } else {
4063
-            $files = glob($cache_dir . '*');
4063
+            $files = glob($cache_dir.'*');
4064 4064
             foreach ($files as $file) {
4065 4065
                 $name = basename($file);
4066 4066
                 if (strpos($name, '.pageCache.php') === false) {
@@ -4129,7 +4129,7 @@  discard block
 block discarded – undo
4129 4129
                         $f_url_suffix = '/';
4130 4130
                     }
4131 4131
 
4132
-                    $alPath = !empty ($al['path']) ? $al['path'] . '/' : '';
4132
+                    $alPath = !empty ($al['path']) ? $al['path'].'/' : '';
4133 4133
 
4134 4134
                     if ($al && $al['alias']) {
4135 4135
                         $alias = $al['alias'];
@@ -4137,7 +4137,7 @@  discard block
 block discarded – undo
4137 4137
 
4138 4138
                 }
4139 4139
 
4140
-                $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix;
4140
+                $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix;
4141 4141
                 $url = "{$alias}{$args}";
4142 4142
             } else {
4143 4143
                 $url = "index.php?id={$id}{$args}";
@@ -4156,7 +4156,7 @@  discard block
 block discarded – undo
4156 4156
             }
4157 4157
 
4158 4158
             //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080)
4159
-            $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host;
4159
+            $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host;
4160 4160
         }
4161 4161
 
4162 4162
         //fix strictUrl by Bumkaka
@@ -4165,9 +4165,9 @@  discard block
 block discarded – undo
4165 4165
         }
4166 4166
 
4167 4167
         if ($this->config['xhtml_urls']) {
4168
-            $url = preg_replace("/&(?!amp;)/", "&amp;", $host . $virtualDir . $url);
4168
+            $url = preg_replace("/&(?!amp;)/", "&amp;", $host.$virtualDir.$url);
4169 4169
         } else {
4170
-            $url = $host . $virtualDir . $url;
4170
+            $url = $host.$virtualDir.$url;
4171 4171
         }
4172 4172
 
4173 4173
         $evtOut = $this->invokeEvent('OnMakeDocUrl', array(
@@ -4191,21 +4191,21 @@  discard block
 block discarded – undo
4191 4191
         if (isset($this->aliasListing[$id])) {
4192 4192
             $out = $this->aliasListing[$id];
4193 4193
         } else {
4194
-            $q = $this->db->query("SELECT id,alias,isfolder,parent FROM " . $this->getFullTableName("site_content") . " WHERE id=" . (int)$id);
4194
+            $q = $this->db->query("SELECT id,alias,isfolder,parent FROM ".$this->getFullTableName("site_content")." WHERE id=".(int) $id);
4195 4195
             if ($this->db->getRecordCount($q) == '1') {
4196 4196
                 $q = $this->db->getRow($q);
4197 4197
                 $this->aliasListing[$id] = array(
4198
-                    'id' => (int)$q['id'],
4198
+                    'id' => (int) $q['id'],
4199 4199
                     'alias' => $q['alias'] == '' ? $q['id'] : $q['alias'],
4200
-                    'parent' => (int)$q['parent'],
4201
-                    'isfolder' => (int)$q['isfolder'],
4200
+                    'parent' => (int) $q['parent'],
4201
+                    'isfolder' => (int) $q['isfolder'],
4202 4202
                 );
4203 4203
                 if ($this->aliasListing[$id]['parent'] > 0) {
4204 4204
                     //fix alias_path_usage
4205 4205
                     if ($this->config['use_alias_path'] == '1') {
4206 4206
                         //&& $tmp['path'] != '' - fix error slash with epty path
4207 4207
                         $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']);
4208
-                        $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : '');
4208
+                        $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : '');
4209 4209
                     } else {
4210 4210
                         $this->aliasListing[$id]['path'] = '';
4211 4211
                     }
@@ -4246,7 +4246,7 @@  discard block
 block discarded – undo
4246 4246
         $out = array();
4247 4247
         if (empty($this->version) || !is_array($this->version)) {
4248 4248
             //include for compatibility modx version < 1.0.10
4249
-            include MODX_MANAGER_PATH . "includes/version.inc.php";
4249
+            include MODX_MANAGER_PATH."includes/version.inc.php";
4250 4250
             $this->version = array();
4251 4251
             $this->version['version'] = isset($modx_version) ? $modx_version : '';
4252 4252
             $this->version['branch'] = isset($modx_branch) ? $modx_branch : '';
@@ -4268,18 +4268,18 @@  discard block
 block discarded – undo
4268 4268
     {
4269 4269
         if (isset ($this->snippetCache[$snippetName])) {
4270 4270
             $snippet = $this->snippetCache[$snippetName];
4271
-            $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : '';
4271
+            $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : '';
4272 4272
         } else { // not in cache so let's check the db
4273
-            $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->db->escape($snippetName) . "'  AND ss.disabled=0;";
4273
+            $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM ".$this->getFullTableName("site_snippets")." as ss LEFT JOIN ".$this->getFullTableName('site_modules')." as sm on sm.guid=ss.moduleguid WHERE ss.`name`='".$this->db->escape($snippetName)."'  AND ss.disabled=0;";
4274 4274
             $result = $this->db->query($sql);
4275 4275
             if ($this->db->getRecordCount($result) == 1) {
4276 4276
                 $row = $this->db->getRow($result);
4277 4277
                 $snippet = $this->snippetCache[$snippetName] = $row['snippet'];
4278 4278
                 $mergedProperties = array_merge($this->parseProperties($row['properties']), $this->parseProperties($row['sharedproperties']));
4279
-                $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties);
4279
+                $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties);
4280 4280
             } else {
4281 4281
                 $snippet = $this->snippetCache[$snippetName] = "return false;";
4282
-                $properties = $this->snippetCache[$snippetName . "Props"] = '';
4282
+                $properties = $this->snippetCache[$snippetName."Props"] = '';
4283 4283
             }
4284 4284
         }
4285 4285
         // load default params/properties
@@ -4379,8 +4379,8 @@  discard block
 block discarded – undo
4379 4379
             }
4380 4380
             if (strpos($tpl, $s) !== false) {
4381 4381
                 $tpl = str_replace($s, $value, $tpl);
4382
-            } elseif($this->debug) {
4383
-                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2);
4382
+            } elseif ($this->debug) {
4383
+                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2);
4384 4384
             }
4385 4385
         }
4386 4386
 
@@ -4429,7 +4429,7 @@  discard block
 block discarded – undo
4429 4429
             case 'CODE':
4430 4430
                 break;
4431 4431
             case 'FILE':
4432
-                $template = file_get_contents(MODX_BASE_PATH . $template);
4432
+                $template = file_get_contents(MODX_BASE_PATH.$template);
4433 4433
                 break;
4434 4434
             case 'CHUNK':
4435 4435
                 $template = $this->getChunk($template);
@@ -4462,7 +4462,7 @@  discard block
 block discarded – undo
4462 4462
         if ($mode !== 'formatOnly' && empty($timestamp)) {
4463 4463
             return '-';
4464 4464
         }
4465
-        $timestamp = (int)$timestamp;
4465
+        $timestamp = (int) $timestamp;
4466 4466
 
4467 4467
         switch ($this->config['datetime_format']) {
4468 4468
             case 'YYYY/mm/dd':
@@ -4482,7 +4482,7 @@  discard block
 block discarded – undo
4482 4482
         }
4483 4483
 
4484 4484
         if (empty($mode)) {
4485
-            $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp);
4485
+            $strTime = strftime($dateFormat." %H:%M:%S", $timestamp);
4486 4486
         } elseif ($mode == 'dateOnly') {
4487 4487
             $strTime = strftime($dateFormat, $timestamp);
4488 4488
         } elseif ($mode == 'formatOnly') {
@@ -4536,7 +4536,7 @@  discard block
 block discarded – undo
4536 4536
             $S = 0;
4537 4537
         }
4538 4538
         $timeStamp = mktime($H, $M, $S, $m, $d, $Y);
4539
-        $timeStamp = (int)$timeStamp;
4539
+        $timeStamp = (int) $timeStamp;
4540 4540
         return $timeStamp;
4541 4541
     }
4542 4542
 
@@ -4578,7 +4578,7 @@  discard block
 block discarded – undo
4578 4578
                     if ($v === 'value') {
4579 4579
                         unset($_[$i]);
4580 4580
                     } else {
4581
-                        $_[$i] = 'tv.' . $v;
4581
+                        $_[$i] = 'tv.'.$v;
4582 4582
                     }
4583 4583
                 }
4584 4584
                 $fields = implode(',', $_);
@@ -4587,12 +4587,12 @@  discard block
 block discarded – undo
4587 4587
             }
4588 4588
 
4589 4589
             if ($tvsort != '') {
4590
-                $tvsort = 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort))));
4590
+                $tvsort = 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort))));
4591 4591
             }
4592 4592
             if ($tvidnames == "*") {
4593 4593
                 $query = "tv.id<>0";
4594 4594
             } else {
4595
-                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . implode("','", $tvidnames) . "')";
4595
+                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".implode("','", $tvidnames)."')";
4596 4596
             }
4597 4597
 
4598 4598
             $this->getUserDocGroups();
@@ -4736,7 +4736,7 @@  discard block
 block discarded – undo
4736 4736
             return $this->tmpCache[__FUNCTION__][$cacheKey];
4737 4737
         }
4738 4738
 
4739
-        if (($idnames != '*' && !is_array($idnames)) || empty($idnames) ) {
4739
+        if (($idnames != '*' && !is_array($idnames)) || empty($idnames)) {
4740 4740
             return false;
4741 4741
         } else {
4742 4742
 
@@ -4754,23 +4754,23 @@  discard block
 block discarded – undo
4754 4754
             }
4755 4755
 
4756 4756
             // get user defined template variables
4757
-            $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $fields))));
4758
-            $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
4757
+            $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $fields))));
4758
+            $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
4759 4759
 
4760 4760
             if ($idnames == '*') {
4761 4761
                 $query = 'tv.id<>0';
4762 4762
             } else {
4763
-                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')";
4763
+                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')";
4764 4764
             }
4765 4765
 
4766
-            $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars') . " tv
4767
-                    INNER JOIN " . $this->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id
4768
-                    LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues') . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : ""));
4766
+            $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value", $this->getFullTableName('site_tmplvars')." tv
4767
+                    INNER JOIN " . $this->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id
4768
+                    LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues')." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'", "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : ""));
4769 4769
 
4770 4770
             $result = $this->db->makeArray($rs);
4771 4771
 
4772 4772
             // get default/built-in template variables
4773
-            if(is_array($docRow)){
4773
+            if (is_array($docRow)) {
4774 4774
                 ksort($docRow);
4775 4775
 
4776 4776
                 foreach ($docRow as $key => $value) {
@@ -4808,22 +4808,22 @@  discard block
 block discarded – undo
4808 4808
      */
4809 4809
     public function getTemplateVarOutput($idnames = array(), $docid = '', $published = 1, $sep = '')
4810 4810
     {
4811
-        if (is_array($idnames) && empty($idnames) ) {
4811
+        if (is_array($idnames) && empty($idnames)) {
4812 4812
             return false;
4813 4813
         } else {
4814 4814
             $output = array();
4815 4815
             $vars = ($idnames == '*' || is_array($idnames)) ? $idnames : array($idnames);
4816 4816
 
4817
-            $docid = (int)$docid > 0 ? (int)$docid : $this->documentIdentifier;
4817
+            $docid = (int) $docid > 0 ? (int) $docid : $this->documentIdentifier;
4818 4818
             // remove sort for speed
4819 4819
             $result = $this->getTemplateVars($vars, '*', $docid, $published, '', '');
4820 4820
 
4821 4821
             if ($result == false) {
4822 4822
                 return false;
4823 4823
             } else {
4824
-                $baspath = MODX_MANAGER_PATH . 'includes';
4825
-                include_once $baspath . '/tmplvars.format.inc.php';
4826
-                include_once $baspath . '/tmplvars.commands.inc.php';
4824
+                $baspath = MODX_MANAGER_PATH.'includes';
4825
+                include_once $baspath.'/tmplvars.format.inc.php';
4826
+                include_once $baspath.'/tmplvars.commands.inc.php';
4827 4827
 
4828 4828
                 for ($i = 0; $i < count($result); $i++) {
4829 4829
                     $row = $result[$i];
@@ -4848,7 +4848,7 @@  discard block
 block discarded – undo
4848 4848
      */
4849 4849
     public function getFullTableName($tbl)
4850 4850
     {
4851
-        return $this->db->config['dbase'] . ".`" . $this->db->config['table_prefix'] . $tbl . "`";
4851
+        return $this->db->config['dbase'].".`".$this->db->config['table_prefix'].$tbl."`";
4852 4852
     }
4853 4853
 
4854 4854
     /**
@@ -4927,7 +4927,7 @@  discard block
 block discarded – undo
4927 4927
     public function getCachePath()
4928 4928
     {
4929 4929
         global $base_url;
4930
-        $pth = $base_url . $this->getCacheFolder();
4930
+        $pth = $base_url.$this->getCacheFolder();
4931 4931
         return $pth;
4932 4932
     }
4933 4933
 
@@ -4979,8 +4979,8 @@  discard block
 block discarded – undo
4979 4979
         $out = false;
4980 4980
 
4981 4981
         if (!empty($context)) {
4982
-            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
4983
-                $out = $_SESSION[$context . 'InternalKey'];
4982
+            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) {
4983
+                $out = $_SESSION[$context.'InternalKey'];
4984 4984
             }
4985 4985
         } else {
4986 4986
             switch (true) {
@@ -5008,8 +5008,8 @@  discard block
 block discarded – undo
5008 5008
         $out = false;
5009 5009
 
5010 5010
         if (!empty($context)) {
5011
-            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
5012
-                $out = $_SESSION[$context . 'Shortname'];
5011
+            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) {
5012
+                $out = $_SESSION[$context.'Shortname'];
5013 5013
             }
5014 5014
         } else {
5015 5015
             switch (true) {
@@ -5080,8 +5080,8 @@  discard block
 block discarded – undo
5080 5080
      */
5081 5081
     public function getWebUserInfo($uid)
5082 5082
     {
5083
-        $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users") . " wu
5084
-                INNER JOIN " . $this->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id", "wu.id='{$uid}'");
5083
+        $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users")." wu
5084
+                INNER JOIN " . $this->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id", "wu.id='{$uid}'");
5085 5085
         if ($row = $this->db->getRow($rs)) {
5086 5086
             if (!isset($row['usertype']) or !$row["usertype"]) {
5087 5087
                 $row["usertype"] = "web";
@@ -5117,7 +5117,7 @@  discard block
 block discarded – undo
5117 5117
         } else if (is_array($dg)) {
5118 5118
             // resolve ids to names
5119 5119
             $dgn = array();
5120
-            $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (" . implode(",", $dg) . ")");
5120
+            $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"), "id IN (".implode(",", $dg).")");
5121 5121
             while ($row = $this->db->getRow($ds)) {
5122 5122
                 $dgn[] = $row['name'];
5123 5123
             }
@@ -5145,7 +5145,7 @@  discard block
 block discarded – undo
5145 5145
         $rt = false;
5146 5146
         if ($_SESSION["webValidated"] == 1) {
5147 5147
             $tbl = $this->getFullTableName("web_users");
5148
-            $ds = $this->db->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'");
5148
+            $ds = $this->db->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'");
5149 5149
             if ($row = $this->db->getRow($ds)) {
5150 5150
                 if ($row["password"] == md5($oldPwd)) {
5151 5151
                     if (strlen($newPwd) < 6) {
@@ -5155,7 +5155,7 @@  discard block
 block discarded – undo
5155 5155
                     } else {
5156 5156
                         $this->db->update(array(
5157 5157
                             'password' => $this->db->escape($newPwd),
5158
-                        ), $tbl, "id='" . $this->getLoginUserID() . "'");
5158
+                        ), $tbl, "id='".$this->getLoginUserID()."'");
5159 5159
                         // invoke OnWebChangePassword event
5160 5160
                         $this->invokeEvent("OnWebChangePassword", array(
5161 5161
                             "userid" => $row["id"],
@@ -5186,8 +5186,8 @@  discard block
 block discarded – undo
5186 5186
         // check cache
5187 5187
         $grpNames = isset ($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false;
5188 5188
         if (!is_array($grpNames)) {
5189
-            $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names") . " wgn
5190
-                    INNER JOIN " . $this->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'");
5189
+            $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names")." wgn
5190
+                    INNER JOIN " . $this->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'");
5191 5191
             $grpNames = $this->db->getColumn("name", $rs);
5192 5192
             // save to cache
5193 5193
             $_SESSION['webUserGroupNames'] = $grpNames;
@@ -5220,7 +5220,7 @@  discard block
 block discarded – undo
5220 5220
         if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) {
5221 5221
             $this->sjscripts[$nextpos] = $src;
5222 5222
         } else {
5223
-            $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>';
5223
+            $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>';
5224 5224
         }
5225 5225
     }
5226 5226
 
@@ -5299,7 +5299,7 @@  discard block
 block discarded – undo
5299 5299
         }
5300 5300
 
5301 5301
         if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) {
5302
-            $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>';
5302
+            $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>';
5303 5303
         }
5304 5304
         if ($startup) {
5305 5305
             $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1;
@@ -5446,7 +5446,7 @@  discard block
 block discarded – undo
5446 5446
                 $eventtime = $this->getMicroTime() - $eventtime;
5447 5447
                 $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName, $pluginName, $eventtime * 1000);
5448 5448
                 foreach ($parameter as $k => $v) {
5449
-                    $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>';
5449
+                    $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>';
5450 5450
                 }
5451 5451
                 $this->pluginsCode .= '</fieldset><br />';
5452 5452
                 $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime;
@@ -5474,13 +5474,13 @@  discard block
 block discarded – undo
5474 5474
         $plugin = array();
5475 5475
         if (isset ($this->pluginCache[$pluginName])) {
5476 5476
             $pluginCode = $this->pluginCache[$pluginName];
5477
-            $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : '';
5477
+            $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : '';
5478 5478
         } else {
5479 5479
             $pluginName = $this->db->escape($pluginName);
5480 5480
             $result = $this->db->select('name, plugincode, properties', $this->getFullTableName("site_plugins"), "name='{$pluginName}' AND disabled=0");
5481 5481
             if ($row = $this->db->getRow($result)) {
5482 5482
                 $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode'];
5483
-                $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties'];
5483
+                $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties'];
5484 5484
             } else {
5485 5485
                 $pluginCode = $this->pluginCache[$pluginName] = "return false;";
5486 5486
                 $pluginProperties = '';
@@ -5583,7 +5583,7 @@  discard block
 block discarded – undo
5583 5583
     public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false)
5584 5584
     {
5585 5585
         $params = array();
5586
-        $fullpath = $element_dir . '/' . $filename;
5586
+        $fullpath = $element_dir.'/'.$filename;
5587 5587
         if (is_readable($fullpath)) {
5588 5588
             $tpl = @fopen($fullpath, "r");
5589 5589
             if ($tpl) {
@@ -5750,8 +5750,8 @@  discard block
 block discarded – undo
5750 5750
         $ph = array('site_url' => MODX_SITE_URL);
5751 5751
         $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/";
5752 5752
         $regexEmail = '#([0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-wyz][a-z](fo|g|l|m|mes|o|op|pa|ro|seum|t|u|v|z)?)#i';
5753
-        $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : '';
5754
-        $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : '';
5753
+        $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : '';
5754
+        $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : '';
5755 5755
         foreach ($parsed as $key => $val) {
5756 5756
             if (is_array($val)) {
5757 5757
                 foreach ($val as $key2 => $val2) {
@@ -5760,7 +5760,7 @@  discard block
 block discarded – undo
5760 5760
                         $val2 = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val2);
5761 5761
                     }
5762 5762
                     if (preg_match($regexEmail, $val2, $url)) {
5763
-                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2);
5763
+                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2);
5764 5764
                     }
5765 5765
                     $parsed[$key][$key2] = $val2;
5766 5766
                 }
@@ -5770,7 +5770,7 @@  discard block
 block discarded – undo
5770 5770
                     $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val);
5771 5771
                 }
5772 5772
                 if (preg_match($regexEmail, $val, $url)) {
5773
-                    $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val);
5773
+                    $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val);
5774 5774
                 }
5775 5775
                 $parsed[$key] = $val;
5776 5776
             }
@@ -5784,32 +5784,32 @@  discard block
 block discarded – undo
5784 5784
         );
5785 5785
 
5786 5786
         $nl = "\n";
5787
-        $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'], "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : '';
5788
-        $list .= '<p>' . $nl;
5789
-        $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : '';
5790
-        $list .= isset($parsed['description']) ? $parsed['description'] . $nl : '';
5791
-        $list .= '</p><br/>' . $nl;
5792
-        $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : '';
5793
-        $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : '';
5794
-        $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : '';
5795
-        $list .= '<br/>' . $nl;
5787
+        $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'], "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : '';
5788
+        $list .= '<p>'.$nl;
5789
+        $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : '';
5790
+        $list .= isset($parsed['description']) ? $parsed['description'].$nl : '';
5791
+        $list .= '</p><br/>'.$nl;
5792
+        $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : '';
5793
+        $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : '';
5794
+        $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : '';
5795
+        $list .= '<br/>'.$nl;
5796 5796
         $first = true;
5797 5797
         foreach ($arrayParams as $param => $label) {
5798 5798
             if (isset($parsed[$param])) {
5799 5799
                 if ($first) {
5800
-                    $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl;
5801
-                    $list .= '<ul class="docBlockList">' . $nl;
5800
+                    $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl;
5801
+                    $list .= '<ul class="docBlockList">'.$nl;
5802 5802
                     $first = false;
5803 5803
                 }
5804
-                $list .= '    <li><strong>' . $label . '</strong>' . $nl;
5805
-                $list .= '        <ul>' . $nl;
5804
+                $list .= '    <li><strong>'.$label.'</strong>'.$nl;
5805
+                $list .= '        <ul>'.$nl;
5806 5806
                 foreach ($parsed[$param] as $val) {
5807
-                    $list .= '            <li>' . $val . '</li>' . $nl;
5807
+                    $list .= '            <li>'.$val.'</li>'.$nl;
5808 5808
                 }
5809
-                $list .= '        </ul></li>' . $nl;
5809
+                $list .= '        </ul></li>'.$nl;
5810 5810
             }
5811 5811
         }
5812
-        $list .= !$first ? '</ul>' . $nl : '';
5812
+        $list .= !$first ? '</ul>'.$nl : '';
5813 5813
 
5814 5814
         return $list;
5815 5815
     }
@@ -5885,7 +5885,7 @@  discard block
 block discarded – undo
5885 5885
      */
5886 5886
     public function addSnippet($name, $phpCode)
5887 5887
     {
5888
-        $this->snippetCache['#' . $name] = $phpCode;
5888
+        $this->snippetCache['#'.$name] = $phpCode;
5889 5889
     }
5890 5890
 
5891 5891
     /**
@@ -5894,7 +5894,7 @@  discard block
 block discarded – undo
5894 5894
      */
5895 5895
     public function addChunk($name, $text)
5896 5896
     {
5897
-        $this->chunkCache['#' . $name] = $text;
5897
+        $this->chunkCache['#'.$name] = $text;
5898 5898
     }
5899 5899
 
5900 5900
     /**
@@ -5930,7 +5930,7 @@  discard block
 block discarded – undo
5930 5930
         }
5931 5931
 
5932 5932
         if (!$isSafe) {
5933
-            $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true);
5933
+            $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true);
5934 5934
             $title = sprintf('Unknown eval was executed (%s)', $this->htmlspecialchars(substr(trim($phpcode), 0, 50)));
5935 5935
             $this->messageQuit($title, '', true, '', '', 'Parser', $msg);
5936 5936
             return;
@@ -5944,7 +5944,7 @@  discard block
 block discarded – undo
5944 5944
             return 'array()';
5945 5945
         }
5946 5946
 
5947
-        $output = $echo . $return;
5947
+        $output = $echo.$return;
5948 5948
         modx_sanitize_gpc($output);
5949 5949
         return $this->htmlspecialchars($output); // Maybe, all html tags are dangerous
5950 5950
     }
@@ -5962,8 +5962,8 @@  discard block
 block discarded – undo
5962 5962
 
5963 5963
         $safe = explode(',', $safe_functions);
5964 5964
 
5965
-        $phpcode = rtrim($phpcode, ';') . ';';
5966
-        $tokens = token_get_all('<?php ' . $phpcode);
5965
+        $phpcode = rtrim($phpcode, ';').';';
5966
+        $tokens = token_get_all('<?php '.$phpcode);
5967 5967
         foreach ($tokens as $i => $token) {
5968 5968
             if (!is_array($token)) {
5969 5969
                 continue;
@@ -5999,7 +5999,7 @@  discard block
 block discarded – undo
5999 5999
     public function atBindFileContent($str = '')
6000 6000
     {
6001 6001
 
6002
-        $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'] . 'files/', '');
6002
+        $search_path = array('assets/tvs/', 'assets/chunks/', 'assets/templates/', $this->config['rb_base_url'].'files/', '');
6003 6003
 
6004 6004
         if (stripos($str, '@FILE') !== 0) {
6005 6005
             return $str;
@@ -6022,7 +6022,7 @@  discard block
 block discarded – undo
6022 6022
         $errorMsg = sprintf("Could not retrieve string '%s'.", $str);
6023 6023
 
6024 6024
         foreach ($search_path as $path) {
6025
-            $file_path = MODX_BASE_PATH . $path . $str;
6025
+            $file_path = MODX_BASE_PATH.$path.$str;
6026 6026
             if (strpos($file_path, MODX_MANAGER_PATH) === 0) {
6027 6027
                 return $errorMsg;
6028 6028
             } elseif (is_file($file_path)) {
@@ -6036,7 +6036,7 @@  discard block
 block discarded – undo
6036 6036
             return $errorMsg;
6037 6037
         }
6038 6038
 
6039
-        $content = (string)file_get_contents($file_path);
6039
+        $content = (string) file_get_contents($file_path);
6040 6040
         if ($content === false) {
6041 6041
             return $errorMsg;
6042 6042
         }
@@ -6149,22 +6149,22 @@  discard block
 block discarded – undo
6149 6149
 
6150 6150
         $version = isset ($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : '';
6151 6151
         $release_date = isset ($GLOBALS['release_date']) ? $GLOBALS['release_date'] : '';
6152
-        $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI'];
6152
+        $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI'];
6153 6153
         $request_uri = $this->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']);
6154 6154
         $ua = $this->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']);
6155 6155
         $referer = $this->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']);
6156 6156
         if ($is_error) {
6157 6157
             $str = '<h2 style="color:red">&laquo; Evo Parse Error &raquo;</h2>';
6158 6158
             if ($msg != 'PHP Parse Error') {
6159
-                $str .= '<h3 style="color:red">' . $msg . '</h3>';
6159
+                $str .= '<h3 style="color:red">'.$msg.'</h3>';
6160 6160
             }
6161 6161
         } else {
6162 6162
             $str = '<h2 style="color:#003399">&laquo; Evo Debug/ stop message &raquo;</h2>';
6163
-            $str .= '<h3 style="color:#003399">' . $msg . '</h3>';
6163
+            $str .= '<h3 style="color:#003399">'.$msg.'</h3>';
6164 6164
         }
6165 6165
 
6166 6166
         if (!empty ($query)) {
6167
-            $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL &gt; <span id="sqlHolder">' . $query . '</span></div>';
6167
+            $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL &gt; <span id="sqlHolder">'.$query.'</span></div>';
6168 6168
         }
6169 6169
 
6170 6170
         $errortype = array(
@@ -6187,13 +6187,13 @@  discard block
 block discarded – undo
6187 6187
 
6188 6188
         if (!empty($nr) || !empty($file)) {
6189 6189
             if ($text != '') {
6190
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>';
6190
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>';
6191 6191
             }
6192 6192
             if ($output != '') {
6193
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>';
6193
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>';
6194 6194
             }
6195 6195
             if ($nr !== '') {
6196
-                $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]");
6196
+                $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]");
6197 6197
             }
6198 6198
             if ($file) {
6199 6199
                 $table[] = array('File', $file);
@@ -6213,7 +6213,7 @@  discard block
 block discarded – undo
6213 6213
         }
6214 6214
 
6215 6215
         if (!empty($this->event->activePlugin)) {
6216
-            $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')');
6216
+            $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')');
6217 6217
         }
6218 6218
 
6219 6219
         $str .= $MakeTable->create($table, array('Error information', ''));
@@ -6223,17 +6223,17 @@  discard block
 block discarded – undo
6223 6223
         $table[] = array('REQUEST_URI', $request_uri);
6224 6224
 
6225 6225
         if ($this->manager->action) {
6226
-            include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
6226
+            include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php');
6227 6227
             global $action_list;
6228 6228
             $actionName = (isset($action_list[$this->manager->action])) ? " - {$action_list[$this->manager->action]}" : '';
6229 6229
 
6230
-            $table[] = array('Manager action', $this->manager->action . $actionName);
6230
+            $table[] = array('Manager action', $this->manager->action.$actionName);
6231 6231
         }
6232 6232
 
6233 6233
         if (preg_match('@^[0-9]+@', $this->documentIdentifier)) {
6234 6234
             $resource = $this->getDocumentObject('id', $this->documentIdentifier);
6235 6235
             $url = $this->makeUrl($this->documentIdentifier, '', '', 'full');
6236
-            $table[] = array('Resource', '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>');
6236
+            $table[] = array('Resource', '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>');
6237 6237
         }
6238 6238
         $table[] = array('Referer', $referer);
6239 6239
         $table[] = array('User Agent', $ua);
@@ -6254,7 +6254,7 @@  discard block
 block discarded – undo
6254 6254
 
6255 6255
         $mem = memory_get_peak_usage(true);
6256 6256
         $total_mem = $mem - $this->mstart;
6257
-        $total_mem = ($total_mem / 1024 / 1024) . ' mb';
6257
+        $total_mem = ($total_mem / 1024 / 1024).' mb';
6258 6258
 
6259 6259
         $queryTime = $this->queryTime;
6260 6260
         $phpTime = $totalTime - $queryTime;
@@ -6275,18 +6275,18 @@  discard block
 block discarded – undo
6275 6275
         $str .= $this->get_backtrace(debug_backtrace());
6276 6276
         // Log error
6277 6277
         if (!empty($this->currentSnippet)) {
6278
-            $source = 'Snippet - ' . $this->currentSnippet;
6278
+            $source = 'Snippet - '.$this->currentSnippet;
6279 6279
         } elseif (!empty($this->event->activePlugin)) {
6280
-            $source = 'Plugin - ' . $this->event->activePlugin;
6280
+            $source = 'Plugin - '.$this->event->activePlugin;
6281 6281
         } elseif ($source !== '') {
6282
-            $source = 'Parser - ' . $source;
6282
+            $source = 'Parser - '.$source;
6283 6283
         } elseif ($query !== '') {
6284 6284
             $source = 'SQL Query';
6285 6285
         } else {
6286 6286
             $source = 'Parser';
6287 6287
         }
6288 6288
         if ($msg) {
6289
-            $source .= ' / ' . $msg;
6289
+            $source .= ' / '.$msg;
6290 6290
         }
6291 6291
         if (isset($actionName) && !empty($actionName)) {
6292 6292
             $source .= $actionName;
@@ -6318,12 +6318,12 @@  discard block
 block discarded – undo
6318 6318
 
6319 6319
         // Display error
6320 6320
         if (isset($_SESSION['mgrValidated'])) {
6321
-            echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>EVO Content Manager ' . $version . ' &raquo; ' . $release_date . '</title>
6321
+            echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>EVO Content Manager '.$version.' &raquo; '.$release_date.'</title>
6322 6322
                  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6323
-                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" />
6323
+                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" />
6324 6324
                  <style type="text/css">body { padding:10px; } td {font:inherit;}</style>
6325 6325
                  </head><body>
6326
-                 ' . $str . '</body></html>';
6326
+                 ' . $str.'</body></html>';
6327 6327
 
6328 6328
         } else {
6329 6329
             echo 'Error';
@@ -6361,7 +6361,7 @@  discard block
 block discarded – undo
6361 6361
             switch ($val['type']) {
6362 6362
                 case '->':
6363 6363
                 case '::':
6364
-                    $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function'];
6364
+                    $functionName = $val['function'] = $val['class'].$val['type'].$val['function'];
6365 6365
                     break;
6366 6366
                 default:
6367 6367
                     $functionName = $val['function'];
@@ -6371,7 +6371,7 @@  discard block
 block discarded – undo
6371 6371
             $args = array_pad(array(), $_, '$var');
6372 6372
             $args = implode(", ", $args);
6373 6373
             $modx = &$this;
6374
-            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) {
6374
+            $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) {
6375 6375
                 $arg = $val['args'][$tmp - 1];
6376 6376
                 switch (true) {
6377 6377
                     case is_null($arg): {
@@ -6383,7 +6383,7 @@  discard block
 block discarded – undo
6383 6383
                         break;
6384 6384
                     }
6385 6385
                     case is_scalar($arg): {
6386
-                        $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->htmlspecialchars(str_replace("'", "\\'", $arg)) . "'");
6386
+                        $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->htmlspecialchars(str_replace("'", "\\'", $arg))."'");
6387 6387
                         break;
6388 6388
                     }
6389 6389
                     case is_bool($arg): {
@@ -6391,23 +6391,23 @@  discard block
 block discarded – undo
6391 6391
                         break;
6392 6392
                     }
6393 6393
                     case is_array($arg): {
6394
-                        $out = 'array $var' . $tmp;
6394
+                        $out = 'array $var'.$tmp;
6395 6395
                         break;
6396 6396
                     }
6397 6397
                     case is_object($arg): {
6398
-                        $out = get_class($arg) . ' $var' . $tmp;
6398
+                        $out = get_class($arg).' $var'.$tmp;
6399 6399
                         break;
6400 6400
                     }
6401 6401
                     default: {
6402
-                        $out = '$var' . $tmp;
6402
+                        $out = '$var'.$tmp;
6403 6403
                     }
6404 6404
                 }
6405 6405
                 $tmp++;
6406 6406
                 return $out;
6407 6407
             }, $args);
6408 6408
             $line = array(
6409
-                "<strong>" . $functionName . "</strong>(" . $args . ")",
6410
-                $path . " on line " . $val['line']
6409
+                "<strong>".$functionName."</strong>(".$args.")",
6410
+                $path." on line ".$val['line']
6411 6411
             );
6412 6412
             $table[] = array(implode("<br />", $line));
6413 6413
         }
@@ -6448,7 +6448,7 @@  discard block
 block discarded – undo
6448 6448
             $alias = strip_tags($alias); // strip HTML
6449 6449
             $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters
6450 6450
             $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash
6451
-            $alias = preg_replace('/-+/', '-', $alias);  // convert multiple dashes to one
6451
+            $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one
6452 6452
             $alias = trim($alias, '-'); // trim excess
6453 6453
             return $alias;
6454 6454
         }
@@ -6464,7 +6464,7 @@  discard block
 block discarded – undo
6464 6464
         $precisions = count($sizes) - 1;
6465 6465
         foreach ($sizes as $unit => $bytes) {
6466 6466
             if ($size >= $bytes) {
6467
-                return number_format($size / $bytes, $precisions) . ' ' . $unit;
6467
+                return number_format($size / $bytes, $precisions).' '.$unit;
6468 6468
             }
6469 6469
             $precisions--;
6470 6470
         }
@@ -6568,10 +6568,10 @@  discard block
 block discarded – undo
6568 6568
 
6569 6569
         if (strpos($str, MODX_MANAGER_PATH) === 0) {
6570 6570
             return false;
6571
-        } elseif (is_file(MODX_BASE_PATH . $str)) {
6572
-            $file_path = MODX_BASE_PATH . $str;
6573
-        } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) {
6574
-            $file_path = MODX_BASE_PATH . $tpl_dir . $str;
6571
+        } elseif (is_file(MODX_BASE_PATH.$str)) {
6572
+            $file_path = MODX_BASE_PATH.$str;
6573
+        } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) {
6574
+            $file_path = MODX_BASE_PATH.$tpl_dir.$str;
6575 6575
         } else {
6576 6576
             return false;
6577 6577
         }
@@ -6697,7 +6697,7 @@  discard block
 block discarded – undo
6697 6697
             $title = 'no title';
6698 6698
         }
6699 6699
         if (is_array($msg)) {
6700
-            $msg = '<pre>' . print_r($msg, true) . '</pre>';
6700
+            $msg = '<pre>'.print_r($msg, true).'</pre>';
6701 6701
         } elseif ($msg === '') {
6702 6702
             $msg = $_SERVER['REQUEST_URI'];
6703 6703
         }
@@ -6742,7 +6742,7 @@  discard block
 block discarded – undo
6742 6742
         if (is_array($SystemAlertMsgQueque)) {
6743 6743
             $title = '';
6744 6744
             if ($this->name && $this->activePlugin) {
6745
-                $title = "<div><b>" . $this->activePlugin . "</b> - <span style='color:maroon;'>" . $this->name . "</span></div>";
6745
+                $title = "<div><b>".$this->activePlugin."</b> - <span style='color:maroon;'>".$this->name."</span></div>";
6746 6746
             }
6747 6747
             $SystemAlertMsgQueque[] = "$title<div style='margin-left:10px;margin-top:3px;'>$msg</div>";
6748 6748
         }
Please login to merge, or discard this patch.
install/actions/action_options.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-$installMode = isset($_POST['installmode']) ? (int)$_POST['installmode'] : 0;
2
+$installMode = isset($_POST['installmode']) ? (int) $_POST['installmode'] : 0;
3 3
 
4
-if( ! function_exists('getTemplates')) {
4
+if (!function_exists('getTemplates')) {
5 5
     /**
6 6
      * @param array $presets
7 7
      * @return string
@@ -25,11 +25,11 @@  discard block
 block discarded – undo
25 25
             $_[] = parse($tpl, $ph);
26 26
             $i++;
27 27
         }
28
-        return (0 < count($_)) ? '<h3>[%templates%]</h3>' . implode("\n", $_) : '';
28
+        return (0 < count($_)) ? '<h3>[%templates%]</h3>'.implode("\n", $_) : '';
29 29
     }
30 30
 }
31 31
 
32
-if( ! function_exists('getTVs')) {
32
+if (!function_exists('getTVs')) {
33 33
     /**
34 34
      * @param array $presets
35 35
      * @return string
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
             $_[] = parse($tpl, $ph);
55 55
             $i++;
56 56
         }
57
-        return (0 < count($_)) ? '<h3>[%tvs%]</h3>' . implode("\n", $_) : '';
57
+        return (0 < count($_)) ? '<h3>[%tvs%]</h3>'.implode("\n", $_) : '';
58 58
     }
59 59
 }
60 60
 
61
-if( ! function_exists('getChunks')) {
61
+if (!function_exists('getChunks')) {
62 62
     /**
63 63
      * display chunks
64 64
      *
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
             $_[] = parse($tpl, $ph);
85 85
             $i++;
86 86
         }
87
-        return (0 < count($_)) ? '<h3>[%chunks%]</h3>' . implode("\n", $_) : '';
87
+        return (0 < count($_)) ? '<h3>[%chunks%]</h3>'.implode("\n", $_) : '';
88 88
     }
89 89
 }
90 90
 
91
-if( ! function_exists('getModules')) {
91
+if (!function_exists('getModules')) {
92 92
     /**
93 93
      * display modules
94 94
      *
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
             $_[] = parse($tpl, $ph);
115 115
             $i++;
116 116
         }
117
-        return (0 < count($_)) ? '<h3>[%modules%]</h3>' . implode("\n", $_) : '';
117
+        return (0 < count($_)) ? '<h3>[%modules%]</h3>'.implode("\n", $_) : '';
118 118
     }
119 119
 }
120 120
 
121
-if( ! function_exists('getPlugins')) {
121
+if (!function_exists('getPlugins')) {
122 122
     /**
123 123
      * display plugins
124 124
      *
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
             $_[] = parse($tpl, $ph);
149 149
             $i++;
150 150
         }
151
-        return (0 < count($_)) ? '<h3>[%plugins%]</h3>' . implode("\n", $_) : '';
151
+        return (0 < count($_)) ? '<h3>[%plugins%]</h3>'.implode("\n", $_) : '';
152 152
     }
153 153
 }
154 154
 
155
-if( ! function_exists('getSnippets')) {
155
+if (!function_exists('getSnippets')) {
156 156
     /**
157 157
      * display snippets
158 158
      *
@@ -178,23 +178,23 @@  discard block
 block discarded – undo
178 178
             $_[] = parse($tpl, $ph);
179 179
             $i++;
180 180
         }
181
-        return (0 < count($_)) ? '<h3>[%snippets%]</h3>' . implode("\n", $_) : '';
181
+        return (0 < count($_)) ? '<h3>[%snippets%]</h3>'.implode("\n", $_) : '';
182 182
     }
183 183
 }
184 184
 
185
-switch($installMode){
185
+switch ($installMode) {
186 186
     case 0:
187 187
     case 2:
188 188
         $database_collation = isset($_POST['database_collation']) ? $_POST['database_collation'] : 'utf8_general_ci';
189 189
         $database_charset = substr($database_collation, 0, strpos($database_collation, '_'));
190 190
         $_POST['database_connection_charset'] = $database_charset;
191
-        if(!empty($_POST['databaseloginpassword']))
191
+        if (!empty($_POST['databaseloginpassword']))
192 192
             $_SESSION['databaseloginpassword'] = $_POST['databaseloginpassword'];
193
-        if(!empty($_POST['databaseloginname']))
193
+        if (!empty($_POST['databaseloginname']))
194 194
             $_SESSION['databaseloginname'] = $_POST['databaseloginname'];
195 195
         break;
196 196
     case 1:
197
-        include $base_path . MGR_DIR . '/includes/config.inc.php';
197
+        include $base_path.MGR_DIR.'/includes/config.inc.php';
198 198
         if (@ $conn = mysqli_connect($database_server, $database_user, $database_password)) {
199 199
             if (@ mysqli_query($conn, "USE {$dbase}")) {
200 200
                 if (!$rs = mysqli_query($conn, "show session variables like 'collation_database'")) {
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 $ph['checked'] = isset ($_POST['installdata']) && $_POST['installdata'] == "1" ? 'checked' : '';
250 250
 
251 251
 # load setup information file
252
-include($base_path . 'install/setup.info.php');
252
+include($base_path.'install/setup.info.php');
253 253
 $ph['templates'] = getTemplates($moduleTemplates);
254 254
 $ph['tvs']       = getTVs($moduleTVs);
255 255
 $ph['chunks']    = getChunks($moduleChunks);
@@ -259,6 +259,6 @@  discard block
 block discarded – undo
259 259
 
260 260
 $ph['action'] = ($installMode == 1) ? 'mode' : 'connection';
261 261
 
262
-$tpl = file_get_contents($base_path . 'install/actions/tpl_options.html');
263
-$content = parse($tpl,$ph);
264
-echo parse($content,$_lang,'[%','%]');
262
+$tpl = file_get_contents($base_path.'install/actions/tpl_options.html');
263
+$content = parse($tpl, $ph);
264
+echo parse($content, $_lang, '[%', '%]');
Please login to merge, or discard this patch.
install/instprocessor.php 1 patch
Spacing   +183 added lines, -183 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if (file_exists(dirname(__FILE__)."/../assets/cache/siteManager.php")) {
3 3
     include_once(dirname(__FILE__)."/../assets/cache/siteManager.php");
4
-}else{
4
+} else {
5 5
     define('MGR_DIR', 'manager');
6 6
 }
7 7
 define('MODX_CLI', false);
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
 echo "<p>{$_lang['setup_database']}</p>\n";
31 31
 
32
-$installMode= (int)$_POST['installmode'];
32
+$installMode = (int) $_POST['installmode'];
33 33
 $installData = $_POST['installdata'] == "1" ? 1 : 0;
34 34
 
35 35
 //if ($installMode == 1) {
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 $database_charset = substr($database_collation, 0, strpos($database_collation, '_'));
44 44
 $database_connection_charset = $_POST['database_connection_charset'];
45 45
 $database_connection_method = $_POST['database_connection_method'];
46
-$dbase = "`" . $_POST['database_name'] . "`";
46
+$dbase = "`".$_POST['database_name']."`";
47 47
 $table_prefix = $_POST['tableprefix'];
48 48
 $adminname = $_POST['cmsadmin'];
49 49
 $adminemail = $_POST['cmsadminemail'];
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
 // set session name variable
56 56
 if (!isset ($site_sessionname)) {
57
-    $site_sessionname = 'SN' . uniqid('');
57
+    $site_sessionname = 'SN'.uniqid('');
58 58
 }
59 59
 
60 60
 // get base path and url
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
     array_pop($a);
69 69
 $pth = implode("install", $a);
70 70
 unset ($a);
71
-$base_url = $url . (substr($url, -1) != "/" ? "/" : "");
72
-$base_path = $pth . (substr($pth, -1) != "/" ? "/" : "");
71
+$base_url = $url.(substr($url, -1) != "/" ? "/" : "");
72
+$base_path = $pth.(substr($pth, -1) != "/" ? "/" : "");
73 73
 
74 74
 // connect to the database
75
-echo "<p>". $_lang['setup_database_create_connection'];
75
+echo "<p>".$_lang['setup_database_create_connection'];
76 76
 if (!$conn = mysqli_connect($database_server, $database_user, $database_password)) {
77 77
     echo '<span class="notok">'.$_lang["setup_database_create_connection_failed"]."</span></p><p>".$_lang['setup_database_create_connection_failed_note']."</p>";
78 78
     return;
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 }
82 82
 
83 83
 // select database
84
-echo "<p>".$_lang['setup_database_selection']. str_replace("`", "", $dbase) . "`: ";
84
+echo "<p>".$_lang['setup_database_selection'].str_replace("`", "", $dbase)."`: ";
85 85
 if (!mysqli_select_db($conn, str_replace("`", "", $dbase))) {
86 86
     echo "<span class=\"notok\" style='color:#707070'>".$_lang['setup_database_selection_failed']."</span>".$_lang['setup_database_selection_failed_note']."</p>";
87 87
     $create = true;
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
 
94 94
 // try to create the database
95 95
 if ($create) {
96
-    echo "<p>".$_lang['setup_database_creation']. str_replace("`", "", $dbase) . "`: ";
96
+    echo "<p>".$_lang['setup_database_creation'].str_replace("`", "", $dbase)."`: ";
97 97
     //	if(!@mysqli_create_db(str_replace("`","",$dbase), $conn)) {
98
-    if (! mysqli_query($conn, "CREATE DATABASE $dbase DEFAULT CHARACTER SET $database_charset COLLATE $database_collation")) {
98
+    if (!mysqli_query($conn, "CREATE DATABASE $dbase DEFAULT CHARACTER SET $database_charset COLLATE $database_collation")) {
99 99
         echo '<span class="notok">'.$_lang['setup_database_creation_failed']."</span>".$_lang['setup_database_creation_failed_note']."</p>";
100 100
         $errors += 1;
101 101
 ?>
@@ -114,18 +114,18 @@  discard block
 block discarded – undo
114 114
 
115 115
 // check table prefix
116 116
 if ($installMode == 0) {
117
-    echo "<p>" . $_lang['checking_table_prefix'] . $table_prefix . "`: ";
118
-    if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) {
119
-        echo '<span class="notok">' . $_lang['failed'] . "</span>" . $_lang['table_prefix_already_inuse'] . "</p>";
117
+    echo "<p>".$_lang['checking_table_prefix'].$table_prefix."`: ";
118
+    if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) {
119
+        echo '<span class="notok">'.$_lang['failed']."</span>".$_lang['table_prefix_already_inuse']."</p>";
120 120
         $errors += 1;
121
-        echo "<p>" . $_lang['table_prefix_already_inuse_note'] . "</p>";
121
+        echo "<p>".$_lang['table_prefix_already_inuse_note']."</p>";
122 122
         return;
123 123
     } else {
124 124
         echo '<span class="ok">'.$_lang['ok']."</span></p>";
125 125
     }
126 126
 }
127 127
 
128
-if(!function_exists('parseProperties')) {
128
+if (!function_exists('parseProperties')) {
129 129
     /**
130 130
      * parses a resource property string and returns the result as an array
131 131
      * duplicate of method in documentParser class
@@ -133,20 +133,20 @@  discard block
 block discarded – undo
133 133
      * @param string $propertyString
134 134
      * @return array
135 135
      */
136
-    function parseProperties($propertyString) {
137
-        $parameter= array ();
136
+    function parseProperties($propertyString){
137
+        $parameter = array();
138 138
         if (!empty ($propertyString)) {
139
-            $tmpParams= explode("&", $propertyString);
139
+            $tmpParams = explode("&", $propertyString);
140 140
             $countParams = count($tmpParams);
141
-            for ($x= 0; $x < $countParams; $x++) {
141
+            for ($x = 0; $x < $countParams; $x++) {
142 142
                 if (strpos($tmpParams[$x], '=', 0)) {
143
-                    $pTmp= explode("=", $tmpParams[$x]);
144
-                    $pvTmp= explode(";", trim($pTmp[1]));
143
+                    $pTmp = explode("=", $tmpParams[$x]);
144
+                    $pvTmp = explode(";", trim($pTmp[1]));
145 145
                     if ($pvTmp[1] == 'list' && $pvTmp[3] != "")
146
-                        $parameter[trim($pTmp[0])]= $pvTmp[3]; //list default
146
+                        $parameter[trim($pTmp[0])] = $pvTmp[3]; //list default
147 147
                     else
148 148
                         if ($pvTmp[1] != 'list' && $pvTmp[2] != "")
149
-                            $parameter[trim($pTmp[0])]= $pvTmp[2];
149
+                            $parameter[trim($pTmp[0])] = $pvTmp[2];
150 150
                 }
151 151
             }
152 152
         }
@@ -157,20 +157,20 @@  discard block
 block discarded – undo
157 157
 // check status of Inherit Parent Template plugin
158 158
 $auto_template_logic = 'parent';
159 159
 if ($installMode != 0) {
160
-    $rs = mysqli_query($conn, "SELECT properties, disabled FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='Inherit Parent Template'");
160
+    $rs = mysqli_query($conn, "SELECT properties, disabled FROM $dbase.`".$table_prefix."site_plugins` WHERE name='Inherit Parent Template'");
161 161
     $row = mysqli_fetch_row($rs);
162
-    if(!$row) {
162
+    if (!$row) {
163 163
         // not installed
164 164
         $auto_template_logic = 'system';
165 165
     } else {
166
-        if($row[1] == 1) {
166
+        if ($row[1] == 1) {
167 167
             // installed but disabled
168 168
             $auto_template_logic = 'system';
169 169
         } else {
170 170
             // installed, enabled .. see how it's configured
171 171
             $properties = parseProperties($row[0]);
172
-            if(isset($properties['inheritTemplate'])) {
173
-                if($properties['inheritTemplate'] == 'From First Sibling') {
172
+            if (isset($properties['inheritTemplate'])) {
173
+                if ($properties['inheritTemplate'] == 'From First Sibling') {
174 174
                     $auto_template_logic = 'sibling';
175 175
                 }
176 176
             }
@@ -194,20 +194,20 @@  discard block
 block discarded – undo
194 194
 $sqlParser->connect();
195 195
 
196 196
 // install/update database
197
-echo "<p>" . $_lang['setup_database_creating_tables'];
197
+echo "<p>".$_lang['setup_database_creating_tables'];
198 198
 if ($moduleSQLBaseFile) {
199 199
     $sqlParser->process($moduleSQLBaseFile);
200 200
     // display database results
201 201
     if ($sqlParser->installFailed == true) {
202 202
         $errors += 1;
203
-        echo "<span class=\"notok\"><b>" . $_lang['database_alerts'] . "</span></p>";
204
-        echo "<p>" . $_lang['setup_couldnt_install'] . "</p>";
205
-        echo "<p>" . $_lang['installation_error_occured'] . "<br /><br />";
203
+        echo "<span class=\"notok\"><b>".$_lang['database_alerts']."</span></p>";
204
+        echo "<p>".$_lang['setup_couldnt_install']."</p>";
205
+        echo "<p>".$_lang['installation_error_occured']."<br /><br />";
206 206
         for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) {
207
-            echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />";
207
+            echo "<em>".$sqlParser->mysqlErrors[$i]["error"]."</em>".$_lang['during_execution_of_sql']."<span class='mono'>".strip_tags($sqlParser->mysqlErrors[$i]["sql"])."</span>.<hr />";
208 208
         }
209 209
         echo "</p>";
210
-        echo "<p>" . $_lang['some_tables_not_updated'] . "</p>";
210
+        echo "<p>".$_lang['some_tables_not_updated']."</p>";
211 211
         return;
212 212
     } else {
213 213
         echo '<span class="ok">'.$_lang['ok']."</span></p>";
@@ -217,12 +217,12 @@  discard block
 block discarded – undo
217 217
 // custom or not
218 218
 if (file_exists(dirname(__FILE__)."/../../assets/cache/siteManager.php")) {
219 219
     $mgrdir = 'include_once(dirname(__FILE__)."/../../assets/cache/siteManager.php");';
220
-}else{
220
+} else {
221 221
     $mgrdir = 'define(\'MGR_DIR\', \'manager\');';
222 222
 }
223 223
 
224 224
 // write the config.inc.php file if new installation
225
-echo "<p>" . $_lang['writing_config_file'];
225
+echo "<p>".$_lang['writing_config_file'];
226 226
 
227 227
 $confph = array();
228 228
 $confph['database_server']    = $database_server;
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 $chmodSuccess = @chmod($filename, 0404);
255 255
 
256 256
 if ($configFileFailed == true) {
257
-    echo '<span class="notok">' . $_lang['failed'] . "</span></p>";
257
+    echo '<span class="notok">'.$_lang['failed']."</span></p>";
258 258
     $errors += 1;
259 259
 ?>
260 260
     <p><?php echo $_lang['cant_write_config_file']?><span class="mono"><?php echo MGR_DIR; ?>/includes/config.inc.php</span></p>
@@ -271,35 +271,35 @@  discard block
 block discarded – undo
271 271
 // generate new site_id and set manager theme to default
272 272
 if ($installMode == 0) {
273 273
     $siteid = uniqid('');
274
-    mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')");
274
+    mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')");
275 275
 } else {
276 276
     // update site_id if missing
277
-    $ds = mysqli_query($sqlParser->conn, "SELECT setting_name,setting_value FROM $dbase.`" . $table_prefix . "system_settings` WHERE setting_name='site_id'");
277
+    $ds = mysqli_query($sqlParser->conn, "SELECT setting_name,setting_value FROM $dbase.`".$table_prefix."system_settings` WHERE setting_name='site_id'");
278 278
     if ($ds) {
279 279
         $r = mysqli_fetch_assoc($ds);
280 280
         $siteid = $r['setting_value'];
281 281
         if ($siteid == '' || $siteid = 'MzGeQ2faT4Dw06+U49x3') {
282 282
             $siteid = uniqid('');
283
-            mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')");
283
+            mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')");
284 284
         }
285 285
     }
286 286
 }
287 287
 
288 288
 // Reset database for installation of demo-site
289 289
 if ($installData && $moduleSQLDataFile && $moduleSQLResetFile) {
290
-	echo "<p>" . $_lang['resetting_database'];
290
+	echo "<p>".$_lang['resetting_database'];
291 291
 	$sqlParser->process($moduleSQLResetFile);
292 292
 	// display database results
293 293
 	if ($sqlParser->installFailed == true) {
294 294
 		$errors += 1;
295
-		echo "<span class=\"notok\"><b>" . $_lang['database_alerts'] . "</span></p>";
296
-		echo "<p>" . $_lang['setup_couldnt_install'] . "</p>";
297
-		echo "<p>" . $_lang['installation_error_occured'] . "<br /><br />";
295
+		echo "<span class=\"notok\"><b>".$_lang['database_alerts']."</span></p>";
296
+		echo "<p>".$_lang['setup_couldnt_install']."</p>";
297
+		echo "<p>".$_lang['installation_error_occured']."<br /><br />";
298 298
 		for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) {
299
-			echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />";
299
+			echo "<em>".$sqlParser->mysqlErrors[$i]["error"]."</em>".$_lang['during_execution_of_sql']."<span class='mono'>".strip_tags($sqlParser->mysqlErrors[$i]["sql"])."</span>.<hr />";
300 300
 		}
301 301
 		echo "</p>";
302
-		echo "<p>" . $_lang['some_tables_not_updated'] . "</p>";
302
+		echo "<p>".$_lang['some_tables_not_updated']."</p>";
303 303
 		return;
304 304
 	} else {
305 305
 		echo '<span class="ok">'.$_lang['ok']."</span></p>";
@@ -308,11 +308,11 @@  discard block
 block discarded – undo
308 308
 
309 309
 // Install Templates
310 310
 if (isset ($_POST['template']) || $installData) {
311
-    echo "<h3>" . $_lang['templates'] . ":</h3> ";
311
+    echo "<h3>".$_lang['templates'].":</h3> ";
312 312
     $selTemplates = $_POST['template'];
313 313
     foreach ($moduleTemplates as $k=>$moduleTemplate) {
314 314
         $installSample = in_array('sample', $moduleTemplate[6]) && $installData == 1;
315
-        if($installSample || in_array($k, $selTemplates)) {
315
+        if ($installSample || in_array($k, $selTemplates)) {
316 316
             $name = mysqli_real_escape_string($conn, $moduleTemplate[0]);
317 317
             $desc = mysqli_real_escape_string($conn, $moduleTemplate[1]);
318 318
             $category = mysqli_real_escape_string($conn, $moduleTemplate[4]);
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
             $filecontent = $moduleTemplate[3];
321 321
             $save_sql_id_as = $moduleTemplate[7]; // Nessecary for demo-site
322 322
             if (!file_exists($filecontent)) {
323
-                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_template'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
323
+                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">".$_lang['unable_install_template']." '$filecontent' ".$_lang['not_found'].".</span></p>";
324 324
             } else {
325 325
                 // Create the category if it does not already exist
326 326
                 $category_id = getCreateDbCategory($category, $sqlParser);
@@ -330,31 +330,31 @@  discard block
 block discarded – undo
330 330
                 $template = mysqli_real_escape_string($conn, $template);
331 331
 
332 332
                 // See if the template already exists
333
-                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name'");
333
+                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name'");
334 334
 
335 335
                 if (mysqli_num_rows($rs)) {
336
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;")) {
336
+                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;")) {
337 337
                         $errors += 1;
338
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
338
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
339 339
                         return;
340 340
                     }
341
-                    if(!is_null($save_sql_id_as)) {
341
+                    if (!is_null($save_sql_id_as)) {
342 342
                         $sql_id = @mysqli_insert_id($sqlParser->conn);
343
-                        if(!$sql_id) {
344
-                            $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name' LIMIT 1;"));
343
+                        if (!$sql_id) {
344
+                            $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name' LIMIT 1;"));
345 345
                             $sql_id = $idQuery['id'];
346 346
                         }
347 347
                         $custom_placeholders[$save_sql_id_as] = $sql_id;
348 348
                     }
349
-                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>";
349
+                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['upgraded']."</span></p>";
350 350
                 } else {
351
-                    if (!@ mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) {
351
+                    if (!@ mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) {
352 352
                         $errors += 1;
353
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
353
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
354 354
                         return;
355 355
                     }
356
-                    if(!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn);
357
-                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>";
356
+                    if (!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn);
357
+                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['installed']."</span></p>";
358 358
                 }
359 359
             }
360 360
         }
@@ -363,11 +363,11 @@  discard block
 block discarded – undo
363 363
 
364 364
 // Install Template Variables
365 365
 if (isset ($_POST['tv']) || $installData) {
366
-    echo "<h3>" . $_lang['tvs'] . ":</h3> ";
366
+    echo "<h3>".$_lang['tvs'].":</h3> ";
367 367
     $selTVs = $_POST['tv'];
368 368
     foreach ($moduleTVs as $k=>$moduleTV) {
369 369
         $installSample = in_array('sample', $moduleTV[12]) && $installData == 1;
370
-        if($installSample || in_array($k, $selTVs)) {
370
+        if ($installSample || in_array($k, $selTVs)) {
371 371
             $name = mysqli_real_escape_string($conn, $moduleTV[0]);
372 372
             $caption = mysqli_real_escape_string($conn, $moduleTV[1]);
373 373
             $desc = mysqli_real_escape_string($conn, $moduleTV[2]);
@@ -385,25 +385,25 @@  discard block
 block discarded – undo
385 385
             // Create the category if it does not already exist
386 386
             $category = getCreateDbCategory($category, $sqlParser);
387 387
 
388
-            $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name'");
388
+            $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name'");
389 389
             if (mysqli_num_rows($rs)) {
390 390
                 $insert = true;
391
-                while($row = mysqli_fetch_assoc($rs)) {
392
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};")) {
393
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
391
+                while ($row = mysqli_fetch_assoc($rs)) {
392
+                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};")) {
393
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
394 394
                         return;
395 395
                     }
396 396
                     $insert = false;
397 397
                 }
398
-                echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>";
398
+                echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['upgraded']."</span></p>";
399 399
             } else {
400 400
                 //$q = "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',(SELECT (CASE COUNT(*) WHEN 0 THEN 0 ELSE `id` END) `id` FROM $dbase.`" . $table_prefix . "categories` WHERE `category` = '$category'),$locked,'$input_options','$output_widget','$output_widget_params','$input_default');";
401
-                $q = "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',$category,$locked,'$input_options','$output_widget','$output_widget_params','$input_default');";
401
+                $q = "INSERT INTO $dbase.`".$table_prefix."site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',$category,$locked,'$input_options','$output_widget','$output_widget_params','$input_default');";
402 402
                 if (!mysqli_query($sqlParser->conn, $q)) {
403
-                    echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
403
+                    echo "<p>".mysqli_error($sqlParser->conn)."</p>";
404 404
                     return;
405 405
                 }
406
-                echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>";
406
+                echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['installed']."</span></p>";
407 407
             }
408 408
 
409 409
             // add template assignments
@@ -412,10 +412,10 @@  discard block
 block discarded – undo
412 412
             if (count($assignments) > 0) {
413 413
 
414 414
                 // remove existing tv -> template assignments
415
-                $ds=mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';");
415
+                $ds = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';");
416 416
                 $row = mysqli_fetch_assoc($ds);
417 417
                 $id = $row["id"];
418
-                mysqli_query($sqlParser->conn, 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_tmplvar_templates` WHERE tmplvarid = \'' . $id . '\'');
418
+                mysqli_query($sqlParser->conn, 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_tmplvar_templates` WHERE tmplvarid = \''.$id.'\'');
419 419
 
420 420
                 // add tv -> template assignments
421 421
                 foreach ($assignments as $assignment) {
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
                     if ($ds && $ts) {
425 425
                         $tRow = mysqli_fetch_assoc($ts);
426 426
                         $templateId = $tRow['id'];
427
-                        mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)");
427
+                        mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)");
428 428
                    }
429 429
                 }
430 430
             }
@@ -434,12 +434,12 @@  discard block
 block discarded – undo
434 434
 
435 435
 // Install Chunks
436 436
 if (isset ($_POST['chunk']) || $installData) {
437
-    echo "<h3>" . $_lang['chunks'] . ":</h3> ";
437
+    echo "<h3>".$_lang['chunks'].":</h3> ";
438 438
     $selChunks = $_POST['chunk'];
439 439
     foreach ($moduleChunks as $k=>$moduleChunk) {
440 440
         $installSample = in_array('sample', $moduleChunk[5]) && $installData == 1;
441 441
         $count_new_name = 0;
442
-        if($installSample || in_array($k, $selChunks)) {
442
+        if ($installSample || in_array($k, $selChunks)) {
443 443
 
444 444
             $name = mysqli_real_escape_string($conn, $moduleChunk[0]);
445 445
             $desc = mysqli_real_escape_string($conn, $moduleChunk[1]);
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
             $filecontent = $moduleChunk[2];
449 449
 
450 450
             if (!file_exists($filecontent))
451
-                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
451
+                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">".$_lang['unable_install_chunk']." '$filecontent' ".$_lang['not_found'].".</span></p>";
452 452
             else {
453 453
 
454 454
                 // Create the category if it does not already exist
@@ -456,31 +456,31 @@  discard block
 block discarded – undo
456 456
 
457 457
                 $chunk = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', file_get_contents($filecontent), 1);
458 458
                 $chunk = mysqli_real_escape_string($conn, $chunk);
459
-                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$name'");
459
+                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$name'");
460 460
                 $count_original_name = mysqli_num_rows($rs);
461
-                if($overwrite == 'false') {
462
-                    $newname = $name . '-' . str_replace('.', '_', $modx_version);
463
-                    $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$newname'");
461
+                if ($overwrite == 'false') {
462
+                    $newname = $name.'-'.str_replace('.', '_', $modx_version);
463
+                    $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$newname'");
464 464
                     $count_new_name = mysqli_num_rows($rs);
465 465
                 }
466 466
                 $update = $count_original_name > 0 && $overwrite == 'true';
467 467
                 if ($update) {
468
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
468
+                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
469 469
                         $errors += 1;
470
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
470
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
471 471
                         return;
472 472
                     }
473
-                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>";
474
-                } elseif($count_new_name == 0) {
475
-                    if($count_original_name > 0 && $overwrite == 'false') {
473
+                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['upgraded']."</span></p>";
474
+                } elseif ($count_new_name == 0) {
475
+                    if ($count_original_name > 0 && $overwrite == 'false') {
476 476
                         $name = $newname;
477 477
                     }
478
-                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) {
478
+                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) {
479 479
                         $errors += 1;
480
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
480
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
481 481
                         return;
482 482
                     }
483
-                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>";
483
+                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['installed']."</span></p>";
484 484
                 }
485 485
             }
486 486
         }
@@ -489,11 +489,11 @@  discard block
 block discarded – undo
489 489
 
490 490
 // Install Modules
491 491
 if (isset ($_POST['module']) || $installData) {
492
-    echo "<h3>" . $_lang['modules'] . ":</h3> ";
492
+    echo "<h3>".$_lang['modules'].":</h3> ";
493 493
     $selModules = $_POST['module'];
494 494
     foreach ($moduleModules as $k=>$moduleModule) {
495 495
         $installSample = in_array('sample', $moduleModule[7]) && $installData == 1;
496
-        if($installSample || in_array($k, $selModules)) {
496
+        if ($installSample || in_array($k, $selModules)) {
497 497
             $name = mysqli_real_escape_string($conn, $moduleModule[0]);
498 498
             $desc = mysqli_real_escape_string($conn, $moduleModule[1]);
499 499
             $filecontent = $moduleModule[2];
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
             $shared = mysqli_real_escape_string($conn, $moduleModule[5]);
503 503
             $category = mysqli_real_escape_string($conn, $moduleModule[6]);
504 504
             if (!file_exists($filecontent))
505
-                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
505
+                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">".$_lang['unable_install_module']." '$filecontent' ".$_lang['not_found'].".</span></p>";
506 506
             else {
507 507
 
508 508
                 // Create the category if it does not already exist
@@ -511,22 +511,22 @@  discard block
 block discarded – undo
511 511
                 $module = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2));
512 512
                 // $module = removeDocblock($module, 'module'); // Modules have no fileBinding, keep docblock for info-tab
513 513
                 $module = mysqli_real_escape_string($conn, $module);
514
-                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_modules` WHERE name='$name'");
514
+                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_modules` WHERE name='$name'");
515 515
                 if (mysqli_num_rows($rs)) {
516 516
                     $row = mysqli_fetch_assoc($rs);
517
-                    $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
518
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
519
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
517
+                    $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
518
+                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
519
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
520 520
                         return;
521 521
                     }
522
-                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>";
522
+                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['upgraded']."</span></p>";
523 523
                 } else {
524 524
                     $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
525
-                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) {
526
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
525
+                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) {
526
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
527 527
                         return;
528 528
                     }
529
-                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>";
529
+                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['installed']."</span></p>";
530 530
                 }
531 531
             }
532 532
         }
@@ -535,11 +535,11 @@  discard block
 block discarded – undo
535 535
 
536 536
 // Install Plugins
537 537
 if (isset ($_POST['plugin']) || $installData) {
538
-    echo "<h3>" . $_lang['plugins'] . ":</h3> ";
538
+    echo "<h3>".$_lang['plugins'].":</h3> ";
539 539
     $selPlugs = $_POST['plugin'];
540 540
     foreach ($modulePlugins as $k=>$modulePlugin) {
541 541
         $installSample = in_array('sample', $modulePlugin[8]) && $installData == 1;
542
-        if($installSample || in_array($k, $selPlugs)) {
542
+        if ($installSample || in_array($k, $selPlugs)) {
543 543
             $name = mysqli_real_escape_string($conn, $modulePlugin[0]);
544 544
             $desc = mysqli_real_escape_string($conn, $modulePlugin[1]);
545 545
             $filecontent = $modulePlugin[2];
@@ -549,17 +549,17 @@  discard block
 block discarded – undo
549 549
             $category = mysqli_real_escape_string($conn, $modulePlugin[6]);
550 550
             $leg_names = '';
551 551
             $disabled = $modulePlugin[9];
552
-            if(array_key_exists(7, $modulePlugin)) {
552
+            if (array_key_exists(7, $modulePlugin)) {
553 553
                 // parse comma-separated legacy names and prepare them for sql IN clause
554
-                $leg_names = "'" . implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))) . "'";
554
+                $leg_names = "'".implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7])))."'";
555 555
             }
556 556
             if (!file_exists($filecontent))
557
-                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
557
+                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">".$_lang['unable_install_plugin']." '$filecontent' ".$_lang['not_found'].".</span></p>";
558 558
             else {
559 559
 
560 560
                 // disable legacy versions based on legacy_names provided
561
-                if(!empty($leg_names)) {
562
-                    $update_query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
561
+                if (!empty($leg_names)) {
562
+                    $update_query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
563 563
                     $rs = mysqli_query($sqlParser->conn, $update_query);
564 564
                 }
565 565
 
@@ -569,50 +569,50 @@  discard block
 block discarded – undo
569 569
                 $plugin = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2));
570 570
                 $plugin = removeDocblock($plugin, 'plugin');
571 571
                 $plugin = mysqli_real_escape_string($conn, $plugin);
572
-                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='$name'");
572
+                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name'");
573 573
                 if (mysqli_num_rows($rs)) {
574 574
                     $insert = true;
575
-                    while($row = mysqli_fetch_assoc($rs)) {
576
-                        $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
577
-                        if($row['description'] == $desc){
578
-                            if (! mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) {
579
-                                echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
575
+                    while ($row = mysqli_fetch_assoc($rs)) {
576
+                        $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
577
+                        if ($row['description'] == $desc) {
578
+                            if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) {
579
+                                echo "<p>".mysqli_error($sqlParser->conn)."</p>";
580 580
                                 return;
581 581
                             }
582 582
                             $insert = false;
583 583
                         } else {
584
-                            if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};")) {
584
+                            if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE id={$row['id']};")) {
585 585
                                 echo "<p>".mysqli_error($sqlParser->conn)."</p>";
586 586
                                 return;
587 587
                             }
588 588
                         }
589 589
                     }
590
-                    if($insert === true) {
591
-                        $properties = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
592
-                        if(!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);")) {
590
+                    if ($insert === true) {
591
+                        $properties = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
592
+                        if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);")) {
593 593
                             echo "<p>".mysqli_error($sqlParser->conn)."</p>";
594 594
                             return;
595 595
                         }
596 596
                     }
597
-                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>";
597
+                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['upgraded']."</span></p>";
598 598
                 } else {
599 599
                     $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
600
-                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) {
601
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
600
+                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) {
601
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
602 602
                         return;
603 603
                     }
604
-                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>";
604
+                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['installed']."</span></p>";
605 605
                 }
606 606
                 // add system events
607 607
                 if (count($events) > 0) {
608
-                    $ds=mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';");
608
+                    $ds = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';");
609 609
                     if ($ds) {
610 610
                         $row = mysqli_fetch_assoc($ds);
611 611
                         $id = $row["id"];
612 612
                         // remove existing events
613
-                        mysqli_query($sqlParser->conn, 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_plugin_events` WHERE pluginid = \'' . $id . '\'');
613
+                        mysqli_query($sqlParser->conn, 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_plugin_events` WHERE pluginid = \''.$id.'\'');
614 614
                         // add new events
615
-                        mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_plugin_events` (pluginid, evtid) SELECT '$id' as 'pluginid',se.id as 'evtid' FROM $dbase.`" . $table_prefix . "system_eventnames` se WHERE name IN ('" . implode("','", $events) . "')");
615
+                        mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugin_events` (pluginid, evtid) SELECT '$id' as 'pluginid',se.id as 'evtid' FROM $dbase.`".$table_prefix."system_eventnames` se WHERE name IN ('".implode("','", $events)."')");
616 616
                     }
617 617
                 }
618 618
             }
@@ -622,18 +622,18 @@  discard block
 block discarded – undo
622 622
 
623 623
 // Install Snippets
624 624
 if (isset ($_POST['snippet']) || $installData) {
625
-    echo "<h3>" . $_lang['snippets'] . ":</h3> ";
625
+    echo "<h3>".$_lang['snippets'].":</h3> ";
626 626
     $selSnips = $_POST['snippet'];
627 627
     foreach ($moduleSnippets as $k=>$moduleSnippet) {
628 628
         $installSample = in_array('sample', $moduleSnippet[5]) && $installData == 1;
629
-        if($installSample || in_array($k, $selSnips)) {
629
+        if ($installSample || in_array($k, $selSnips)) {
630 630
             $name = mysqli_real_escape_string($conn, $moduleSnippet[0]);
631 631
             $desc = mysqli_real_escape_string($conn, $moduleSnippet[1]);
632 632
             $filecontent = $moduleSnippet[2];
633 633
             $properties = $moduleSnippet[3];
634 634
             $category = mysqli_real_escape_string($conn, $moduleSnippet[4]);
635 635
             if (!file_exists($filecontent))
636
-                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">" . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . ".</span></p>";
636
+                echo "<p>&nbsp;&nbsp;$name: <span class=\"notok\">".$_lang['unable_install_snippet']." '$filecontent' ".$_lang['not_found'].".</span></p>";
637 637
             else {
638 638
 
639 639
                 // Create the category if it does not already exist
@@ -642,22 +642,22 @@  discard block
 block discarded – undo
642 642
                 $snippet = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent)));
643 643
                 $snippet = removeDocblock($snippet, 'snippet');
644 644
                 $snippet = mysqli_real_escape_string($conn, $snippet);
645
-                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_snippets` WHERE name='$name'");
645
+                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_snippets` WHERE name='$name'");
646 646
                 if (mysqli_num_rows($rs)) {
647 647
                     $row = mysqli_fetch_assoc($rs);
648
-                    $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
649
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
650
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
648
+                    $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
649
+                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
650
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
651 651
                         return;
652 652
                     }
653
-                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['upgraded'] . "</span></p>";
653
+                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['upgraded']."</span></p>";
654 654
                 } else {
655 655
                     $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
656
-                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) {
657
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
656
+                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) {
657
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
658 658
                         return;
659 659
                     }
660
-                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">" . $_lang['installed'] . "</span></p>";
660
+                    echo "<p>&nbsp;&nbsp;$name: <span class=\"ok\">".$_lang['installed']."</span></p>";
661 661
                 }
662 662
             }
663 663
         }
@@ -666,24 +666,24 @@  discard block
 block discarded – undo
666 666
 
667 667
 // Install demo-site
668 668
 if ($installData && $moduleSQLDataFile) {
669
-    echo "<p>" . $_lang['installing_demo_site'];
669
+    echo "<p>".$_lang['installing_demo_site'];
670 670
     $sqlParser->process($moduleSQLDataFile);
671 671
     // display database results
672 672
     if ($sqlParser->installFailed == true) {
673 673
         $errors += 1;
674
-        echo "<span class=\"notok\"><b>" . $_lang['database_alerts'] . "</span></p>";
675
-        echo "<p>" . $_lang['setup_couldnt_install'] . "</p>";
676
-        echo "<p>" . $_lang['installation_error_occured'] . "<br /><br />";
674
+        echo "<span class=\"notok\"><b>".$_lang['database_alerts']."</span></p>";
675
+        echo "<p>".$_lang['setup_couldnt_install']."</p>";
676
+        echo "<p>".$_lang['installation_error_occured']."<br /><br />";
677 677
         for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) {
678
-            echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />";
678
+            echo "<em>".$sqlParser->mysqlErrors[$i]["error"]."</em>".$_lang['during_execution_of_sql']."<span class='mono'>".strip_tags($sqlParser->mysqlErrors[$i]["sql"])."</span>.<hr />";
679 679
         }
680 680
         echo "</p>";
681
-        echo "<p>" . $_lang['some_tables_not_updated'] . "</p>";
681
+        echo "<p>".$_lang['some_tables_not_updated']."</p>";
682 682
         return;
683 683
     } else {
684 684
         $sql = sprintf("SELECT id FROM `%ssite_templates` WHERE templatename='EVO startup - Bootstrap'", $sqlParser->prefix);
685 685
         $rs = mysqli_query($sqlParser->conn, $sql);
686
-        if(mysqli_num_rows($rs)) {
686
+        if (mysqli_num_rows($rs)) {
687 687
             $row = mysqli_fetch_assoc($rs);
688 688
             $sql = sprintf('UPDATE `%ssite_content` SET template=%s WHERE template=4', $sqlParser->prefix, $row['id']);
689 689
             mysqli_query($sqlParser->conn, $sql);
@@ -694,9 +694,9 @@  discard block
 block discarded – undo
694 694
 
695 695
 // Install Dependencies
696 696
 foreach ($moduleDependencies as $dependency) {
697
-	$ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_modules` WHERE name="' . $dependency['module'] . '"');
697
+	$ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM '.$dbase.'`'.$sqlParser->prefix.'site_modules` WHERE name="'.$dependency['module'].'"');
698 698
 	if (!$ds) {
699
-		echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
699
+		echo "<p>".mysqli_error($sqlParser->conn)."</p>";
700 700
 		return;
701 701
 	} else {
702 702
 		$row = mysqli_fetch_assoc($ds);
@@ -704,37 +704,37 @@  discard block
 block discarded – undo
704 704
 		$moduleGuid = $row["guid"];
705 705
 	}
706 706
 	// get extra id
707
-	$ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE ' . $dependency['column'] . '="' . $dependency['name'] . '"');
707
+	$ds = mysqli_query($sqlParser->conn, 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE '.$dependency['column'].'="'.$dependency['name'].'"');
708 708
 	if (!$ds) {
709
-		echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
709
+		echo "<p>".mysqli_error($sqlParser->conn)."</p>";
710 710
 		return;
711 711
 	} else {
712 712
 		$row = mysqli_fetch_assoc($ds);
713 713
 		$extraId = $row["id"];
714 714
 	}
715 715
 	// setup extra as module dependency
716
-	$ds = mysqli_query($sqlParser->conn, 'SELECT module FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type'] . ' LIMIT 1');
716
+	$ds = mysqli_query($sqlParser->conn, 'SELECT module FROM '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type'].' LIMIT 1');
717 717
 	if (!$ds) {
718
-		echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
718
+		echo "<p>".mysqli_error($sqlParser->conn)."</p>";
719 719
 		return;
720 720
 	} else {
721 721
 		if (mysqli_num_rows($ds) === 0) {
722
-			mysqli_query($sqlParser->conn, 'INSERT INTO ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` (module, resource, type) VALUES(' . $moduleId . ',' . $extraId . ',' . $dependency['type'] . ')');
723
-			echo '<p>&nbsp;&nbsp;' . $dependency['module'] . ' Module: <span class="ok">' . $_lang['depedency_create'] . '</span></p>';
722
+			mysqli_query($sqlParser->conn, 'INSERT INTO '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` (module, resource, type) VALUES('.$moduleId.','.$extraId.','.$dependency['type'].')');
723
+			echo '<p>&nbsp;&nbsp;'.$dependency['module'].' Module: <span class="ok">'.$_lang['depedency_create'].'</span></p>';
724 724
 		} else {
725
-			mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` SET module = ' . $moduleId . ', resource = ' . $extraId . ', type = ' . $dependency['type'] . ' WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type']);
726
-			echo '<p>&nbsp;&nbsp;' . $dependency['module'] . ' Module: <span class="ok">' . $_lang['depedency_update'] . '</span></p>';
725
+			mysqli_query($sqlParser->conn, 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` SET module = '.$moduleId.', resource = '.$extraId.', type = '.$dependency['type'].' WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type']);
726
+			echo '<p>&nbsp;&nbsp;'.$dependency['module'].' Module: <span class="ok">'.$_lang['depedency_update'].'</span></p>';
727 727
 		}
728 728
 		if ($dependency['type'] == 30 || $dependency['type'] == 40) {
729 729
 			// set extra guid for plugins and snippets
730
-			$ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE id=' . $extraId . ' LIMIT 1');
730
+			$ds = mysqli_query($sqlParser->conn, 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE id='.$extraId.' LIMIT 1');
731 731
 			if (!$ds) {
732
-				echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
732
+				echo "<p>".mysqli_error($sqlParser->conn)."</p>";
733 733
 				return;
734 734
 			} else {
735 735
 				if (mysqli_num_rows($ds) != 0) {
736
-					mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` SET moduleguid = ' . $moduleGuid . ' WHERE id=' . $extraId);
737
-					echo '<p>&nbsp;&nbsp;' . $dependency['name'] . ': <span class="ok">' . $_lang['guid_set'] . '</span></p>';
736
+					mysqli_query($sqlParser->conn, 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` SET moduleguid = '.$moduleGuid.' WHERE id='.$extraId);
737
+					echo '<p>&nbsp;&nbsp;'.$dependency['name'].': <span class="ok">'.$_lang['guid_set'].'</span></p>';
738 738
 				}
739 739
 			}
740 740
 		}
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
 
744 744
 // call back function
745 745
 if ($callBackFnc != "")
746
-    $callBackFnc ($sqlParser);
746
+    $callBackFnc($sqlParser);
747 747
 
748 748
 // Setup the MODX API -- needed for the cache processor
749 749
 define('MODX_API_MODE', true);
@@ -778,12 +778,12 @@  discard block
 block discarded – undo
778 778
 }
779 779
 
780 780
 // setup completed!
781
-echo "<p><b>" . $_lang['installation_successful'] . "</b></p>";
782
-echo "<p>" . $_lang['to_log_into_content_manager'] . "</p>";
781
+echo "<p><b>".$_lang['installation_successful']."</b></p>";
782
+echo "<p>".$_lang['to_log_into_content_manager']."</p>";
783 783
 if ($installMode == 0) {
784
-    echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />" . $_lang['installation_note'] . "</p>";
784
+    echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />".$_lang['installation_note']."</p>";
785 785
 } else {
786
-    echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />" . $_lang['upgrade_note'] . "</p>";
786
+    echo "<p><img src=\"img/ico_info.png\" width=\"40\" height=\"42\" align=\"left\" style=\"margin-right:10px;\" />".$_lang['upgrade_note']."</p>";
787 787
 }
788 788
 
789 789
 /**
@@ -793,11 +793,11 @@  discard block
 block discarded – undo
793 793
  * @param string $old
794 794
  * @return string
795 795
  */
796
-function propUpdate($new,$old){
796
+function propUpdate($new, $old){
797 797
     $newArr = parseProperties($new);
798 798
     $oldArr = parseProperties($old);
799
-    foreach ($oldArr as $k => $v){
800
-        if (isset($v['0']['options'])){
799
+    foreach ($oldArr as $k => $v) {
800
+        if (isset($v['0']['options'])) {
801 801
             $oldArr[$k]['0']['options'] = $newArr[$k]['0']['options'];
802 802
         }
803 803
     }
@@ -812,30 +812,30 @@  discard block
 block discarded – undo
812 812
  * @param bool|mixed $json
813 813
  * @return string
814 814
  */
815
-function parseProperties($propertyString, $json=false) {
816
-    $propertyString = str_replace('{}', '', $propertyString );
817
-    $propertyString = str_replace('} {', ',', $propertyString );
815
+function parseProperties($propertyString, $json = false){
816
+    $propertyString = str_replace('{}', '', $propertyString);
817
+    $propertyString = str_replace('} {', ',', $propertyString);
818 818
 
819
-    if(empty($propertyString)) return array();
820
-    if($propertyString=='{}' || $propertyString=='[]') return array();
819
+    if (empty($propertyString)) return array();
820
+    if ($propertyString == '{}' || $propertyString == '[]') return array();
821 821
 
822 822
     $jsonFormat = isJson($propertyString, true);
823 823
     $property = array();
824 824
     // old format
825
-    if ( $jsonFormat === false) {
826
-        $props= explode('&', $propertyString);
825
+    if ($jsonFormat === false) {
826
+        $props = explode('&', $propertyString);
827 827
         foreach ($props as $prop) {
828 828
             $prop = trim($prop);
829
-            if($prop === '') {
829
+            if ($prop === '') {
830 830
                 continue;
831 831
             }
832 832
 
833 833
             $arr = explode(';', $prop);
834
-            if( ! is_array($arr)) {
834
+            if (!is_array($arr)) {
835 835
                 $arr = array();
836 836
             }
837 837
             $key = explode('=', isset($arr[0]) ? $arr[0] : '');
838
-            if( ! is_array($key) || empty($key[0])) {
838
+            if (!is_array($key) || empty($key[0])) {
839 839
                 continue;
840 840
             }
841 841
 
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
 
860 860
         }
861 861
     // new json-format
862
-    } else if(!empty($jsonFormat)){
862
+    } else if (!empty($jsonFormat)) {
863 863
         $property = $jsonFormat;
864 864
     }
865 865
     if ($json) {
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
  * @param bool $returnData
875 875
  * @return bool|mixed
876 876
  */
877
-function isJson($string, $returnData=false) {
877
+function isJson($string, $returnData = false){
878 878
     $data = json_decode($string, true);
879 879
     return (json_last_error() == JSON_ERROR_NONE) ? ($returnData ? $data : true) : false;
880 880
 }
@@ -884,20 +884,20 @@  discard block
 block discarded – undo
884 884
  * @param SqlParser $sqlParser
885 885
  * @return int
886 886
  */
887
-function getCreateDbCategory($category, $sqlParser) {
887
+function getCreateDbCategory($category, $sqlParser){
888 888
     $dbase = $sqlParser->dbname;
889
-    $dbase = '`' . trim($dbase,'`') . '`';
889
+    $dbase = '`'.trim($dbase, '`').'`';
890 890
     $table_prefix = $sqlParser->prefix;
891 891
     $category_id = 0;
892
-    if(!empty($category)) {
892
+    if (!empty($category)) {
893 893
         $category = mysqli_real_escape_string($sqlParser->conn, $category);
894 894
         $rs = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."categories` WHERE category = '".$category."'");
895
-        if(mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) {
895
+        if (mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) {
896 896
             $category_id = $row['id'];
897 897
         } else {
898 898
             $q = "INSERT INTO $dbase.`".$table_prefix."categories` (`category`) VALUES ('{$category}');";
899 899
             $rs = mysqli_query($sqlParser->conn, $q);
900
-            if($rs) {
900
+            if ($rs) {
901 901
                 $category_id = mysqli_insert_id($sqlParser->conn);
902 902
             }
903 903
         }
@@ -912,12 +912,12 @@  discard block
 block discarded – undo
912 912
  * @param string $type
913 913
  * @return string
914 914
  */
915
-function removeDocblock($code, $type) {
915
+function removeDocblock($code, $type){
916 916
 
917 917
     $cleaned = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', $code, 1);
918 918
 
919 919
     // Procedure taken from plugin.filesource.php
920
-    switch($type) {
920
+    switch ($type) {
921 921
         case 'snippet':
922 922
             $elm_name = 'snippets';
923 923
             $include = 'return require';
@@ -933,7 +933,7 @@  discard block
 block discarded – undo
933 933
         default:
934 934
             return $cleaned;
935 935
     };
936
-    if(substr(trim($cleaned),0,$count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/')
936
+    if (substr(trim($cleaned), 0, $count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/')
937 937
         return $cleaned;
938 938
 
939 939
     // fileBinding not found - return code incl docblock
Please login to merge, or discard this patch.
manager/actions/user_management.static.php 1 patch
Spacing   +17 added lines, -17 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_user')) {
5
+if (!$modx->hasPermission('edit_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->manager->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 {
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 
27 27
 // context menu
28
-include_once MODX_MANAGER_PATH . "includes/controls/contextmenu.php";
28
+include_once MODX_MANAGER_PATH."includes/controls/contextmenu.php";
29 29
 $cm = new ContextMenu("cntxm", 150);
30 30
 $cm->addItem($_lang["edit"], "js:menuAction(1)", $_style["actions_edit"], (!$modx->hasPermission('edit_user') ? 1 : 0));
31 31
 $cm->addItem($_lang["delete"], "js:menuAction(2)", $_style["actions_delete"], (!$modx->hasPermission('delete_user') ? 1 : 0));
@@ -121,16 +121,16 @@  discard block
 block discarded – undo
121 121
 				<div class="table-responsive">
122 122
 					<?php
123 123
 					$where = "";
124
-					if(!$modx->hasPermission('save_role')) {
125
-						$where .= (empty($where) ? "" : " AND ") . "mua.role != 1";
124
+					if (!$modx->hasPermission('save_role')) {
125
+						$where .= (empty($where) ? "" : " AND ")."mua.role != 1";
126 126
 					}
127
-					if(!empty($sqlQuery)) {
128
-						$where .= (empty($where) ? "" : " AND ") . "((mu.username LIKE '{$sqlQuery}%') OR (mua.fullname LIKE '%{$sqlQuery}%') OR (mua.email LIKE '{$sqlQuery}%'))";
127
+					if (!empty($sqlQuery)) {
128
+						$where .= (empty($where) ? "" : " AND ")."((mu.username LIKE '{$sqlQuery}%') OR (mua.fullname LIKE '%{$sqlQuery}%') OR (mua.email LIKE '{$sqlQuery}%'))";
129 129
 					}
130
-					$ds = $modx->db->select("mu.id, mu.username, rname.name AS role, mua.fullname, mua.email, IF(mua.blocked,'{$_lang['yes']}','-') as blocked, mua.thislogin, mua.logincount", $modx->getFullTableName('manager_users') . " AS mu 
131
-			INNER JOIN " . $modx->getFullTableName('user_attributes') . " AS mua ON mua.internalKey=mu.id 
132
-			LEFT JOIN " . $modx->getFullTableName('user_roles') . " AS rname ON mua.role=rname.id", $where, 'mua.blocked ASC, mua.thislogin DESC');
133
-					include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php";
130
+					$ds = $modx->db->select("mu.id, mu.username, rname.name AS role, mua.fullname, mua.email, IF(mua.blocked,'{$_lang['yes']}','-') as blocked, mua.thislogin, mua.logincount", $modx->getFullTableName('manager_users')." AS mu 
131
+			INNER JOIN " . $modx->getFullTableName('user_attributes')." AS mua ON mua.internalKey=mu.id 
132
+			LEFT JOIN " . $modx->getFullTableName('user_roles')." AS rname ON mua.role=rname.id", $where, 'mua.blocked ASC, mua.thislogin DESC');
133
+					include_once MODX_MANAGER_PATH."includes/controls/datagrid.class.php";
134 134
 					$grd = new DataGrid('', $ds, $modx->config['number_of_results']); // set page size to 0 t show all items
135 135
 					$grd->noRecordMsg = $_lang["no_records_found"];
136 136
 					$grd->cssClass = "table data";
@@ -151,19 +151,19 @@  discard block
 block discarded – undo
151 151
 					$grd->colWidths = "1%,,,,,1%,1%,1%";
152 152
 					$grd->colAligns = "center,,,,,right' nowrap='nowrap,right,center";
153 153
 					$grd->colTypes = implode('||', array(
154
-						'template:<a class="gridRowIcon" href="javascript:;" onclick="return showContentMenu([+id+],event);" title="' . $_lang['click_to_context'] . '"><i class="' . $_style['icons_user'] . '"></i></a>',
155
-						'template:<a href="index.php?a=12&id=[+id+]" title="' . $_lang['click_to_edit_title'] . '">[+value+]</a>',
154
+						'template:<a class="gridRowIcon" href="javascript:;" onclick="return showContentMenu([+id+],event);" title="'.$_lang['click_to_context'].'"><i class="'.$_style['icons_user'].'"></i></a>',
155
+						'template:<a href="index.php?a=12&id=[+id+]" title="'.$_lang['click_to_edit_title'].'">[+value+]</a>',
156 156
 						'template:[+fullname+]',
157 157
 						'template:[+role+]',
158 158
 						'template:[+email+]',
159
-						'date: ' . $modx->toDateFormat('[+thislogin+]', 'formatOnly') . ' %H:%M',
159
+						'date: '.$modx->toDateFormat('[+thislogin+]', 'formatOnly').' %H:%M',
160 160
 						'template:[+logincount+]',
161 161
 						'template:[+blocked+]'
162 162
 					));
163
-					if($listmode == '1') {
163
+					if ($listmode == '1') {
164 164
 						$grd->pageSize = 0;
165 165
 					}
166
-					if($_REQUEST['op'] == 'reset') {
166
+					if ($_REQUEST['op'] == 'reset') {
167 167
 						$grd->pageNumber = 1;
168 168
 					}
169 169
 					// render grid
Please login to merge, or discard this patch.
manager/actions/web_user_management.static.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2
-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->manager->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 {
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 
27 27
 // context menu
28
-include_once MODX_MANAGER_PATH . "includes/controls/contextmenu.php";
28
+include_once MODX_MANAGER_PATH."includes/controls/contextmenu.php";
29 29
 $cm = new ContextMenu("cntxm", 150);
30 30
 $cm->addItem($_lang["edit"], "js:menuAction(1)", $_style["actions_edit"], (!$modx->hasPermission('edit_user') ? 1 : 0));
31 31
 $cm->addItem($_lang["delete"], "js:menuAction(2)", $_style["actions_delete"], (!$modx->hasPermission('delete_user') ? 1 : 0));
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
 			<div class="row">
121 121
 				<div class="table-responsive">
122 122
 					<?php
123
-					$ds = $modx->db->select("wu.id, wu.username, wua.fullname, wua.email, wua.lastlogin, wua.logincount, IF(wua.blocked,'{$_lang['yes']}','-') as 'blocked'", $modx->getFullTableName("web_users") . " wu 
124
-			INNER JOIN " . $modx->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');
125
-					include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php";
123
+					$ds = $modx->db->select("wu.id, wu.username, wua.fullname, wua.email, wua.lastlogin, wua.logincount, IF(wua.blocked,'{$_lang['yes']}','-') as 'blocked'", $modx->getFullTableName("web_users")." wu 
124
+			INNER JOIN " . $modx->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');
125
+					include_once MODX_MANAGER_PATH."includes/controls/datagrid.class.php";
126 126
 					$grd = new DataGrid('', $ds, $number_of_results); // set page size to 0 t show all items
127 127
 					$grd->noRecordMsg = $_lang["no_records_found"];
128 128
 					$grd->cssClass = "table data";
@@ -130,15 +130,15 @@  discard block
 block discarded – undo
130 130
 					$grd->itemClass = "tableItem";
131 131
 					$grd->altItemClass = "tableAltItem";
132 132
 					$grd->fields = "id,username,fullname,email,lastlogin,logincount,blocked";
133
-					$grd->columns = $_lang["icon"] . " ," . $_lang["name"] . " ," . $_lang["user_full_name"] . " ," . $_lang["email"] . " ," . $_lang["user_prevlogin"] . " ," . $_lang["user_logincount"] . " ," . $_lang["user_block"];
133
+					$grd->columns = $_lang["icon"]." ,".$_lang["name"]." ,".$_lang["user_full_name"]." ,".$_lang["email"]." ,".$_lang["user_prevlogin"]." ,".$_lang["user_logincount"]." ,".$_lang["user_block"];
134 134
 					$grd->colWidths = "1%,,,,1%,1%,1%";
135 135
 					$grd->colAligns = "center,,,,right' nowrap='nowrap,right,center";
136
-					$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') . 
136
+					$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'). 
137 137
 					" %H:%M";
138
-					if($listmode == '1') {
138
+					if ($listmode == '1') {
139 139
 						$grd->pageSize = 0;
140 140
 					}
141
-					if($_REQUEST['op'] == 'reset') {
141
+					if ($_REQUEST['op'] == 'reset') {
142 142
 						$grd->pageNumber = 1;
143 143
 					}
144 144
 					// render grid
Please login to merge, or discard this patch.