Completed
Push — develop ( e6bcf2...351294 )
by Dmytro
06:18
created
manager/includes/extenders/dbapi.mysqli.class.inc.php 1 patch
Spacing   +39 added lines, -39 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'];
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
                         $ua = $modx->htmlspecialchars($_SERVER['HTTP_USER_AGENT']);
71 71
                         $referer = $modx->htmlspecialchars($_SERVER['HTTP_REFERER']);
72 72
                         $modx->sendmail(array(
73
-                            'subject' => 'Missing to create the database connection! from ' . $modx->config['site_name'],
73
+                            'subject' => 'Missing to create the database connection! from '.$modx->config['site_name'],
74 74
                             'body'    => "{$logtitle}\n{$request_uri}\n{$ua}\n{$referer}",
75 75
                             'type'    => 'text'
76 76
                         ));
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
             $tend = $modx->getMicroTime();
86 86
             $totaltime = $tend - $tstart;
87 87
             if ($modx->dumpSQL) {
88
-                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>" . sprintf("Database connection was created in %2.4f s",
89
-                        $totaltime) . "</fieldset><br />";
88
+                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>".sprintf("Database connection was created in %2.4f s",
89
+                        $totaltime)."</fieldset><br />";
90 90
             }
91 91
             $this->conn->set_charset($this->config['charset']);
92 92
             $this->isConnected = true;
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
         if (1000 < $safeCount) {
120 120
             exit("Too many loops '{$safeCount}'");
121 121
         }
122
-        if (! ($this->conn instanceof mysqli)) {
122
+        if (!($this->conn instanceof mysqli)) {
123 123
             $this->connect();
124 124
         }
125 125
         if (is_array($s)) {
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
     public function query($sql, $watchError = true)
146 146
     {
147 147
         $modx = evolutionCMS();
148
-        if (! ($this->conn instanceof mysqli)) {
148
+        if (!($this->conn instanceof mysqli)) {
149 149
             $this->connect();
150 150
         }
151 151
         $tStart = $modx->getMicroTime();
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
                 case 1091:
166 166
                     break;
167 167
                 default:
168
-                    $modx->messageQuit('Execution of a query to the database failed - ' . $this->getLastError(), $sql);
168
+                    $modx->messageQuit('Execution of a query to the database failed - '.$this->getLastError(), $sql);
169 169
             }
170 170
         } else {
171 171
             $tend = $modx->getMicroTime();
@@ -179,24 +179,24 @@  discard block
 block discarded – undo
179 179
                     $debug_path[] = $line['function'];
180 180
                 }
181 181
                 $debug_path = implode(' > ', array_reverse($debug_path));
182
-                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query " . ($modx->executedQueries + 1) . " - " . sprintf("%2.2f ms",
183
-                        $totalTime * 1000) . "</legend>";
184
-                $modx->queryCode .= $sql . '<br><br>';
182
+                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query ".($modx->executedQueries + 1)." - ".sprintf("%2.2f ms",
183
+                        $totalTime * 1000)."</legend>";
184
+                $modx->queryCode .= $sql.'<br><br>';
185 185
                 if ($modx->event->name) {
186
-                    $modx->queryCode .= 'Current Event  => ' . $modx->event->name . '<br>';
186
+                    $modx->queryCode .= 'Current Event  => '.$modx->event->name.'<br>';
187 187
                 }
188 188
                 if ($modx->event->activePlugin) {
189
-                    $modx->queryCode .= 'Current Plugin => ' . $modx->event->activePlugin . '<br>';
189
+                    $modx->queryCode .= 'Current Plugin => '.$modx->event->activePlugin.'<br>';
190 190
                 }
191 191
                 if ($modx->currentSnippet) {
192
-                    $modx->queryCode .= 'Current Snippet => ' . $modx->currentSnippet . '<br>';
192
+                    $modx->queryCode .= 'Current Snippet => '.$modx->currentSnippet.'<br>';
193 193
                 }
194 194
                 if (stripos($sql, 'select') === 0) {
195
-                    $modx->queryCode .= 'Record Count => ' . $this->getRecordCount($result) . '<br>';
195
+                    $modx->queryCode .= 'Record Count => '.$this->getRecordCount($result).'<br>';
196 196
                 } else {
197
-                    $modx->queryCode .= 'Affected Rows => ' . $this->getAffectedRows() . '<br>';
197
+                    $modx->queryCode .= 'Affected Rows => '.$this->getAffectedRows().'<br>';
198 198
                 }
