Passed
Push — master ( 2744eb...81ba93 )
by Michael
02:46
created
class/FaqHandler.php 2 patches
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     public function get($id)
49 49
     {
50 50
         if ((int)$id > 0) {
51
-            $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_faq') . ' WHERE faqid=' . $id;
51
+            $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_faq').' WHERE faqid='.$id;
52 52
             if (!$result = $this->db->query($sql)) {
53 53
                 return false;
54 54
             }
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 //            $faq->setError($this->db->error());
163 163
 
164 164
 
165
-            trigger_error('Class ' . $faq . ' could not be saved ' . __FILE__ . ' at line ' . __LINE__, E_USER_WARNING);
165
+            trigger_error('Class '.$faq.' could not be saved '.__FILE__.' at line '.__LINE__, E_USER_WARNING);
166 166
 
167 167
             return false;
168 168
         }
@@ -228,26 +228,26 @@  discard block
 block discarded – undo
228 228
     {
229 229
         $ret   = [];
230 230
         $limit = $start = 0;
231
-        $sql   = 'SELECT * FROM ' . $this->db->prefix('smartfaq_faq');
231
+        $sql   = 'SELECT * FROM '.$this->db->prefix('smartfaq_faq');
232 232
 
233 233
         if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) {
234 234
             $whereClause = $criteria->renderWhere();
235 235
 
236 236
             if ('WHERE ()' !== $whereClause) {
237
-                $sql .= ' ' . $criteria->renderWhere();
237
+                $sql .= ' '.$criteria->renderWhere();
238 238
                 if (!empty($notNullFields)) {
239 239
                     $sql .= $this->NotNullFieldClause($notNullFields, true);
240 240
                 }
241 241
             } elseif (!empty($notNullFields)) {
242
-                $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
242
+                $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
243 243
             }
244 244
             if ('' != $criteria->getSort()) {
245
-                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
245
+                $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
246 246
             }
247 247
             $limit = $criteria->getLimit();
248 248
             $start = $criteria->getStart();
249 249
         } elseif (!empty($notNullFields)) {
250
-            $sql .= $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
250
+            $sql .= $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
251 251
         }
252 252
 
253 253
         //echo "<br>" . $sql . "<br>";
@@ -266,9 +266,9 @@  discard block
 block discarded – undo
266 266
             $faq->assignVars($myrow);
267 267
 
268 268
             if (!$id_as_key) {
269
-                $ret[] =& $faq;
269
+                $ret[] = & $faq;
270 270
             } else {
271
-                $ret[$myrow['faqid']] =& $faq;
271
+                $ret[$myrow['faqid']] = & $faq;
272 272
             }
273 273
             unset($faq);
274 274
         }
@@ -308,26 +308,26 @@  discard block
 block discarded – undo
308 308
                             faq.modulelink AS modulelink,
309 309
                             faq.contextpage AS contextpage,
310 310
                             faq.exacturl AS exacturl
311
-                FROM ' . $this->db->prefix('smartfaq_faq') . ' AS faq INNER JOIN ' . $this->db->prefix('smartfaq_categories') . ' AS category ON faq.categoryid = category.categoryid ';
311
+                FROM ' . $this->db->prefix('smartfaq_faq').' AS faq INNER JOIN '.$this->db->prefix('smartfaq_categories').' AS category ON faq.categoryid = category.categoryid ';
312 312
 
313 313
         if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) {
314 314
             $whereClause = $criteria->renderWhere();
315 315
 
316 316
             if ('WHERE ()' !== $whereClause) {
317
-                $sql .= ' ' . $criteria->renderWhere();
317
+                $sql .= ' '.$criteria->renderWhere();
318 318
                 if (!empty($notNullFields)) {
319 319
                     $sql .= $this->NotNullFieldClause($notNullFields, true);
320 320
                 }
321 321
             } elseif (!empty($notNullFields)) {
322
-                $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
322
+                $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
323 323
             }
324 324
             if ('' != $criteria->getSort()) {
325
-                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
325
+                $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
326 326
             }
327 327
             $limit = $criteria->getLimit();
328 328
             $start = $criteria->getStart();
329 329
         } elseif (!empty($notNullFields)) {
330
-            $sql .= $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
330
+            $sql .= $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
331 331
         }
332 332
 
333 333
         //echo "<br>" . $sql . "<br>";
@@ -345,9 +345,9 @@  discard block
 block discarded – undo
345 345
             $faq->assignVars($myrow);
346 346
 
347 347
             if (!$id_as_key) {
348
-                $ret[] =& $faq;
348
+                $ret[] = & $faq;
349 349
             } else {
350
-                $ret[$myrow['faqid']] =& $faq;
350
+                $ret[$myrow['faqid']] = & $faq;
351 351
             }
352 352
             unset($faq);
353 353
         }
@@ -377,19 +377,19 @@  discard block
 block discarded – undo
377 377
      */
378 378
     public function getCount($criteria = null, $notNullFields = '')
379 379
     {
380
-        $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_faq');
380
+        $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('smartfaq_faq');
381 381
         if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) {
382 382
             $whereClause = $criteria->renderWhere();
383 383
             if ('WHERE ()' !== $whereClause) {
384
-                $sql .= ' ' . $criteria->renderWhere();
384
+                $sql .= ' '.$criteria->renderWhere();
385 385
                 if (!empty($notNullFields)) {
386 386
                     $sql .= $this->NotNullFieldClause($notNullFields, true);
387 387
                 }
388 388
             } elseif (!empty($notNullFields)) {
389
-                $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
389
+                $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
390 390
             }
391 391
         } elseif (!empty($notNullFields)) {
392
-            $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
392
+            $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
393 393
         }
394 394
 
395 395
         //echo "<br>" . $sql . "<br>";
@@ -423,11 +423,11 @@  discard block
 block discarded – undo
423 423
             $smartPermHandler = Smartfaq\Helper::getInstance()->getHandler('Permission');
424 424
 
425 425
             $categoriesGranted = $smartPermHandler->getPermissions('category');
426
-            $grantedCategories = new \Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN');
426
+            $grantedCategories = new \Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN');
427 427
 
428 428
             $faqsGranted = $smartPermHandler->getPermissions('item');
429 429
             $grantedFaq  = new \CriteriaCompo();
