Completed
Push — develop ( 4e806c...6a553b )
by Agel_Nash
10:03
created
manager/includes/src/Database.php 2 patches
Doc Comments   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 
372 372
     /**
373 373
      * @param $fields
374
-     * @param $table
374
+     * @param string $table
375 375
      * @param string $where
376 376
      * @return bool|mixed|mysqli_result
377 377
      */
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
     }
517 517
 
518 518
     /**
519
-     * @param $name
519
+     * @param string $name
520 520
      * @param mysqli_result|string $dsq
521 521
      * @return array
522 522
      */
@@ -650,6 +650,9 @@  discard block
 block discarded – undo
650 650
         return $this->conn->server_info;
651 651
     }
652 652
 
653
+    /**
654
+     * @param string $tbl
655
+     */
653 656
     public function getFullTableName($tbl)
654 657
     {
655 658
         return $this->config['dbase'] . ".`" . $this->config['table_prefix'] . $tbl . "`";
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         $pre = null,
34 34
         $charset = '',
35 35
         $connection_method = 'SET CHARACTER SET'
36
-    ) {
36
+    ){
37 37
         $this->config['host'] = $host ? $host : $GLOBALS['database_server'];
38 38
         $this->config['dbase'] = $dbase ? $dbase : $GLOBALS['dbase'];
39 39
         $this->config['user'] = $uid ? $uid : $GLOBALS['database_user'];
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
                         $ua = $modx->getPhpCompat()->htmlspecialchars($_SERVER['HTTP_USER_AGENT']);
74 74
                         $referer = $modx->getPhpCompat()->htmlspecialchars($_SERVER['HTTP_REFERER']);
75 75
                         $modx->sendmail(array(
76
-                            'subject' => 'Missing to create the database connection! from ' . $modx->getPhpCompat()->entities($modx->config['site_name']),
76
+                            'subject' => 'Missing to create the database connection! from '.$modx->getPhpCompat()->entities($modx->config['site_name']),
77 77
                             'body'    => "{$logtitle}\n{$request_uri}\n{$ua}\n{$referer}",
78 78
                             'type'    => 'text'
79 79
                         ));
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
             $tend = $modx->getMicroTime();
89 89
             $totaltime = $tend - $tstart;
90 90
             if ($modx->dumpSQL) {
91
-                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>" . sprintf("Database connection was created in %2.4f s",
92
-                        $totaltime) . "</fieldset><br />";
91
+                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>".sprintf("Database connection was created in %2.4f s",
92
+                        $totaltime)."</fieldset><br />";
93 93
             }
94 94
             $this->conn->set_charset($this->config['charset']);
95 95
             $this->isConnected = true;
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         if (1000 < $safeCount) {
123 123
             exit("Too many loops '{$safeCount}'");
124 124
         }
125
-        if ( ! ($this->conn instanceof mysqli)) {
125
+        if (!($this->conn instanceof mysqli)) {
126 126
             $this->connect();
127 127
         }
128 128
         if (is_array($s)) {
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
     public function query($sql, $watchError = true)
149 149
     {
150 150
         $modx = evolutionCMS();
151
-        if ( ! ($this->conn instanceof mysqli)) {
151
+        if (!($this->conn instanceof mysqli)) {
152 152
             $this->connect();
153 153
         }
154 154
         $tStart = $modx->getMicroTime();
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
                 case 1091:
169 169
                     break;
170 170
                 default:
171
-                    $modx->messageQuit('Execution of a query to the database failed - ' . $this->getLastError(), $sql);
171
+                    $modx->messageQuit('Execution of a query to the database failed - '.$this->getLastError(), $sql);
172 172
             }
173 173
         } else {
174 174
             $tend = $modx->getMicroTime();
@@ -182,24 +182,24 @@  discard block
 block discarded – undo
182 182
                     $debug_path[] = $line['function'];
183 183
                 }
184 184
                 $debug_path = implode(' > ', array_reverse($debug_path));
185
-                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query " . ($modx->executedQueries + 1) . " - " . sprintf("%2.2f ms",
186
-                        $totalTime * 1000) . "</legend>";
187
-                $modx->queryCode .= $sql . '<br><br>';
185
+                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query ".($modx->executedQueries + 1)." - ".sprintf("%2.2f ms",
186
+                        $totalTime * 1000)."</legend>";
187
+                $modx->queryCode .= $sql.'<br><br>';
188 188
                 if ($modx->event->name) {
189
-                    $modx->queryCode .= 'Current Event  => ' . $modx->event->name . '<br>';
189
+                    $modx->queryCode .= 'Current Event  => '.$modx->event->name.'<br>';
190 190
                 }
191 191
                 if ($modx->event->activePlugin) {
192
-                    $modx->queryCode .= 'Current Plugin => ' . $modx->event->activePlugin . '<br>';
192
+                    $modx->queryCode .= 'Current Plugin => '.$modx->event->activePlugin.'<br>';
193 193
                 }
194 194
                 if ($modx->currentSnippet) {
195
-                    $modx->queryCode .= 'Current Snippet => ' . $modx->currentSnippet . '<br>';
195
+                    $modx->queryCode .= 'Current Snippet => '.$modx->currentSnippet.'<br>';
196 196
                 }
197 197
                 if (stripos($sql, 'select') === 0) {
198
-                    $modx->queryCode .= 'Record Count => ' . $this->getRecordCount($result) . '<br>';
198
+                    $modx->queryCode .= 'Record Count => '.$this->getRecordCount($result).'<br>';
199 199
                 } else {
200
-                    $modx->queryCode .= 'Affected Rows => ' . $this->getAffectedRows() . '<br>';
200
+                    $modx->queryCode .= 'Affected Rows => '.$this->getAffectedRows().'<br>';
201 201
                 }
202
-                $modx->queryCode .= 'Functions Path => ' . $debug_path . '<br>';
202
+                $modx->queryCode .= 'Functions Path => '.$debug_path.'<br>';
203 203
                 $modx->queryCode .= "</fieldset><br />";
204 204
             }
205 205
             $modx->executedQueries++;
@@ -306,9 +306,9 @@  discard block
 block discarded – undo
306 306
                     if ($value === null || strtolower($value) === 'null') {
307 307
                         $f = 'NULL';
308 308
                     } else {
309
-                        $f = "'" . $value . "'";
309
+                        $f = "'".$value."'";
310 310
                     }
311
-                    $fields[$key] = "`{$key}` = " . $f;
311
+                    $fields[$key] = "`{$key}` = ".$f;
312 312
                 }
313 313
                 $fields = implode(',', $fields);
314 314
             }
@@ -343,12 +343,12 @@  discard block
 block discarded – undo
343 343
                 $this->query("INSERT INTO {$intotable} {$fields}");