199
-                $modx->queryCode .= 'Functions Path => ' . $debug_path . '<br>';
199
+                $modx->queryCode .= 'Functions Path => '.$debug_path.'<br>';
200 200
                 $modx->queryCode .= "</fieldset><br />";
201 201
             }
202 202
             $modx->executedQueries++;
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
         $modx = evolutionCMS();
296 296
         $out = false;
297 297
         if (!$table) {
298
-            $modx->messageQuit('Empty ' . $table . ' parameter in DBAPI::update().');
298
+            $modx->messageQuit('Empty '.$table.' parameter in DBAPI::update().');
299 299
         } else {
300 300
             $table = $this->replaceFullTableName($table);
301 301
             if (is_array($fields)) {
@@ -303,18 +303,18 @@  discard block
 block discarded – undo
303 303
                     if ($value === null || strtolower($value) === 'null') {
304 304
                         $f = 'NULL';
305 305
                     } else {
306
-                        $f = "'" . $value . "'";
306
+                        $f = "'".$value."'";
307 307
                     }
308
-                    $fields[$key] = "`{$key}` = " . $f;
308
+                    $fields[$key] = "`{$key}` = ".$f;
309 309
                 }
310 310
                 $fields = implode(',', $fields);
311 311
             }
312 312
             $where = trim($where);
313 313
             if ($where !== '' && stripos($where, 'WHERE') !== 0) {
314
-                $where = 'WHERE ' . $where;
314
+                $where = 'WHERE '.$where;
315 315
             }
316 316
 
317
-            return $this->query('UPDATE ' . $table . ' SET ' . $fields . ' ' . $where);
317
+            return $this->query('UPDATE '.$table.' SET '.$fields.' '.$where);
318 318
         }
319 319
         return $out;
320 320
     }
@@ -340,12 +340,12 @@  discard block
 block discarded – undo
340 340
                 $this->query("INSERT INTO {$intotable} {$fields}");