430
-            $grantedFaq->add(new \Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR');
430
+            $grantedFaq->add(new \Criteria('faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR');
431 431
             // If user is anonymous, check if the FAQ allow partialview
432 432
             if (!is_object($xoopsUser)) {
433 433
                 $grantedFaq->add(new \Criteria('partialview', '1'), 'OR');
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
      */
475 475
     public function getFaqsCountByStatus()
476 476
     {
477
-        $sql    = 'SELECT status, COUNT(*) FROM ' . $this->db->prefix('smartfaq_faq') . ' GROUP BY status';
477
+        $sql    = 'SELECT status, COUNT(*) FROM '.$this->db->prefix('smartfaq_faq').' GROUP BY status';
478 478
         $result = $this->db->query($sql);
479 479
         if (!$result) {
480 480
             return [];
@@ -544,11 +544,11 @@  discard block
 block discarded – undo
544 544
             $smartPermHandler = Smartfaq\Helper::getInstance()->getHandler('Permission');
545 545
 
546 546
             $categoriesGranted = $smartPermHandler->getPermissions('category');
547
-            $grantedCategories = new \Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN');
547
+            $grantedCategories = new \Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN');
548 548
 
549 549
             $faqsGranted = $smartPermHandler->getPermissions('item');
550 550
             $grantedFaq  = new \CriteriaCompo();
551
-            $grantedFaq->add(new \Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR');
551
+            $grantedFaq->add(new \Criteria('faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR');
552 552
             // If user is anonymous, check if the FAQ allow partialview
553 553
             if (!is_object($xoopsUser)) {
554 554
                 $grantedFaq->add(new \Criteria('partialview', '1'), 'OR');
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 
558 558
         if (isset($categoryid) && (-1 != $categoryid)) {
559 559
             if (is_array($categoryid)) {
560
-                $criteriaCategory = new \Criteria('categoryid', '(' . implode(',', $categoryid) . ')', 'IN');
560
+                $criteriaCategory = new \Criteria('categoryid', '('.implode(',', $categoryid).')', 'IN');
561 561
             } else {
562 562
                 $criteriaCategory = new \Criteria('categoryid', (int)$categoryid);
563 563
             }
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
         $criteria->setStart($start);
601 601
         $criteria->setSort($sort);
602 602
         $criteria->setOrder($order);
603
-        $ret =& $this->getObjects($criteria, false, $notNullFields);
603
+        $ret = & $this->getObjects($criteria, false, $notNullFields);
604 604
 
605 605
         return $ret;
606 606
     }
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
             $entrynumber = mt_rand(0, $totalFaqs);
690 690
             $faq         = $this->getFaqs(1, $entrynumber, $status, -1, 'datesub', 'DESC', $notNullFields);
691 691
             if ($faq) {
692
-                $ret =& $faq[0];
692
+                $ret = & $faq[0];
693 693
             }
694 694
         }
695 695
 
@@ -720,10 +720,10 @@  discard block
 block discarded – undo
720 720
                 $httphost    = $_SERVER['HTTP_HOST'];
721 721
                 $querystring = $_SERVER['QUERY_STRING'];
722 722
                 if ('' != $querystring) {
723
-                    $querystring = '?' . $querystring;
723
+                    $querystring = '?'.$querystring;
724 724
                 }
725
-                $currenturl     = $http . $httphost . $phpself . $querystring;
726
-                $fullcontexturl = XOOPS_URL . '/' . $iValue->contextpage();
725
+                $currenturl     = $http.$httphost.$phpself.$querystring;
726
+                $fullcontexturl = XOOPS_URL.'/'.$iValue->contextpage();
727 727
                 switch ($iValue->modulelink()) {
728 728
                     case '':
729 729
                         $display = false;
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
                         }
743 743
                         break;
744 744
                     default:
745
-                        if (false === strpos($currenturl, XOOPS_URL . '/modules/')) {
745
+                        if (false === strpos($currenturl, XOOPS_URL.'/modules/')) {
746 746
                             $display = false;
747 747
                         } else {
748 748
                             if (false === strpos($currenturl, $iValue->modulelink())) {
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
                         break;
755 755
                 }
756 756
                 if ($display) {
757
-                    $randomFaqs[] =& $faqsObj[$i];
757
+                    $randomFaqs[] = & $faqsObj[$i];
758 758
                 }
759 759
             }
760 760
         }
@@ -763,10 +763,10 @@  discard block
 block discarded – undo
763 763
             mt_srand((float)microtime() * 10000000);
764 764
             $rand_keys = array_rand($randomFaqs, $limit);
765 765
             for ($j = 0, $jMax = count($rand_keys); $j < $jMax; ++$j) {
766
-                $ret[] =& $randomFaqs[$rand_keys[$j]];
766
+                $ret[] = & $randomFaqs[$rand_keys[$j]];
767 767
             }
768 768
         } else {
769
-            $ret =& $randomFaqs;
769
+            $ret = & $randomFaqs;
770 770
         }
771 771
 
772 772
         return $ret;
@@ -784,14 +784,14 @@  discard block
 block discarded – undo
784 784
             /** @var Smartfaq\PermissionHandler $smartPermHandler */
785 785
             $smartPermHandler = Smartfaq\Helper::getInstance()->getHandler('Permission');
786 786
             $items            = $smartPermHandler->getPermissions('item');
787
-            $faqclause        = ' AND faqid IN (' . implode(',', $items) . ')';
787
+            $faqclause        = ' AND faqid IN ('.implode(',', $items).')';
788 788
         }
789 789
 
790 790
         $sql  = "CREATE TEMPORARY TABLE tmp (categoryid INT(8) UNSIGNED NOT NULL,datesub INT(11) DEFAULT '0' NOT NULL);";
791
-        $sql2 = ' LOCK TABLES ' . $this->db->prefix('smartfaq_faq') . ' READ;';
792
-        $sql3 = ' INSERT INTO tmp SELECT categoryid, MAX(datesub) FROM ' . $this->db->prefix('smartfaq_faq') . ' WHERE status IN (' . implode(',', $status) . ") $faqclause GROUP BY categoryid;";
793
-        $sql4 = ' SELECT ' . $this->db->prefix('smartfaq_faq') . '.categoryid, faqid, question, uid, ' . $this->db->prefix('smartfaq_faq') . '.datesub FROM ' . $this->db->prefix('smartfaq_faq') . ', tmp
794
-                              WHERE ' . $this->db->prefix('smartfaq_faq') . '.categoryid=tmp.categoryid AND ' . $this->db->prefix('smartfaq_faq') . '.datesub=tmp.datesub;';
791
+        $sql2 = ' LOCK TABLES '.$this->db->prefix('smartfaq_faq').' READ;';
792
+        $sql3 = ' INSERT INTO tmp SELECT categoryid, MAX(datesub) FROM '.$this->db->prefix('smartfaq_faq').' WHERE status IN ('.implode(',', $status).") $faqclause GROUP BY categoryid;";
793
+        $sql4 = ' SELECT '.$this->db->prefix('smartfaq_faq').'.categoryid, faqid, question, uid, '.$this->db->prefix('smartfaq_faq').'.datesub FROM '.$this->db->prefix('smartfaq_faq').', tmp
794
+                              WHERE ' . $this->db->prefix('smartfaq_faq').'.categoryid=tmp.categoryid AND '.$this->db->prefix('smartfaq_faq').'.datesub=tmp.datesub;';
795 795
         /*
796 796
         //Old implementation
797 797
         $sql = "SELECT categoryid, faqid, question, uid, MAX(datesub) AS datesub FROM ".$this->db->prefix("smartfaq_faq")."
@@ -806,14 +806,14 @@  discard block
 block discarded – undo
806 806
         $this->db->queryF('UNLOCK TABLES;');
807 807
         $this->db->queryF('DROP TABLE tmp;');
808 808
         if (!$result) {
809
-            trigger_error('Error in getLastPublishedByCat SQL: ' . $error);
809
+            trigger_error('Error in getLastPublishedByCat SQL: '.$error);
810 810
 
811 811
             return $ret;
812 812
         }
813 813
         while (false !== ($row = $this->db->fetchArray($result))) {
814 814
             $faq = new Smartfaq\Faq();
815 815
             $faq->assignVars($row);
816
-            $ret[$row['categoryid']] =& $faq;
816
+            $ret[$row['categoryid']] = & $faq;
817 817
             unset($faq);
818 818
         }
819 819
 
@@ -828,9 +828,9 @@  discard block
 block discarded – undo
828 828
      */
829 829
     public function deleteAll($criteria = null)
830 830
     {
831
-        $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_faq');
831
+        $sql = 'DELETE FROM '.$this->db->prefix('smartfaq_faq');
832 832
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
833
-            $sql .= ' ' . $criteria->renderWhere();
833
+            $sql .= ' '.$criteria->renderWhere();
834 834
         }
835 835
         if (!$this->db->query($sql)) {
836 836
             return false;
@@ -851,10 +851,10 @@  discard block
 block discarded – undo
851 851
      **/
852 852
     public function updateAll($fieldname, $fieldvalue, $criteria = null)
853 853
     {
854
-        $set_clause = is_numeric($fieldvalue) ? $fieldname . ' = ' . $fieldvalue : $fieldname . ' = ' . $this->db->quoteString($fieldvalue);
855
-        $sql        = 'UPDATE ' . $this->db->prefix('smartfaq_faq') . ' SET ' . $set_clause;
854
+        $set_clause = is_numeric($fieldvalue) ? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue);
855
+        $sql        = 'UPDATE '.$this->db->prefix('smartfaq_faq').' SET '.$set_clause;
856 856
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
857
-            $sql .= ' ' . $criteria->renderWhere();
857
+            $sql .= ' '.$criteria->renderWhere();
858 858
         }
859 859
         if (!$this->db->queryF($sql)) {
860 860
             return false;
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
      */
870 870
     public function updateCounter($faqid)
871 871
     {
872
-        $sql = 'UPDATE ' . $this->db->prefix('smartfaq_faq') . ' SET counter=counter+1 WHERE faqid = ' . $faqid;
872
+        $sql = 'UPDATE '.$this->db->prefix('smartfaq_faq').' SET counter=counter+1 WHERE faqid = '.$faqid;
873 873
         if ($this->db->queryF($sql)) {
874 874
             return true;
875 875
         } else {
@@ -921,12 +921,12 @@  discard block
 block discarded – undo
921 921
             $criteriaUser->add(new \Criteria('answer.uid', $userid), 'OR');
922 922
         }
923 923
 
924
-        if (! empty($queryarray)) {
924
+        if (!empty($queryarray)) {
925 925
             $criteriaKeywords = new \CriteriaCompo();
926 926
             foreach ($queryarray as $iValue) {
927 927
                 $criteriaKeyword = new \CriteriaCompo();
928
-                $criteriaKeyword->add(new \Criteria('faq.question', '%' . $iValue . '%', 'LIKE'), 'OR');
929
-                $criteriaKeyword->add(new \Criteria('answer.answer', '%' . $iValue . '%', 'LIKE'), 'OR');
928
+                $criteriaKeyword->add(new \Criteria('faq.question', '%'.$iValue.'%', 'LIKE'), 'OR');
929
+                $criteriaKeyword->add(new \Criteria('answer.answer', '%'.$iValue.'%', 'LIKE'), 'OR');
930 930
                 $criteriaKeywords->add($criteriaKeyword, $andor);
931 931
                 unset($criteriaKeyword);
932 932
             }
@@ -945,9 +945,9 @@  discard block
 block discarded – undo
945 945
             if (empty($faqsGranted)) {
946 946
                 return $ret;
947 947
             }
948
-            $grantedCategories = new \Criteria('faq.categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN');
948
+            $grantedCategories = new \Criteria('faq.categoryid', '('.implode(',', $categoriesGranted).')', 'IN');
949 949
             $grantedFaq        = new \CriteriaCompo();
950
-            $grantedFaq->add(new \Criteria('faq.faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR');
950
+            $grantedFaq->add(new \Criteria('faq.faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR');
951 951
             // If user is anonymous, check if the FAQ allow partialview
952 952
             if (!is_object($xoopsUser)) {
953 953
                 $grantedFaq->add(new \Criteria('partialview', '1'), 'OR');
@@ -993,15 +993,15 @@  discard block
 block discarded – undo
993 993
         $criteria->setSort('faq.datesub');
994 994
         $criteria->setOrder('DESC');
995 995
 
996
-        $sql = 'SELECT faq.faqid, faq.question, faq.datesub, faq.uid FROM ' . $this->db->prefix('smartfaq_faq') . ' AS faq INNER JOIN ' . $this->db->prefix('smartfaq_answers') . ' AS answer ON faq.faqid = answer.faqid';
996
+        $sql = 'SELECT faq.faqid, faq.question, faq.datesub, faq.uid FROM '.$this->db->prefix('smartfaq_faq').' AS faq INNER JOIN '.$this->db->prefix('smartfaq_answers').' AS answer ON faq.faqid = answer.faqid';
997 997
 
998 998
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
999 999
             $whereClause = $criteria->renderWhere();
1000 1000
 
1001 1001
             if ('WHERE ()' !== $whereClause) {
1002
-                $sql .= ' ' . $criteria->renderWhere();
1002
+                $sql .= ' '.$criteria->renderWhere();
1003 1003
                 if ('' != $criteria->getSort()) {
1004
-                    $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
1004
+                    $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
1005 1005
                 }
1006 1006
                 $limit = $criteria->getLimit();
1007 1007
                 $start = $criteria->getStart();
@@ -1024,7 +1024,7 @@  discard block
 block discarded – undo
1024 1024
         while (false !== ($myrow = $this->db->fetchArray($result))) {
1025 1025
             $faq = new Smartfaq\Faq();
1026 1026
             $faq->assignVars($myrow);
1027
-            $ret[] =& $faq;
1027
+            $ret[] = & $faq;
1028 1028
             unset($faq);
1029 1029
         }
1030 1030
 
@@ -1040,20 +1040,20 @@  discard block
 block discarded – undo
1040 1040
     {
1041 1041
         global $xoopsUser;
1042 1042
         $ret = [];
1043
-        $sql = 'SELECT categoryid, COUNT(*) AS count FROM ' . $this->db->prefix('smartfaq_faq');
1043
+        $sql = 'SELECT categoryid, COUNT(*) AS count FROM '.$this->db->prefix('smartfaq_faq');
1044 1044
         if ((int)$cat_id > 0) {
1045
-            $sql .= ' WHERE categoryid = ' . (int)$cat_id;
1046
-            $sql .= ' AND status IN (' . implode(',', $status) . ')';
1045
+            $sql .= ' WHERE categoryid = '.(int)$cat_id;
1046
+            $sql .= ' AND status IN ('.implode(',', $status).')';
1047 1047
         } else {
1048
-            $sql .= ' WHERE status IN (' . implode(',', $status) . ')';
1048
+            $sql .= ' WHERE status IN ('.implode(',', $status).')';
1049 1049
             if (!Smartfaq\Utility::userIsAdmin()) {
1050 1050
                 /** @var Smartfaq\PermissionHandler $smartPermHandler */
1051 1051
                 $smartPermHandler = Smartfaq\Helper::getInstance()->getHandler('Permission');
1052 1052
                 $items            = $smartPermHandler->getPermissions('item');
1053 1053
                 if (is_object($xoopsUser)) {
1054
-                    $sql .= ' AND faqid IN (' . implode(',', $items) . ')';
1054
+                    $sql .= ' AND faqid IN ('.implode(',', $items).')';
1055 1055
                 } else {
1056
-                    $sql .= ' AND (faqid IN (' . implode(',', $items) . ') OR partialview = 1)';
1056
+                    $sql .= ' AND (faqid IN ('.implode(',', $items).') OR partialview = 1)';
1057 1057
                 }
1058 1058
             }
1059 1059
         }
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@
 block discarded – undo
94 94
         if ($faq->isNew()) {
95 95
             $sql = sprintf(
96 96
                 'INSERT INTO `%s` (faqid, categoryid, question, howdoi, diduno, uid, datesub, status, counter, weight, html, smiley, xcodes, cancomment, comments, notifypub, modulelink, contextpage, exacturl, partialview) VALUES (NULL, %u, %s, %s, %s, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %s, %s, %u, %u)',
97
-                           $this->db->prefix('smartfaq_faq'),
97
+                            $this->db->prefix('smartfaq_faq'),
98 98
                 $categoryid,
99 99
                 $this->db->quoteString($question),
100 100
                 $this->db->quoteString($howdoi),
Please login to merge, or discard this patch.
admin/docbook_export.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -6,16 +6,16 @@  discard block
 block discarded – undo
6 6
  * Licence: GNU
7 7
  */
8 8
 
9
-require_once __DIR__ . '/../../../include/cp_header.php';
9
+require_once __DIR__.'/../../../include/cp_header.php';
10 10
 
11
-$op = 'go';//'start';
11
+$op = 'go'; //'start';
12 12
 
13 13
 if (isset($_POST['op']) && ('go' === $_POST['op'])) {
14 14
     $op = $_POST['op'];
15 15
 }
16 16
 
17 17
 if ('start' === $op) {
18
-    require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
18
+    require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
19 19
 
20 20
     xoops_cp_header();
21 21
 
@@ -44,41 +44,41 @@  discard block
 block discarded – undo
44 44
 
45 45
     echo "  <title>{module title}</title>\r\n";
46 46
 
47
-    $resultC = $xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('smartfaq_categories'));
47
+    $resultC = $xoopsDB->queryF('SELECT * FROM '.$xoopsDB->prefix('smartfaq_categories'));
48 48
     while (false !== ($arrC = $xoopsDB->fetchArray($resultC))) {
49 49
         extract($arrC, EXTR_PREFIX_ALL, 'c');
50 50
 
51 51
         echo "  <qandadiv ID=\"c$c_categoryid\" Revision=\"$c_created\">\r\n";
52
-        echo '    <title>' . encodeText($c_name) . "</title>\r\n";
53
-        echo '    <para>' . encodeText($c_description) . "</para>\r\n";
52
+        echo '    <title>'.encodeText($c_name)."</title>\r\n";
53
+        echo '    <para>'.encodeText($c_description)."</para>\r\n";
54 54
 
55
-        $resultQ = $xoopsDB->queryF('select * from ' . $xoopsDB->prefix('smartfaq_faq') . " where categoryid=$c_categoryid");
55
+        $resultQ = $xoopsDB->queryF('select * from '.$xoopsDB->prefix('smartfaq_faq')." where categoryid=$c_categoryid");
56 56
         while (false !== ($arrQ = $xoopsDB->fetchArray($resultQ))) {
57 57
             extract($arrQ, EXTR_PREFIX_ALL, 'q');
58 58
 
59
-            echo "    <qandaentry ID=\"q$q_faqid\" Revision=\"$q_datesub\" Condition=\"$q_html $q_smiley $q_xcodes\" XrefLabel=\"$q_modulelink $q_contextpage\" Vendor=\"" . getUserFullName($q_uid) . "\">\r\n";
59
+            echo "    <qandaentry ID=\"q$q_faqid\" Revision=\"$q_datesub\" Condition=\"$q_html $q_smiley $q_xcodes\" XrefLabel=\"$q_modulelink $q_contextpage\" Vendor=\"".getUserFullName($q_uid)."\">\r\n";
60 60
             echo "      <question>\r\n";
61
-            echo '        <para>' . encodeText($q_question) . "</para>\r\n";
61
+            echo '        <para>'.encodeText($q_question)."</para>\r\n";
62 62
             if (!empty($q_howdoi)) {
63 63
                 echo "        <note Conformance=\"howdoi\">\r\n";
64 64
                 echo "          <title>{'How do I' from language file}</title>\r\n";
65
-                echo '          <para>' . encodeText($q_howdoi) . "</para>\r\n";
65
+                echo '          <para>'.encodeText($q_howdoi)."</para>\r\n";
66 66
                 echo "        </note>\r\n";
67 67
             }
68 68
             if (!empty($q_diduno)) {
69 69
                 echo "        <note Conformance=\"diduno\">\r\n";
70 70
                 echo "          <title>{'Did you know' from language file}</title>\r\n";
71
-                echo '          <para>' . encodeText($q_diduno) . "</para>\r\n";
71
+                echo '          <para>'.encodeText($q_diduno)."</para>\r\n";
72 72
                 echo "        </note>\r\n";
73 73
             }
74 74
             echo "      </question>\r\n";
75 75
 
76
-            $resultA = $xoopsDB->queryF('select * from ' . $xoopsDB->prefix('smartfaq_answers') . " where answerid=$q_answerid");
76
+            $resultA = $xoopsDB->queryF('select * from '.$xoopsDB->prefix('smartfaq_answers')." where answerid=$q_answerid");
77 77
             while (false !== ($arrA = $xoopsDB->fetchArray($resultA))) {
78 78
                 extract($arrA, EXTR_PREFIX_ALL, 'a');
79 79
 
80
-                echo "      <answer ID=\"a$a_answerid\" Revision=\"$a_datesub\" Vendor=\"" . getUserFullName($a_uid) . "\">\r\n";
81
-                echo '        <para>' . encodeText($a_answer) . "</para>\r\n";
80
+                echo "      <answer ID=\"a$a_answerid\" Revision=\"$a_datesub\" Vendor=\"".getUserFullName($a_uid)."\">\r\n";
81
+                echo '        <para>'.encodeText($a_answer)."</para>\r\n";
82 82
                 echo "      </answer>\r\n";
83 83
             }
84 84
             $xoopsDB->freeRecordSet($resultA);
Please login to merge, or discard this patch.
admin/xoopsfaq.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 use XoopsModules\Smartfaq;
15 15
 use XoopsModules\Smartfaq\Constants;
16 16
 
17
-require_once __DIR__ . '/admin_header.php';
17
+require_once __DIR__.'/admin_header.php';
18 18
 
19 19
 $importFromModuleName = 'XoopsFAQ';
20 20
 $scriptname           = 'xoopsfaq.php';
@@ -27,33 +27,33 @@  discard block
 block discarded – undo
27 27
 
28 28
 if ('start' === $op) {
29 29
     xoops_cp_header();
30
-    require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
30
+    require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
31 31
 
32
-    $result = $xoopsDB->queryF('SELECT count(*) FROM ' . $xoopsDB->prefix('xoopsfaq_categories'));
32
+    $result = $xoopsDB->queryF('SELECT count(*) FROM '.$xoopsDB->prefix('xoopsfaq_categories'));
33 33
     list($totalCat) = $xoopsDB->fetchRow($result);
34 34
 
35 35
     Smartfaq\Utility::collapsableBar('bottomtable', 'bottomtableicon');
36
-    echo "<img id='bottomtableicon' src=" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt=''></a>&nbsp;" . sprintf(_AM_SF_IMPORT_FROM, $importFromModuleName) . '</h3>';
36
+    echo "<img id='bottomtableicon' src=".XOOPS_URL.'/modules/'.$xoopsModule->dirname()."/assets/images/icon/close12.gif alt=''></a>&nbsp;".sprintf(_AM_SF_IMPORT_FROM, $importFromModuleName).'</h3>';
37 37
     echo "<div id='bottomtable'>";
38 38
 
39 39
     if (0 == $totalCat) {
40
-        echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . _AM_SF_IMPORT_NO_CATEGORY . '</span>';
40
+        echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">'._AM_SF_IMPORT_NO_CATEGORY.'</span>';
41 41
     } else {
42
-        require_once XOOPS_ROOT_PATH . '/class/xoopstree.php';
42
+        require_once XOOPS_ROOT_PATH.'/class/xoopstree.php';
43 43
 
44
-        $result = $xoopsDB->queryF('SELECT count(*) FROM ' . $xoopsDB->prefix('xoopsfaq_contents'));
44
+        $result = $xoopsDB->queryF('SELECT count(*) FROM '.$xoopsDB->prefix('xoopsfaq_contents'));
45 45
         list($totalFAQ) = $xoopsDB->fetchRow($result);
46 46
 
47 47
         if (0 == $totalFAQ) {
48
-            echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . sprintf(_AM_SF_IMPORT_MODULE_FOUND_NO_FAQ, $importFromModuleName, $totalCat) . '</span>';
48
+            echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">'.sprintf(_AM_SF_IMPORT_MODULE_FOUND_NO_FAQ, $importFromModuleName, $totalCat).'</span>';
49 49
         } else {
50
-            echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . sprintf(_AM_SF_IMPORT_MODULE_FOUND, $importFromModuleName, $totalCat, $totalFAQ) . '</span>';
50
+            echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">'.sprintf(_AM_SF_IMPORT_MODULE_FOUND, $importFromModuleName, $totalCat, $totalFAQ).'</span>';
51 51
 
52
-            $form = new \XoopsThemeForm(_AM_SF_IMPORT_SETTINGS, 'import_form', XOOPS_URL . '/modules/smartfaq/admin/' . $scriptname);
52
+            $form = new \XoopsThemeForm(_AM_SF_IMPORT_SETTINGS, 'import_form', XOOPS_URL.'/modules/smartfaq/admin/'.$scriptname);
53 53
 
54 54
             // Categories to be imported
55 55
             $cat_cbox = new \XoopsFormCheckBox(sprintf(_AM_SF_IMPORT_CATEGORIES, $importFromModuleName), 'import_category', -1);
56
-            $result   = $xoopsDB->queryF('SELECT c.category_id, c.category_title, count(q.contents_id) FROM ' . $xoopsDB->prefix('xoopsfaq_categories') . ' AS c, ' . $xoopsDB->prefix('xoopsfaq_contents') . ' AS q WHERE c.category_id=q.category_id GROUP BY c.category_id ORDER BY category_order');
56
+            $result   = $xoopsDB->queryF('SELECT c.category_id, c.category_title, count(q.contents_id) FROM '.$xoopsDB->prefix('xoopsfaq_categories').' AS c, '.$xoopsDB->prefix('xoopsfaq_contents').' AS q WHERE c.category_id=q.category_id GROUP BY c.category_id ORDER BY category_order');
57 57
 
58 58
             while (false !== (list($cid, $cat_title, $count) = $xoopsDB->fetchRow($result))) {
59 59
                 $cat_cbox->addOption($cid, "$cat_title ($count)<br\>");
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             ob_end_clean();
69 69
 
70 70
             // Auto-Approve
71
-            $form->addElement(new \XoopsFormRadioYN(_AM_SF_IMPORT_AUTOAPPROVE, 'autoaprove', 1, ' ' . _AM_SF_YES . '', ' ' . _AM_SF_NO . ''));
71
+            $form->addElement(new \XoopsFormRadioYN(_AM_SF_IMPORT_AUTOAPPROVE, 'autoaprove', 1, ' '._AM_SF_YES.'', ' '._AM_SF_NO.''));
72 72
 
73 73
             // Submitted and answered by
74 74
             $memberHandler = xoops_getHandler('member');
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
             $form->addElement($user_select);
82 82
 
83 83
             // Q&As can be commented?
84
-            $form->addElement(new \XoopsFormRadioYN(_AM_SF_IMPORT_ALLOWCOMMENTS, 'cancomment', 1, ' ' . _AM_SF_YES . '', ' ' . _AM_SF_NO . ''));
84
+            $form->addElement(new \XoopsFormRadioYN(_AM_SF_IMPORT_ALLOWCOMMENTS, 'cancomment', 1, ' '._AM_SF_YES.'', ' '._AM_SF_NO.''));
85 85
 
86 86
             $group_list      = $memberHandler->getGroupList();
87 87
             $groups_selected = [];
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 }
106 106
 
107 107
 if ('go' === $op) {
108
-    require_once __DIR__ . '/admin_header.php';
108
+    require_once __DIR__.'/admin_header.php';
109 109
 
110 110
     $import_category = (isset($_POST['import_category']) ? $_POST['import_category'] : null);
111 111
     if (!$import_category) {
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
     xoops_cp_header();
116 116
 
117 117
     Smartfaq\Utility::collapsableBar('bottomtable', 'bottomtableicon');
118
-    echo "<img id='bottomtableicon' src=" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt=''></a>&nbsp;" . sprintf(_AM_SF_IMPORT_FROM, $importFromModuleName) . '</h3>';
118
+    echo "<img id='bottomtableicon' src=".XOOPS_URL.'/modules/'.$xoopsModule->dirname()."/assets/images/icon/close12.gif alt=''></a>&nbsp;".sprintf(_AM_SF_IMPORT_FROM, $importFromModuleName).'</h3>';
119 119
     echo "<div id='bottomtable'>";
120
-    echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . _AM_SF_IMPORT_RESULT . '</span>';
120
+    echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">'._AM_SF_IMPORT_RESULT.'</span>';
121 121
 
122 122
     $cnt_imported_cat = 0;
123 123
     $cnt_imported_faq = 0;
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
     echo "Can Comment: $cancomment<br>";
147 147
     echo "Auto aprove: $autoaprove<br>";*/
148 148
 
149
-    $resultCat = $xoopsDB->queryF('select * from ' . $xoopsDB->prefix('xoopsfaq_categories') . " where category_id in ($import_category_list) order by category_order");
149
+    $resultCat = $xoopsDB->queryF('select * from '.$xoopsDB->prefix('xoopsfaq_categories')." where category_id in ($import_category_list) order by category_order");
150 150
 
151 151
     while (false !== ($arrCat = $xoopsDB->fetchArray($resultCat))) {
152 152
         extract($arrCat, EXTR_PREFIX_ALL, 'xcat');
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
         $categoryObj->setVar('name', $xcat_category_title);
161 161
 
162 162
         if (!$categoryObj->store(false)) {
163
-            echo sprintf(_AM_SF_IMPORT_CATEGORY_ERROR, $xcat_name) . '<br>';
163
+            echo sprintf(_AM_SF_IMPORT_CATEGORY_ERROR, $xcat_name).'<br>';
164 164
             continue;
165 165
         }
166 166
 
@@ -168,9 +168,9 @@  discard block
 block discarded – undo
168 168
 
169 169
         ++$cnt_imported_cat;
170 170
 
171
-        echo sprintf(_AM_SF_IMPORT_CATEGORY_SUCCESS, $xcat_category_title) . "<br\>";
171
+        echo sprintf(_AM_SF_IMPORT_CATEGORY_SUCCESS, $xcat_category_title)."<br\>";
172 172
 
173
-        $resultFAQ = $xoopsDB->queryF('select * from ' . $xoopsDB->prefix('xoopsfaq_contents') . " where category_id=$xcat_category_id order by contents_order");
173
+        $resultFAQ = $xoopsDB->queryF('select * from '.$xoopsDB->prefix('xoopsfaq_contents')." where category_id=$xcat_category_id order by contents_order");
174 174
         while (false !== ($arrFAQ = $xoopsDB->fetchArray($resultFAQ))) {
175 175
             extract($arrFAQ, EXTR_PREFIX_ALL, 'xfaq');
176 176
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
             $faqObj->setVar('cancomment', $cancomment);
199 199
 
200 200
             if (!$faqObj->store(false)) {
201
-                echo sprintf('  ' . _AM_SF_IMPORT_FAQ_ERROR, $xfaq_contents_title) . '<br>';
201
+                echo sprintf('  '._AM_SF_IMPORT_FAQ_ERROR, $xfaq_contents_title).'<br>';
202 202
                 continue;
203 203
             } else {
204 204
                 $answerObj->setVar('faqid', $faqObj->faqid());
@@ -207,10 +207,10 @@  discard block
 block discarded – undo
207 207
                 $answerObj->setVar('status', Constants::SF_AN_STATUS_APPROVED);
208 208
 
209 209
                 if (!$answerObj->store()) {
210
-                    echo sprintf('  ' . _AM_SF_IMPORT_FAQ_ERROR) . '<br>';
210
+                    echo sprintf('  '._AM_SF_IMPORT_FAQ_ERROR).'<br>';
211 211
                     continue;
212 212
                 } else {
213
-                    echo '&nbsp;&nbsp;' . sprintf(_AM_SF_IMPORTED_QUESTION, $faqObj->question(50)) . '<br>';
213
+                    echo '&nbsp;&nbsp;'.sprintf(_AM_SF_IMPORTED_QUESTION, $faqObj->question(50)).'<br>';
214 214
                     ++$cnt_imported_faq;
215 215
                 }
216 216
             }
@@ -220,8 +220,8 @@  discard block
 block discarded – undo
220 220
     }
221 221
 
222 222
     echo 'Done.<br>';
223
-    echo sprintf(_AM_SF_IMPORTED_CATEGORIES, $cnt_imported_cat) . '<br>';
224
-    echo sprintf(_AM_SF_IMPORTED_QUESTIONS, $cnt_imported_faq) . '<br>';
223
+    echo sprintf(_AM_SF_IMPORTED_CATEGORIES, $cnt_imported_cat).'<br>';
224
+    echo sprintf(_AM_SF_IMPORTED_QUESTIONS, $cnt_imported_faq).'<br>';
225 225
 
226 226
     exit();
227 227
 }
Please login to merge, or discard this patch.
admin/wffaq.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 use XoopsModules\Smartfaq;
14 14
 use XoopsModules\Smartfaq\Constants;
15 15
 
16
-require_once __DIR__ . '/admin_header.php';
16
+require_once __DIR__.'/admin_header.php';
17 17
 
18 18
 $importFromModuleName = 'WF-FAQ';
19 19
 $scriptname           = 'wffaq.php';
@@ -25,33 +25,33 @@  discard block
 block discarded – undo
25 25
 }
26 26
 
27 27
 if ('start' === $op) {
28
-    require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
28
+    require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
29 29
     xoops_cp_header();
30
-    $result = $xoopsDB->queryF('SELECT count(*) FROM ' . $xoopsDB->prefix('faqcategories'));
30
+    $result = $xoopsDB->queryF('SELECT count(*) FROM '.$xoopsDB->prefix('faqcategories'));
31 31
     list($totalCat) = $xoopsDB->fetchRow($result);
32 32
 
33 33
     Smartfaq\Utility::collapsableBar('bottomtable', 'bottomtableicon');
34
-    echo "<img id='bottomtableicon' src=" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt=''></a>&nbsp;" . sprintf(_AM_SF_IMPORT_FROM, $importFromModuleName) . '</h3>';
34
+    echo "<img id='bottomtableicon' src=".XOOPS_URL.'/modules/'.$xoopsModule->dirname()."/assets/images/icon/close12.gif alt=''></a>&nbsp;".sprintf(_AM_SF_IMPORT_FROM, $importFromModuleName).'</h3>';
35 35
     echo "<div id='bottomtable'>";
36 36
 
37 37
     if (0 == $totalCat) {
38
-        echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . _AM_SF_IMPORT_NO_CATEGORY . '</span>';
38
+        echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">'._AM_SF_IMPORT_NO_CATEGORY.'</span>';
39 39
     } else {
40
-        require_once XOOPS_ROOT_PATH . '/class/xoopstree.php';
40
+        require_once XOOPS_ROOT_PATH.'/class/xoopstree.php';
41 41
 
42
-        $result = $xoopsDB->queryF('SELECT count(*) FROM ' . $xoopsDB->prefix('faqtopics'));
42
+        $result = $xoopsDB->queryF('SELECT count(*) FROM '.$xoopsDB->prefix('faqtopics'));
43 43
         list($totalFAQ) = $xoopsDB->fetchRow($result);
44 44
 
45 45
         if (0 == $totalFAQ) {
46
-            echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . sprintf(_AM_SF_IMPORT_MODULE_FOUND_NO_FAQ, $importFromModuleName, $totalCat) . '</span>';
46
+            echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">'.sprintf(_AM_SF_IMPORT_MODULE_FOUND_NO_FAQ, $importFromModuleName, $totalCat).'</span>';
47 47
         } else {
48
-            echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . sprintf(_AM_SF_IMPORT_MODULE_FOUND, $importFromModuleName, $totalCat, $totalFAQ) . '</span>';
48
+            echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">'.sprintf(_AM_SF_IMPORT_MODULE_FOUND, $importFromModuleName, $totalCat, $totalFAQ).'</span>';
49 49
 
50
-            $form = new \XoopsThemeForm(_AM_SF_IMPORT_SETTINGS, 'import_form', XOOPS_URL . '/modules/smartfaq/admin/' . $scriptname);
50
+            $form = new \XoopsThemeForm(_AM_SF_IMPORT_SETTINGS, 'import_form', XOOPS_URL.'/modules/smartfaq/admin/'.$scriptname);
51 51
 
52 52
             // Categories to be imported
53 53
             $cat_cbox = new \XoopsFormCheckBox(sprintf(_AM_SF_IMPORT_CATEGORIES, $importFromModuleName), 'import_category', -1);
54
-            $result   = $xoopsDB->queryF('SELECT c.catID, c.name, count(t.topicID) FROM ' . $xoopsDB->prefix('faqcategories') . ' AS c, ' . $xoopsDB->prefix('faqtopics') . ' AS t WHERE c.catID=t.catID GROUP BY t.catID ORDER BY c.weight');
54
+            $result   = $xoopsDB->queryF('SELECT c.catID, c.name, count(t.topicID) FROM '.$xoopsDB->prefix('faqcategories').' AS c, '.$xoopsDB->prefix('faqtopics').' AS t WHERE c.catID=t.catID GROUP BY t.catID ORDER BY c.weight');
55 55
             while (false !== (list($cid, $cat_title, $count) = $xoopsDB->fetchRow($result))) {
56 56
                 $cat_cbox->addOption($cid, "$cat_title ($count)<br\>");
57 57
             }
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
             ob_end_clean();
66 66
 
67 67
             // Auto-Approve
68
-            $form->addElement(new \XoopsFormRadioYN(_AM_SF_IMPORT_AUTOAPPROVE, 'autoaprove', 1, ' ' . _AM_SF_YES . '', ' ' . _AM_SF_NO . ''));
68
+            $form->addElement(new \XoopsFormRadioYN(_AM_SF_IMPORT_AUTOAPPROVE, 'autoaprove', 1, ' '._AM_SF_YES.'', ' '._AM_SF_NO.''));
69 69
 
70 70
             // Submitted and answered by
71 71
             $memberHandler = xoops_getHandler('member');
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
             $form->addElement($user_select);
79 79
 
80 80
             // Q&As can be commented?
81
-            $form->addElement(new \XoopsFormRadioYN(_AM_SF_IMPORT_ALLOWCOMMENTS, 'cancomment', 1, ' ' . _AM_SF_YES . '', ' ' . _AM_SF_NO . ''));
81
+            $form->addElement(new \XoopsFormRadioYN(_AM_SF_IMPORT_ALLOWCOMMENTS, 'cancomment', 1, ' '._AM_SF_YES.'', ' '._AM_SF_NO.''));
82 82
             $group_list      = $memberHandler->getGroupList();
83 83
             $groups_selected = [];
84 84
             $groups_checkbox = new \XoopsFormCheckBox(_AM_SF_IMPORT_PERMISSIONS, 'groups_read');
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
         redirect_header($scriptname, 2, _AM_SF_NOCATSELECTED);
108 108
     }
109 109
 
110
-    require_once __DIR__ . '/admin_header.php';
110
+    require_once __DIR__.'/admin_header.php';
111 111
     xoops_cp_header();
112 112
 
113 113
     Smartfaq\Utility::collapsableBar('bottomtable', 'bottomtableicon');
114
-    echo "<img id='bottomtableicon' src=" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt=''></a>&nbsp;" . sprintf(_AM_SF_IMPORT_FROM, $importFromModuleName) . '</h3>';
114
+    echo "<img id='bottomtableicon' src=".XOOPS_URL.'/modules/'.$xoopsModule->dirname()."/assets/images/icon/close12.gif alt=''></a>&nbsp;".sprintf(_AM_SF_IMPORT_FROM, $importFromModuleName).'</h3>';
115 115
     echo "<div id='bottomtable'>";
116
-    echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . _AM_SF_IMPORT_RESULT . '</span>';
116
+    echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">'._AM_SF_IMPORT_RESULT.'</span>';
117 117
 
118 118
     $cnt_imported_cat = 0;
119 119
     $cnt_imported_faq = 0;
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     echo "Can Comment: $cancomment<br>";
143 143
     echo "Auto aprove: $autoaprove<br>";*/
144 144
 
145
-    $resultCat = $xoopsDB->queryF('select * from ' . $xoopsDB->prefix('faqcategories') . " where catID in ($import_category_list) order by weight");
145
+    $resultCat = $xoopsDB->queryF('select * from '.$xoopsDB->prefix('faqcategories')." where catID in ($import_category_list) order by weight");
146 146
 
147 147
     while (false !== ($arrCat = $xoopsDB->fetchArray($resultCat))) {
148 148
         extract($arrCat, EXTR_PREFIX_ALL, 'wfc');
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
         $categoryObj->setVar('description', $wfc_description);
158 158
 
159 159
         if (!$categoryObj->store(false)) {
160
-            echo sprintf(_AM_SF_IMPORT_CATEGORY_ERROR, $xcat_name) . '<br>';
160
+            echo sprintf(_AM_SF_IMPORT_CATEGORY_ERROR, $xcat_name).'<br>';
161 161
             continue;
162 162
         }
163 163
 
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
 
166 166
         ++$cnt_imported_cat;
167 167
 
168
-        echo sprintf(_AM_SF_IMPORT_CATEGORY_SUCCESS, $wfc_name) . "<br\>";
168
+        echo sprintf(_AM_SF_IMPORT_CATEGORY_SUCCESS, $wfc_name)."<br\>";
169 169
 
170
-        $resultFAQ = $xoopsDB->queryF('select * from ' . $xoopsDB->prefix('faqtopics') . " where catID=$wfc_catID order by weight");
170
+        $resultFAQ = $xoopsDB->queryF('select * from '.$xoopsDB->prefix('faqtopics')." where catID=$wfc_catID order by weight");
171 171
         while (false !== ($arrFAQ = $xoopsDB->fetchArray($resultFAQ))) {
172 172
             extract($arrFAQ, EXTR_PREFIX_ALL, 'wft');
173 173
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
             $faqObj->setVar('exacturl', 0);
200 200
 
201 201
             if (!$faqObj->store(false)) {
202
-                echo sprintf('  ' . _AM_SF_IMPORT_FAQ_ERROR, $wft_question) . '<br>';
202
+                echo sprintf('  '._AM_SF_IMPORT_FAQ_ERROR, $wft_question).'<br>';
203 203
                 continue;
204 204
             } else {
205 205
                 $answerObj->setVar('faqid', $faqObj->faqid());
@@ -208,10 +208,10 @@  discard block
 block discarded – undo
208 208
                 $answerObj->setVar('status', Constants::SF_AN_STATUS_APPROVED);
209 209
 
210 210
                 if (!$answerObj->store()) {
211
-                    echo sprintf('  ' . _AM_SF_IMPORT_FAQ_ERROR) . '<br>';
211
+                    echo sprintf('  '._AM_SF_IMPORT_FAQ_ERROR).'<br>';
212 212
                     continue;
213 213
                 } else {
214
-                    echo '&nbsp;&nbsp;' . sprintf(_AM_SF_IMPORTED_QUESTION, $faqObj->question(50)) . '<br>';
214
+                    echo '&nbsp;&nbsp;'.sprintf(_AM_SF_IMPORTED_QUESTION, $faqObj->question(50)).'<br>';
215 215
                     ++$cnt_imported_faq;
216 216
                 }
217 217
             }
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
     }
222 222
 
223 223
     echo 'Done.<br>';
224
-    echo sprintf(_AM_SF_IMPORTED_CATEGORIES, $cnt_imported_cat) . '<br>';
225
-    echo sprintf(_AM_SF_IMPORTED_QUESTIONS, $cnt_imported_faq) . '<br>';
224
+    echo sprintf(_AM_SF_IMPORTED_CATEGORIES, $cnt_imported_cat).'<br>';
225
+    echo sprintf(_AM_SF_IMPORTED_QUESTIONS, $cnt_imported_faq).'<br>';
226 226
 
227 227
     exit();
228 228
 }
Please login to merge, or discard this patch.
include/searchform.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
     $searchcat = new \XoopsFormSelect(_MD_WB_CATEGORY, 'categoryID', $categoryID);
22 22
     $searchcat->addOption('0', _MD_WB_ALLOFTHEM);
23 23
 
24
-    $resultcat = $xoopsDB->queryF('SELECT categoryID, name FROM ' . $xoopsDB->prefix('wbcategories') . ' ORDER BY categoryID');
24
+    $resultcat = $xoopsDB->queryF('SELECT categoryID, name FROM '.$xoopsDB->prefix('wbcategories').' ORDER BY categoryID');
25 25
 
26 26
     while (false !== (list($categoryID, $name) = $xoopsDB->fetchRow($resultcat))) {
27 27
         $searchcat->addOption('categoryID', "$categoryID : $name");
Please login to merge, or discard this patch.
language/english/common.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -21,61 +21,61 @@
 block discarded – undo
21 21
 $moduleDirName      = basename(dirname(dirname(__DIR__)));
22 22
 $moduleDirNameUpper = strtoupper($moduleDirName);
23 23
 
24
-define('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS', 'GD library support: ');
25
-define('CO_' . $moduleDirNameUpper . '_GDLIBVERSION', 'GD Library version: ');
26
-define('CO_' . $moduleDirNameUpper . '_GDOFF', "<span style='font-weight: bold;'>Disabled</span> (No thumbnails available)");
27
-define('CO_' . $moduleDirNameUpper . '_GDON', "<span style='font-weight: bold;'>Enabled</span> (Thumbsnails available)");
28
-define('CO_' . $moduleDirNameUpper . '_IMAGEINFO', 'Server status');
29
-define('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE', 'Max post size permitted (post_max_size directive in php.ini): ');
30
-define('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE', 'Max upload size permitted (upload_max_filesize directive in php.ini): ');
31
-define('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT', 'Memory limit (memory_limit directive in php.ini): ');
32
-define('CO_' . $moduleDirNameUpper . '_METAVERSION', "<span style='font-weight: bold;'>Downloads meta version:</span> ");
33
-define('CO_' . $moduleDirNameUpper . '_OFF', "<span style='font-weight: bold;'>OFF</span>");
34
-define('CO_' . $moduleDirNameUpper . '_ON', "<span style='font-weight: bold;'>ON</span>");
35
-define('CO_' . $moduleDirNameUpper . '_SERVERPATH', 'Server path to XOOPS root: ');
36
-define('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS', 'Server uploads status: ');
37
-define('CO_' . $moduleDirNameUpper . '_SPHPINI', "<span style='font-weight: bold;'>Information taken from PHP ini file:</span>");
38
-define('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC', 'Note. Upload path *MUST* contain the full server path of your upload folder.');
24
+define('CO_'.$moduleDirNameUpper.'_GDLIBSTATUS', 'GD library support: ');
25
+define('CO_'.$moduleDirNameUpper.'_GDLIBVERSION', 'GD Library version: ');
26
+define('CO_'.$moduleDirNameUpper.'_GDOFF', "<span style='font-weight: bold;'>Disabled</span> (No thumbnails available)");
27
+define('CO_'.$moduleDirNameUpper.'_GDON', "<span style='font-weight: bold;'>Enabled</span> (Thumbsnails available)");
28
+define('CO_'.$moduleDirNameUpper.'_IMAGEINFO', 'Server status');
29
+define('CO_'.$moduleDirNameUpper.'_MAXPOSTSIZE', 'Max post size permitted (post_max_size directive in php.ini): ');
30
+define('CO_'.$moduleDirNameUpper.'_MAXUPLOADSIZE', 'Max upload size permitted (upload_max_filesize directive in php.ini): ');
31
+define('CO_'.$moduleDirNameUpper.'_MEMORYLIMIT', 'Memory limit (memory_limit directive in php.ini): ');
32
+define('CO_'.$moduleDirNameUpper.'_METAVERSION', "<span style='font-weight: bold;'>Downloads meta version:</span> ");
33
+define('CO_'.$moduleDirNameUpper.'_OFF', "<span style='font-weight: bold;'>OFF</span>");
34
+define('CO_'.$moduleDirNameUpper.'_ON', "<span style='font-weight: bold;'>ON</span>");
35
+define('CO_'.$moduleDirNameUpper.'_SERVERPATH', 'Server path to XOOPS root: ');
36
+define('CO_'.$moduleDirNameUpper.'_SERVERUPLOADSTATUS', 'Server uploads status: ');
37
+define('CO_'.$moduleDirNameUpper.'_SPHPINI', "<span style='font-weight: bold;'>Information taken from PHP ini file:</span>");
38
+define('CO_'.$moduleDirNameUpper.'_UPLOADPATHDSC', 'Note. Upload path *MUST* contain the full server path of your upload folder.');
39 39
 
40
-define('CO_' . $moduleDirNameUpper . '_PRINT', "<span style='font-weight: bold;'>Print</span>");
41
-define('CO_' . $moduleDirNameUpper . '_PDF', "<span style='font-weight: bold;'>Create PDF</span>");
40
+define('CO_'.$moduleDirNameUpper.'_PRINT', "<span style='font-weight: bold;'>Print</span>");
41
+define('CO_'.$moduleDirNameUpper.'_PDF', "<span style='font-weight: bold;'>Create PDF</span>");
42 42
 
43 43
 
44
-define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED0', "Update failed - couldn't rename field '%s'");
45
-define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED1', "Update failed - couldn't add new fields");
46
-define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED2', "Update failed - couldn't rename table '%s'");
47
-define('CO_' . $moduleDirNameUpper . '_ERROR_COLUMN', 'Could not create column in database : %s');
48
-define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS', 'This module requires XOOPS %s+ (%s installed)');
49
-define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP', 'This module requires PHP version %s+ (%s installed)');
50
-define('CO_' . $moduleDirNameUpper . '_ERROR_TAG_REMOVAL', 'Could not remove tags from Tag Module');
44
+define('CO_'.$moduleDirNameUpper.'_UPGRADEFAILED0', "Update failed - couldn't rename field '%s'");
45
+define('CO_'.$moduleDirNameUpper.'_UPGRADEFAILED1', "Update failed - couldn't add new fields");
46
+define('CO_'.$moduleDirNameUpper.'_UPGRADEFAILED2', "Update failed - couldn't rename table '%s'");
47
+define('CO_'.$moduleDirNameUpper.'_ERROR_COLUMN', 'Could not create column in database : %s');
48
+define('CO_'.$moduleDirNameUpper.'_ERROR_BAD_XOOPS', 'This module requires XOOPS %s+ (%s installed)');
49
+define('CO_'.$moduleDirNameUpper.'_ERROR_BAD_PHP', 'This module requires PHP version %s+ (%s installed)');
50
+define('CO_'.$moduleDirNameUpper.'_ERROR_TAG_REMOVAL', 'Could not remove tags from Tag Module');
51 51
 
52
-define('CO_' . $moduleDirNameUpper . '_FOLDERS_DELETED_OK', 'Upload Folders have been deleted');
52
+define('CO_'.$moduleDirNameUpper.'_FOLDERS_DELETED_OK', 'Upload Folders have been deleted');
53 53
 
54 54
 // Error Msgs
55
-define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH', 'Could not delete %s directory');
56
-define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_REMOVE', 'Could not delete %s');
57
-define('CO_' . $moduleDirNameUpper . '_ERROR_NO_PLUGIN', 'Could not load plugin');
55
+define('CO_'.$moduleDirNameUpper.'_ERROR_BAD_DEL_PATH', 'Could not delete %s directory');
56
+define('CO_'.$moduleDirNameUpper.'_ERROR_BAD_REMOVE', 'Could not delete %s');
57
+define('CO_'.$moduleDirNameUpper.'_ERROR_NO_PLUGIN', 'Could not load plugin');
58 58
 
59 59
 
60 60
 //Help
61
-define('CO_' . $moduleDirNameUpper . '_DIRNAME', basename(dirname(dirname(__DIR__))));
62
-define('CO_' . $moduleDirNameUpper . '_HELP_HEADER', __DIR__.'/help/helpheader.tpl');
63
-define('CO_' . $moduleDirNameUpper . '_BACK_2_ADMIN', 'Back to Administration of ');
64
-define('CO_' . $moduleDirNameUpper . '_OVERVIEW', 'Overview');
61
+define('CO_'.$moduleDirNameUpper.'_DIRNAME', basename(dirname(dirname(__DIR__))));
62
+define('CO_'.$moduleDirNameUpper.'_HELP_HEADER', __DIR__.'/help/helpheader.tpl');
63
+define('CO_'.$moduleDirNameUpper.'_BACK_2_ADMIN', 'Back to Administration of ');
64
+define('CO_'.$moduleDirNameUpper.'_OVERVIEW', 'Overview');
65 65
 
66 66
 //define('CO_' . $moduleDirNameUpper . '_HELP_DIR', __DIR__);
67 67
 
68 68
 //help multi-page
69
-define('CO_' . $moduleDirNameUpper . '_DISCLAIMER', 'Disclaimer');
70
-define('CO_' . $moduleDirNameUpper . '_LICENSE', 'License');
71
-define('CO_' . $moduleDirNameUpper . '_SUPPORT', 'Support');
69
+define('CO_'.$moduleDirNameUpper.'_DISCLAIMER', 'Disclaimer');
70
+define('CO_'.$moduleDirNameUpper.'_LICENSE', 'License');
71
+define('CO_'.$moduleDirNameUpper.'_SUPPORT', 'Support');
72 72
 
73 73
 //Sample Data
74
-define('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA', 'Import Sample Data (will delete ALL current data)');
75
-define('CO_' . $moduleDirNameUpper . '_' . 'SAMPLEDATA_SUCCESS', 'Sample Date uploaded successfully');
76
-define('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA', 'Export Tables to YAML');
77
-define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON', 'Show Sample Button?');
78
-define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC', 'If yes, the "Add Sample Data" button will be visible to the Admin. It is Yes as a default for first installation.');
79
-define('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA', 'Export DB Schema to YAML');
80
-define('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_SUCCESS', 'Export DB Schema to YAML was a success');
81
-define('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_ERROR', 'ERROR: Export of DB Schema to YAML failed');
74
+define('CO_'.$moduleDirNameUpper.'_'.'ADD_SAMPLEDATA', 'Import Sample Data (will delete ALL current data)');
75
+define('CO_'.$moduleDirNameUpper.'_'.'SAMPLEDATA_SUCCESS', 'Sample Date uploaded successfully');
76
+define('CO_'.$moduleDirNameUpper.'_'.'SAVE_SAMPLEDATA', 'Export Tables to YAML');
77
+define('CO_'.$moduleDirNameUpper.'_'.'SHOW_SAMPLE_BUTTON', 'Show Sample Button?');
78
+define('CO_'.$moduleDirNameUpper.'_'.'SHOW_SAMPLE_BUTTON_DESC', 'If yes, the "Add Sample Data" button will be visible to the Admin. It is Yes as a default for first installation.');
79
+define('CO_'.$moduleDirNameUpper.'_'.'EXPORT_SCHEMA', 'Export DB Schema to YAML');
80
+define('CO_'.$moduleDirNameUpper.'_'.'EXPORT_SCHEMA_SUCCESS', 'Export DB Schema to YAML was a success');
81
+define('CO_'.$moduleDirNameUpper.'_'.'EXPORT_SCHEMA_ERROR', 'ERROR: Export of DB Schema to YAML failed');
Please login to merge, or discard this patch.
admin/index.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 
20 20
 use XoopsModules\Smartfaq\Constants;
21 21
 
22
-require_once __DIR__ . '/../../../include/cp_header.php';
23
-require_once __DIR__ . '/admin_header.php';
22
+require_once __DIR__.'/../../../include/cp_header.php';
23
+require_once __DIR__.'/admin_header.php';
24 24
 
25 25
 xoops_cp_header();
26 26
 
@@ -76,34 +76,34 @@  discard block
 block discarded – undo
76 76
 $adminObject->addInfoBox(_AM_SF_INVENTORY);
77 77
 
78 78
 if ($totalcategories > 0) {
79
-    $adminObject->addInfoBoxLine(sprintf('<infolabel>' . '<a href="category.php">' . _AM_SF_TOTALCAT . '</a><b>' . '</infolabel>', $totalcategories), '', 'Green');
79
+    $adminObject->addInfoBoxLine(sprintf('<infolabel>'.'<a href="category.php">'._AM_SF_TOTALCAT.'</a><b>'.'</infolabel>', $totalcategories), '', 'Green');
80 80
 } else {
81
-    $adminObject->addInfoBoxLine(sprintf('<infolabel>' . _AM_SF_TOTALCAT . '</infolabel>', $totalcategories), '', 'Green');
81
+    $adminObject->addInfoBoxLine(sprintf('<infolabel>'._AM_SF_TOTALCAT.'</infolabel>', $totalcategories), '', 'Green');
82 82
 }
83 83
 if ($totalasked > 0) {
84
-    $adminObject->addInfoBoxLine(sprintf('<infolabel>' . '<a href="main.php">' . _AM_SF_TOTALASKED . '</a><b>' . '</infolabel>', $totalasked), '', 'Green');
84
+    $adminObject->addInfoBoxLine(sprintf('<infolabel>'.'<a href="main.php">'._AM_SF_TOTALASKED.'</a><b>'.'</infolabel>', $totalasked), '', 'Green');
85 85
 } else {
86
-    $adminObject->addInfoBoxLine(sprintf('<infolabel>' . _AM_SF_TOTALASKED . '</infolabel>', $totalasked), '', 'Green');
86
+    $adminObject->addInfoBoxLine(sprintf('<infolabel>'._AM_SF_TOTALASKED.'</infolabel>', $totalasked), '', 'Green');
87 87
 }
88 88
 if ($totalopened > 0) {
89
-    $adminObject->addInfoBoxLine(sprintf('<infolabel>' . '<a href="question.php">' . _AM_SF_TOTALOPENED . '</a><b>' . '</infolabel>', $totalopened), '', 'Red');
89
+    $adminObject->addInfoBoxLine(sprintf('<infolabel>'.'<a href="question.php">'._AM_SF_TOTALOPENED.'</a><b>'.'</infolabel>', $totalopened), '', 'Red');
90 90
 } else {
91
-    $adminObject->addInfoBoxLine(sprintf('<infolabel>' . _AM_SF_TOTALOPENED . '</infolabel>', $totalopened), '', 'Green');
91
+    $adminObject->addInfoBoxLine(sprintf('<infolabel>'._AM_SF_TOTALOPENED.'</infolabel>', $totalopened), '', 'Green');
92 92
 }
93 93
 if ($totalsubmitted > 0) {
94
-    $adminObject->addInfoBoxLine(sprintf('<infolabel>' . '<a href="category.php">' . _AM_SF_TOTALSUBMITTED . '</a><b>' . '</infolabel>', $totalsubmitted), '', 'Green');
94
+    $adminObject->addInfoBoxLine(sprintf('<infolabel>'.'<a href="category.php">'._AM_SF_TOTALSUBMITTED.'</a><b>'.'</infolabel>', $totalsubmitted), '', 'Green');
95 95
 } else {
96
-    $adminObject->addInfoBoxLine(sprintf('<infolabel>' . _AM_SF_TOTALSUBMITTED . '</infolabel>', $totalsubmitted), '', 'Green');
96
+    $adminObject->addInfoBoxLine(sprintf('<infolabel>'._AM_SF_TOTALSUBMITTED.'</infolabel>', $totalsubmitted), '', 'Green');
97 97
 }
98 98
 if ($totalpublished > 0) {
99
-    $adminObject->addInfoBoxLine(sprintf('<infolabel>' . '<a href="faq.php">' . _AM_SF_TOTALPUBLISHED . '</a><b>' . '</infolabel>', $totalpublished), '', 'Green');
99
+    $adminObject->addInfoBoxLine(sprintf('<infolabel>'.'<a href="faq.php">'._AM_SF_TOTALPUBLISHED.'</a><b>'.'</infolabel>', $totalpublished), '', 'Green');
100 100
 } else {
101
-    $adminObject->addInfoBoxLine(sprintf('<infolabel>' . _AM_SF_TOTALPUBLISHED . '</infolabel>', $totalpublished), '', 'Green');
101
+    $adminObject->addInfoBoxLine(sprintf('<infolabel>'._AM_SF_TOTALPUBLISHED.'</infolabel>', $totalpublished), '', 'Green');
102 102
 }
103 103
 if ($totalnewanswers > 0) {
104
-    $adminObject->addInfoBoxLine(sprintf('<infolabel>' . '<a href="main.php">' . _AM_SF_TOTALNEWANSWERS . '</a><b>' . '</infolabel>', $totalnewanswers), '', 'Red');
104
+    $adminObject->addInfoBoxLine(sprintf('<infolabel>'.'<a href="main.php">'._AM_SF_TOTALNEWANSWERS.'</a><b>'.'</infolabel>', $totalnewanswers), '', 'Red');
105 105
 } else {
106
-    $adminObject->addInfoBoxLine(sprintf('<infolabel>' . _AM_SF_TOTALNEWANSWERS . '</infolabel>', $totalnewanswers), '', 'Green');
106
+    $adminObject->addInfoBoxLine(sprintf('<infolabel>'._AM_SF_TOTALNEWANSWERS.'</infolabel>', $totalnewanswers), '', 'Green');
107 107
 }
108 108
 
109 109
 //----------------------
@@ -113,4 +113,4 @@  discard block
 block discarded – undo
113 113
 
114 114
 echo $utility::getServerStats();
115 115
 
116
-require_once __DIR__ . '/admin_footer.php';
116
+require_once __DIR__.'/admin_footer.php';
Please login to merge, or discard this patch.
submit.php 2 patches
Switch Indentation   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -54,153 +54,153 @@  discard block
 block discarded – undo
54 54
 }
55 55
 
56 56
 switch ($op) {
57
-    case 'preview':
57
+        case 'preview':
58 58
 
59
-        global $xoopsUser, $xoopsConfig, $xoopsModule,  $xoopsDB;
59
+            global $xoopsUser, $xoopsConfig, $xoopsModule,  $xoopsDB;
60 60
 
61
-        $faqObj      = $faqHandler->create();
62
-        $answerObj   = $answerHandler->create();
63
-        $categoryObj = $categoryHandler->get($_POST['categoryid']);
61
+            $faqObj      = $faqHandler->create();
62
+            $answerObj   = $answerHandler->create();
63
+            $categoryObj = $categoryHandler->get($_POST['categoryid']);
64 64
 
65
-        if (!$xoopsUser) {
66
-            if (1 == $helper->getConfig('anonpost')) {
67
-                $uid = 0;
65
+            if (!$xoopsUser) {
66
+                if (1 == $helper->getConfig('anonpost')) {
67
+                    $uid = 0;
68
+                } else {
69
+                    redirect_header('index.php', 3, _NOPERM);
70
+                }
68 71
             } else {
69
-                redirect_header('index.php', 3, _NOPERM);
72
+                $uid = $xoopsUser->uid();
70 73
             }
71
-        } else {
72
-            $uid = $xoopsUser->uid();
73
-        }
74 74
 
75
-        $notifypub = \Xmf\Request::getInt('notifypub', 0, POST);
75
+            $notifypub = \Xmf\Request::getInt('notifypub', 0, POST);
76 76
 
77
-        // Putting the values about the FAQ in the FAQ object
78
-        $faqObj->setVar('categoryid', $_POST['categoryid']);
79
-        $faqObj->setVar('uid', $uid);
80
-        $faqObj->setVar('question', $_POST['question']);
81
-        $faqObj->setVar('howdoi', $_POST['howdoi']);
82
-        $faqObj->setVar('diduno', $_POST['diduno']);
83
-        $faqObj->setVar('datesub', time());
77
+            // Putting the values about the FAQ in the FAQ object
78
+            $faqObj->setVar('categoryid', $_POST['categoryid']);
79
+            $faqObj->setVar('uid', $uid);
80
+            $faqObj->setVar('question', $_POST['question']);
81
+            $faqObj->setVar('howdoi', $_POST['howdoi']);
82
+            $faqObj->setVar('diduno', $_POST['diduno']);
83
+            $faqObj->setVar('datesub', time());
84 84
 
85
-        // Putting the values in the answer object
86
-        $answerObj->setVar('status', Constants::SF_AN_STATUS_APPROVED);
87
-        $answerObj->setVar('faqid', $faqObj->faqid());
88
-        $answerObj->setVar('answer', $_POST['answer']);
89
-        $answerObj->setVar('uid', $uid);
85
+            // Putting the values in the answer object
86
+            $answerObj->setVar('status', Constants::SF_AN_STATUS_APPROVED);
87
+            $answerObj->setVar('faqid', $faqObj->faqid());
88
+            $answerObj->setVar('answer', $_POST['answer']);
89
+            $answerObj->setVar('uid', $uid);
90 90
 
91
-        global $xoopsUser, $myts;
91
+            global $xoopsUser, $myts;
92 92
 
93
-        $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.tpl';
94
-        require_once XOOPS_ROOT_PATH . '/header.php';
95
-        require_once __DIR__ . '/footer.php';
93
+            $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.tpl';
94
+            require_once XOOPS_ROOT_PATH . '/header.php';
95
+            require_once __DIR__ . '/footer.php';
96 96
 
97
-        $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous';
97
+            $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous';
98 98
 
99
-        $moduleName          =& $myts->displayTarea($xoopsModule->getVar('name'));
100
-        $faq                 = $faqObj->toArray(null, $categoryObj, false);
101
-        $faq['categoryPath'] = $categoryObj->getCategoryPath(true);
102
-        $faq['answer']       = $answerObj->answer();
103
-        $faq['who_when']     = $faqObj->getWhoAndWhen();
99
+            $moduleName          =& $myts->displayTarea($xoopsModule->getVar('name'));
100
+            $faq                 = $faqObj->toArray(null, $categoryObj, false);
101
+            $faq['categoryPath'] = $categoryObj->getCategoryPath(true);
102
+            $faq['answer']       = $answerObj->answer();
103
+            $faq['who_when']     = $faqObj->getWhoAndWhen();
104 104
 
105
-        $faq['comments'] = -1;
106
-        $xoopsTpl->assign('faq', $faq);
107
-        $xoopsTpl->assign('op', 'preview');
108
-        $xoopsTpl->assign('whereInSection', $moduleName);
109
-        $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME);
105
+            $faq['comments'] = -1;
106
+            $xoopsTpl->assign('faq', $faq);
107
+            $xoopsTpl->assign('op', 'preview');
108
+            $xoopsTpl->assign('whereInSection', $moduleName);
109
+            $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME);
110 110
 
111
-        $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name())));
112
-        $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO);
111
+            $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name())));
112
+            $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO);
113 113
 
114
-        require_once __DIR__ . '/include/submit.inc.php';
114
+            require_once __DIR__ . '/include/submit.inc.php';
115 115
 
116
-        require_once XOOPS_ROOT_PATH . '/footer.php';
116
+            require_once XOOPS_ROOT_PATH . '/footer.php';
117 117
 
118
-        exit();
119
-        break;
118
+            exit();
119
+            break;
120 120
 
121
-    case 'post':
121
+        case 'post':
122 122
 
123
-        global $xoopsUser, $xoopsConfig, $xoopsModule,  $xoopsDB;
123
+            global $xoopsUser, $xoopsConfig, $xoopsModule,  $xoopsDB;
124 124
 
125
-        $newFaqObj    = $faqHandler->create();
126
-        $newAnswerObj = $answerHandler->create();
125
+            $newFaqObj    = $faqHandler->create();
126
+            $newAnswerObj = $answerHandler->create();
127 127
 
128
-        if (!$xoopsUser) {
129
-            if (1 == $helper->getConfig('anonpost')) {
130
-                $uid = 0;
128
+            if (!$xoopsUser) {
129
+                if (1 == $helper->getConfig('anonpost')) {
130
+                    $uid = 0;
131
+                } else {
132
+                    redirect_header('index.php', 3, _NOPERM);
133
+                }
131 134
             } else {
132
-                redirect_header('index.php', 3, _NOPERM);
135
+                $uid = $xoopsUser->uid();
133 136
             }
134
-        } else {
135
-            $uid = $xoopsUser->uid();
136
-        }
137
-
138
-        $notifypub = \Xmf\Request::getInt('notifypub', 0, POST);
139
-
140
-        // Putting the values about the FAQ in the FAQ object
141
-        $newFaqObj->setVar('categoryid', $_POST['categoryid']);
142
-        $newFaqObj->setVar('uid', $uid);
143
-        $newFaqObj->setVar('question', $_POST['question']);
144
-        $newFaqObj->setVar('howdoi', $_POST['howdoi']);
145
-        $newFaqObj->setVar('diduno', $_POST['diduno']);
146
-        $newFaqObj->setVar('notifypub', $notifypub);
147
-        //$newFaqObj->setVar('modulelink', $_POST['modulelink']);
148
-        //$newFaqObj->setVar('contextpage', $_POST['contextpage']);
149 137
 
150
-        // Setting the status of the FAQ
151
-
152
-        // if user is admin, FAQ are automatically published
153
-        $isAdmin = Smartfaq\Utility::userIsAdmin();
154
-        if ($isAdmin) {
155
-            $newFaqObj->setVar('status', Constants::SF_STATUS_PUBLISHED);
156
-        } elseif (1 == $helper->getConfig('autoapprove_submitted_faq')) {
157
-            $newFaqObj->setVar('status', Constants::SF_STATUS_PUBLISHED);
158
-        } else {
159
-            $newFaqObj->setVar('status', Constants::SF_STATUS_SUBMITTED);
160
-        }
138
+            $notifypub = \Xmf\Request::getInt('notifypub', 0, POST);
139
+
140
+            // Putting the values about the FAQ in the FAQ object
141
+            $newFaqObj->setVar('categoryid', $_POST['categoryid']);
142
+            $newFaqObj->setVar('uid', $uid);
143
+            $newFaqObj->setVar('question', $_POST['question']);
144
+            $newFaqObj->setVar('howdoi', $_POST['howdoi']);
145
+            $newFaqObj->setVar('diduno', $_POST['diduno']);
146
+            $newFaqObj->setVar('notifypub', $notifypub);
147
+            //$newFaqObj->setVar('modulelink', $_POST['modulelink']);
148
+            //$newFaqObj->setVar('contextpage', $_POST['contextpage']);
149
+
150
+            // Setting the status of the FAQ
151
+
152
+            // if user is admin, FAQ are automatically published
153
+            $isAdmin = Smartfaq\Utility::userIsAdmin();
154
+            if ($isAdmin) {
155
+                $newFaqObj->setVar('status', Constants::SF_STATUS_PUBLISHED);
156
+            } elseif (1 == $helper->getConfig('autoapprove_submitted_faq')) {
157
+                $newFaqObj->setVar('status', Constants::SF_STATUS_PUBLISHED);
158
+            } else {
159
+                $newFaqObj->setVar('status', Constants::SF_STATUS_SUBMITTED);
160
+            }
161 161
 
162
-        // Storing the FAQ object in the database
163
-        if (!$newFaqObj->store()) {
164
-            redirect_header('javascript:history.go(-1)', 2, _MD_SF_SUBMIT_ERROR);
165
-        }
162
+            // Storing the FAQ object in the database
163
+            if (!$newFaqObj->store()) {
164
+                redirect_header('javascript:history.go(-1)', 2, _MD_SF_SUBMIT_ERROR);
165
+            }
166 166
 
167
-        // Putting the values in the answer object
168
-        $newAnswerObj->setVar('status', Constants::SF_AN_STATUS_APPROVED);
169
-        $newAnswerObj->setVar('faqid', $newFaqObj->faqid());
170
-        $newAnswerObj->setVar('answer', $_POST['answer']);
171
-        $newAnswerObj->setVar('uid', $uid);
172
-
173
-        //====================================================================================
174
-        //TODO post Attachment
175
-        $attachments_tmp = [];
176
-        if (!empty($_POST['attachments_tmp'])) {
177
-            $attachments_tmp = unserialize(base64_decode($_POST['attachments_tmp']));
178
-            if (isset($_POST['delete_tmp']) && count($_POST['delete_tmp'])) {
179
-                foreach ($_POST['delete_tmp'] as $key) {
180
-                    unlink(XOOPS_ROOT_PATH . '/' . $helper->getConfig('dir_attachments') . '/' . $attachments_tmp[$key][0]);
181
-                    unset($attachments_tmp[$key]);
167
+            // Putting the values in the answer object
168
+            $newAnswerObj->setVar('status', Constants::SF_AN_STATUS_APPROVED);
169
+            $newAnswerObj->setVar('faqid', $newFaqObj->faqid());
170
+            $newAnswerObj->setVar('answer', $_POST['answer']);
171
+            $newAnswerObj->setVar('uid', $uid);
172
+
173
+            //====================================================================================
174
+            //TODO post Attachment
175
+            $attachments_tmp = [];
176
+            if (!empty($_POST['attachments_tmp'])) {
177
+                $attachments_tmp = unserialize(base64_decode($_POST['attachments_tmp']));
178
+                if (isset($_POST['delete_tmp']) && count($_POST['delete_tmp'])) {
179
+                    foreach ($_POST['delete_tmp'] as $key) {
180
+                        unlink(XOOPS_ROOT_PATH . '/' . $helper->getConfig('dir_attachments') . '/' . $attachments_tmp[$key][0]);
181
+                        unset($attachments_tmp[$key]);
182
+                    }
182 183
                 }
183 184
             }
184
-        }
185
-        if (count($attachments_tmp)) {
186
-            foreach ($attachments_tmp as $key => $attach) {
187
-                if (rename(XOOPS_CACHE_PATH . '/' . $attachments_tmp[$key][0], XOOPS_ROOT_PATH . '/' . $helper->getConfig('dir_attachments') . '/' . $attachments_tmp[$key][0])) {
188
-                    $post_obj->setAttachment($attach[0], $attach[1], $attach[2]);
185
+            if (count($attachments_tmp)) {
186
+                foreach ($attachments_tmp as $key => $attach) {
187
+                    if (rename(XOOPS_CACHE_PATH . '/' . $attachments_tmp[$key][0], XOOPS_ROOT_PATH . '/' . $helper->getConfig('dir_attachments') . '/' . $attachments_tmp[$key][0])) {
188
+                        $post_obj->setAttachment($attach[0], $attach[1], $attach[2]);
189
+                    }
189 190
                 }
190 191
             }
191
-        }
192
-        $error_upload = '';
192
+            $error_upload = '';
193 193
 
194
-        if (isset($_FILES['userfile']['name']) && '' != $_FILES['userfile']['name']
195
-            && $topicHandler->getPermission($forum_obj, $topic_status, 'attach')) {
196
-            require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/uploader.php';
197
-            $maxfilesize = $forum_obj->getVar('attach_maxkb') * 1024;
198
-            $uploaddir   = XOOPS_CACHE_PATH;
194
+            if (isset($_FILES['userfile']['name']) && '' != $_FILES['userfile']['name']
195
+                && $topicHandler->getPermission($forum_obj, $topic_status, 'attach')) {
196
+                require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/uploader.php';
197
+                $maxfilesize = $forum_obj->getVar('attach_maxkb') * 1024;
198
+                $uploaddir   = XOOPS_CACHE_PATH;
199 199
 
200
-            $uploader = new Smartfaq\Uploader($uploaddir, $newAnswerObj->getVar('attach_ext'), (int)$maxfilesize, (int)$helper->getConfig('max_img_width'), (int)$helper->getConfig('max_img_height'));
200
+                $uploader = new Smartfaq\Uploader($uploaddir, $newAnswerObj->getVar('attach_ext'), (int)$maxfilesize, (int)$helper->getConfig('max_img_width'), (int)$helper->getConfig('max_img_height'));
201 201
 
202
-            if ($_FILES['userfile']['error'] > 0) {
203
-                switch ($_FILES['userfile']['error']) {
202
+                if ($_FILES['userfile']['error'] > 0) {
203
+                    switch ($_FILES['userfile']['error']) {
204 204
                     case 1:
205 205
                         $error_message[] = _MD_NEWBB_MAXUPLOADFILEINI;
206 206
                         break;
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
                     default:
211 211
                         $error_message[] = _MD_NEWBB_UPLOAD_ERRNODEF;
212 212
                         break;
213
-                }
213
+                    }
214 214
             } else {
215 215
                 $uploader->setCheckMediaTypeByExt();
216 216
 
@@ -273,30 +273,30 @@  discard block
 block discarded – undo
273 273
         redirect_header('index.php', 2, $redirect_msg);
274 274
         break;
275 275
 
276
-    case 'form':
277
-    default:
276
+        case 'form':
277
+        default:
278 278
 
279
-        global $xoopsUser, $myts;
279
+            global $xoopsUser, $myts;
280 280
 
281
-        $faqObj      = $faqHandler->create();
282
-        $answerObj   = $answerHandler->create();
283
-        $categoryObj = $categoryHandler->create();
281
+            $faqObj      = $faqHandler->create();
282
+            $answerObj   = $answerHandler->create();
283
+            $categoryObj = $categoryHandler->create();
284 284
 
285
-        $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.tpl';
286
-        require_once XOOPS_ROOT_PATH . '/header.php';
287
-        require_once __DIR__ . '/footer.php';
285
+            $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.tpl';
286
+            require_once XOOPS_ROOT_PATH . '/header.php';
287
+            require_once __DIR__ . '/footer.php';
288 288
 
289
-        $name       = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous';
290
-        $notifypub  = 1;
291
-        $moduleName =& $myts->displayTarea($xoopsModule->getVar('name'));
292
-        $xoopsTpl->assign('whereInSection', $moduleName);
293
-        $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME);
289
+            $name       = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous';
290
+            $notifypub  = 1;
291
+            $moduleName =& $myts->displayTarea($xoopsModule->getVar('name'));
292
+            $xoopsTpl->assign('whereInSection', $moduleName);
293
+            $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME);
294 294
 
295
-        $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name())));
296
-        $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO);
295
+            $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name())));
296
+            $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO);
297 297
 
298
-        require_once __DIR__ . '/include/submit.inc.php';
298
+            require_once __DIR__ . '/include/submit.inc.php';
299 299
 
300
-        require_once XOOPS_ROOT_PATH . '/footer.php';
301
-        break;
300
+            require_once XOOPS_ROOT_PATH . '/footer.php';
301
+            break;
302 302
 }
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 use XoopsModules\Smartfaq;
10 10
 use XoopsModules\Smartfaq\Constants;
11 11
 
12
-require_once __DIR__ . '/header.php';
12
+require_once __DIR__.'/header.php';
13 13
 
14 14
 global $xoopsUser, $xoopsConfig, $xoopsModule;
15 15
 /** @var Smartfaq\Helper $helper */
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 switch ($op) {
57 57
     case 'preview':
58 58
 
59
-        global $xoopsUser, $xoopsConfig, $xoopsModule,  $xoopsDB;
59
+        global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsDB;
60 60
 
61 61
         $faqObj      = $faqHandler->create();
62 62
         $answerObj   = $answerHandler->create();
@@ -91,12 +91,12 @@  discard block
 block discarded – undo
91 91
         global $xoopsUser, $myts;
92 92
 
93 93
         $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.tpl';
94
-        require_once XOOPS_ROOT_PATH . '/header.php';
95
-        require_once __DIR__ . '/footer.php';
94
+        require_once XOOPS_ROOT_PATH.'/header.php';
95
+        require_once __DIR__.'/footer.php';
96 96
 
97 97
         $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous';
98 98
 
99
-        $moduleName          =& $myts->displayTarea($xoopsModule->getVar('name'));
99
+        $moduleName          = & $myts->displayTarea($xoopsModule->getVar('name'));
100 100
         $faq                 = $faqObj->toArray(null, $categoryObj, false);
101 101
         $faq['categoryPath'] = $categoryObj->getCategoryPath(true);
102 102
         $faq['answer']       = $answerObj->answer();
@@ -109,18 +109,18 @@  discard block
 block discarded – undo
109 109
         $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME);
110 110
 
111 111
         $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name())));
112
-        $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO);
112
+        $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY."<b>$name</b>, "._MD_SF_SUB_INTRO);
113 113
 
114
-        require_once __DIR__ . '/include/submit.inc.php';
114
+        require_once __DIR__.'/include/submit.inc.php';
115 115
 
116
-        require_once XOOPS_ROOT_PATH . '/footer.php';
116
+        require_once XOOPS_ROOT_PATH.'/footer.php';
117 117
 
118 118
         exit();
119 119
         break;
120 120
 
121 121
     case 'post':
122 122
 
123
-        global $xoopsUser, $xoopsConfig, $xoopsModule,  $xoopsDB;
123
+        global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsDB;
124 124
 
125 125
         $newFaqObj    = $faqHandler->create();
126 126
         $newAnswerObj = $answerHandler->create();
@@ -177,14 +177,14 @@  discard block
 block discarded – undo
177 177
             $attachments_tmp = unserialize(base64_decode($_POST['attachments_tmp']));
178 178
             if (isset($_POST['delete_tmp']) && count($_POST['delete_tmp'])) {
179 179
                 foreach ($_POST['delete_tmp'] as $key) {
180
-                    unlink(XOOPS_ROOT_PATH . '/' . $helper->getConfig('dir_attachments') . '/' . $attachments_tmp[$key][0]);
180
+                    unlink(XOOPS_ROOT_PATH.'/'.$helper->getConfig('dir_attachments').'/'.$attachments_tmp[$key][0]);
181 181
                     unset($attachments_tmp[$key]);
182 182
                 }
183 183
             }
184 184
         }
185 185
         if (count($attachments_tmp)) {
186 186
             foreach ($attachments_tmp as $key => $attach) {
187
-                if (rename(XOOPS_CACHE_PATH . '/' . $attachments_tmp[$key][0], XOOPS_ROOT_PATH . '/' . $helper->getConfig('dir_attachments') . '/' . $attachments_tmp[$key][0])) {
187
+                if (rename(XOOPS_CACHE_PATH.'/'.$attachments_tmp[$key][0], XOOPS_ROOT_PATH.'/'.$helper->getConfig('dir_attachments').'/'.$attachments_tmp[$key][0])) {
188 188
                     $post_obj->setAttachment($attach[0], $attach[1], $attach[2]);
189 189
                 }
190 190
             }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 
194 194
         if (isset($_FILES['userfile']['name']) && '' != $_FILES['userfile']['name']
195 195
             && $topicHandler->getPermission($forum_obj, $topic_status, 'attach')) {
196
-            require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/uploader.php';
196
+            require_once XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname', 'n').'/class/uploader.php';
197 197
             $maxfilesize = $forum_obj->getVar('attach_maxkb') * 1024;
198 198
             $uploaddir   = XOOPS_CACHE_PATH;
199 199
 
@@ -215,19 +215,19 @@  discard block
 block discarded – undo
215 215
                 $uploader->setCheckMediaTypeByExt();
216 216
 
217 217
                 if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
218
-                    $prefix = is_object($xoopsUser) ? (string)$xoopsUser->uid() . '_' : 'newbb_';
218
+                    $prefix = is_object($xoopsUser) ? (string)$xoopsUser->uid().'_' : 'newbb_';
219 219
                     $uploader->setPrefix($prefix);
220 220
                     if (!$uploader->upload()) {
221
-                        $error_message[] = $error_upload =& $uploader->getErrors();
221
+                        $error_message[] = $error_upload = & $uploader->getErrors();
222 222
                     } else {
223 223
                         if (is_file($uploader->getSavedDestination())) {
224
-                            if (rename(XOOPS_CACHE_PATH . '/' . $uploader->getSavedFileName(), XOOPS_ROOT_PATH . '/' . $helper->getConfig('dir_attachments') . '/' . $uploader->getSavedFileName())) {
224
+                            if (rename(XOOPS_CACHE_PATH.'/'.$uploader->getSavedFileName(), XOOPS_ROOT_PATH.'/'.$helper->getConfig('dir_attachments').'/'.$uploader->getSavedFileName())) {
225 225
                                 $post_obj->setAttachment($uploader->getSavedFileName(), $uploader->getMediaName(), $uploader->getMediaType());
226 226
                             }
227 227
                         }
228 228
                     }
229 229
                 } else {
230
-                    $error_message[] = $error_upload =& $uploader->getErrors();
230
+                    $error_message[] = $error_upload = & $uploader->getErrors();
231 231
                 }
232 232
             }
233 233
         }
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
         } else {
261 261
             // Subscribe the user to On Published notification, if requested
262 262
             if (1 == $notifypub) {
263
-                require_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
263
+                require_once XOOPS_ROOT_PATH.'/include/notification_constants.php';
264 264
                 $notificationHandler = xoops_getHandler('notification');
265 265
                 $notificationHandler->subscribe('faq', $newFaqObj->faqid(), 'approved', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE);
266 266
             }
@@ -283,20 +283,20 @@  discard block
 block discarded – undo
283 283
         $categoryObj = $categoryHandler->create();
284 284
 
285 285
         $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.tpl';
286
-        require_once XOOPS_ROOT_PATH . '/header.php';
287
-        require_once __DIR__ . '/footer.php';
286
+        require_once XOOPS_ROOT_PATH.'/header.php';
287
+        require_once __DIR__.'/footer.php';
288 288
 
289 289
         $name       = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous';
290 290
         $notifypub  = 1;
291
-        $moduleName =& $myts->displayTarea($xoopsModule->getVar('name'));
291
+        $moduleName = & $myts->displayTarea($xoopsModule->getVar('name'));
292 292
         $xoopsTpl->assign('whereInSection', $moduleName);
293 293
         $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME);
294 294
 
295 295
         $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name())));
296
-        $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO);
296
+        $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY."<b>$name</b>, "._MD_SF_SUB_INTRO);
297 297
 
298
-        require_once __DIR__ . '/include/submit.inc.php';
298
+        require_once __DIR__.'/include/submit.inc.php';
299 299
 
300
-        require_once XOOPS_ROOT_PATH . '/footer.php';
300
+        require_once XOOPS_ROOT_PATH.'/footer.php';
301 301
         break;
302 302
 }
Please login to merge, or discard this patch.
category.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 /** @var Smartfaq\Helper $helper */
11 11
 $helper = Smartfaq\Helper::getInstance();
12 12
 
13
-require_once __DIR__ . '/header.php';
13
+require_once __DIR__.'/header.php';
14 14
 
15 15
 $categoryid = \Xmf\Request::getInt('categoryid', 0, 'GET');
16 16
 
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 }
38 38
 $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_category.tpl';
39 39
 
40
-require_once XOOPS_ROOT_PATH . '/header.php';
41
-require_once __DIR__ . '/footer.php';
40
+require_once XOOPS_ROOT_PATH.'/header.php';
41
+require_once __DIR__.'/footer.php';
42 42
 
43 43
 // At which record shall we start
44 44
 $start = \Xmf\Request::getInt('start', 0, 'GET');
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 }
79 79
 $lastfaqsize = (int)$helper->getConfig('lastfaqsize');
