Completed
Push — develop ( dd48c1...053968 )
by Maxim
06:38 queued 01:16
created
manager/includes/extenders/dbapi.mysqli.class.inc.php 4 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
         $pre = null,
20 20
         $charset = '',
21 21
         $connection_method = 'SET CHARACTER SET'
22
-    ) {
22
+    ){
23 23
         $this->config['host'] = $host ? $host : $GLOBALS['database_server'];
24 24
         $this->config['dbase'] = $dbase ? $dbase : $GLOBALS['dbase'];
25 25
         $this->config['user'] = $uid ? $uid : $GLOBALS['database_user'];
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
                         $ua = $modx->htmlspecialchars($_SERVER['HTTP_USER_AGENT']);
53 53
                         $referer = $modx->htmlspecialchars($_SERVER['HTTP_REFERER']);
54 54
                         $modx->sendmail(array(
55
-                            'subject' => 'Missing to create the database connection! from ' . $modx->config['site_name'],
55
+                            'subject' => 'Missing to create the database connection! from '.$modx->config['site_name'],
56 56
                             'body'    => "{$logtitle}\n{$request_uri}\n{$ua}\n{$referer}",
57 57
                             'type'    => 'text'
58 58
                         ));
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
             $tend = $modx->getMicroTime();
71 71
             $totaltime = $tend - $tstart;
72 72
             if ($modx->dumpSQL) {
73
-                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>" . sprintf("Database connection was created in %2.4f s",
74
-                        $totaltime) . "</fieldset><br />";
73
+                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>".sprintf("Database connection was created in %2.4f s",
74
+                        $totaltime)."</fieldset><br />";
75 75
             }
76 76
             $this->conn->set_charset($this->config['charset']);
77 77
             $this->isConnected = true;
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
                 case 1091:
139 139
                     break;
140 140
                 default:
141
-                    $modx->messageQuit('Execution of a query to the database failed - ' . $this->getLastError(), $sql);
141
+                    $modx->messageQuit('Execution of a query to the database failed - '.$this->getLastError(), $sql);
142 142
             }
143 143
         } else {
144 144
             $tend = $modx->getMicroTime();
@@ -152,24 +152,24 @@  discard block
 block discarded – undo
152 152
                     $debug_path[] = $line['function'];
153 153
                 }
154 154
                 $debug_path = implode(' > ', array_reverse($debug_path));
155
-                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query " . ($modx->executedQueries + 1) . " - " . sprintf("%2.2f ms",
156
-                        $totaltime * 1000) . "</legend>";
157
-                $modx->queryCode .= $sql . '<br><br>';
155
+                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query ".($modx->executedQueries + 1)." - ".sprintf("%2.2f ms",
156
+                        $totaltime * 1000)."</legend>";
157
+                $modx->queryCode .= $sql.'<br><br>';
158 158
                 if ($modx->event->name) {
159
-                    $modx->queryCode .= 'Current Event  => ' . $modx->event->name . '<br>';
159
+                    $modx->queryCode .= 'Current Event  => '.$modx->event->name.'<br>';
160 160
                 }
161 161
                 if ($modx->event->activePlugin) {
162
-                    $modx->queryCode .= 'Current Plugin => ' . $modx->event->activePlugin . '<br>';
162
+                    $modx->queryCode .= 'Current Plugin => '.$modx->event->activePlugin.'<br>';
163 163
                 }
164 164
                 if ($modx->currentSnippet) {
165
-                    $modx->queryCode .= 'Current Snippet => ' . $modx->currentSnippet . '<br>';
165
+                    $modx->queryCode .= 'Current Snippet => '.$modx->currentSnippet.'<br>';
166 166
                 }
167 167
                 if (stripos($sql, 'select') === 0) {
168
-                    $modx->queryCode .= 'Record Count => ' . $this->getRecordCount($result) . '<br>';
168
+                    $modx->queryCode .= 'Record Count => '.$this->getRecordCount($result).'<br>';
169 169
                 } else {
170
-                    $modx->queryCode .= 'Affected Rows => ' . $this->getAffectedRows() . '<br>';
170
+                    $modx->queryCode .= 'Affected Rows => '.$this->getAffectedRows().'<br>';
171 171
                 }
172
-                $modx->queryCode .= 'Functions Path => ' . $debug_path . '<br>';
172
+                $modx->queryCode .= 'Functions Path => '.$debug_path.'<br>';
173 173
                 $modx->queryCode .= "</fieldset><br />";
174 174
             }
175 175
             $modx->executedQueries = $modx->executedQueries + 1;
@@ -252,9 +252,9 @@  discard block
 block discarded – undo
252 252
                     if (is_null($value) || strtolower($value) === 'null') {
253 253
                         $flds = 'NULL';
254 254
                     } else {
255
-                        $flds = "'" . $value . "'";
255
+                        $flds = "'".$value."'";
256 256
                     }
257
-                    $fields[$key] = "`{$key}` = " . $flds;
257
+                    $fields[$key] = "`{$key}` = ".$flds;
258 258
                 }
259 259
                 $fields = implode(",", $fields);
260 260
             }
@@ -278,12 +278,12 @@  discard block
 block discarded – undo
278 278
                 $this->query("INSERT INTO {$intotable} {$fields}");