341 341
             } else {
342 342
                 if (empty($fromtable)) {
343
-                    $fields = "(`" . implode("`, `", array_keys($fields)) . "`) VALUES('" . implode("', '",
344
-                            array_values($fields)) . "')";
343
+                    $fields = "(`".implode("`, `", array_keys($fields))."`) VALUES('".implode("', '",
344
+                            array_values($fields))."')";
345 345
                     $this->query("INSERT INTO {$intotable} {$fields}");
346 346
                 } else {
347 347
                     $fromtable = $this->replaceFullTableName($fromtable);
348
-                    $fields = "(" . implode(",", array_keys($fields)) . ")";
348
+                    $fields = "(".implode(",", array_keys($fields)).")";
349 349
                     $where = trim($where);
350 350
                     $limit = trim($limit);
351 351
                     if ($where !== '' && stripos($where, 'WHERE') !== 0) {
@@ -439,8 +439,8 @@  discard block
 block discarded – undo
439 439
      */
440 440
     public function getInsertId($conn = null)
441 441
     {
442
-        if (! ($conn instanceof mysqli)) {
443
-            $conn =& $this->conn;
442
+        if (!($conn instanceof mysqli)) {
443
+            $conn = & $this->conn;
444 444
         }
445 445
 
446 446
         return $conn->insert_id;
@@ -452,8 +452,8 @@  discard block
 block discarded – undo
452 452
      */
453 453
     public function getAffectedRows($conn = null)
454 454
     {
455
-        if (! ($conn instanceof mysqli)) {
456
-            $conn =& $this->conn;
455
+        if (!($conn instanceof mysqli)) {
456
+            $conn = & $this->conn;
457 457
         }
458 458
 
459 459
         return $conn->affected_rows;
@@ -465,8 +465,8 @@  discard block
 block discarded – undo
465 465
      */
466 466
     public function getLastError($conn = null)
467 467
     {
468
-        if (! ($conn instanceof mysqli)) {
469
-            $conn =& $this->conn;
468
+        if (!($conn instanceof mysqli)) {
469
+            $conn = & $this->conn;
470 470
         }
471 471
 
472 472
         return $conn->error;
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
     public function getColumn($name, $dsq)
521 521
     {
522 522
         $col = array();
523
-        if (! ($dsq instanceof mysqli_result)) {
523
+        if (!($dsq instanceof mysqli_result)) {
524 524
             $dsq = $this->query($dsq);
525 525
         }
526 526
         if ($dsq) {
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
     public function getColumnNames($dsq)
540 540
     {
541 541
         $names = array();
542
-        if (! ($dsq instanceof mysqli_result)) {
542
+        if (!($dsq instanceof mysqli_result)) {
543 543
             $dsq = $this->query($dsq);
544 544
         }
545 545
         if ($dsq) {
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
     public function getValue($dsq)
560 560
     {
561 561
         $out = false;
562
-        if (! ($dsq instanceof mysqli_result)) {
562
+        if (!($dsq instanceof mysqli_result)) {
563 563
             $dsq = $this->query($dsq);
564 564
         }
565 565
         if ($dsq) {
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
     {
579 579
         $metadata = array();
580 580
         if (!empty($table) && is_scalar($table)) {
581
-            $sql = 'SHOW FIELDS FROM ' . $table;
581
+            $sql = 'SHOW FIELDS FROM '.$table;
582 582
             if ($ds = $this->query($sql)) {
583 583
                 while ($row = $this->getRow($ds)) {
584 584
                     $fieldName = $row['Field'];
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
         $tableName = trim($tableName);
658 658
         $dbase = trim($this->config['dbase'], '`');
659 659
         $prefix = $this->config['table_prefix'];
660
-        if ((bool)$force === true) {
660
+        if ((bool) $force === true) {
661 661
             $result = "`{$dbase}`.`{$prefix}{$tableName}`";
662 662
         } elseif (strpos($tableName, '[+prefix+]') !== false) {
663 663
             $result = preg_replace('@\[\+prefix\+\]([0-9a-zA-Z_]+)@', "`{$dbase}`.`{$prefix}$1`", $tableName);
@@ -674,9 +674,9 @@  discard block
 block discarded – undo
674 674
      */
675 675
     public function optimize($table_name)
676 676
     {
677
-        $rs = $this->query('OPTIMIZE TABLE ' . $table_name);
677
+        $rs = $this->query('OPTIMIZE TABLE '.$table_name);
678 678
         if ($rs) {
679
-            $rs = $this->query('ALTER TABLE ' . $table_name);
679
+            $rs = $this->query('ALTER TABLE '.$table_name);
680 680
         }
681 681
 
682 682
         return $rs;
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
      */
689 689
     public function truncate($table_name)
690 690
     {
691
-        return $this->query('TRUNCATE ' . $table_name);
691
+        return $this->query('TRUNCATE '.$table_name);
692 692
     }
693 693
 
694 694
     /**
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
         $_ = array();
715 715
         foreach ($fields as $k => $v) {
716 716
             if ($k !== $v) {
717
-                $_[] = $v . ' as ' . $k;
717
+                $_[] = $v.' as '.$k;
718 718
             } else {
719 719
                 $_[] = $v;
720 720
             }
Please login to merge, or discard this patch.
manager/includes/extenders/modifiers/mdf_summary.inc.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -2,23 +2,23 @@  discard block
 block discarded – undo
2 2
 if (strpos($opt, ',')) {
3 3
     list($limit, $delim) = explode(',', $opt);
4 4
 } elseif (preg_match('/^[1-9][0-9]*$/', $opt)) {
5
-    $limit=$opt;
6
-    $delim='';
5
+    $limit = $opt;
6
+    $delim = '';
7 7
 } else {
8
-    $limit=124;
9
-    $delim='';
8
+    $limit = 124;
9
+    $delim = '';
10 10
 }
11 11
 
12
-if ($delim==='') {
13
-    $delim = $modx->config['manager_language']==='japanese-utf8' ? '。' : '.';
12
+if ($delim === '') {
13
+    $delim = $modx->config['manager_language'] === 'japanese-utf8' ? '。' : '.';
14 14
 }
15
-$limit = (int)$limit;
15
+$limit = (int) $limit;
16 16
 
17 17
 $content = $modx->filter->parseDocumentSource($value);
18 18
 
19 19
 $content = strip_tags($content);
20 20
 
21
-$content = str_replace(array("\r\n","\r","\n","\t",'&nbsp;'), ' ', $content);
21
+$content = str_replace(array("\r\n", "\r", "\n", "\t", '&nbsp;'), ' ', $content);
22 22
 if (preg_match('/\s+/', $content)) {
23 23
     $content = preg_replace('/\s+/', ' ', $content);
24 24
 }
@@ -26,30 +26,30 @@  discard block
 block discarded – undo
26 26
 
27 27
 $pos = $modx->filter->strpos($content, $delim);
28 28
 
29
-if ($pos!==false && $pos<$limit) {
29
+if ($pos !== false && $pos < $limit) {
30 30
     $_ = explode($delim, $content);
31 31
     $text = '';
32 32
     foreach ($_ as $v) {
33
-        if ($limit <= $modx->filter->strlen($text . $v . $delim)) {
33
+        if ($limit <= $modx->filter->strlen($text.$v.$delim)) {
34 34
             break;
35 35
         }
36
-        $text .= $v . $delim;
36
+        $text .= $v.$delim;
37 37
     }
38 38
     if ($text) {
39 39
         $content = $text;
40 40
     }
41 41
 }
42 42
 
43
-if ($limit<$modx->filter->strlen($content) && strpos($content, ' ')!==false) {
43
+if ($limit < $modx->filter->strlen($content) && strpos($content, ' ') !== false) {
44 44
     $_ = explode(' ', $content);
45 45
     $text = '';
46 46
     foreach ($_ as $v) {
47
-        if ($limit <= $modx->filter->strlen($text . $v . ' ')) {
47
+        if ($limit <= $modx->filter->strlen($text.$v.' ')) {
48 48
             break;
49 49
         }
50
-        $text .= $v . ' ';
50
+        $text .= $v.' ';
51 51
     }
52
-    if ($text!=='') {
52
+    if ($text !== '') {
53 53
         $content = $text;
54 54
     }
55 55
 }
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
 if ($limit < $modx->filter->strlen($content)) {
58 58
     $content = $modx->filter->substr($content, 0, $limit);
59 59
 }
60
-if ($modx->filter->substr($content, -1)==$delim) {
61
-    $content = rtrim($content, $delim) . $delim;
60
+if ($modx->filter->substr($content, -1) == $delim) {
61
+    $content = rtrim($content, $delim).$delim;
62 62
 }
63 63
 
64 64
 return $content;
Please login to merge, or discard this patch.
manager/includes/extenders/modifiers/mdf_getimage.inc.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 $pattern = '/<img[\s\n]+.*src=[\s\n]*"([^"]+\.(jpg|jpeg|png|gif))"[^>]+>/i';
3 3
 preg_match_all($pattern, $value, $images);
4
-if ($opt==='') {
4
+if ($opt === '') {
5 5
     if ($images[1][0]) {
6 6
         return $images[1][0];
7 7
     } else {
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
     }
10 10
 } else {
11 11
     foreach ($images[0] as $i=>$image) {
12
-        if (strpos($image, $opt)!==false) {
12
+        if (strpos($image, $opt) !== false) {
13 13
             return $images[1][$i];
14 14
         }
15 15
     }
Please login to merge, or discard this patch.
manager/includes/extenders/modifiers/mdf_addbreak.inc.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 $text = $modx->filter->parseDocumentSource($value);
3
-$text = str_replace(array("\r\n","\r"), "\n", $text);
3
+$text = str_replace(array("\r\n", "\r"), "\n", $text);
4 4
 
5 5
 $blockElms  = 'br,table,tbody,tr,td,th,thead,tfoot,caption,colgroup,div';
6 6
 $blockElms .= ',dl,dd,dt,ul,ol,li,pre,select,option,form,map,area,blockquote';
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
 $c = count($lines);
12 12
 foreach ($lines as $i=>$line) {
13 13
     $line = rtrim($line);
14
-    if ($i===$c-1) {
14
+    if ($i === $c - 1) {
15 15
         break;
16 16
     }
17 17
     foreach ($blockElms as $block) {
18
-        if (preg_match("@</?{$block}" . '[^>]*>$@', $line)) {
18
+        if (preg_match("@</?{$block}".'[^>]*>$@', $line)) {
19 19
             continue 2;
20 20
         }
21 21
     }
Please login to merge, or discard this patch.
manager/includes/extenders/modifiers/mdf_memberof.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 $userID = abs($modx->getLoginUserID('web'));
3
-$modx->qs_hash = md5($modx->qs_hash . "^{$userID}^");
3
+$modx->qs_hash = md5($modx->qs_hash."^{$userID}^");
4 4
 
5 5
 $groupNames = ($this->strlen($opt) > 0) ? explode(',', $opt) : array();
6 6
 
Please login to merge, or discard this patch.
manager/includes/extenders/modifiers/mdf_wordwrap.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1 1
 <?php
2
-return preg_replace_callback("~(\b\w+\b)~", function ($m) use ($wrapat) {
2
+return preg_replace_callback("~(\b\w+\b)~", function($m) use ($wrapat) {
3 3
     return wordwrap($m[1], $wrapat, ' ', 1);
4 4
 }, $value);
Please login to merge, or discard this patch.
manager/includes/extenders/modifiers/mdf_moduser.inc.php 1 patch
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) {
5 5
         $user = $modx->getWebUserInfo(abs($userid));
Please login to merge, or discard this patch.
manager/includes/extenders/ex_dbapi.inc.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,12 +13,12 @@
 block discarded – undo
13 13
 
14 14
 $out = false;
15 15
 $class = 'DBAPI';
16
-if (! class_exists($class)) {
17
-    include_once MODX_MANAGER_PATH . 'includes/extenders/dbapi.' . $database_type . '.class.inc.php';
16
+if (!class_exists($class)) {
17
+    include_once MODX_MANAGER_PATH.'includes/extenders/dbapi.'.$database_type.'.class.inc.php';
18 18
 }
19 19
 
20 20
 if (class_exists($class)) {
21
-    $this->db= new $class;
21
+    $this->db = new $class;
22 22
     $out = true;
23 23
 }
24 24
 
Please login to merge, or discard this patch.
manager/includes/extenders/message.quit.inc.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * Message Quit Template
4 4
  *
5 5
  */
6
-if ((! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) && IN_PARSER_MODE!="true") {
6
+if ((!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) && IN_PARSER_MODE != "true") {
7 7
     die("<b>INCLUDE ACCESS ERROR</b><br /><br />Direct access to this file prohibited.");
8 8
 }
9 9
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='javascript:copyToClip();' style='color:#821517;font-size: 9px; text-decoration: none'>[Copy SQL to ClipBoard]</a><textarea id='holdtext' style='display:none;'></textarea></td></tr>";
38 38
 }
39 39
 
40
-if ($text!='') {
40
+if ($text != '') {
41 41
     $errortype = array(
42 42
         E_ERROR          => "Error",
43 43
         E_WARNING        => "Warning",
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     $parsedMessageString .= "</tr>";
60 60
 
61 61
     $parsedMessageString .= "<tr><td valign='top'>&nbsp;&nbsp;Error type/ Nr.: </td>";
62
-    $parsedMessageString .= "<td colspan='2'>" . $errortype[$nr] . " - $nr</b></td><td>&nbsp;</td>";
62
+    $parsedMessageString .= "<td colspan='2'>".$errortype[$nr]." - $nr</b></td><td>&nbsp;</td>";
63 63
     $parsedMessageString .= "</tr>";
64 64
 
65 65
     $parsedMessageString .= "<tr><td>&nbsp;&nbsp;File: </td>";
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     $parsedMessageString .= "<tr><td>&nbsp;&nbsp;Line: </td>";
70 70
     $parsedMessageString .= "<td colspan='2'>$line</td><td>&nbsp;</td>";
71 71
     $parsedMessageString .= "</tr>";
72
-    if ($source!='') {
72
+    if ($source != '') {
73 73
         $parsedMessageString .= "<tr><td valign='top'>&nbsp;&nbsp;Line $line source: </td>";
74 74
         $parsedMessageString .= "<td colspan='2'>$source</td><td>&nbsp;</td>";
75 75
         $parsedMessageString .= "</tr>";
Please login to merge, or discard this patch.