Completed
Branch master (c92e39)
by Michael
02:32
created
class/smartdbupdater.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     //Verifies that a MySQL table exists
17 17
     $xoopsDB  = XoopsDatabaseFactory::getDatabaseConnection();
18 18
     $realname = $xoopsDB->prefix($table);
19
-    $sql      = 'SHOW TABLES FROM ' . XOOPS_DB_NAME;
19
+    $sql      = 'SHOW TABLES FROM '.XOOPS_DB_NAME;
20 20
     $ret      = $xoopsDB->queryF($sql);
21 21
     while (list($m_table) = $xoopsDB->fetchRow($ret)) {
22 22
         if ($m_table == $realname) {
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
  * Include the language constants for the SmartObjectDBUpdater
54 54
  */
55 55
 global $xoopsConfig;
56
-$common_file = XOOPS_ROOT_PATH . '/modules/smartfaq/language/' . $xoopsConfig['language'] . '/smartdbupdater.php';
56
+$common_file = XOOPS_ROOT_PATH.'/modules/smartfaq/language/'.$xoopsConfig['language'].'/smartdbupdater.php';
57 57
 if (!file_exists($common_file)) {
58
-    $common_file = XOOPS_ROOT_PATH . '/modules/smartfaq/language/english/smartdbupdater.php';
58
+    $common_file = XOOPS_ROOT_PATH.'/modules/smartfaq/language/english/smartdbupdater.php';
59 59
 }
60 60
 
61 61
 include $common_file;
@@ -152,14 +152,14 @@  discard block
 block discarded – undo
152 152
     public function getExistingFieldsArray()
153 153
     {
154 154
         global $xoopsDB;
155
-        $result = $xoopsDB->query('SHOW COLUMNS FROM ' . $this->name());
155
+        $result = $xoopsDB->query('SHOW COLUMNS FROM '.$this->name());
156 156
         while ($existing_field = $xoopsDB->fetchArray($result)) {
157 157
             $fields[$existing_field['Field']] = $existing_field['Type'];
158 158
             if ($existing_field['Null'] !== 'YES') {
159 159
                 $fields[$existing_field['Field']] .= ' NOT NULL';
160 160
             }
161 161
             if ($existing_field['Extra']) {
162
-                $fields[$existing_field['Field']] .= ' ' . $existing_field['Extra'];
162
+                $fields[$existing_field['Field']] .= ' '.$existing_field['Extra'];
163 163
             }
164 164
         }
165 165
 
@@ -235,9 +235,9 @@  discard block
 block discarded – undo
235 235
             $query = sprintf('INSERT INTO %s VALUES (%s)', $this->name(), $data);
236 236
             $ret   = $xoopsDB->query($query);
237 237
             if (!$ret) {
238
-                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_ADD_DATA_ERR, $this->name()) . '<br>';
238
+                echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_ADD_DATA_ERR, $this->name()).'<br>';
239 239
             } else {
240
-                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_ADD_DATA, $this->name()) . '<br>';
240
+                echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_ADD_DATA, $this->name()).'<br>';
241 241
             }
242 242
         }
243 243
 
@@ -402,9 +402,9 @@  discard block
 block discarded – undo
402 402
 
403 403
         $ret = $xoopsDB->query($query);
404 404
         if (!$ret) {
405
-            echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_CREATE_TABLE_ERR, $this->name()) . '<br>';
405
+            echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_CREATE_TABLE_ERR, $this->name()).'<br>';
406 406
         } else {
407
-            echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_CREATE_TABLE, $this->name()) . '<br>';
407
+            echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_CREATE_TABLE, $this->name()).'<br>';
408 408
         }
409 409
 
410 410
         return $ret;
@@ -423,11 +423,11 @@  discard block
 block discarded – undo
423 423
         $query = sprintf('DROP TABLE %s', $this->name());
424 424
         $ret   = $xoopsDB->query($query);
425 425
         if (!$ret) {
426
-            echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_DROP_TABLE_ERR, $this->name()) . '<br>';
426
+            echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_DROP_TABLE_ERR, $this->name()).'<br>';
427 427
 
428 428
             return false;
429 429
         } else {
430
-            echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_DROP_TABLE, $this->name()) . '<br>';
430
+            echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_DROP_TABLE, $this->name()).'<br>';
431 431
 
432 432
             return true;
433 433
         }
@@ -451,9 +451,9 @@  discard block
 block discarded – undo
451 451
             $ret = $ret && $xoopsDB->query($query);
452 452
             if ($alteredField['showerror']) {
453 453
                 if (!$ret) {
454
-                    echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_CHGFIELD_ERR, $alteredField['name'], $this->name()) . '<br>';
454
+                    echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_CHGFIELD_ERR, $alteredField['name'], $this->name()).'<br>';
455 455
                 } else {
456
-                    echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_CHGFIELD, $alteredField['name'], $this->name()) . '<br>';
456
+                    echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_CHGFIELD, $alteredField['name'], $this->name()).'<br>';
457 457
                 }
458 458
             }
459 459
         }
@@ -477,9 +477,9 @@  discard block
 block discarded – undo
477 477
             //echo $query;
478 478
             $ret = $ret && $xoopsDB->query($query);
479 479
             if (!$ret) {
480
-                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_NEWFIELD_ERR, $newField['name'], $this->name()) . '<br>';
480
+                echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_NEWFIELD_ERR, $newField['name'], $this->name()).'<br>';
481 481
             } else {
482
-                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_NEWFIELD, $newField['name'], $this->name()) . '<br>';
482
+                echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_NEWFIELD, $newField['name'], $this->name()).'<br>';
483 483
             }
484 484
         }
485 485
 
@@ -502,9 +502,9 @@  discard block
 block discarded – undo
502 502
             $query = sprintf('UPDATE %s SET %s = %s', $this->name(), $updatedField['name'], $updatedField['value']);
503 503
             $ret   = $ret && $xoopsDB->query($query);
504 504
             if (!$ret) {
505
-                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_UPDATE_TABLE_ERR, $this->name()) . '<br>';
505
+                echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_UPDATE_TABLE_ERR, $this->name()).'<br>';
506 506
             } else {
507
-                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()) . '<br>';
507
+                echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()).'<br>';
508 508
             }
509 509
         }
510 510
 
@@ -527,9 +527,9 @@  discard block
 block discarded – undo
527 527
             //echo $query."<br>";
528 528
             $ret = $ret && $xoopsDB->query($query);
529 529
             if (!$ret) {
530
-                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_UPDATE_TABLE_ERR, $this->name()) . '<br>';
530
+                echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_UPDATE_TABLE_ERR, $this->name()).'<br>';
531 531
             } else {
532
-                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()) . '<br>';
532
+                echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()).'<br>';
533 533
             }
534 534
         }
535 535
 
@@ -553,9 +553,9 @@  discard block
 block discarded – undo
553 553
 
554 554
             $ret = $ret && $xoopsDB->query($query);
555 555
             if (!$ret) {
556
-                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_DROPFIELD_ERR, $droppedField, $this->name()) . '<br>';
556
+                echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_DROPFIELD_ERR, $droppedField, $this->name()).'<br>';
557 557
             } else {
558
-                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_DROPFIELD, $droppedField, $this->name()) . '<br>';
558
+                echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_DROPFIELD, $droppedField, $this->name()).'<br>';
559 559
             }