279 279
             } else {
280 280
                 if (empty($fromtable)) {
281
-                    $fields = "(`" . implode("`, `", array_keys($fields)) . "`) VALUES('" . implode("', '",
282
-                            array_values($fields)) . "')";
281
+                    $fields = "(`".implode("`, `", array_keys($fields))."`) VALUES('".implode("', '",
282
+                            array_values($fields))."')";
283 283
                     $rt = $this->query("INSERT INTO {$intotable} {$fields}");
284 284
                 } else {
285 285
                     $fromtable = $this->replaceFullTableName($fromtable);
286
-                    $fields = "(" . implode(",", array_keys($fields)) . ")";
286
+                    $fields = "(".implode(",", array_keys($fields)).")";
287 287
                     $where = trim($where);
288 288
                     $limit = trim($limit);
289 289
                     if ($where !== '' && stripos($where, 'WHERE') !== 0) {
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
     public function getInsertId($conn = null)
349 349
     {
350 350
         if (!is_object($conn)) {
351
-            $conn =& $this->conn;
351
+            $conn = & $this->conn;
352 352
         }
353 353
 
354 354
         return $conn->insert_id;
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
     public function getAffectedRows($conn = null)
358 358
     {
359 359
         if (!is_object($conn)) {
360
-            $conn =& $this->conn;
360
+            $conn = & $this->conn;
361 361
         }
362 362
 
363 363
         return $conn->affected_rows;
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
     public function getLastError($conn = null)
367 367
     {
368 368
         if (!is_object($conn)) {
369
-            $conn =& $this->conn;
369
+            $conn = & $this->conn;
370 370
         }
371 371
 
372 372
         return $conn->error;
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
     {
387 387
         $out = false;
388 388
         if (is_object($ds)) {
389
-            switch($mode){
389
+            switch ($mode) {
390 390
                 case 'assoc':
391 391
                     $out = $ds->fetch_assoc();
392 392
                     break;
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -304,7 +304,8 @@  discard block
 block discarded – undo
304 304
     }
305 305
 
306 306
     public function save($fields, $table, $where = '')
307
-    { // This is similar to "replace into table".
307
+    {
308
+// This is similar to "replace into table".
308 309
 
309 310
         if ($where === '') {
310 311
             $mode = 'insert';
@@ -386,7 +387,7 @@  discard block
 block discarded – undo
386 387
     {
387 388
         $out = false;
388 389
         if (is_object($ds)) {
389
-            switch($mode){
390
+            switch($mode) {
390 391
                 case 'assoc':
391 392
                     $out = $ds->fetch_assoc();
392 393
                     break;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -190,13 +190,13 @@  discard block
 block discarded – undo
190 190
             $orderby = trim($orderby);
191 191
             $limit = trim($limit);
192 192
             if ($where !== '' && stripos($where, 'WHERE') !== 0) {
193
-                $where = "WHERE {$where}";
193
+                $where = "where {$where}";
194 194
             }
195 195
             if ($orderby !== '' && stripos($orderby, 'ORDER BY') !== 0) {
196 196
                 $orderby = "ORDER BY {$orderby}";
197 197
             }
198 198
             if ($limit !== '' && stripos($limit, 'LIMIT') !== 0) {
199
-                $limit = "LIMIT {$limit}";
199
+                $limit = "limit {$limit}";
200 200
             }
201 201
 
202 202
             return $this->query("DELETE FROM {$from} {$where} {$orderby} {$limit}");
@@ -228,16 +228,16 @@  discard block
 block discarded – undo
228 228
         $orderby = trim($orderby);
229 229
         $limit = trim($limit);
230 230
         if ($where !== '' && stripos($where, 'WHERE') !== 0) {
231
-            $where = "WHERE {$where}";
231
+            $where = "where {$where}";
232 232
         }
233 233
         if ($orderby !== '' && stripos($orderby, 'ORDER') !== 0) {
234 234
             $orderby = "ORDER BY {$orderby}";
235 235
         }
236 236
         if ($limit !== '' && stripos($limit, 'LIMIT') !== 0) {
237
-            $limit = "LIMIT {$limit}";
237
+            $limit = "limit {$limit}";
238 238
         }
239 239
 
240
-        return $this->query("SELECT {$fields} FROM {$from} {$where} {$orderby} {$limit}");
240
+        return $this->query("select {$fields} FROM {$from} {$where} {$orderby} {$limit}");
241 241
     }
242 242
 
243 243
     public function update($fields, $table, $where = "")
@@ -260,10 +260,10 @@  discard block
 block discarded – undo
260 260
             }
261 261
             $where = trim($where);
262 262
             if ($where !== '' && stripos($where, 'WHERE') !== 0) {
263
-                $where = "WHERE {$where}";
263
+                $where = "where {$where}";
264 264
             }
265 265
 
266
-            return $this->query("UPDATE {$table} SET {$fields} {$where}");
266
+            return $this->query("update {$table} SET {$fields} {$where}");
267 267
         }
268 268
     }
269 269
 
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
                     $where = trim($where);
288 288
                     $limit = trim($limit);
289 289
                     if ($where !== '' && stripos($where, 'WHERE') !== 0) {
290
-                        $where = "WHERE {$where}";
290
+                        $where = "where {$where}";
291 291
                     }
292 292
                     if ($limit !== '' && stripos($limit, 'LIMIT') !== 0) {
293
-                        $limit = "LIMIT {$limit}";
293
+                        $limit = "limit {$limit}";
294 294
                     }
295 295
                     $rt = $this->query("INSERT INTO {$intotable} {$fields} SELECT {$fromfields} FROM {$fromtable} {$where} {$limit}");
296 296
                 }
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 
540 540
     public function truncate($table_name)
541 541
     {
542
-        $rs = $this->query("TRUNCATE {$table_name}");
542
+        $rs = $this->query("truncate {$table_name}");
543 543
 
544 544
         return $rs;
545 545
     }
Please login to merge, or discard this patch.
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -408,6 +408,9 @@  discard block
 block discarded – undo
408 408
         return $out;
409 409
     }
410 410
 
411
+    /**
412
+     * @param string $name
413
+     */
411 414
     public function getColumn($name, $dsq)
412 415
     {
413 416
         if (!is_object($dsq)) {
@@ -506,6 +509,9 @@  discard block
 block discarded – undo
506 509
         return $rsArray;
507 510
     }
508 511
 
512
+    /**
513
+     * @return string
514
+     */
509 515
     public function getVersion()
510 516
     {
511 517
         return $this->conn->server_info;
@@ -527,6 +533,9 @@  discard block
 block discarded – undo
527 533
         return $result;
528 534
     }
529 535
 
536
+    /**
537
+     * @param string $table_name
538
+     */
530 539
     public function optimize($table_name)
531 540
     {
532 541
         $rs = $this->query("OPTIMIZE TABLE {$table_name}");
Please login to merge, or discard this patch.
manager/includes/extenders/modifiers/mdf_moduser.inc.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-$userid = (int)$value;
2
+$userid = (int) $value;
3 3
 if (!isset($modx->filter->cache['ui'][$userid])) {
4 4
     if ($userid < 0) $user = $modx->getWebUserInfo(abs($userid));
5 5
     else             $user = $modx->getUserInfo($userid);
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,8 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 $userid = (int)$value;
3 3
 if (!isset($modx->filter->cache['ui'][$userid])) {
4
-    if ($userid < 0) $user = $modx->getWebUserInfo(abs($userid));
5
-    else             $user = $modx->getUserInfo($userid);
4
+    if ($userid < 0) {
5
+        $user = $modx->getWebUserInfo(abs($userid));
6
+    } else {
7
+        $user = $modx->getUserInfo($userid);
8
+    }
6 9
     $modx->filter->cache['ui'][$userid] = $user;
7 10
 } else {
8 11
     $user = $modx->filter->cache['ui'][$userid];
Please login to merge, or discard this patch.
manager/includes/extenders/modifiers/mdf_summary.inc.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,43 +1,43 @@
 block discarded – undo
1 1
 <?php
2
-if(strpos($opt,',')) list($limit,$delim) = explode(',', $opt);
3
-elseif(preg_match('/^[1-9][0-9]*$/',$opt)) {$limit=$opt;$delim='';}
4
-else {$limit=124;$delim='';}
2
+if (strpos($opt, ',')) list($limit, $delim) = explode(',', $opt);
3
+elseif (preg_match('/^[1-9][0-9]*$/', $opt)) {$limit = $opt; $delim = ''; }
4
+else {$limit = 124; $delim = ''; }
5 5
 
6
-if($delim==='') $delim = $modx->config['manager_language']==='japanese-utf8' ? '。' : '.';
7
-$limit = (int)$limit;
6
+if ($delim === '') $delim = $modx->config['manager_language'] === 'japanese-utf8' ? '。' : '.';
7
+$limit = (int) $limit;
8 8
 
9 9
 $content = $modx->filter->parseDocumentSource($value);
10 10
 
11 11
 $content = strip_tags($content);
12 12
 
13
-$content = str_replace(array("\r\n","\r","\n","\t",'&nbsp;'),' ',$content);
14
-if(preg_match('/\s+/',$content))
15
-    $content = preg_replace('/\s+/',' ',$content);
13
+$content = str_replace(array("\r\n", "\r", "\n", "\t", '&nbsp;'), ' ', $content);
14
+if (preg_match('/\s+/', $content))
15
+    $content = preg_replace('/\s+/', ' ', $content);
16 16
 $content = trim($content);
17 17
 
18 18
 $pos = $modx->filter->strpos($content, $delim);
19 19
 
20
-if($pos!==false && $pos<$limit) {
20
+if ($pos !== false && $pos < $limit) {
21 21
     $_ = explode($delim, $content);
22 22
     $text = '';
23
-    foreach($_ as $v) {
24
-        if($limit <= $modx->filter->strlen($text.$v.$delim)) break;
23
+    foreach ($_ as $v) {
24
+        if ($limit <= $modx->filter->strlen($text.$v.$delim)) break;
25 25
         $text .= $v.$delim;
26 26
     }
27
-    if($text) $content = $text;
27
+    if ($text) $content = $text;
28 28
 }
29 29
 
30
-if($limit<$modx->filter->strlen($content) && strpos($content,' ')!==false) {
30
+if ($limit < $modx->filter->strlen($content) && strpos($content, ' ') !== false) {
31 31
     $_ = explode(' ', $content);
32 32
     $text = '';
33
-    foreach($_ as $v) {
34
-        if($limit <= $modx->filter->strlen($text.$v.' ')) break;
35
-        $text .= $v . ' ';
33
+    foreach ($_ as $v) {
34
+        if ($limit <= $modx->filter->strlen($text.$v.' ')) break;
35
+        $text .= $v.' ';
36 36
     }
37
-    if($text!=='') $content = $text;
37
+    if ($text !== '') $content = $text;
38 38
 }
39 39
 
40
-if($limit < $modx->filter->strlen($content)) $content = $modx->filter->substr($content, 0, $limit);
41
-if($modx->filter->substr($content,-1)==$delim) $content = rtrim($content,$delim) . $delim;
40
+if ($limit < $modx->filter->strlen($content)) $content = $modx->filter->substr($content, 0, $limit);
41
+if ($modx->filter->substr($content, -1) == $delim) $content = rtrim($content, $delim).$delim;
42 42
 
43 43
 return $content;
Please login to merge, or discard this patch.
Braces   +28 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,9 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(strpos($opt,',')) list($limit,$delim) = explode(',', $opt);
3
-elseif(preg_match('/^[1-9][0-9]*$/',$opt)) {$limit=$opt;$delim='';}
4
-else {$limit=124;$delim='';}
2
+if(strpos($opt,',')) {
3
+    list($limit,$delim) = explode(',', $opt);
4
+} elseif(preg_match('/^[1-9][0-9]*$/',$opt)) {$limit=$opt;$delim='';} else {$limit=124;$delim='';}
5 5
 
6
-if($delim==='') $delim = $modx->config['manager_language']==='japanese-utf8' ? '。' : '.';
6
+if($delim==='') {
7
+    $delim = $modx->config['manager_language']==='japanese-utf8' ? '。' : '.';
8
+}
7 9
 $limit = (int)$limit;
8 10
 
9 11
 $content = $modx->filter->parseDocumentSource($value);
@@ -11,8 +13,9 @@  discard block
 block discarded – undo
11 13
 $content = strip_tags($content);
12 14
 
13 15
 $content = str_replace(array("\r\n","\r","\n","\t",'&nbsp;'),' ',$content);
14
-if(preg_match('/\s+/',$content))
16
+if(preg_match('/\s+/',$content)) {
15 17
     $content = preg_replace('/\s+/',' ',$content);
18
+}
16 19
 $content = trim($content);
17 20
 
18 21
 $pos = $modx->filter->strpos($content, $delim);
@@ -21,23 +24,35 @@  discard block
 block discarded – undo
21 24
     $_ = explode($delim, $content);
22 25
     $text = '';
23 26
     foreach($_ as $v) {
24
-        if($limit <= $modx->filter->strlen($text.$v.$delim)) break;
27
+        if($limit <= $modx->filter->strlen($text.$v.$delim)) {
28
+            break;
29
+        }
25 30
         $text .= $v.$delim;
26 31
     }
27
-    if($text) $content = $text;
28
-}
32
+    if($text) {
33
+        $content = $text;
34
+    }
35
+    }
29 36
 
30 37
 if($limit<$modx->filter->strlen($content) && strpos($content,' ')!==false) {
31 38
     $_ = explode(' ', $content);
32 39
     $text = '';
33 40
     foreach($_ as $v) {
34
-        if($limit <= $modx->filter->strlen($text.$v.' ')) break;
41
+        if($limit <= $modx->filter->strlen($text.$v.' ')) {
42
+            break;
43
+        }
35 44
         $text .= $v . ' ';
36 45
     }
37
-    if($text!=='') $content = $text;
38
-}
46
+    if($text!=='') {
47
+        $content = $text;
48
+    }
49
+    }
39 50
 
40
-if($limit < $modx->filter->strlen($content)) $content = $modx->filter->substr($content, 0, $limit);
41
-if($modx->filter->substr($content,-1)==$delim) $content = rtrim($content,$delim) . $delim;
51
+if($limit < $modx->filter->strlen($content)) {
52
+    $content = $modx->filter->substr($content, 0, $limit);
53
+}
54
+if($modx->filter->substr($content,-1)==$delim) {
55
+    $content = rtrim($content,$delim) . $delim;
56
+}
42 57
 
43 58
 return $content;
Please login to merge, or discard this patch.
manager/includes/extenders/dbapi.mysql.class.inc.php 3 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
         $pre = null,
31 31
         $charset = '',
32 32
         $connection_method = 'SET CHARACTER SET'
33
-    ) {
33
+    ){
34 34
         $this->config['host'] = $host ? $host : $GLOBALS['database_server'];
35 35
         $this->config['dbase'] = $dbase ? $dbase : $GLOBALS['dbase'];
36 36
         $this->config['user'] = $uid ? $uid : $GLOBALS['database_user'];
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
                         $referer = $modx->htmlspecialchars($_SERVER['HTTP_REFERER']);
121 121
 
122 122
                         $modx->sendmail(array(
123
-                                'subject' => 'Missing to create the database connection! from ' . $modx->config['site_name'],
123
+                                'subject' => 'Missing to create the database connection! from '.$modx->config['site_name'],
124 124
                                 'body'    => "{$logtitle}\n{$request_uri}\n{$ua}\n{$referer}",
125 125
                                 'type'    => 'text'
126 126
                             )
@@ -137,15 +137,15 @@  discard block
 block discarded – undo
137 137
         } else {
138 138
             $dbase = trim($dbase, '`'); // remove the `` chars
139 139
             if (!@ mysql_select_db($dbase, $this->conn)) {
140
-                $modx->messageQuit("Failed to select the database '" . $dbase . "'!");
140
+                $modx->messageQuit("Failed to select the database '".$dbase."'!");
141 141
                 exit;
142 142
             }
143 143
             @mysql_query("{$connection_method} {$charset}", $this->conn);
144 144
             $tend = $modx->getMicroTime();
145 145
             $totaltime = $tend - $tstart;
146 146
             if ($modx->dumpSQL) {
147
-                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>" . sprintf("Database connection was created in %2.4f s",
148
-                        $totaltime) . "</fieldset><br />";
147
+                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>".sprintf("Database connection was created in %2.4f s",
148
+                        $totaltime)."</fieldset><br />";
149 149
             }
150 150
             if (function_exists('mysql_set_charset')) {
151 151
                 mysql_set_charset($this->config['charset']);
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
                 case 1091:
226 226
                     break;
227 227
                 default:
228
-                    $modx->messageQuit('Execution of a query to the database failed - ' . $this->getLastError(), $sql);
228
+                    $modx->messageQuit('Execution of a query to the database failed - '.$this->getLastError(), $sql);
229 229
             }
230 230
         } else {
231 231
             $tend = $modx->getMicroTime();
@@ -239,24 +239,24 @@  discard block
 block discarded – undo
239 239
                     $debug_path[] = $line['function'];
240 240
                 }
241 241
                 $debug_path = implode(' > ', array_reverse($debug_path));
242
-                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query " . ($modx->executedQueries + 1) . " - " . sprintf("%2.2f ms",
243
-                        $totaltime * 1000) . "</legend>";
244
-                $modx->queryCode .= $sql . '<br><br>';
242
+                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query ".($modx->executedQueries + 1)." - ".sprintf("%2.2f ms",
243
+                        $totaltime * 1000)."</legend>";
244
+                $modx->queryCode .= $sql.'<br><br>';
245 245
                 if ($modx->event->name) {
246
-                    $modx->queryCode .= 'Current Event  => ' . $modx->event->name . '<br>';
246
+                    $modx->queryCode .= 'Current Event  => '.$modx->event->name.'<br>';
247 247
                 }
248 248
                 if ($modx->event->activePlugin) {
249
-                    $modx->queryCode .= 'Current Plugin => ' . $modx->event->activePlugin . '<br>';
249
+                    $modx->queryCode .= 'Current Plugin => '.$modx->event->activePlugin.'<br>';
250 250
                 }
251 251
                 if ($modx->currentSnippet) {
252
-                    $modx->queryCode .= 'Current Snippet => ' . $modx->currentSnippet . '<br>';
252
+                    $modx->queryCode .= 'Current Snippet => '.$modx->currentSnippet.'<br>';
253 253
                 }
254 254
                 if (stripos($sql, 'select') === 0) {
255
-                    $modx->queryCode .= 'Record Count => ' . $this->getRecordCount($result) . '<br>';
255
+                    $modx->queryCode .= 'Record Count => '.$this->getRecordCount($result).'<br>';
256 256
                 } else {
257
-                    $modx->queryCode .= 'Affected Rows => ' . $this->getAffectedRows() . '<br>';
257
+                    $modx->queryCode .= 'Affected Rows => '.$this->getAffectedRows().'<br>';
258 258
                 }
259
-                $modx->queryCode .= 'Functions Path => ' . $debug_path . '<br>';
259
+                $modx->queryCode .= 'Functions Path => '.$debug_path.'<br>';
260 260
                 $modx->queryCode .= "</fieldset><br />";
261 261
             }
262 262
             $modx->executedQueries = $modx->executedQueries + 1;
@@ -350,9 +350,9 @@  discard block
 block discarded – undo
350 350
                     if (is_null($value) || strtolower($value) === 'null') {
351 351
                         $flds = 'NULL';
352 352
                     } else {
353
-                        $flds = "'" . $value . "'";
353
+                        $flds = "'".$value."'";
354 354
                     }
355
-                    $fields[$key] = "`{$key}` = " . $flds;
355
+                    $fields[$key] = "`{$key}` = ".$flds;
356 356
                 }
357 357
                 $fields = implode(",", $fields);
358 358
             }
@@ -380,13 +380,13 @@  discard block
 block discarded – undo
380 380
                 $this->query("INSERT INTO {$intotable} {$fields}");
381 381
             } else {
382 382
                 if (empty($fromtable)) {
383
-                    $fields = "(`" . implode("`, `", array_keys($fields)) . "`) VALUES('" . implode("', '",
384
-                            array_values($fields)) . "')";
383
+                    $fields = "(`".implode("`, `", array_keys($fields))."`) VALUES('".implode("', '",
384
+                            array_values($fields))."')";
385 385
                     $rt = $this->query("INSERT INTO {$intotable} {$fields}");
386 386
                 } else {
387 387
                     if (version_compare($this->getVersion(), "4.0.14") >= 0) {
388 388
                         $fromtable = $this->replaceFullTableName($fromtable);
389
-                        $fields = "(" . implode(",", array_keys($fields)) . ")";
389
+                        $fields = "(".implode(",", array_keys($fields)).")";
390 390
                         $where = trim($where);
391 391
                         $limit = trim($limit);
392 392
                         if ($where !== '' && stripos($where, 'WHERE') !== 0) {
@@ -399,8 +399,8 @@  discard block
 block discarded – undo
399 399
                     } else {
400 400
                         $ds = $this->select($fromfields, $fromtable, $where, '', $limit);
401 401
                         while ($row = $this->getRow($ds)) {
402
-                            $fields = "(" . implode(",", array_keys($fields)) . ") VALUES('" . implode("', '",
403
-                                    $row) . "')";
402
+                            $fields = "(".implode(",", array_keys($fields)).") VALUES('".implode("', '",
403
+                                    $row)."')";
404 404
                             $rt = $this->query("INSERT INTO {$intotable} {$fields}");
405 405
                         }
406 406
                     }
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
     public function getInsertId($conn = null)
486 486
     {
487 487
         if (!is_resource($conn)) {
488
-            $conn =& $this->conn;
488
+            $conn = & $this->conn;
489 489
         }
490 490
 
491 491
         return mysql_insert_id($conn);
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
     public function getAffectedRows($conn = null)
499 499
     {
500 500
         if (!is_resource($conn)) {
501
-            $conn =& $this->conn;
501
+            $conn = & $this->conn;
502 502
         }
503 503
 
504 504
         return mysql_affected_rows($conn);
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
     public function getLastError($conn = null)
512 512
     {
513 513
         if (!is_resource($conn)) {
514
-            $conn =& $this->conn;
514
+            $conn = & $this->conn;
515 515
         }
516 516
 
517 517
         return mysql_error($conn);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -280,13 +280,13 @@  discard block
 block discarded – undo
280 280
             $orderby = trim($orderby);
281 281
             $limit = trim($limit);
282 282
             if ($where !== '' && stripos($where, 'WHERE') !== 0) {
283
-                $where = "WHERE {$where}";
283
+                $where = "where {$where}";
284 284
             }
285 285
             if ($orderby !== '' && stripos($orderby, 'ORDER BY') !== 0) {
286 286
                 $orderby = "ORDER BY {$orderby}";
287 287
             }
288 288
             if ($limit !== '' && stripos($limit, 'LIMIT') !== 0) {
289
-                $limit = "LIMIT {$limit}";
289
+                $limit = "limit {$limit}";
290 290
             }
291 291
 
292 292
             return $this->query("DELETE FROM {$from} {$where} {$orderby} {$limit}");
@@ -322,16 +322,16 @@  discard block
 block discarded – undo
322 322
         $orderby = trim($orderby);
323 323
         $limit = trim($limit);
324 324
         if ($where !== '' && stripos($where, 'WHERE') !== 0) {
325
-            $where = "WHERE {$where}";
325
+            $where = "where {$where}";
326 326
         }
327 327
         if ($orderby !== '' && stripos($orderby, 'ORDER') !== 0) {
328 328
             $orderby = "ORDER BY {$orderby}";
329 329
         }
330 330
         if ($limit !== '' && stripos($limit, 'LIMIT') !== 0) {
331
-            $limit = "LIMIT {$limit}";
331
+            $limit = "limit {$limit}";
332 332
         }
333 333
 
334
-        return $this->query("SELECT {$fields} FROM {$from} {$where} {$orderby} {$limit}");
334
+        return $this->query("select {$fields} FROM {$from} {$where} {$orderby} {$limit}");
335 335
     }
336 336
 
337 337
     /**
@@ -358,10 +358,10 @@  discard block
 block discarded – undo
358 358
             }
359 359
             $where = trim($where);
360 360
             if ($where !== '' && stripos($where, 'WHERE') !== 0) {
361
-                $where = "WHERE {$where}";
361
+                $where = "where {$where}";
362 362
             }
363 363
 
364
-            return $this->query("UPDATE {$table} SET {$fields} {$where}");
364
+            return $this->query("update {$table} SET {$fields} {$where}");
365 365
         }
366 366
     }
367 367
 
@@ -390,10 +390,10 @@  discard block
 block discarded – undo
390 390
                         $where = trim($where);
391 391
                         $limit = trim($limit);
392 392
                         if ($where !== '' && stripos($where, 'WHERE') !== 0) {
393
-                            $where = "WHERE {$where}";
393
+                            $where = "where {$where}";
394 394
                         }
395 395
                         if ($limit !== '' && stripos($limit, 'LIMIT') !== 0) {
396
-                            $limit = "LIMIT {$limit}";
396
+                            $limit = "limit {$limit}";
397 397
                         }
398 398
                         $rt = $this->query("INSERT INTO {$intotable} {$fields} SELECT {$fromfields} FROM {$fromtable} {$where} {$limit}");
399 399
                     } else {
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 
733 733
     public function truncate($table_name)
734 734
     {
735
-        $rs = $this->query("TRUNCATE {$table_name}");
735
+        $rs = $this->query("truncate {$table_name}");
736 736
 
737 737
         return $rs;
738 738
     }
Please login to merge, or discard this patch.
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -554,6 +554,7 @@  discard block
 block discarded – undo
554 554
      * @name:  getColumn
555 555
      * @desc:  returns an array of the values found on colun $name
556 556
      * @param: $dsq - dataset or query string
557
+     * @param string $name
557 558
      */
558 559
     public function getColumn($name, $dsq)
559 560
     {
@@ -720,6 +721,9 @@  discard block
 block discarded – undo
720 721
         return $result;
721 722
     }
722 723
 
724
+    /**
725
+     * @param string $table_name
726
+     */
723 727
     public function optimize($table_name)
724 728
     {
725 729
         $rs = $this->query("OPTIMIZE TABLE {$table_name}");
Please login to merge, or discard this patch.
manager/includes/extenders/deprecated.functions.inc.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     public function getUserData() {
41 41
         $client['ip'] = $_SERVER['REMOTE_ADDR'];
42 42
         $client['ua'] = $_SERVER['HTTP_USER_AGENT'];
43
-    	return $client;
43
+        return $client;
44 44
     }
45 45
 
46 46
     # Returns true, install or interact when inside manager
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
 
61 61
     // deprecated
62 62
     public function putChunk($chunkName) { // alias name >.<
63
-    	global $modx;
63
+        global $modx;
64 64
         return $modx->getChunk($chunkName);
65 65
     }
66 66
 
67 67
     public function getDocGroups() {
68
-    	global $modx;
68
+        global $modx;
69 69
         return $modx->getUserDocGroups();
70 70
     } // deprecated
71 71
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     } // deprecated
75 75
 
76 76
     public function userLoggedIn() {
77
-    	global $modx;
77
+        global $modx;
78 78
         $userdetails= array ();
79 79
         if ($modx->isFrontend() && isset ($_SESSION['webValidated'])) {
80 80
             // web user
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
     public function getFormVars($method= "", $prefix= "", $trim= "", $REQUEST_METHOD) {
100 100
         //  function to retrieve form results into an associative array
101
-    	global $modx;
101
+        global $modx;
102 102
         $results= array ();
103 103
         $method= strtoupper($method);
104 104
         if ($method == "")
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      * @param string $url URL to redirect to
131 131
      */
132 132
     public function webAlert($msg, $url= "") {
133
-    	global $modx;
133
+        global $modx;
134 134
         $msg= addslashes($modx->db->escape($msg));
135 135
         if (substr(strtolower($url), 0, 11) == "javascript:") {
136 136
             $act= "__WebAlert();";
Please login to merge, or discard this patch.
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -1,43 +1,43 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 $this->old = new OldFunctions();
3
-class OldFunctions {
3
+class OldFunctions{
4 4
 
5
-    public function dbConnect()                 {global $modx;       $modx->db->connect();$modx->rs = $modx->db->conn;}
6
-    public function dbQuery($sql)               {global $modx;return $modx->db->query($sql);}
7
-    public function recordCount($rs)            {global $modx;return $modx->db->getRecordCount($rs);}
8
-    public function fetchRow($rs,$mode='assoc') {global $modx;return $modx->db->getRow($rs, $mode);}
9
-    public function affectedRows($rs)           {global $modx;return $modx->db->getAffectedRows($rs);}
10
-    public function insertId($rs)               {global $modx;return $modx->db->getInsertId($rs);}
11
-    public function dbClose()                   {global $modx;       $modx->db->disconnect();}
5
+    public function dbConnect(){global $modx; $modx->db->connect(); $modx->rs = $modx->db->conn; }
6
+    public function dbQuery($sql){global $modx; return $modx->db->query($sql); }
7
+    public function recordCount($rs){global $modx; return $modx->db->getRecordCount($rs); }
8
+    public function fetchRow($rs, $mode = 'assoc'){global $modx; return $modx->db->getRow($rs, $mode); }
9
+    public function affectedRows($rs){global $modx; return $modx->db->getAffectedRows($rs); }
10
+    public function insertId($rs){global $modx; return $modx->db->getInsertId($rs); }
11
+    public function dbClose(){global $modx; $modx->db->disconnect(); }
12 12
 
13
-    public function makeList($array, $ulroot= 'root', $ulprefix= 'sub_', $type= '', $ordered= false, $tablevel= 0) {
13
+    public function makeList($array, $ulroot = 'root', $ulprefix = 'sub_', $type = '', $ordered = false, $tablevel = 0){
14 14
         // first find out whether the value passed is an array
15 15
         if (!is_array($array)) {
16 16
             return "<ul><li>Bad list</li></ul>";
17 17
         }
18 18
         if (!empty ($type)) {
19
-            $typestr= " style='list-style-type: $type'";
19
+            $typestr = " style='list-style-type: $type'";
20 20
         } else {
21
-            $typestr= "";
21
+            $typestr = "";
22 22
         }
23
-        $tabs= "";
24
-        for ($i= 0; $i < $tablevel; $i++) {
23
+        $tabs = "";
24
+        for ($i = 0; $i < $tablevel; $i++) {
25 25
             $tabs .= "\t";
26 26
         }
27
-        $listhtml= $ordered == true ? $tabs . "<ol class='$ulroot'$typestr>\n" : $tabs . "<ul class='$ulroot'$typestr>\n";
27
+        $listhtml = $ordered == true ? $tabs."<ol class='$ulroot'$typestr>\n" : $tabs."<ul class='$ulroot'$typestr>\n";
28 28
         foreach ($array as $key => $value) {
29 29
             if (is_array($value)) {
30
-                $listhtml .= $tabs . "\t<li>" . $key . "\n" . $this->makeList($value, $ulprefix . $ulroot, $ulprefix, $type, $ordered, $tablevel +2) . $tabs . "\t</li>\n";
30
+                $listhtml .= $tabs."\t<li>".$key."\n".$this->makeList($value, $ulprefix.$ulroot, $ulprefix, $type, $ordered, $tablevel + 2).$tabs."\t</li>\n";
31 31
             } else {
32
-                $listhtml .= $tabs . "\t<li>" . $value . "</li>\n";
32
+                $listhtml .= $tabs."\t<li>".$value."</li>\n";
33 33
             }
34 34
         }
35
-        $listhtml .= $ordered == true ? $tabs . "</ol>\n" : $tabs . "</ul>\n";
35
+        $listhtml .= $ordered == true ? $tabs."</ol>\n" : $tabs."</ul>\n";
36 36
         return $listhtml;
37 37
     }
38 38
 
39 39
 
40
-    public function getUserData() {
40
+    public function getUserData(){
41 41
         $client['ip'] = $_SERVER['REMOTE_ADDR'];
42 42
         $client['ua'] = $_SERVER['HTTP_USER_AGENT'];
43 43
     	return $client;
@@ -45,80 +45,80 @@  discard block
 block discarded – undo
45 45
 
46 46
     # Returns true, install or interact when inside manager
47 47
     // deprecated
48
-    public function insideManager() {
49
-        $m= false;
50
-        if( defined('IN_MANAGER_MODE') && IN_MANAGER_MODE === true) {
51
-            $m= true;
48
+    public function insideManager(){
49
+        $m = false;
50
+        if (defined('IN_MANAGER_MODE') && IN_MANAGER_MODE === true) {
51
+            $m = true;
52 52
             if (defined('SNIPPET_INTERACTIVE_MODE') && SNIPPET_INTERACTIVE_MODE == 'true')
53
-                $m= "interact";
53
+                $m = "interact";
54 54
             else
55 55
                 if (defined('SNIPPET_INSTALL_MODE') && SNIPPET_INSTALL_MODE == 'true')
56
-                    $m= "install";
56
+                    $m = "install";
57 57
         }
58 58
         return $m;
59 59
     }
60 60
 
61 61
     // deprecated
62
-    public function putChunk($chunkName) { // alias name >.<
62
+    public function putChunk($chunkName){ // alias name >.<
63 63
     	global $modx;
64 64
         return $modx->getChunk($chunkName);
65 65
     }
66 66
 
67
-    public function getDocGroups() {
67
+    public function getDocGroups(){
68 68
     	global $modx;
69 69
         return $modx->getUserDocGroups();
70 70
     } // deprecated
71 71
 
72
-    public function changePassword($o, $n) {
72
+    public function changePassword($o, $n){
73 73
         return changeWebUserPassword($o, $n);
74 74
     } // deprecated
75 75
 
76
-    public function userLoggedIn() {
76
+    public function userLoggedIn(){
77 77
     	global $modx;
78
-        $userdetails= array ();
78
+        $userdetails = array();
79 79
         if ($modx->isFrontend() && isset ($_SESSION['webValidated'])) {
80 80
             // web user
81
-            $userdetails['loggedIn']= true;
82
-            $userdetails['id']= $_SESSION['webInternalKey'];
83
-            $userdetails['username']= $_SESSION['webShortname'];
84
-            $userdetails['usertype']= 'web'; // added by Raymond
81
+            $userdetails['loggedIn'] = true;
82
+            $userdetails['id'] = $_SESSION['webInternalKey'];
83
+            $userdetails['username'] = $_SESSION['webShortname'];
84
+            $userdetails['usertype'] = 'web'; // added by Raymond
85 85
             return $userdetails;
86 86
         } else
87 87
             if ($modx->isBackend() && isset ($_SESSION['mgrValidated'])) {
88 88
                 // manager user
89
-                $userdetails['loggedIn']= true;
90
-                $userdetails['id']= $_SESSION['mgrInternalKey'];
91
-                $userdetails['username']= $_SESSION['mgrShortname'];
92
-                $userdetails['usertype']= 'manager'; // added by Raymond
89
+                $userdetails['loggedIn'] = true;
90
+                $userdetails['id'] = $_SESSION['mgrInternalKey'];
91
+                $userdetails['username'] = $_SESSION['mgrShortname'];
92
+                $userdetails['usertype'] = 'manager'; // added by Raymond
93 93
                 return $userdetails;
94 94
             } else {
95 95
                 return false;
96 96
             }
97 97
     }
98 98
 
99
-    public function getFormVars($method= "", $prefix= "", $trim= "", $REQUEST_METHOD) {
99
+    public function getFormVars($method = "", $prefix = "", $trim = "", $REQUEST_METHOD){
100 100
         //  function to retrieve form results into an associative array
101 101
     	global $modx;
102
-        $results= array ();
103
-        $method= strtoupper($method);
102
+        $results = array();
103
+        $method = strtoupper($method);
104 104
         if ($method == "")
105
-            $method= $REQUEST_METHOD;
105
+            $method = $REQUEST_METHOD;
106 106
         if ($method == "POST")
107
-            $method= & $_POST;
108
-        elseif ($method == "GET") $method= & $_GET;
107
+            $method = & $_POST;
108
+        elseif ($method == "GET") $method = & $_GET;
109 109
         else
110 110
             return false;
111 111
         reset($method);
112 112
         foreach ($method as $key => $value) {
113 113
             if (($prefix != "") && (substr($key, 0, strlen($prefix)) == $prefix)) {
114 114
                 if ($trim) {
115
-                    $pieces= explode($prefix, $key, 2);
116
-                    $key= $pieces[1];
117
-                    $results[$key]= $value;
115
+                    $pieces = explode($prefix, $key, 2);
116
+                    $key = $pieces[1];
117
+                    $results[$key] = $value;
118 118
                 } else
119
-                    $results[$key]= $value;
119
+                    $results[$key] = $value;
120 120
             }
121
-            elseif ($prefix == "") $results[$key]= $value;
121
+            elseif ($prefix == "") $results[$key] = $value;
122 122
         }
123 123
         return $results;
124 124
     }
@@ -129,16 +129,16 @@  discard block
 block discarded – undo
129 129
      * @param string $msg Message to show
130 130
      * @param string $url URL to redirect to
131 131
      */
132
-    public function webAlert($msg, $url= "") {
132
+    public function webAlert($msg, $url = ""){
133 133
     	global $modx;
134
-        $msg= addslashes($modx->db->escape($msg));
134
+        $msg = addslashes($modx->db->escape($msg));
135 135
         if (substr(strtolower($url), 0, 11) == "javascript:") {
136
-            $act= "__WebAlert();";
137
-            $fnc= "function __WebAlert(){" . substr($url, 11) . "};";
136
+            $act = "__WebAlert();";
137
+            $fnc = "function __WebAlert(){".substr($url, 11)."};";
138 138
         } else {
139
-            $act= ($url ? "window.location.href='" . addslashes($url) . "';" : "");
139
+            $act = ($url ? "window.location.href='".addslashes($url)."';" : "");
140 140
         }
141
-        $html= "<script>$fnc window.setTimeout(\"alert('$msg');$act\",100);</script>";
141
+        $html = "<script>$fnc window.setTimeout(\"alert('$msg');$act\",100);</script>";
142 142
         if ($modx->isFrontend())
143 143
             $modx->regClientScript($html);
144 144
         else {
Please login to merge, or discard this patch.
Braces   +66 added lines, -35 removed lines patch added patch discarded remove patch
@@ -1,16 +1,32 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 $this->old = new OldFunctions();
3
-class OldFunctions {
3
+class OldFunctions
4
+{
4 5
 
5
-    public function dbConnect()                 {global $modx;       $modx->db->connect();$modx->rs = $modx->db->conn;}
6
-    public function dbQuery($sql)               {global $modx;return $modx->db->query($sql);}
7
-    public function recordCount($rs)            {global $modx;return $modx->db->getRecordCount($rs);}
8
-    public function fetchRow($rs,$mode='assoc') {global $modx;return $modx->db->getRow($rs, $mode);}
9
-    public function affectedRows($rs)           {global $modx;return $modx->db->getAffectedRows($rs);}
10
-    public function insertId($rs)               {global $modx;return $modx->db->getInsertId($rs);}
11
-    public function dbClose()                   {global $modx;       $modx->db->disconnect();}
6
+    public function dbConnect()
7
+    {
8
+global $modx;       $modx->db->connect();$modx->rs = $modx->db->conn;}
9
+    public function dbQuery($sql)
10
+    {
11
+global $modx;return $modx->db->query($sql);}
12
+    public function recordCount($rs)
13
+    {
14
+global $modx;return $modx->db->getRecordCount($rs);}
15
+    public function fetchRow($rs,$mode='assoc')
16
+    {
17
+global $modx;return $modx->db->getRow($rs, $mode);}
18
+    public function affectedRows($rs)
19
+    {
20
+global $modx;return $modx->db->getAffectedRows($rs);}
21
+    public function insertId($rs)
22
+    {
23
+global $modx;return $modx->db->getInsertId($rs);}
24
+    public function dbClose()
25
+    {
26
+global $modx;       $modx->db->disconnect();}
12 27
 
13
-    public function makeList($array, $ulroot= 'root', $ulprefix= 'sub_', $type= '', $ordered= false, $tablevel= 0) {
28
+    public function makeList($array, $ulroot= 'root', $ulprefix= 'sub_', $type= '', $ordered= false, $tablevel= 0)
29
+    {
14 30
         // first find out whether the value passed is an array
15 31
         if (!is_array($array)) {
16 32
             return "<ul><li>Bad list</li></ul>";
@@ -37,7 +53,8 @@  discard block
 block discarded – undo
37 53
     }
38 54
 
39 55
 
40
-    public function getUserData() {
56
+    public function getUserData()
57
+    {
41 58
         $client['ip'] = $_SERVER['REMOTE_ADDR'];
42 59
         $client['ua'] = $_SERVER['HTTP_USER_AGENT'];
43 60
     	return $client;
@@ -45,35 +62,42 @@  discard block
 block discarded – undo
45 62
 
46 63
     # Returns true, install or interact when inside manager
47 64
     // deprecated
48
-    public function insideManager() {
65
+    public function insideManager()
66
+    {
49 67
         $m= false;
50 68
         if( defined('IN_MANAGER_MODE') && IN_MANAGER_MODE === true) {
51 69
             $m= true;
52
-            if (defined('SNIPPET_INTERACTIVE_MODE') && SNIPPET_INTERACTIVE_MODE == 'true')
53
-                $m= "interact";
54
-            else
55
-                if (defined('SNIPPET_INSTALL_MODE') && SNIPPET_INSTALL_MODE == 'true')
56
-                    $m= "install";
70
+            if (defined('SNIPPET_INTERACTIVE_MODE') && SNIPPET_INTERACTIVE_MODE == 'true') {
71
+                            $m= "interact";
72
+            } else
73
+                if (defined('SNIPPET_INSTALL_MODE') && SNIPPET_INSTALL_MODE == 'true') {
74
+                                    $m= "install";
75
+                }
57 76
         }
58 77
         return $m;
59 78
     }
60 79
 
61 80
     // deprecated
62
-    public function putChunk($chunkName) { // alias name >.<
81
+    public function putChunk($chunkName)
82
+    {
83
+// alias name >.<
63 84
     	global $modx;
64 85
         return $modx->getChunk($chunkName);
65 86
     }
66 87
 
67
-    public function getDocGroups() {
88
+    public function getDocGroups()
89
+    {
68 90
     	global $modx;
69 91
         return $modx->getUserDocGroups();
70 92
     } // deprecated
71 93
 
72
-    public function changePassword($o, $n) {
94
+    public function changePassword($o, $n)
95
+    {
73 96
         return changeWebUserPassword($o, $n);
74 97
     } // deprecated
75 98
 
76
-    public function userLoggedIn() {
99
+    public function userLoggedIn()
100
+    {
77 101
     	global $modx;
78 102
         $userdetails= array ();
79 103
         if ($modx->isFrontend() && isset ($_SESSION['webValidated'])) {
@@ -96,18 +120,22 @@  discard block
 block discarded – undo
96 120
             }
97 121
     }
98 122
 
99
-    public function getFormVars($method= "", $prefix= "", $trim= "", $REQUEST_METHOD) {
123
+    public function getFormVars($method= "", $prefix= "", $trim= "", $REQUEST_METHOD)
124
+    {
100 125
         //  function to retrieve form results into an associative array
101 126
     	global $modx;
102 127
         $results= array ();
103 128
         $method= strtoupper($method);
104
-        if ($method == "")
105
-            $method= $REQUEST_METHOD;
106
-        if ($method == "POST")
107
-            $method= & $_POST;
108
-        elseif ($method == "GET") $method= & $_GET;
109
-        else
110
-            return false;
129
+        if ($method == "") {
130
+                    $method= $REQUEST_METHOD;
131
+        }
132
+        if ($method == "POST") {
133
+                    $method= & $_POST;
134
+        } elseif ($method == "GET") {
135
+            $method= & $_GET;
136
+        } else {
137
+                    return false;
138
+        }
111 139
         reset($method);
112 140
         foreach ($method as $key => $value) {
113 141
             if (($prefix != "") && (substr($key, 0, strlen($prefix)) == $prefix)) {
@@ -115,10 +143,12 @@  discard block
 block discarded – undo
115 143
                     $pieces= explode($prefix, $key, 2);
116 144
                     $key= $pieces[1];
117 145
                     $results[$key]= $value;
118
-                } else
119
-                    $results[$key]= $value;
146
+                } else {
147
+                                    $results[$key]= $value;
148
+                }
149
+            } elseif ($prefix == "") {
150
+                $results[$key]= $value;
120 151
             }
121
-            elseif ($prefix == "") $results[$key]= $value;
122 152
         }
123 153
         return $results;
124 154
     }
@@ -129,7 +159,8 @@  discard block
 block discarded – undo
129 159
      * @param string $msg Message to show
130 160
      * @param string $url URL to redirect to
131 161
      */
132
-    public function webAlert($msg, $url= "") {
162
+    public function webAlert($msg, $url= "")
163
+    {
133 164
     	global $modx;
134 165
         $msg= addslashes($modx->db->escape($msg));
135 166
         if (substr(strtolower($url), 0, 11) == "javascript:") {
@@ -139,9 +170,9 @@  discard block
 block discarded – undo
139 170
             $act= ($url ? "window.location.href='" . addslashes($url) . "';" : "");
140 171
         }
141 172
         $html= "<script>$fnc window.setTimeout(\"alert('$msg');$act\",100);</script>";
142
-        if ($modx->isFrontend())
143
-            $modx->regClientScript($html);
144
-        else {
173
+        if ($modx->isFrontend()) {
174
+                    $modx->regClientScript($html);
175
+        } else {
145 176
             echo $html;
146 177
         }
147 178
     }
Please login to merge, or discard this patch.
manager/includes/controls/contextmenu.php 3 patches
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -4,71 +4,71 @@
 block discarded – undo
4 4
 $ContextMenuCnt = 0;
5 5
 
6 6
 class ContextMenu {
7
-	public $id;
7
+    public $id;
8 8
     /**
9 9
      * @var string
10 10
      */
11
-	public $html = '';
11
+    public $html = '';
12 12
     /**
13 13
      * @var bool
14 14
      */
15
-	public $visible = false;
15
+    public $visible = false;
16 16
     /**
17 17
      * @var int
18 18
      */
19
-	public $width = 120;
19
+    public $width = 120;
20 20
 
21 21
     public function __construct($id = '', $width = 120, $visible = false) {
22
-		global $ContextMenuCnt;
23
-		$ContextMenuCnt++;
24
-		$this->html = "";
25
-		$this->visible = $visible ? $visible : false;
26
-		$this->width = is_numeric($width) ? (int)$width : 120;
27
-		$this->id = $id ? $id : "cntxMnu" . $ContextMenuCnt;    // set id
28
-	}
22
+        global $ContextMenuCnt;
23
+        $ContextMenuCnt++;
24
+        $this->html = "";
25
+        $this->visible = $visible ? $visible : false;
26
+        $this->width = is_numeric($width) ? (int)$width : 120;
27
+        $this->id = $id ? $id : "cntxMnu" . $ContextMenuCnt;    // set id
28
+    }
29 29
 
30 30
     public function addItem($text, $action = "", $img = "", $disabled = 0) {
31
-		global $base_url, $_style;
31
+        global $base_url, $_style;
32 32
         if($disabled) {
33 33
             return;
34 34
         }
35
-		if(!$img) {
36
-			$img = $base_url . $_style['tx'];
37
-		}
38
-		if(substr($action, 0, 3) == "js:") {
39
-			$action = substr($action, 3);
40
-		} else if(substr($action, 0, 3) == "hl:") {
41
-			$action = "window.location.href='" . substr($action, 3) . "'";
42
-		} else {
43
-			$action = "window.location.href='" . $action . "'";
44
-		}
45
-		$action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('" . $this->id . "');\"";
46
-		$this->html .= "<div class='" . ($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem") . "' $action>";
35
+        if(!$img) {
36
+            $img = $base_url . $_style['tx'];
37
+        }
38
+        if(substr($action, 0, 3) == "js:") {
39
+            $action = substr($action, 3);
40
+        } else if(substr($action, 0, 3) == "hl:") {
41
+            $action = "window.location.href='" . substr($action, 3) . "'";
42
+        } else {
43
+            $action = "window.location.href='" . $action . "'";
44
+        }
45
+        $action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('" . $this->id . "');\"";
46
+        $this->html .= "<div class='" . ($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem") . "' $action>";
47 47
         if(substr($img, 0, 5) == 'fa fa') {
48 48
             $img = '<i class="' . $img . '"></i>';
49 49
         } else if(substr($img, 0, 1) != '<') {
50 50
             $img = '<img src="' . $img . '" />';
51 51
         }
52
-		$this->html .= $img . '&nbsp;' . $text . '</div>';
53
-	}
52
+        $this->html .= $img . '&nbsp;' . $text . '</div>';
53
+    }
54 54
 
55 55
     public function addSeparator() {
56
-		$this->html .= "
56
+        $this->html .= "
57 57
 			<div class='cntxMnuSeparator'></div>
58 58
 		";
59
-	}
59
+    }
60 60
 
61 61
     public function render() {
62
-		global $ContextMenuScript;
62
+        global $ContextMenuScript;
63 63
 
64
-		$html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>";
65
-		$ContextMenuScript = ""; // reset css
66
-		return $html;
67
-	}
64
+        $html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>";
65
+        $ContextMenuScript = ""; // reset css
66
+        return $html;
67
+    }
68 68
 
69 69
     public function getClientScriptObject() {
70
-		return "getCntxMenu('" . $this->id . "')";
71
-	}
70
+        return "getCntxMenu('" . $this->id . "')";
71
+    }
72 72
 }
73 73
 
74 74
 $ContextMenuScript = <<<BLOCK
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 global $ContextMenuCnt;
4 4
 $ContextMenuCnt = 0;
5 5
 
6
-class ContextMenu {
6
+class ContextMenu{
7 7
 	public $id;
8 8
     /**
9 9
      * @var string
@@ -18,56 +18,56 @@  discard block
 block discarded – undo
18 18
      */
19 19
 	public $width = 120;
20 20
 
21
-    public function __construct($id = '', $width = 120, $visible = false) {
21
+    public function __construct($id = '', $width = 120, $visible = false){
22 22
 		global $ContextMenuCnt;
23 23
 		$ContextMenuCnt++;
24 24
 		$this->html = "";
25 25
 		$this->visible = $visible ? $visible : false;
26
-		$this->width = is_numeric($width) ? (int)$width : 120;
27
-		$this->id = $id ? $id : "cntxMnu" . $ContextMenuCnt;    // set id
26
+		$this->width = is_numeric($width) ? (int) $width : 120;
27
+		$this->id = $id ? $id : "cntxMnu".$ContextMenuCnt; // set id
28 28
 	}
29 29
 
30
-    public function addItem($text, $action = "", $img = "", $disabled = 0) {
30
+    public function addItem($text, $action = "", $img = "", $disabled = 0){
31 31
 		global $base_url, $_style;
32
-        if($disabled) {
32
+        if ($disabled) {
33 33
             return;
34 34
         }
35
-		if(!$img) {
36
-			$img = $base_url . $_style['tx'];
35
+		if (!$img) {
36
+			$img = $base_url.$_style['tx'];
37 37
 		}
38
-		if(substr($action, 0, 3) == "js:") {
38
+		if (substr($action, 0, 3) == "js:") {
39 39
 			$action = substr($action, 3);
40
-		} else if(substr($action, 0, 3) == "hl:") {
41
-			$action = "window.location.href='" . substr($action, 3) . "'";
40
+		} else if (substr($action, 0, 3) == "hl:") {
41
+			$action = "window.location.href='".substr($action, 3)."'";
42 42
 		} else {
43
-			$action = "window.location.href='" . $action . "'";
43
+			$action = "window.location.href='".$action."'";
44 44
 		}
45
-		$action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('" . $this->id . "');\"";
46
-		$this->html .= "<div class='" . ($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem") . "' $action>";
47
-        if(substr($img, 0, 5) == 'fa fa') {
48
-            $img = '<i class="' . $img . '"></i>';
49
-        } else if(substr($img, 0, 1) != '<') {
50
-            $img = '<img src="' . $img . '" />';
45
+		$action = " onmouseover=\"this.className='cntxMnuItemOver';\" onmouseout=\"this.className='cntxMnuItem';\" onclick=\"$action; hideCntxMenu('".$this->id."');\"";
46
+		$this->html .= "<div class='".($disabled ? "cntxMnuItemDisabled" : "cntxMnuItem")."' $action>";
47
+        if (substr($img, 0, 5) == 'fa fa') {
48
+            $img = '<i class="'.$img.'"></i>';
49
+        } else if (substr($img, 0, 1) != '<') {
50
+            $img = '<img src="'.$img.'" />';
51 51
         }
52
-		$this->html .= $img . '&nbsp;' . $text . '</div>';
52
+		$this->html .= $img.'&nbsp;'.$text.'</div>';
53 53
 	}
54 54
 
55
-    public function addSeparator() {
55
+    public function addSeparator(){
56 56
 		$this->html .= "
57 57
 			<div class='cntxMnuSeparator'></div>
58 58
 		";
59 59
 	}
60 60
 
61
-    public function render() {
61
+    public function render(){
62 62
 		global $ContextMenuScript;
63 63
 
64
-		$html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>";
64
+		$html = $ContextMenuScript."<div id='".$this->id."' class='contextMenu' style='width:".$this->width."px; visibility:".($this->visible ? 'visible' : 'hidden')."'>".$this->html."</div>";
65 65
 		$ContextMenuScript = ""; // reset css
66 66
 		return $html;
67 67
 	}
68 68
 
69
-    public function getClientScriptObject() {
70
-		return "getCntxMenu('" . $this->id . "')";
69
+    public function getClientScriptObject(){
70
+		return "getCntxMenu('".$this->id."')";
71 71
 	}
72 72
 }
73 73
 
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -3,7 +3,8 @@  discard block
 block discarded – undo
3 3
 global $ContextMenuCnt;
4 4
 $ContextMenuCnt = 0;
5 5
 
6
-class ContextMenu {
6
+class ContextMenu
7
+{
7 8
 	public $id;
8 9
     /**
9 10
      * @var string
@@ -18,7 +19,8 @@  discard block
 block discarded – undo
18 19
      */
19 20
 	public $width = 120;
20 21
 
21
-    public function __construct($id = '', $width = 120, $visible = false) {
22
+    public function __construct($id = '', $width = 120, $visible = false)
23
+    {
22 24
 		global $ContextMenuCnt;
23 25
 		$ContextMenuCnt++;
24 26
 		$this->html = "";
@@ -27,7 +29,8 @@  discard block
 block discarded – undo
27 29
 		$this->id = $id ? $id : "cntxMnu" . $ContextMenuCnt;    // set id
28 30
 	}
29 31
 
30
-    public function addItem($text, $action = "", $img = "", $disabled = 0) {
32
+    public function addItem($text, $action = "", $img = "", $disabled = 0)
33
+    {
31 34
 		global $base_url, $_style;
32 35
         if($disabled) {
33 36
             return;
@@ -52,13 +55,15 @@  discard block
 block discarded – undo
52 55
 		$this->html .= $img . '&nbsp;' . $text . '</div>';
53 56
 	}
54 57
 
55
-    public function addSeparator() {
58
+    public function addSeparator()
59
+    {
56 60
 		$this->html .= "
57 61
 			<div class='cntxMnuSeparator'></div>
58 62
 		";
59 63
 	}
60 64
 
61
-    public function render() {
65
+    public function render()
66
+    {
62 67
 		global $ContextMenuScript;
63 68
 
64 69
 		$html = $ContextMenuScript . "<div id='" . $this->id . "' class='contextMenu' style='width:" . $this->width . "px; visibility:" . ($this->visible ? 'visible' : 'hidden') . "'>" . $this->html . "</div>";
@@ -66,7 +71,8 @@  discard block
 block discarded – undo
66 71
 		return $html;
67 72
 	}
68 73
 
69
-    public function getClientScriptObject() {
74
+    public function getClientScriptObject()
75
+    {
70 76
 		return "getCntxMenu('" . $this->id . "')";
71 77
 	}
72 78
 }
Please login to merge, or discard this patch.
manager/includes/active_user_locks.inc.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
2
+if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) {
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 
6
-$lockElementId = (int)$lockElementId;
6
+$lockElementId = (int) $lockElementId;
7 7
 
8 8
 if ($lockElementId > 0) {
9 9
     ?>
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
         var stay = document.getElementById('stay');
19 19
         // Trigger unlock
20 20
         if ((stay && stay.value !== '2') || !form_save) {
21
-          var url = '<?php echo MODX_MANAGER_URL; ?>?a=67&type=<?php echo $lockElementType;?>&id=<?php echo $lockElementId;?>&o=' + Math.random();
21
+          var url = '<?php echo MODX_MANAGER_URL; ?>?a=67&type=<?php echo $lockElementType; ?>&id=<?php echo $lockElementId; ?>&o=' + Math.random();
22 22
           if (navigator.sendBeacon) {
23 23
             navigator.sendBeacon(url)
24 24
           } else {
Please login to merge, or discard this patch.
manager/includes/error.class.inc.php 3 patches
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -17,70 +17,70 @@  discard block
 block discarded – undo
17 17
 
18 18
     public function __construct() {
19 19
 
20
-		$_lang = $this->include_lang('errormsg');
20
+        $_lang = $this->include_lang('errormsg');
21 21
 
22
-		$this->errors = array(
23
-		0	=>	$_lang["No errors occured."],
24
-		1	=>	$_lang["An error occured!"],
25
-		2	=>	$_lang["Document's ID not passed in request!"],
26
-		3	=>	$_lang["You don't have enough privileges for this action!"],
27
-		4	=>	$_lang["ID passed in request is NaN!"],
28
-		5	=>	$_lang["The document is locked!"],
29
-		6	=>	$_lang["Too many results returned from database!"],
30
-		7	=>	$_lang["Not enough/ no results returned from database!"],
31
-		8	=>	$_lang["Couldn't find parent document's name!"],
32
-		9	=>	$_lang["Logging error!"],
33
-		10	=>	$_lang["Table to optimise not found in request!"],
34
-		11	=>	$_lang["No settings found in request!"],
35
-		12	=>	$_lang["The document must have a title!"],
36
-		13	=>	$_lang["No user selected as recipient of this message!"],
37
-		14	=>	$_lang["No group selected as recipient of this message!"],
38
-		15	=>	$_lang["The document was not found!"],
22
+        $this->errors = array(
23
+        0	=>	$_lang["No errors occured."],
24
+        1	=>	$_lang["An error occured!"],
25
+        2	=>	$_lang["Document's ID not passed in request!"],
26
+        3	=>	$_lang["You don't have enough privileges for this action!"],
27
+        4	=>	$_lang["ID passed in request is NaN!"],
28
+        5	=>	$_lang["The document is locked!"],
29
+        6	=>	$_lang["Too many results returned from database!"],
30
+        7	=>	$_lang["Not enough/ no results returned from database!"],
31
+        8	=>	$_lang["Couldn't find parent document's name!"],
32
+        9	=>	$_lang["Logging error!"],
33
+        10	=>	$_lang["Table to optimise not found in request!"],
34
+        11	=>	$_lang["No settings found in request!"],
35
+        12	=>	$_lang["The document must have a title!"],
36
+        13	=>	$_lang["No user selected as recipient of this message!"],
37
+        14	=>	$_lang["No group selected as recipient of this message!"],
38
+        15	=>	$_lang["The document was not found!"],
39 39
 
40
-		100 =>	$_lang["Double action (GET & POST) posted!"],
41
-		600 =>	$_lang["Document cannot be it's own parent!"],
42
-		601 =>	$_lang["Document's ID not passed in request!"],
43
-		602 =>	$_lang["New parent not set in request!"],
44
-		900 =>	$_lang["don't know the user!"], // don't know the user!
45
-		901 =>	$_lang["wrong password!"], // wrong password!
46
-		902 =>	$_lang["Due to too many failed logins, you have been blocked!"],
47
-		903 =>	$_lang["You are blocked and cannot log in!"],
48
-		904 =>	$_lang["You are blocked and cannot log in! Please try again later."],
49
-		905 =>	$_lang["The security code you entered didn't validate! Please try to login again!"]
50
-	);
51
-	}
40
+        100 =>	$_lang["Double action (GET & POST) posted!"],
41
+        600 =>	$_lang["Document cannot be it's own parent!"],
42
+        601 =>	$_lang["Document's ID not passed in request!"],
43
+        602 =>	$_lang["New parent not set in request!"],
44
+        900 =>	$_lang["don't know the user!"], // don't know the user!
45
+        901 =>	$_lang["wrong password!"], // wrong password!
46
+        902 =>	$_lang["Due to too many failed logins, you have been blocked!"],
47
+        903 =>	$_lang["You are blocked and cannot log in!"],
48
+        904 =>	$_lang["You are blocked and cannot log in! Please try again later."],
49
+        905 =>	$_lang["The security code you entered didn't validate! Please try to login again!"]
50
+    );
51
+    }
52 52
 
53
-	function include_lang($context='common') {
54
-		global $modx;
55
-		$_lang = array();
53
+    function include_lang($context='common') {
54
+        global $modx;
55
+        $_lang = array();
56 56
 
57
-		$context = trim($context,'/');
58
-		if(strpos($context,'..')!==false) return;
57
+        $context = trim($context,'/');
58
+        if(strpos($context,'..')!==false) return;
59 59
 
60
-		if($context === 'common')
61
-			$lang_path = MODX_MANAGER_PATH . 'includes/lang/';
62
-		else
63
-			$lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/";
64
-		include_once($lang_path . 'english.inc.php');
65
-		$manager_language = $modx->config['manager_language'];
66
-		if(is_file("{$lang_path}{$manager_language}.inc.php"))
67
-			include_once("{$lang_path}{$manager_language}.inc.php");
68
-		return $_lang;
69
-	}
60
+        if($context === 'common')
61
+            $lang_path = MODX_MANAGER_PATH . 'includes/lang/';
62
+        else
63
+            $lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/";
64
+        include_once($lang_path . 'english.inc.php');
65
+        $manager_language = $modx->config['manager_language'];
66
+        if(is_file("{$lang_path}{$manager_language}.inc.php"))
67
+            include_once("{$lang_path}{$manager_language}.inc.php");
68
+        return $_lang;
69
+    }
70 70
 
71
-	function setError($errorcode, $custommessage=""){
72
-		$this->errorcode=$errorcode;
73
-		$this->errormessage=$this->errors[$errorcode];
74
-		if($custommessage!="") {
75
-			$this->errormessage=$custommessage;
76
-		}
77
-	}
71
+    function setError($errorcode, $custommessage=""){
72
+        $this->errorcode=$errorcode;
73
+        $this->errormessage=$this->errors[$errorcode];
74
+        if($custommessage!="") {
75
+            $this->errormessage=$custommessage;
76
+        }
77
+    }
78 78
 
79
-	function getError() {
80
-		return $this->errorcode;
81
-	}
79
+    function getError() {
80
+        return $this->errorcode;
81
+    }
82 82
 
83
-	function dumpError(){
83
+    function dumpError(){
84 84
 ?>
85 85
 	<html>
86 86
 	<head>
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	</body>
99 99
 	</html>
100 100
 <?php
101
-		exit;
102
-	}
101
+        exit;
102
+    }
103 103
 }
104 104
 ?>
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
      */
16 16
     public $errormessage;
17 17
 
18
-    public function __construct() {
18
+    public function __construct(){
19 19
 
20 20
 		$_lang = $this->include_lang('errormsg');
21 21
 
@@ -50,33 +50,33 @@  discard block
 block discarded – undo
50 50
 	);
51 51
 	}
52 52
 
53
-	function include_lang($context='common') {
53
+	function include_lang($context = 'common'){
54 54
 		global $modx;
55 55
 		$_lang = array();
56 56
 
57
-		$context = trim($context,'/');
58
-		if(strpos($context,'..')!==false) return;
57
+		$context = trim($context, '/');
58
+		if (strpos($context, '..') !== false) return;
59 59
 
60
-		if($context === 'common')
61
-			$lang_path = MODX_MANAGER_PATH . 'includes/lang/';
60
+		if ($context === 'common')
61
+			$lang_path = MODX_MANAGER_PATH.'includes/lang/';
62 62
 		else
63
-			$lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/";
64
-		include_once($lang_path . 'english.inc.php');
63
+			$lang_path = MODX_MANAGER_PATH."includes/lang/{$context}/";
64
+		include_once($lang_path.'english.inc.php');
65 65
 		$manager_language = $modx->config['manager_language'];
66
-		if(is_file("{$lang_path}{$manager_language}.inc.php"))
66
+		if (is_file("{$lang_path}{$manager_language}.inc.php"))
67 67
 			include_once("{$lang_path}{$manager_language}.inc.php");
68 68
 		return $_lang;
69 69
 	}
70 70
 
71
-	function setError($errorcode, $custommessage=""){
72
-		$this->errorcode=$errorcode;
73
-		$this->errormessage=$this->errors[$errorcode];
74
-		if($custommessage!="") {
75
-			$this->errormessage=$custommessage;
71
+	function setError($errorcode, $custommessage = ""){
72
+		$this->errorcode = $errorcode;
73
+		$this->errormessage = $this->errors[$errorcode];
74
+		if ($custommessage != "") {
75
+			$this->errormessage = $custommessage;
76 76
 		}
77 77
 	}
78 78
 
79
-	function getError() {
79
+	function getError(){
80 80
 		return $this->errorcode;
81 81
 	}
82 82
 
Please login to merge, or discard this patch.
Braces   +23 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // this is the old error handler. Here for legacy, until i replace all the old errors.
3
-class errorHandler{
3
+class errorHandler
4
+{
4 5
 
5 6
     /**
6 7
      * @var int
@@ -15,7 +16,8 @@  discard block
 block discarded – undo
15 16
      */
16 17
     public $errormessage;
17 18
 
18
-    public function __construct() {
19
+    public function __construct()
20
+    {
19 21
 
20 22
 		$_lang = $this->include_lang('errormsg');
21 23
 
@@ -50,25 +52,31 @@  discard block
 block discarded – undo
50 52
 	);
51 53
 	}
52 54
 
53
-	function include_lang($context='common') {
55
+	function include_lang($context='common')
56
+	{
54 57
 		global $modx;
55 58
 		$_lang = array();
56 59
 
57 60
 		$context = trim($context,'/');
58
-		if(strpos($context,'..')!==false) return;
61
+		if(strpos($context,'..')!==false) {
62
+		    return;
63
+		}
59 64
 
60
-		if($context === 'common')
61
-			$lang_path = MODX_MANAGER_PATH . 'includes/lang/';
62
-		else
63
-			$lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/";
65
+		if($context === 'common') {
66
+					$lang_path = MODX_MANAGER_PATH . 'includes/lang/';
67
+		} else {
68
+					$lang_path = MODX_MANAGER_PATH . "includes/lang/{$context}/";
69
+		}
64 70
 		include_once($lang_path . 'english.inc.php');
65 71
 		$manager_language = $modx->config['manager_language'];
66
-		if(is_file("{$lang_path}{$manager_language}.inc.php"))
67
-			include_once("{$lang_path}{$manager_language}.inc.php");
72
+		if(is_file("{$lang_path}{$manager_language}.inc.php")) {
73
+					include_once("{$lang_path}{$manager_language}.inc.php");
74
+		}
68 75
 		return $_lang;
69 76
 	}
70 77
 
71
-	function setError($errorcode, $custommessage=""){
78
+	function setError($errorcode, $custommessage="")
79
+	{
72 80
 		$this->errorcode=$errorcode;
73 81
 		$this->errormessage=$this->errors[$errorcode];
74 82
 		if($custommessage!="") {
@@ -76,11 +84,13 @@  discard block
 block discarded – undo
76 84
 		}
77 85
 	}
78 86
 
79
-	function getError() {
87
+	function getError()
88
+	{
80 89
 		return $this->errorcode;
81 90
 	}
82 91
 
83
-	function dumpError(){
92
+	function dumpError()
93
+	{
84 94
 ?>
85 95
 	<html>
86 96
 	<head>
Please login to merge, or discard this patch.
manager/includes/log.class.inc.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -12,24 +12,24 @@  discard block
 block discarded – undo
12 12
 
13 13
 */
14 14
 
15
-class logHandler {
15
+class logHandler{
16 16
     // Single variable for a log entry
17 17
     var $entry = array();
18 18
 
19
-    function initAndWriteLog($msg="", $internalKey="", $username="", $action="", $itemid="", $itemname="") {
19
+    function initAndWriteLog($msg = "", $internalKey = "", $username = "", $action = "", $itemid = "", $itemname = ""){
20 20
         global $modx;
21 21
         $this->entry['msg'] = $msg; // writes testmessage to the object
22
-        $this->entry['action'] = empty($action)? $modx->manager->action : $action;    // writes the action to the object
22
+        $this->entry['action'] = empty($action) ? $modx->manager->action : $action; // writes the action to the object
23 23
 
24 24
         // User Credentials
25 25
         $this->entry['internalKey'] = $internalKey == "" ? $modx->getLoginUserID() : $internalKey;
26 26
         $this->entry['username'] = $username == "" ? $modx->getLoginUserName() : $username;
27 27
 
28
-        $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int)$_REQUEST['id'] : $itemid;  // writes the id to the object
29
-        if($this->entry['itemId'] == 0) $this->entry['itemId'] = "-"; // to stop items having id 0
28
+        $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int) $_REQUEST['id'] : $itemid; // writes the id to the object
29
+        if ($this->entry['itemId'] == 0) $this->entry['itemId'] = "-"; // to stop items having id 0
30 30
 
31
-        $this->entry['itemName'] = ($itemname == "" && isset($_SESSION['itemname']))? $_SESSION['itemname'] : $itemname; // writes the id to the object
32
-        if($this->entry['itemName'] == "") $this->entry['itemName'] = "-"; // to stop item name being empty
31
+        $this->entry['itemName'] = ($itemname == "" && isset($_SESSION['itemname'])) ? $_SESSION['itemname'] : $itemname; // writes the id to the object
32
+        if ($this->entry['itemName'] == "") $this->entry['itemName'] = "-"; // to stop item name being empty
33 33
 
34 34
         $this->writeToLog();
35 35
         return;
@@ -38,20 +38,20 @@  discard block
 block discarded – undo
38 38
     // function to write to the log
39 39
     // collects all required info, and
40 40
     // writes it to the logging table
41
-    function writeToLog() {
41
+    function writeToLog(){
42 42
         global $modx;
43 43
         $tbl_manager_log = $modx->getFullTableName('manager_log');
44 44
 
45
-        if($this->entry['internalKey'] == "") {
45
+        if ($this->entry['internalKey'] == "") {
46 46
             $modx->webAlertAndQuit("Logging error: internalKey not set.");
47 47
         }
48
-        if(empty($this->entry['action'])) {
48
+        if (empty($this->entry['action'])) {
49 49
             $modx->webAlertAndQuit("Logging error: action not set.");
50 50
         }
51
-        if($this->entry['msg'] == "") {
51
+        if ($this->entry['msg'] == "") {
52 52
             include_once "actionlist.inc.php";
53 53
             $this->entry['msg'] = getAction($this->entry['action'], $this->entry['itemId']);
54
-            if($this->entry['msg'] == "") {
54
+            if ($this->entry['msg'] == "") {
55 55
                 $modx->webAlertAndQuit("Logging error: couldn't find message to write to log.");
56 56
             }
57 57
         }
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
         $fields['itemid']      = $this->entry['itemId'];
64 64
         $fields['itemname']    = $modx->db->escape($this->entry['itemName']);
65 65
         $fields['message']     = $modx->db->escape($this->entry['msg']);
66
-        $insert_id = $modx->db->insert($fields,$tbl_manager_log);
67
-        if(!$insert_id) {
66
+        $insert_id = $modx->db->insert($fields, $tbl_manager_log);
67
+        if (!$insert_id) {
68 68
             $modx->messageQuit("Logging error: couldn't save log to table! Error code: ".$modx->db->getLastError());
69 69
         } else {
70
-            $limit = (isset($modx->config['manager_log_limit'])) ? (int)$modx->config['manager_log_limit'] : 3000;
71
-            $trim  = (isset($modx->config['manager_log_trim']))  ? (int)$modx->config['manager_log_trim'] : 100;
72
-            if(($insert_id % $trim) === 0) {
73
-                $modx->rotate_log('manager_log',$limit,$trim);
70
+            $limit = (isset($modx->config['manager_log_limit'])) ? (int) $modx->config['manager_log_limit'] : 3000;
71
+            $trim  = (isset($modx->config['manager_log_trim'])) ? (int) $modx->config['manager_log_trim'] : 100;
72
+            if (($insert_id % $trim) === 0) {
73
+                $modx->rotate_log('manager_log', $limit, $trim);
74 74
             }
75 75
         }
76 76
     }
Please login to merge, or discard this patch.