Completed
Push — develop ( 8dee05 )
by Dmytro
20:08
created
manager/processors/save_web_user.processor.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	$input[$k] = $v;
15 15
 }
16 16
 
17
-$id = (int)$input['id'];
17
+$id = (int) $input['id'];
18 18
 $oldusername = $input['oldusername'];
19 19
 $newusername = !empty ($input['newusername']) ? trim($input['newusername']) : "New User";
20 20
 $fullname = $input['fullname'];
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
 		$field = array();
92 92
 		$field['username'] = $newusername;
93 93
 		$field['password'] = md5($newpassword);
94
-		$webUser= EvolutionCMS\Models\WebUser::create($field);
94
+		$webUser = EvolutionCMS\Models\WebUser::create($field);
95 95
 		$internalKey = $webUser->getKey();
96
-		$field = compact( 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter');
96
+		$field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter');
97 97
 		$webUser->attributes()->create($field);
98 98
 
99 99
         $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street',
@@ -110,11 +110,11 @@  discard block
 block discarded – undo
110 110
 		/*******************************************************************************/
111 111
 		// put the user in the user_groups he/ she should be in
112 112
 		// first, check that up_perms are switched on!
113
-		if($modx->getConfig('use_udperms') == 1) {
114
-			if(!empty($user_groups)) {
115
-				for($i = 0; $i < count($user_groups); $i++) {
113
+		if ($modx->getConfig('use_udperms') == 1) {
114
+			if (!empty($user_groups)) {
115
+				for ($i = 0; $i < count($user_groups); $i++) {
116 116
 					$field = array();
117
-					$field['webgroup'] = (int)$user_groups[$i];
117
+					$field['webgroup'] = (int) $user_groups[$i];
118 118
 					$webUser->memberGroups()->create($field);
119 119
 				}
120 120
 			}
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
             sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url);
142 142
             if ($input['stay'] != '') {
143 143
 				$a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
144
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
144
+				$header = "Location: index.php?a={$a}&r=2&stay=".$input['stay'];
145 145
 				header($header);
146 146
 			} else {
147 147
 				$header = "Location: index.php?a=99&r=2";
@@ -150,12 +150,12 @@  discard block
 block discarded – undo
150 150
 		} else {
151 151
             if ($input['stay'] != '') {
152 152
 				$a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
153
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
153
+				$stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay'];
154 154
 			} else {
155 155
 				$stayUrl = "index.php?a=99&r=2";
156 156
 			}
157 157
 
158
-			include_once MODX_MANAGER_PATH . "includes/header.inc.php";
158
+			include_once MODX_MANAGER_PATH."includes/header.inc.php";
159 159
 			?>
160 160
 
161 161
 			<h1><?php echo $_lang['web_user_title']; ?></h1>
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 			</div>
179 179
 			<?php
180 180
 
181
-			include_once MODX_MANAGER_PATH . "includes/footer.inc.php";
181
+			include_once MODX_MANAGER_PATH."includes/footer.inc.php";
182 182
 		}
183 183
 		break;
184 184
 	case '88' : // edit user
@@ -242,13 +242,13 @@  discard block
 block discarded – undo
242 242
 		/*******************************************************************************/
243 243
 		// put the user in the user_groups he/ she should be in
244 244
 		// first, check that up_perms are switched on!
245
-		if($modx->getConfig('use_udperms') == 1) {
245
+		if ($modx->getConfig('use_udperms') == 1) {
246 246
 			// as this is an existing user, delete his/ her entries in the groups before saving the new groups
247 247
 			$webUser->memberGroups()->delete();
248 248
             if (!empty($user_groups)) {
249 249
                 for ($i = 0; $i < count($user_groups); $i++) {
250 250
 					$field = array();
251
-					$field['webgroup'] = (int)$user_groups[$i];
251
+					$field['webgroup'] = (int) $user_groups[$i];
252 252
 					$webUser->memberGroups()->create($field);
253 253
 				}
254 254
 			}
@@ -286,12 +286,12 @@  discard block
 block discarded – undo
286 286
         if ($genpassword == 1 && $passwordnotifymethod == 's') {
287 287
             if ($input['stay'] != '') {
288 288
 				$a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
289
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
289
+				$stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay'];
290 290
 			} else {
291 291
 				$stayUrl = "index.php?a=99&r=2";
292 292
 			}
293 293
 
294
-			include_once MODX_MANAGER_PATH . "includes/header.inc.php";
294
+			include_once MODX_MANAGER_PATH."includes/header.inc.php";
295 295
 			?>
296 296
 
297 297
 			<h1><?php echo $_lang['web_user_title']; ?></h1>
@@ -312,11 +312,11 @@  discard block
 block discarded – undo
312 312
 			</div>
313 313
 			<?php
314 314
 
315
-			include_once MODX_MANAGER_PATH . "includes/footer.inc.php";
315
+			include_once MODX_MANAGER_PATH."includes/footer.inc.php";
316 316
 		} else {
317 317
             if ($input['stay'] != '') {
318 318
 				$a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
319
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
319
+				$header = "Location: index.php?a={$a}&r=2&stay=".$input['stay'];
320 320
 				header($header);
321 321
 			} else {
322 322
 				$header = "Location: index.php?a=99&r=2";
Please login to merge, or discard this patch.
manager/processors/save_content.processor.php 1 patch
Spacing   +89 added lines, -90 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
 if (!$modx->hasPermission('save_document')) {
@@ -14,32 +14,32 @@  discard block
 block discarded – undo
14 14
 $description = $modx->getDatabase()->escape($_POST['description']);
15 15
 $alias = $modx->getDatabase()->escape($_POST['alias']);
16 16
 $link_attributes = $modx->getDatabase()->escape($_POST['link_attributes']);
17
-$isfolder = (int)$_POST['isfolder'];
18
-$richtext = (int)$_POST['richtext'];
19
-$published = (int)$_POST['published'];
20
-$parent = $_POST['parent'] != '' ? (int)$_POST['parent'] : 0;
21
-$template = (int)$_POST['template'];
22
-$menuindex = !empty($_POST['menuindex']) ? (int)$_POST['menuindex'] : 0;
23
-$searchable = (int)$_POST['searchable'];
24
-$cacheable = (int)$_POST['cacheable'];
25
-$syncsite = (int)$_POST['syncsite'];
17
+$isfolder = (int) $_POST['isfolder'];
18
+$richtext = (int) $_POST['richtext'];
19
+$published = (int) $_POST['published'];
20
+$parent = $_POST['parent'] != '' ? (int) $_POST['parent'] : 0;
21
+$template = (int) $_POST['template'];
22
+$menuindex = !empty($_POST['menuindex']) ? (int) $_POST['menuindex'] : 0;
23
+$searchable = (int) $_POST['searchable'];
24
+$cacheable = (int) $_POST['cacheable'];
25
+$syncsite = (int) $_POST['syncsite'];
26 26
 $pub_date = $_POST['pub_date'];
27 27
 $unpub_date = $_POST['unpub_date'];
28 28
 $document_groups = (isset($_POST['chkalldocs']) && $_POST['chkalldocs'] == 'on') ? array() : $_POST['docgroups'];
29 29
 $type = $modx->getDatabase()->escape($_POST['type']);
30 30
 $contentType = $modx->getDatabase()->escape($_POST['contentType']);
31
-$contentdispo = (int)$_POST['content_dispo'];
31
+$contentdispo = (int) $_POST['content_dispo'];
32 32
 $longtitle = $modx->getDatabase()->escape($_POST['longtitle']);
33
-$donthit = (int)$_POST['donthit'];
33
+$donthit = (int) $_POST['donthit'];
34 34
 $menutitle = $modx->getDatabase()->escape($_POST['menutitle']);
35
-$hidemenu = (int)$_POST['hidemenu'];
36
-$aliasvisible = (int)$_POST['alias_visible'];
35
+$hidemenu = (int) $_POST['hidemenu'];
36
+$aliasvisible = (int) $_POST['alias_visible'];
37 37
 
38 38
 /************* webber ********/
39
-$sd=isset($_POST['dir']) && strtolower($_POST['dir']) === 'asc' ? '&dir=ASC' : '&dir=DESC';
40
-$sb=isset($_POST['sort'])?'&sort='.entities($_POST['sort'], $modx->getConfig('modx_charset')):'&sort=pub_date';
41
-$pg=isset($_POST['page'])?'&page='.(int)$_POST['page']:'';
42
-$add_path=$sd.$sb.$pg;
39
+$sd = isset($_POST['dir']) && strtolower($_POST['dir']) === 'asc' ? '&dir=ASC' : '&dir=DESC';
40
+$sb = isset($_POST['sort']) ? '&sort='.entities($_POST['sort'], $modx->getConfig('modx_charset')) : '&sort=pub_date';
41
+$pg = isset($_POST['page']) ? '&page='.(int) $_POST['page'] : '';
42
+$add_path = $sd.$sb.$pg;
43 43
 
44 44
 
45 45
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     // auto assign alias
74 74
     if (!$alias && $automatic_alias) {
75 75
         $alias = strtolower($modx->stripAlias(trim($pagetitle)));
76
-        if(!$allow_duplicate_alias) {
76
+        if (!$allow_duplicate_alias) {
77 77
             if ($modx->getDatabase()->getValue($modx->getDatabase()->select('COUNT(id)', $tbl_site_content, "id<>'$id' AND alias='$alias'")) != 0) {
78 78
                 $cnt = 1;
79 79
                 $tempAlias = $alias;
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
                 }
85 85
                 $alias = $tempAlias;
86 86
             }
87
-        }else{
87
+        } else {
88 88
             if ($modx->getDatabase()->getValue($modx->getDatabase()->select('COUNT(id)', $tbl_site_content, "id<>'$id' AND parent=$parent AND alias='$alias'")) != 0) {
89 89
                 $cnt = 1;
90 90
                 $tempAlias = $alias;
@@ -165,19 +165,19 @@  discard block
 block discarded – undo
165 165
 }
166 166
 
167 167
 // get document groups for current user
168
-$tmplvars = array ();
168
+$tmplvars = array();
169 169
 if ($_SESSION['mgrDocgroups']) {
170 170
     $docgrp = implode(",", $_SESSION['mgrDocgroups']);
171 171
 }
172 172
 
173 173
 // ensure that user has not made this document inaccessible to themselves
174
-if($_SESSION['mgrRole'] != 1 && is_array($document_groups)) {
174
+if ($_SESSION['mgrRole'] != 1 && is_array($document_groups)) {
175 175
     $document_group_list = implode(',', $document_groups);
176
-    $document_group_list = implode(',', array_filter(explode(',',$document_group_list), 'is_numeric'));
177
-    if(!empty($document_group_list)) {
176
+    $document_group_list = implode(',', array_filter(explode(',', $document_group_list), 'is_numeric'));
177
+    if (!empty($document_group_list)) {
178 178
         $rs = $modx->getDatabase()->select('COUNT(mg.id)', "{$tbl_membergroup_access} AS mga, {$tbl_member_groups} AS mg", "mga.membergroup = mg.user_group AND mga.documentgroup IN({$document_group_list}) AND mg.member = {$_SESSION['mgrInternalKey']}");
179 179
         $count = $modx->getDatabase()->getValue($rs);
180
-        if($count == 0) {
180
+        if ($count == 0) {
181 181
             if ($actionToTake == 'edit') {
182 182
                 $modx->getManagerApi()->saveFormValues(27);
183 183
                 $modx->webAlertAndQuit(sprintf($_lang["resource_permissions_error"]), "index.php?a=27&id={$id}");
@@ -195,45 +195,45 @@  discard block
 block discarded – undo
195 195
         INNER JOIN {$tbl_site_tmplvar_templates} AS tvtpl ON tvtpl.tmplvarid = tv.id
196 196
         LEFT JOIN {$tbl_site_tmplvar_contentvalues} AS tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$id}'
197 197
         LEFT JOIN {$tbl_site_tmplvar_access} AS tva ON tva.tmplvarid=tv.id",
198
-    "tvtpl.templateid = '{$template}' AND (1='{$_SESSION['mgrRole']}' OR ISNULL(tva.documentgroup)" . ((!$docgrp) ? "" : " OR tva.documentgroup IN ($docgrp)") . ")",
198
+    "tvtpl.templateid = '{$template}' AND (1='{$_SESSION['mgrRole']}' OR ISNULL(tva.documentgroup)".((!$docgrp) ? "" : " OR tva.documentgroup IN ($docgrp)").")",
199 199
     "tv.rank"
200 200
     );
201 201
 while ($row = $modx->getDatabase()->getRow($rs)) {
202 202
     $tmplvar = '';
203 203
     switch ($row['type']) {
204 204
         case 'url':
205
-            $tmplvar = $_POST["tv" . $row['id']];
206
-            if ($_POST["tv" . $row['id'] . '_prefix'] != '--') {
207
-                $tmplvar = str_replace(array (
205
+            $tmplvar = $_POST["tv".$row['id']];
206
+            if ($_POST["tv".$row['id'].'_prefix'] != '--') {
207
+                $tmplvar = str_replace(array(
208 208
                     "feed://",
209 209
                     "ftp://",
210 210
                     "http://",
211 211
                     "https://",
212 212
                     "mailto:"
213 213
                 ), "", $tmplvar);
214
-                $tmplvar = $_POST["tv" . $row['id'] . '_prefix'] . $tmplvar;
214
+                $tmplvar = $_POST["tv".$row['id'].'_prefix'].$tmplvar;
215 215
             }
216 216
         break;
217 217
         case 'file':
218
-            $tmplvar = $_POST["tv" . $row['id']];
218
+            $tmplvar = $_POST["tv".$row['id']];
219 219
         break;
220 220
         default:
221
-            if (is_array($_POST["tv" . $row['id']])) {
221
+            if (is_array($_POST["tv".$row['id']])) {
222 222
                 // handles checkboxes & multiple selects elements
223
-                $feature_insert = array ();
224
-                $lst = $_POST["tv" . $row['id']];
225
-                foreach($lst as $featureValue => $feature_item) {
223
+                $feature_insert = array();
224
+                $lst = $_POST["tv".$row['id']];
225
+                foreach ($lst as $featureValue => $feature_item) {
226 226
                     $feature_insert[count($feature_insert)] = $feature_item;
227 227
                 }
228 228
                 $tmplvar = implode("||", $feature_insert);
229 229
             } else {
230
-                $tmplvar = $_POST["tv" . $row['id']];
230
+                $tmplvar = $_POST["tv".$row['id']];
231 231
             }
232 232
         break;
233 233
     }
234 234
     // save value if it was modified
235 235
     if (strlen($tmplvar) > 0 && $tmplvar != $row['default_text']) {
236
-        $tmplvars[$row['id']] = array (
236
+        $tmplvars[$row['id']] = array(
237 237
             $row['id'],
238 238
             $tmplvar
239 239
         );
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
         case 'new' :
278 278
 
279 279
             // invoke OnBeforeDocFormSave event
280
-            switch($modx->config['docid_incrmnt_method'])
280
+            switch ($modx->config['docid_incrmnt_method'])
281 281
             {
282 282
             case '1':
283 283
                 $from = "{$tbl_site_content} AS T0 LEFT JOIN {$tbl_site_content} AS T1 ON T0.id + 1 = T1.id";
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
                 $id = '';
295 295
             }
296 296
 
297
-        $modx->invokeEvent("OnBeforeDocFormSave", array (
297
+        $modx->invokeEvent("OnBeforeDocFormSave", array(
298 298
             "mode" => "new",
299 299
             "id" => $id
300 300
         ));
@@ -309,41 +309,40 @@  discard block
 block discarded – undo
309 309
         $publishedon = ($published ? $currentdate : 0);
310 310
         $publishedby = ($published ? $modx->getLoginUserID() : 0);
311 311
 
312
-        if ((!empty($pub_date))&&($published)){
313
-            $publishedon=$pub_date;
312
+        if ((!empty($pub_date)) && ($published)) {
313
+            $publishedon = $pub_date;
314 314
         }
315 315
 
316
-        $dbInsert = array
317
-        (
318
-            "introtext"        => $introtext ,
319
-            "content"          => $content ,
320
-            "pagetitle"        => $pagetitle ,
321
-            "longtitle"        => $longtitle ,
322
-            "type"             => $type ,
323
-            "description"      => $description ,
324
-            "alias"            => $alias ,
325
-            "link_attributes"  => $link_attributes ,
326
-            "isfolder"         => $isfolder ,
327
-            "richtext"         => $richtext ,
328
-            "published"        => $published ,
329
-            "parent"           => $parent ,
330
-            "template"         => $template ,
331
-            "menuindex"        => $menuindex ,
332
-            "searchable"       => $searchable ,
333
-            "cacheable"        => $cacheable ,
334
-            "createdby"        => $modx->getLoginUserID() ,
335
-            "createdon"        => $currentdate ,
336
-            "editedby"         => $modx->getLoginUserID() ,
337
-            "editedon"         => $currentdate ,
338
-            "publishedby"      => $publishedby ,
339
-            "publishedon"      => $publishedon ,
340
-            "pub_date"         => $pub_date ,
341
-            "unpub_date"       => $unpub_date ,
342
-            "contentType"      => $contentType ,
343
-            "content_dispo"    => $contentdispo ,
344
-            "donthit"          => $donthit ,
345
-            "menutitle"        => $menutitle ,
346
-            "hidemenu"         => $hidemenu ,
316
+        $dbInsert = array(
317
+            "introtext"        => $introtext,
318
+            "content"          => $content,
319
+            "pagetitle"        => $pagetitle,
320
+            "longtitle"        => $longtitle,
321
+            "type"             => $type,
322
+            "description"      => $description,
323
+            "alias"            => $alias,
324
+            "link_attributes"  => $link_attributes,
325
+            "isfolder"         => $isfolder,
326
+            "richtext"         => $richtext,
327
+            "published"        => $published,
328
+            "parent"           => $parent,
329
+            "template"         => $template,
330
+            "menuindex"        => $menuindex,
331
+            "searchable"       => $searchable,
332
+            "cacheable"        => $cacheable,
333
+            "createdby"        => $modx->getLoginUserID(),
334
+            "createdon"        => $currentdate,
335
+            "editedby"         => $modx->getLoginUserID(),
336
+            "editedon"         => $currentdate,
337
+            "publishedby"      => $publishedby,
338
+            "publishedon"      => $publishedon,
339
+            "pub_date"         => $pub_date,
340
+            "unpub_date"       => $unpub_date,
341
+            "contentType"      => $contentType,
342
+            "content_dispo"    => $contentdispo,
343
+            "donthit"          => $donthit,
344
+            "menutitle"        => $menutitle,
345
+            "hidemenu"         => $hidemenu,
347 346
             "alias_visible"    => $aliasvisible
348 347
         );
349 348
 
@@ -372,7 +371,7 @@  discard block
 block discarded – undo
372 371
             foreach ($document_groups as $value_pair) {
373 372
                 // first, split the pair (this is a new document, so ignore the second value
374 373
                 list($group) = explode(',', $value_pair); // @see actions/mutate_content.dynamic.php @ line 1138 (permissions list)
375
-                $new_groups[] = '('.(int)$group.','.$key.')';
374
+                $new_groups[] = '('.(int) $group.','.$key.')';
376 375
             }
377 376
             $saved = true;
378 377
             if (!empty($new_groups)) {
@@ -381,7 +380,7 @@  discard block
 block discarded – undo
381 380
         } else {
382 381
             $isManager = $modx->hasPermission('access_permissions');
383 382
             $isWeb     = $modx->hasPermission('web_access_permissions');
384
-            if($use_udperms && !($isManager || $isWeb) && $parent != 0) {
383
+            if ($use_udperms && !($isManager || $isWeb) && $parent != 0) {
385 384
                 // inherit document access permissions
386 385
                 $modx->getDatabase()->insert(
387 386
                     array(
@@ -400,17 +399,17 @@  discard block
 block discarded – undo
400 399
         }
401 400
 
402 401
         // invoke OnDocFormSave event
403
-        $modx->invokeEvent("OnDocFormSave", array (
402
+        $modx->invokeEvent("OnDocFormSave", array(
404 403
             "mode" => "new",
405 404
             "id" => $key
406 405
         ));
407 406
 
408 407
         // secure web documents - flag as private
409
-        include MODX_MANAGER_PATH . "includes/secure_web_documents.inc.php";
408
+        include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php";
410 409
         secureWebDocument($key);
411 410
 
412 411
         // secure manager documents - flag as private
413
-        include MODX_MANAGER_PATH . "includes/secure_mgr_documents.inc.php";
412
+        include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php";
414 413
         secureMgrDocument($key);
415 414
 
416 415
         // Set the item name for logger
@@ -429,13 +428,13 @@  discard block
 block discarded – undo
429 428
             // document
430 429
             if ($_POST['mode'] == "4")
431 430
                 $a = ($_POST['stay'] == '2') ? "27&id=$key" : "4&pid=$parent";
432
-            $header = "Location: index.php?a=" . $a . "&r=1&stay=" . $_POST['stay'];
431
+            $header = "Location: index.php?a=".$a."&r=1&stay=".$_POST['stay'];
433 432
         } else {
434 433
             $header = "Location: index.php?a=3&id=$key&r=1";
435 434
         }
436 435
 
437 436
         if (headers_sent()) {
438
-            $header = str_replace('Location: ','',$header);
437
+            $header = str_replace('Location: ', '', $header);
439 438
             echo "<script>document.location.href='$header';</script>\n";
440 439
         } else {
441 440
             header($header);
@@ -489,7 +488,7 @@  discard block
 block discarded – undo
489 488
             if (!$was_published && $published) {
490 489
                 $publishedon = $currentdate;
491 490
                 $publishedby = $modx->getLoginUserID();
492
-                }elseif ((!empty($pub_date)&& $pub_date<=$currentdate && $published)) {
491
+                }elseif ((!empty($pub_date) && $pub_date <= $currentdate && $published)) {
493 492
                 $publishedon = $pub_date;
494 493
                 $publishedby = $modx->getLoginUserID();
495 494
                    }elseif ($was_published && !$published) {
@@ -501,7 +500,7 @@  discard block
 block discarded – undo
501 500
             }
502 501
 
503 502
             // invoke OnBeforeDocFormSave event
504
-            $modx->invokeEvent("OnBeforeDocFormSave", array (
503
+            $modx->invokeEvent("OnBeforeDocFormSave", array(
505 504
                 "mode" => "upd",
506 505
                 "id" => $id
507 506
             ));
@@ -526,7 +525,7 @@  discard block
 block discarded – undo
526 525
                 . "menuindex={$menuindex}, "
527 526
                 . "searchable={$searchable}, "
528 527
                 . "cacheable={$cacheable}, "
529
-                . "editedby=" . $modx->getLoginUserID() . ", "
528
+                . "editedby=".$modx->getLoginUserID().", "
530 529
                 . "editedon={$currentdate}, "
531 530
                 . "publishedon={$publishedon}, "
532 531
                 . "publishedby={$publishedby}, "
@@ -540,7 +539,7 @@  discard block
 block discarded – undo
540 539
 
541 540
             // update template variables
542 541
             $rs = $modx->getDatabase()->select('id, tmplvarid', $tbl_site_tmplvar_contentvalues, "contentid='{$id}'");
543
-            $tvIds = array ();
542
+            $tvIds = array();
544 543
             while ($row = $modx->getDatabase()->getRow($rs)) {
545 544
                 $tvIds[$row['tmplvarid']] = $row['id'];
546 545
             }
@@ -593,7 +592,7 @@  discard block
 block discarded – undo
593 592
                     'groups_document.id, groups_document.document_group',
594 593
                     "{$tbl_document_groups} AS groups_document
595 594
                     LEFT JOIN {$tbl_documentgroup_names} AS dgn ON dgn.id = groups_document.document_group",
596
-                    "((1=".(int)$isManager." AND dgn.private_memgroup) OR (1=".(int)$isWeb." AND dgn.private_webgroup)) AND groups_document.document = '{$id}'"
595
+                    "((1=".(int) $isManager." AND dgn.private_memgroup) OR (1=".(int) $isWeb." AND dgn.private_webgroup)) AND groups_document.document = '{$id}'"
597 596
                     );
598 597
                 $old_groups = array();
599 598
                 while ($row = $modx->getDatabase()->getRow($rs)) $old_groups[$row['document_group']] = $row['id'];
@@ -605,7 +604,7 @@  discard block
 block discarded – undo
605 604
                         unset($old_groups[$group]);
606 605
                         continue;
607 606
                     } elseif ($link_id == 'new') {
608
-                        $insertions[] = '('.(int)$group.','.$id.')';
607
+                        $insertions[] = '('.(int) $group.','.$id.')';
609 608
                     }
610 609
                 }
611 610
                 if (!empty($insertions)) {
@@ -637,17 +636,17 @@  discard block
 block discarded – undo
637 636
 
638 637
 
639 638
             // invoke OnDocFormSave event
640
-            $modx->invokeEvent("OnDocFormSave", array (
639
+            $modx->invokeEvent("OnDocFormSave", array(
641 640
                 "mode" => "upd",
642 641
                 "id" => $id
643 642
             ));
644 643
 
645 644
             // secure web documents - flag as private
646
-            include MODX_MANAGER_PATH . "includes/secure_web_documents.inc.php";
645
+            include MODX_MANAGER_PATH."includes/secure_web_documents.inc.php";
647 646
             secureWebDocument($id);
648 647
 
649 648
             // secure manager documents - flag as private
650
-            include MODX_MANAGER_PATH . "includes/secure_mgr_documents.inc.php";
649
+            include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php";
651 650
             secureMgrDocument($id);
652 651
 
653 652
             // Set the item name for logger
@@ -673,13 +672,13 @@  discard block
 block discarded – undo
673 672
                         // document
674 673
                         $a = ($_POST['stay'] == '2') ? "27&id=$id" : "4&pid=$parent";
675 674
                     }
676
-                    $header = "Location: index.php?a=" . $a . "&r=1&stay=" . $_POST['stay'].$add_path;
675
+                    $header = "Location: index.php?a=".$a."&r=1&stay=".$_POST['stay'].$add_path;
677 676
                 } else {
678 677
                     $header = "Location: index.php?a=3&id=$id&r=1".$add_path;
679 678
                 }
680 679
             }
681 680
             if (headers_sent()) {
682
-                $header = str_replace('Location: ','',$header);
681
+                $header = str_replace('Location: ', '', $header);
683 682
                 echo "<script>document.location.href='$header';</script>\n";
684 683
             } else {
685 684
                 header($header);
Please login to merge, or discard this patch.
manager/processors/save_plugin.processor.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die('<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.');
4 4
 }
5 5
 if (!$modx->hasPermission('save_plugin')) {
6 6
     $modx->webAlertAndQuit($_lang['error_no_privileges']);
7 7
 }
8 8
 
9
-$id = (int)$_POST['id'];
9
+$id = (int) $_POST['id'];
10 10
 $name = $modx->getDatabase()->escape(trim($_POST['name']));
11 11
 $description = $modx->getDatabase()->escape($_POST['description']);
12 12
 $locked = isset($_POST['locked']) && $_POST['locked'] == 'on' ? '1' : '0';
@@ -20,11 +20,11 @@  discard block
 block discarded – undo
20 20
 
21 21
 //Kyle Jaebker - added category support
22 22
 if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) {
23
-    $categoryid = (int)$_POST['categoryid'];
23
+    $categoryid = (int) $_POST['categoryid'];
24 24
 } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) {
25 25
     $categoryid = 0;
26 26
 } else {
27
-    include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
27
+    include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
28 28
     $categoryid = getCategory($_POST['newcategory']);
29 29
 }
30 30
 
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
     $moduleguid = isset($parsed['guid']) ? $parsed['guid'] : $moduleguid;
41 41
 
42 42
     $description = isset($parsed['description']) ? $parsed['description'] : $description;
43
-    $version = isset($parsed['version']) ? '<b>' . $parsed['version'] . '</b> ' : '';
43
+    $version = isset($parsed['version']) ? '<b>'.$parsed['version'].'</b> ' : '';
44 44
     if ($version) {
45
-        $description = $version . trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description));
45
+        $description = $version.trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description));
46 46
     }
47 47
     if (isset($parsed['modx_category'])) {
48
-        include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
48
+        include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
49 49
         $categoryid = getCategory($parsed['modx_category']);
50 50
     }
51 51
 }
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
         // finished emptying cache - redirect
104 104
         if ($_POST['stay'] != '') {
105 105
             $a = ($_POST['stay'] == '2') ? "102&id=$newid" : '101';
106
-            $header = 'Location: index.php?a=' . $a . '&r=2&stay=' . $_POST['stay'];
106
+            $header = 'Location: index.php?a='.$a.'&r=2&stay='.$_POST['stay'];
107 107
             header($header);
108 108
         } else {
109 109
             $header = 'Location: index.php?a=76&r=2';
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
         // finished emptying cache - redirect
159 159
         if ($_POST['stay'] != '') {
160 160
             $a = ($_POST['stay'] == '2') ? "102&id=$id" : '101';
161
-            $header = 'Location: index.php?a=' . $a . '&r=2&stay=' . $_POST['stay'];
161
+            $header = 'Location: index.php?a='.$a.'&r=2&stay='.$_POST['stay'];
162 162
             header($header);
163 163
         } else {
164 164
             $modx->unlockElement(5, $id);
Please login to merge, or discard this patch.
manager/processors/remove_installer.processor.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 }
37 37
 
38 38
 $msg = '';
39
-$pth = dirname(__DIR__, 2) . '/install/';
39
+$pth = dirname(__DIR__, 2).'/install/';
40 40
 $pth = str_replace('\\', '/', $pth);
41 41
 
42 42
 if (isset($_GET['rminstall'])) {
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     }
48 48
 }
49 49
 if ($msg) {
50
-    echo "<script>alert('" . addslashes($msg) . "');</script>";
50
+    echo "<script>alert('".addslashes($msg)."');</script>";
51 51
 }
52 52
 
53 53
 echo "<script>window.location='../index.php?a=2';</script>";
Please login to merge, or discard this patch.
manager/processors/login.processor.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -1,23 +1,23 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (! isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
2
+if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
3 3
 	header('HTTP/1.0 404 Not Found');
4 4
 	exit('error');
5 5
 }
6 6
 
7
-define('IN_MANAGER_MODE', true);  // we use this to make sure files are accessed through
7
+define('IN_MANAGER_MODE', true); // we use this to make sure files are accessed through
8 8
 define('MODX_API_MODE', true);
9 9
 
10
-if (file_exists(dirname(__DIR__) . '/config.php')) {
11
-    $config = require dirname(__DIR__) . '/config.php';
12
-} elseif (file_exists(dirname(__DIR__, 2) . '/config.php')) {
13
-    $config = require dirname(__DIR__, 2) . '/config.php';
10
+if (file_exists(dirname(__DIR__).'/config.php')) {
11
+    $config = require dirname(__DIR__).'/config.php';
12
+} elseif (file_exists(dirname(__DIR__, 2).'/config.php')) {
13
+    $config = require dirname(__DIR__, 2).'/config.php';
14 14
 } else {
15 15
     $config = [
16 16
         'root' => dirname(__DIR__, 2)
17 17
     ];
18 18
 }
19
-if (!empty($config['root']) && file_exists($config['root']. '/index.php')) {
20
-    require_once $config['root'] . '/index.php';
19
+if (!empty($config['root']) && file_exists($config['root'].'/index.php')) {
20
+    require_once $config['root'].'/index.php';
21 21
 } else {
22 22
     echo "<h3>Unable to load configuration settings</h3>";
23 23
     echo "Please run the EVO <a href='../install'>install utility</a>";
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 $_lang = ManagerTheme::getLexicon();
33 33
 
34 34
 // Initialize System Alert Message Queque
35
-if(!isset($_SESSION['SystemAlertMsgQueque'])) {
35
+if (!isset($_SESSION['SystemAlertMsgQueque'])) {
36 36
 	$_SESSION['SystemAlertMsgQueque'] = array();
37 37
 }
38 38
 $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque'];
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 		'rememberme' => $rememberme
57 57
 	));
58 58
 $fields = 'mu.*, ua.*';
59
-$from = $modx->getDatabase()->getFullTableName('manager_users') . ' AS mu, ' .
60
-    $modx->getDatabase()->getFullTableName('user_attributes') . ' AS ua';
59
+$from = $modx->getDatabase()->getFullTableName('manager_users').' AS mu, '.
60
+    $modx->getDatabase()->getFullTableName('user_attributes').' AS ua';
61 61
 $where = "BINARY mu.username='{$username}' and ua.internalKey=mu.id";
62 62
 $rs = $modx->getDatabase()->select($fields, $from, $where);
63 63
 $limit = $modx->getDatabase()->getRecordCount($rs);
64 64
 
65
-if($limit == 0 || $limit > 1) {
65
+if ($limit == 0 || $limit > 1) {
66 66
 	jsAlert($_lang['login_processor_unknown_user']);
67 67
 	return;
68 68
 }
@@ -87,32 +87,32 @@  discard block
 block discarded – undo
87 87
     $modx->getDatabase()->getFullTableName('user_settings'),
88 88
     "user='{$internalKey}' AND setting_value!=''"
89 89
 );
90
-while($row = $modx->getDatabase()->getRow($rs)) {
90
+while ($row = $modx->getDatabase()->getRow($rs)) {
91 91
 	extract($row);
92 92
 	${$setting_name} = $setting_value;
93 93
 }
94 94
 
95 95
 // blocked due to number of login errors.
96
-if($failedlogins >= $failed_allowed && $blockeduntildate > time()) {
96
+if ($failedlogins >= $failed_allowed && $blockeduntildate > time()) {
97 97
 	@session_destroy();
98 98
 	session_unset();
99
-	if($cip = getenv("HTTP_CLIENT_IP")) {
99
+	if ($cip = getenv("HTTP_CLIENT_IP")) {
100 100
 		$ip = $cip;
101
-	} elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) {
101
+	} elseif ($cip = getenv("HTTP_X_FORWARDED_FOR")) {
102 102
 		$ip = $cip;
103
-	} elseif($cip = getenv("REMOTE_ADDR")) {
103
+	} elseif ($cip = getenv("REMOTE_ADDR")) {
104 104
 		$ip = $cip;
105 105
 	} else {
106 106
 		$ip = "UNKNOWN";
107 107
 	}
108 108
 	$log = new EvolutionCMS\Legacy\LogHandler();
109
-	$log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: " . $ip);
109
+	$log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: ".$ip);
110 110
 	jsAlert($_lang['login_processor_many_failed_logins']);
111 111
 	return;
112 112
 }
113 113
 
114 114
 // blocked due to number of login errors, but get to try again
115
-if($failedlogins >= $failed_allowed && $blockeduntildate < time()) {
115
+if ($failedlogins >= $failed_allowed && $blockeduntildate < time()) {
116 116
 	$fields = array();
117 117
 	$fields['failedlogincount'] = '0';
118 118
 	$fields['blockeduntil'] = time() - 1;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 }
125 125
 
126 126
 // this user has been blocked by an admin, so no way he's loggin in!
127
-if($blocked == '1') {
127
+if ($blocked == '1') {
128 128
 	@session_destroy();
129 129
 	session_unset();
130 130
 	jsAlert($_lang['login_processor_blocked1']);
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 }
133 133
 
134 134
 // blockuntil: this user has a block until date
135
-if($blockeduntildate > time()) {
135
+if ($blockeduntildate > time()) {
136 136
 	@session_destroy();
137 137
 	session_unset();
138 138
 	jsAlert($_lang['login_processor_blocked2']);
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 }
141 141
 
142 142
 // blockafter: this user has a block after date
143
-if($blockedafterdate > 0 && $blockedafterdate < time()) {
143
+if ($blockedafterdate > 0 && $blockedafterdate < time()) {
144 144
 	@session_destroy();
145 145
 	session_unset();
146 146
 	jsAlert($_lang['login_processor_blocked3']);
@@ -148,24 +148,24 @@  discard block
 block discarded – undo
148 148
 }
149 149
 
150 150
 // allowed ip
151
-if(!empty($allowed_ip)) {
152
-	if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) {
153
-		if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) {
151
+if (!empty($allowed_ip)) {
152
+	if (($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) {
153
+		if (gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) {
154 154
 			jsAlert($_lang['login_processor_remotehost_ip']);
155 155
 			return;
156 156
 		}
157 157
 	}
158
-	if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) {
158
+	if (!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) {
159 159
 		jsAlert($_lang['login_processor_remote_ip']);
160 160
 		return;
161 161
 	}
162 162
 }
163 163
 
164 164
 // allowed days
165
-if(!empty($allowed_days)) {
165
+if (!empty($allowed_days)) {
166 166
 	$date = getdate();
167 167
 	$day = $date['wday'] + 1;
168
-	if(!in_array($day,explode(',',$allowed_days))) {
168
+	if (!in_array($day, explode(',', $allowed_days))) {
169 169
 		jsAlert($_lang['login_processor_date']);
170 170
 		return;
171 171
 	}
@@ -182,33 +182,33 @@  discard block
 block discarded – undo
182 182
 
183 183
 // check if plugin authenticated the user
184 184
 $matchPassword = false;
185
-if(!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) {
185
+if (!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) {
186 186
 	// check user password - local authentication
187 187
 	$hashType = $modx->getManagerApi()->getHashType($dbasePassword);
188
-	if($hashType == 'phpass') {
188
+	if ($hashType == 'phpass') {
189 189
 		$matchPassword = login($username, $requestPassword, $dbasePassword);
190
-	} elseif($hashType == 'md5') {
190
+	} elseif ($hashType == 'md5') {
191 191
 		$matchPassword = loginMD5($internalKey, $requestPassword, $dbasePassword, $username);
192
-	} elseif($hashType == 'v1') {
192
+	} elseif ($hashType == 'v1') {
193 193
 		$matchPassword = loginV1($internalKey, $requestPassword, $dbasePassword, $username);
194 194
 	} else {
195 195
 		$matchPassword = false;
196 196
 	}
197
-} else if($rt === true || (is_array($rt) && in_array(true, $rt))) {
197
+} else if ($rt === true || (is_array($rt) && in_array(true, $rt))) {
198 198
 	$matchPassword = true;
199 199
 }
200 200
 
201
-if(!$matchPassword) {
201
+if (!$matchPassword) {
202 202
 	jsAlert($_lang['login_processor_wrong_password']);
203 203
 	incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes ?? 10);
204 204
 	return;
205 205
 }
206 206
 
207
-if($modx->config['use_captcha'] == 1) {
208
-	if(!isset ($_SESSION['veriword'])) {
207
+if ($modx->config['use_captcha'] == 1) {
208
+	if (!isset ($_SESSION['veriword'])) {
209 209
 		jsAlert($_lang['login_processor_captcha_config']);
210 210
 		return;
211
-	} elseif($_SESSION['veriword'] != $captcha_code) {
211
+	} elseif ($_SESSION['veriword'] != $captcha_code) {
212 212
 		jsAlert($_lang['login_processor_bad_code']);
213 213
 		incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes ?? 10);
214 214
 		return;
@@ -237,28 +237,28 @@  discard block
 block discarded – undo
237 237
 
238 238
 // successful login so reset fail count and update key values
239 239
 $modx->getDatabase()->update(
240
-    'failedlogincount=0, ' . 'logincount=logincount+1, ' . 'lastlogin=thislogin, ' . 'thislogin=' . time() . ', ' . "sessionid='{$currentsessionid}'",
240
+    'failedlogincount=0, '.'logincount=logincount+1, '.'lastlogin=thislogin, '.'thislogin='.time().', '."sessionid='{$currentsessionid}'",
241 241
     $modx->getDatabase()->getFullTableName('user_attributes'),
242 242
     "internalKey='{$internalKey}'"
243 243
 );
244 244
 
245 245
 // get user's document groups
246 246
 $i = 0;
247
-$rs = $modx->getDatabase()->select('uga.documentgroup', $modx->getDatabase()->getFullTableName('member_groups') . ' ug
248
-		INNER JOIN ' . $modx->getDatabase()->getFullTableName('membergroup_access') . ' uga ON uga.membergroup=ug.user_group', "ug.member='{$internalKey}'");
247
+$rs = $modx->getDatabase()->select('uga.documentgroup', $modx->getDatabase()->getFullTableName('member_groups').' ug
248
+		INNER JOIN ' . $modx->getDatabase()->getFullTableName('membergroup_access').' uga ON uga.membergroup=ug.user_group', "ug.member='{$internalKey}'");
249 249
 $_SESSION['mgrDocgroups'] = $modx->getDatabase()->getColumn('documentgroup', $rs);
250 250
 
251 251
 $_SESSION['mgrToken'] = md5($currentsessionid);
252 252
 
253
-if($rememberme == '1') {
254
-	$_SESSION['modx.mgr.session.cookie.lifetime'] = (int)$modx->config['session.cookie.lifetime'];
253
+if ($rememberme == '1') {
254
+	$_SESSION['modx.mgr.session.cookie.lifetime'] = (int) $modx->config['session.cookie.lifetime'];
255 255
 
256 256
 	// Set a cookie separate from the session cookie with the username in it.
257 257
 	// Are we using secure connection? If so, make sure the cookie is secure
258 258
 	global $https_port;
259 259
 
260 260
 	$secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port);
261
-	if(version_compare(PHP_VERSION, '5.2', '<')) {
261
+	if (version_compare(PHP_VERSION, '5.2', '<')) {
262 262
 		setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure);
263 263
 	} else {
264 264
 		setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true);
@@ -273,9 +273,9 @@  discard block
 block discarded – undo
273 273
 // Check if user already has an active session, if not check if user pressed logout end of last session
274 274
 $rs = $modx->getDatabase()->select('lasthit', $modx->getDatabase()->getFullTableName('active_user_sessions'), "internalKey='{$internalKey}'");
275 275
 $activeSession = $modx->getDatabase()->getValue($rs);
276
-if(!$activeSession) {
276
+if (!$activeSession) {
277 277
 	$rs = $modx->getDatabase()->select('lasthit', $modx->getDatabase()->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8");
278
-	if($lastHit = $modx->getDatabase()->getValue($rs)) {
278
+	if ($lastHit = $modx->getDatabase()->getValue($rs)) {
279 279
 		$_SESSION['show_logout_reminder'] = array(
280 280
 			'type' => 'logout_reminder',
281 281
 			'lastHit' => $lastHit
@@ -300,18 +300,18 @@  discard block
 block discarded – undo
300 300
     $modx->getDatabase()->getFullTableName('user_settings'),
301 301
     "user='{$internalKey}' AND setting_name='manager_login_startup'"
302 302
 );
303
-$id = (int)$modx->getDatabase()->getValue($rs);
304
-$ajax = (int)get_by_key($_POST, 'ajax', 0, 'is_scalar');
305
-if($id > 0) {
306
-	$header = 'Location: ' . $modx->makeUrl($id, '', '', 'full');
307
-	if($ajax === 1) {
303
+$id = (int) $modx->getDatabase()->getValue($rs);
304
+$ajax = (int) get_by_key($_POST, 'ajax', 0, 'is_scalar');
305
+if ($id > 0) {
306
+	$header = 'Location: '.$modx->makeUrl($id, '', '', 'full');
307
+	if ($ajax === 1) {
308 308
 		echo $header;
309 309
 	} else {
310 310
 		header($header);
311 311
 	}
312 312
 } else {
313
-	$header = 'Location: ' . MODX_MANAGER_URL;
314
-	if($ajax === 1) {
313
+	$header = 'Location: '.MODX_MANAGER_URL;
314
+	if ($ajax === 1) {
315 315
 		echo $header;
316 316
 	} else {
317 317
 		header($header);
Please login to merge, or discard this patch.
manager/processors/save_snippet.processor.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 if (!$modx->hasPermission('save_snippet')) {
6 6
     $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$id = (int)$_POST['id'];
9
+$id = (int) $_POST['id'];
10 10
 $snippet = trim($_POST['post']);
11 11
 $name = trim($_POST['name']);
12 12
 $description = $_POST['description'];
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
 
33 33
 //Kyle Jaebker - added category support
34 34
 if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) {
35
-    $category = (int)$_POST['categoryid'];
35
+    $category = (int) $_POST['categoryid'];
36 36
 } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) {
37 37
     $category = 0;
38 38
 } else {
39
-    include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
39
+    include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
40 40
     $category = checkCategory($_POST['newcategory']);
41 41
     if (!$category) {
42 42
         $category = newCategory($_POST['newcategory']);
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
     $moduleguid = isset($parsed['guid']) ? $parsed['guid'] : $moduleguid;
55 55
 
56 56
     $description = isset($parsed['description']) ? $parsed['description'] : $description;
57
-    $version = isset($parsed['version']) ? '<b>' . $parsed['version'] . '</b> ' : '';
57
+    $version = isset($parsed['version']) ? '<b>'.$parsed['version'].'</b> ' : '';
58 58
     if ($version) {
59
-        $description = $version . trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description));
59
+        $description = $version.trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description));
60 60
     }
61 61
     if (isset($parsed['modx_category'])) {
62
-        include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
62
+        include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
63 63
         $category = getCategory($parsed['modx_category']);
64 64
     }
65 65
 }
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
         ));
75 75
 
76 76
         // disallow duplicate names for new snippets
77
-        if (EvolutionCMS\Models\SiteSnippet::where('name','=',$name)->first()) {
77
+        if (EvolutionCMS\Models\SiteSnippet::where('name', '=', $name)->first()) {
78 78
             $modx->getManagerApi()->saveFormValues(23);
79 79
             $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['snippet'], $name), "index.php?a=23");
80 80
         }
81 81
 
82 82
         //do stuff to save the new doc
83
-        $newid = EvolutionCMS\Models\SiteSnippet::create(compact('name', 'description','snippet','moduleguid','locked','properties','category','disabled','createdon','editedon'))->getKey();
83
+        $newid = EvolutionCMS\Models\SiteSnippet::create(compact('name', 'description', 'snippet', 'moduleguid', 'locked', 'properties', 'category', 'disabled', 'createdon', 'editedon'))->getKey();
84 84
 
85 85
         // invoke OnSnipFormSave event
86 86
         $modx->invokeEvent("OnSnipFormSave", array(
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         // finished emptying cache - redirect
98 98
         if ($_POST['stay'] != '') {
99 99
             $a = ($_POST['stay'] == '2') ? "22&id=$newid" : "23";
100
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
100
+            $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay'];
101 101
             header($header);
102 102
         } else {
103 103
             $header = "Location: index.php?a=76&r=2";
@@ -112,15 +112,15 @@  discard block
 block discarded – undo
112 112
         ));
113 113
 
114 114
         // disallow duplicate names for snippets
115
-        if (EvolutionCMS\Models\SiteSnippet::where('id','!=',$id)->where('name','=',$name)->first()) {
115
+        if (EvolutionCMS\Models\SiteSnippet::where('id', '!=', $id)->where('name', '=', $name)->first()) {
116 116
             $modx->getManagerApi()->saveFormValues(22);
117 117
             $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['snippet'], $name), "index.php?a=22&id={$id}");
118 118
         }
119 119
 
120 120
         //do stuff to save the edited doc
121
-        $siteSnippet= EvolutionCMS\Models\SiteSnippet::find($id);
121
+        $siteSnippet = EvolutionCMS\Models\SiteSnippet::find($id);
122 122
 
123
-        $siteSnippet->update(compact('name', 'description','snippet','moduleguid','locked','properties','category','disabled','editedon'));
123
+        $siteSnippet->update(compact('name', 'description', 'snippet', 'moduleguid', 'locked', 'properties', 'category', 'disabled', 'editedon'));
124 124
 
125 125
         // invoke OnSnipFormSave event
126 126
         $modx->invokeEvent("OnSnipFormSave", array(
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
         // finished emptying cache - redirect
141 141
         if ($_POST['stay'] != '') {
142 142
             $a = ($_POST['stay'] == '2') ? "22&id=$id" : "23";
143
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
143
+            $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay'];
144 144
             header($header);
145 145
         } else {
146 146
             $modx->unlockElement(4, $id);
Please login to merge, or discard this patch.
manager/processors/duplicate_snippet.processor.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  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('new_snippet')) {
5
+if (!$modx->hasPermission('new_snippet')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$id = isset($_GET['id'])? (int)$_GET['id'] : 0;
10
-if($id==0) {
9
+$id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
10
+if ($id == 0) {
11 11
 	$modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 $snippet = EvolutionCMS\Models\SiteSnippet::findOrFail($id);
16 16
 $name = $snippet ->name;
17 17
 $count = EvolutionCMS\Models\SiteSnippet::where('name', 'like', $name.' '.$_lang['duplicated_el_suffix'].'%')->count();
18
-if($count>=1) $count = ' '.($count+1);
18
+if ($count >= 1) $count = ' '.($count + 1);
19 19
 else $count = '';
20 20
 
21 21
 // duplicate Snippet
@@ -27,5 +27,5 @@  discard block
 block discarded – undo
27 27
 $_SESSION['itemname'] = $newSnippet->name;
28 28
 
29 29
 // finish duplicating - redirect to new snippet
30
-$header="Location: index.php?r=2&a=22&id=".$newSnippet->getKey();
30
+$header = "Location: index.php?r=2&a=22&id=".$newSnippet->getKey();
31 31
 header($header);
Please login to merge, or discard this patch.
manager/processors/save_password.processor.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5
-if(!$modx->hasPermission('save_password')) {
5
+if (!$modx->hasPermission('save_password')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
 $pass1 = $_POST['pass1'];
11 11
 $pass2 = $_POST['pass2'];
12 12
 
13
-if($pass1!=$pass2){
13
+if ($pass1 != $pass2) {
14 14
 	$modx->webAlertAndQuit("Passwords don't match!");
15 15
 }
16 16
 
17
-if(strlen($pass1)<6){
17
+if (strlen($pass1) < 6) {
18 18
 	$modx->webAlertAndQuit("Password is too short. Please specify a password of at least 6 characters.");
19 19
 }
20 20
 
@@ -25,11 +25,11 @@  discard block
 block discarded – undo
25 25
     $user->update(['password' => $password]);
26 26
 
27 27
 	// invoke OnManagerChangePassword event
28
-	$modx->invokeEvent('OnManagerChangePassword', array (
28
+	$modx->invokeEvent('OnManagerChangePassword', array(
29 29
 		'userid' => $uid,
30 30
 		'username' => $_SESSION['mgrShortname'],
31 31
 		'userpassword' => $pass1
32 32
 	));
33 33
 
34
-$header="Location: index.php?a=2";
34
+$header = "Location: index.php?a=2";
35 35
 header($header);
Please login to merge, or discard this patch.
manager/actions/files.dynamic.php 1 patch
Spacing   +59 added lines, -59 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
 if (!$modx->hasPermission('file_manager')) {
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 $newToken = makeToken();
10 10
 
11 11
 // settings
12
-$theme_image_path = MODX_MANAGER_URL . 'media/style/' . $modx->config['manager_theme'] . '/images/';
12
+$theme_image_path = MODX_MANAGER_URL.'media/style/'.$modx->config['manager_theme'].'/images/';
13 13
 $excludes = array(
14 14
     '.',
15 15
     '..',
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
     '.git',
18 18
     '.idea'
19 19
 );
20
-$alias_suffix = (!empty($friendly_url_suffix)) ? ',' . ltrim($friendly_url_suffix, '.') : '';
21
-$editablefiles = explode(',', 'txt,php,tpl,less,sass,shtml,html,htm,xml,js,css,pageCache,htaccess,json,ini' . $alias_suffix);
22
-$inlineviewablefiles = explode(',', 'txt,php,tpl,less,sass,html,htm,xml,js,css,pageCache,htaccess,json,ini' . $alias_suffix);
20
+$alias_suffix = (!empty($friendly_url_suffix)) ? ','.ltrim($friendly_url_suffix, '.') : '';
21
+$editablefiles = explode(',', 'txt,php,tpl,less,sass,shtml,html,htm,xml,js,css,pageCache,htaccess,json,ini'.$alias_suffix);
22
+$inlineviewablefiles = explode(',', 'txt,php,tpl,less,sass,html,htm,xml,js,css,pageCache,htaccess,json,ini'.$alias_suffix);
23 23
 $viewablefiles = explode(',', 'jpg,gif,png,ico');
24 24
 
25 25
 $editablefiles = add_dot($editablefiles);
@@ -32,31 +32,31 @@  discard block
 block discarded – undo
32 32
 {
33 33
 */
34 34
 $protected_path[] = MODX_MANAGER_PATH;
35
-$protected_path[] = MODX_BASE_PATH . 'temp/backup';
36
-$protected_path[] = MODX_BASE_PATH . 'assets/backup';
35
+$protected_path[] = MODX_BASE_PATH.'temp/backup';
36
+$protected_path[] = MODX_BASE_PATH.'assets/backup';
37 37
 
38 38
 if (!$modx->hasPermission('save_plugin')) {
39
-    $protected_path[] = MODX_BASE_PATH . 'assets/plugins';
39
+    $protected_path[] = MODX_BASE_PATH.'assets/plugins';
40 40
 }
41 41
 if (!$modx->hasPermission('save_snippet')) {
42
-    $protected_path[] = MODX_BASE_PATH . 'assets/snippets';
42
+    $protected_path[] = MODX_BASE_PATH.'assets/snippets';
43 43
 }
44 44
 if (!$modx->hasPermission('save_template')) {
45
-    $protected_path[] = MODX_BASE_PATH . 'assets/templates';
45
+    $protected_path[] = MODX_BASE_PATH.'assets/templates';
46 46
 }
47 47
 if (!$modx->hasPermission('save_module')) {
48
-    $protected_path[] = MODX_BASE_PATH . 'assets/modules';
48
+    $protected_path[] = MODX_BASE_PATH.'assets/modules';
49 49
 }
50 50
 if (!$modx->hasPermission('empty_cache')) {
51
-    $protected_path[] = MODX_BASE_PATH . 'assets/cache';
51
+    $protected_path[] = MODX_BASE_PATH.'assets/cache';
52 52
 }
53 53
 if (!$modx->hasPermission('import_static')) {
54
-    $protected_path[] = MODX_BASE_PATH . 'temp/import';
55
-    $protected_path[] = MODX_BASE_PATH . 'assets/import';
54
+    $protected_path[] = MODX_BASE_PATH.'temp/import';
55
+    $protected_path[] = MODX_BASE_PATH.'assets/import';
56 56
 }
57 57
 if (!$modx->hasPermission('export_static')) {
58
-    $protected_path[] = MODX_BASE_PATH . 'temp/export';
59
-    $protected_path[] = MODX_BASE_PATH . 'assets/export';
58
+    $protected_path[] = MODX_BASE_PATH.'temp/export';
59
+    $protected_path[] = MODX_BASE_PATH.'assets/export';
60 60
 }
61 61
 /*
62 62
 }
@@ -98,15 +98,15 @@  discard block
 block discarded – undo
98 98
 $rw = realpath('../');
99 99
 $webstart_path = str_replace('\\', '/', str_replace($rw, '', $rf));
100 100
 if (substr($webstart_path, 0, 1) == '/') {
101
-    $webstart_path = '..' . $webstart_path;
101
+    $webstart_path = '..'.$webstart_path;
102 102
 } else {
103
-    $webstart_path = '../' . $webstart_path;
103
+    $webstart_path = '../'.$webstart_path;
104 104
 }
105 105
 
106 106
 ?>
107 107
     <script type="text/javascript">
108 108
 
109
-        var current_path = '<?= $startpath;?>';
109
+        var current_path = '<?= $startpath; ?>';
110 110
 
111 111
         function viewfile (url)
112 112
         {
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
         function unzipFile (file)
143 143
         {
144 144
             if (confirmUnzip()) {
145
-                window.location.href = "index.php?a=31&mode=unzip&path=" + current_path + '/&file=' + file + "&token=<?= $newToken;?>";
145
+                window.location.href = "index.php?a=31&mode=unzip&path=" + current_path + '/&file=' + file + "&token=<?= $newToken; ?>";
146 146
                 return false;
147 147
             }
148 148
         }
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         function deleteFolder (folder, status)
165 165
         {
166 166
             if (confirmDeleteFolder(status)) {
167
-                window.location.href = "index.php?a=31&mode=deletefolder&path=" + current_path + "&folderpath=" + current_path + '/' + folder + "&token=<?= $newToken;?>";
167
+                window.location.href = "index.php?a=31&mode=deletefolder&path=" + current_path + "&folderpath=" + current_path + '/' + folder + "&token=<?= $newToken; ?>";
168 168
                 return false;
169 169
             }
170 170
         }
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
         function deleteFile (file)
173 173
         {
174 174
             if (confirmDelete()) {
175
-                window.location.href = "index.php?a=31&mode=delete&path=" + current_path + '/' + file + "&token=<?= $newToken;?>";
175
+                window.location.href = "index.php?a=31&mode=delete&path=" + current_path + '/' + file + "&token=<?= $newToken; ?>";
176 176
                 return false;
177 177
             }
178 178
         }
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
         {
182 182
             var newFilename = prompt("<?= $_lang["files_dynamic_new_file_name"] ?>", file);
183 183
             if (newFilename !== null && newFilename !== file) {
184
-                window.location.href = "index.php?a=31&mode=duplicate&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken;?>";
184
+                window.location.href = "index.php?a=31&mode=duplicate&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken; ?>";
185 185
             }
186 186
         }
187 187
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
         {
190 190
             var newDirname = prompt("<?= $_lang["files_dynamic_new_folder_name"] ?>", dir);
191 191
             if (newDirname !== null && newDirname !== dir) {
192
-                window.location.href = "index.php?a=31&mode=renameFolder&path=" + current_path + '&dirname=' + dir + "&newDirname=" + newDirname + "&token=<?= $newToken;?>";
192
+                window.location.href = "index.php?a=31&mode=renameFolder&path=" + current_path + '&dirname=' + dir + "&newDirname=" + newDirname + "&token=<?= $newToken; ?>";
193 193
             }
194 194
         }
195 195
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
         {
198 198
             var newFilename = prompt("<?= $_lang["files_dynamic_new_file_name"] ?>", file);
199 199
             if (newFilename !== null && newFilename !== file) {
200
-                window.location.href = "index.php?a=31&mode=renameFile&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken;?>";
200
+                window.location.href = "index.php?a=31&mode=renameFile&path=" + current_path + '/' + file + "&newFilename=" + newFilename + "&token=<?= $newToken; ?>";
201 201
             }
202 202
         }
203 203
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
             <?php endif ?>
217 217
             <?php
218 218
             if (isset($_GET['mode']) && $_GET['mode'] !== 'drill') {
219
-                $href = 'a=31&path=' . urlencode($_REQUEST['path']);
219
+                $href = 'a=31&path='.urlencode($_REQUEST['path']);
220 220
             } else {
221 221
                 $href = 'a=2';
222 222
             }
@@ -226,12 +226,12 @@  discard block
 block discarded – undo
226 226
                 $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFolderName(this);"><i class="[+image+]"></i><span>[+subject+]</span></a>';
227 227
                 $ph['image'] = $_style['files_folder-open'];
228 228
                 $ph['subject'] = $_lang['add_folder'];
229
-                $ph['href'] = 'index.php?a=31&mode=newfolder&path=' . urlencode($startpath) . '&name=';
229
+                $ph['href'] = 'index.php?a=31&mode=newfolder&path='.urlencode($startpath).'&name=';
230 230
                 $_ = parsePlaceholder($tpl, $ph);
231 231
 
232
-                $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFileName(this);"><i class="[+image+]"></i><span>' . $_lang['files.dynamic.php1'] . '</span></a>';
232
+                $tpl = '<a class="btn btn-secondary" href="[+href+]" onclick="return getFileName(this);"><i class="[+image+]"></i><span>'.$_lang['files.dynamic.php1'].'</span></a>';
233 233
                 $ph['image'] = $_style['files_page_html'];
234
-                $ph['href'] = 'index.php?a=31&mode=newfile&path=' . urlencode($startpath) . '&name=';
234
+                $ph['href'] = 'index.php?a=31&mode=newfile&path='.urlencode($startpath).'&name=';
235 235
                 $_ .= parsePlaceholder($tpl, $ph);
236 236
                 echo $_;
237 237
             }
@@ -261,12 +261,12 @@  discard block
 block discarded – undo
261 261
             $ph = array();
262 262
             $ph['style_path'] = $theme_image_path;
263 263
             // To Top Level with folder icon to the left
264
-            if ($startpath == $filemanager_path || $startpath . '/' == $filemanager_path) {
265
-                $ph['image'] = '' . $_style['files_top'] . '';
264
+            if ($startpath == $filemanager_path || $startpath.'/' == $filemanager_path) {
265
+                $ph['image'] = ''.$_style['files_top'].'';
266 266
                 $ph['subject'] = '<span>Top</span>';
267 267
             } else {
268
-                $ph['image'] = '' . $_style['files_top'] . '';
269
-                $ph['subject'] = '<a href="index.php?a=31&mode=drill&path=' . $filemanager_path . '">Top</a>/';
268
+                $ph['image'] = ''.$_style['files_top'].'';
269
+                $ph['subject'] = '<a href="index.php?a=31&mode=drill&path='.$filemanager_path.'">Top</a>/';
270 270
             }
271 271
 
272 272
             echo parsePlaceholder($tpl, $ph);
@@ -283,12 +283,12 @@  discard block
 block discarded – undo
283 283
                     if (empty($v)) {
284 284
                         continue;
285 285
                     }
286
-                    $path .= rtrim($v, '/') . '/';
286
+                    $path .= rtrim($v, '/').'/';
287 287
                     if (1 < $count) {
288
-                        $href = 'index.php?a=31&mode=drill&path=' . urlencode($filemanager_path . $path);
289
-                        $pieces[$i] = '<a href="' . $href . '">' . trim($v, '/') . '</a>';
288
+                        $href = 'index.php?a=31&mode=drill&path='.urlencode($filemanager_path.$path);
289
+                        $pieces[$i] = '<a href="'.$href.'">'.trim($v, '/').'</a>';
290 290
                     } else {
291
-                        $pieces[$i] = '<span>' . trim($v, '/') . '</span>';
291
+                        $pieces[$i] = '<span>'.trim($v, '/').'</span>';
292 292
                     }
293 293
                     $count--;
294 294
                 }
@@ -301,16 +301,16 @@  discard block
 block discarded – undo
301 301
         </div>
302 302
         <?php
303 303
         // check to see user isn't trying to move below the document_root
304
-        if (substr(strtolower(str_replace('//', '/', $startpath . "/")), 0, $len) != strtolower(str_replace('//', '/', $filemanager_path . '/'))) {
304
+        if (substr(strtolower(str_replace('//', '/', $startpath."/")), 0, $len) != strtolower(str_replace('//', '/', $filemanager_path.'/'))) {
305 305
             $modx->webAlertAndQuit($_lang["files_access_denied"]);
306 306
         }
307 307
 
308 308
         // Unzip .zip files - by Raymond
309 309
         if ($enablefileunzip && get_by_key($_REQUEST, 'mode') == 'unzip' && is_writable($startpath)) {
310
-            if (!$err = unzip(realpath("{$startpath}/" . $_REQUEST['file']), realpath($startpath))) {
311
-                echo '<span class="warning"><b>' . $_lang['file_unzip_fail'] . ($err === 0 ? 'Missing zip library (php_zip.dll / zip.so)' : '') . '</b></span><br /><br />';
310
+            if (!$err = unzip(realpath("{$startpath}/".$_REQUEST['file']), realpath($startpath))) {
311
+                echo '<span class="warning"><b>'.$_lang['file_unzip_fail'].($err === 0 ? 'Missing zip library (php_zip.dll / zip.so)' : '').'</b></span><br /><br />';
312 312
             } else {
313
-                echo '<span class="success"><b>' . $_lang['file_unzip'] . '</b></span><br /><br />';
313
+                echo '<span class="success"><b>'.$_lang['file_unzip'].'</b></span><br /><br />';
314 314
             }
315 315
         }
316 316
         // End Unzip - Raymond
@@ -322,9 +322,9 @@  discard block
 block discarded – undo
322 322
             if (get_by_key($_REQUEST, 'mode') == 'deletefolder') {
323 323
                 $folder = $_REQUEST['folderpath'];
324 324
                 if (!$token_check || !@rrmdir($folder)) {
325
-                    echo '<span class="warning"><b>' . $_lang['file_folder_not_deleted'] . '</b></span><br /><br />';
325
+                    echo '<span class="warning"><b>'.$_lang['file_folder_not_deleted'].'</b></span><br /><br />';
326 326
                 } else {
327
-                    echo '<span class="success"><b>' . $_lang['file_folder_deleted'] . '</b></span><br /><br />';
327
+                    echo '<span class="success"><b>'.$_lang['file_folder_deleted'].'</b></span><br /><br />';
328 328
                 }
329 329
             }
330 330
 
@@ -335,10 +335,10 @@  discard block
 block discarded – undo
335 335
                 if (!mkdirs("{$startpath}/{$foldername}", 0777)) {
336 336
                     echo '<span class="warning"><b>', $_lang['file_folder_not_created'], '</b></span><br /><br />';
337 337
                 } else {
338
-                    if (!@chmod($startpath . '/' . $foldername, $newfolderaccessmode)) {
339
-                        echo '<span class="warning"><b>' . $_lang['file_folder_chmod_error'] . '</b></span><br /><br />';
338
+                    if (!@chmod($startpath.'/'.$foldername, $newfolderaccessmode)) {
339
+                        echo '<span class="warning"><b>'.$_lang['file_folder_chmod_error'].'</b></span><br /><br />';
340 340
                     } else {
341
-                        echo '<span class="success"><b>' . $_lang['file_folder_created'] . '</b></span><br /><br />';
341
+                        echo '<span class="success"><b>'.$_lang['file_folder_created'].'</b></span><br /><br />';
342 342
                     }
343 343
                 }
344 344
                 umask($old_umask);
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
                 $filename = $modx->getDatabase()->escape($filename);
351 351
 
352 352
                 if (!checkExtension($filename)) {
353
-                    echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />';
353
+                    echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />';
354 354
                 } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $filename) !== 0) {
355 355
                     echo $_lang['files.dynamic.php3'];
356 356
                 } else {
@@ -372,11 +372,11 @@  discard block
 block discarded – undo
372 372
                 $newFilename = $modx->getDatabase()->escape($newFilename);
373 373
 
374 374
                 if (!checkExtension($newFilename)) {
375
-                    echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />';
375
+                    echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />';
376 376
                 } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newFilename) !== 0) {
377 377
                     echo $_lang['files.dynamic.php3'];
378 378
                 } else {
379
-                    if (!copy($filename, MODX_BASE_PATH . $newFilename)) {
379
+                    if (!copy($filename, MODX_BASE_PATH.$newFilename)) {
380 380
                         echo $_lang['files.dynamic.php5'];
381 381
                     }
382 382
                     umask($old_umask);
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
             // Rename folder here
386 386
             if (get_by_key($_REQUEST, 'mode') == 'renameFolder') {
387 387
                 $old_umask = umask(0);
388
-                $dirname = $_REQUEST['path'] . '/' . $_REQUEST['dirname'];
388
+                $dirname = $_REQUEST['path'].'/'.$_REQUEST['dirname'];
389 389
                 $dirname = $modx->getDatabase()->escape($dirname);
390 390
                 $newDirname = str_replace(array(
391 391
                     '..\\',
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 
398 398
                 if (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newDirname) !== 0) {
399 399
                     echo $_lang['files.dynamic.php3'];
400
-                } else if (!rename($dirname, $_REQUEST['path'] . '/' . $newDirname)) {
400
+                } else if (!rename($dirname, $_REQUEST['path'].'/'.$newDirname)) {
401 401
                     echo '<span class="warning"><b>', $_lang['file_folder_not_created'], '</b></span><br /><br />';
402 402
                 }
403 403
                 umask($old_umask);
@@ -417,11 +417,11 @@  discard block
 block discarded – undo
417 417
                 $newFilename = $modx->getDatabase()->escape($newFilename);
418 418
 
419 419
                 if (!checkExtension($newFilename)) {
420
-                    echo '<span class="warning"><b>' . $_lang['files_filetype_notok'] . '</b></span><br /><br />';
420
+                    echo '<span class="warning"><b>'.$_lang['files_filetype_notok'].'</b></span><br /><br />';
421 421
                 } elseif (preg_match('@(\\\\|\/|\:|\;|\,|\*|\?|\"|\<|\>|\||\?)@', $newFilename) !== 0) {
422 422
                     echo $_lang['files.dynamic.php3'];
423 423
                 } else {
424
-                    if (!rename($filename, $path . '/' . $newFilename)) {
424
+                    if (!rename($filename, $path.'/'.$newFilename)) {
425 425
                         echo $_lang['files.dynamic.php5'];
426 426
                     }
427 427
                     umask($old_umask);
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
                 extract(ls($startpath, compact('len', 'webstart_path', 'editablefiles', 'enablefileunzip', 'inlineviewablefiles', 'uploadablefiles', 'enablefiledownload', 'viewablefiles', 'protected_path', 'excludes')), EXTR_OVERWRITE);
451 451
                 echo "\n\n\n";
452 452
                 if ($folders == 0 && $files == 0) {
453
-                    echo '<tr><td colspan="4"><i class="' . $_style['files_deleted_folder'] . ' FilesDeletedFolder"></i> <span style="color:#888;cursor:default;"> ' . $_lang['files_directory_is_empty'] . ' </span></td></tr>';
453
+                    echo '<tr><td colspan="4"><i class="'.$_style['files_deleted_folder'].' FilesDeletedFolder"></i> <span style="color:#888;cursor:default;"> '.$_lang['files_directory_is_empty'].' </span></td></tr>';
454 454
                 }
455 455
                 ?>
456 456
             </table>
@@ -459,10 +459,10 @@  discard block
 block discarded – undo
459 459
         <div class="container">
460 460
             <p>
461 461
                 <?php
462
-                echo $_lang['files_directories'] . ': <b>' . $folders . '</b> ';
463
-                echo $_lang['files_files'] . ': <b>' . $files . '</b> ';
464
-                echo $_lang['files_data'] . ': <b><span dir="ltr">' . nicesize($filesizes) . '</span></b> ';
465
-                echo $_lang['files_dirwritable'] . ' <b>' . (is_writable($startpath) == 1 ? $_lang['yes'] . '.' : $_lang['no']) . '.</b>'
462
+                echo $_lang['files_directories'].': <b>'.$folders.'</b> ';
463
+                echo $_lang['files_files'].': <b>'.$files.'</b> ';
464
+                echo $_lang['files_data'].': <b><span dir="ltr">'.nicesize($filesizes).'</span></b> ';
465
+                echo $_lang['files_dirwritable'].' <b>'.(is_writable($startpath) == 1 ? $_lang['yes'].'.' : $_lang['no']).'.</b>'
466 466
                 ?>
467 467
             </p>
468 468
 
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
                 </form>
488 488
                 <?php
489 489
             } else {
490
-                echo "<p>" . $_lang['files_upload_inhibited_msg'] . "</p>";
490
+                echo "<p>".$_lang['files_upload_inhibited_msg']."</p>";
491 491
             }
492 492
             ?>
493 493
             <div id="imageviewer"></div>
Please login to merge, or discard this patch.