80 80
 // Creating the sub-categories objects that belong to the selected category
81
-$subcatsObj    =& $categoryHandler->getCategories(0, 0, $categoryid);
81
+$subcatsObj    = & $categoryHandler->getCategories(0, 0, $categoryid);
82 82
 $total_subcats = count($subcatsObj);
83 83
 $total_faqs    = 0;
84 84
 if (0 != $total_subcats) {
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
         if (isset($totalQnas[$subcat_id]) && $totalQnas[$subcat_id] > 0) {
89 89
             if (isset($last_qnaObj[$subcat_id])) {
90 90
                 $subcatsObj[$i]->setVar('last_faqid', $last_qnaObj[$subcat_id]->getVar('faqid'));
91
-                $subcatsObj[$i]->setVar('last_question_link', "<a href='faq.php?faqid=" . $last_qnaObj[$subcat_id]->getVar('faqid') . "'>" . $last_qnaObj[$subcat_id]->question($lastfaqsize) . '</a>');
91
+                $subcatsObj[$i]->setVar('last_question_link', "<a href='faq.php?faqid=".$last_qnaObj[$subcat_id]->getVar('faqid')."'>".$last_qnaObj[$subcat_id]->question($lastfaqsize).'</a>');
92 92
             }
93 93
         }
94 94
         $subcatsObj[$i]->setVar('faqcount', $totalQnas[$subcat_id]);
95 95
         $subcats[$subcat_id] = $subcatsObj[$i]->toArray();
96
-        $total_faqs          += $totalQnas[$subcat_id];
96
+        $total_faqs += $totalQnas[$subcat_id];
97 97
         //}replacé ligne 92
98 98
     }