560 560
         }
561 561
 
@@ -624,11 +624,11 @@  discard block
 block discarded – undo
624 624
         $query = sprintf('ALTER TABLE %s RENAME %s', $from, $to);
625 625
         $ret   = $xoopsDB->query($query);
626 626
         if (!$ret) {
627
-            echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_RENAME_TABLE_ERR, $from) . '<br>';
627
+            echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_RENAME_TABLE_ERR, $from).'<br>';
628 628
 
629 629
             return false;
630 630
         } else {
631
-            echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_RENAME_TABLE, $from, $to) . '<br>';
631
+            echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_RENAME_TABLE, $from, $to).'<br>';
632 632
 
633 633
             return true;
634 634
         }
Please login to merge, or discard this patch.
class/answer.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
         if (!$attach_key) {
92 92
             return false;
93 93
         }
94
-        $this->attachment_array[(string)$attach_key]['num_download']++;
94
+        $this->attachment_array[(string) $attach_key]['num_download']++;
95 95
 
96
-        return $this->attachment_array[(string)$attach_key]['num_download'];
96
+        return $this->attachment_array[(string) $attach_key]['num_download'];
97 97
     }
98 98
 
99 99
     /**
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
             $attachment_save = base64_encode(serialize($this->attachment_array));
107 107
         }
108 108
         $this->setVar('attachment', $attachment_save);
109
-        $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('smartfaq_answers') . ' SET attachment=' . $GLOBALS['xoopsDB']->quoteString($attachment_save) . ' WHERE post_id = ' . $this->getVar('answerid');
109
+        $sql = 'UPDATE '.$GLOBALS['xoopsDB']->prefix('smartfaq_answers').' SET attachment='.$GLOBALS['xoopsDB']->quoteString($attachment_save).' WHERE post_id = '.$this->getVar('answerid');
110 110
         if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) {
111 111
             //xoops_error($GLOBALS["xoopsDB"]->error());
112 112
             return false;
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
 
139 139
         foreach ($attach_old as $key => $attach) {
140 140
             if (in_array($key, $attach_array)) {
141
-                @unlink(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attach['name_saved']);
142
-                @unlink(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/thumbs/' . $attach['name_saved']); // delete thumbnails
141
+                @unlink(XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/'.$attach['name_saved']);
142
+                @unlink(XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/thumbs/'.$attach['name_saved']); // delete thumbnails
143 143
                 continue;
144 144
             }
145 145
             $this->attachment_array[$key] = $attach;
@@ -165,12 +165,12 @@  discard block
 block discarded – undo
165 165
         static $counter = 0;
166 166
         $this->attachment_array = $this->getAttachment();
167 167
         if ($name_saved) {
168
-            $key                          = (string)(time() + ($counter++));
168
+            $key                          = (string) (time()+($counter++));
169 169
             $this->attachment_array[$key] = array(
170 170
                 'name_saved'   => $name_saved,
171 171
                 'name_display' => isset($name_display) ? $name_display : $name_saved,
172 172
                 'mimetype'     => $mimetype,
173
-                'num_download' => isset($num_download) ? (int)$num_download : 0
173
+                'num_download' => isset($num_download) ? (int) $num_download : 0
174 174
             );
175 175
         }
176 176
         $attachment_save = null;
@@ -196,24 +196,24 @@  discard block
 block discarded – undo
196 196
         if (is_array($attachments) && count($attachments) > 0) {
197 197
             $iconHandler = sf_getIconHandler();
198 198
             $mime_path   = $iconHandler->getPath('mime');
199
-            include_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/include/functions.image.php';
199
+            include_once XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname', 'n').'/include/functions.image.php';
200 200
             $image_extensions = array('jpg', 'jpeg', 'gif', 'png', 'bmp'); // need improve !!!
201
-            $post_attachment  .= '<br><strong>' . _MD_ATTACHMENT . '</strong>:';
201
+            $post_attachment  .= '<br><strong>'._MD_ATTACHMENT.'</strong>:';
202 202
             $post_attachment  .= '<br><hr size="1" noshade="noshade" /><br>';
203 203
             foreach ($attachments as $key => $att) {
204 204
                 $file_extension = ltrim(strrchr($att['name_saved'], '.'), '.');
205 205
                 $filetype       = $file_extension;
206
-                if (file_exists(XOOPS_ROOT_PATH . '/' . $mime_path . '/' . $filetype . '.gif')) {
207
-                    $icon_filetype = XOOPS_URL . '/' . $mime_path . '/' . $filetype . '.gif';
206
+                if (file_exists(XOOPS_ROOT_PATH.'/'.$mime_path.'/'.$filetype.'.gif')) {
207
+                    $icon_filetype = XOOPS_URL.'/'.$mime_path.'/'.$filetype.'.gif';
208 208
                 } else {
209
-                    $icon_filetype = XOOPS_URL . '/' . $mime_path . '/unknown.gif';
209
+                    $icon_filetype = XOOPS_URL.'/'.$mime_path.'/unknown.gif';
210 210
                 }
211
-                $file_size = @filesize(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $att['name_saved']);
212
-                $file_size = number_format($file_size / 1024, 2) . ' KB';
211
+                $file_size = @filesize(XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/'.$att['name_saved']);
212
+                $file_size = number_format($file_size / 1024, 2).' KB';
213 213
                 if ($xoopsModuleConfig['media_allowed'] && in_array(strtolower($file_extension), $image_extensions)) {
214
-                    $post_attachment .= '<br><img src="' . $icon_filetype . '" alt="' . $filetype . '" /><strong>&nbsp; ' . $att['name_display'] . '</strong> <small>(' . $file_size . ')</small>';
215
-                    $post_attachment .= '<br>' . sf_attachmentImage($att['name_saved']);
216
-                    $isDisplayed     = true;
214
+                    $post_attachment .= '<br><img src="'.$icon_filetype.'" alt="'.$filetype.'" /><strong>&nbsp; '.$att['name_display'].'</strong> <small>('.$file_size.')</small>';
215
+                    $post_attachment .= '<br>'.sf_attachmentImage($att['name_saved']);
216
+                    $isDisplayed = true;
217 217
                 } else {
218 218
                     global $xoopsUser;
219 219
                     if (empty($xoopsModuleConfig['show_userattach'])) {
@@ -370,9 +370,9 @@  discard block
 block discarded – undo
370 370
         $tags                  = array();
371 371
         $tags['MODULE_NAME']   = $myts->displayTarea($smartModule->getVar('name'));
372 372
         $tags['FAQ_NAME']      = $faqObj->question();
373
-        $tags['FAQ_URL']       = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/faq.php?faqid=' . $faqObj->faqid();
373
+        $tags['FAQ_URL']       = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/faq.php?faqid='.$faqObj->faqid();
374 374
         $tags['CATEGORY_NAME'] = $faqObj->getCategoryName();
375
-        $tags['CATEGORY_URL']  = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/category.php?categoryid=' . $faqObj->categoryid();
375
+        $tags['CATEGORY_URL']  = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/category.php?categoryid='.$faqObj->categoryid();
376 376
         $tags['FAQ_QUESTION']  = $faqObj->question();
377 377
 
378 378
         // TODO : Not sure about the 'formpreview' ...
@@ -431,8 +431,8 @@  discard block
 block discarded – undo
431 431
      */
