Completed
Push — master ( 0bf21d...0dd879 )
by Agel_Nash
02:58
created
assets/lib/MODxAPI/modResource.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
         $this->get_TV();
153 153
         $uTable = $this->makeTable("manager_users");
154 154
         $aTable = $this->makeTable("user_attributes");
155
-        $query = "SELECT `u`.`id`, `a`.`email`, `u`.`username`  FROM " . $aTable . " as `a` LEFT JOIN " . $uTable . " as `u` ON `u`.`id`=`a`.`internalKey`";
155
+        $query = "SELECT `u`.`id`, `a`.`email`, `u`.`username`  FROM ".$aTable." as `a` LEFT JOIN ".$uTable." as `u` ON `u`.`id`=`a`.`internalKey`";
156 156
         $query = $this->query($query);
157 157
         $this->managerUsers = new DLCollection($modx, empty($query) ? array() : $query);
158 158
     }
@@ -267,8 +267,8 @@  discard block
 block discarded – undo
267 267
     {
268 268
         $out = null;
269 269
         if ($this->getID() > 0) {
270
-            include_once MODX_MANAGER_PATH . "includes/tmplvars.format.inc.php";
271
-            include_once MODX_MANAGER_PATH . "includes/tmplvars.commands.inc.php";
270
+            include_once MODX_MANAGER_PATH."includes/tmplvars.format.inc.php";
271
+            include_once MODX_MANAGER_PATH."includes/tmplvars.commands.inc.php";
272 272
             $tvval = $this->get($tvname);
273 273
             $param = APIHelpers::getkey($this->tvd, $tvname, array());
274 274
             $display = APIHelpers::getkey($param, 'display', '');
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
         $value = (int)$value;
382 382
         if (!empty($value)) {
383 383
             $by = $this->findUserBy($value);
384
-            $exists = $this->managerUsers->exists(function ($key, Helpers\Collection $val) use ($by, $value) {
384
+            $exists = $this->managerUsers->exists(function($key, Helpers\Collection $val) use ($by, $value) {
385 385
                 return ($val->containsKey($by) && $val->get($by) === (string)$value);
386 386
             });
387 387
             if (!$exists) {
@@ -463,9 +463,9 @@  discard block
 block discarded – undo
463 463
             $this->close();
464 464
             $this->newDoc = false;
465 465
 
466
-            $result = $this->query("SELECT * from {$this->makeTable('site_content')} where `id`=" . (int)$id);
466
+            $result = $this->query("SELECT * from {$this->makeTable('site_content')} where `id`=".(int)$id);
467 467
             $this->fromArray($this->modx->db->getRow($result));
468
-            $result = $this->query("SELECT * from {$this->makeTable('site_tmplvar_contentvalues')} where `contentid`=" . (int)$id);
468
+            $result = $this->query("SELECT * from {$this->makeTable('site_tmplvar_contentvalues')} where `contentid`=".(int)$id);
469 469
             while ($row = $this->modx->db->getRow($result)) {
470 470
                 $this->field[$this->tvid[$row['tmplvarid']]] = $row['value'];
471 471
             }
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
     {
491 491
         $parent = null;
492 492
         if ($this->field['pagetitle'] == '') {
493
-            $this->log['emptyPagetitle'] = 'Pagetitle is empty in <pre>' . print_r($this->field, true) . '</pre>';
493
+            $this->log['emptyPagetitle'] = 'Pagetitle is empty in <pre>'.print_r($this->field, true).'</pre>';
494 494
 
495 495
             return false;
496 496
         }
@@ -550,10 +550,10 @@  discard block
 block discarded – undo
550 550
 
551 551
         if (!empty($this->set)) {
552 552
             if ($this->newDoc) {
553
-                $SQL = "INSERT into {$this->makeTable('site_content')} SET " . implode(', ', $this->set);
553
+                $SQL = "INSERT into {$this->makeTable('site_content')} SET ".implode(', ', $this->set);
554 554
             } else {
555
-                $SQL = "UPDATE {$this->makeTable('site_content')} SET " . implode(', ',
556
-                        $this->set) . " WHERE `id` = " . $this->id;
555
+                $SQL = "UPDATE {$this->makeTable('site_content')} SET ".implode(', ',
556
+                        $this->set)." WHERE `id` = ".$this->id;
557 557
             }
558 558
             $this->query($SQL);
559 559
 
@@ -613,8 +613,8 @@  discard block
 block discarded – undo
613 613
             $id = $this->sanitarIn($_ids);
614 614
             $this->query("UPDATE {$this->makeTable('site_content')} SET `deleted`='1' WHERE `id` IN ({$id})");
615 615
         } else {
616
-            throw new Exception('Invalid IDs list for mark trash: <pre>' . print_r($ids,
617
-                    1) . '</pre> please, check ignore list: <pre>' . print_r($ignore, 1) . '</pre>');
616
+            throw new Exception('Invalid IDs list for mark trash: <pre>'.print_r($ids,
617
+                    1).'</pre> please, check ignore list: <pre>'.print_r($ignore, 1).'</pre>');
618 618
         }
619 619
 
620 620
         return $this;
@@ -696,8 +696,8 @@  discard block
 block discarded – undo
696 696
                 ), $fire_events);
697 697
             }
698 698
         } else {
699
-            throw new Exception('Invalid IDs list for delete: <pre>' . print_r($ids,
700
-                    1) . '</pre> please, check ignore list: <pre>' . print_r($ignore, 1) . '</pre>');
699
+            throw new Exception('Invalid IDs list for delete: <pre>'.print_r($ids,
700
+                    1).'</pre> please, check ignore list: <pre>'.print_r($ignore, 1).'</pre>');
701 701
         }
702 702
 
703 703
         return $this;
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
                 $suffix = substr($alias, -2);
744 744
                 if (preg_match('/-(\d+)/', $suffix, $tmp) && isset($tmp[1]) && (int)$tmp[1] > 1) {
745 745
                     $suffix = (int)$tmp[1] + 1;
746
-                    $alias = substr($alias, 0, -2) . '-' . $suffix;
746
+                    $alias = substr($alias, 0, -2).'-'.$suffix;
747 747
                 } else {
748 748
                     $alias .= '-2';
749 749
                 }
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
     protected function get_TV($reload = false)
771 771
     {
772 772
         if (empty($this->modx->_TVnames) || $reload) {
773
-            $result = $this->query('SELECT `id`,`name` FROM ' . $this->makeTable('site_tmplvars'));
773
+            $result = $this->query('SELECT `id`,`name` FROM '.$this->makeTable('site_tmplvars'));
774 774
             while ($row = $this->modx->db->GetRow($result)) {
775 775
                 $this->modx->_TVnames[$row['name']] = $row['id'];
776 776
             }
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
      */
790 790
     protected function loadTVTemplate()
791 791
     {
792
-        $q = $this->query("SELECT `tmplvarid`, `templateid` FROM " . $this->makeTable('site_tmplvar_templates'));
792
+        $q = $this->query("SELECT `tmplvarid`, `templateid` FROM ".$this->makeTable('site_tmplvar_templates'));
793 793
         $q = $this->modx->db->makeArray($q);
794 794
         $this->tvTpl = array();
795 795
         foreach ($q as $item) {
@@ -829,14 +829,14 @@  discard block
 block discarded – undo
829 829
     {
830 830
         if (!is_numeric($tpl) || $tpl != (int)$tpl) {
831 831
             if (is_scalar($tpl)) {
832
-                $sql = "SELECT `id` FROM {$this->makeTable('site_templates')} WHERE `templatename` = '" . $this->escape($tpl) . "'";
832
+                $sql = "SELECT `id` FROM {$this->makeTable('site_templates')} WHERE `templatename` = '".$this->escape($tpl)."'";
833 833
                 $rs = $this->query($sql);
834 834
                 if (!$rs || $this->modx->db->getRecordCount($rs) <= 0) {
835 835
                     throw new Exception("Template {$tpl} is not exists");
836 836
                 }
837 837
                 $tpl = $this->modx->db->getValue($rs);
838 838
             } else {
839
-                throw new Exception("Invalid template name: " . print_r($tpl, 1));
839
+                throw new Exception("Invalid template name: ".print_r($tpl, 1));
840 840
             }
841 841
         }
842 842
 
Please login to merge, or discard this patch.