Completed
Pull Request — develop (#522)
by Agel_Nash
07:16
created
manager/actions/mutate_password.dynamic.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 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('change_password')) {
5
+if (!$modx->hasPermission('change_password')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 ?>
Please login to merge, or discard this patch.
manager/actions/mutate_settings.dynamic.php 1 patch
Spacing   +21 added lines, -21 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 />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
 
9
-include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/functions.inc.php');
9
+include_once(MODX_MANAGER_PATH.'actions/mutate_settings/functions.inc.php');
10 10
 
11 11
 // check to see the edit settings page isn't locked
12
-$rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=17 AND internalKey!='" . $modx->getLoginUserID() . "'");
13
-if($username = $modx->db->getValue($rs)) {
12
+$rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=17 AND internalKey!='".$modx->getLoginUserID()."'");
13
+if ($username = $modx->db->getValue($rs)) {
14 14
 	$modx->webAlertAndQuit(sprintf($_lang['lock_settings_msg'], $username));
15 15
 }
16 16
 // end check for lock
@@ -18,21 +18,21 @@  discard block
 block discarded – undo
18 18
 // reload system settings from the database.
19 19
 // this will prevent user-defined settings from being saved as system setting
20 20
 $settings = array();
21
-include_once(MODX_MANAGER_PATH . 'includes/default_config.php');
21
+include_once(MODX_MANAGER_PATH.'includes/default_config.php');
22 22
 $rs = $modx->db->select('setting_name, setting_value', '[+prefix+]system_settings');
23
-while($row = $modx->db->getRow($rs)) {
23
+while ($row = $modx->db->getRow($rs)) {
24 24
 	$settings[$row['setting_name']] = $row['setting_value'];
25 25
 }
26
-$settings['filemanager_path'] = preg_replace('@^' . preg_quote(MODX_BASE_PATH) . '@', '[(base_path)]', $settings['filemanager_path']);
27
-$settings['rb_base_dir'] = preg_replace('@^' . preg_quote(MODX_BASE_PATH) . '@', '[(base_path)]', $settings['rb_base_dir']);
26
+$settings['filemanager_path'] = preg_replace('@^'.preg_quote(MODX_BASE_PATH).'@', '[(base_path)]', $settings['filemanager_path']);
27
+$settings['rb_base_dir'] = preg_replace('@^'.preg_quote(MODX_BASE_PATH).'@', '[(base_path)]', $settings['rb_base_dir']);
28 28
 
29 29
 extract($settings, EXTR_OVERWRITE);
30 30
 
31 31
 // load languages and keys
32 32
 $lang_keys = array();
33 33
 $dir = dir('includes/lang');
34
-while($file = $dir->read()) {
35
-	if(strpos($file, '.inc.php') > 0) {
34
+while ($file = $dir->read()) {
35
+	if (strpos($file, '.inc.php') > 0) {
36 36
 		$endpos = strpos($file, '.');
37 37
 		$languagename = substr($file, 0, $endpos);
38 38
 		$lang_keys[$languagename] = get_lang_keys($file);
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 			<input type="hidden" name="site_id" value="<?php echo $site_id; ?>" />
70 70
 			<input type="hidden" name="settings_version" value="<?php echo $modx->getVersionData('version'); ?>" />
71 71
 			<!-- this field is used to check site settings have been entered/ updated after install or upgrade -->
72
-			<?php if(!isset($settings_version) || $settings_version != $modx->getVersionData('version')) { ?>
72
+			<?php if (!isset($settings_version) || $settings_version != $modx->getVersionData('version')) { ?>
73 73
 				<div class='sectionBody'><p class='element-edit-message-tab alert alert-warning'><?php echo $_lang['settings_after_install']; ?></p></div>
74 74
 			<?php } ?>
75 75
 			<div class="tab-pane" id="settingsPane">
@@ -78,13 +78,13 @@  discard block
 block discarded – undo
78 78
 				</script>
79 79
 
80 80
 				<?php
81
-				include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab1_site_settings.inc.php');
82
-				include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab2_furl_settings.inc.php');
83
-				include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab3_user_settings.inc.php');
84
-				include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab4_manager_settings.inc.php');
85
-				include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab5_security_settings.inc.php');
86
-				include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab6_filemanager_settings.inc.php');
87
-				include_once(MODX_MANAGER_PATH . 'actions/mutate_settings/tab7_filebrowser_settings.inc.php');
81
+				include_once(MODX_MANAGER_PATH.'actions/mutate_settings/tab1_site_settings.inc.php');
82
+				include_once(MODX_MANAGER_PATH.'actions/mutate_settings/tab2_furl_settings.inc.php');
83
+				include_once(MODX_MANAGER_PATH.'actions/mutate_settings/tab3_user_settings.inc.php');
84
+				include_once(MODX_MANAGER_PATH.'actions/mutate_settings/tab4_manager_settings.inc.php');
85
+				include_once(MODX_MANAGER_PATH.'actions/mutate_settings/tab5_security_settings.inc.php');
86
+				include_once(MODX_MANAGER_PATH.'actions/mutate_settings/tab6_filemanager_settings.inc.php');
87
+				include_once(MODX_MANAGER_PATH.'actions/mutate_settings/tab7_filebrowser_settings.inc.php');
88 88
 				?>
89 89
 			</div>
90 90
 		</div>
@@ -131,6 +131,6 @@  discard block
 block discarded – undo
131 131
 		});
132 132
 	</script>
133 133
 <?php
134
-if(is_numeric($_GET['tab'])) {
135
-	echo '<script type="text/javascript">tpSettings.setSelectedIndex( ' . $_GET['tab'] . ' );</script>';
134
+if (is_numeric($_GET['tab'])) {
135
+	echo '<script type="text/javascript">tpSettings.setSelectedIndex( '.$_GET['tab'].' );</script>';
136 136
 }
Please login to merge, or discard this patch.
manager/actions/access_permissions.dynamic.php 1 patch
Spacing   +37 added lines, -37 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('access_permissions')) {
5
+if (!$modx->hasPermission('access_permissions')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
@@ -17,23 +17,23 @@  discard block
 block discarded – undo
17 17
 
18 18
 // find all document groups, for the select :)
19 19
 $rs = $modx->db->select('*', $tbl_documentgroup_names, '', 'name');
20
-if($modx->db->getRecordCount($rs) < 1) {
20
+if ($modx->db->getRecordCount($rs) < 1) {
21 21
 	$docgroupselector = '[no groups to add]';
22 22
 } else {
23
-	$docgroupselector = '<select name="docgroup">' . "\n";
24
-	while($row = $modx->db->getRow($rs)) {
25
-		$docgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n";
23
+	$docgroupselector = '<select name="docgroup">'."\n";
24
+	while ($row = $modx->db->getRow($rs)) {
25
+		$docgroupselector .= "\t".'<option value="'.$row['id'].'">'.$row['name']."</option>\n";
26 26
 	}
27 27
 	$docgroupselector .= "</select>\n";
28 28
 }
29 29
 
30 30
 $rs = $modx->db->select('*', $tbl_membergroup_names, '', 'name');
31
-if($modx->db->getRecordCount($rs) < 1) {
31
+if ($modx->db->getRecordCount($rs) < 1) {
32 32
 	$usrgroupselector = '[no user groups]';
33 33
 } else {
34
-	$usrgroupselector = '<select name="usergroup">' . "\n";
35
-	while($row = $modx->db->getRow($rs)) {
36
-		$usrgroupselector .= "\t" . '<option value="' . $row['id'] . '">' . $row['name'] . "</option>\n";
34
+	$usrgroupselector = '<select name="usergroup">'."\n";
35
+	while ($row = $modx->db->getRow($rs)) {
36
+		$usrgroupselector .= "\t".'<option value="'.$row['id'].'">'.$row['name']."</option>\n";
37 37
 	}
38 38
 	$usrgroupselector .= "</select>\n";
39 39
 }
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	<div class="alert alert-info"><?= $_lang['access_permissions_introtext'] ?></div>
70 70
 </div>
71 71
 
72
-<div class="container"><?= ($use_udperms != 1 ? '<div class="alert alert-danger">' . $_lang['access_permissions_off'] . '</div>' : '') ?></div>
72
+<div class="container"><?= ($use_udperms != 1 ? '<div class="alert alert-danger">'.$_lang['access_permissions_off'].'</div>' : '') ?></div>
73 73
 
74 74
 <div class="tab-pane" id="uapPane">
75 75
 	<script type="text/javascript">
@@ -96,10 +96,10 @@  discard block
 block discarded – undo
96 96
 				</form>
97 97
 			</div>
98 98
 			<?php
99
-			$rs = $modx->db->select('groupnames.*, users.id AS user_id, users.username user_name', $tbl_membergroup_names . ' AS groupnames
100
-			LEFT JOIN ' . $tbl_member_groups . ' AS groups ON groups.user_group = groupnames.id
101
-			LEFT JOIN ' . $tbl_manager_users . ' AS users ON users.id = groups.member', '', 'groupnames.name, user_name');
102
-			if($modx->db->getRecordCount($rs) < 1) {
99
+			$rs = $modx->db->select('groupnames.*, users.id AS user_id, users.username user_name', $tbl_membergroup_names.' AS groupnames
100
+			LEFT JOIN ' . $tbl_member_groups.' AS groups ON groups.user_group = groupnames.id
101
+			LEFT JOIN ' . $tbl_manager_users.' AS users ON users.id = groups.member', '', 'groupnames.name, user_name');
102
+			if ($modx->db->getRecordCount($rs) < 1) {
103 103
 				?>
104 104
 				<div class="text-danger"><?= $_lang['no_groups_found'] ?></div>
105 105
 				<?php
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
 			<div class="form-group">
109 109
 				<?php
110 110
 				$pid = '';
111
-				while($row = $modx->db->getRow($rs)) {
112
-					if($pid != $row['id']) {
113
-						if($pid != '') {
111
+				while ($row = $modx->db->getRow($rs)) {
112
+					if ($pid != $row['id']) {
113
+						if ($pid != '') {
114 114
 							echo '</div><div class="form-group">';
115 115
 						}
116 116
 						?>
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 						<?= $_lang['access_permissions_users_in_group'] ?>
130 130
 						<?php
131 131
 					}
132
-					if(!$row['user_id']) {
132
+					if (!$row['user_id']) {
133 133
 						?>
134 134
 						<i><?= $_lang['access_permissions_no_users_in_group'] ?></i>
135 135
 						<?php
@@ -167,10 +167,10 @@  discard block
 block discarded – undo
167 167
 				</form>
168 168
 			</div>
169 169
 			<?php
170
-			$rs = $modx->db->select('dgnames.id, dgnames.name, sc.id AS doc_id, sc.pagetitle AS doc_title', $tbl_documentgroup_names . ' AS dgnames
171
-			LEFT JOIN ' . $tbl_document_groups . ' AS dg ON dg.document_group = dgnames.id
172
-			LEFT JOIN ' . $tbl_site_content . ' AS sc ON sc.id = dg.document', '', 'dgnames.name, sc.id');
173
-			if($modx->db->getRecordCount($rs) < 1) {
170
+			$rs = $modx->db->select('dgnames.id, dgnames.name, sc.id AS doc_id, sc.pagetitle AS doc_title', $tbl_documentgroup_names.' AS dgnames
171
+			LEFT JOIN ' . $tbl_document_groups.' AS dg ON dg.document_group = dgnames.id
172
+			LEFT JOIN ' . $tbl_site_content.' AS sc ON sc.id = dg.document', '', 'dgnames.name, sc.id');
173
+			if ($modx->db->getRecordCount($rs) < 1) {
174 174
 				?>
175 175
 				<div class="text-danger"><?= $_lang['no_groups_found'] ?></div>
176 176
 				<?php
@@ -179,9 +179,9 @@  discard block
 block discarded – undo
179 179
 			<div class="form-group">
180 180
 				<?php
181 181
 				$pid = '';
182
-				while($row = $modx->db->getRow($rs)) {
183
-					if($pid != $row['id']) {
184
-						if($pid != '') {
182
+				while ($row = $modx->db->getRow($rs)) {
183
+					if ($pid != $row['id']) {
184
+						if ($pid != '') {
185 185
 							echo '</div><div class="form-group">';
186 186
 						}
187 187
 						?>
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 						<?= $_lang['access_permissions_resources_in_group'] ?>
201 201
 						<?php
202 202
 					}
203
-					if(!$row['doc_id']) {
203
+					if (!$row['doc_id']) {
204 204
 						?>
205 205
 						<i><?= $_lang['access_permissions_no_resources_in_group'] ?></i>
206 206
 						<?php
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
 			<p class="element-edit-message-tab alert alert-warning"><?= $_lang['access_permissions_links_tab'] ?></p>
227 227
 			<?php
228 228
 			// User/Document Group Links
229
-			$rs = $modx->db->select('groupnames.*, groupacc.id AS link_id, dgnames.id AS dg_id, dgnames.name AS dg_name', $tbl_membergroup_names . ' AS groupnames
230
-			LEFT JOIN ' . $tbl_membergroup_access . ' AS groupacc ON groupacc.membergroup = groupnames.id
231
-			LEFT JOIN ' . $tbl_documentgroup_names . ' AS dgnames ON dgnames.id = groupacc.documentgroup', '', 'name, dg_name');
232
-			if($modx->db->getRecordCount($rs) < 1) {
229
+			$rs = $modx->db->select('groupnames.*, groupacc.id AS link_id, dgnames.id AS dg_id, dgnames.name AS dg_name', $tbl_membergroup_names.' AS groupnames
230
+			LEFT JOIN ' . $tbl_membergroup_access.' AS groupacc ON groupacc.membergroup = groupnames.id
231
+			LEFT JOIN ' . $tbl_documentgroup_names.' AS dgnames ON dgnames.id = groupacc.documentgroup', '', 'name, dg_name');
232
+			if ($modx->db->getRecordCount($rs) < 1) {
233 233
 				?>
234 234
 				<div class="text-danger"><?= $_lang['no_groups_found'] ?></div>
235 235
 				<?php
@@ -251,23 +251,23 @@  discard block
 block discarded – undo
251 251
 				<ul>
252 252
 					<?php
253 253
 					$pid = '';
254
-					while($row = $modx->db->getRow($rs)) {
255
-						if($row['id'] != $pid) {
256
-							if($pid != '') {
254
+					while ($row = $modx->db->getRow($rs)) {
255
+						if ($row['id'] != $pid) {
256
+							if ($pid != '') {
257 257
 								echo '</ul></li>';
258 258
 							} // close previous one
259 259
 							?>
260 260
 							<li><b><?= $row['name'] ?></b></li>
261 261
 							<?php
262
-							if(!$row['dg_id']) {
263
-								echo '<i>' . $_lang['no_groups_found'] . '</i></li>';
262
+							if (!$row['dg_id']) {
263
+								echo '<i>'.$_lang['no_groups_found'].'</i></li>';
264 264
 								$pid = '';
265 265
 								continue;
266 266
 							} else {
267 267
 								echo '<ul>';
268 268
 							}
269 269
 						}
270
-						if(!$row['dg_id']) {
270
+						if (!$row['dg_id']) {
271 271
 							continue;
272 272
 						}
273 273
 						?>
Please login to merge, or discard this patch.
manager/actions/search.static.php 1 patch
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     exit();
4 4
 }
5 5
 unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
                         $option[] = '<option value="">No selected</option>';
44 44
                         $templateid = (isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '') ? intval($_REQUEST['templateid']) : '';
45 45
                         $selected = $templateid === 0 ? ' selected="selected"' : '';
46
-                        $option[] = '<option value="0"' . $selected . '>(blank)</option>';
46
+                        $option[] = '<option value="0"'.$selected.'>(blank)</option>';
47 47
                         while ($row = $modx->db->getRow($rs)) {
48 48
                             $templatename = htmlspecialchars($row['templatename'], ENT_QUOTES, $modx->config['modx_charset']);
49 49
                             $selected = $row['id'] == $templateid ? ' selected="selected"' : '';
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
         $friendly_url_suffix = $modx->config['friendly_url_suffix'];
101 101
         $base_url = $modx->config['base_url'];
102 102
         $site_url = $modx->config['site_url'];
103
-        $url = preg_replace('@' . $friendly_url_suffix . '$@', '', $url);
103
+        $url = preg_replace('@'.$friendly_url_suffix.'$@', '', $url);
104 104
         if ($url[0] === '/') {
105
-            $url = preg_replace('@^' . $base_url . '@', '', $url);
105
+            $url = preg_replace('@^'.$base_url.'@', '', $url);
106 106
         }
107 107
         if (substr($url, 0, 4) === 'http') {
108
-            $url = preg_replace('@^' . $site_url . '@', '', $url);
108
+            $url = preg_replace('@^'.$site_url.'@', '', $url);
109 109
         }
110 110
         $idFromAlias = $modx->getIdFromAlias($url);
111 111
     }
@@ -118,18 +118,18 @@  discard block
 block discarded – undo
118 118
 		$articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'";
119 119
 		$articul_result = $modx->db->query($articul_query);
120 120
 		$articul_id_array = $modx->db->makeArray($articul_result);
121
-		if(count($articul_id_array)>0){
121
+		if (count($articul_id_array) > 0) {
122 122
 			$articul_id = '';
123 123
 			$i = 1;
124
-			foreach( $articul_id_array as $articul ) {
125
-				$articul_id.=$articul['contentid'];
126
-				if($i !== count($articul_id_array)){
127
-					$articul_id.=',';
124
+			foreach ($articul_id_array as $articul) {
125
+				$articul_id .= $articul['contentid'];
126
+				if ($i !== count($articul_id_array)) {
127
+					$articul_id .= ',';
128 128
 				}
129 129
 				$i++;
130 130
 			}
131 131
 		$articul_id_query = " OR sc.id IN ({$articul_id})";
132
-		}else{
132
+		} else {
133 133
 			$articul_id_query = '';
134 134
 		}
135 135
 		/*end search by TV*/
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
         if (ctype_digit($searchfields)) {
138 138
             $sqladd .= "sc.id='{$searchfields}'";
139 139
             if (strlen($searchfields) > 3) {
140
-				$sqladd .= $articul_id_query;//search by TV
140
+				$sqladd .= $articul_id_query; //search by TV
141 141
                 $sqladd .= " OR sc.pagetitle LIKE '%{$searchfields}%'";
142 142
             }
143 143
         }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
             $sqladd .= " OR sc.introtext LIKE '%{$searchlongtitle}%'";
158 158
             $sqladd .= " OR sc.menutitle LIKE '%{$searchlongtitle}%'";
159 159
             $sqladd .= " OR sc.alias LIKE '%{$search_alias}%'";
160
-			$sqladd .= $articul_id_query;//search by TV
160
+			$sqladd .= $articul_id_query; //search by TV
161 161
         }
162 162
     } else if ($idFromAlias) {
163 163
         $sqladd .= " sc.id='{$idFromAlias}'";
@@ -180,8 +180,8 @@  discard block
 block discarded – undo
180 180
         $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : '';
181 181
         $mgrRole = (isset ($_SESSION['mgrRole']) && $_SESSION['mgrRole'] == 1) ? 1 : 0;
182 182
         $docgrp_cond = $docgrp ? " OR dg.document_group IN ({$docgrp})" : '';
183
-        $fields .= ', MAX(IF(1=' . $mgrRole . ' OR sc.privatemgr=0' . $docgrp_cond . ',1,0)) AS hasAccess';
184
-        $sqladd = '(' . $sqladd . ") AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))");
183
+        $fields .= ', MAX(IF(1='.$mgrRole.' OR sc.privatemgr=0'.$docgrp_cond.',1,0)) AS hasAccess';
184
+        $sqladd = '('.$sqladd.") AND (1={$mgrRole} OR sc.privatemgr=0".(!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))");
185 185
     }
186 186
 
187 187
     if ($sqladd) {
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     $where = $sqladd;
192 192
 
193 193
     if ($where) {
194
-        $rs = $modx->db->select($fields, $tbl_site_content . ' AS sc LEFT JOIN ' . $tbldg . ' AS dg ON dg.document=sc.id', $where, 'sc.id');
194
+        $rs = $modx->db->select($fields, $tbl_site_content.' AS sc LEFT JOIN '.$tbldg.' AS dg ON dg.document=sc.id', $where, 'sc.id');
195 195
         $limit = $modx->db->getRecordCount($rs);
196 196
     } else {
197 197
         $limit = 0;
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
                 if ($limit < 1) {
211 211
                     echo $_lang['search_empty'];
212 212
                 } else {
213
-                    printf('<p>' . $_lang['search_results_returned_msg'] . '</p>', $limit);
213
+                    printf('<p>'.$_lang['search_results_returned_msg'].'</p>', $limit);
214 214
                     ?>
215 215
                     <script type="text/javascript" src="media/script/tablesort.js"></script>
216 216
                     <table class="grid sortabletable sortable-onload-2 rowstyle-even" id="table-1">
@@ -270,14 +270,14 @@  discard block
 block discarded – undo
270 270
                                 if (function_exists('mb_strlen') && function_exists('mb_substr')) {
271 271
                                     ?>
272 272
                                     <td<?= $tdClass ?>>
273
-                                        <a href="index.php?a=27&id=<?= $row['id'] ?>"><?= mb_strlen($row['pagetitle'], $modx_manager_charset) > 70 ? mb_substr($row['pagetitle'], 0, 70, $modx_manager_charset) . "..." : $row['pagetitle'] ?></a>
273
+                                        <a href="index.php?a=27&id=<?= $row['id'] ?>"><?= mb_strlen($row['pagetitle'], $modx_manager_charset) > 70 ? mb_substr($row['pagetitle'], 0, 70, $modx_manager_charset)."..." : $row['pagetitle'] ?></a>
274 274
                                     </td>
275
-                                    <td<?= $tdClass ?>><?= mb_strlen($row['description'], $modx_manager_charset) > 70 ? mb_substr($row['description'], 0, 70, $modx_manager_charset) . "..." : $row['description'] ?></td>
275
+                                    <td<?= $tdClass ?>><?= mb_strlen($row['description'], $modx_manager_charset) > 70 ? mb_substr($row['description'], 0, 70, $modx_manager_charset)."..." : $row['description'] ?></td>
276 276
                                     <?php
277 277
                                 } else {
278 278
                                     ?>
279
-                                    <td<?= $tdClass ?>><?= strlen($row['pagetitle']) > 20 ? substr($row['pagetitle'], 0, 20) . '...' : $row['pagetitle'] ?></td>
280
-                                    <td<?= $tdClass ?>><?= strlen($row['description']) > 35 ? substr($row['description'], 0, 35) . '...' : $row['description'] ?></td>
279
+                                    <td<?= $tdClass ?>><?= strlen($row['pagetitle']) > 20 ? substr($row['pagetitle'], 0, 20).'...' : $row['pagetitle'] ?></td>
280
+                                    <td<?= $tdClass ?>><?= strlen($row['description']) > 35 ? substr($row['description'], 0, 35).'...' : $row['description'] ?></td>
281 281
                                     <?php
282 282
                                 }
283 283
                                 ?>
@@ -297,115 +297,115 @@  discard block
 block discarded – undo
297 297
                 if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) {
298 298
                     $docscounts = $modx->db->getRecordCount($rs);
299 299
                     if ($docscounts > 0) {
300
-                        $output .= '<li><b><i class="fa fa-sitemap"></i> ' . $_lang["manage_documents"] . ' (' . $docscounts . ')</b></li>';
300
+                        $output .= '<li><b><i class="fa fa-sitemap"></i> '.$_lang["manage_documents"].' ('.$docscounts.')</b></li>';
301 301
                         while ($row = $modx->db->getRow($rs)) {
302
-                            $output .= '<li' . addClassForItemList('', !$row['published'], $row['deleted']) . '><a href="index.php?a=27&id=' . $row['id'] . '" id="content_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['pagetitle'] . ' <small>(' . $row['id'] . ')</small>', $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
302
+                            $output .= '<li'.addClassForItemList('', !$row['published'], $row['deleted']).'><a href="index.php?a=27&id='.$row['id'].'" id="content_'.$row['id'].'" target="main">'.highlightingCoincidence($row['pagetitle'].' <small>('.$row['id'].')</small>', $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
303 303
                         }
304 304
                     }
305 305
                 }
306 306
 
307 307
                 //templates
308 308
                 if ($modx->hasPermission('edit_template')) {
309
-                    $rs = $modx->db->select("id,templatename,locked", $modx->getFullTableName('site_templates'), "`id` like '%" . $searchfields . "%' 
310
-					OR `templatename` like '%" . $searchfields . "%' 
311
-					OR `description` like '%" . $searchfields . "%' 
312
-					OR `content` like '%" . $searchfields . "%'");
309
+                    $rs = $modx->db->select("id,templatename,locked", $modx->getFullTableName('site_templates'), "`id` like '%".$searchfields."%' 
310
+					OR `templatename` like '%" . $searchfields."%' 
311
+					OR `description` like '%" . $searchfields."%' 
312
+					OR `content` like '%" . $searchfields."%'");
313 313
                     $templatecounts = $modx->db->getRecordCount($rs);
314 314
                     if ($templatecounts > 0) {
315
-                        $output .= '<li><b><i class="fa fa-newspaper-o"></i> ' . $_lang["manage_templates"] . ' (' . $templatecounts . ')</b></li>';
315
+                        $output .= '<li><b><i class="fa fa-newspaper-o"></i> '.$_lang["manage_templates"].' ('.$templatecounts.')</b></li>';
316 316
                         while ($row = $modx->db->getRow($rs)) {
317
-                            $output .= '<li' . addClassForItemList($row['locked']) . '><a href="index.php?a=16&id=' . $row['id'] . '" id="templates_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['templatename'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
317
+                            $output .= '<li'.addClassForItemList($row['locked']).'><a href="index.php?a=16&id='.$row['id'].'" id="templates_'.$row['id'].'" target="main">'.highlightingCoincidence($row['templatename'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
318 318
                         }
319 319
                     }
320 320
                 }
321 321
 
322 322
                 //tvs
323 323
                 if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
324
-                    $rs = $modx->db->select("id,name,locked", $modx->getFullTableName('site_tmplvars'), "`id` like '%" . $searchfields . "%' 
325
-					OR `name` like '%" . $searchfields . "%' 
326
-					OR `description` like '%" . $searchfields . "%' 
327
-					OR `type` like '%" . $searchfields . "%' 
328
-					OR `elements` like '%" . $searchfields . "%' 
329
-					OR `display` like '%" . $searchfields . "%' 
330
-					OR `display_params` like '%" . $searchfields . "%' 
331
-					OR `default_text` like '%" . $searchfields . "%'");
324
+                    $rs = $modx->db->select("id,name,locked", $modx->getFullTableName('site_tmplvars'), "`id` like '%".$searchfields."%' 
325
+					OR `name` like '%" . $searchfields."%' 
326
+					OR `description` like '%" . $searchfields."%' 
327
+					OR `type` like '%" . $searchfields."%' 
328
+					OR `elements` like '%" . $searchfields."%' 
329
+					OR `display` like '%" . $searchfields."%' 
330
+					OR `display_params` like '%" . $searchfields."%' 
331
+					OR `default_text` like '%" . $searchfields."%'");
332 332
                     $tvscounts = $modx->db->getRecordCount($rs);
333 333
                     if ($tvscounts > 0) {
334
-                        $output .= '<li><b><i class="fa fa-list-alt"></i> ' . $_lang["settings_templvars"] . ' (' . $tvscounts . ')</b></li>';
334
+                        $output .= '<li><b><i class="fa fa-list-alt"></i> '.$_lang["settings_templvars"].' ('.$tvscounts.')</b></li>';
335 335
                         while ($row = $modx->db->getRow($rs)) {
336
-                            $output .= '<li' . addClassForItemList($row['locked']) . '><a href="index.php?a=301&id=' . $row['id'] . '" id="tmplvars_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
336
+                            $output .= '<li'.addClassForItemList($row['locked']).'><a href="index.php?a=301&id='.$row['id'].'" id="tmplvars_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
337 337
                         }
338 338
                     }
339 339
                 }
340 340
 
341 341
                 //Chunks
342 342
                 if ($modx->hasPermission('edit_chunk')) {
343
-                    $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_htmlsnippets'), "`id` like '%" . $searchfields . "%' 
344
-					OR `name` like '%" . $searchfields . "%' 
345
-					OR `description` like '%" . $searchfields . "%'     
346
-					OR `snippet` like '%" . $searchfields . "%'");
343
+                    $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_htmlsnippets'), "`id` like '%".$searchfields."%' 
344
+					OR `name` like '%" . $searchfields."%' 
345
+					OR `description` like '%" . $searchfields."%'     
346
+					OR `snippet` like '%" . $searchfields."%'");
347 347
                     $chunkscounts = $modx->db->getRecordCount($rs);
348 348
                     if ($chunkscounts > 0) {
349
-                        $output .= '<li><b><i class="fa fa-th-large"></i> ' . $_lang["manage_htmlsnippets"] . ' (' . $chunkscounts . ')</b></li>';
349
+                        $output .= '<li><b><i class="fa fa-th-large"></i> '.$_lang["manage_htmlsnippets"].' ('.$chunkscounts.')</b></li>';
350 350
                         while ($row = $modx->db->getRow($rs)) {
351
-                            $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=78&id=' . $row['id'] . '" id="htmlsnippets_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
351
+                            $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=78&id='.$row['id'].'" id="htmlsnippets_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
352 352
                         }
353 353
                     }
354 354
                 }
355 355
 
356 356
                 //Snippets
357 357
                 if ($modx->hasPermission('edit_snippet')) {
358
-                    $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_snippets'), "`id` like '%" . $searchfields . "%' 
359
-					OR `name` like '%" . $searchfields . "%' 
360
-					OR `description` like '%" . $searchfields . "%' 
361
-					OR `snippet` like '%" . $searchfields . "%'  
362
-					OR `properties` like '%" . $searchfields . "%'      
363
-					OR `moduleguid` like '%" . $searchfields . "%'");
358
+                    $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_snippets'), "`id` like '%".$searchfields."%' 
359
+					OR `name` like '%" . $searchfields."%' 
360
+					OR `description` like '%" . $searchfields."%' 
361
+					OR `snippet` like '%" . $searchfields."%'  
362
+					OR `properties` like '%" . $searchfields."%'      
363
+					OR `moduleguid` like '%" . $searchfields."%'");
364 364
                     $snippetscounts = $modx->db->getRecordCount($rs);
365 365
                     if ($snippetscounts > 0) {
366
-                        $output .= '<li><b><i class="fa fa-code"></i> ' . $_lang["manage_snippets"] . ' (' . $snippetscounts . ')</b></li>';
366
+                        $output .= '<li><b><i class="fa fa-code"></i> '.$_lang["manage_snippets"].' ('.$snippetscounts.')</b></li>';
367 367
                         while ($row = $modx->db->getRow($rs)) {
368
-                            $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=22&id=' . $row['id'] . '" id="snippets_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
368
+                            $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=22&id='.$row['id'].'" id="snippets_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
369 369
                         }
370 370
                     }
371 371
                 }
372 372
 
373 373
                 //plugins
374 374
                 if ($modx->hasPermission('edit_plugin')) {
375
-                    $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_plugins'), "`id` like '%" . $searchfields . "%' 
376
-					OR `name` like '%" . $searchfields . "%' 
377
-					OR `description` like '%" . $searchfields . "%' 
378
-					OR `plugincode` like '%" . $searchfields . "%'  
379
-					OR `properties` like '%" . $searchfields . "%'      
380
-					OR `moduleguid` like '%" . $searchfields . "%'");
375
+                    $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_plugins'), "`id` like '%".$searchfields."%' 
376
+					OR `name` like '%" . $searchfields."%' 
377
+					OR `description` like '%" . $searchfields."%' 
378
+					OR `plugincode` like '%" . $searchfields."%'  
379
+					OR `properties` like '%" . $searchfields."%'      
380
+					OR `moduleguid` like '%" . $searchfields."%'");
381 381
                     $pluginscounts = $modx->db->getRecordCount($rs);
382 382
                     if ($pluginscounts > 0) {
383
-                        $output .= '<li><b><i class="fa fa-plug"></i> ' . $_lang["manage_plugins"] . ' (' . $pluginscounts . ')</b></li>';
383
+                        $output .= '<li><b><i class="fa fa-plug"></i> '.$_lang["manage_plugins"].' ('.$pluginscounts.')</b></li>';
384 384
                         while ($row = $modx->db->getRow($rs)) {
385
-                            $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=102&id=' . $row['id'] . '" id="plugins_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
385
+                            $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=102&id='.$row['id'].'" id="plugins_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
386 386
                         }
387 387
                     }
388 388
                 }
389 389
 
390 390
                 //modules
391 391
                 if ($modx->hasPermission('edit_module')) {
392
-                    $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_modules'), "`id` like '%" . $searchfields . "%' 
393
-                    OR `name` like '%" . $searchfields . "%' 
394
-                    OR `description` like '%" . $searchfields . "%' 
395
-                    OR `modulecode` like '%" . $searchfields . "%'  
396
-                    OR `properties` like '%" . $searchfields . "%'  
397
-                    OR `guid` like '%" . $searchfields . "%'      
398
-                    OR `resourcefile` like '%" . $searchfields . "%'");
392
+                    $rs = $modx->db->select("id,name,locked,disabled", $modx->getFullTableName('site_modules'), "`id` like '%".$searchfields."%' 
393
+                    OR `name` like '%" . $searchfields."%' 
394
+                    OR `description` like '%" . $searchfields."%' 
395
+                    OR `modulecode` like '%" . $searchfields."%'  
396
+                    OR `properties` like '%" . $searchfields."%'  
397
+                    OR `guid` like '%" . $searchfields."%'      
398
+                    OR `resourcefile` like '%" . $searchfields."%'");
399 399
                     $modulescounts = $modx->db->getRecordCount($rs);
400 400
                     if ($modulescounts > 0) {
401
-                        $output .= '<li><b><i class="fa fa-cogs"></i> ' . $_lang["modules"] . ' (' . $modulescounts . ')</b></li>';
401
+                        $output .= '<li><b><i class="fa fa-cogs"></i> '.$_lang["modules"].' ('.$modulescounts.')</b></li>';
402 402
                         while ($row = $modx->db->getRow($rs)) {
403
-                            $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=108&id=' . $row['id'] . '" id="modules_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . $_style['icons_external_link'] . '</a></li>';
403
+                            $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=108&id='.$row['id'].'" id="modules_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).$_style['icons_external_link'].'</a></li>';
404 404
                         }
405 405
                     }
406 406
                 }
407 407
 
408
-                echo $output ? '<div class="ajaxSearchResults"><ul>' . $output . '</ul></div>' : '1';
408
+                echo $output ? '<div class="ajaxSearchResults"><ul>'.$output.'</ul></div>' : '1';
409 409
             }
410 410
 
411 411
             ?>
@@ -416,13 +416,13 @@  discard block
 block discarded – undo
416 416
 
417 417
 function highlightingCoincidence($text, $search)
418 418
 {
419
-    $regexp = '!(' . str_replace(array(
419
+    $regexp = '!('.str_replace(array(
420 420
             '(',
421 421
             ')'
422 422
         ), array(
423 423
             '\(',
424 424
             '\)'
425
-        ), trim($search)) . ')!isu';
425
+        ), trim($search)).')!isu';
426 426
     return preg_replace($regexp, '<span class="text-danger">$1</span>', $text);
427 427
 }
428 428
 
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
         $class .= ' deleted';
440 440
     }
441 441
     if ($class) {
442
-        $class = ' class="' . trim($class) . '"';
442
+        $class = ' class="'.trim($class).'"';
443 443
     }
444 444
     return $class;
445 445
 }
Please login to merge, or discard this patch.
manager/actions/eventlog.dynamic.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('view_eventlog')) {
5
+if (!$modx->hasPermission('view_eventlog')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
@@ -15,12 +15,12 @@  discard block
 block discarded – undo
15 15
 $modx->manager->initPageViewState();
16 16
 
17 17
 // get and save search string
18
-if($_REQUEST['op'] == 'reset') {
18
+if ($_REQUEST['op'] == 'reset') {
19 19
 	$sqlQuery = $query = '';
20 20
 	$_PAGE['vs']['search'] = '';
21 21
 } else {
22 22
 	$sqlQuery = $query = isset($_REQUEST['search']) ? $_REQUEST['search'] : $_PAGE['vs']['search'];
23
-	if(!is_numeric($sqlQuery)) {
23
+	if (!is_numeric($sqlQuery)) {
24 24
 		$sqlQuery = $modx->db->escape($query);
25 25
 	}
26 26
 	$_PAGE['vs']['search'] = $query;
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 $_PAGE['vs']['lm'] = $listmode;
32 32
 
33 33
 // context menu
34
-include_once MODX_MANAGER_PATH . "includes/controls/contextmenu.php";
34
+include_once MODX_MANAGER_PATH."includes/controls/contextmenu.php";
35 35
 $cm = new ContextMenu("cntxm", 150);
36 36
 $cm->addItem($_lang['view_log'], "js:menuAction(1)", $_style['actions_preview']);
37 37
 $cm->addSeparator();
@@ -127,8 +127,8 @@  discard block
 block discarded – undo
127 127
 					<?php
128 128
 					$ds = $modx->db->select("el.id, ELT(el.type , 'text-info {$_style['actions_info']}' , 'text-warning {$_style['actions_triangle']}' , 'text-danger {$_style['actions_error']}' ) as icon, el.createdon, el.source, el.eventid,IFNULL(wu.username,mu.username) as username", "{$tbl_event_log} AS el 
129 129
 			LEFT JOIN {$tbl_manager_users} AS mu ON mu.id=el.user AND el.usertype=0
130
-			LEFT JOIN {$tbl_web_users} AS wu ON wu.id=el.user AND el.usertype=1", ($sqlQuery ? "" . (is_numeric($sqlQuery) ? "(eventid='{$sqlQuery}') OR " : '') . "(source LIKE '%{$sqlQuery}%') OR (description LIKE '%{$sqlQuery}%')" : ""), "createdon DESC");
131
-					include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php";
130
+			LEFT JOIN {$tbl_web_users} AS wu ON wu.id=el.user AND el.usertype=1", ($sqlQuery ? "".(is_numeric($sqlQuery) ? "(eventid='{$sqlQuery}') OR " : '')."(source LIKE '%{$sqlQuery}%') OR (description LIKE '%{$sqlQuery}%')" : ""), "createdon DESC");
131
+					include_once MODX_MANAGER_PATH."includes/controls/datagrid.class.php";
132 132
 					$grd = new DataGrid('', $ds, $number_of_results); // set page size to 0 t show all items
133 133
 					$grd->pagerClass = '';
134 134
 					$grd->pageClass = 'page-item';
@@ -139,14 +139,14 @@  discard block
 block discarded – undo
139 139
 					$grd->itemClass = "tableItem";
140 140
 					$grd->altItemClass = "tableAltItem";
141 141
 					$grd->fields = "type,source,createdon,eventid,username";
142
-					$grd->columns = $_lang['type'] . " ," . $_lang['source'] . " ," . $_lang['date'] . " ," . $_lang['event_id'] . " ," . $_lang['sysinfo_userid'];
142
+					$grd->columns = $_lang['type']." ,".$_lang['source']." ,".$_lang['date']." ,".$_lang['event_id']." ,".$_lang['sysinfo_userid'];
143 143
 					$grd->colWidths = "1%,,1%,1%,1%";
144 144
 					$grd->colAligns = "center,,,center,center";
145
-					$grd->colTypes = "template:<a class='gridRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='" . $_lang['click_to_context'] . "'><i class='[+icon+]'></i></a>||template:<a href='index.php?a=115&id=[+id+]' title='" . $_lang['click_to_view_details'] . "'>[+source+]</a>||date: " . $modx->toDateFormat(null, 'formatOnly') . ' %I:%M %p';
146
-					if($listmode == '1') {
145
+					$grd->colTypes = "template:<a class='gridRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='".$_lang['click_to_context']."'><i class='[+icon+]'></i></a>||template:<a href='index.php?a=115&id=[+id+]' title='".$_lang['click_to_view_details']."'>[+source+]</a>||date: ".$modx->toDateFormat(null, 'formatOnly').' %I:%M %p';
146
+					if ($listmode == '1') {
147 147
 						$grd->pageSize = 0;
148 148
 					}
149
-					if($_REQUEST['op'] == 'reset') {
149
+					if ($_REQUEST['op'] == 'reset') {
150 150
 						$grd->pageNumber = 1;
151 151
 					}
152 152
 					// render grid
Please login to merge, or discard this patch.
manager/actions/mutate_snippet.dynamic.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     $rs = $modx->db->select('*', $tbl_site_snippets, "id='{$id}'");
40 40
     $content = $modx->db->getRow($rs);
41 41
     if (!$content) {
42
-        header("Location: " . MODX_SITE_URL . "index.php?id=" . $site_start);
42
+        header("Location: ".MODX_SITE_URL."index.php?id=".$site_start);
43 43
     }
44 44
     $_SESSION['itemname'] = $content['name'];
45 45
     if ($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) {
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 // Add lock-element JS-Script
63 63
 $lockElementId = $id;
64 64
 $lockElementType = 4;
65
-require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php');
65
+require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php');
66 66
 ?>
67 67
 <script type="text/javascript">
68 68
 
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
     <input type="hidden" name="mode" value="<?= $modx->manager->action ?>">
432 432
 
433 433
     <h1 class="pagetitle">
434
-        <i class="fa fa-code"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['new_snippet']) ?><i class="fa fa-question-circle help"></i>
434
+        <i class="fa fa-code"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['new_snippet']) ?><i class="fa fa-question-circle help"></i>
435 435
     </h1>
436 436
 
437 437
     <?= $_style['actionbuttons']['dynamic']['element'] ?>
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
                             <div class="form-control-name clearfix">
458 458
                                 <input name="name" type="text" maxlength="100" value="<?= $modx->htmlspecialchars($content['name']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;" />
459 459
                                 <?php if ($modx->hasPermission('save_role')): ?>
460
-                                    <label class="custom-control" title="<?= $_lang['lock_snippet'] . "\n" . $_lang['lock_snippet_msg'] ?>" tooltip>
460
+                                    <label class="custom-control" title="<?= $_lang['lock_snippet']."\n".$_lang['lock_snippet_msg'] ?>" tooltip>
461 461
                                         <input name="locked" type="checkbox"<?= ($content['locked'] == 1 ? ' checked="checked"' : '') ?> />
462 462
                                         <i class="fa fa-lock"></i>
463 463
                                     </label>
@@ -481,9 +481,9 @@  discard block
 block discarded – undo
481 481
                             <select name="categoryid" class="form-control" onchange="documentDirty=true;">
482 482
                                 <option>&nbsp;</option>
483 483
                                 <?php
484
-                                include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
484
+                                include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
485 485
                                 foreach (getCategories() as $n => $v) {
486
-                                    echo '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($v['category']) . '</option>';
486
+                                    echo '<option value="'.$v['id'].'"'.($content['category'] == $v['id'] ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($v['category']).'</option>';
487 487
                                 }
488 488
                                 ?>
489 489
                             </select>
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
                     <div class="form-group">
501 501
                         <?php if ($_SESSION['mgrRole'] == 1): ?>
502 502
                             <div class="form-row">
503
-                                <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>" . $_lang['disabled'] . "</span>" : $_lang['disabled']) ?></label>
503
+                                <label><input name="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> <?= ($content['disabled'] == 1 ? "<span class='text-danger'>".$_lang['disabled']."</span>" : $_lang['disabled']) ?></label>
504 504
                             </div>
505 505
                         <?php endif; ?>
506 506
                         <div class="form-row">
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
                 <span><?= $_lang['snippet_code'] ?></span>
518 518
             </div>
519 519
             <div class="section-editor clearfix">
520
-                <textarea dir="ltr" name="post" class="phptextarea" rows="20" wrap="soft" onchange="documentDirty=true;"><?= (isset($content['post']) ? trim($modx->htmlspecialchars($content['post'])) : "<?php" . "\n" . trim($modx->htmlspecialchars($content['snippet'])) . "\n") ?></textarea>
520
+                <textarea dir="ltr" name="post" class="phptextarea" rows="20" wrap="soft" onchange="documentDirty=true;"><?= (isset($content['post']) ? trim($modx->htmlspecialchars($content['post'])) : "<?php"."\n".trim($modx->htmlspecialchars($content['snippet']))."\n") ?></textarea>
521 521
             </div>
522 522
             <!-- PHP text editor end -->
523 523
         </div>
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 								INNER JOIN {$tbl_site_module_depobj} AS smd ON smd.module=sm.id AND smd.type=40 
553 553
 								INNER JOIN {$tbl_site_snippets} AS ss ON ss.id=smd.resource", "smd.resource='{$id}' AND sm.enable_sharedparams=1", 'sm.name');
554 554
                                 while ($row = $modx->db->getRow($ds)) {
555
-                                    echo "<option value='" . $row['guid'] . "'" . ($content['moduleguid'] == $row['guid'] ? " selected='selected'" : "") . ">" . $modx->htmlspecialchars($row['name']) . "</option>";
555
+                                    echo "<option value='".$row['guid']."'".($content['moduleguid'] == $row['guid'] ? " selected='selected'" : "").">".$modx->htmlspecialchars($row['name'])."</option>";
556 556
                                 }
557 557
                                 ?>
558 558
                             </select>
Please login to merge, or discard this patch.
manager/actions/import_site.static.php 1 patch
Spacing   +82 added lines, -82 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('import_static')) {
5
+if (!$modx->hasPermission('import_static')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 	<div class="tab-page">
44 44
 		<div class="container container-body">
45 45
 			<?php
46
-			if(!isset($_POST['import'])) {
47
-				echo "<div class=\"element-edit-message\">" . $_lang['import_site_message'] . "</div>";
46
+			if (!isset($_POST['import'])) {
47
+				echo "<div class=\"element-edit-message\">".$_lang['import_site_message']."</div>";
48 48
 				?>
49 49
 				<form action="index.php" method="post" name="importFrm">
50 50
 					<input type="hidden" name="import" value="import" />
@@ -101,14 +101,14 @@  discard block
 block discarded – undo
101 101
 	</div>
102 102
 
103 103
 <?php
104
-function run() {
104
+function run(){
105 105
 	global $modx;
106 106
 
107 107
 	$tbl_site_content = $modx->getFullTableName('site_content');
108 108
 	$output = '';
109 109
 	$maxtime = $_POST['maxtime'];
110 110
 
111
-	if(!is_numeric($maxtime)) {
111
+	if (!is_numeric($maxtime)) {
112 112
 		$maxtime = 30;
113 113
 	}
114 114
 
@@ -119,17 +119,17 @@  discard block
 block discarded – undo
119 119
 	$mtime = $mtime[1] + $mtime[0];
120 120
 	$importstart = $mtime;
121 121
 
122
-	if($_POST['reset'] == 'on') {
122
+	if ($_POST['reset'] == 'on') {
123 123
 		$modx->db->truncate($tbl_site_content);
124 124
 		$modx->db->query("ALTER TABLE {$tbl_site_content} AUTO_INCREMENT = 1");
125 125
 	}
126 126
 
127 127
 	$parent = intval($_POST['parent']);
128 128
 
129
-	if(is_dir(MODX_BASE_PATH . 'temp/import')) {
130
-		$filedir = MODX_BASE_PATH . 'temp/import/';
131
-	} elseif(is_dir(MODX_BASE_PATH . 'assets/import')) {
132
-		$filedir = MODX_BASE_PATH . 'assets/import/';
129
+	if (is_dir(MODX_BASE_PATH.'temp/import')) {
130
+		$filedir = MODX_BASE_PATH.'temp/import/';
131
+	} elseif (is_dir(MODX_BASE_PATH.'assets/import')) {
132
+		$filedir = MODX_BASE_PATH.'assets/import/';
133 133
 	}
134 134
 
135 135
 	$filesfound = 0;
@@ -138,10 +138,10 @@  discard block
 block discarded – undo
138 138
 	$files = pop_index($files);
139 139
 
140 140
 	// no. of files to import
141
-	$output .= sprintf('<p>' . $_lang['import_files_found'] . '</p>', $filesfound);
141
+	$output .= sprintf('<p>'.$_lang['import_files_found'].'</p>', $filesfound);
142 142
 
143 143
 	// import files
144
-	if(0 < count($files)) {
144
+	if (0 < count($files)) {
145 145
 		$modx->db->update(array('isfolder' => 1), $tbl_site_content, "id='{$parent}'");
146 146
 		importFiles($parent, $filedir, $files, 'root');
147 147
 	}
@@ -151,16 +151,16 @@  discard block
 block discarded – undo
151 151
 	$mtime = $mtime[1] + $mtime[0];
152 152
 	$importend = $mtime;
153 153
 	$totaltime = ($importend - $importstart);
154
-	$output .= sprintf('<p>' . $_lang['import_site_time'] . '</p>', round($totaltime, 3));
154
+	$output .= sprintf('<p>'.$_lang['import_site_time'].'</p>', round($totaltime, 3));
155 155
 
156
-	if($_POST['convert_link'] == 'on') {
156
+	if ($_POST['convert_link'] == 'on') {
157 157
 		convertLink();
158 158
 	}
159 159
 
160 160
 	return $output;
161 161
 }
162 162
 
163
-function importFiles($parent, $filedir, $files, $mode) {
163
+function importFiles($parent, $filedir, $files, $mode){
164 164
 	global $modx;
165 165
 	global $_lang, $allowedfiles;
166 166
 	global $search_default, $cache_default, $publish_default;
@@ -169,21 +169,21 @@  discard block
 block discarded – undo
169 169
 	$tbl_system_settings = $modx->getFullTableName('system_settings');
170 170
 
171 171
 	$createdby = $modx->getLoginUserID();
172
-	if(!is_array($files)) {
172
+	if (!is_array($files)) {
173 173
 		return;
174 174
 	}
175
-	if($_POST['object'] == 'all') {
175
+	if ($_POST['object'] == 'all') {
176 176
 		$modx->config['default_template'] = '0';
177 177
 		$richtext = '0';
178 178
 	} else {
179 179
 		$richtext = '1';
180 180
 	}
181 181
 
182
-	foreach($files as $id => $value) {
183
-		if(is_array($value)) {
182
+	foreach ($files as $id => $value) {
183
+		if (is_array($value)) {
184 184
 			// create folder
185 185
 			$alias = $id;
186
-			printf('<span>' . $_lang['import_site_importing_document'] . '</span>', $alias);
186
+			printf('<span>'.$_lang['import_site_importing_document'].'</span>', $alias);
187 187
 			$field = array();
188 188
 			$field['type'] = 'document';
189 189
 			$field['contentType'] = 'text/html';
@@ -198,12 +198,12 @@  discard block
 block discarded – undo
198 198
 			$field['isfolder'] = 1;
199 199
 			$field['menuindex'] = 1;
200 200
 			$find = false;
201
-			foreach(array(
201
+			foreach (array(
202 202
 						'index.html',
203 203
 						'index.htm'
204 204
 					) as $filename) {
205
-				$filepath = $filedir . $alias . '/' . $filename;
206
-				if($find === false && file_exists($filepath)) {
205
+				$filepath = $filedir.$alias.'/'.$filename;
206
+				if ($find === false && file_exists($filepath)) {
207 207
 					$file = getFileContent($filepath);
208 208
 					list($pagetitle, $content, $description) = treatContent($file, $filename, $alias);
209 209
 
@@ -215,17 +215,17 @@  discard block
 block discarded – undo
215 215
 					$field['createdon'] = $date;
216 216
 					$field['editedon'] = $date;
217 217
 					$newid = $modx->db->insert($field, $tbl_site_content);
218
-					if($newid) {
218
+					if ($newid) {
219 219
 						$find = true;
220
-						echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
221
-						importFiles($newid, $filedir . $alias . '/', $value, 'sub');
220
+						echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n";
221
+						importFiles($newid, $filedir.$alias.'/', $value, 'sub');
222 222
 					} else {
223
-						echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError();
223
+						echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError();
224 224
 						exit;
225 225
 					}
226 226
 				}
227 227
 			}
228
-			if($find === false) {
228
+			if ($find === false) {
229 229
 				$date = time();
230 230
 				$field['pagetitle'] = '---';
231 231
 				$field['content'] = '';
@@ -233,30 +233,30 @@  discard block
 block discarded – undo
233 233
 				$field['editedon'] = $date;
234 234
 				$field['hidemenu'] = '1';
235 235
 				$newid = $modx->db->insert($field, $tbl_site_content);
236
-				if($newid) {
236
+				if ($newid) {
237 237
 					$find = true;
238
-					echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
239
-					importFiles($newid, $filedir . $alias . '/', $value, 'sub');
238
+					echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n";
239
+					importFiles($newid, $filedir.$alias.'/', $value, 'sub');
240 240
 				} else {
241
-					echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError();
241
+					echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError();
242 242
 					exit;
243 243
 				}
244 244
 			}
245 245
 		} else {
246 246
 			// create document
247
-			if($mode == 'sub' && $value == 'index.html') {
247
+			if ($mode == 'sub' && $value == 'index.html') {
248 248
 				continue;
249 249
 			}
250 250
 			$filename = $value;
251 251
 			$fparts = explode('.', $value);
252 252
 			$alias = $fparts[0];
253 253
 			$ext = (count($fparts) > 1) ? $fparts[count($fparts) - 1] : "";
254
-			printf("<span>" . $_lang['import_site_importing_document'] . "</span>", $filename);
254
+			printf("<span>".$_lang['import_site_importing_document']."</span>", $filename);
255 255
 
256
-			if(!in_array($ext, $allowedfiles)) {
257
-				echo ' - <span class="fail">' . $_lang["import_site_skip"] . '</span><br />' . "\n";
256
+			if (!in_array($ext, $allowedfiles)) {
257
+				echo ' - <span class="fail">'.$_lang["import_site_skip"].'</span><br />'."\n";
258 258
 			} else {
259
-				$filepath = $filedir . $filename;
259
+				$filepath = $filedir.$filename;
260 260
 				$file = getFileContent($filepath);
261 261
 				list($pagetitle, $content, $description) = treatContent($file, $filename, $alias);
262 262
 
@@ -281,18 +281,18 @@  discard block
 block discarded – undo
281 281
 				$field['isfolder'] = 0;
282 282
 				$field['menuindex'] = ($alias == 'index') ? 0 : 2;
283 283
 				$newid = $modx->db->insert($field, $tbl_site_content);
284
-				if($newid) {
285
-					echo ' - <span class="success">' . $_lang['import_site_success'] . '</span><br />' . "\n";
284
+				if ($newid) {
285
+					echo ' - <span class="success">'.$_lang['import_site_success'].'</span><br />'."\n";
286 286
 				} else {
287
-					echo '<span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_db_error"] . $modx->db->getLastError();
287
+					echo '<span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_db_error"].$modx->db->getLastError();
288 288
 					exit;
289 289
 				}
290 290
 
291 291
 				$is_site_start = false;
292
-				if($filename == 'index.html') {
292
+				if ($filename == 'index.html') {
293 293
 					$is_site_start = true;
294 294
 				}
295
-				if($is_site_start == true && $_POST['reset'] == 'on') {
295
+				if ($is_site_start == true && $_POST['reset'] == 'on') {
296 296
 					$modx->db->update(array('setting_value' => $newid), $tbl_system_settings, "setting_name='site_start'");
297 297
 					$modx->db->update(array('menuindex' => 0), $tbl_site_content, "id='{$newid}'");
298 298
 				}
@@ -301,85 +301,85 @@  discard block
 block discarded – undo
301 301
 	}
302 302
 }
303 303
 
304
-function getFiles($directory, $listing = array(), $count = 0) {
304
+function getFiles($directory, $listing = array(), $count = 0){
305 305
 	global $_lang;
306 306
 	global $filesfound;
307 307
 	$dummy = $count;
308
-	if($files = scandir($directory)) {
309
-		foreach($files as $file) {
310
-			if($file == '.' || $file == '..') {
308
+	if ($files = scandir($directory)) {
309
+		foreach ($files as $file) {
310
+			if ($file == '.' || $file == '..') {
311 311
 				continue;
312
-			} elseif($h = @opendir($directory . $file . "/")) {
312
+			} elseif ($h = @opendir($directory.$file."/")) {
313 313
 				closedir($h);
314 314
 				$count = -1;
315
-				$listing[$file] = getFiles($directory . $file . "/", array(), $count + 1);
316
-			} elseif(strpos($file, '.htm') !== false) {
315
+				$listing[$file] = getFiles($directory.$file."/", array(), $count + 1);
316
+			} elseif (strpos($file, '.htm') !== false) {
317 317
 				$listing[$dummy] = $file;
318 318
 				$dummy = $dummy + 1;
319 319
 				$filesfound++;
320 320
 			}
321 321
 		}
322 322
 	} else {
323
-		echo '<p><span class="fail">' . $_lang["import_site_failed"] . "</span> " . $_lang["import_site_failed_no_open_dir"] . $directory . ".</p>";
323
+		echo '<p><span class="fail">'.$_lang["import_site_failed"]."</span> ".$_lang["import_site_failed_no_open_dir"].$directory.".</p>";
324 324
 	}
325 325
 	return ($listing);
326 326
 }
327 327
 
328
-function getFileContent($filepath) {
328
+function getFileContent($filepath){
329 329
 	global $_lang;
330 330
 	// get the file
331
-	if(!$buffer = file_get_contents($filepath)) {
332
-		echo '<p><span class="fail">' . $_lang['import_site_failed'] . "</span> " . $_lang["import_site_failed_no_retrieve_file"] . $filepath . ".</p>";
331
+	if (!$buffer = file_get_contents($filepath)) {
332
+		echo '<p><span class="fail">'.$_lang['import_site_failed']."</span> ".$_lang["import_site_failed_no_retrieve_file"].$filepath.".</p>";
333 333
 	} else {
334 334
 		return $buffer;
335 335
 	}
336 336
 }
337 337
 
338
-function pop_index($array) {
338
+function pop_index($array){
339 339
 	$new_array = array();
340
-	foreach($array as $k => $v) {
341
-		if($v !== 'index.html' && $v !== 'index.htm') {
340
+	foreach ($array as $k => $v) {
341
+		if ($v !== 'index.html' && $v !== 'index.htm') {
342 342
 			$new_array[$k] = $v;
343 343
 		} else {
344 344
 			array_unshift($new_array, $v);
345 345
 		}
346 346
 	}
347
-	foreach($array as $k => $v) {
348
-		if(is_array($v)) {
347
+	foreach ($array as $k => $v) {
348
+		if (is_array($v)) {
349 349
 			$new_array[$k] = $v;
350 350
 		}
351 351
 	}
352 352
 	return $new_array;
353 353
 }
354 354
 
355
-function treatContent($src, $filename, $alias) {
355
+function treatContent($src, $filename, $alias){
356 356
 	global $modx;
357 357
 
358 358
 	$src = mb_convert_encoding($src, $modx->config['modx_charset'], 'UTF-8,SJIS-win,eucJP-win,SJIS,EUC-JP,ASCII');
359 359
 
360
-	if(preg_match("@<title>(.*)</title>@i", $src, $matches)) {
360
+	if (preg_match("@<title>(.*)</title>@i", $src, $matches)) {
361 361
 		$pagetitle = ($matches[1] !== '') ? $matches[1] : $filename;
362 362
 		$pagetitle = str_replace('[*pagetitle*]', '', $pagetitle);
363 363
 	} else {
364 364
 		$pagetitle = $alias;
365 365
 	}
366
-	if(!$pagetitle) {
366
+	if (!$pagetitle) {
367 367
 		$pagetitle = $alias;
368 368
 	}
369 369
 
370
-	if(preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) {
370
+	if (preg_match('@<meta[^>]+"description"[^>]+content=[\'"](.*)[\'"].+>@i', $src, $matches)) {
371 371
 		$description = ($matches[1] !== '') ? $matches[1] : $filename;
372 372
 		$description = str_replace('[*description*]', '', $description);
373 373
 	} else {
374 374
 		$description = '';
375 375
 	}
376 376
 
377
-	if((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') {
377
+	if ((preg_match("@<body[^>]*>(.*)[^<]+</body>@is", $src, $matches)) && $_POST['object'] == 'body') {
378 378
 		$content = $matches[1];
379 379
 	} else {
380 380
 		$content = $src;
381 381
 		$s = '/(<meta[^>]+charset\s*=)[^>"\'=]+(.+>)/i';
382
-		$r = '$1' . $modx->config['modx_charset'] . '$2';
382
+		$r = '$1'.$modx->config['modx_charset'].'$2';
383 383
 		$content = preg_replace($s, $r, $content);
384 384
 		$content = preg_replace('@<title>.*</title>@i', "<title>[*pagetitle*]</title>", $content);
385 385
 	}
@@ -393,38 +393,38 @@  discard block
 block discarded – undo
393 393
 	);
394 394
 }
395 395
 
396
-function convertLink() {
396
+function convertLink(){
397 397
 	global $modx;
398 398
 	$tbl_site_content = $modx->getFullTableName('site_content');
399 399
 
400 400
 	$rs = $modx->db->select('id,content', $tbl_site_content);
401
-	while($row = $modx->db->getRow($rs)) {
401
+	while ($row = $modx->db->getRow($rs)) {
402 402
 		$id = $row['id'];
403 403
 		$array = explode('<a href=', $row['content']);
404 404
 		$c = 0;
405
-		foreach($array as $v) {
406
-			if($v[0] === '"') {
405
+		foreach ($array as $v) {
406
+			if ($v[0] === '"') {
407 407
 				$v = substr($v, 1);
408 408
 				list($href, $v) = explode('"', $v, 2);
409 409
 				$_ = $href;
410
-				if(strpos($_, $modx->config['site_url']) !== false) {
411
-					$_ = $modx->config['base_url'] . str_replace($modx->config['site_url'], '', $_);
410
+				if (strpos($_, $modx->config['site_url']) !== false) {
411
+					$_ = $modx->config['base_url'].str_replace($modx->config['site_url'], '', $_);
412 412
 				}
413
-				if($_[0] === '/') {
413
+				if ($_[0] === '/') {
414 414
 					$_ = substr($_, 1);
415 415
 				}
416 416
 				$_ = str_replace('/index.html', '.html', $_);
417 417
 				$level = substr_count($_, '../');
418
-				if(1 < $level) {
419
-					if(!isset($p[$id])) {
418
+				if (1 < $level) {
419
+					if (!isset($p[$id])) {
420 420
 						$p[$id] = $modx->getParentIds($id);
421 421
 					}
422 422
 					$k = array_keys($p[$id]);
423
-					while(0 < $level) {
423
+					while (0 < $level) {
424 424
 						$dir = array_shift($k);
425 425
 						$level--;
426 426
 					}
427
-					if($dir != '') {
427
+					if ($dir != '') {
428 428
 						$dir .= '/';
429 429
 					}
430 430
 				} else {
@@ -432,18 +432,18 @@  discard block
 block discarded – undo
432 432
 				}
433 433
 
434 434
 				$_ = trim($_, './');
435
-				if(strpos($_, '/') !== false) {
435
+				if (strpos($_, '/') !== false) {
436 436
 					$_ = substr($_, strrpos($_, '/'));
437 437
 				}
438
-				$_ = $dir . str_replace('.html', '', $_);
439
-				if(!isset($target[$_])) {
438
+				$_ = $dir.str_replace('.html', '', $_);
439
+				if (!isset($target[$_])) {
440 440
 					$target[$_] = $modx->getIdFromAlias($_);
441 441
 				}
442 442
 				$target[$_] = trim($target[$_]);
443
-				if(!empty($target[$_])) {
444
-					$href = '[~' . $target[$_] . '~]';
443
+				if (!empty($target[$_])) {
444
+					$href = '[~'.$target[$_].'~]';
445 445
 				}
446
-				$array[$c] = '<a href="' . $href . '"' . $v;
446
+				$array[$c] = '<a href="'.$href.'"'.$v;
447 447
 			}
448 448
 			$c++;
449 449
 		}
Please login to merge, or discard this patch.
manager/actions/welcome.static.php 1 patch
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
 	die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.');
4 4
 }
5 5
 
6 6
 unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes
7 7
 
8
-if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
8
+if ($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
9 9
 	// seems to be a new install - send the user to the configuration page
10 10
 	exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
11 11
 }
@@ -16,50 +16,50 @@  discard block
 block discarded – undo
16 16
 $_SESSION['nrnewmessages'] = 0;
17 17
 
18 18
 // setup message info
19
-if($modx->hasPermission('messages')) {
20
-	include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php');
19
+if ($modx->hasPermission('messages')) {
20
+	include_once(MODX_MANAGER_PATH.'includes/messageCount.inc.php');
21 21
 	$_SESSION['nrtotalmessages'] = $nrtotalmessages;
22 22
 	$_SESSION['nrnewmessages'] = $nrnewmessages;
23 23
 
24 24
 	$msg = array();
25 25
 	$msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']);
26
-	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : '';
26
+	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">'.$_SESSION['nrnewmessages'].'</span>)' : '';
27 27
 	$msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold">&nbsp;<a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages);
28
-	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0';
28
+	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">'.$_SESSION['nrnewmessages'].'</span>' : '0';
29 29
 	$welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages);
30 30
 	$msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
31 31
 	$ph['MessageInfo'] = join("\n", $msg);
32 32
 }
33 33
 
34 34
 // setup icons
35
-if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
35
+if ($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
36 36
 	$icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]';
37 37
 	$ph['SecurityIcon'] = wrapIcon($icon, 75);
38 38
 }
39
-if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
39
+if ($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
40 40
 	$icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]';
41 41
 	$ph['WebUserIcon'] = wrapIcon($icon, 99);
42 42
 }
43
-if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
43
+if ($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
44 44
 	$icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]';
45 45
 	$ph['ModulesIcon'] = wrapIcon($icon, 106);
46 46
 }
47
-if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
47
+if ($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
48 48
 	$icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]';
49 49
 	$ph['ResourcesIcon'] = wrapIcon($icon, 76);
50 50
 }
51
-if($modx->hasPermission('bk_manager')) {
51
+if ($modx->hasPermission('bk_manager')) {
52 52
 	$icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]';
53 53
 	$ph['BackupIcon'] = wrapIcon($icon, 93);
54 54
 }
55
-if($modx->hasPermission('help')) {
55
+if ($modx->hasPermission('help')) {
56 56
 	$icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]';
57 57
 	$ph['HelpIcon'] = wrapIcon($icon, 9);
58 58
 }
59 59
 // do some config checks
60
-if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
61
-	include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php');
62
-	if($config_check_results != $_lang['configcheck_ok']) {
60
+if (($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
61
+	include_once(MODX_MANAGER_PATH.'includes/config_check.inc.php');
62
+	if ($config_check_results != $_lang['configcheck_ok']) {
63 63
 		$ph['config_check_results'] = $config_check_results;
64 64
 		$ph['config_display'] = 'block';
65 65
 	} else {
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
 }
71 71
 
72 72
 // Check logout-reminder
73
-if(isset($_SESSION['show_logout_reminder'])) {
74
-	switch($_SESSION['show_logout_reminder']['type']) {
73
+if (isset($_SESSION['show_logout_reminder'])) {
74
+	switch ($_SESSION['show_logout_reminder']['type']) {
75 75
 		case 'logout_reminder':
76 76
 			$date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly');
77 77
 			$ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	</tr>
126 126
 </table>';
127 127
 
128
-$nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>';
128
+$nrnewmessages = '<span class="text-danger">'.$_SESSION['nrnewmessages'].'</span>';
129 129
 
130 130
 $ph['UserInfo'] = $modx->parseText($tpl, array(
131 131
 	'username' => $modx->getLoginUserName(),
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
 $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'";
141 141
 $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
142 142
 
143
-if($modx->db->getRecordCount($rs) < 1) {
143
+if ($modx->db->getRecordCount($rs) < 1) {
144 144
 	$html = '<p>[%no_active_users_found%]</p>';
145 145
 } else {
146
-	include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
146
+	include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php');
147 147
 	$now = $_SERVER['REQUEST_TIME'] + $server_offset_time;
148 148
 	$ph['now'] = strftime('%H:%M:%S', $now);
149 149
 	$timetocheck = ($now - (60 * 20)); //+$server_offset_time;
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	$userList = array();
169 169
 	$userCount = array();
170 170
 	// Create userlist with session-count first before output
171
-	while($activeusers = $modx->db->getRow($rs)) {
171
+	while ($activeusers = $modx->db->getRow($rs)) {
172 172
 		$userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1;
173 173
 
174 174
 		$idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : '';
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
 			$currentaction
187 187
 		);
188 188
 	}
189
-	foreach($userList as $params) {
189
+	foreach ($userList as $params) {
190 190
 		$params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : '';
191
-		$html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
191
+		$html .= "\n\t\t".vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
192 192
 	}
193 193
 
194 194
 	$html .= '
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 $ph['OnlineInfo'] = $html;
201 201
 
202 202
 // include rss feeds for important forum topics
203
-include_once(MODX_MANAGER_PATH . 'includes/rss.inc.php');
203
+include_once(MODX_MANAGER_PATH.'includes/rss.inc.php');
204 204
 $ph['modx_security_notices_content'] = $feedData['modx_security_notices_content'];
205 205
 $ph['modx_news_content'] = $feedData['modx_news_content'];
206 206
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 
232 232
 // invoke event OnManagerWelcomePrerender
233 233
 $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
234
-if(is_array($evtOut)) {
234
+if (is_array($evtOut)) {
235 235
 	$output = implode('', $evtOut);
236 236
 	$ph['OnManagerWelcomePrerender'] = $output;
237 237
 }
@@ -365,57 +365,57 @@  discard block
 block discarded – undo
365 365
 
366 366
 // invoke OnManagerWelcomeHome event
367 367
 $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
368
-if(is_array($sitewidgets)) {
368
+if (is_array($sitewidgets)) {
369 369
 	$newwidgets = array();
370
-    foreach($sitewidgets as $widget){
370
+    foreach ($sitewidgets as $widget) {
371 371
         $newwidgets = array_merge($newwidgets, unserialize($widget));
372 372
     }
373 373
     $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets;
374 374
 }
375 375
 
376
-usort($widgets, function ($a, $b) {
376
+usort($widgets, function($a, $b){
377 377
 	return $a['menuindex'] - $b['menuindex'];
378 378
 });
379 379
 
380 380
 $tpl = getTplWidget();
381 381
 $output = '';
382
-foreach($widgets as $widget) {
383
-	if ($widget['hide'] != '1'){
382
+foreach ($widgets as $widget) {
383
+	if ($widget['hide'] != '1') {
384 384
 		$output .= $modx->parseText($tpl, $widget);
385 385
 	}
386 386
 }
387 387
 $ph['widgets'] = $output;
388 388
 
389 389
 // load template
390
-if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
391
-	$modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl';
390
+if (!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
391
+	$modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH.'media/style/common/welcome.tpl';
392 392
 }
393 393
 
394 394
 $target = $modx->config['manager_welcome_tpl'];
395 395
 $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
396 396
 $target = $modx->mergeSettingsContent($target);
397 397
 
398
-if(substr($target, 0, 1) === '@') {
399
-	if(substr($target, 0, 6) === '@CHUNK') {
398
+if (substr($target, 0, 1) === '@') {
399
+	if (substr($target, 0, 6) === '@CHUNK') {
400 400
 		$content = $modx->getChunk(trim(substr($target, 7)));
401
-	} elseif(substr($target, 0, 5) === '@FILE') {
401
+	} elseif (substr($target, 0, 5) === '@FILE') {
402 402
 		$content = file_get_contents(trim(substr($target, 6)));
403 403
 	} else {
404 404
 		$content = '';
405 405
 	}
406 406
 } else {
407 407
 	$chunk = $modx->getChunk($target);
408
-	if($chunk !== false && !empty($chunk)) {
408
+	if ($chunk !== false && !empty($chunk)) {
409 409
 		$content = $chunk;
410
-	} elseif(is_file(MODX_BASE_PATH . $target)) {
411
-		$content = file_get_contents(MODX_BASE_PATH . $target);
412
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
413
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl');
414
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible
410
+	} elseif (is_file(MODX_BASE_PATH.$target)) {
411
+		$content = file_get_contents(MODX_BASE_PATH.$target);
412
+	} elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/welcome.tpl')) {
413
+		$content = file_get_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/welcome.tpl');
414
+	} elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/welcome.html')) // ClipperCMS compatible
415 415
 	{
416
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
416
+		$content = file_get_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/welcome.html');
417 417
 	} else {
418
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
418
+		$content = file_get_contents(MODX_MANAGER_PATH.'media/style/common/welcome.tpl');
419 419
 	}
420 420
 }
421 421
 
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 $content = $modx->mergeConditionalTagsContent($content);
424 424
 $content = $modx->mergeSettingsContent($content);
425 425
 $content = $modx->parseText($content, $ph);
426
-if(strpos($content, '[+') !== false) {
426
+if (strpos($content, '[+') !== false) {
427 427
 	$modx->toPlaceholders($ph);
428 428
 	$content = $modx->mergePlaceholderContent($content);
429 429
 }
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 $content = $modx->parseText($content, $_style, '[&', '&]');
433 433
 $content = $modx->cleanUpMODXTags($content); //cleanup
434 434
 
435
-if($js = $modx->getRegisteredClientScripts()) {
435
+if ($js = $modx->getRegisteredClientScripts()) {
436 436
 	$content .= $js;
437 437
 }
438 438
 
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 //	<a href="javascript:;" class="setting"><i class="fa fa-cog"></i></a>
443 443
 //  <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a>
444 444
 //</span>
445
-function getTplWidget() { // recent document info
445
+function getTplWidget(){ // recent document info
446 446
 	return '
447 447
 		<div class="[+cols+]" id="[+id+]">
448 448
 			<div class="card"[+cardAttr+]>
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 ';
454 454
 }
455 455
 
456
-function getRecentInfo() { // recent document info
456
+function getRecentInfo(){ // recent document info
457 457
 	global $modx;
458 458
 
459 459
 	$modx->addSnippet('recentInfoList', 'getRecentInfoList');
@@ -479,12 +479,12 @@  discard block
 block discarded – undo
479 479
 	return $html;
480 480
 }
481 481
 
482
-function getRecentInfoList() {
482
+function getRecentInfoList(){
483 483
 	global $modx;
484 484
 
485 485
 	$rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
486 486
 
487
-	if($modx->db->getRecordCount($rs) < 1) {
487
+	if ($modx->db->getRecordCount($rs) < 1) {
488 488
 		return '<tr><td>[%no_activity_message%]</td></tr>';
489 489
 	}
490 490
 
@@ -494,20 +494,20 @@  discard block
 block discarded – undo
494 494
 	$btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&amp;id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> ';
495 495
 
496 496
 	$output = array();
497
-	while($ph = $modx->db->getRow($rs)) {
497
+	while ($ph = $modx->db->getRow($rs)) {
498 498
 		$docid = $ph['id'];
499 499
 		$_ = $modx->getUserInfo($ph['editedby']);
500 500
 		$ph['username'] = $_['username'];
501 501
 
502
-		if($ph['deleted'] == 1) {
502
+		if ($ph['deleted'] == 1) {
503 503
 			$ph['status'] = 'deleted text-danger';
504
-		} elseif($ph['published'] == 0) {
504
+		} elseif ($ph['published'] == 0) {
505 505
 			$ph['status'] = 'unpublished font-italic text-muted';
506 506
 		} else {
507 507
 			$ph['status'] = 'published';
508 508
 		}
509 509
 
510
-		if($modx->hasPermission('edit_document')) {
510
+		if ($modx->hasPermission('edit_document')) {
511 511
 			$ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
512 512
 		} else {
513 513
 			$ph['edit_btn'] = '';
@@ -522,8 +522,8 @@  discard block
 block discarded – undo
522 522
 			$preview_disabled
523 523
 		), $btntpl['preview_btn']);
524 524
 
525
-		if($modx->hasPermission('delete_document')) {
526
-			if($ph['deleted'] == 0) {
525
+		if ($modx->hasPermission('delete_document')) {
526
+			if ($ph['deleted'] == 0) {
527 527
 				$delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&amp;id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> ';
528 528
 			} else {
529 529
 				$delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&amp;id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> ';
@@ -533,11 +533,11 @@  discard block
 block discarded – undo
533 533
 			$ph['delete_btn'] = '';
534 534
 		}
535 535
 
536
-		if($ph['deleted'] == 1 && $ph['published'] == 0) {
536
+		if ($ph['deleted'] == 1 && $ph['published'] == 0) {
537 537
 			$publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
538
-		} elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
538
+		} elseif ($ph['deleted'] == 1 && $ph['published'] == 1) {
539 539
 			$publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
540
-		} elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
540
+		} elseif ($ph['deleted'] == 0 && $ph['published'] == 0) {
541 541
 			$publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
542 542
 		} else {
543 543
 			$publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
@@ -546,16 +546,16 @@  discard block
 block discarded – undo
546 546
 
547 547
 		$ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
548 548
 
549
-		if($ph['longtitle'] == '') {
549
+		if ($ph['longtitle'] == '') {
550 550
 			$ph['longtitle'] = '(<i>[%not_set%]</i>)';
551 551
 		}
552
-		if($ph['description'] == '') {
552
+		if ($ph['description'] == '') {
553 553
 			$ph['description'] = '(<i>[%not_set%]</i>)';
554 554
 		}
555
-		if($ph['introtext'] == '') {
555
+		if ($ph['introtext'] == '') {
556 556
 			$ph['introtext'] = '(<i>[%not_set%]</i>)';
557 557
 		}
558
-		if($ph['alias'] == '') {
558
+		if ($ph['alias'] == '') {
559 559
 			$ph['alias'] = '(<i>[%not_set%]</i>)';
560 560
 		}
561 561
 
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
 	return join("\n", $output);
565 565
 }
566 566
 
567
-function getRecentInfoRowTpl() {
567
+function getRecentInfoRowTpl(){
568 568
 	$tpl = '
569 569
 						<tr>
570 570
 							<td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td>
@@ -593,11 +593,11 @@  discard block
 block discarded – undo
593 593
 }
594 594
 
595 595
 // setup icons
596
-function wrapIcon($i, $action) {
596
+function wrapIcon($i, $action){
597 597
 	return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
598 598
 }
599 599
 
600
-function getStartUpScript() {
600
+function getStartUpScript(){
601 601
 	$script = '
602 602
         <script type="text/javascript">
603 603
         function hideConfigCheckWarning(key) {
Please login to merge, or discard this patch.
manager/actions/mutate_web_user.dynamic.php 1 patch
Spacing   +31 added lines, -31 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 88:
8
-		if(!$modx->hasPermission('edit_web_user')) {
8
+		if (!$modx->hasPermission('edit_web_user')) {
9 9
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
10 10
 		}
11 11
 		break;
12 12
 	case 87:
13
-		if(!$modx->hasPermission('new_web_user')) {
13
+		if (!$modx->hasPermission('new_web_user')) {
14 14
 			$modx->webAlertAndQuit($_lang["error_no_privileges"]);
15 15
 		}
16 16
 		break;
@@ -22,30 +22,30 @@  discard block
 block discarded – undo
22 22
 
23 23
 
24 24
 // check to see the snippet editor isn't locked
25
-$rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=88 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'");
26
-if($username = $modx->db->getValue($rs)) {
25
+$rs = $modx->db->select('username', $modx->getFullTableName('active_users'), "action=88 AND id='{$user}' AND internalKey!='".$modx->getLoginUserID()."'");
26
+if ($username = $modx->db->getValue($rs)) {
27 27
 	$modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "web user"));
28 28
 }
29 29
 // end check for lock
30 30
 
31
-if($modx->manager->action == '88') {
31
+if ($modx->manager->action == '88') {
32 32
 	// get user attributes
33 33
 	$rs = $modx->db->select('*', $modx->getFullTableName('web_user_attributes'), "internalKey = '{$user}'");
34 34
 	$userdata = $modx->db->getRow($rs);
35
-	if(!$userdata) {
35
+	if (!$userdata) {
36 36
 		$modx->webAlertAndQuit("No user returned!");
37 37
 	}
38 38
 
39 39
 	// get user settings
40 40
 	$rs = $modx->db->select('*', $modx->getFullTableName('web_user_settings'), "webuser = '{$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
 	extract($usersettings, EXTR_OVERWRITE);
44 44
 
45 45
 	// get user name
46 46
 	$rs = $modx->db->select('*', $modx->getFullTableName('web_users'), "id = '{$user}'");
47 47
 	$usernamedata = $modx->db->getRow($rs);
48
-	if(!$usernamedata) {
48
+	if (!$usernamedata) {
49 49
 		$modx->webAlertAndQuit("No user returned while getting username!");
50 50
 	}
51 51
 	$_SESSION['itemname'] = $usernamedata['username'];
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
 }
58 58
 
59 59
 // avoid doubling htmlspecialchars (already encoded in DB)
60
-foreach($userdata as $key => $val) {
60
+foreach ($userdata as $key => $val) {
61 61
 	$userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']);
62 62
 };
63 63
 $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']);
64 64
 
65 65
 // restore saved form
66 66
 $formRestored = false;
67
-if($modx->manager->hasFormValues()) {
67
+if ($modx->manager->hasFormValues()) {
68 68
 	$modx->manager->loadFormValues();
69 69
 	// restore post values
70 70
 	$userdata = array_merge($userdata, $_POST);
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 
79 79
 // include the country list language file
80 80
 $_country_lang = array();
81
-if($manager_language != "english" && file_exists($modx->config['site_manager_path'] . "includes/lang/country/" . $manager_language . "_country.inc.php")) {
82
-	include_once "lang/country/" . $manager_language . "_country.inc.php";
81
+if ($manager_language != "english" && file_exists($modx->config['site_manager_path']."includes/lang/country/".$manager_language."_country.inc.php")) {
82
+	include_once "lang/country/".$manager_language."_country.inc.php";
83 83
 } else {
84 84
 	include_once "lang/country/english_country.inc.php";
85 85
 }
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 	<?php
192 192
 	// invoke OnWUsrFormPrerender event
193 193
 	$evtOut = $modx->invokeEvent("OnWUsrFormPrerender", array("id" => $user));
194
-	if(is_array($evtOut)) {
194
+	if (is_array($evtOut)) {
195 195
 		echo implode("", $evtOut);
196 196
 	}
197 197
 	?>
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	<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" ?>" />
201 201
 
202 202
 	<h1>
203
-        <i class="fa fa fa-users"></i><?= ($usernamedata['username'] ? $usernamedata['username'] . '<small>(' . $usernamedata['id'] . ')</small>' : $_lang['web_user_title']) ?>
203
+        <i class="fa fa fa-users"></i><?= ($usernamedata['username'] ? $usernamedata['username'].'<small>('.$usernamedata['id'].')</small>' : $_lang['web_user_title']) ?>
204 204
     </h1>
205 205
 
206 206
 	<?php echo $_style['actionbuttons']['dynamic']['user'] ?>
@@ -218,13 +218,13 @@  discard block
 block discarded – undo
218 218
 				<table border="0" cellspacing="0" cellpadding="3" class="table table--edit table--editUser">
219 219
 					<tr>
220 220
 						<td colspan="3"><span id="blocked" class="warning">
221
-							<?php if($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) { ?>
221
+							<?php if ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) { ?>
222 222
 								<b><?php echo $_lang['user_is_blocked']; ?></b>
223 223
 							<?php } ?>
224 224
 							</span>
225 225
 							<br /></td>
226 226
 					</tr>
227
-					<?php if(!empty($userdata['id'])) { ?>
227
+					<?php if (!empty($userdata['id'])) { ?>
228 228
 						<tr id="showname" style="display: <?php echo ($modx->manager->action == '88' && (!isset($usernamedata['oldusername']) || $usernamedata['oldusername'] == $usernamedata['username'])) ? $displayStyle : 'none'; ?> ">
229 229
 							<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>
230 230
 								<input type="hidden" name="oldusername" value="<?php echo $modx->htmlspecialchars(!empty($usernamedata['oldusername']) ? $usernamedata['oldusername'] : $usernamedata['username']); ?>" />
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 						<td><input type="text" name="newusername" class="inputBox" value="<?php echo $modx->htmlspecialchars(isset($_POST['newusername']) ? $_POST['newusername'] : $usernamedata['username']); ?>" onChange='documentDirty=true;' maxlength="100" /></td>
238 238
 					</tr>
239 239
 					<tr>
240
-						<th><?php echo $modx->manager->action == '87' ? $_lang['password'] . ":" : $_lang['change_password_new'] . ":"; ?></th>
240
+						<th><?php echo $modx->manager->action == '87' ? $_lang['password'].":" : $_lang['change_password_new'].":"; ?></th>
241 241
 						<td>&nbsp;</td>
242 242
 						<td><input name="newpasswordcheck" type="checkbox" onClick="changestate(document.userform.newpassword);changePasswordState(document.userform.newpassword);"<?php echo $modx->manager->action == "87" ? " checked disabled" : ""; ?>>
243 243
 							<input type="hidden" name="newpassword" value="<?php echo $modx->manager->action == "87" ? 1 : 0; ?>" onChange="documentDirty=true;" />
@@ -324,8 +324,8 @@  discard block
 block discarded – undo
324 324
 								<?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?>
325 325
 								<option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> >&nbsp;</option>
326 326
 								<?php
327
-								foreach($_country_lang as $key => $country) {
328
-									echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>";
327
+								foreach ($_country_lang as $key => $country) {
328
+									echo "<option value=\"$key\"".(isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '').">$country</option>";
329 329
 								}
330 330
 								?>
331 331
 							</select></td>
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 						<td>&nbsp;</td>
352 352
 						<td><textarea type="text" name="comment" class="inputBox" rows="5" onChange="documentDirty=true;"><?php echo $modx->htmlspecialchars(isset($_POST['comment']) ? $_POST['comment'] : $userdata['comment']); ?></textarea></td>
353 353
 					</tr>
354
-					<?php if($modx->manager->action == '88') { ?>
354
+					<?php if ($modx->manager->action == '88') { ?>
355 355
 						<tr>
356 356
 							<th><?php echo $_lang['user_logincount']; ?>:</th>
357 357
 							<td>&nbsp;</td>
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 					function BrowseServer() {
473 473
 						var w = screen.width * 0.7;
474 474
 						var h = screen.height * 0.7;
475
-						OpenServerBrowser("<?php echo MODX_MANAGER_URL;?>media/browser/<?php echo $which_browser;?>/browser.php?Type=images", w, h);
475
+						OpenServerBrowser("<?php echo MODX_MANAGER_URL; ?>media/browser/<?php echo $which_browser; ?>/browser.php?Type=images", w, h);
476 476
 					}
477 477
 
478 478
 					function SetUrl(url, width, height, alt) {
@@ -491,22 +491,22 @@  discard block
 block discarded – undo
491 491
 						<td class='comment'><?php echo $_lang["user_photo_message"] ?></td>
492 492
 					</tr>
493 493
 					<tr>
494
-						<td colspan="2" align="center"><img name="iphoto" src="<?php echo isset($_POST['photo']) ? (strpos($_POST['photo'], "http://") === false ? MODX_SITE_URL : "") . $_POST['photo'] : !empty($userdata['photo']) ? (strpos($userdata['photo'], "http://") === false ? MODX_SITE_URL : "") . $userdata['photo'] : $_style["tx"]; ?>" /></td>
494
+						<td colspan="2" align="center"><img name="iphoto" src="<?php echo isset($_POST['photo']) ? (strpos($_POST['photo'], "http://") === false ? MODX_SITE_URL : "").$_POST['photo'] : !empty($userdata['photo']) ? (strpos($userdata['photo'], "http://") === false ? MODX_SITE_URL : "").$userdata['photo'] : $_style["tx"]; ?>" /></td>
495 495
 					</tr>
496 496
 				</table>
497 497
 			</div>
498 498
 			<?php
499
-			if($use_udperms == 1) {
499
+			if ($use_udperms == 1) {
500 500
 
501 501
 			$groupsarray = array();
502 502
 
503
-			if($modx->manager->action == '88') { // only do this bit if the user is being edited
503
+			if ($modx->manager->action == '88') { // only do this bit if the user is being edited
504 504
 				$rs = $modx->db->select('webgroup', $modx->getFullTableName('web_groups'), "webuser='{$user}'");
505 505
 				$groupsarray = $modx->db->getColumn('webgroup', $rs);
506 506
 			}
507 507
 			// retain selected user groups between post
508
-			if(is_array($_POST['user_groups'])) {
509
-				foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
508
+			if (is_array($_POST['user_groups'])) {
509
+				foreach ($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
510 510
 			}
511 511
 			?>
512 512
 			<div class="tab-page" id="tabPermissions">
@@ -515,8 +515,8 @@  discard block
 block discarded – undo
515 515
 				<p><?php echo $_lang['access_permissions_user_message'] ?></p>
516 516
 				<?php
517 517
 				$rs = $modx->db->select('name, id', $modx->getFullTableName('webgroup_names'), '', 'name');
518
-				while($row = $modx->db->getRow($rs)) {
519
-					echo '<label><input type="checkbox" name="user_groups[]" value="' . $row['id'] . '"' . (in_array($row['id'], $groupsarray) ? ' checked="checked"' : '') . ' />' . $row['name'] . '</label><br />';
518
+				while ($row = $modx->db->getRow($rs)) {
519
+					echo '<label><input type="checkbox" name="user_groups[]" value="'.$row['id'].'"'.(in_array($row['id'], $groupsarray) ? ' checked="checked"' : '').' />'.$row['name'].'</label><br />';
520 520
 				}
521 521
 				}
522 522
 				?>
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 			$evtOut = $modx->invokeEvent("OnWUsrFormRender", array(
527 527
 				"id" => $user
528 528
 			));
529
-			if(is_array($evtOut)) {
529
+			if (is_array($evtOut)) {
530 530
 				echo implode("", $evtOut);
531 531
 			}
532 532
 			?>
Please login to merge, or discard this patch.