432 432
     public function get($id = null, $fields = null)
433 433
     {
434
-        if ((int)$id > 0) {
435
-            $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_answers') . ' WHERE answerid=' . $id;
434
+        if ((int) $id > 0) {
435
+            $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_answers').' WHERE answerid='.$id;
436 436
             if (!$result = $this->db->query($sql)) {
437 437
                 return false;
438 438
             }
@@ -562,11 +562,11 @@  discard block
 block discarded – undo
562 562
     {
563 563
         $ret   = array();
564 564
         $limit = $start = 0;
565
-        $sql   = 'SELECT * FROM ' . $this->db->prefix('smartfaq_answers');
565
+        $sql   = 'SELECT * FROM '.$this->db->prefix('smartfaq_answers');
566 566
         if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
567
-            $sql .= ' ' . $criteria->renderWhere();
567
+            $sql .= ' '.$criteria->renderWhere();
568 568
             if ($criteria->getSort() != '') {
569
-                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
569
+                $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
570 570
             }
571 571
             $limit = $criteria->getLimit();
572 572
             $start = $criteria->getStart();
@@ -580,9 +580,9 @@  discard block
 block discarded – undo
580 580
             $answer = new sfAnswer();
581 581
             $answer->assignVars($myrow);
582 582
             if (!$id_as_key) {
583
-                $ret[] =& $answer;
583
+                $ret[] = & $answer;
584 584
             } else {
585
-                $ret[$myrow['answerid']] =& $answer;
585
+                $ret[$myrow['answerid']] = & $answer;
586 586
             }
587 587
             unset($answer);
588 588
         }
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
         $criteria->setOrder($order);
651 651
         $criteria->setLimit($limit);
652 652
         $criteria->setStart($start);
653
-        $ret =& $this->getObjects($criteria);
653
+        $ret = & $this->getObjects($criteria);
654 654
 
655 655
         return $ret;
656 656
     }
@@ -663,9 +663,9 @@  discard block
 block discarded – undo
663 663
      */
664 664
     public function getCount(CriteriaElement $criteria = null)
665 665
     {
666
-        $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_answers');
666
+        $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('smartfaq_answers');
667 667
         if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
668
-            $sql .= ' ' . $criteria->renderWhere();
668
+            $sql .= ' '.$criteria->renderWhere();
669 669
         }
670 670
         $result = $this->db->query($sql);
671 671
         if (!$result) {
@@ -684,10 +684,10 @@  discard block
 block discarded – undo
684 684
      */
685 685
     public function getCountByFAQ($criteria = null)
686 686
     {
687
-        $sql = 'SELECT faqid, COUNT(*) FROM ' . $this->db->prefix('smartfaq_answers');
687
+        $sql = 'SELECT faqid, COUNT(*) FROM '.$this->db->prefix('smartfaq_answers');
688 688
         if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
689
-            $sql .= ' ' . $criteria->renderWhere();
690
-            $sql .= ' ' . $criteria->getGroupby();
689
+            $sql .= ' '.$criteria->renderWhere();
690
+            $sql .= ' '.$criteria->getGroupby();
691 691
         }
692 692
 
693 693
         //echo "<br>$sql<br>";
@@ -714,9 +714,9 @@  discard block
 block discarded – undo
714 714
      */
715 715
     public function deleteAll(CriteriaElement $criteria = null, $force = true, $asObject = false)
716 716
     {
717
-        $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_answers');
717
+        $sql = 'DELETE FROM '.$this->db->prefix('smartfaq_answers');
718 718
         if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
719
-            $sql .= ' ' . $criteria->renderWhere();
719
+            $sql .= ' '.$criteria->renderWhere();
720 720
         }
721 721
         if (!$this->db->query($sql)) {
722 722
             return false;
@@ -736,10 +736,10 @@  discard block
 block discarded – undo
736 736
      */
737 737
     public function updateAll($fieldname, $fieldvalue, CriteriaElement $criteria = null, $force = false)
738 738
     {
739
-        $set_clause = is_numeric($fieldvalue) ? $fieldname . ' = ' . $fieldvalue : $fieldname . ' = ' . $this->db->quoteString($fieldvalue);
740
-        $sql        = 'UPDATE ' . $this->db->prefix('smartfaq_answers') . ' SET ' . $set_clause;
739
+        $set_clause = is_numeric($fieldvalue) ? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue);
740
+        $sql        = 'UPDATE '.$this->db->prefix('smartfaq_answers').' SET '.$set_clause;
741 741
         if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
742
-            $sql .= ' ' . $criteria->renderWhere();
742
+            $sql .= ' '.$criteria->renderWhere();
743 743
         }
744 744
         //echo "<br>" . $sql . "<br>";
745 745
         if (!$this->db->queryF($sql)) {
@@ -756,8 +756,8 @@  discard block
 block discarded – undo
756 756
     public function getLastPublishedByFaq($faqids)
757 757
     {
758 758
         $ret    = array();
759
-        $sql    = 'SELECT faqid, answer, uid, datesub FROM ' . $this->db->prefix('smartfaq_answers') . '
760
-               WHERE faqid IN (' . implode(',', $faqids) . ') AND status = ' . _SF_AN_STATUS_APPROVED . ' GROUP BY faqid';
759
+        $sql    = 'SELECT faqid, answer, uid, datesub FROM '.$this->db->prefix('smartfaq_answers').'
760
+               WHERE faqid IN (' . implode(',', $faqids).') AND status = '._SF_AN_STATUS_APPROVED.' GROUP BY faqid';
761 761
         $result = $this->db->query($sql);
762 762
         if (!$result) {
763 763
             return $ret;
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
         while ($row = $this->db->fetchArray($result)) {
766 766
             $answer = new sfAnswer();
767 767
             $answer->assignVars($row);
768
-            $ret[$row['faqid']] =& $answer;
768
+            $ret[$row['faqid']] = & $answer;
769 769
             unset($answer);
770 770
         }
771 771
 
Please login to merge, or discard this patch.
class/faq.php 1 patch
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined');
10 10
 
11
-require_once XOOPS_ROOT_PATH . '/modules/smartfaq/class/category.php';
11
+require_once XOOPS_ROOT_PATH.'/modules/smartfaq/class/category.php';
12 12
 
13 13
 // FAQ status
14 14
 define('_SF_STATUS_NOTSET', -1);
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
      */
129 129
     public function checkPermission()
130 130
     {
131
-        include_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php';
131
+        include_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php';
132 132
 
133 133
         $userIsAdmin = sf_userIsAdmin();
134 134
         if ($userIsAdmin) {
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         if ($maxLength != 0) {
205 205
             if (!XOOPS_USE_MULTIBYTES) {
206 206
                 if (strlen($ret) >= $maxLength) {
207
-                    $ret = substr($ret, 0, $maxLength - 1) . '...';
207
+                    $ret = substr($ret, 0, $maxLength-1).'...';
208 208
                 }
209 209
             }
210 210
         }
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
         $tags['MODULE_NAME']   = $myts->displayTarea($smartModule->getVar('name'));
490 490
         $tags['FAQ_NAME']      = $this->question();
491 491
         $tags['CATEGORY_NAME'] = $this->getCategoryName();
492
-        $tags['CATEGORY_URL']  = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/category.php?categoryid=' . $this->categoryid();
492
+        $tags['CATEGORY_URL']  = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/category.php?categoryid='.$this->categoryid();
493 493
         $tags['FAQ_QUESTION']  = $this->question();
494 494
         $answerObj             = $this->answer();
495 495
         if (is_object($answerObj)) {
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
         foreach ($notifications as $notification) {
502 502
             switch ($notification) {
503 503
                 case _SF_NOT_FAQ_PUBLISHED:
504
-                    $tags['FAQ_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/faq.php?faqid=' . $this->faqid();
504
+                    $tags['FAQ_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/faq.php?faqid='.$this->faqid();
505 505
 
506 506
                     $notificationHandler->triggerEvent('global_faq', 0, 'published', $tags);
507 507
                     $notificationHandler->triggerEvent('category_faq', $this->categoryid(), 'published', $tags);
@@ -509,20 +509,20 @@  discard block
 block discarded – undo
509 509
                     break;
510 510
 
511 511
                 case _SF_NOT_FAQ_SUBMITTED:
512
-                    $tags['WAITINGFILES_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/admin/faq.php?faqid=' . $this->faqid();
512
+                    $tags['WAITINGFILES_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/admin/faq.php?faqid='.$this->faqid();
513 513
                     $notificationHandler->triggerEvent('global_faq', 0, 'submitted', $tags);
514 514
                     $notificationHandler->triggerEvent('category_faq', $this->categoryid(), 'submitted', $tags);
515 515
                     break;
516 516
 
517 517
                 case _SF_NOT_QUESTION_PUBLISHED:
518
-                    $tags['FAQ_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/answer.php?faqid=' . $this->faqid();
518
+                    $tags['FAQ_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/answer.php?faqid='.$this->faqid();
519 519
                     $notificationHandler->triggerEvent('global_question', 0, 'published', $tags);
520 520
                     $notificationHandler->triggerEvent('category_question', $this->categoryid(), 'published', $tags);
521 521
                     $notificationHandler->triggerEvent('question', $this->faqid(), 'approved', $tags);
522 522
                     break;
523 523
 
524 524
                 case _SF_NOT_QUESTION_SUBMITTED:
525
-                    $tags['WAITINGFILES_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/admin/question.php?op=mod&faqid=' . $this->faqid();
525
+                    $tags['WAITINGFILES_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/admin/question.php?op=mod&faqid='.$this->faqid();
526 526
                     $notificationHandler->triggerEvent('global_question', 0, 'submitted', $tags);
527 527
                     $notificationHandler->triggerEvent('category_question', $this->categoryid(), 'submitted', $tags);
528 528
                     break;
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
                     break;
533 533
 
534 534
                 case _SF_NOT_NEW_ANSWER_PROPOSED:
535
-                    $tags['WAITINGFILES_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/admin/answer.php?op=mod&faqid=' . $this->faqid();
535
+                    $tags['WAITINGFILES_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/admin/answer.php?op=mod&faqid='.$this->faqid();
536 536
                     $notificationHandler->triggerEvent('global_faq', 0, 'answer_proposed', $tags);
537 537
                     $notificationHandler->triggerEvent('category_faq', $this->categoryid(), 'answer_proposed', $tags);
538 538
                     break;
@@ -668,16 +668,16 @@  discard block
 block discarded – undo
668 668
     public function toArray($faq = array(), $category = null, $linkInQuestion = true)
669 669
     {
670 670
         global $xoopsModuleConfig;
671
-        $lastfaqsize = (int)$xoopsModuleConfig['lastfaqsize'];
671
+        $lastfaqsize = (int) $xoopsModuleConfig['lastfaqsize'];
672 672
 
673 673
         $faq['id']         = $this->faqid();
674 674
         $faq['categoryid'] = $this->categoryid();
675 675
         $faq['question']   = $this->question();
676 676
         $page              = ($this->status() == _SF_STATUS_OPENED) ? 'answer.php' : 'faq.php';
677 677
 
678
-        $faq['questionlink'] = "<a href='$page?faqid=" . $this->faqid() . "'>" . $this->question($lastfaqsize) . '</a>';
678
+        $faq['questionlink'] = "<a href='$page?faqid=".$this->faqid()."'>".$this->question($lastfaqsize).'</a>';
679 679
         if ($linkInQuestion) {
680
-            $faq['fullquestionlink'] = "<a href='$page?faqid=" . $this->faqid() . "'>" . $this->question() . '</a>';
680
+            $faq['fullquestionlink'] = "<a href='$page?faqid=".$this->faqid()."'>".$this->question().'</a>';
681 681
         } else {
682 682
             $faq['fullquestionlink'] = $this->question();
683 683
         }
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
                 $categoryObj = $category[$this->categoryid()];
694 694
             }
695 695
             $faq['categoryname'] = $categoryObj->getVar('name');
696
-            $faq['categorylink'] = "<a href='" . XOOPS_URL . '/modules/smartfaq/category.php?categoryid=' . $this->categoryid() . "'>" . $categoryObj->getVar('name') . '</a>';
696
+            $faq['categorylink'] = "<a href='".XOOPS_URL.'/modules/smartfaq/category.php?categoryid='.$this->categoryid()."'>".$categoryObj->getVar('name').'</a>';
697 697
         }
698 698
 
699 699
         return $faq;
@@ -733,8 +733,8 @@  discard block
 block discarded – undo
733 733
      */
734 734
     public function & get($id)
735 735
     {
736
-        if ((int)$id > 0) {
737
-            $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_faq') . ' WHERE faqid=' . $id;
736
+        if ((int) $id > 0) {
737
+            $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_faq').' WHERE faqid='.$id;
738 738
             if (!$result = $this->db->query($sql)) {
739 739
                 return false;
740 740
             }
@@ -857,26 +857,26 @@  discard block
 block discarded – undo
857 857
     {
858 858
         $ret   = array();
859 859
         $limit = $start = 0;
860
-        $sql   = 'SELECT * FROM ' . $this->db->prefix('smartfaq_faq');
860
+        $sql   = 'SELECT * FROM '.$this->db->prefix('smartfaq_faq');
861 861
 
862 862
         if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
863 863
             $whereClause = $criteria->renderWhere();
864 864
 
865 865
             if ($whereClause !== 'WHERE ()') {
866
-                $sql .= ' ' . $criteria->renderWhere();
866
+                $sql .= ' '.$criteria->renderWhere();
867 867
                 if (!empty($notNullFields)) {
868 868
                     $sql .= $this->NotNullFieldClause($notNullFields, true);
869 869
                 }
870 870
             } elseif (!empty($notNullFields)) {
871
-                $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
871
+                $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
872 872
             }
873 873
             if ($criteria->getSort() != '') {
874
-                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
874
+                $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
875 875
             }
876 876
             $limit = $criteria->getLimit();
877 877
             $start = $criteria->getStart();
878 878
         } elseif (!empty($notNullFields)) {
879
-            $sql .= $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
879
+            $sql .= $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
880 880
         }
881 881
 
882 882
         //echo "<br>" . $sql . "<br>";
@@ -936,26 +936,26 @@  discard block
 block discarded – undo
936 936
                             faq.modulelink AS modulelink,
937 937
                             faq.contextpage AS contextpage,
938 938
                             faq.exacturl AS exacturl
939
-                FROM ' . $this->db->prefix('smartfaq_faq') . ' AS faq INNER JOIN ' . $this->db->prefix('smartfaq_categories') . ' AS category ON faq.categoryid = category.categoryid ';
939
+                FROM ' . $this->db->prefix('smartfaq_faq').' AS faq INNER JOIN '.$this->db->prefix('smartfaq_categories').' AS category ON faq.categoryid = category.categoryid ';
940 940
 
941 941
         if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
942 942
             $whereClause = $criteria->renderWhere();
943 943
 
944 944
             if ($whereClause !== 'WHERE ()') {
945
-                $sql .= ' ' . $criteria->renderWhere();
945
+                $sql .= ' '.$criteria->renderWhere();
946 946
                 if (!empty($notNullFields)) {
947 947
                     $sql .= $this->NotNullFieldClause($notNullFields, true);
948 948
                 }
949 949
             } elseif (!empty($notNullFields)) {
950
-                $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
950
+                $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
951 951
             }
952 952
             if ($criteria->getSort() != '') {
953
-                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
953
+                $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
954 954
             }
955 955
             $limit = $criteria->getLimit();
956 956
             $start = $criteria->getStart();
957 957
         } elseif (!empty($notNullFields)) {
958
-            $sql .= $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
958
+            $sql .= $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
959 959
         }
960 960
 
961 961
         //echo "<br>" . $sql . "<br>";
@@ -1005,19 +1005,19 @@  discard block
 block discarded – undo
1005 1005
      */
1006 1006
     public function getCount($criteria = null, $notNullFields = '')
1007 1007
     {
1008
-        $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_faq');
1008
+        $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('smartfaq_faq');
1009 1009
         if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
1010 1010
             $whereClause = $criteria->renderWhere();
1011 1011
             if ($whereClause !== 'WHERE ()') {
1012
-                $sql .= ' ' . $criteria->renderWhere();
1012
+                $sql .= ' '.$criteria->renderWhere();
1013 1013
                 if (!empty($notNullFields)) {
1014 1014
                     $sql .= $this->NotNullFieldClause($notNullFields, true);
1015 1015
                 }
1016 1016
             } elseif (!empty($notNullFields)) {
1017
-                $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
1017
+                $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
1018 1018
             }
1019 1019
         } elseif (!empty($notNullFields)) {
1020
-            $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
1020
+            $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
1021 1021
         }
1022 1022
 
1023 1023
         //echo "<br>" . $sql . "<br>";
@@ -1050,11 +1050,11 @@  discard block
 block discarded – undo
1050 1050
             $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq');
1051 1051
 
1052 1052
             $categoriesGranted = $smartPermHandler->getPermissions('category');
1053
-            $grantedCategories = new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN');
1053
+            $grantedCategories = new Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN');
1054 1054
 
1055 1055
             $faqsGranted = $smartPermHandler->getPermissions('item');
1056 1056
             $grantedFaq  = new CriteriaCompo();
1057
-            $grantedFaq->add(new Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR');
1057
+            $grantedFaq->add(new Criteria('faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR');
1058 1058
             // If user is anonymous, check if the FAQ allow partialview
1059 1059
             if (!is_object($xoopsUser)) {
1060 1060
                 $grantedFaq->add(new Criteria('partialview', '1'), 'OR');
@@ -1101,7 +1101,7 @@  discard block
 block discarded – undo
1101 1101
      */
1102 1102
     public function getFaqsCountByStatus()
1103 1103
     {
1104
-        $sql    = 'SELECT status, COUNT(*) FROM ' . $this->db->prefix('smartfaq_faq') . ' GROUP BY status';
1104
+        $sql    = 'SELECT status, COUNT(*) FROM '.$this->db->prefix('smartfaq_faq').' GROUP BY status';
1105 1105
         $result = $this->db->query($sql);
1106 1106
         if (!$result) {
1107 1107
             return array();
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
         $otherCriteria = null
1159 1159
     ) {
1160 1160
         global $xoopsUser;
1161
-        include_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php';
1161
+        include_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php';
1162 1162
 
1163 1163
         //if ( ($categoryid == -1) && (empty($status) || ($status == -1)) && ($limit == 0) && ($start ==0) ) {
1164 1164
         //  return $this->getObjects();
@@ -1170,11 +1170,11 @@  discard block
 block discarded – undo
1170 1170
             $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq');
1171 1171
 
1172 1172
             $categoriesGranted = $smartPermHandler->getPermissions('category');
1173
-            $grantedCategories = new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN');
1173
+            $grantedCategories = new Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN');
1174 1174
 
1175 1175
             $faqsGranted = $smartPermHandler->getPermissions('item');
1176 1176
             $grantedFaq  = new CriteriaCompo();
1177
-            $grantedFaq->add(new Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR');
1177
+            $grantedFaq->add(new Criteria('faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR');
1178 1178
             // If user is anonymous, check if the FAQ allow partialview
1179 1179
             if (!is_object($xoopsUser)) {
1180 1180
                 $grantedFaq->add(new Criteria('partialview', '1'), 'OR');
@@ -1183,9 +1183,9 @@  discard block
 block discarded – undo
1183 1183
 
1184 1184
         if (isset($categoryid) && ($categoryid != -1)) {
1185 1185
             if (is_array($categoryid)) {
1186
-                $criteriaCategory = new Criteria('categoryid', '(' . implode(',', $categoryid) . ')', 'IN');
1186
+                $criteriaCategory = new Criteria('categoryid', '('.implode(',', $categoryid).')', 'IN');
1187 1187
             } else {
1188
-                $criteriaCategory = new Criteria('categoryid', (int)$categoryid);
1188
+                $criteriaCategory = new Criteria('categoryid', (int) $categoryid);
1189 1189
             }
1190 1190
         }
1191 1191
 
@@ -1252,7 +1252,7 @@  discard block
 block discarded – undo
1252 1252
         $asobject = true,
1253 1253
         $otherCriteria = null
1254 1254
     ) {
1255
-        include_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php';
1255
+        include_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php';
1256 1256
 
1257 1257
         $smartModule = sf_getModuleInfo();
1258 1258
 
@@ -1311,7 +1311,7 @@  discard block
 block discarded – undo
1311 1311
 
1312 1312
         if ($totalFaqs > 0) {
1313 1313
             --$totalFaqs;
1314
-            mt_srand((double)microtime() * 1000000);
1314
+            mt_srand((double) microtime() * 1000000);
1315 1315
             $entrynumber = mt_rand(0, $totalFaqs);
1316 1316
             $faq         = $this->getFaqs(1, $entrynumber, $status, -1, 'datesub', 'DESC', $notNullFields);
1317 1317
             if ($faq) {
@@ -1346,10 +1346,10 @@  discard block
 block discarded – undo
1346 1346
                 $httphost    = $_SERVER['HTTP_HOST'];
1347 1347
                 $querystring = $_SERVER['QUERY_STRING'];
1348 1348
                 if ($querystring != '') {
1349
-                    $querystring = '?' . $querystring;
1349
+                    $querystring = '?'.$querystring;
1350 1350
                 }
1351
-                $currenturl     = $http . $httphost . $phpself . $querystring;
1352
-                $fullcontexturl = XOOPS_URL . '/' . $faqsObj[$i]->contextpage();
1351
+                $currenturl     = $http.$httphost.$phpself.$querystring;
1352
+                $fullcontexturl = XOOPS_URL.'/'.$faqsObj[$i]->contextpage();
1353 1353
                 switch ($faqsObj[$i]->modulelink()) {
1354 1354
                     case '':
1355 1355
                         $display = false;
@@ -1368,7 +1368,7 @@  discard block
 block discarded – undo
1368 1368
                         }
1369 1369
                         break;
1370 1370
                     default:
1371
-                        if (strpos($currenturl, XOOPS_URL . '/modules/') === false) {
1371
+                        if (strpos($currenturl, XOOPS_URL.'/modules/') === false) {
1372 1372
                             $display = false;
1373 1373
                         } else {
1374 1374
                             if (strpos($currenturl, $faqsObj[$i]->modulelink()) === false) {
@@ -1386,7 +1386,7 @@  discard block
 block discarded – undo
1386 1386
         }
1387 1387
 
1388 1388
         if (count($randomFaqs) > $limit) {
1389
-            mt_srand((float)microtime() * 10000000);
1389
+            mt_srand((float) microtime() * 10000000);
1390 1390
             $rand_keys = array_rand($randomFaqs, $limit);
1391 1391
             for ($j = 0, $jMax = count($rand_keys); $j < $jMax; ++$j) {
1392 1392
                 $ret[] = &$randomFaqs[$rand_keys[$j]];
@@ -1409,14 +1409,14 @@  discard block
 block discarded – undo
1409 1409
         if (!sf_userIsAdmin()) {
1410 1410
             $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq');
1411 1411
             $items            = $smartPermHandler->getPermissions('item');
1412
-            $faqclause        = ' AND faqid IN (' . implode(',', $items) . ')';
1412
+            $faqclause        = ' AND faqid IN ('.implode(',', $items).')';
1413 1413
         }
1414 1414
 
1415 1415
         $sql  = "CREATE TEMPORARY TABLE tmp (categoryid INT(8) UNSIGNED NOT NULL,datesub INT(11) DEFAULT '0' NOT NULL);";
1416
-        $sql2 = ' LOCK TABLES ' . $this->db->prefix('smartfaq_faq') . ' READ;';
1417
-        $sql3 = ' INSERT INTO tmp SELECT categoryid, MAX(datesub) FROM ' . $this->db->prefix('smartfaq_faq') . ' WHERE status IN (' . implode(',', $status) . ") $faqclause GROUP BY categoryid;";
1418
-        $sql4 = ' SELECT ' . $this->db->prefix('smartfaq_faq') . '.categoryid, faqid, question, uid, ' . $this->db->prefix('smartfaq_faq') . '.datesub FROM ' . $this->db->prefix('smartfaq_faq') . ', tmp
1419
-                              WHERE ' . $this->db->prefix('smartfaq_faq') . '.categoryid=tmp.categoryid AND ' . $this->db->prefix('smartfaq_faq') . '.datesub=tmp.datesub;';
1416
+        $sql2 = ' LOCK TABLES '.$this->db->prefix('smartfaq_faq').' READ;';
1417
+        $sql3 = ' INSERT INTO tmp SELECT categoryid, MAX(datesub) FROM '.$this->db->prefix('smartfaq_faq').' WHERE status IN ('.implode(',', $status).") $faqclause GROUP BY categoryid;";
1418
+        $sql4 = ' SELECT '.$this->db->prefix('smartfaq_faq').'.categoryid, faqid, question, uid, '.$this->db->prefix('smartfaq_faq').'.datesub FROM '.$this->db->prefix('smartfaq_faq').', tmp
1419
+                              WHERE ' . $this->db->prefix('smartfaq_faq').'.categoryid=tmp.categoryid AND '.$this->db->prefix('smartfaq_faq').'.datesub=tmp.datesub;';
1420 1420
         /*
1421 1421
         //Old implementation
1422 1422
         $sql = "SELECT categoryid, faqid, question, uid, MAX(datesub) AS datesub FROM ".$this->db->prefix("smartfaq_faq")."
@@ -1431,7 +1431,7 @@  discard block
 block discarded – undo
1431 1431
         $this->db->queryF('UNLOCK TABLES;');
1432 1432
         $this->db->queryF('DROP TABLE tmp;');
1433 1433
         if (!$result) {
1434
-            trigger_error('Error in getLastPublishedByCat SQL: ' . $error);
1434
+            trigger_error('Error in getLastPublishedByCat SQL: '.$error);
1435 1435
 
1436 1436
             return $ret;
1437 1437
         }
@@ -1453,9 +1453,9 @@  discard block
 block discarded – undo
1453 1453
      */
1454 1454
     public function deleteAll($criteria = null)
1455 1455
     {
1456
-        $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_faq');
1456
+        $sql = 'DELETE FROM '.$this->db->prefix('smartfaq_faq');
1457 1457
         if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
1458
-            $sql .= ' ' . $criteria->renderWhere();
1458
+            $sql .= ' '.$criteria->renderWhere();
1459 1459
         }
1460 1460
         if (!$this->db->query($sql)) {
1461 1461
             return false;
@@ -1476,10 +1476,10 @@  discard block
 block discarded – undo
1476 1476
      **/
1477 1477
     public function updateAll($fieldname, $fieldvalue, $criteria = null)
1478 1478
     {
1479
-        $set_clause = is_numeric($fieldvalue) ? $fieldname . ' = ' . $fieldvalue : $fieldname . ' = ' . $this->db->quoteString($fieldvalue);
1480
-        $sql        = 'UPDATE ' . $this->db->prefix('smartfaq_faq') . ' SET ' . $set_clause;
1479
+        $set_clause = is_numeric($fieldvalue) ? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue);
1480
+        $sql        = 'UPDATE '.$this->db->prefix('smartfaq_faq').' SET '.$set_clause;
1481 1481
         if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
1482
-            $sql .= ' ' . $criteria->renderWhere();
1482
+            $sql .= ' '.$criteria->renderWhere();
1483 1483
         }
1484 1484
         if (!$this->db->queryF($sql)) {
1485 1485
             return false;
@@ -1494,7 +1494,7 @@  discard block
 block discarded – undo
1494 1494
      */
1495 1495
     public function updateCounter($faqid)
1496 1496
     {
1497
-        $sql = 'UPDATE ' . $this->db->prefix('smartfaq_faq') . ' SET counter=counter+1 WHERE faqid = ' . $faqid;
1497
+        $sql = 'UPDATE '.$this->db->prefix('smartfaq_faq').' SET counter=counter+1 WHERE faqid = '.$faqid;
1498 1498
         if ($this->db->queryF($sql)) {
1499 1499
             return true;
1500 1500
         } else {
@@ -1550,8 +1550,8 @@  discard block
 block discarded – undo
1550 1550
             $criteriaKeywords = new CriteriaCompo();
1551 1551
             for ($i = 0, $iMax = count($queryarray); $i < $iMax; ++$i) {
1552 1552
                 $criteriaKeyword = new CriteriaCompo();
1553
-                $criteriaKeyword->add(new Criteria('faq.question', '%' . $queryarray[$i] . '%', 'LIKE'), 'OR');
1554
-                $criteriaKeyword->add(new Criteria('answer.answer', '%' . $queryarray[$i] . '%', 'LIKE'), 'OR');
1553
+                $criteriaKeyword->add(new Criteria('faq.question', '%'.$queryarray[$i].'%', 'LIKE'), 'OR');
1554
+                $criteriaKeyword->add(new Criteria('answer.answer', '%'.$queryarray[$i].'%', 'LIKE'), 'OR');
1555 1555
                 $criteriaKeywords->add($criteriaKeyword, $andor);
1556 1556
                 unset($criteriaKeyword);
1557 1557
             }
@@ -1569,9 +1569,9 @@  discard block
 block discarded – undo
1569 1569
             if (!$faqsGranted) {
1570 1570
                 return $ret;
1571 1571
             }
1572
-            $grantedCategories = new Criteria('faq.categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN');
1572
+            $grantedCategories = new Criteria('faq.categoryid', '('.implode(',', $categoriesGranted).')', 'IN');
1573 1573
             $grantedFaq        = new CriteriaCompo();
1574
-            $grantedFaq->add(new Criteria('faq.faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR');
1574
+            $grantedFaq->add(new Criteria('faq.faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR');
1575 1575
             // If user is anonymous, check if the FAQ allow partialview
1576 1576
             if (!is_object($xoopsUser)) {
1577 1577
                 $grantedFaq->add(new Criteria('partialview', '1'), 'OR');
@@ -1627,9 +1627,9 @@  discard block
 block discarded – undo
1627 1627
             $whereClause = $criteria->renderWhere();
1628 1628
 
1629 1629
             if ($whereClause !== 'WHERE ()') {
1630
-                $sql .= ' ' . $criteria->renderWhere();
1630
+                $sql .= ' '.$criteria->renderWhere();
1631 1631
                 if ($criteria->getSort() != '') {
1632
-                    $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
1632
+                    $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
1633 1633
                 }
1634 1634
                 $limit = $criteria->getLimit();
1635 1635
                 $start = $criteria->getStart();
@@ -1668,19 +1668,19 @@  discard block
 block discarded – undo
1668 1668
     {
1669 1669
         global $xoopsUser;
1670 1670
         $ret = array();
1671
-        $sql = 'SELECT categoryid, COUNT(*) AS count FROM ' . $this->db->prefix('smartfaq_faq');
1672
-        if ((int)$cat_id > 0) {
1673
-            $sql .= ' WHERE categoryid = ' . (int)$cat_id;
1674
-            $sql .= ' AND status IN (' . implode(',', $status) . ')';
1671
+        $sql = 'SELECT categoryid, COUNT(*) AS count FROM '.$this->db->prefix('smartfaq_faq');
1672
+        if ((int) $cat_id > 0) {
1673
+            $sql .= ' WHERE categoryid = '.(int) $cat_id;
1674
+            $sql .= ' AND status IN ('.implode(',', $status).')';
1675 1675
         } else {
1676
-            $sql .= ' WHERE status IN (' . implode(',', $status) . ')';
1676
+            $sql .= ' WHERE status IN ('.implode(',', $status).')';
1677 1677
             if (!sf_userIsAdmin()) {
1678 1678
                 $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq');
1679 1679
                 $items            = $smartPermHandler->getPermissions('item');
1680 1680
                 if (is_object($xoopsUser)) {
1681
-                    $sql .= ' AND faqid IN (' . implode(',', $items) . ')';
1681
+                    $sql .= ' AND faqid IN ('.implode(',', $items).')';
1682 1682
                 } else {
1683
-                    $sql .= ' AND (faqid IN (' . implode(',', $items) . ') OR partialview = 1)';
1683
+                    $sql .= ' AND (faqid IN ('.implode(',', $items).') OR partialview = 1)';
1684 1684
                 }
1685 1685
             }
1686 1686
         }
@@ -1693,7 +1693,7 @@  discard block
 block discarded – undo
1693 1693
             return $ret;
1694 1694
         }
1695 1695
         while ($row = $this->db->fetchArray($result)) {
1696
-            $ret[$row['categoryid']] = (int)$row['count'];
1696
+            $ret[$row['categoryid']] = (int) $row['count'];
1697 1697
         }
1698 1698
 
1699 1699
         return $ret;
Please login to merge, or discard this patch.
comment_delete.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
6 6
  * Licence: GNU
7 7
  */
8 8
 
9
-include __DIR__ . '/../../mainfile.php';
10
-include_once XOOPS_ROOT_PATH . '/include/comment_delete.php';
9
+include __DIR__.'/../../mainfile.php';
10
+include_once XOOPS_ROOT_PATH.'/include/comment_delete.php';
Please login to merge, or discard this patch.
comment_new.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
6 6
  * Licence: GNU
7 7
  */
8 8
 
9
-include __DIR__ . '/../../mainfile.php';
10
-include_once XOOPS_ROOT_PATH . '/include/comment_new.php';
9
+include __DIR__.'/../../mainfile.php';
10
+include_once XOOPS_ROOT_PATH.'/include/comment_new.php';
Please login to merge, or discard this patch.
request.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@  discard block
 block discarded – undo
6 6
  * Licence: GNU
7 7
  */
8 8
 
9
-include_once __DIR__ . '/header.php';
10
-include_once XOOPS_ROOT_PATH . '/header.php';
9
+include_once __DIR__.'/header.php';
10
+include_once XOOPS_ROOT_PATH.'/header.php';
11 11
 
12 12
 global $xoopsUser, $xoopsConfig, $xoopsModuleConfig, $xoopsModule;
13 13
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
         // Storing the FAQ object in the database
79 79
         if (!$newFaqObj->store()) {
80
-            redirect_header('javascript:history.go(-1)', 3, _MD_SF_REQUEST_ERROR . sf_formatErrors($newFaqObj->getErrors()));
80
+            redirect_header('javascript:history.go(-1)', 3, _MD_SF_REQUEST_ERROR.sf_formatErrors($newFaqObj->getErrors()));
81 81
         }
82 82
 
83 83
         // Get the cateopry object related to that FAQ
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         } else {
93 93
             // Subscribe the user to On Published notification, if requested
94 94
             if ($notifypub == 1) {
95
-                include_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
95
+                include_once XOOPS_ROOT_PATH.'/include/notification_constants.php';
96 96
                 $notificationHandler = xoops_getHandler('notification');
97 97
                 $notificationHandler->subscribe('question', $newFaqObj->faqid(), 'approved', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE);
98 98
             }
@@ -112,27 +112,27 @@  discard block
 block discarded – undo
112 112
         global $xoopsUser, $myts;
113 113
 
114 114
         $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.tpl';
115
-        include_once XOOPS_ROOT_PATH . '/header.php';
116
-        include_once __DIR__ . '/footer.php';
115
+        include_once XOOPS_ROOT_PATH.'/header.php';
116
+        include_once __DIR__.'/footer.php';
117 117
 
118 118
         $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous';
119 119
 
120
-        $moduleName =& $myts->displayTarea($xoopsModule->getVar('name'));
120
+        $moduleName = & $myts->displayTarea($xoopsModule->getVar('name'));
121 121
         $xoopsTpl->assign('whereInSection', $moduleName);
122 122
         $xoopsTpl->assign('lang_submit', _MD_SF_REQUEST);
123 123
 
124 124
         $xoopsTpl->assign('lang_intro_title', _MD_SF_REQUEST);
125
-        $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . $myts->displayTarea($xoopsModuleConfig['requestintromsg']));
125
+        $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY."<b>$name</b>, ".$myts->displayTarea($xoopsModuleConfig['requestintromsg']));
126 126
 
127
-        include_once __DIR__ . '/include/request.inc.php';
127
+        include_once __DIR__.'/include/request.inc.php';
128 128
 
129 129
         $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous';
130 130
 
131 131
         $sectionname = $myts->htmlSpecialChars($xoopsModule->getVar('name'));
132 132
 
133
-        include_once __DIR__ . '/include/request.inc.php';
133
+        include_once __DIR__.'/include/request.inc.php';
134 134
 
135
-        include_once XOOPS_ROOT_PATH . '/footer.php';
135
+        include_once XOOPS_ROOT_PATH.'/footer.php';
136 136
 
137 137
         break;
138 138
 }
Please login to merge, or discard this patch.
comment_post.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
6 6
  * Licence: GNU
7 7
  */
8 8
 
9
-include __DIR__ . '/../../mainfile.php';
10
-include_once XOOPS_ROOT_PATH . '/include/comment_post.php';
9
+include __DIR__.'/../../mainfile.php';
10
+include_once XOOPS_ROOT_PATH.'/include/comment_post.php';
Please login to merge, or discard this patch.
admin/mygroupperm.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -15,14 +15,14 @@  discard block
 block discarded – undo
15 15
 
16 16
 function myDeleteByModule(XoopsDatabase $db, $gperm_modid, $gperm_name = null, $gperm_itemid = null)
17 17
 {
18
-    $criteria = new CriteriaCompo(new Criteria('gperm_modid', (int)$gperm_modid));
18
+    $criteria = new CriteriaCompo(new Criteria('gperm_modid', (int) $gperm_modid));
19 19
     if (isset($gperm_name)) {
20 20
         $criteria->add(new Criteria('gperm_name', $gperm_name));
21 21
         if (isset($gperm_itemid)) {
22
-            $criteria->add(new Criteria('gperm_itemid', (int)$gperm_itemid));
22
+            $criteria->add(new Criteria('gperm_itemid', (int) $gperm_itemid));
23 23
         }
24 24
     }
25
-    $sql = 'DELETE FROM ' . $db->prefix('group_permission') . ' ' . $criteria->renderWhere();
25
+    $sql = 'DELETE FROM '.$db->prefix('group_permission').' '.$criteria->renderWhere();
26 26
     if (!$result = $db->query($sql)) {
27 27
         return false;
28 28
     }
@@ -31,19 +31,19 @@  discard block
 block discarded – undo
31 31
 }
32 32
 
33 33
 // include_once __DIR__ . '/../../../include/cp_header.php'; GIJ
34
-$modid = isset($HTTP_POST_VARS['modid']) ? (int)$HTTP_POST_VARS['modid'] : 1;
34
+$modid = isset($HTTP_POST_VARS['modid']) ? (int) $HTTP_POST_VARS['modid'] : 1;
35 35
 // we dont want system module permissions to be changed here ( 1 -> 0 GIJ)
36 36
 if ($modid <= 0 || !is_object($xoopsUser) || !$xoopsUser->isAdmin($modid)) {
37
-    redirect_header(XOOPS_URL . '/user.php', 1, _NOPERM);
37
+    redirect_header(XOOPS_URL.'/user.php', 1, _NOPERM);
38 38
 }
39 39
 /** @var XoopsModuleHandler $moduleHandler */
40 40
 $moduleHandler = xoops_getHandler('module');
41 41
 $module        = $moduleHandler->get($modid);
42 42
 if (!is_object($module) || !$module->getVar('isactive')) {
43
-    redirect_header(XOOPS_URL . '/admin.php', 1, _MODULENOEXIST);
43
+    redirect_header(XOOPS_URL.'/admin.php', 1, _MODULENOEXIST);
44 44
 }
45 45
 $memberHandler = xoops_getHandler('member');
46
-$group_list    =& $memberHandler->getGroupList();
46
+$group_list    = & $memberHandler->getGroupList();
47 47
 if (is_array($HTTP_POST_VARS['perms']) && !empty($HTTP_POST_VARS['perms'])) {
48 48
     $gpermHandler = xoops_getHandler('groupperm');
49 49
     foreach ($HTTP_POST_VARS['perms'] as $perm_name => $perm_data) {
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
                             foreach ($parent_ids as $pid) {
67 67
                                 if ($pid != 0 && !in_array($pid, array_keys($item_ids))) {
68 68
                                     // one of the parent items were not selected, so skip this item
69
-                                    $msg[] = sprintf(_MD_AM_PERMADDNG, '<b>' . $perm_name . '</b>', '<b>' . $perm_data['itemname'][$item_id] . '</b>', '<b>' . $group_list[$group_id] . '</b>')
69
+                                    $msg[] = sprintf(_MD_AM_PERMADDNG, '<b>'.$perm_name.'</b>', '<b>'.$perm_data['itemname'][$item_id].'</b>', '<b>'.$group_list[$group_id].'</b>')
70 70
                                              . ' ('
71 71
                                              . _MD_AM_PERMADDNGP
72 72
                                              . ')';
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
                         $gperm->setVar('gperm_modid', $modid);
81 81
                         $gperm->setVar('gperm_itemid', $item_id);
82 82
                         if (!$gpermHandler->insert($gperm)) {
83
-                            $msg[] = sprintf(_MD_AM_PERMADDNG, '<b>' . $perm_name . '</b>', '<b>' . $perm_data['itemname'][$item_id] . '</b>', '<b>' . $group_list[$group_id] . '</b>');
83
+                            $msg[] = sprintf(_MD_AM_PERMADDNG, '<b>'.$perm_name.'</b>', '<b>'.$perm_data['itemname'][$item_id].'</b>', '<b>'.$group_list[$group_id].'</b>');
84 84
                         } else {
85
-                            $msg[] = sprintf(_MD_AM_PERMADDOK, '<b>' . $perm_name . '</b>', '<b>' . $perm_data['itemname'][$item_id] . '</b>', '<b>' . $group_list[$group_id] . '</b>');
85
+                            $msg[] = sprintf(_MD_AM_PERMADDOK, '<b>'.$perm_name.'</b>', '<b>'.$perm_data['itemname'][$item_id].'</b>', '<b>'.$group_list[$group_id].'</b>');
86 86
                         }
87 87
                         unset($gperm);
88 88
                     }
Please login to merge, or discard this patch.
admin/about.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@
 block discarded – undo
17 17
  * @author       XOOPS Development Team
18 18
  */
19 19
 
20
-require_once __DIR__ . '/admin_header.php';
20
+require_once __DIR__.'/admin_header.php';
21 21
 xoops_cp_header();
22 22
 
23 23
 $adminObject->displayNavigation(basename(__FILE__));
24 24
 \Xmf\Module\Admin::setPaypal('6KJ7RW5DR3VTJ');
25 25
 $adminObject->displayAbout(false);
26 26
 
27
-require_once __DIR__ . '/admin_footer.php';
27
+require_once __DIR__.'/admin_footer.php';
Please login to merge, or discard this patch.