99 99
     $xoopsTpl->assign('subcats', $subcats);
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     }
117 117
 
118 118
     $memberHandler = xoops_getHandler('member');
119
-    $users         = $memberHandler->getUsers(new \Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN'), true);
119
+    $users         = $memberHandler->getUsers(new \Criteria('uid', '('.implode(',', array_keys($userids)).')', 'IN'), true);
120 120
     // Adding the Q&As of the selected category
121 121
     foreach ($faqsObj as $iValue) {
122 122
         $faq = $iValue->toArray(null, $categoryObj);
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 
143 143
     if (isset($last_qnaObj) && $last_qnaObj) {
144 144
         $category['last_faqid']         = $last_qnaObj[$categoryObj->getVar('categoryid')]->getVar('faqid');
145
-        $category['last_question_link'] = "<a href='faq.php?faqid=" . $last_qnaObj[$categoryObj->getVar('categoryid')]->getVar('faqid') . "'>" . $last_qnaObj[$categoryObj->getVar('categoryid')]->question($lastfaqsize) . '</a>';
145
+        $category['last_question_link'] = "<a href='faq.php?faqid=".$last_qnaObj[$categoryObj->getVar('categoryid')]->getVar('faqid')."'>".$last_qnaObj[$categoryObj->getVar('categoryid')]->question($lastfaqsize).'</a>';
146 146
     }
147 147
 }
148 148
 
@@ -167,26 +167,26 @@  discard block
 block discarded – undo
167 167
 $xoopsTpl->assign('lang_comments', _MD_SF_COMMENTS);
168 168
 
169 169
 // The Navigation Bar
170
-require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
171
-$pagenav = new \XoopsPageNav($thiscategory_faqcount, $helper->getConfig('indexperpage'), $start, 'start', 'categoryid=' . $categoryObj->getVar('categoryid'));
170
+require_once XOOPS_ROOT_PATH.'/class/pagenav.php';
171
+$pagenav = new \XoopsPageNav($thiscategory_faqcount, $helper->getConfig('indexperpage'), $start, 'start', 'categoryid='.$categoryObj->getVar('categoryid'));
172 172
 if (1 == $helper->getConfig('useimagenavpage')) {
173
-    $xoopsTpl->assign('navbar', '<div style="text-align:right;">' . $pagenav->renderImageNav() . '</div>');
173
+    $xoopsTpl->assign('navbar', '<div style="text-align:right;">'.$pagenav->renderImageNav().'</div>');
174 174
 } else {
175
-    $xoopsTpl->assign('navbar', '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>');
175
+    $xoopsTpl->assign('navbar', '<div style="text-align:right;">'.$pagenav->renderNav().'</div>');
176 176
 }
177 177
 
178 178
 $xoopsTpl->assign('category', $category);
179 179
 
180 180
 // Page Title Hack by marcan
181 181
 $module_name = $myts->htmlSpecialChars($xoopsModule->getVar('name'));
182
-$xoopsTpl->assign('xoops_pagetitle', $module_name . ' - ' . $category['name']);
182
+$xoopsTpl->assign('xoops_pagetitle', $module_name.' - '.$category['name']);
183 183
 // End Page Title Hack by marcan
184 184
 
185 185
 //code to include smartie
186
-if (file_exists(XOOPS_ROOT_PATH . '/modules/smarttie/smarttie_links.php')) {
187
-    require_once XOOPS_ROOT_PATH . '/modules/smarttie/smarttie_links.php';
186
+if (file_exists(XOOPS_ROOT_PATH.'/modules/smarttie/smarttie_links.php')) {
187
+    require_once XOOPS_ROOT_PATH.'/modules/smarttie/smarttie_links.php';
188 188
     $xoopsTpl->assign('smarttie', 1);
189 189
 }
190 190
 //end code for smarttie
191 191
 
192
-require_once XOOPS_ROOT_PATH . '/footer.php';
192
+require_once XOOPS_ROOT_PATH.'/footer.php';
Please login to merge, or discard this patch.