Completed
Push — develop ( 8dee05 )
by Dmytro
20:08
created
manager/actions/mutate_user.dynamic.php 1 patch
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,7 +43,9 @@  discard block
 block discarded – undo
43 43
 	// get user settings
44 44
 	$rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('user_settings'), "user = '{$user}'");
45 45
 	$usersettings = array();
46
-	while($row = $modx->getDatabase()->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value'];
46
+	while($row = $modx->getDatabase()->getRow($rs)) {
47
+	    $usersettings[$row['setting_name']] = $row['setting_value'];
48
+	}
47 49
 	// manually extract so that user display settings are not overwritten
48 50
 	foreach($usersettings as $k => $v) {
49 51
 		if($k != 'manager_language' && $k != 'manager_theme') {
@@ -771,13 +773,16 @@  discard block
 block discarded – undo
771 773
 
772 774
 			$groupsarray = array();
773 775
 
774
-			if($modx->getManagerApi()->action == '12') { // only do this bit if the user is being edited
776
+			if($modx->getManagerApi()->action == '12') {
777
+// only do this bit if the user is being edited
775 778
 				$rs = $modx->getDatabase()->select('user_group', $modx->getDatabase()->getFullTableName('member_groups'), "member='{$user}'");
776 779
 				$groupsarray = $modx->getDatabase()->getColumn('user_group', $rs);
777 780
 			}
778 781
 			// retain selected doc groups between post
779 782
 			if(is_array($_POST['user_groups'])) {
780
-				foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v;
783
+				foreach($_POST['user_groups'] as $n => $v) {
784
+				    $groupsarray[] = $v;
785
+				}
781 786
 			}
782 787
 			?>
783 788
 			<div class="tab-page" id="tabAccess">
Please login to merge, or discard this patch.
manager/actions/modules.static.php 1 patch
Braces   +12 added lines, -12 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('new_module') || $modx->hasPermission('edit_module') || $modx->hasPermission('exec_module'))) {
5
+if (!($modx->hasPermission('new_module') || $modx->hasPermission('edit_module') || $modx->hasPermission('exec_module'))) {
6 6
     $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
@@ -10,10 +10,10 @@  discard block
 block discarded – undo
10 10
 $modx->getManagerApi()->initPageViewState();
11 11
 
12 12
 // get and save search string
13
-if ($_REQUEST['op'] == 'reset') {
13
+if ($_REQUEST['op'] == 'reset') {
14 14
     $query = '';
15 15
     $_PAGE['vs']['search'] = '';
16
-} else {
16
+} else {
17 17
     $query = isset($_REQUEST['search']) ? $_REQUEST['search'] : $_PAGE['vs']['search'];
18 18
     $sqlQuery = $modx->getDatabase()->escape($query);
19 19
     $_PAGE['vs']['search'] = $query;
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 // context menu
28 28
 $cm = new \EvolutionCMS\Support\ContextMenu("cntxm", 150);
29 29
 $cm->addItem($_lang["run_module"], "js:menuAction(1)", $_style['actions_run'], (!$modx->hasPermission('exec_module') ? 1 : 0));
30
-if ($modx->hasPermission('edit_module') || $modx->hasPermission('new_module') || $modx->hasPermission('delete_module')) {
30
+if ($modx->hasPermission('edit_module') || $modx->hasPermission('new_module') || $modx->hasPermission('delete_module')) {
31 31
     $cm->addSeparator();
32 32
 }
33 33
 $cm->addItem($_lang["edit"], "js:menuAction(2)", $_style['actions_edit'], (!$modx->hasPermission('edit_module') ? 1 : 0));
@@ -106,21 +106,21 @@  discard block
 block discarded – undo
106 106
 <div class="tab-page">
107 107
     <div class="table-responsive">
108 108
         <?php
109
-        if ($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) {
109
+        if ($_SESSION['mgrRole'] != 1 && !empty($modx->config['use_udperms'])) {
110 110
             $rs = $modx->getDatabase()->query('SELECT DISTINCT sm.id, sm.name, sm.description, mg.member, IF(disabled,"' . $_lang['yes'] . '","-") as disabled, IF(sm.icon<>"",sm.icon,"' . $_style['icons_modules'] . '") as icon
111 111
 				FROM ' . $modx->getDatabase()->getFullTableName('site_modules') . ' AS sm
112 112
 				LEFT JOIN ' . $modx->getDatabase()->getFullTableName('site_module_access') . ' AS sma ON sma.module = sm.id
113 113
 				LEFT JOIN ' . $modx->getDatabase()->getFullTableName('member_groups') . ' AS mg ON sma.usergroup = mg.user_group
114 114
                 WHERE (mg.member IS NULL OR mg.member = ' . $modx->getLoginUserID() . ') AND sm.disabled != 1 AND sm.locked != 1
115 115
                 ORDER BY sm.name');
116
-            if ($modx->hasPermission('edit_module')) {
116
+            if ($modx->hasPermission('edit_module')) {
117 117
                 $title = "<a href='index.php?a=108&id=[+id+]' title='" . $_lang["module_edit_click_title"] . "'>[+value+]</a>";
118
-            } else if ($modx->hasPermission('exec_module')) {
118
+            } else if ($modx->hasPermission('exec_module')) {
119 119
                 $title = "<a href='index.php?a=112&id=[+id+]' title='" . $_lang["module_edit_click_title"] . "'>[+value+]</a>";
120
-            } else {
120
+            } else {
121 121
                 $title = '[+value+]';
122 122
             }
123
-        } else {
123
+        } else {
124 124
             $rs = $modx->getDatabase()->select("id, name, description, IF(locked,'{$_lang['yes']}','-') as locked, IF(disabled,'{$_lang['yes']}','-') as disabled, IF(icon<>'',icon,'{$_style['icons_module']}') as icon", $modx->getDatabase()->getFullTableName("site_modules"), (!empty($sqlQuery) ? "(name LIKE '%{$sqlQuery}%') OR (description LIKE '%{$sqlQuery}%')" : ""), "name");
125 125
             $title = "<a href='index.php?a=108&id=[+id+]' title='" . $_lang["module_edit_click_title"] . "'>[+value+]</a>";
126 126
         }
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
         $grd->colWidths = "34,,,60,60";
136 136
         $grd->colAligns = "center,,,center,center";
137 137
         $grd->colTypes = "template:<a class='tableRowIcon' href='javascript:;' onclick='return showContentMenu([+id+],event);' title='" . $_lang["click_to_context"] . "'><i class='[+value+]'></i></a>||template:" . $title;
138
-        if ($listmode == '1') {
138
+        if ($listmode == '1') {
139 139
             $grd->pageSize = 0;
140 140
         }
141
-        if ($_REQUEST['op'] == 'reset') {
141
+        if ($_REQUEST['op'] == 'reset') {
142 142
             $grd->pageNumber = 1;
143 143
         }
144 144
         // render grid
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/core/uploader.php 1 patch
Braces   +193 added lines, -121 removed lines patch added patch discarded remove patch
@@ -12,7 +12,8 @@  discard block
 block discarded – undo
12 12
   *      @link http://kcfinder.sunhater.com
13 13
   */
14 14
 
15
-class uploader {
15
+class uploader
16
+{
16 17
 
17 18
 /** Release version */
18 19
     const VERSION = "2.54";
@@ -104,7 +105,8 @@  discard block
 block discarded – undo
104 105
 /** Magic method which allows read-only access to protected or private class properties
105 106
   * @param string $property
106 107
   * @return mixed */
107
-    public function __get($property) {
108
+    public function __get($property)
109
+    {
108 110
         return property_exists($this, $property) ? $this->$property : null;
109 111
     }
110 112
 
@@ -112,13 +114,16 @@  discard block
 block discarded – undo
112 114
      * uploader constructor.
113 115
      * @param DocumentParser $modx
114 116
      */
115
-    public function __construct(DocumentParser $modx) {
117
+    public function __construct(DocumentParser $modx)
118
+    {
116 119
 
117 120
         //MODX
118 121
         try {
119 122
             if ($modx instanceof DocumentParser) {
120 123
                 $this->modx = $modx;
121
-            } else throw new Exception('MODX should be instance of DocumentParser');
124
+            } else {
125
+                throw new Exception('MODX should be instance of DocumentParser');
126
+            }
122 127
         } catch (Exception $e) {
123 128
             die($e->getMessage());
124 129
         }
@@ -133,12 +138,14 @@  discard block
 block discarded – undo
133 138
         // SET CMS INTEGRATION ATTRIBUTE
134 139
         if (isset($this->get['cms']) &&
135 140
             in_array($this->get['cms'], array("drupal"))
136
-        )
137
-            $this->cms = $this->get['cms'];
141
+        ) {
142
+                    $this->cms = $this->get['cms'];
143
+        }
138 144
 
139 145
 		// LINKING UPLOADED FILE
140
-        if (count($_FILES))
141
-            $this->file = &$_FILES[key($_FILES)];
146
+        if (count($_FILES)) {
147
+                    $this->file = &$_FILES[key($_FILES)];
148
+        }
142 149
 
143 150
         // LOAD DEFAULT CONFIGURATION
144 151
         require "config.php";
@@ -148,31 +155,37 @@  discard block
 block discarded – undo
148 155
         if (isset($_CONFIG['_sessionVar']) &&
149 156
             is_array($_CONFIG['_sessionVar'])
150 157
         ) {
151
-            foreach ($_CONFIG['_sessionVar'] as $key => $val)
152
-                if ((substr($key, 0, 1) != "_") && isset($_CONFIG[$key]))
158
+            foreach ($_CONFIG['_sessionVar'] as $key => $val) {
159
+                            if ((substr($key, 0, 1) != "_") && isset($_CONFIG[$key]))
153 160
                     $this->config[$key] = $val;
154
-            if (!isset($this->config['_sessionVar']['self']))
155
-                $this->config['_sessionVar']['self'] = array();
161
+            }
162
+            if (!isset($this->config['_sessionVar']['self'])) {
163
+                            $this->config['_sessionVar']['self'] = array();
164
+            }
156 165
             $this->session = &$this->config['_sessionVar']['self'];
157
-        } else
158
-            $this->session = &$_SESSION;
166
+        } else {
167
+                    $this->session = &$_SESSION;
168
+        }
159 169
 
160 170
         // IMAGE DRIVER INIT
161 171
         if (isset($this->config['imageDriversPriority'])) {
162 172
             $this->config['imageDriversPriority'] =
163 173
                 text::clearWhitespaces($this->config['imageDriversPriority']);
164 174
             $driver = image::getDriver(explode(' ', $this->config['imageDriversPriority']));
165
-            if ($driver !== false)
166
-                $this->imageDriver = $driver;
175
+            if ($driver !== false) {
176
+                            $this->imageDriver = $driver;
177
+            }
167 178
         }
168 179
         if ((!isset($driver) || ($driver === false)) &&
169 180
             (image::getDriver(array($this->imageDriver)) === false)
170
-        )
171
-            die("Cannot find any of the supported PHP image extensions!");
181
+        ) {
182
+                    die("Cannot find any of the supported PHP image extensions!");
183
+        }
172 184
 
173 185
         // WATERMARK INIT
174
-        if (isset($this->config['watermark']) && is_string($this->config['watermark']))
175
-            $this->config['watermark'] = array('file' => $this->config['watermark']);
186
+        if (isset($this->config['watermark']) && is_string($this->config['watermark'])) {
187
+                    $this->config['watermark'] = array('file' => $this->config['watermark']);
188
+        }
176 189
 
177 190
         // GET TYPE DIRECTORY
178 191
         $this->types = &$this->config['types'];
@@ -186,9 +199,10 @@  discard block
 block discarded – undo
186 199
 
187 200
         // LOAD TYPE DIRECTORY SPECIFIC CONFIGURATION IF EXISTS
188 201
         if (is_array($this->types[$this->type])) {
189
-            foreach ($this->types[$this->type] as $key => $val)
190
-                if (in_array($key, $this->typeSettings))
202
+            foreach ($this->types[$this->type] as $key => $val) {
203
+                            if (in_array($key, $this->typeSettings))
191 204
                     $this->config[$key] = $val;
205
+            }
192 206
             $this->types[$this->type] = isset($this->types[$this->type]['type'])
193 207
                 ? $this->types[$this->type]['type'] : "";
194 208
         }
@@ -198,12 +212,14 @@  discard block
 block discarded – undo
198 212
         $ip = '/^' . implode('\.', array($ip, $ip, $ip, $ip)) . '$/';
199 213
         if (preg_match($ip, $_SERVER['HTTP_HOST']) ||
200 214
             preg_match('/^[^\.]+$/', $_SERVER['HTTP_HOST'])
201
-        )
202
-            $this->config['cookieDomain'] = "";
203
-        elseif (!strlen($this->config['cookieDomain']))
204
-            $this->config['cookieDomain'] = $_SERVER['HTTP_HOST'];
205
-        if (!strlen($this->config['cookiePath']))
206
-            $this->config['cookiePath'] = "/";
215
+        ) {
216
+                    $this->config['cookieDomain'] = "";
217
+        } elseif (!strlen($this->config['cookieDomain'])) {
218
+                    $this->config['cookieDomain'] = $_SERVER['HTTP_HOST'];
219
+        }
220
+        if (!strlen($this->config['cookiePath'])) {
221
+                    $this->config['cookiePath'] = "/";
222
+        }
207 223
 
208 224
         // UPLOAD FOLDER INIT
209 225
 
@@ -239,26 +255,30 @@  discard block
 block discarded – undo
239 255
             $this->typeDir = "{$this->config['uploadDir']}/{$this->type}";
240 256
             $this->typeURL = "{$this->config['uploadURL']}/{$this->type}";
241 257
         }
242
-        if (!is_dir($this->config['uploadDir']))
243
-            @mkdir($this->config['uploadDir'], $this->config['dirPerms']);
258
+        if (!is_dir($this->config['uploadDir'])) {
259
+                    @mkdir($this->config['uploadDir'], $this->config['dirPerms']);
260
+        }
244 261
 
245 262
         // HOST APPLICATIONS INIT
246
-        if (isset($this->get['CKEditorFuncNum']))
247
-            $this->opener['CKEditor']['funcNum'] = $this->get['CKEditorFuncNum'];
263
+        if (isset($this->get['CKEditorFuncNum'])) {
264
+                    $this->opener['CKEditor']['funcNum'] = $this->get['CKEditorFuncNum'];
265
+        }
248 266
         if (isset($this->get['opener']) &&
249 267
             (strtolower($this->get['opener']) == "tinymce") &&
250 268
             isset($this->config['_tinyMCEPath']) &&
251 269
             strlen($this->config['_tinyMCEPath'])
252
-        )
253
-            $this->opener['TinyMCE'] = true;
270
+        ) {
271
+                    $this->opener['TinyMCE'] = true;
272
+        }
254 273
 
255 274
         // LOCALIZATION
256
-        foreach ($this->langInputNames as $key)
257
-            if (isset($this->get[$key]) &&
275
+        foreach ($this->langInputNames as $key) {
276
+                    if (isset($this->get[$key]) &&
258 277
                 preg_match('/^[a-z][a-z\._\-]*$/i', $this->get[$key]) &&
259 278
                 file_exists("lang/" . strtolower($this->get[$key]) . ".php")
260 279
             ) {
261 280
                 $this->lang = $this->get[$key];
281
+        }
262 282
                 break;
263 283
             }
264 284
         $this->localize($this->lang);
@@ -269,28 +289,34 @@  discard block
 block discarded – undo
269 289
         ) {
270 290
             $htaccess = "{$this->config['uploadDir']}/.htaccess";
271 291
             if (!file_exists($htaccess)) {
272
-                if (!@file_put_contents($htaccess, $this->get_htaccess()))
273
-                    $this->backMsg("Cannot write to upload folder. {$this->config['uploadDir']}");
292
+                if (!@file_put_contents($htaccess, $this->get_htaccess())) {
293
+                                    $this->backMsg("Cannot write to upload folder. {$this->config['uploadDir']}");
294
+                }
274 295
             } else {
275
-                if (false === ($data = @file_get_contents($htaccess)))
276
-                    $this->backMsg("Cannot read .htaccess");
277
-                if (($data != $this->get_htaccess()) && !@file_put_contents($htaccess, $data))
278
-                    $this->backMsg("Incorrect .htaccess file. Cannot rewrite it!");
296
+                if (false === ($data = @file_get_contents($htaccess))) {
297
+                                    $this->backMsg("Cannot read .htaccess");
298
+                }
299
+                if (($data != $this->get_htaccess()) && !@file_put_contents($htaccess, $data)) {
300
+                                    $this->backMsg("Incorrect .htaccess file. Cannot rewrite it!");
301
+                }
279 302
             }
280 303
         }
281 304
 
282 305
         // CHECK & CREATE UPLOAD FOLDER
283 306
         if (!is_dir($this->typeDir)) {
284
-            if (!mkdir($this->typeDir, $this->config['dirPerms']))
285
-                $this->backMsg("Cannot create {dir} folder.", array('dir' => $this->type));
286
-        } elseif (!is_readable($this->typeDir))
287
-            $this->backMsg("Cannot read upload folder.");
307
+            if (!mkdir($this->typeDir, $this->config['dirPerms'])) {
308
+                            $this->backMsg("Cannot create {dir} folder.", array('dir' => $this->type));
309
+            }
310
+        } elseif (!is_readable($this->typeDir)) {
311
+                    $this->backMsg("Cannot read upload folder.");
312
+        }
288 313
     }
289 314
 
290 315
     /**
291 316
      * @return array|bool|int|null|string|void
292 317
      */
293
-    protected function getTransaliasSettings() {
318
+    protected function getTransaliasSettings()
319
+    {
294 320
 		$modx = evolutionCMS();
295 321
 
296 322
 		// Cleaning uploaded filename?
@@ -314,7 +340,8 @@  discard block
 block discarded – undo
314 340
      * @param $filename
315 341
      * @return mixed|string
316 342
      */
317
-    protected function normalizeFilename($filename) {
343
+    protected function normalizeFilename($filename)
344
+    {
318 345
 		if ($this->getTransaliasSettings()) {
319 346
         		$format = strrchr($filename, ".");
320 347
         		$filename = str_replace($format, "", $filename);
@@ -327,7 +354,8 @@  discard block
 block discarded – undo
327 354
      * @param $dirname
328 355
      * @return string
329 356
      */
330
-    protected function normalizeDirname($dirname) {
357
+    protected function normalizeDirname($dirname)
358
+    {
331 359
         return $this->modx->stripAlias($dirname);
332 360
     }
333 361
 
@@ -335,19 +363,21 @@  discard block
 block discarded – undo
335 363
      * @param array|null $aFile
336 364
      * @return bool|mixed
337 365
      */
338
-    protected function checkUploadedFile(array $aFile=null) {
366
+    protected function checkUploadedFile(array $aFile=null)
367
+    {
339 368
         $config = &$this->config;
340 369
         $file = ($aFile === null) ? $this->file : $aFile;
341 370
 
342
-        if (!is_array($file) || !isset($file['name']))
343
-            return $this->label("Unknown error.");
371
+        if (!is_array($file) || !isset($file['name'])) {
372
+                    return $this->label("Unknown error.");
373
+        }
344 374
 
345 375
         $extension = file::getExtension($file['name']);
346 376
         $typePatt = strtolower(text::clearWhitespaces($this->types[$this->type]));
347 377
 
348 378
         // CHECK FOR UPLOAD ERRORS
349
-        if ($file['error'])
350
-            return
379
+        if ($file['error']) {
380
+                    return
351 381
                 ($file['error'] == UPLOAD_ERR_INI_SIZE) ?
352 382
                     $this->label("The uploaded file exceeds {size} bytes.",
353 383
                         array('size' => ini_get('upload_max_filesize'))) : (
@@ -364,14 +394,17 @@  discard block
 block discarded – undo
364 394
                     $this->label("Failed to write file.") :
365 395
                     $this->label("Unknown error.")
366 396
             )))));
397
+        }
367 398
 
368 399
         // HIDDEN FILENAMES CHECK
369
-        elseif (substr($file['name'], 0, 1) == ".")
370
-            return $this->label("File name shouldn't begins with '.'");
400
+        elseif (substr($file['name'], 0, 1) == ".") {
401
+                    return $this->label("File name shouldn't begins with '.'");
402
+        }
371 403
 
372 404
         // EXTENSION CHECK
373
-        elseif (!$this->validateExtension($extension, $this->type))
374
-            return $this->label("Denied file extension.");
405
+        elseif (!$this->validateExtension($extension, $this->type)) {
406
+                    return $this->label("Denied file extension.");
407
+        }
375 408
 
376 409
         // SPECIAL DIRECTORY TYPES CHECK (e.g. *img)
377 410
         elseif (preg_match('/^\*([^ ]+)(.*)?$/s', $typePatt, $patt)) {
@@ -381,25 +414,30 @@  discard block
 block discarded – undo
381 414
                 $type = new $class();
382 415
                 $cfg = $config;
383 416
                 $cfg['filename'] = $file['name'];
384
-                if (strlen($params))
385
-                    $cfg['params'] = trim($params);
417
+                if (strlen($params)) {
418
+                                    $cfg['params'] = trim($params);
419
+                }
386 420
                 $response = $type->checkFile($file['tmp_name'], $cfg);
387
-                if ($response !== true)
388
-                    return $this->label($response);
389
-            } else
390
-                return $this->label("Non-existing directory type.");
421
+                if ($response !== true) {
422
+                                    return $this->label($response);
423
+                }
424
+            } else {
425
+                            return $this->label("Non-existing directory type.");
426
+            }
391 427
         }
392 428
 
393 429
         // IMAGE RESIZE
394 430
         $img = image::factory($this->imageDriver, $file['tmp_name']);
395
-        if (!$img->initError && !$this->imageResize($img, $file['tmp_name']))
396
-            return $this->label("The image is too big and/or cannot be resized.");
431
+        if (!$img->initError && !$this->imageResize($img, $file['tmp_name'])) {
432
+                    return $this->label("The image is too big and/or cannot be resized.");
433
+        }
397 434
 
398 435
 
399 436
 	// CHECK FOR MODX MAX FILE SIZE
400 437
 	$actualfilesize=filesize($file['tmp_name']);
401
-	if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize'])
402
-	    return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)");
438
+	if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) {
439
+		    return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)");
440
+	}
403 441
 
404 442
         return true;
405 443
     }
@@ -410,27 +448,32 @@  discard block
 block discarded – undo
410 448
      * @param bool $existing
411 449
      * @return bool|string
412 450
      */
413
-    protected function checkInputDir($dir, $inclType=true, $existing=true) {
451
+    protected function checkInputDir($dir, $inclType=true, $existing=true)
452
+    {
414 453
         $dir = path::normalize($dir);
415
-        if (substr($dir, 0, 1) == "/")
416
-            $dir = substr($dir, 1);
454
+        if (substr($dir, 0, 1) == "/") {
455
+                    $dir = substr($dir, 1);
456
+        }
417 457
 
418
-        if ((substr($dir, 0, 1) == ".") || (substr(basename($dir), 0, 1) == "."))
419
-            return false;
458
+        if ((substr($dir, 0, 1) == ".") || (substr(basename($dir), 0, 1) == ".")) {
459
+                    return false;
460
+        }
420 461
 
421 462
         if ($inclType) {
422 463
             $first = explode("/", $dir);
423 464
             $first = $first[0];
424
-            if ($first != $this->type)
425
-                return false;
465
+            if ($first != $this->type) {
466
+                            return false;
467
+            }
426 468
             $return = $this->removeTypeFromPath($dir);
427 469
         } else {
428 470
             $return = $dir;
429 471
             $dir = "{$this->type}/$dir";
430 472
         }
431 473
 
432
-        if (!$existing)
433
-            return $return;
474
+        if (!$existing) {
475
+                    return $return;
476
+        }
434 477
 
435 478
         $path = "{$this->config['uploadDir']}/$dir";
436 479
         return (is_dir($path) && is_readable($path)) ? $return : false;
@@ -441,21 +484,25 @@  discard block
 block discarded – undo
441 484
      * @param $type
442 485
      * @return bool
443 486
      */
444
-    protected function validateExtension($ext, $type) {
487
+    protected function validateExtension($ext, $type)
488
+    {
445 489
         $ext = trim(strtolower($ext));
446
-        if (!isset($this->types[$type]))
447
-            return false;
490
+        if (!isset($this->types[$type])) {
491
+                    return false;
492
+        }
448 493
 
449 494
         $exts = strtolower(text::clearWhitespaces($this->config['deniedExts']));
450 495
         if (strlen($exts)) {
451 496
             $exts = explode(" ", $exts);
452
-            if (in_array($ext, $exts))
453
-                return false;
497
+            if (in_array($ext, $exts)) {
498
+                            return false;
499
+            }
454 500
         }
455 501
 
456 502
         $exts = trim($this->types[$type]);
457
-        if (!strlen($exts) || substr($exts, 0, 1) == "*")
458
-            return true;
503
+        if (!strlen($exts) || substr($exts, 0, 1) == "*") {
504
+                    return true;
505
+        }
459 506
 
460 507
         if (substr($exts, 0, 1) == "!") {
461 508
             $exts = explode(" ", trim(strtolower(substr($exts, 1))));
@@ -470,7 +517,8 @@  discard block
 block discarded – undo
470 517
      * @param $path
471 518
      * @return mixed
472 519
      */
473
-    protected function getTypeFromPath($path) {
520
+    protected function getTypeFromPath($path)
521
+    {
474 522
         return preg_match('/^([^\/]*)\/.*$/', $path, $patt)
475 523
             ? $patt[1] : $path;
476 524
     }
@@ -479,7 +527,8 @@  discard block
 block discarded – undo
479 527
      * @param $path
480 528
      * @return string
481 529
      */
482
-    protected function removeTypeFromPath($path) {
530
+    protected function removeTypeFromPath($path)
531
+    {
483 532
         return preg_match('/^[^\/]*\/(.*)$/', $path, $patt)
484 533
             ? $patt[1] : "";
485 534
     }
@@ -489,16 +538,20 @@  discard block
 block discarded – undo
489 538
      * @param null $file
490 539
      * @return bool
491 540
      */
492
-    protected function imageResize($image, $file=null) {
541
+    protected function imageResize($image, $file=null)
542
+    {
493 543
 
494 544
         if (!($image instanceof image)) {
495 545
             $img = image::factory($this->imageDriver, $image);
496
-            if ($img->initError) return false;
546
+            if ($img->initError) {
547
+                return false;
548
+            }
497 549
             $file = $image;
498
-        } elseif ($file === null)
499
-            return false;
500
-        else
501
-            $img = $image;
550
+        } elseif ($file === null) {
551
+                    return false;
552
+        } else {
553
+                    $img = $image;
554
+        }
502 555
 
503 556
         $orientation = 1;
504 557
         if (function_exists("exif_read_data")) {
@@ -520,8 +573,9 @@  discard block
 block discarded – undo
520 573
             )
521 574
             ) &&
522 575
             ($orientation == 1)
523
-        )
524
-            return true;
576
+        ) {
577
+                    return true;
578
+        }
525 579
 
526 580
 
527 581
         // PROPORTIONAL RESIZE
@@ -541,15 +595,17 @@  discard block
 block discarded – undo
541 595
                 $width = $img->getPropWidth($height);
542 596
             }
543 597
 
544
-            if (isset($width) && isset($height) && !$img->resize($width, $height))
545
-                return false;
598
+            if (isset($width) && isset($height) && !$img->resize($width, $height)) {
599
+                            return false;
600
+            }
546 601
 
547 602
         // RESIZE TO FIT
548 603
         } elseif (
549 604
             $this->config['maxImageWidth'] && $this->config['maxImageHeight'] &&
550 605
             !$img->resizeFit($this->config['maxImageWidth'], $this->config['maxImageHeight'])
551
-        )
552
-            return false;
606
+        ) {
607
+                    return false;
608
+        }
553 609
 
554 610
         // AUTO FLIP AND ROTATE FROM EXIF
555 611
         if ((($orientation == 2) && !$img->flipHorizontal()) ||
@@ -559,11 +615,13 @@  discard block
 block discarded – undo
559 615
             (($orientation == 6) && !$img->rotate(90)) ||
560 616
             (($orientation == 7) && (!$img->flipHorizontal() || !$img->rotate(90))) ||
561 617
             (($orientation == 8) && !$img->rotate(270))
562
-        )
563
-            return false;
564
-        if (($orientation >= 2) && ($orientation <= 8) && ($this->imageDriver == "imagick"))
565
-            try {
618
+        ) {
619
+                    return false;
620
+        }
621
+        if (($orientation >= 2) && ($orientation <= 8) && ($this->imageDriver == "imagick")) {
622
+                    try {
566 623
                 $img->image->setImageProperty('exif:Orientation', "1");
624
+        }
567 625
             } catch (Exception $e) {}
568 626
 
569 627
         // WATERMARK
@@ -599,22 +657,26 @@  discard block
 block discarded – undo
599 657
      * @param bool $overwrite
600 658
      * @return bool
601 659
      */
602
-    protected function makeThumb($file, $overwrite=true) {
660
+    protected function makeThumb($file, $overwrite=true)
661
+    {
603 662
         $img = image::factory($this->imageDriver, $file);
604 663
 
605 664
         // Drop files which are not images
606
-        if ($img->initError)
607
-            return true;
665
+        if ($img->initError) {
666
+                    return true;
667
+        }
608 668
 
609 669
         $thumb = substr($file, strlen($this->config['uploadDir']));
610 670
         $thumb = $this->config['uploadDir'] . "/" . $this->config['thumbsDir'] . "/" . $thumb;
611 671
         $thumb = path::normalize($thumb);
612 672
         $thumbDir = dirname($thumb);
613
-        if (!is_dir($thumbDir) && !@mkdir($thumbDir, $this->config['dirPerms'], true))
614
-            return false;
673
+        if (!is_dir($thumbDir) && !@mkdir($thumbDir, $this->config['dirPerms'], true)) {
674
+                    return false;
675
+        }
615 676
 
616
-        if (!$overwrite && is_file($thumb))
617
-            return true;
677
+        if (!$overwrite && is_file($thumb)) {
678
+                    return true;
679
+        }
618 680
 
619 681
         // Images with smaller resolutions than thumbnails
620 682
         /*if (($img->width <= $this->config['thumbWidth']) &&
@@ -627,8 +689,9 @@  discard block
 block discarded – undo
627 689
 
628 690
         // Resize image
629 691
         } else */
630
-        if (!$img->resizeFit($this->config['thumbWidth'], $this->config['thumbHeight']))
631
-            return false;
692
+        if (!$img->resizeFit($this->config['thumbWidth'], $this->config['thumbHeight'])) {
693
+                    return false;
694
+        }
632 695
 
633 696
         if ( $this->imageDriver == 'gd' ) {
634 697
             $width  = imagesx( $img->image );
@@ -653,7 +716,8 @@  discard block
 block discarded – undo
653 716
     /**
654 717
      * @param $langCode
655 718
      */
656
-    protected function localize($langCode) {
719
+    protected function localize($langCode)
720
+    {
657 721
         require "lang/{$langCode}.php";
658 722
         setlocale(LC_ALL, $lang['_locale']);
659 723
         $this->charset = $lang['_charset'];
@@ -673,11 +737,13 @@  discard block
 block discarded – undo
673 737
      * @param array|null $data
674 738
      * @return mixed
675 739
      */
676
-    protected function label($string, array $data=null) {
740
+    protected function label($string, array $data=null)
741
+    {
677 742
         $return = isset($this->labels[$string]) ? $this->labels[$string] : $string;
678
-        if (is_array($data))
679
-            foreach ($data as $key => $val)
743
+        if (is_array($data)) {
744
+                    foreach ($data as $key => $val)
680 745
                 $return = str_replace("{{$key}}", $val, $return);
746
+        }
681 747
         return $return;
682 748
     }
683 749
 
@@ -685,10 +751,12 @@  discard block
 block discarded – undo
685 751
      * @param $message
686 752
      * @param array|null $data
687 753
      */
688
-    protected function backMsg($message, array $data=null) {
754
+    protected function backMsg($message, array $data=null)
755
+    {
689 756
         $message = $this->label($message, $data);
690
-        if (isset($this->file['tmp_name']) && file_exists($this->file['tmp_name']))
691
-            @unlink($this->file['tmp_name']);
757
+        if (isset($this->file['tmp_name']) && file_exists($this->file['tmp_name'])) {
758
+                    @unlink($this->file['tmp_name']);
759
+        }
692 760
         $this->callBack("", $message);
693 761
         die;
694 762
     }
@@ -697,11 +765,14 @@  discard block
 block discarded – undo
697 765
      * @param $url
698 766
      * @param string $message
699 767
      */
700
-    protected function callBack($url, $message="") {
768
+    protected function callBack($url, $message="")
769
+    {
701 770
         $message = text::jsValue($message);
702 771
         $CKfuncNum = isset($this->opener['CKEditor']['funcNum'])
703 772
             ? $this->opener['CKEditor']['funcNum'] : 0;
704
-        if (!$CKfuncNum) $CKfuncNum = 0;
773
+        if (!$CKfuncNum) {
774
+            $CKfuncNum = 0;
775
+        }
705 776
         header("Content-Type: text/html; charset={$this->charset}");
706 777
 
707 778
 ?><html>
@@ -741,7 +812,8 @@  discard block
 block discarded – undo
741 812
     /**
742 813
      * @return string
743 814
      */
744
-    protected function get_htaccess() {
815
+    protected function get_htaccess()
816
+    {
745 817
         return "<IfModule mod_php4.c>
746 818
   php_value engine off
747 819
 </IfModule>
Please login to merge, or discard this patch.
manager/media/browser/mcpuk/lib/class_image.php 1 patch
Braces   +42 added lines, -21 removed lines patch added patch discarded remove patch
@@ -12,7 +12,8 @@  discard block
 block discarded – undo
12 12
   *      @link http://kcfinder.sunhater.com
13 13
   */
14 14
 
15
-abstract class image {
15
+abstract class image
16
+{
16 17
     const DEFAULT_JPEG_QUALITY = 75;
17 18
 
18 19
 /** Image resource or object
@@ -41,7 +42,8 @@  discard block
 block discarded – undo
41 42
   * @param string $property
42 43
   * @return mixed */
43 44
 
44
-    final public function __get($property) {
45
+    final public function __get($property)
46
+    {
45 47
         return property_exists($this, $property) ? $this->$property : null;
46 48
     }
47 49
 
@@ -57,14 +59,16 @@  discard block
 block discarded – undo
57 59
   * @param mixed $image
58 60
   * @param array $options */
59 61
 
60
-    public function __construct($image, array $options=array()) {
62
+    public function __construct($image, array $options=array())
63
+    {
61 64
         $this->image = $this->width = $this->height = null;
62 65
         $imageDetails = $this->buildImage($image);
63 66
 
64
-        if ($imageDetails !== false)
65
-            list($this->image, $this->width, $this->height) = $imageDetails;
66
-        else
67
-            $this->initError = true;
67
+        if ($imageDetails !== false) {
68
+                    list($this->image, $this->width, $this->height) = $imageDetails;
69
+        } else {
70
+                    $this->initError = true;
71
+        }
68 72
         $this->options = $options;
69 73
     }
70 74
 
@@ -75,7 +79,8 @@  discard block
 block discarded – undo
75 79
   * @param mixed $image
76 80
   * @return object */
77 81
 
78
-    final static function factory($driver, $image, array $options=array()) {
82
+    final static function factory($driver, $image, array $options=array())
83
+    {
79 84
         $class = "image_$driver";
80 85
         return new $class($image, $options);
81 86
     }
@@ -86,14 +91,18 @@  discard block
 block discarded – undo
86 91
   * @param array $drivers
87 92
   * @return string */
88 93
 
89
-    final static function getDriver(array $drivers=array('gd')) {
94
+    final static function getDriver(array $drivers=array('gd'))
95
+    {
90 96
         foreach ($drivers as $driver) {
91
-            if (!preg_match('/^[a-z0-9\_]+$/i', $driver))
92
-                continue;
97
+            if (!preg_match('/^[a-z0-9\_]+$/i', $driver)) {
98
+                            continue;
99
+            }
93 100
             $class = "image_$driver";
94 101
             if (class_exists($class) && method_exists($class, "available")) {
95 102
                 eval("\$avail = $class::available();");
96
-                if ($avail) return $driver;
103
+                if ($avail) {
104
+                    return $driver;
105
+                }
97 106
             }
98 107
         }
99 108
         return false;
@@ -105,7 +114,8 @@  discard block
 block discarded – undo
105 114
   * @param mixed $image
106 115
   * @return array */
107 116
 
108
-    final protected function buildImage($image) {
117
+    final protected function buildImage($image)
118
+    {
109 119
         $class = get_class($this);
110 120
         if ($image instanceof $class) {
111 121
             $width = $image->width;
@@ -117,8 +127,9 @@  discard block
 block discarded – undo
117 127
             $height = $image[1];
118 128
             $img = $this->getBlankImage($width, $height);
119 129
 
120
-        } else
121
-            $img = $this->getImage($image, $width, $height);
130
+        } else {
131
+                    $img = $this->getImage($image, $width, $height);
132
+        }
122 133
         return ($img !== false)
123 134
             ? array($img, $width, $height)
124 135
             : false;
@@ -129,9 +140,12 @@  discard block
 block discarded – undo
129 140
   * @param integer $resizedHeight
130 141
   * @return integer */
131 142
 
132
-    final public function getPropWidth($resizedHeight) {
143
+    final public function getPropWidth($resizedHeight)
144
+    {
133 145
         $width = round(($this->width * $resizedHeight) / $this->height);
134
-        if (!$width) $width = 1;
146
+        if (!$width) {
147
+            $width = 1;
148
+        }
135 149
         return $width;
136 150
     }
137 151
 
@@ -140,9 +154,12 @@  discard block
 block discarded – undo
140 154
   * @param integer $resizedWidth
141 155
   * @return integer */
142 156
 
143
-    final public function getPropHeight($resizedWidth) {
157
+    final public function getPropHeight($resizedWidth)
158
+    {
144 159
         $height = round(($this->height * $resizedWidth) / $this->width);
145
-        if (!$height) $height = 1;
160
+        if (!$height) {
161
+            $height = 1;
162
+        }
146 163
         return $height;
147 164
     }
148 165
 
@@ -151,13 +168,17 @@  discard block
 block discarded – undo
151 168
   * static method should be implemented into driver classes like abstract
152 169
   * methods
153 170
   * @return bool */
154
-    static function available() { return false; }
171
+    static function available()
172
+    {
173
+return false; }
155 174
 
156 175
 /** Checks if file is an image. This static method should be implemented into
157 176
   * driver classes like abstract methods
158 177
   * @param string $file
159 178
   * @return bool */
160
-    static function checkImage($file) { return false; }
179
+    static function checkImage($file)
180
+    {
181
+return false; }
161 182
 
162 183
 /** Resize image. Should return TRUE on success or FALSE on failure
163 184
   * @param integer $width
Please login to merge, or discard this patch.
manager/views/frame/1.blade.php 1 patch
Braces   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
     <?php
154 154
     // invoke OnManagerTopPrerender event
155 155
     $evtOut = $modx->invokeEvent('OnManagerTopPrerender', $_REQUEST);
156
-    if (is_array($evtOut)) {
156
+    if (is_array($evtOut)) {
157 157
         echo implode("\n", $evtOut);
158 158
     }
159 159
     ?>
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
         <?php
316 316
         // invoke OnManagerTreeInit event
317 317
         $evtOut = $modx->invokeEvent('OnManagerTreeInit', $_REQUEST);
318
-        if(is_array($evtOut)) {
318
+        if(is_array($evtOut)) {
319 319
             echo implode("\n", $evtOut);
320 320
         }
321 321
         ?>
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
                 <?php
365 365
                 // invoke OnManagerTreePrerender event
366 366
                 $evtOut = $modx->invokeEvent('OnManagerTreePrerender', $modx->getDatabase()->escape($_REQUEST));
367
-                if(is_array($evtOut)) {
367
+                if(is_array($evtOut)) {
368 368
                     echo implode("\n", $evtOut);
369 369
                 }
370 370
                 $siteName = $modx->getPhpCompat()->entities($modx->getConfig('site_name'));
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
                 <?php
377 377
                 // invoke OnManagerTreeRender event
378 378
                 $evtOut = $modx->invokeEvent('OnManagerTreeRender', $modx->getDatabase()->escape($_REQUEST));
379
-                if(is_array($evtOut)) {
379
+                if(is_array($evtOut)) {
380 380
                     echo implode("\n", $evtOut);
381 381
                 }
382 382
                 ?>
@@ -414,11 +414,11 @@  discard block
 block discarded – undo
414 414
             'tree_sortdir',
415 415
             'tree_nodename'
416 416
         );
417
-        foreach ($sortParams as $param) {
418
-            if (isset($_REQUEST[$param])) {
417
+        foreach ($sortParams as $param) {
418
+            if (isset($_REQUEST[$param])) {
419 419
                 $modx->getManagerApi()->saveLastUserSetting($param, $_REQUEST[$param]);
420 420
                 $_SESSION[$param] = $_REQUEST[$param];
421
-            } else if (!isset($_SESSION[$param])) {
421
+            } else if (!isset($_SESSION[$param])) {
422 422
                 $_SESSION[$param] = $modx->getManagerApi()->getLastUserSetting($param);
423 423
             }
424 424
         }
@@ -470,16 +470,16 @@  discard block
 block discarded – undo
470 470
     </div>
471 471
 
472 472
 <?php
473
-if(!function_exists('constructLink')) {
473
+if(!function_exists('constructLink')) {
474 474
     /**
475 475
      * @param string $action
476 476
      * @param string $img
477 477
      * @param string $text
478 478
      * @param bool $allowed
479 479
      */
480
-    function constructLink($action, $img, $text, $allowed)
481
-    {
482
-        if ((bool)$allowed) {
480
+    function constructLink($action, $img, $text, $allowed)
481
+    {
482
+        if ((bool)$allowed) {
483 483
             echo sprintf('<div class="menuLink" id="item%s" onclick="modx.tree.menuHandler(%s);">', $action,
484 484
                 $action);
485 485
             echo sprintf('<i class="%s"></i> %s</div>', $img, $text);
Please login to merge, or discard this patch.
manager/views/page/2.blade.php 1 patch
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -420,20 +420,20 @@
 block discarded – undo
420 420
     $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
421 421
     if(is_array($sitewidgets)) {
422 422
         $newwidgets = array();
423
-        foreach($sitewidgets as $widget){
423
+        foreach($sitewidgets as $widget) {
424 424
             $newwidgets = array_merge($newwidgets, unserialize($widget));
425 425
         }
426 426
         $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets;
427 427
     }
428 428
 
429
-    usort($widgets, function ($a, $b) {
429
+    usort($widgets, function ($a, $b){
430 430
         return $a['menuindex'] - $b['menuindex'];
431 431
     });
432 432
 
433 433
     $tpl = $modx->getChunk('manager#welcome\Widget');
434 434
     $output = '';
435 435
     foreach($widgets as $widget) {
436
-        if ($widget['hide'] != '1'){
436
+        if ($widget['hide'] != '1') {
437 437
             $output .= $modx->parseText($tpl, $widget);
438 438
         }
439 439
     }
Please login to merge, or discard this patch.
manager/media/script/air-datepicker/datepicker.inc.php 1 patch
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,13 +1,17 @@  discard block
 block discarded – undo
1 1
 <?php
2
-class DATEPICKER {
2
+class DATEPICKER
3
+{
3 4
     /**
4 5
      * @return string
5 6
      */
6
-    public function getDP() {
7
+    public function getDP()
8
+    {
7 9
         $modx = evolutionCMS();
8 10
 
9 11
         $load_script = file_get_contents(__DIR__.'/datepicker.tpl');
10
-        if(!isset($modx->config['lang_code'])) $modx->config['lang_code'] = $this->getLangCode();
12
+        if(!isset($modx->config['lang_code'])) {
13
+            $modx->config['lang_code'] = $this->getLangCode();
14
+        }
11 15
 		$modx->config['datetime_format_lc'] = isset($modx->config['datetime_format']) ? strtolower($modx->config['datetime_format']) : 'dd-mm-yyyy';
12 16
         return $modx->mergeSettingsContent($load_script);
13 17
     }
@@ -15,7 +19,8 @@  discard block
 block discarded – undo
15 19
     /**
16 20
      * @return string
17 21
      */
18
-    public function getLangCode() {
22
+    public function getLangCode()
23
+    {
19 24
         $lang = evolutionCMS()->get('ManagerTheme')->getLang();
20 25
 
21 26
         if ($lang === 'uk') {
Please login to merge, or discard this patch.
manager/media/calendar/datepicker.inc.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,10 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-class DATEPICKER {
4
-	function __construct() {
3
+class DATEPICKER
4
+{
5
+	function __construct()
6
+	{
5 7
 	}
6 8
 
7
-	function getDP() {
9
+	function getDP()
10
+	{
8 11
 		$modx = evolutionCMS(); global $_lang;
9 12
 
10 13
 		$tpl = file_get_contents(__DIR__ . '/datepicker.tpl');
Please login to merge, or discard this patch.
manager/media/style/default/ajax.php 1 patch
Braces   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -2,19 +2,19 @@  discard block
 block discarded – undo
2 2
 define('IN_MANAGER_MODE', true);  // we use this to make sure files are accessed through
3 3
 define('MODX_API_MODE', true);
4 4
 
5
-if (file_exists(dirname(__DIR__, 3) . '/config.php')) {
5
+if (file_exists(dirname(__DIR__, 3) . '/config.php')) {
6 6
     $config = require dirname(__DIR__) . '/config.php';
7
-} elseif (file_exists(dirname(__DIR__, 4) . '/config.php')) {
7
+} elseif (file_exists(dirname(__DIR__, 4) . '/config.php')) {
8 8
     $config = require dirname(__DIR__, 4) . '/config.php';
9
-} else {
9
+} else {
10 10
     $config = [
11 11
         'root' => dirname(__DIR__, 4)
12 12
     ];
13 13
 }
14 14
 
15
-if (!empty($config['root']) && file_exists($config['root']. '/index.php')) {
15
+if (!empty($config['root']) && file_exists($config['root']. '/index.php')) {
16 16
     require_once $config['root'] . '/index.php';
17
-} else {
17
+} else {
18 18
     echo "<h3>Unable to load configuration settings</h3>";
19 19
     echo "Please run the EVO <a href='../install'>install utility</a>";
20 20
     exit;
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
 $modx->getSettings();
24 24
 
25
-if (!isset($_SESSION['mgrValidated']) || !isset($_SERVER['HTTP_X_REQUESTED_WITH']) || (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') || ($_SERVER['REQUEST_METHOD'] != 'POST')) {
25
+if (!isset($_SESSION['mgrValidated']) || !isset($_SERVER['HTTP_X_REQUESTED_WITH']) || (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest') || ($_SERVER['REQUEST_METHOD'] != 'POST')) {
26 26
     $modx->sendErrorPage();
27 27
 }
28 28
 
@@ -40,16 +40,16 @@  discard block
 block discarded – undo
40 40
 $limit = $modx->getConfig('number_of_results', 100);
41 41
 header('Content-Type: text/html; charset='.$modx->getConfig('modx_charset'), true);
42 42
 
43
-if (isset($action)) {
44
-    switch ($action) {
43
+if (isset($action)) {
44
+    switch ($action) {
45 45
         case '1': {
46
-            switch ($frame) {
46
+            switch ($frame) {
47 47
                 case 'nodes':
48 48
                     // save folderstate
49
-                    if (isset($_REQUEST['opened'])) {
49
+                    if (isset($_REQUEST['opened'])) {
50 50
                         $_SESSION['openedArray'] = $_REQUEST['opened'];
51 51
                     }
52
-                    if (isset($_REQUEST['savestateonly'])) {
52
+                    if (isset($_REQUEST['savestateonly'])) {
53 53
                         exit('send some data');
54 54
                     } //??
55 55
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
                     $output = '';
60 60
                     $hereid = isset($_REQUEST['id']) && is_numeric($_REQUEST['id']) ? $_REQUEST['id'] : '';
61 61
 
62
-                    if (isset($_REQUEST['showonlyfolders'])) {
62
+                    if (isset($_REQUEST['showonlyfolders'])) {
63 63
                         $_SESSION['tree_show_only_folders'] = $_REQUEST['showonlyfolders'];
64 64
                     }
65 65
 
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
                         'tree_sortdir',
70 70
                         'tree_nodename'
71 71
                     );
72
-                    foreach ($sortParams as $param) {
73
-                        if (isset($_REQUEST[$param])) {
72
+                    foreach ($sortParams as $param) {
73
+                        if (isset($_REQUEST[$param])) {
74 74
                             $_SESSION[$param] = $_REQUEST[$param];
75 75
                             $modx->getManagerApi()->saveLastUserSetting($param, $_REQUEST[$param]);
76 76
                         }
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
                     // icons by content type
80 80
                     $icons = getIconInfo($_style);
81 81
 
82
-                    if (isset($_SESSION['openedArray'])) {
82
+                    if (isset($_SESSION['openedArray'])) {
83 83
                         $opened = array_filter(array_map('intval', explode('|', $_SESSION['openedArray'])));
84
-                    } else {
84
+                    } else {
85 85
                         $opened = array();
86 86
                     }
87 87
 
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
                     echo makeHTML($indent, $parent, $expandAll, $hereid);
93 93
 
94 94
                     // check for deleted documents on reload
95
-                    if ($expandAll == 2) {
95
+                    if ($expandAll == 2) {
96 96
                         $rs = $modx->getDatabase()->select('id', $modx->getDatabase()->getFullTableName('site_content'), 'deleted=1 LIMIT 1');
97
-                        if ($modx->getDatabase()->getRecordCount($rs)) {
97
+                        if ($modx->getDatabase()->getRecordCount($rs)) {
98 98
                             echo '<span id="binFull"></span>'; // add a special element to let system now that the bin is full
99 99
                         }
100 100
                     }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 
109 109
             $elements = isset($_REQUEST['elements']) && is_scalar($_REQUEST['elements']) ? htmlentities($_REQUEST['elements']) : '';
110 110
 
111
-            if ($elements) {
111
+            if ($elements) {
112 112
                 $output = '';
113 113
                 $items = '';
114 114
                 $sql = '';
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
                 $sqlLike = $filter ? 'WHERE t1.name LIKE "' . $modx->getDatabase()->escape($filter) . '%"' : '';
118 118
                 $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit;
119 119
 
120
-                switch ($elements) {
120
+                switch ($elements) {
121 121
                     case 'element_templates':
122 122
                         $a = 16;
123 123
                         $sqlLike = $filter ? 'WHERE t1.templatename LIKE "' . $modx->getDatabase()->escape($filter) . '%"' : '';
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
                         ORDER BY t1.templatename ASC
128 128
                         ' . $sqlLimit);
129 129
 
130
-                        if ($modx->hasPermission('new_template')) {
130
+                        if ($modx->hasPermission('new_template')) {
131 131
                             $output .= '<li><a id="a_19" href="index.php?a=19" target="main"><i class="fa fa-plus"></i>' . $_lang['new_template'] . '</a></li>';
132 132
                         }
133 133
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                         ORDER BY t1.name ASC
144 144
                         ' . $sqlLimit);
145 145
 
146
-                        if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
146
+                        if ($modx->hasPermission('edit_template') && $modx->hasPermission('edit_snippet') && $modx->hasPermission('edit_chunk') && $modx->hasPermission('edit_plugin')) {
147 147
                             $output .= '<li><a id="a_300" href="index.php?a=300" target="main"><i class="fa fa-plus"></i>' . $_lang['new_tmplvars'] . '</a></li>';
148 148
                         }
149 149
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
                         ORDER BY t1.name ASC
158 158
                         ' . $sqlLimit);
159 159
 
160
-                        if ($modx->hasPermission('new_chunk')) {
160
+                        if ($modx->hasPermission('new_chunk')) {
161 161
                             $output .= '<li><a id="a_77" href="index.php?a=77" target="main"><i class="fa fa-plus"></i>' . $_lang['new_htmlsnippet'] . '</a></li>';
162 162
                         }
163 163
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
                         ORDER BY t1.name ASC
172 172
                         ' . $sqlLimit);
173 173
 
174
-                        if ($modx->hasPermission('new_snippet')) {
174
+                        if ($modx->hasPermission('new_snippet')) {
175 175
                             $output .= '<li><a id="a_23" href="index.php?a=23" target="main"><i class="fa fa-plus"></i>' . $_lang['new_snippet'] . '</a></li>';
176 176
                         }
177 177
 
@@ -185,19 +185,19 @@  discard block
 block discarded – undo
185 185
                         ORDER BY t1.name ASC
186 186
                         ' . $sqlLimit);
187 187
 
188
-                        if ($modx->hasPermission('new_plugin')) {
188
+                        if ($modx->hasPermission('new_plugin')) {
189 189
                             $output .= '<li><a id="a_101" href="index.php?a=101" target="main"><i class="fa fa-plus"></i>' . $_lang['new_plugin'] . '</a></li>';
190 190
                         }
191 191
 
192 192
                         break;
193 193
                 }
194 194
 
195
-                if ($count = $modx->getDatabase()->getRecordCount($sql)) {
196
-                    if ($count == $limit) {
195
+                if ($count = $modx->getDatabase()->getRecordCount($sql)) {
196
+                    if ($count == $limit) {
197 197
                         $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>';
198 198
                     }
199
-                    while ($row = $modx->getDatabase()->getRow($sql)) {
200
-                        if (($row['disabled'] || $row['locked']) && $role != 1) {
199
+                    while ($row = $modx->getDatabase()->getRow($sql)) {
200
+                        if (($row['disabled'] || $row['locked']) && $role != 1) {
201 201
                             continue;
202 202
                         }
203 203
 
@@ -205,9 +205,9 @@  discard block
 block discarded – undo
205 205
                     }
206 206
                 }
207 207
 
208
-                if (isset($_REQUEST['filter'])) {
208
+                if (isset($_REQUEST['filter'])) {
209 209
                     $output = $items;
210
-                } else {
210
+                } else {
211 211
                     $output .= $items;
212 212
                 }
213 213
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
             $sqlLike = $filter ? 'WHERE t1.username LIKE "' . $modx->getDatabase()->escape($filter) . '%"' : '';
226 226
             $sqlLimit = $sqlLike ? '' : 'LIMIT ' . $limit;
227 227
 
228
-            if(!$modx->hasPermission('save_role')) {
228
+            if(!$modx->hasPermission('save_role')) {
229 229
                 $sqlLike .= $sqlLike ? ' AND ' : 'WHERE ';
230 230
                 $sqlLike .= 't2.role != 1';
231 231
             }
@@ -237,22 +237,22 @@  discard block
 block discarded – undo
237 237
 				ORDER BY t1.username ASC
238 238
 				' . $sqlLimit);
239 239
 
240
-            if ($modx->hasPermission('new_user')) {
240
+            if ($modx->hasPermission('new_user')) {
241 241
                 $output .= '<li><a id="a_11" href="index.php?a=11" target="main"><i class="fa fa-plus"></i>' . $_lang['new_user'] . '</a></li>';
242 242
             }
243 243
 
244
-            if ($count = $modx->getDatabase()->getRecordCount($sql)) {
245
-                if ($count == $limit) {
244
+            if ($count = $modx->getDatabase()->getRecordCount($sql)) {
245
+                if ($count == $limit) {
246 246
                     $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>';
247 247
                 }
248
-                while ($row = $modx->getDatabase()->getRow($sql)) {
248
+                while ($row = $modx->getDatabase()->getRow($sql)) {
249 249
                     $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . entities($row['name'], $modx->getConfig('modx_charset')) . ' <small>(' . $row['id'] . ')</small></a></li>';
250 250
                 }
251 251
             }
252 252
 
253
-            if (isset($_REQUEST['filter'])) {
253
+            if (isset($_REQUEST['filter'])) {
254 254
                 $output = $items;
255
-            } else {
255
+            } else {
256 256
                 $output .= $items;
257 257
             }
258 258
 
@@ -276,22 +276,22 @@  discard block
 block discarded – undo
276 276
 				ORDER BY t1.username ASC
277 277
 				' . $sqlLimit);
278 278
 
279
-            if ($modx->hasPermission('new_web_user')) {
279
+            if ($modx->hasPermission('new_web_user')) {
280 280
                 $output .= '<li><a id="a_87" href="index.php?a=87" target="main"><i class="fa fa-plus"></i>' . $_lang['new_web_user'] . '</a></li>';
281 281
             }
282 282
 
283
-            if ($count = $modx->getDatabase()->getRecordCount($sql)) {
284
-                if ($count == $limit) {
283
+            if ($count = $modx->getDatabase()->getRecordCount($sql)) {
284
+                if ($count == $limit) {
285 285
                     $output .= '<li class="item-input"><input type="text" name="filter" class="dropdown-item form-control form-control-sm" autocomplete="off" /></li>';
286 286
                 }
287
-                while ($row = $modx->getDatabase()->getRow($sql)) {
287
+                while ($row = $modx->getDatabase()->getRow($sql)) {
288 288
                     $items .= '<li class="item ' . ($row['blocked'] ? 'disabled' : '') . '"><a id="a_' . $a . '__id_' . $row['id'] . '" href="index.php?a=' . $a . '&id=' . $row['id'] . '" target="main">' . entities($row['name'], $modx->getConfig('modx_charset')) . ' <small>(' . $row['id'] . ')</small></a></li>';
289 289
                 }
290 290
             }
291 291
 
292
-            if (isset($_REQUEST['filter'])) {
292
+            if (isset($_REQUEST['filter'])) {
293 293
                 $output = $items;
294
-            } else {
294
+            } else {
295 295
                 $output .= $items;
296 296
             }
297 297
 
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
             $type = isset($_REQUEST['type']) && is_scalar($_REQUEST['type']) ? $modx->getDatabase()->escape($_REQUEST['type']) : false;
306 306
             $contextmenu = '';
307 307
 
308
-            if ($role && $name && $type) {
309
-                switch ($type) {
308
+            if ($role && $name && $type) {
309
+                switch ($type) {
310 310
                     case 'Snippet':
311 311
                     case 'SnippetNoCache': {
312 312
 
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 						WHERE name="' . $name . '"
316 316
 						LIMIT 1');
317 317
 
318
-                        if ($modx->getDatabase()->getRecordCount($sql)) {
318
+                        if ($modx->getDatabase()->getRecordCount($sql)) {
319 319
                             $row = $modx->getDatabase()->getRow($sql);
320 320
                             $contextmenu = array(
321 321
                                 'header' => array(
@@ -326,13 +326,13 @@  discard block
 block discarded – undo
326 326
                                     'url' => "index.php?a=22&id=" . $row['id']
327 327
                                 )
328 328
                             );
329
-                            if (!empty($row['description'])) {
329
+                            if (!empty($row['description'])) {
330 330
                                 $contextmenu['seperator'] = '';
331 331
                                 $contextmenu['description'] = array(
332 332
                                     'innerHTML' => '<i class="fa fa-info"></i> ' . entities($row['description'], $modx->getConfig('modx_charset'))
333 333
                                 );
334 334
                             }
335
-                        } else {
335
+                        } else {
336 336
                             $contextmenu = array(
337 337
                                 'header' => array(
338 338
                                     'innerHTML' => '<i class="fa fa-code"></i> ' . entities($name, $modx->getConfig('modx_charset'))
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 						WHERE name="' . $name . '"
354 354
 						LIMIT 1');
355 355
 
356
-                        if ($modx->getDatabase()->getRecordCount($sql)) {
356
+                        if ($modx->getDatabase()->getRecordCount($sql)) {
357 357
                             $row = $modx->getDatabase()->getRow($sql);
358 358
                             $contextmenu = array(
359 359
                                 'header' => array(
@@ -364,13 +364,13 @@  discard block
 block discarded – undo
364 364
                                     'url' => "index.php?a=78&id=" . $row['id']
365 365
                                 )
366 366
                             );
367
-                            if (!empty($row['description'])) {
367
+                            if (!empty($row['description'])) {
368 368
                                 $contextmenu['seperator'] = '';
369 369
                                 $contextmenu['description'] = array(
370 370
                                     'innerHTML' => '<i class="fa fa-info"></i> ' . entities($row['description'], $modx->getConfig('modx_charset'))
371 371
                                 );
372 372
                             }
373
-                        } else {
373
+                        } else {
374 374
                             $contextmenu = array(
375 375
                                 'header' => array(
376 376
                                     'innerHTML' => '<i class="fa fa-th-large"></i> ' . entities($name, $modx->getConfig('modx_charset'))
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 						WHERE name="' . $name . '"
391 391
 						LIMIT 1');
392 392
 
393
-                        if ($modx->getDatabase()->getRecordCount($sql)) {
393
+                        if ($modx->getDatabase()->getRecordCount($sql)) {
394 394
                             $row = $modx->getDatabase()->getRow($sql);
395 395
                             $contextmenu = array(
396 396
                                 'header' => array(
@@ -401,20 +401,20 @@  discard block
 block discarded – undo
401 401
                                     'url' => "index.php?a=78&id=" . $row['id']
402 402
                                 )
403 403
                             );
404
-                            if (!empty($row['description'])) {
404
+                            if (!empty($row['description'])) {
405 405
                                 $contextmenu['seperator'] = '';
406 406
                                 $contextmenu['description'] = array(
407 407
                                     'innerHTML' => '<i class="fa fa-info"></i> ' . entities($row['description'], $modx->getConfig('modx_charset'))
408 408
                                 );
409 409
                             }
410
-                        } else {
410
+                        } else {
411 411
 
412 412
                             $sql = $modx->getDatabase()->query('SELECT *
413 413
 							FROM ' . $modx->getFullTableName('site_snippets') . '
414 414
 							WHERE name="' . $name . '"
415 415
 							LIMIT 1');
416 416
 
417
-                            if ($modx->getDatabase()->getRecordCount($sql)) {
417
+                            if ($modx->getDatabase()->getRecordCount($sql)) {
418 418
                                 $row = $modx->getDatabase()->getRow($sql);
419 419
                                 $contextmenu = array(
420 420
                                     'header' => array(
@@ -425,13 +425,13 @@  discard block
 block discarded – undo
425 425
                                         'url' => "index.php?a=22&id=" . $row['id']
426 426
                                     )
427 427
                                 );
428
-                                if (!empty($row['description'])) {
428
+                                if (!empty($row['description'])) {
429 429
                                     $contextmenu['seperator'] = '';
430 430
                                     $contextmenu['description'] = array(
431 431
                                         'innerHTML' => '<i class="fa fa-info"></i> ' . entities($row['description'], $modx->getConfig('modx_charset'))
432 432
                                     );
433 433
                                 }
434
-                            } else {
434
+                            } else {
435 435
                                 $contextmenu = array(
436 436
                                     'header' => array(
437 437
                                         'innerHTML' => '<i class="fa fa-code"></i> ' . entities($name, $modx->getConfig('modx_charset'))
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
                             'alias_visible'
494 494
                         );
495 495
 
496
-                        if (in_array($name, $default_field)) {
496
+                        if (in_array($name, $default_field)) {
497 497
                             return;
498 498
                         }
499 499
 
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 						WHERE name="' . $name . '"
503 503
 						LIMIT 1');
504 504
 
505
-                        if ($modx->getDatabase()->getRecordCount($sql)) {
505
+                        if ($modx->getDatabase()->getRecordCount($sql)) {
506 506
                             $row = $modx->getDatabase()->getRow($sql);
507 507
                             $contextmenu = array(
508 508
                                 'header' => array(
@@ -513,13 +513,13 @@  discard block
 block discarded – undo
513 513
                                     'url' => "index.php?a=301&id=" . $row['id']
514 514
                                 )
515 515
                             );
516
-                            if (!empty($row['description'])) {
516
+                            if (!empty($row['description'])) {
517 517
                                 $contextmenu['seperator'] = '';
518 518
                                 $contextmenu['description'] = array(
519 519
                                     'innerHTML' => '<i class="fa fa-info"></i> ' . entities($row['description'], $modx->getConfig('modx_charset'))
520 520
                                 );
521 521
                             }
522
-                        } else {
522
+                        } else {
523 523
                             $contextmenu = array(
524 524
                                 'header' => array(
525 525
                                     'innerHTML' => '<i class="fa fa-list-alt"></i> ' . entities($name, $modx->getConfig('modx_charset'))
@@ -544,13 +544,13 @@  discard block
 block discarded – undo
544 544
         case 'movedocument' : {
545 545
             $json = array();
546 546
 
547
-            if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) {
547
+            if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) {
548 548
                 $id = !empty($_REQUEST['id']) ? (int)$_REQUEST['id'] : '';
549 549
                 $parent = isset($_REQUEST['parent']) ? (int)$_REQUEST['parent'] : 0;
550 550
                 $menuindex = isset($_REQUEST['menuindex']) && is_scalar($_REQUEST['menuindex']) ? $_REQUEST['menuindex'] : 0;
551 551
 
552 552
                 // set parent
553
-                if ($id && $parent >= 0) {
553
+                if ($id && $parent >= 0) {
554 554
 
555 555
                     // find older parent
556 556
                     $parentOld = $modx->getDatabase()->getValue($modx->getDatabase()->select('parent', $modx->getFullTableName('site_content'), 'id=' . $id));
@@ -561,31 +561,31 @@  discard block
 block discarded – undo
561 561
                         'new_parent'  => $parent,
562 562
                     ]);
563 563
 
564
-                    if (is_array($eventOut) && count($eventOut) > 0) {
564
+                    if (is_array($eventOut) && count($eventOut) > 0) {
565 565
                         $eventParent = array_pop($eventOut);
566 566
 
567
-                        if ($eventParent == $parentOld) {
567
+                        if ($eventParent == $parentOld) {
568 568
                             $json['errors'] = $_lang['error_movedocument2'];
569
-                        } else {
569
+                        } else {
570 570
                             $parent = $eventParent;
571 571
                         }
572 572
                     }
573 573
 
574
-                    if (empty($json['errors'])) {
574
+                    if (empty($json['errors'])) {
575 575
                         // check privileges user for move docs
576
-                        if (!empty($modx->config['tree_show_protected']) && $role != 1) {
576
+                        if (!empty($modx->config['tree_show_protected']) && $role != 1) {
577 577
                             $sql = $modx->getDatabase()->select('*', $modx->getFullTableName('document_groups'), 'document IN(' . $id . ',' . $parent . ',' . $parentOld . ')');
578
-                            if ($modx->getDatabase()->getRecordCount($sql)) {
578
+                            if ($modx->getDatabase()->getRecordCount($sql)) {
579 579
                                 $document_groups = array();
580
-                                while ($row = $modx->getDatabase()->getRow($sql)) {
580
+                                while ($row = $modx->getDatabase()->getRow($sql)) {
581 581
                                     $document_groups[$row['document']]['groups'][] = $row['document_group'];
582 582
                                 }
583
-                                foreach ($document_groups as $key => $value) {
584
-                                    if (($key == $parent || $key == $parentOld || $key == $id) && !in_array($role, $value['groups'])) {
583
+                                foreach ($document_groups as $key => $value) {
584
+                                    if (($key == $parent || $key == $parentOld || $key == $id) && !in_array($role, $value['groups'])) {
585 585
                                         $json['errors'] = $_lang["error_no_privileges"];
586 586
                                     }
587 587
                                 }
588
-                                if ($json['errors']) {
588
+                                if ($json['errors']) {
589 589
                                     header('content-type: application/json');
590 590
                                     echo json_encode($json, JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE);
591 591
                                     break;
@@ -593,9 +593,9 @@  discard block
 block discarded – undo
593 593
                             }
594 594
                         }
595 595
 
596
-                        if ($parent == 0 && $parent != $parentOld && !$modx->config['udperms_allowroot'] && $role != 1) {
596
+                        if ($parent == 0 && $parent != $parentOld && !$modx->config['udperms_allowroot'] && $role != 1) {
597 597
                             $json['errors'] = $_lang["error_no_privileges"];
598
-                        } else {
598
+                        } else {
599 599
                             // set new parent
600 600
                             $modx->getDatabase()->update(array(
601 601
                                 'parent' => $parent
@@ -605,13 +605,13 @@  discard block
 block discarded – undo
605 605
                                 'isfolder' => 1
606 606
                             ), $modx->getFullTableName('site_content'), 'id=' . $parent);
607 607
 
608
-                            if ($parent != $parentOld) {
608
+                            if ($parent != $parentOld) {
609 609
                                 // check children docs and set parent isfolder
610
-                                if ($modx->getDatabase()->getRecordCount($modx->getDatabase()->select('id', $modx->getFullTableName('site_content'), 'parent=' . $parentOld))) {
610
+                                if ($modx->getDatabase()->getRecordCount($modx->getDatabase()->select('id', $modx->getFullTableName('site_content'), 'parent=' . $parentOld))) {
611 611
                                     $modx->getDatabase()->update(array(
612 612
                                         'isfolder' => 1
613 613
                                     ), $modx->getFullTableName('site_content'), 'id=' . $parentOld);
614
-                                } else {
614
+                                } else {
615 615
                                     $modx->getDatabase()->update(array(
616 616
                                         'isfolder' => 0
617 617
                                     ), $modx->getFullTableName('site_content'), 'id=' . $parentOld);
@@ -619,16 +619,16 @@  discard block
 block discarded – undo
619 619
                             }
620 620
 
621 621
                             // set menuindex
622
-                            if (!empty($menuindex)) {
622
+                            if (!empty($menuindex)) {
623 623
                                 $menuindex = explode(',', $menuindex);
624
-                                foreach ($menuindex as $key => $value) {
624
+                                foreach ($menuindex as $key => $value) {
625 625
                                     $modx->getDatabase()->query('UPDATE ' . $modx->getFullTableName('site_content') . ' SET menuindex=' . $key . ' WHERE id=' . $value);
626 626
                                 }
627
-                            } else {
627
+                            } else {
628 628
                                 // TODO: max(*) menuindex
629 629
                             }
630 630
 
631
-                            if (!$json['errors']) {
631
+                            if (!$json['errors']) {
632 632
                                 $json['success'] = $_lang["actioncomplete"];
633 633
 
634 634
                                 $modx->invokeEvent('onAfterMoveDocument', [
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
                         }
641 641
                     }
642 642
                 }
643
-            } else {
643
+            } else {
644 644
                 $json['errors'] = $_lang["error_no_privileges"];
645 645
             }
646 646
 
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
 
657 657
             $output = !!$modx->elementIsLocked($type, $id, true);
658 658
 
659
-            if (!$output) {
659
+            if (!$output) {
660 660
                 $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : '';
661 661
                 $docgrp_cond = $docgrp ? ' OR dg.document_group IN (' . $docgrp . ')' : '';
662 662
                 $sql = '
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
                     LEFT JOIN ' . $modx->getFullTableName('document_groups') . ' dg ON dg.document=sc.id
666 666
                     WHERE sc.id=' . $id . ' GROUP BY sc.id';
667 667
                 $sql = $modx->getDatabase()->query($sql);
668
-                if ($modx->getDatabase()->getRecordCount($sql)) {
668
+                if ($modx->getDatabase()->getRecordCount($sql)) {
669 669
                     $row = $modx->getDatabase()->getRow($sql);
670 670
                     $output = !!$row['locked'];
671 671
                 }
Please login to merge, or discard this patch.