344 344
             } else {
345 345
                 if (empty($fromtable)) {
346
-                    $fields = "(`" . implode("`, `", array_keys($fields)) . "`) VALUES('" . implode("', '",
347
-                            array_values($fields)) . "')";
346
+                    $fields = "(`".implode("`, `", array_keys($fields))."`) VALUES('".implode("', '",
347
+                            array_values($fields))."')";
348 348
                     $this->query("INSERT INTO {$intotable} {$fields}");
349 349
                 } else {
350 350
                     $fromtable = $this->replaceFullTableName($fromtable);
351
-                    $fields = "(" . implode(",", array_keys($fields)) . ")";
351
+                    $fields = "(".implode(",", array_keys($fields)).")";
352 352
                     $where = trim($where);
353 353
                     $limit = trim($limit);
354 354
                     if ($where !== '' && stripos($where, 'WHERE') !== 0) {
@@ -442,8 +442,8 @@  discard block
 block discarded – undo
442 442
      */
443 443
     public function getInsertId($conn = null)
444 444
     {
445
-        if (! ($conn instanceof mysqli)) {
446
-            $conn =& $this->conn;
445
+        if (!($conn instanceof mysqli)) {
446
+            $conn = & $this->conn;
447 447
         }
448 448
 
449 449
         return $conn->insert_id;
@@ -455,8 +455,8 @@  discard block
 block discarded – undo
455 455
      */
456 456
     public function getAffectedRows($conn = null)
457 457
     {
458
-        if (! ($conn instanceof mysqli)) {
459
-            $conn =& $this->conn;
458
+        if (!($conn instanceof mysqli)) {
459
+            $conn = & $this->conn;
460 460
         }
461 461
 
462 462
         return $conn->affected_rows;
@@ -468,8 +468,8 @@  discard block
 block discarded – undo
468 468
      */
469 469
     public function getLastError($conn = null)
470 470
     {
471
-        if (! ($conn instanceof mysqli)) {
472
-            $conn =& $this->conn;
471
+        if (!($conn instanceof mysqli)) {
472
+            $conn = & $this->conn;
473 473
         }
474 474
 
475 475
         return $conn->error;
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
     {
494 494
         $out = false;
495 495
         if ($ds instanceof mysqli_result) {
496
-            switch($mode){
496
+            switch ($mode) {
497 497
                 case 'assoc':
498 498
                     $out = $ds->fetch_assoc();
499 499
                     break;
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
     public function getColumn($name, $dsq)
524 524
     {
525 525
         $col = array();
526
-        if ( ! ($dsq instanceof mysqli_result)) {
526
+        if (!($dsq instanceof mysqli_result)) {
527 527
             $dsq = $this->query($dsq);
528 528
         }
529 529
         if ($dsq) {
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
     public function getColumnNames($dsq)
543 543
     {
544 544
         $names = array();
545
-        if ( ! ($dsq instanceof mysqli_result)) {
545
+        if (!($dsq instanceof mysqli_result)) {
546 546
             $dsq = $this->query($dsq);
547 547
         }
548 548
         if ($dsq) {
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
     public function getValue($dsq)
563 563
     {
564 564
         $out = false;
565
-        if ( ! ($dsq instanceof mysqli_result)) {
565
+        if (!($dsq instanceof mysqli_result)) {
566 566
             $dsq = $this->query($dsq);
567 567
         }
568 568
         if ($dsq) {
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
 
653 653
     public function getFullTableName($tbl)
654 654
     {
655
-        return $this->config['dbase'] . ".`" . $this->config['table_prefix'] . $tbl . "`";
655
+        return $this->config['dbase'].".`".$this->config['table_prefix'].$tbl."`";
656 656
     }
657 657
 
658 658
     /**
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
         $tableName = trim($tableName);
666 666
         $dbase = trim($this->config['dbase'], '`');
667 667
         $prefix = $this->config['table_prefix'];
668
-        if ((bool)$force === true) {
668
+        if ((bool) $force === true) {
669 669
             $result = "`{$dbase}`.`{$prefix}{$tableName}`";
670 670
         } elseif (strpos($tableName, '[+prefix+]') !== false) {
671 671
             $result = preg_replace('@\[\+prefix\+\]([0-9a-zA-Z_]+)@', "`{$dbase}`.`{$prefix}$1`", $tableName);
Please login to merge, or discard this patch.
manager/processors/delete_eventlog.processor.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5
-if(!$modx->hasPermission('delete_eventlog')) {
5
+if (!$modx->hasPermission('delete_eventlog')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-if (isset($_GET['cls']) && $_GET['cls']==1) {
9
+if (isset($_GET['cls']) && $_GET['cls'] == 1) {
10 10
 	$where = '';
11 11
 } else {
12
-	$id = isset($_GET['id'])? (int)$_GET['id'] : 0;
13
-	if($id==0) {
12
+	$id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
13
+	if ($id == 0) {
14 14
 		$modx->webAlertAndQuit($_lang["error_no_id"]);
15 15
 	}
16 16
 	$where = "id='{$id}'";
@@ -19,5 +19,5 @@  discard block
 block discarded – undo
19 19
 // delete event log
20 20
 $modx->getDatabase()->delete($modx->getDatabase()->getFullTableName('event_log'), $where);
21 21
 
22
-$header="Location: index.php?a=114";
22
+$header = "Location: index.php?a=114";
23 23
 header($header);
Please login to merge, or discard this patch.
manager/processors/duplicate_htmlsnippet.processor.php 3 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -3,12 +3,12 @@  discard block
 block discarded – undo
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('new_chunk')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $id = isset($_GET['id'])? (int)$_GET['id'] : 0;
10 10
 if($id==0) {
11
-	$modx->webAlertAndQuit($_lang["error_no_id"]);
11
+    $modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
14 14
 // count duplicates
@@ -19,13 +19,13 @@  discard block
 block discarded – undo
19 19
 
20 20
 // duplicate htmlsnippet
21 21
 $newid = $modx->getDatabase()->insert(
22
-	array(
23
-		'name'=>'',
24
-		'description'=>'',
25
-		'snippet'=>'',
26
-		'category'=>'',
27
-		), $modx->getDatabase()->getFullTableName('site_htmlsnippets'), // Insert into
28
-	"CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, snippet, category", $modx->getDatabase()->getFullTableName('site_htmlsnippets'), "id='{$id}'"); // Copy from
22
+    array(
23
+        'name'=>'',
24
+        'description'=>'',
25
+        'snippet'=>'',
26
+        'category'=>'',
27
+        ), $modx->getDatabase()->getFullTableName('site_htmlsnippets'), // Insert into
28
+    "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, snippet, category", $modx->getDatabase()->getFullTableName('site_htmlsnippets'), "id='{$id}'"); // Copy from
29 29
 
30 30
 // Set the item name for logger
31 31
 $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_htmlsnippets'), "id='{$newid}'"));
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@  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_chunk')) {
5
+if (!$modx->hasPermission('new_chunk')) {
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
 
14 14
 // count duplicates
15 15
 $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_htmlsnippets'), "id='{$id}'"));
16 16
 $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_htmlsnippets'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'"));
17
-if($count>=1) $count = ' '.($count+1);
17
+if ($count >= 1) $count = ' '.($count + 1);
18 18
 else $count = '';
19 19
 
20 20
 // duplicate htmlsnippet
@@ -32,5 +32,5 @@  discard block
 block discarded – undo
32 32
 $_SESSION['itemname'] = $name;
33 33
 
34 34
 // finish duplicating - redirect to new chunk
35
-$header="Location: index.php?r=2&a=78&id=$newid";
35
+$header = "Location: index.php?r=2&a=78&id=$newid";
36 36
 header($header);
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,11 @@
 block discarded – undo
14 14
 // count duplicates
15 15
 $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_htmlsnippets'), "id='{$id}'"));
16 16
 $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_htmlsnippets'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'"));
17
-if($count>=1) $count = ' '.($count+1);
18
-else $count = '';
17
+if($count>=1) {
18
+    $count = ' '.($count+1);
19
+} else {
20
+    $count = '';
21
+}
19 22
 
20 23
 // duplicate htmlsnippet
21 24
 $newid = $modx->getDatabase()->insert(
Please login to merge, or discard this patch.
manager/processors/duplicate_module.processor.php 3 patches
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -3,12 +3,12 @@  discard block
 block discarded – undo
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('new_module')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $id = isset($_GET['id'])? (int)$_GET['id'] : 0;
10 10
 if($id==0) {
11
-	$modx->webAlertAndQuit($_lang["error_no_id"]);
11
+    $modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 // count duplicates
14 14
 $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_modules'), "id='{$id}'"));
@@ -18,40 +18,40 @@  discard block
 block discarded – undo
18 18
 
19 19
 // duplicate module
20 20
 $newid = $modx->getDatabase()->insert(
21
-	array(
22
-		'name'=>'',
23
-		'description'=>'',
24
-		'disabled'=>'',
25
-		'category'=>'',
26
-		'wrap'=>'',
27
-		'icon'=>'',
28
-		'enable_resource'=>'',
29
-		'resourcefile'=>'',
30
-		'createdon'=>'',
31
-		'editedon'=>'',
32
-		'guid'=>'',
33
-		'enable_sharedparams'=>'',
34
-		'properties'=>'',
35
-		'modulecode'=>'',
36
-		), $modx->getDatabase()->getFullTableName('site_modules'), // Insert into
37
-	"CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, '1' AS disabled, category, wrap, icon, enable_resource, resourcefile, createdon, editedon, '".createGUID()."' AS guid, enable_sharedparams, properties, modulecode", $modx->getDatabase()->getFullTableName('site_modules'), "id='{$id}'"); // Copy from
21
+    array(
22
+        'name'=>'',
23
+        'description'=>'',
24
+        'disabled'=>'',
25
+        'category'=>'',
26
+        'wrap'=>'',
27
+        'icon'=>'',
28
+        'enable_resource'=>'',
29
+        'resourcefile'=>'',
30
+        'createdon'=>'',
31
+        'editedon'=>'',
32
+        'guid'=>'',
33
+        'enable_sharedparams'=>'',
34
+        'properties'=>'',
35
+        'modulecode'=>'',
36
+        ), $modx->getDatabase()->getFullTableName('site_modules'), // Insert into
37
+    "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, '1' AS disabled, category, wrap, icon, enable_resource, resourcefile, createdon, editedon, '".createGUID()."' AS guid, enable_sharedparams, properties, modulecode", $modx->getDatabase()->getFullTableName('site_modules'), "id='{$id}'"); // Copy from
38 38
 
39 39
 // duplicate module dependencies
40 40
 $modx->getDatabase()->insert(
41
-	array(
42
-		'module'=>'',
43
-		'resource'=>'',
44
-		'type'=>'',
45
-		), $modx->getDatabase()->getFullTableName('site_module_depobj'), // Insert into
46
-	"'{$newid}', resource, type", $modx->getDatabase()->getFullTableName('site_module_depobj'), "module='{$id}'"); // Copy from
41
+    array(
42
+        'module'=>'',
43
+        'resource'=>'',
44
+        'type'=>'',
45
+        ), $modx->getDatabase()->getFullTableName('site_module_depobj'), // Insert into
46
+    "'{$newid}', resource, type", $modx->getDatabase()->getFullTableName('site_module_depobj'), "module='{$id}'"); // Copy from
47 47
 
48 48
 // duplicate module user group access
49 49
 $modx->getDatabase()->insert(
50
-	array(
51
-		'module'=>'',
52
-		'usergroup'=>'',
53
-		), $modx->getDatabase()->getFullTableName('site_module_access'), // Insert into
54
-	"'{$newid}', usergroup", $modx->getDatabase()->getFullTableName('site_module_access'), "module='{$id}'"); // Copy from
50
+    array(
51
+        'module'=>'',
52
+        'usergroup'=>'',
53
+        ), $modx->getDatabase()->getFullTableName('site_module_access'), // Insert into
54
+    "'{$newid}', usergroup", $modx->getDatabase()->getFullTableName('site_module_access'), "module='{$id}'"); // Copy from
55 55
 
56 56
 // Set the item name for logger
57 57
 $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_modules'), "id='{$newid}'"));
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@  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')) {
5
+if (!$modx->hasPermission('new_module')) {
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
 // count duplicates
14 14
 $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_modules'), "id='{$id}'"));
15 15
 $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_modules'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'"));
16
-if($count>=1) $count = ' '.($count+1);
16
+if ($count >= 1) $count = ' '.($count + 1);
17 17
 else $count = '';
18 18
 
19 19
 // duplicate module
@@ -58,5 +58,5 @@  discard block
 block discarded – undo
58 58
 $_SESSION['itemname'] = $name;
59 59
 
60 60
 // finish duplicating - redirect to new module
61
-$header="Location: index.php?r=2&a=108&id=$newid";
61
+$header = "Location: index.php?r=2&a=108&id=$newid";
62 62
 header($header);
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,11 @@
 block discarded – undo
13 13
 // count duplicates
14 14
 $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_modules'), "id='{$id}'"));
15 15
 $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->getDatabase()->getFullTableName('site_modules'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'"));
16
-if($count>=1) $count = ' '.($count+1);
17
-else $count = '';
16
+if($count>=1) {
17
+    $count = ' '.($count+1);
18
+} else {
19
+    $count = '';
20
+}
18 21
 
19 22
 // duplicate module
20 23
 $newid = $modx->getDatabase()->insert(
Please login to merge, or discard this patch.
manager/processors/duplicate_template.processor.php 3 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -3,12 +3,12 @@  discard block
 block discarded – undo
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('new_template')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $id = isset($_GET['id'])? (int)$_GET['id'] : 0;
10 10
 if($id==0) {
11
-	$modx->webAlertAndQuit($_lang["error_no_id"]);
11
+    $modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
14 14
 // count duplicates
@@ -19,22 +19,22 @@  discard block
 block discarded – undo
19 19
 
20 20
 // duplicate template
21 21
 $newid = $modx->getDatabase()->insert(
22
-	array(
23
-		'templatename'=>'',
24
-		'description'=>'',
25
-		'content'=>'',
26
-		'category'=>'',
27
-		), $modx->getDatabase()->getFullTableName('site_templates'), // Insert into
28
-	"CONCAT(templatename, ' {$_lang['duplicated_el_suffix']}{$count}') AS templatename, description, content, category", $modx->getDatabase()->getFullTableName('site_templates'), "id='{$id}'"); // Copy from
22
+    array(
23
+        'templatename'=>'',
24
+        'description'=>'',
25
+        'content'=>'',
26
+        'category'=>'',
27
+        ), $modx->getDatabase()->getFullTableName('site_templates'), // Insert into
28
+    "CONCAT(templatename, ' {$_lang['duplicated_el_suffix']}{$count}') AS templatename, description, content, category", $modx->getDatabase()->getFullTableName('site_templates'), "id='{$id}'"); // Copy from
29 29
 
30 30
 // duplicate TV values
31 31
 $modx->getDatabase()->insert(
32
-	array(
33
-		'tmplvarid'=>'',
34
-		'templateid'=>'',
35
-		'rank'=>'',
36
-		), $modx->getDatabase()->getFullTableName('site_tmplvar_templates'), // Insert into
37
-	"tmplvarid, '{$newid}', rank", $modx->getDatabase()->getFullTableName('site_tmplvar_templates'), "templateid='{$id}'"); // Copy from
32
+    array(
33
+        'tmplvarid'=>'',
34
+        'templateid'=>'',
35
+        'rank'=>'',
36
+        ), $modx->getDatabase()->getFullTableName('site_tmplvar_templates'), // Insert into
37
+    "tmplvarid, '{$newid}', rank", $modx->getDatabase()->getFullTableName('site_tmplvar_templates'), "templateid='{$id}'"); // Copy from
38 38
 
39 39
 // Set the item name for logger
40 40
 $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('templatename', $modx->getDatabase()->getFullTableName('site_templates'), "id='{$newid}'"));
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@  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_template')) {
5
+if (!$modx->hasPermission('new_template')) {
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
 
14 14
 // count duplicates
15 15
 $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('templatename', $modx->getDatabase()->getFullTableName('site_templates'), "id='{$id}'"));
16 16
 $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('templatename', $modx->getDatabase()->getFullTableName('site_templates'), "templatename LIKE '{$name} {$_lang['duplicated_el_suffix']}%'"));
17
-if($count>=1) $count = ' '.($count+1);
17
+if ($count >= 1) $count = ' '.($count + 1);
18 18
 else $count = '';
19 19
 
20 20
 // duplicate template
@@ -41,5 +41,5 @@  discard block
 block discarded – undo
41 41
 $_SESSION['itemname'] = $name;
42 42
 
43 43
 // finish duplicating - redirect to new template
44
-$header="Location: index.php?r=2&a=16&id=$newid";
44
+$header = "Location: index.php?r=2&a=16&id=$newid";
45 45
 header($header);
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,11 @@
 block discarded – undo
14 14
 // count duplicates
15 15
 $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('templatename', $modx->getDatabase()->getFullTableName('site_templates'), "id='{$id}'"));
16 16
 $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('templatename', $modx->getDatabase()->getFullTableName('site_templates'), "templatename LIKE '{$name} {$_lang['duplicated_el_suffix']}%'"));
17
-if($count>=1) $count = ' '.($count+1);
18
-else $count = '';
17
+if($count>=1) {
18
+    $count = ' '.($count+1);
19
+} else {
20
+    $count = '';
21
+}
19 22
 
20 23
 // duplicate template
21 24
 $newid = $modx->getDatabase()->insert(
Please login to merge, or discard this patch.
manager/processors/delete_tmplvars.processor.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3
-	die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
3
+    die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 if(!$modx->hasPermission('delete_template')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
10 10
 if($id == 0) {
11
-	$modx->webAlertAndQuit($_lang["error_no_id"]);
11
+    $modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
14 14
 $forced = isset($_GET['force']) ? $_GET['force'] : 0;
15 15
 
16 16
 // check for relations
17 17
 if(!$forced) {
18
-	$drs = $modx->getDatabase()->select('sc.id, sc.pagetitle,sc.description', $modx->getDatabase()->getFullTableName('site_content') . " AS sc
18
+    $drs = $modx->getDatabase()->select('sc.id, sc.pagetitle,sc.description', $modx->getDatabase()->getFullTableName('site_content') . " AS sc
19 19
 			INNER JOIN " . $modx->getDatabase()->getFullTableName('site_tmplvar_contentvalues') . " AS stcv ON stcv.contentid=sc.id", "stcv.tmplvarid='{$id}'");
20
-	$count = $modx->getDatabase()->getRecordCount($drs);
21
-	if($count > 0) {
22
-		include_once "header.inc.php";
23
-		?>
20
+    $count = $modx->getDatabase()->getRecordCount($drs);
21
+    if($count > 0) {
22
+        include_once "header.inc.php";
23
+        ?>
24 24
 		<script>
25 25
 			var actions = {
26 26
 				delete: function() {
@@ -42,17 +42,17 @@  discard block
 block discarded – undo
42 42
 				<p><?= $_lang['tmplvar_inuse'] ?></p>
43 43
 				<ul>
44 44
 					<?php
45
-					while($row = $modx->getDatabase()->getRow($drs)) {
46
-						echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['description'] != '' ? ' - ' . $row['description'] : '') . '</li>';
47
-					}
48
-					?>
45
+                    while($row = $modx->getDatabase()->getRow($drs)) {
46
+                        echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['description'] != '' ? ' - ' . $row['description'] : '') . '</li>';
47
+                    }
48
+                    ?>
49 49
 				</ul>
50 50
 			</div>
51 51
 		</div>
52 52
 		<?php
53
-		include_once "footer.inc.php";
54
-		exit;
55
-	}
53
+        include_once "footer.inc.php";
54
+        exit;
55
+    }
56 56
 }
57 57
 
58 58
 // Set the item name for logger
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
 // invoke OnBeforeTVFormDelete event
63 63
 $modx->invokeEvent("OnBeforeTVFormDelete", array(
64
-	"id" => $id
64
+    "id" => $id
65 65
 ));
66 66
 
67 67
 // delete variable
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
 // invoke OnTVFormDelete event
80 80
 $modx->invokeEvent("OnTVFormDelete", array(
81
-	"id" => $id
81
+    "id" => $id
82 82
 ));
83 83
 
84 84
 // empty cache
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,24 +1,24 @@  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('delete_template')) {
5
+if (!$modx->hasPermission('delete_template')) {
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
 
14 14
 $forced = isset($_GET['force']) ? $_GET['force'] : 0;
15 15
 
16 16
 // check for relations
17
-if(!$forced) {
18
-	$drs = $modx->getDatabase()->select('sc.id, sc.pagetitle,sc.description', $modx->getDatabase()->getFullTableName('site_content') . " AS sc
19
-			INNER JOIN " . $modx->getDatabase()->getFullTableName('site_tmplvar_contentvalues') . " AS stcv ON stcv.contentid=sc.id", "stcv.tmplvarid='{$id}'");
17
+if (!$forced) {
18
+	$drs = $modx->getDatabase()->select('sc.id, sc.pagetitle,sc.description', $modx->getDatabase()->getFullTableName('site_content')." AS sc
19
+			INNER JOIN " . $modx->getDatabase()->getFullTableName('site_tmplvar_contentvalues')." AS stcv ON stcv.contentid=sc.id", "stcv.tmplvarid='{$id}'");
20 20
 	$count = $modx->getDatabase()->getRecordCount($drs);
21
-	if($count > 0) {
21
+	if ($count > 0) {
22 22
 		include_once "header.inc.php";
23 23
 		?>
24 24
 		<script>
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 				<p><?= $_lang['tmplvar_inuse'] ?></p>
43 43
 				<ul>
44 44
 					<?php
45
-					while($row = $modx->getDatabase()->getRow($drs)) {
46
-						echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['description'] != '' ? ' - ' . $row['description'] : '') . '</li>';
45
+					while ($row = $modx->getDatabase()->getRow($drs)) {
46
+						echo '<li><span style="width: 200px"><a href="index.php?id='.$row['id'].'&a=27">'.$row['pagetitle'].'</a></span>'.($row['description'] != '' ? ' - '.$row['description'] : '').'</li>';
47 47
 					}
48 48
 					?>
49 49
 				</ul>
Please login to merge, or discard this patch.
manager/processors/login.processor.php 2 patches
Indentation   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if(!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
3
-	header('HTTP/1.0 404 Not Found');
4
-	exit('error');
3
+    header('HTTP/1.0 404 Not Found');
4
+    exit('error');
5 5
 }
6 6
 define('IN_MANAGER_MODE', true);  // we use this to make sure files are accessed through
7 7
 define('MODX_API_MODE', true);
@@ -16,12 +16,12 @@  discard block
 block discarded – undo
16 16
 include_once("{$core_path}lang/english.inc.php");
17 17
 
18 18
 if($manager_language !== 'english' && is_file("{$core_path}lang/{$manager_language}.inc.php")) {
19
-	include_once("{$core_path}lang/{$manager_language}.inc.php");
19
+    include_once("{$core_path}lang/{$manager_language}.inc.php");
20 20
 }
21 21
 
22 22
 // Initialize System Alert Message Queque
23 23
 if(!isset($_SESSION['SystemAlertMsgQueque'])) {
24
-	$_SESSION['SystemAlertMsgQueque'] = array();
24
+    $_SESSION['SystemAlertMsgQueque'] = array();
25 25
 }
26 26
 $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque'];
27 27
 
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
 
37 37
 // invoke OnBeforeManagerLogin event
38 38
 $modx->invokeEvent('OnBeforeManagerLogin', array(
39
-		'username' => $username,
40
-		'userpassword' => $givenPassword,
41
-		'rememberme' => $rememberme
42
-	));
39
+        'username' => $username,
40
+        'userpassword' => $givenPassword,
41
+        'rememberme' => $rememberme
42
+    ));
43 43
 $fields = 'mu.*, ua.*';
44 44
 $from = $modx->getDatabase()->getFullTableName('manager_users') . ' AS mu, ' .
45 45
     $modx->getDatabase()->getFullTableName('user_attributes') . ' AS ua';
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 $limit = $modx->getDatabase()->getRecordCount($rs);
49 49
 
50 50
 if($limit == 0 || $limit > 1) {
51
-	jsAlert($_lang['login_processor_unknown_user']);
52
-	return;
51
+    jsAlert($_lang['login_processor_unknown_user']);
52
+    return;
53 53
 }
54 54
 
55 55
 $row = $modx->getDatabase()->getRow($rs);
@@ -74,36 +74,36 @@  discard block
 block discarded – undo
74 74
     "user='{$internalKey}' AND setting_value!=''"
75 75
 );
76 76
 while($row = $modx->getDatabase()->getRow($rs)) {
77
-	extract($row);
78
-	${$setting_name} = $setting_value;
77
+    extract($row);
78
+    ${$setting_name} = $setting_value;
79 79
 }
80 80
 
81 81
 // blocked due to number of login errors.
82 82
 if($failedlogins >= $failed_allowed && $blockeduntildate > time()) {
83
-	@session_destroy();
84
-	session_unset();
85
-	if($cip = getenv("HTTP_CLIENT_IP")) {
86
-		$ip = $cip;
87
-	} elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) {
88
-		$ip = $cip;
89
-	} elseif($cip = getenv("REMOTE_ADDR")) {
90
-		$ip = $cip;
91
-	} else {
92
-		$ip = "UNKNOWN";
93
-	}
94
-	$log = new EvolutionCMS\Legacy\LogHandler();
95
-	$log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: " . $ip);
96
-	jsAlert($_lang['login_processor_many_failed_logins']);
97
-	return;
83
+    @session_destroy();
84
+    session_unset();
85
+    if($cip = getenv("HTTP_CLIENT_IP")) {
86
+        $ip = $cip;
87
+    } elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) {
88
+        $ip = $cip;
89
+    } elseif($cip = getenv("REMOTE_ADDR")) {
90
+        $ip = $cip;
91
+    } else {
92
+        $ip = "UNKNOWN";
93
+    }
94
+    $log = new EvolutionCMS\Legacy\LogHandler();
95
+    $log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: " . $ip);
96
+    jsAlert($_lang['login_processor_many_failed_logins']);
97
+    return;
98 98
 }
99 99
 
100 100
 // blocked due to number of login errors, but get to try again
101 101
 if($failedlogins >= $failed_allowed && $blockeduntildate < time()) {
102
-	$fields = array();
103
-	$fields['failedlogincount'] = '0';
104
-	$fields['blockeduntil'] = time() - 1;
105
-	$modx->getDatabase()->update(
106
-	    $fields,
102
+    $fields = array();
103
+    $fields['failedlogincount'] = '0';
104
+    $fields['blockeduntil'] = time() - 1;
105
+    $modx->getDatabase()->update(
106
+        $fields,
107 107
         $modx->getDatabase()->getFullTableName('user_attributes'),
108 108
         "internalKey='{$internalKey}'"
109 109
     );
@@ -111,94 +111,94 @@  discard block
 block discarded – undo
111 111
 
112 112
 // this user has been blocked by an admin, so no way he's loggin in!
113 113
 if($blocked == '1') {
114
-	@session_destroy();
115
-	session_unset();
116
-	jsAlert($_lang['login_processor_blocked1']);
117
-	return;
114
+    @session_destroy();
115
+    session_unset();
116
+    jsAlert($_lang['login_processor_blocked1']);
117
+    return;
118 118
 }
119 119
 
120 120
 // blockuntil: this user has a block until date
121 121
 if($blockeduntildate > time()) {
122
-	@session_destroy();
123
-	session_unset();
124
-	jsAlert($_lang['login_processor_blocked2']);
125
-	return;
122
+    @session_destroy();
123
+    session_unset();
124
+    jsAlert($_lang['login_processor_blocked2']);
125
+    return;
126 126
 }
127 127
 
128 128
 // blockafter: this user has a block after date
129 129
 if($blockedafterdate > 0 && $blockedafterdate < time()) {
130
-	@session_destroy();
131
-	session_unset();
132
-	jsAlert($_lang['login_processor_blocked3']);
133
-	return;
130
+    @session_destroy();
131
+    session_unset();
132
+    jsAlert($_lang['login_processor_blocked3']);
133
+    return;
134 134
 }
135 135
 
136 136
 // allowed ip
137 137
 if($allowed_ip) {
138
-	if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) {
139
-		if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) {
140
-			jsAlert($_lang['login_processor_remotehost_ip']);
141
-			return;
142
-		}
143
-	}
144
-	if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) {
145
-		jsAlert($_lang['login_processor_remote_ip']);
146
-		return;
147
-	}
138
+    if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) {
139
+        if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) {
140
+            jsAlert($_lang['login_processor_remotehost_ip']);
141
+            return;
142
+        }
143
+    }
144
+    if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) {
145
+        jsAlert($_lang['login_processor_remote_ip']);
146
+        return;
147
+    }
148 148
 }
149 149
 
150 150
 // allowed days
151 151
 if($allowed_days) {
152
-	$date = getdate();
153
-	$day = $date['wday'] + 1;
154
-	if(!in_array($day,explode(',',$allowed_days))) {
155
-		jsAlert($_lang['login_processor_date']);
156
-		return;
157
-	}
152
+    $date = getdate();
153
+    $day = $date['wday'] + 1;
154
+    if(!in_array($day,explode(',',$allowed_days))) {
155
+        jsAlert($_lang['login_processor_date']);
156
+        return;
157
+    }
158 158
 }
159 159
 
160 160
 // invoke OnManagerAuthentication event
161 161
 $rt = $modx->invokeEvent('OnManagerAuthentication', array(
162
-		'userid' => $internalKey,
163
-		'username' => $username,
164
-		'userpassword' => $givenPassword,
165
-		'savedpassword' => $dbasePassword,
166
-		'rememberme' => $rememberme
167
-	));
162
+        'userid' => $internalKey,
163
+        'username' => $username,
164
+        'userpassword' => $givenPassword,
165
+        'savedpassword' => $dbasePassword,
166
+        'rememberme' => $rememberme
167
+    ));
168 168
 
169 169
 // check if plugin authenticated the user
170 170
 $matchPassword = false;
171 171
 if(!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) {
172
-	// check user password - local authentication
173
-	$hashType = $modx->getManagerApi()->getHashType($dbasePassword);
174
-	if($hashType == 'phpass') {
175
-		$matchPassword = login($username, $_REQUEST['password'], $dbasePassword);
176
-	} elseif($hashType == 'md5') {
177
-		$matchPassword = loginMD5($internalKey, $_REQUEST['password'], $dbasePassword, $username);
178
-	} elseif($hashType == 'v1') {
179
-		$matchPassword = loginV1($internalKey, $_REQUEST['password'], $dbasePassword, $username);
180
-	} else {
181
-		$matchPassword = false;
182
-	}
172
+    // check user password - local authentication
173
+    $hashType = $modx->getManagerApi()->getHashType($dbasePassword);
174
+    if($hashType == 'phpass') {
175
+        $matchPassword = login($username, $_REQUEST['password'], $dbasePassword);
176
+    } elseif($hashType == 'md5') {
177
+        $matchPassword = loginMD5($internalKey, $_REQUEST['password'], $dbasePassword, $username);
178
+    } elseif($hashType == 'v1') {
179
+        $matchPassword = loginV1($internalKey, $_REQUEST['password'], $dbasePassword, $username);
180
+    } else {
181
+        $matchPassword = false;
182
+    }
183 183
 } else if($rt === true || (is_array($rt) && in_array(true, $rt))) {
184
-	$matchPassword = true;
184
+    $matchPassword = true;
185 185
 }
186 186
 
187 187
 if(!$matchPassword) {
188
-	jsAlert($_lang['login_processor_wrong_password']);
189
-	incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes);
190
-	return;
188
+    jsAlert($_lang['login_processor_wrong_password']);
189
+    incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes);
190
+    return;
191 191
 }
192 192
 
193 193
 if($modx->config['use_captcha'] == 1) {
194
-	if(!isset ($_SESSION['veriword'])) {
195
-		jsAlert($_lang['login_processor_captcha_config']);
196
-		return;
197
-	} elseif($_SESSION['veriword'] != $captcha_code) {
198
-		jsAlert($_lang['login_processor_bad_code']);
199
-		incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes);
200
-		return;
201
-	}
194
+    if(!isset ($_SESSION['veriword'])) {
195
+        jsAlert($_lang['login_processor_captcha_config']);
196
+        return;
197
+    } elseif($_SESSION['veriword'] != $captcha_code) {
198
+        jsAlert($_lang['login_processor_bad_code']);
199
+        incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes);
200
+        return;
201
+    }
202 202
 }
203 203
 
204 204
 $modx->cleanupExpiredLocks();
@@ -237,36 +237,36 @@  discard block
 block discarded – undo
237 237
 $_SESSION['mgrToken'] = md5($currentsessionid);
238 238
 
239 239
 if($rememberme == '1') {
240
-	$_SESSION['modx.mgr.session.cookie.lifetime'] = (int)$modx->config['session.cookie.lifetime'];
241
-
242
-	// Set a cookie separate from the session cookie with the username in it.
243
-	// Are we using secure connection? If so, make sure the cookie is secure
244
-	global $https_port;
245
-
246
-	$secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port);
247
-	if(version_compare(PHP_VERSION, '5.2', '<')) {
248
-		setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure);
249
-	} else {
250
-		setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true);
251
-	}
240
+    $_SESSION['modx.mgr.session.cookie.lifetime'] = (int)$modx->config['session.cookie.lifetime'];
241
+
242
+    // Set a cookie separate from the session cookie with the username in it.
243
+    // Are we using secure connection? If so, make sure the cookie is secure
244
+    global $https_port;
245
+
246
+    $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port);
247
+    if(version_compare(PHP_VERSION, '5.2', '<')) {
248
+        setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure);
249
+    } else {
250
+        setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true);
251
+    }
252 252
 } else {
253
-	$_SESSION['modx.mgr.session.cookie.lifetime'] = 0;
253
+    $_SESSION['modx.mgr.session.cookie.lifetime'] = 0;
254 254
 
255
-	// Remove the Remember Me cookie
256
-	setcookie('modx_remember_manager', '', time() - 3600, MODX_BASE_URL);
255
+    // Remove the Remember Me cookie
256
+    setcookie('modx_remember_manager', '', time() - 3600, MODX_BASE_URL);
257 257
 }
258 258
 
259 259
 // Check if user already has an active session, if not check if user pressed logout end of last session
260 260
 $rs = $modx->getDatabase()->select('lasthit', $modx->getDatabase()->getFullTableName('active_user_sessions'), "internalKey='{$internalKey}'");
261 261
 $activeSession = $modx->getDatabase()->getValue($rs);
262 262
 if(!$activeSession) {
263
-	$rs = $modx->getDatabase()->select('lasthit', $modx->getDatabase()->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8");
264
-	if($lastHit = $modx->getDatabase()->getValue($rs)) {
265
-		$_SESSION['show_logout_reminder'] = array(
266
-			'type' => 'logout_reminder',
267
-			'lastHit' => $lastHit
268
-		);
269
-	}
263
+    $rs = $modx->getDatabase()->select('lasthit', $modx->getDatabase()->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8");
264
+    if($lastHit = $modx->getDatabase()->getValue($rs)) {
265
+        $_SESSION['show_logout_reminder'] = array(
266
+            'type' => 'logout_reminder',
267
+            'lastHit' => $lastHit
268
+        );
269
+    }
270 270
 }
271 271
 
272 272
 $log = new EvolutionCMS\Legacy\LogHandler();
@@ -274,11 +274,11 @@  discard block
 block discarded – undo
274 274
 
275 275
 // invoke OnManagerLogin event
276 276
 $modx->invokeEvent('OnManagerLogin', array(
277
-		'userid' => $internalKey,
278
-		'username' => $username,
279
-		'userpassword' => $givenPassword,
280
-		'rememberme' => $rememberme
281
-	));
277
+        'userid' => $internalKey,
278
+        'username' => $username,
279
+        'userpassword' => $givenPassword,
280
+        'rememberme' => $rememberme
281
+    ));
282 282
 
283 283
 // check if we should redirect user to a web page
284 284
 $rs = $modx->getDatabase()->select(
@@ -288,17 +288,17 @@  discard block
 block discarded – undo
288 288
 );
289 289
 $id = (int)$modx->getDatabase()->getValue($rs);
290 290
 if($id > 0) {
291
-	$header = 'Location: ' . $modx->makeUrl($id, '', '', 'full');
292
-	if($_POST['ajax'] == 1) {
293
-		echo $header;
294
-	} else {
295
-		header($header);
296
-	}
291
+    $header = 'Location: ' . $modx->makeUrl($id, '', '', 'full');
292
+    if($_POST['ajax'] == 1) {
293
+        echo $header;
294
+    } else {
295
+        header($header);
296
+    }
297 297
 } else {
298
-	$header = 'Location: ' . MODX_MANAGER_URL;
299
-	if($_POST['ajax'] == 1) {
300
-		echo $header;
301
-	} else {
302
-		header($header);
303
-	}
298
+    $header = 'Location: ' . MODX_MANAGER_URL;
299
+    if($_POST['ajax'] == 1) {
300
+        echo $header;
301
+    } else {
302
+        header($header);
303
+    }
304 304
 }
Please login to merge, or discard this patch.
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@  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
-define('IN_MANAGER_MODE', true);  // we use this to make sure files are accessed through
6
+define('IN_MANAGER_MODE', true); // we use this to make sure files are accessed through
7 7
 define('MODX_API_MODE', true);
8
-include_once(__DIR__ . '/../../index.php');
8
+include_once(__DIR__.'/../../index.php');
9 9
 $modx->getDatabase()->connect();
10 10
 $modx->getSettings();
11 11
 $modx->invokeEvent('OnManagerPageInit');
12 12
 
13
-$core_path = MODX_MANAGER_PATH . 'includes/';
13
+$core_path = MODX_MANAGER_PATH.'includes/';
14 14
 // include_once the language file
15 15
 $_lang = array();
16 16
 include_once("{$core_path}lang/english.inc.php");
17 17
 
18
-if($manager_language !== 'english' && is_file("{$core_path}lang/{$manager_language}.inc.php")) {
18
+if ($manager_language !== 'english' && is_file("{$core_path}lang/{$manager_language}.inc.php")) {
19 19
 	include_once("{$core_path}lang/{$manager_language}.inc.php");
20 20
 }
21 21
 
22 22
 // Initialize System Alert Message Queque
23
-if(!isset($_SESSION['SystemAlertMsgQueque'])) {
23
+if (!isset($_SESSION['SystemAlertMsgQueque'])) {
24 24
 	$_SESSION['SystemAlertMsgQueque'] = array();
25 25
 }
26 26
 $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque'];
@@ -41,13 +41,13 @@  discard block
 block discarded – undo
41 41
 		'rememberme' => $rememberme
42 42
 	));
43 43
 $fields = 'mu.*, ua.*';
44
-$from = $modx->getDatabase()->getFullTableName('manager_users') . ' AS mu, ' .
45
-    $modx->getDatabase()->getFullTableName('user_attributes') . ' AS ua';
44
+$from = $modx->getDatabase()->getFullTableName('manager_users').' AS mu, '.
45
+    $modx->getDatabase()->getFullTableName('user_attributes').' AS ua';
46 46
 $where = "BINARY mu.username='{$username}' and ua.internalKey=mu.id";
47 47
 $rs = $modx->getDatabase()->select($fields, $from, $where);
48 48
 $limit = $modx->getDatabase()->getRecordCount($rs);
49 49
 
50
-if($limit == 0 || $limit > 1) {
50
+if ($limit == 0 || $limit > 1) {
51 51
 	jsAlert($_lang['login_processor_unknown_user']);
52 52
 	return;
53 53
 }
@@ -73,32 +73,32 @@  discard block
 block discarded – undo
73 73
     $modx->getDatabase()->getFullTableName('user_settings'),
74 74
     "user='{$internalKey}' AND setting_value!=''"
75 75
 );
76
-while($row = $modx->getDatabase()->getRow($rs)) {
76
+while ($row = $modx->getDatabase()->getRow($rs)) {
77 77
 	extract($row);
78 78
 	${$setting_name} = $setting_value;
79 79
 }
80 80
 
81 81
 // blocked due to number of login errors.
82
-if($failedlogins >= $failed_allowed && $blockeduntildate > time()) {
82
+if ($failedlogins >= $failed_allowed && $blockeduntildate > time()) {
83 83
 	@session_destroy();
84 84
 	session_unset();
85
-	if($cip = getenv("HTTP_CLIENT_IP")) {
85
+	if ($cip = getenv("HTTP_CLIENT_IP")) {
86 86
 		$ip = $cip;
87
-	} elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) {
87
+	} elseif ($cip = getenv("HTTP_X_FORWARDED_FOR")) {
88 88
 		$ip = $cip;
89
-	} elseif($cip = getenv("REMOTE_ADDR")) {
89
+	} elseif ($cip = getenv("REMOTE_ADDR")) {
90 90
 		$ip = $cip;
91 91
 	} else {
92 92
 		$ip = "UNKNOWN";
93 93
 	}
94 94
 	$log = new EvolutionCMS\Legacy\LogHandler();
95
-	$log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: " . $ip);
95
+	$log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: ".$ip);
96 96
 	jsAlert($_lang['login_processor_many_failed_logins']);
97 97
 	return;
98 98
 }
99 99
 
100 100
 // blocked due to number of login errors, but get to try again
101
-if($failedlogins >= $failed_allowed && $blockeduntildate < time()) {
101
+if ($failedlogins >= $failed_allowed && $blockeduntildate < time()) {
102 102
 	$fields = array();
103 103
 	$fields['failedlogincount'] = '0';
104 104
 	$fields['blockeduntil'] = time() - 1;
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 }
111 111
 
112 112
 // this user has been blocked by an admin, so no way he's loggin in!
113
-if($blocked == '1') {
113
+if ($blocked == '1') {
114 114
 	@session_destroy();
115 115
 	session_unset();
116 116
 	jsAlert($_lang['login_processor_blocked1']);
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 }
119 119
 
120 120
 // blockuntil: this user has a block until date
121
-if($blockeduntildate > time()) {
121
+if ($blockeduntildate > time()) {
122 122
 	@session_destroy();
123 123
 	session_unset();
124 124
 	jsAlert($_lang['login_processor_blocked2']);
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 }
127 127
 
128 128
 // blockafter: this user has a block after date
129
-if($blockedafterdate > 0 && $blockedafterdate < time()) {
129
+if ($blockedafterdate > 0 && $blockedafterdate < time()) {
130 130
 	@session_destroy();
131 131
 	session_unset();
132 132
 	jsAlert($_lang['login_processor_blocked3']);
@@ -134,24 +134,24 @@  discard block
 block discarded – undo
134 134
 }
135 135
 
136 136
 // allowed ip
137
-if($allowed_ip) {
138
-	if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) {
139
-		if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) {
137
+if ($allowed_ip) {
138
+	if (($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) {
139
+		if (gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) {
140 140
 			jsAlert($_lang['login_processor_remotehost_ip']);
141 141
 			return;
142 142
 		}
143 143
 	}
144
-	if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) {
144
+	if (!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) {
145 145
 		jsAlert($_lang['login_processor_remote_ip']);
146 146
 		return;
147 147
 	}
148 148
 }
149 149
 
150 150
 // allowed days
151
-if($allowed_days) {
151
+if ($allowed_days) {
152 152
 	$date = getdate();
153 153
 	$day = $date['wday'] + 1;
154
-	if(!in_array($day,explode(',',$allowed_days))) {
154
+	if (!in_array($day, explode(',', $allowed_days))) {
155 155
 		jsAlert($_lang['login_processor_date']);
156 156
 		return;
157 157
 	}
@@ -168,33 +168,33 @@  discard block
 block discarded – undo
168 168
 
169 169
 // check if plugin authenticated the user
170 170
 $matchPassword = false;
171
-if(!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) {
171
+if (!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) {
172 172
 	// check user password - local authentication
173 173
 	$hashType = $modx->getManagerApi()->getHashType($dbasePassword);
174
-	if($hashType == 'phpass') {
174
+	if ($hashType == 'phpass') {
175 175
 		$matchPassword = login($username, $_REQUEST['password'], $dbasePassword);
176
-	} elseif($hashType == 'md5') {
176
+	} elseif ($hashType == 'md5') {
177 177
 		$matchPassword = loginMD5($internalKey, $_REQUEST['password'], $dbasePassword, $username);
178
-	} elseif($hashType == 'v1') {
178
+	} elseif ($hashType == 'v1') {
179 179
 		$matchPassword = loginV1($internalKey, $_REQUEST['password'], $dbasePassword, $username);
180 180
 	} else {
181 181
 		$matchPassword = false;
182 182
 	}
183
-} else if($rt === true || (is_array($rt) && in_array(true, $rt))) {
183
+} else if ($rt === true || (is_array($rt) && in_array(true, $rt))) {
184 184
 	$matchPassword = true;
185 185
 }
186 186
 
187
-if(!$matchPassword) {
187
+if (!$matchPassword) {
188 188
 	jsAlert($_lang['login_processor_wrong_password']);
189 189
 	incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes);
190 190
 	return;
191 191
 }
192 192
 
193
-if($modx->config['use_captcha'] == 1) {
194
-	if(!isset ($_SESSION['veriword'])) {
193
+if ($modx->config['use_captcha'] == 1) {
194
+	if (!isset ($_SESSION['veriword'])) {
195 195
 		jsAlert($_lang['login_processor_captcha_config']);
196 196
 		return;
197
-	} elseif($_SESSION['veriword'] != $captcha_code) {
197
+	} elseif ($_SESSION['veriword'] != $captcha_code) {
198 198
 		jsAlert($_lang['login_processor_bad_code']);
199 199
 		incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes);
200 200
 		return;
@@ -223,28 +223,28 @@  discard block
 block discarded – undo
223 223
 
224 224
 // successful login so reset fail count and update key values
225 225
 $modx->getDatabase()->update(
226
-    'failedlogincount=0, ' . 'logincount=logincount+1, ' . 'lastlogin=thislogin, ' . 'thislogin=' . time() . ', ' . "sessionid='{$currentsessionid}'",
226
+    'failedlogincount=0, '.'logincount=logincount+1, '.'lastlogin=thislogin, '.'thislogin='.time().', '."sessionid='{$currentsessionid}'",
227 227
     $modx->getDatabase()->getFullTableName('user_attributes'),
228 228
     "internalKey='{$internalKey}'"
229 229
 );
230 230
 
231 231
 // get user's document groups
232 232
 $i = 0;
233
-$rs = $modx->getDatabase()->select('uga.documentgroup', $modx->getDatabase()->getFullTableName('member_groups') . ' ug
234
-		INNER JOIN ' . $modx->getDatabase()->getFullTableName('membergroup_access') . ' uga ON uga.membergroup=ug.user_group', "ug.member='{$internalKey}'");
233
+$rs = $modx->getDatabase()->select('uga.documentgroup', $modx->getDatabase()->getFullTableName('member_groups').' ug
234
+		INNER JOIN ' . $modx->getDatabase()->getFullTableName('membergroup_access').' uga ON uga.membergroup=ug.user_group', "ug.member='{$internalKey}'");
235 235
 $_SESSION['mgrDocgroups'] = $modx->getDatabase()->getColumn('documentgroup', $rs);
236 236
 
237 237
 $_SESSION['mgrToken'] = md5($currentsessionid);
238 238
 
239
-if($rememberme == '1') {
240
-	$_SESSION['modx.mgr.session.cookie.lifetime'] = (int)$modx->config['session.cookie.lifetime'];
239
+if ($rememberme == '1') {
240
+	$_SESSION['modx.mgr.session.cookie.lifetime'] = (int) $modx->config['session.cookie.lifetime'];
241 241
 
242 242
 	// Set a cookie separate from the session cookie with the username in it.
243 243
 	// Are we using secure connection? If so, make sure the cookie is secure
244 244
 	global $https_port;
245 245
 
246 246
 	$secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port);
247
-	if(version_compare(PHP_VERSION, '5.2', '<')) {
247
+	if (version_compare(PHP_VERSION, '5.2', '<')) {
248 248
 		setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure);
249 249
 	} else {
250 250
 		setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true);
@@ -259,9 +259,9 @@  discard block
 block discarded – undo
259 259
 // Check if user already has an active session, if not check if user pressed logout end of last session
260 260
 $rs = $modx->getDatabase()->select('lasthit', $modx->getDatabase()->getFullTableName('active_user_sessions'), "internalKey='{$internalKey}'");
261 261
 $activeSession = $modx->getDatabase()->getValue($rs);
262
-if(!$activeSession) {
262
+if (!$activeSession) {
263 263
 	$rs = $modx->getDatabase()->select('lasthit', $modx->getDatabase()->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8");
264
-	if($lastHit = $modx->getDatabase()->getValue($rs)) {
264
+	if ($lastHit = $modx->getDatabase()->getValue($rs)) {
265 265
 		$_SESSION['show_logout_reminder'] = array(
266 266
 			'type' => 'logout_reminder',
267 267
 			'lastHit' => $lastHit
@@ -286,17 +286,17 @@  discard block
 block discarded – undo
286 286
     $modx->getDatabase()->getFullTableName('user_settings'),
287 287
     "user='{$internalKey}' AND setting_name='manager_login_startup'"
288 288
 );
289
-$id = (int)$modx->getDatabase()->getValue($rs);
290
-if($id > 0) {
291
-	$header = 'Location: ' . $modx->makeUrl($id, '', '', 'full');
292
-	if($_POST['ajax'] == 1) {
289
+$id = (int) $modx->getDatabase()->getValue($rs);
290
+if ($id > 0) {
291
+	$header = 'Location: '.$modx->makeUrl($id, '', '', 'full');
292
+	if ($_POST['ajax'] == 1) {
293 293
 		echo $header;
294 294
 	} else {
295 295
 		header($header);
296 296
 	}
297 297
 } else {
298
-	$header = 'Location: ' . MODX_MANAGER_URL;
299
-	if($_POST['ajax'] == 1) {
298
+	$header = 'Location: '.MODX_MANAGER_URL;
299
+	if ($_POST['ajax'] == 1) {
300 300
 		echo $header;
301 301
 	} else {
302 302
 		header($header);
Please login to merge, or discard this patch.
manager/processors/remove_content.processor.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
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('delete_document')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $rs = $modx->getDatabase()->select('id', $modx->getDatabase()->getFullTableName('site_content'), "deleted=1");
@@ -11,9 +11,9 @@  discard block
 block discarded – undo
11 11
 
12 12
 // invoke OnBeforeEmptyTrash event
13 13
 $modx->invokeEvent("OnBeforeEmptyTrash",
14
-						array(
15
-							"ids"=>$ids
16
-						));
14
+                        array(
15
+                            "ids"=>$ids
16
+                        ));
17 17
 
18 18
 // remove the document groups link.
19 19
 $sql = "DELETE document_groups
@@ -32,15 +32,15 @@  discard block
 block discarded – undo
32 32
 //'undelete' the document.
33 33
 $modx->getDatabase()->delete($modx->getDatabase()->getFullTableName('site_content'), "deleted=1");
34 34
 
35
-	// invoke OnEmptyTrash event
36
-	$modx->invokeEvent("OnEmptyTrash",
37
-						array(
38
-							"ids"=>$ids
39
-						));
35
+    // invoke OnEmptyTrash event
36
+    $modx->invokeEvent("OnEmptyTrash",
37
+                        array(
38
+                            "ids"=>$ids
39
+                        ));
40 40
 
41
-	// empty cache
42
-	$modx->clearCache('full');
41
+    // empty cache
42
+    $modx->clearCache('full');
43 43
 
44
-	// finished emptying cache - redirect
45
-	$header="Location: index.php?a=2&r=1";
46
-	header($header);
44
+    // finished emptying cache - redirect
45
+    $header="Location: index.php?a=2&r=1";
46
+    header($header);
Please login to merge, or discard this patch.
manager/processors/save_module.processor.php 1 patch
Switch Indentation   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -59,123 +59,123 @@
 block discarded – undo
59 59
 }
60 60
 
61 61
 switch ($_POST['mode']) {
62
-    case '107':
63
-        // invoke OnBeforeModFormSave event
64
-        $modx->invokeEvent("OnBeforeModFormSave", array(
65
-                "mode" => "new",
66
-                "id" => $id
67
-            ));
68
-
69
-        // disallow duplicate names for new modules
70
-        $rs = $modx->getDatabase()->select('count(id)', $modx->getDatabase()->getFullTableName('site_modules'), "name='{$name}'");
71
-        $count = $modx->getDatabase()->getValue($rs);
72
-        if ($count > 0) {
73
-            $modx->getManagerApi()->saveFormValues(107);
74
-            $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_module'], $name), "index.php?a=107");
75
-        }
76
-
77
-        // save the new module
78
-        $newid = $modx->getDatabase()->insert(array(
79
-            'name' => $name,
80
-            'description' => $description,
81
-            'disabled' => $disabled,
82
-            'wrap' => $wrap,
83
-            'locked' => $locked,
84
-            'icon' => $icon,
85
-            'resourcefile' => $resourcefile,
86
-            'enable_resource' => $enable_resource,
87
-            'category' => $categoryid,
88
-            'enable_sharedparams' => $enable_sharedparams,
89
-            'guid' => $guid,
90
-            'modulecode' => $modulecode,
91
-            'properties' => $properties,
92
-            'createdon' => $currentdate,
93
-            'editedon' => $currentdate
94
-        ), $modx->getDatabase()->getFullTableName('site_modules'));
95
-
96
-        // save user group access permissions
97
-        saveUserGroupAccessPermissons();
98
-
99
-        // invoke OnModFormSave event
100
-        $modx->invokeEvent("OnModFormSave", array(
101
-                "mode" => "new",
102
-                "id" => $newid
103
-            ));
104
-
105
-        // Set the item name for logger
106
-        $_SESSION['itemname'] = $name;
107
-
108
-        // empty cache
109
-        $modx->clearCache('full');
110
-
111
-        // finished emptying cache - redirect
112
-        if ($_POST['stay'] != '') {
113
-            $a = ($_POST['stay'] == '2') ? "108&id=$newid" : "107";
114
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
115
-            header($header);
116
-        } else {
117
-            $header = "Location: index.php?a=106&r=2";
118
-            header($header);
119
-        }
120
-        break;
121
-    case '108':
122
-        // invoke OnBeforeModFormSave event
123
-        $modx->invokeEvent("OnBeforeModFormSave", array(
124
-                "mode" => "upd",
125
-                "id" => $id
126
-            ));
127
-
128
-        // disallow duplicate names for new modules
129
-        $rs = $modx->getDatabase()->select('count(id)', $modx->getDatabase()->getFullTableName('site_modules'), "name='{$name}' AND id!='{$id}'");
130
-        if ($modx->getDatabase()->getValue($rs) > 0) {
131
-            $modx->getManagerApi()->saveFormValues(108);
132
-            $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_module'], $name), "index.php?a=108&id={$id}");
133
-        }
134
-
135
-        // save the edited module
136
-        $modx->getDatabase()->update(array(
137
-            'name' => $name,
138
-            'description' => $description,
139
-            'icon' => $icon,
140
-            'enable_resource' => $enable_resource,
141
-            'resourcefile' => $resourcefile,
142
-            'disabled' => $disabled,
143
-            'wrap' => $wrap,
144
-            'locked' => $locked,
145
-            'category' => $categoryid,
146
-            'enable_sharedparams' => $enable_sharedparams,
147
-            'guid' => $guid,
148
-            'modulecode' => $modulecode,
149
-            'properties' => $properties,
150
-            'editedon' => $currentdate
151
-        ), $modx->getDatabase()->getFullTableName('site_modules'), "id='{$id}'");
152
-
153
-        // save user group access permissions
154
-        saveUserGroupAccessPermissons();
155
-
156
-        // invoke OnModFormSave event
157
-        $modx->invokeEvent("OnModFormSave", array(
158
-                "mode" => "upd",
159
-                "id" => $id
160
-            ));
161
-
162
-        // Set the item name for logger
163
-        $_SESSION['itemname'] = $name;
164
-
165
-        // empty cache
166
-        $modx->clearCache('full');
167
-
168
-        // finished emptying cache - redirect
169
-        if ($_POST['stay'] != '') {
170
-            $a = ($_POST['stay'] == '2') ? "108&id=$id" : "107";
171
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
172
-            header($header);
173
-        } else {
174
-            $modx->unlockElement(6, $id);
175
-            $header = "Location: index.php?a=106&r=2";
176
-            header($header);
177
-        }
178
-        break;
179
-    default:
180
-        $modx->webAlertAndQuit("No operation set in request.");
62
+        case '107':
63
+            // invoke OnBeforeModFormSave event
64
+            $modx->invokeEvent("OnBeforeModFormSave", array(
65
+                    "mode" => "new",
66
+                    "id" => $id
67
+                ));
68
+
69
+            // disallow duplicate names for new modules
70
+            $rs = $modx->getDatabase()->select('count(id)', $modx->getDatabase()->getFullTableName('site_modules'), "name='{$name}'");
71
+            $count = $modx->getDatabase()->getValue($rs);
72
+            if ($count > 0) {
73
+                $modx->getManagerApi()->saveFormValues(107);
74
+                $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_module'], $name), "index.php?a=107");
75
+            }
76
+
77
+            // save the new module
78
+            $newid = $modx->getDatabase()->insert(array(
79
+                'name' => $name,
80
+                'description' => $description,
81
+                'disabled' => $disabled,
82
+                'wrap' => $wrap,
83
+                'locked' => $locked,
84
+                'icon' => $icon,
85
+                'resourcefile' => $resourcefile,
86
+                'enable_resource' => $enable_resource,
87
+                'category' => $categoryid,
88
+                'enable_sharedparams' => $enable_sharedparams,
89
+                'guid' => $guid,
90
+                'modulecode' => $modulecode,
91
+                'properties' => $properties,
92
+                'createdon' => $currentdate,
93
+                'editedon' => $currentdate
94
+            ), $modx->getDatabase()->getFullTableName('site_modules'));
95
+
96
+            // save user group access permissions
97
+            saveUserGroupAccessPermissons();
98
+
99
+            // invoke OnModFormSave event
100
+            $modx->invokeEvent("OnModFormSave", array(
101
+                    "mode" => "new",
102
+                    "id" => $newid
103
+                ));
104
+
105
+            // Set the item name for logger
106
+            $_SESSION['itemname'] = $name;
107
+
108
+            // empty cache
109
+            $modx->clearCache('full');
110
+
111
+            // finished emptying cache - redirect
112
+            if ($_POST['stay'] != '') {
113
+                $a = ($_POST['stay'] == '2') ? "108&id=$newid" : "107";
114
+                $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
115
+                header($header);
116
+            } else {
117
+                $header = "Location: index.php?a=106&r=2";
118
+                header($header);
119
+            }
120
+            break;
121
+        case '108':
122
+            // invoke OnBeforeModFormSave event
123
+            $modx->invokeEvent("OnBeforeModFormSave", array(
124
+                    "mode" => "upd",
125
+                    "id" => $id
126
+                ));
127
+
128
+            // disallow duplicate names for new modules
129
+            $rs = $modx->getDatabase()->select('count(id)', $modx->getDatabase()->getFullTableName('site_modules'), "name='{$name}' AND id!='{$id}'");
130
+            if ($modx->getDatabase()->getValue($rs) > 0) {
131
+                $modx->getManagerApi()->saveFormValues(108);
132
+                $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_module'], $name), "index.php?a=108&id={$id}");
133
+            }
134
+
135
+            // save the edited module
136
+            $modx->getDatabase()->update(array(
137
+                'name' => $name,
138
+                'description' => $description,
139
+                'icon' => $icon,
140
+                'enable_resource' => $enable_resource,
141
+                'resourcefile' => $resourcefile,
142
+                'disabled' => $disabled,
143
+                'wrap' => $wrap,
144
+                'locked' => $locked,
145
+                'category' => $categoryid,
146
+                'enable_sharedparams' => $enable_sharedparams,
147
+                'guid' => $guid,
148
+                'modulecode' => $modulecode,
149
+                'properties' => $properties,
150
+                'editedon' => $currentdate
151
+            ), $modx->getDatabase()->getFullTableName('site_modules'), "id='{$id}'");
152
+
153
+            // save user group access permissions
154
+            saveUserGroupAccessPermissons();
155
+
156
+            // invoke OnModFormSave event
157
+            $modx->invokeEvent("OnModFormSave", array(
158
+                    "mode" => "upd",
159
+                    "id" => $id
160
+                ));
161
+
162
+            // Set the item name for logger
163
+            $_SESSION['itemname'] = $name;
164
+
165
+            // empty cache
166
+            $modx->clearCache('full');
167
+
168
+            // finished emptying cache - redirect
169
+            if ($_POST['stay'] != '') {
170
+                $a = ($_POST['stay'] == '2') ? "108&id=$id" : "107";
171
+                $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
172
+                header($header);
173
+            } else {
174
+                $modx->unlockElement(6, $id);
175
+                $header = "Location: index.php?a=106&r=2";
176
+                header($header);
177
+            }
178
+            break;
179
+        default:
180
+            $modx->webAlertAndQuit("No operation set in request.");
181 181
 }
Please login to merge, or discard this patch.