Completed
Push — master ( 48b96e...454ebd )
by Michael
02:08
created
index.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@  discard block
 block discarded – undo
5 5
  * Author: The SmartFactory <www.smartfactory.ca>
6 6
  * Licence: GNU
7 7
  */
8
-require_once __DIR__ . '/header.php';
8
+require_once __DIR__.'/header.php';
9 9
 
10 10
 // At which record shall we start for the Categories
11
-$catstart = isset($_GET['catstart']) ? (int)$_GET['catstart'] : 0;
11
+$catstart = isset($_GET['catstart']) ? (int) $_GET['catstart'] : 0;
12 12
 
13 13
 // At which record shall we start for the FAQ
14
-$start = isset($_GET['start']) ? (int)$_GET['start'] : 0;
14
+$start = isset($_GET['start']) ? (int) $_GET['start'] : 0;
15 15
 
16 16
 // Creating the category handler object
17 17
 $categoryHandler = sf_gethandler('category');
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 
37 37
 $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_index.tpl';
38 38
 
39
-require_once XOOPS_ROOT_PATH . '/header.php';
40
-require_once __DIR__ . '/footer.php';
39
+require_once XOOPS_ROOT_PATH.'/header.php';
40
+require_once __DIR__.'/footer.php';
41 41
 
42 42
 // Creating the categories objects
43 43
 $categoriesObj = $categoryHandler->getCategories($xoopsModuleConfig['catperpage'], $catstart);
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     // Get the last smartfaq in each category
61 61
     $last_qnaObj = $faqHandler->getLastPublishedByCat();
62 62
 }
63
-$lastfaqsize = (int)$xoopsModuleConfig['lastfaqsize'];
63
+$lastfaqsize = (int) $xoopsModuleConfig['lastfaqsize'];
64 64
 $categories  = [];
65 65
 foreach ($categoriesObj as $cat_id => $category) {
66 66
     $total = 0;
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
             if (isset($totalQnas[$subcat_id]) && $totalQnas[$subcat_id] > 0) {
71 71
                 if (isset($last_qnaObj[$subcat_id])) {
72 72
                     $subcat->setVar('last_faqid', $last_qnaObj[$subcat_id]->getVar('faqid'));
73
-                    $subcat->setVar('last_question_link', "<a href='faq.php?faqid=" . $last_qnaObj[$subcat_id]->getVar('faqid') . "'>" . $last_qnaObj[$subcat_id]->question($lastfaqsize) . '</a>');
73
+                    $subcat->setVar('last_question_link', "<a href='faq.php?faqid=".$last_qnaObj[$subcat_id]->getVar('faqid')."'>".$last_qnaObj[$subcat_id]->question($lastfaqsize).'</a>');
74 74
                 }
75 75
                 $subcat->setVar('faqcount', $totalQnas[$subcat_id]);
76 76
                 if ($xoopsModuleConfig['displaysubcatonindex']) {
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     if ($total > 0) {
89 89
         if (isset($last_qnaObj[$cat_id])) {
90 90
             $category->setVar('last_faqid', $last_qnaObj[$cat_id]->getVar('faqid'));
91
-            $category->setVar('last_question_link', "<a href='faq.php?faqid=" . $last_qnaObj[$cat_id]->getVar('faqid') . "'>" . $last_qnaObj[$cat_id]->question($lastfaqsize) . '</a>');
91
+            $category->setVar('last_question_link', "<a href='faq.php?faqid=".$last_qnaObj[$cat_id]->getVar('faqid')."'>".$last_qnaObj[$cat_id]->question($lastfaqsize).'</a>');
92 92
         }
93 93
         $category->setVar('faqcount', $total);
94 94
         if (!isset($categories[$cat_id])) {
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         }
127 127
 
128 128
         $memberHandler = xoops_getHandler('member');
129
-        $users         = $memberHandler->getUsers(new Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN'), true);
129
+        $users         = $memberHandler->getUsers(new Criteria('uid', '('.implode(',', array_keys($userids)).')', 'IN'), true);
130 130
         for ($i = 0; $i < $totalQnasOnPage; ++$i) {
131 131
             $faq = $faqsObj[$i]->toArray(null, $allcategories);
132 132
 
@@ -152,14 +152,14 @@  discard block
 block discarded – undo
152 152
 }
153 153
 
154 154
 // Language constants
155
-$moduleName =& $myts->displayTarea($xoopsModule->getVar('name'));
155
+$moduleName = & $myts->displayTarea($xoopsModule->getVar('name'));
156 156
 $xoopsTpl->assign('whereInSection', $moduleName);
157 157
 $xoopsTpl->assign('displaysubcatonindex', $xoopsModuleConfig['displaysubcatonindex']);
158 158
 $xoopsTpl->assign('displaylastfaqs', $xoopsModuleConfig['displaylastfaqs']);
159 159
 $xoopsTpl->assign('display_categoryname', true);
160 160
 $xoopsTpl->assign('displayFull', 'full' === $xoopsModuleConfig['displaytype']);
161 161
 
162
-$xoopsTpl->assign('lang_mainhead', _MD_SF_MAINHEAD . ' ' . $moduleName);
162
+$xoopsTpl->assign('lang_mainhead', _MD_SF_MAINHEAD.' '.$moduleName);
163 163
 $xoopsTpl->assign('lang_mainintro', $myts->displayTarea($xoopsModuleConfig['indexwelcomemsg'], 1));
164 164
 $xoopsTpl->assign('lang_total', _MD_SF_TOTAL_SMARTFAQS);
165 165
 $xoopsTpl->assign('lang_home', _MD_SF_HOME);
@@ -178,20 +178,20 @@  discard block
 block discarded – undo
178 178
 $xoopsTpl->assign('lang_comments', _MD_SF_COMMENTS);
179 179
 
180 180
 // Category Navigation Bar
181
-require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
181
+require_once XOOPS_ROOT_PATH.'/class/pagenav.php';
182 182
 $pagenav = new XoopsPageNav($totalCategories, $xoopsModuleConfig['catperpage'], $catstart, 'catstart', '');
183 183
 if (1 == $xoopsModuleConfig['useimagenavpage']) {
184
-    $xoopsTpl->assign('catnavbar', '<div style="text-align:right;">' . $pagenav->renderImageNav() . '</div>');
184
+    $xoopsTpl->assign('catnavbar', '<div style="text-align:right;">'.$pagenav->renderImageNav().'</div>');
185 185
 } else {
186
-    $xoopsTpl->assign('catnavbar', '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>');
186
+    $xoopsTpl->assign('catnavbar', '<div style="text-align:right;">'.$pagenav->renderNav().'</div>');
187 187
 }
188 188
 
189 189
 // FAQ Navigation Bar
190 190
 $pagenav = new XoopsPageNav($totalFaqs, $xoopsModuleConfig['indexperpage'], $start, 'start', '');
191 191
 if (1 == $xoopsModuleConfig['useimagenavpage']) {
192
-    $xoopsTpl->assign('navbar', '<div style="text-align:right;">' . $pagenav->renderImageNav() . '</div>');
192
+    $xoopsTpl->assign('navbar', '<div style="text-align:right;">'.$pagenav->renderImageNav().'</div>');
193 193
 } else {
194
-    $xoopsTpl->assign('navbar', '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>');
194
+    $xoopsTpl->assign('navbar', '<div style="text-align:right;">'.$pagenav->renderNav().'</div>');
195 195
 }
196 196
 
197 197
 // Page Title Hack by marcan
@@ -199,4 +199,4 @@  discard block
 block discarded – undo
199 199
 $xoopsTpl->assign('xoops_pagetitle', $module_name);
200 200
 // End Page Title Hack by marcan
201 201
 
202
-require_once XOOPS_ROOT_PATH . '/footer.php';
202
+require_once XOOPS_ROOT_PATH.'/footer.php';
Please login to merge, or discard this patch.
class/smartdbupdater.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     //Verifies that a MySQL table exists
17 17
     $xoopsDB  = XoopsDatabaseFactory::getDatabaseConnection();
18 18
     $realname = $xoopsDB->prefix($table);
19
-    $sql      = 'SHOW TABLES FROM ' . XOOPS_DB_NAME;
19
+    $sql      = 'SHOW TABLES FROM '.XOOPS_DB_NAME;
20 20
     $ret      = $xoopsDB->queryF($sql);
21 21
     while (list($m_table) = $xoopsDB->fetchRow($ret)) {
22 22
         if ($m_table == $realname) {
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
  * Include the language constants for the SmartObjectDBUpdater
54 54
  */
55 55
 global $xoopsConfig;
56
-$common_file = XOOPS_ROOT_PATH . '/modules/smartfaq/language/' . $xoopsConfig['language'] . '/smartdbupdater.php';
56
+$common_file = XOOPS_ROOT_PATH.'/modules/smartfaq/language/'.$xoopsConfig['language'].'/smartdbupdater.php';
57 57
 if (!file_exists($common_file)) {
58
-    $common_file = XOOPS_ROOT_PATH . '/modules/smartfaq/language/english/smartdbupdater.php';
58
+    $common_file = XOOPS_ROOT_PATH.'/modules/smartfaq/language/english/smartdbupdater.php';
59 59
 }
60 60
 
61 61
 include $common_file;
@@ -152,14 +152,14 @@  discard block
 block discarded – undo
152 152
     public function getExistingFieldsArray()
153 153
     {
154 154
         global $xoopsDB;
155
-        $result = $xoopsDB->queryF('SHOW COLUMNS FROM ' . $this->name());
155
+        $result = $xoopsDB->queryF('SHOW COLUMNS FROM '.$this->name());
156 156
         while ($existing_field = $xoopsDB->fetchArray($result)) {
157 157
             $fields[$existing_field['Field']] = $existing_field['Type'];
158 158
             if ('YES' !== $existing_field['Null']) {
159 159
                 $fields[$existing_field['Field']] .= ' NOT NULL';
160 160
             }
161 161
             if ($existing_field['Extra']) {
162
-                $fields[$existing_field['Field']] .= ' ' . $existing_field['Extra'];
162
+                $fields[$existing_field['Field']] .= ' '.$existing_field['Extra'];
163 163
             }
164 164
         }
165 165
 
@@ -235,9 +235,9 @@  discard block
 block discarded – undo
235 235
             $query = sprintf('INSERT INTO "%s" VALUES ("%s")', $this->name(), $data);
236 236
             $ret   = $xoopsDB->queryF($query);
237 237
             if (!$ret) {
238
-                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_ADD_DATA_ERR, $this->name()) . '<br>';
238
+                echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_ADD_DATA_ERR, $this->name()).'<br>';
239 239
             } else {
240
-                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_ADD_DATA, $this->name()) . '<br>';
240
+                echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_ADD_DATA, $this->name()).'<br>';
241 241
             }
242 242
         }
243 243
 
@@ -402,9 +402,9 @@  discard block
 block discarded – undo
402 402
 
403 403
         $ret = $xoopsDB->queryF($query);
404 404
         if (!$ret) {
405
-            echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_CREATE_TABLE_ERR, $this->name()) . '<br>';
405
+            echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_CREATE_TABLE_ERR, $this->name()).'<br>';
406 406
         } else {
407
-            echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_CREATE_TABLE, $this->name()) . '<br>';
407
+            echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_CREATE_TABLE, $this->name()).'<br>';
408 408
         }
409 409
 
410 410
         return $ret;
@@ -423,11 +423,11 @@  discard block
 block discarded – undo
423 423
         $query = sprintf('DROP TABLE %s', $this->name());
424 424
         $ret   = $xoopsDB->queryF($query);
425 425
         if (!$ret) {
426
-            echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_DROP_TABLE_ERR, $this->name()) . '<br>';
426
+            echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_DROP_TABLE_ERR, $this->name()).'<br>';
427 427
 
428 428
             return false;
429 429
         } else {
430
-            echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_DROP_TABLE, $this->name()) . '<br>';
430
+            echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_DROP_TABLE, $this->name()).'<br>';
431 431
 
432 432
             return true;
433 433
         }
@@ -451,9 +451,9 @@  discard block
 block discarded – undo
451 451
             $ret = $ret && $xoopsDB->queryF($query);
452 452
             if ($alteredField['showerror']) {
453 453
                 if (!$ret) {
454
-                    echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_CHGFIELD_ERR, $alteredField['name'], $this->name()) . '<br>';
454
+                    echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_CHGFIELD_ERR, $alteredField['name'], $this->name()).'<br>';
455 455
                 } else {
456
-                    echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_CHGFIELD, $alteredField['name'], $this->name()) . '<br>';
456
+                    echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_CHGFIELD, $alteredField['name'], $this->name()).'<br>';
457 457
                 }
458 458
             }
459 459
         }
@@ -477,9 +477,9 @@  discard block
 block discarded – undo
477 477
             //echo $query;
478 478
             $ret = $ret && $xoopsDB->queryF($query);
479 479
             if (!$ret) {
480
-                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_NEWFIELD_ERR, $newField['name'], $this->name()) . '<br>';
480
+                echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_NEWFIELD_ERR, $newField['name'], $this->name()).'<br>';
481 481
             } else {
482
-                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_NEWFIELD, $newField['name'], $this->name()) . '<br>';
482
+                echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_NEWFIELD, $newField['name'], $this->name()).'<br>';
483 483
             }
484 484
         }
485 485
 
@@ -502,9 +502,9 @@  discard block
 block discarded – undo
502 502
             $query = sprintf('UPDATE %s SET %s = %s', $this->name(), $updatedField['name'], $updatedField['value']);
503 503
             $ret   = $ret && $xoopsDB->queryF($query);
504 504
             if (!$ret) {
505
-                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_UPDATE_TABLE_ERR, $this->name()) . '<br>';
505
+                echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_UPDATE_TABLE_ERR, $this->name()).'<br>';
506 506
             } else {
507
-                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()) . '<br>';
507
+                echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()).'<br>';
508 508
             }
509 509
         }
510 510
 
@@ -527,9 +527,9 @@  discard block
 block discarded – undo
527 527
             //echo $query."<br>";
528 528
             $ret = $ret && $xoopsDB->queryF($query);
529 529
             if (!$ret) {
530
-                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_UPDATE_TABLE_ERR, $this->name()) . '<br>';
530
+                echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_UPDATE_TABLE_ERR, $this->name()).'<br>';
531 531
             } else {
532
-                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()) . '<br>';
532
+                echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()).'<br>';
533 533
             }
534 534
         }
535 535
 
@@ -553,9 +553,9 @@  discard block
 block discarded – undo
553 553
 
554 554
             $ret = $ret && $xoopsDB->queryF($query);
555 555
             if (!$ret) {
556
-                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_DROPFIELD_ERR, $droppedField, $this->name()) . '<br>';
556
+                echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_DROPFIELD_ERR, $droppedField, $this->name()).'<br>';
557 557
             } else {
558
-                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_DROPFIELD, $droppedField, $this->name()) . '<br>';
558
+                echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_DROPFIELD, $droppedField, $this->name()).'<br>';
559 559
             }
560 560
         }
561 561
 
@@ -624,11 +624,11 @@  discard block
 block discarded – undo
624 624
         $query = sprintf('ALTER TABLE %s RENAME %s', $from, $to);
625 625
         $ret   = $xoopsDB->queryF($query);
626 626
         if (!$ret) {
627
-            echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_RENAME_TABLE_ERR, $from) . '<br>';
627
+            echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_RENAME_TABLE_ERR, $from).'<br>';
628 628
 
629 629
             return false;
630 630
         } else {
631
-            echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_RENAME_TABLE, $from, $to) . '<br>';
631
+            echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_RENAME_TABLE, $from, $to).'<br>';
632 632
 
633 633
             return true;
634 634
         }
Please login to merge, or discard this patch.
class/utility.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
                 if (!mkdir($folder) && !is_dir($folder)) {
30 30
                     throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder));
31 31
                 } else {
32
-                    file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>');
32
+                    file_put_contents($folder.'/index.html', '<script>history.go(-1);</script>');
33 33
                 }
34 34
             }
35 35
         } catch (Exception $e) {
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
         //    @mkdir($dst);
68 68
         while (false !== ($file = readdir($dir))) {
69 69
             if (('.' !== $file) && ('..' !== $file)) {
70
-                if (is_dir($src . '/' . $file)) {
71
-                    self::recurseCopy($src . '/' . $file, $dst . '/' . $file);
70
+                if (is_dir($src.'/'.$file)) {
71
+                    self::recurseCopy($src.'/'.$file, $dst.'/'.$file);
72 72
                 } else {
73
-                    copy($src . '/' . $file, $dst . '/' . $file);
73
+                    copy($src.'/'.$file, $dst.'/'.$file);
74 74
                 }
75 75
             }
76 76
         }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         $currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string
98 98
         $currArray  = explode('.', $currentVer);
99 99
         if (null === $requiredVer) {
100
-            $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string
100
+            $requiredVer = ''.$module->getInfo('min_xoops'); //making sure it's a string
101 101
         }
102 102
         $reqArray = explode('.', $requiredVer);
103 103
         $success  = true;
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
                     break;
113 113
                 }
114 114
             } else {
115
-                if ((int)$v > 0) { // handles versions like x.x.x.0_RC2
115
+                if ((int) $v > 0) { // handles versions like x.x.x.0_RC2
116 116
                     $success = false;
117 117
                     break;
118 118
                 }
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
                 break;
204 204
 
205 205
             case 'inside':
206
-                return XOOPS_URL . '/modules/smartfaq/doc/';
206
+                return XOOPS_URL.'/modules/smartfaq/doc/';
207 207
                 break;
208 208
 
209 209
             case 'custom':
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
     {
221 221
         $ret = '';
222 222
         foreach ($errors as $key => $value) {
223
-            $ret .= '<br> - ' . $value;
223
+            $ret .= '<br> - '.$value;
224 224
         }
225 225
 
226 226
         return $ret;
@@ -243,11 +243,11 @@  discard block
 block discarded – undo
243 243
             $spaces .= '--';
244 244
         }
245 245
 
246
-        $ret .= "<option value='" . $categoryObj->categoryid() . "'";
246
+        $ret .= "<option value='".$categoryObj->categoryid()."'";
247 247
         if ($selectedid == $categoryObj->categoryid()) {
248 248
             $ret .= ' selected';
249 249
         }
250
-        $ret .= '>' . $spaces . $categoryObj->name() . "</option>\n";
250
+        $ret .= '>'.$spaces.$categoryObj->name()."</option>\n";
251 251
 
252 252
         $subCategoriesObj = $categoryHandler->getCategories(0, 0, $categoryObj->categoryid());
253 253
         if (count($subCategoriesObj) > 0) {
@@ -268,10 +268,10 @@  discard block
 block discarded – undo
268 268
      */
269 269
     public static function sf_createCategorySelect($selectedid = 0, $parentcategory = 0, $allCatOption = true)
270 270
     {
271
-        $ret = '' . _MB_SF_SELECTCAT . "&nbsp;<select name='options[]'>";
271
+        $ret = ''._MB_SF_SELECTCAT."&nbsp;<select name='options[]'>";
272 272
         if ($allCatOption) {
273 273
             $ret .= "<option value='0'";
274
-            $ret .= '>' . _MB_SF_ALLCAT . "</option>\n";
274
+            $ret .= '>'._MB_SF_ALLCAT."</option>\n";
275 275
         }
276 276
 
277 277
         // Creating the category handler object
@@ -339,9 +339,9 @@  discard block
 block discarded – undo
339 339
     {
340 340
         $smartModule = sf_getModuleInfo();
341 341
 
342
-        $modfootertxt = 'Module ' . $smartModule->getInfo('name') . ' - Version ' . $smartModule->getInfo('version') . '';
342
+        $modfootertxt = 'Module '.$smartModule->getInfo('name').' - Version '.$smartModule->getInfo('version').'';
343 343
 
344
-        $modfooter = "<a href='" . $smartModule->getInfo('support_site_url') . "' target='_blank'><img src='" . XOOPS_URL . "/modules/smartfaq/assets/images/sfcssbutton.gif' title='" . $modfootertxt . "' alt='" . $modfootertxt . "'></a>";
344
+        $modfooter = "<a href='".$smartModule->getInfo('support_site_url')."' target='_blank'><img src='".XOOPS_URL."/modules/smartfaq/assets/images/sfcssbutton.gif' title='".$modfootertxt."' alt='".$modfootertxt."'></a>";
345 345
 
346 346
         return $modfooter;
347 347
     }
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 
438 438
         $gpermHandler = xoops_getHandler('groupperm');
439 439
 
440
-        $sql    = 'SELECT faqid FROM ' . $xoopsDB->prefix('smartfaq_faq') . " WHERE categoryid = '$categoryid' ";
440
+        $sql    = 'SELECT faqid FROM '.$xoopsDB->prefix('smartfaq_faq')." WHERE categoryid = '$categoryid' ";
441 441
         $result = $xoopsDB->queryF($sql);
442 442
 
443 443
         if ($GLOBALS['xoopsDB']->getRowsNum($result) > 0) {
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
         $ret = [];
553 553
         global $xoopsDB;
554 554
 
555
-        $result = $xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('smartfaq_faq') . " WHERE faqid = '$faqid'");
555
+        $result = $xoopsDB->queryF('SELECT * FROM '.$xoopsDB->prefix('smartfaq_faq')." WHERE faqid = '$faqid'");
556 556
         $ret    = $xoopsDB->fetcharray($result);
557 557
 
558 558
         return $ret;
@@ -571,26 +571,26 @@  discard block
 block discarded – undo
571 571
     {
572 572
         global $xoopsUser, $xoopsModule, $xoopsModuleConfig, $xoopsConfig;
573 573
         $adminLinks = '';
574
-        $modulePath = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/';
574
+        $modulePath = XOOPS_URL.'/modules/'.$xoopsModule->dirname().'/';
575 575
         $page       = $open ? 'question.php' : 'faq.php';
576 576
         if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->getVar('mid'))) {
577 577
             // Edit button
578
-            $adminLinks .= "<a href='" . $modulePath . "admin/$page?op=mod&amp;faqid=" . $faqid . "'><img src='" . $modulePath . "assets/images/links/edit.gif'" . " title='" . _MD_SF_EDIT . "' alt='" . _MD_SF_EDIT . "'></a>";
578
+            $adminLinks .= "<a href='".$modulePath."admin/$page?op=mod&amp;faqid=".$faqid."'><img src='".$modulePath."assets/images/links/edit.gif'"." title='"._MD_SF_EDIT."' alt='"._MD_SF_EDIT."'></a>";
579 579
             $adminLinks .= ' ';
580 580
             // Delete button
581
-            $adminLinks .= "<a href='" . $modulePath . "admin/$page?op=del&amp;faqid=" . $faqid . "'><img src='" . $modulePath . "assets/images/links/delete.gif'" . " title='" . _MD_SF_DELETE . "' alt='" . _MD_SF_DELETE . "'></a>";
581
+            $adminLinks .= "<a href='".$modulePath."admin/$page?op=del&amp;faqid=".$faqid."'><img src='".$modulePath."assets/images/links/delete.gif'"." title='"._MD_SF_DELETE."' alt='"._MD_SF_DELETE."'></a>";
582 582
             $adminLinks .= ' ';
583 583
         }
584 584
         // Print button
585
-        $adminLinks .= "<a href='" . $modulePath . 'print.php?faqid=' . $faqid . "'><img src='" . $modulePath . "assets/images/links/print.gif' title='" . _MD_SF_PRINT . "' alt='" . _MD_SF_PRINT . "'></a>";
585
+        $adminLinks .= "<a href='".$modulePath.'print.php?faqid='.$faqid."'><img src='".$modulePath."assets/images/links/print.gif' title='"._MD_SF_PRINT."' alt='"._MD_SF_PRINT."'></a>";
586 586
         $adminLinks .= ' ';
587 587
         // Email button
588
-        $maillink   = 'mailto:?subject=' . sprintf(_MD_SF_INTARTICLE, $xoopsConfig['sitename']) . '&amp;body=' . sprintf(_MD_SF_INTARTFOUND, $xoopsConfig['sitename']) . ':  ' . $modulePath . 'faq.php?faqid=' . $faqid;
589
-        $adminLinks .= '<a href="' . $maillink . "\"><img src='" . $modulePath . "assets/images/links/friend.gif' title='" . _MD_SF_MAIL . "' alt='" . _MD_SF_MAIL . "'></a>";
588
+        $maillink = 'mailto:?subject='.sprintf(_MD_SF_INTARTICLE, $xoopsConfig['sitename']).'&amp;body='.sprintf(_MD_SF_INTARTFOUND, $xoopsConfig['sitename']).':  '.$modulePath.'faq.php?faqid='.$faqid;
589
+        $adminLinks .= '<a href="'.$maillink."\"><img src='".$modulePath."assets/images/links/friend.gif' title='"._MD_SF_MAIL."' alt='"._MD_SF_MAIL."'></a>";
590 590
         $adminLinks .= ' ';
591 591
         // Submit New Answer button
592 592
         if ($xoopsModuleConfig['allownewanswer'] && (is_object($xoopsUser) || $xoopsModuleConfig['anonpost'])) {
593
-            $adminLinks .= "<a href='" . $modulePath . 'answer.php?faqid=' . $faqid . "'><img src='" . $modulePath . "assets/images/links/newanswer.gif' title='" . _MD_SF_SUBMITANSWER . "' alt='" . _MD_SF_SUBMITANSWER . "'></a>";
593
+            $adminLinks .= "<a href='".$modulePath.'answer.php?faqid='.$faqid."'><img src='".$modulePath."assets/images/links/newanswer.gif' title='"._MD_SF_SUBMITANSWER."' alt='"._MD_SF_SUBMITANSWER."'></a>";
594 594
             $adminLinks .= ' ';
595 595
         }
596 596
 
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
             return $userid;
612 612
         }
613 613
 
614
-        $userid = (int)$userid;
614
+        $userid = (int) $userid;
615 615
         if ($userid > 0) {
616 616
             if ($users == []) {
617 617
                 //fetching users
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
                 if (!isset($users[$userid])) {
622 622
                     return $GLOBALS['xoopsConfig']['anonymous'];
623 623
                 }
624
-                $user =& $users[$userid];
624
+                $user = & $users[$userid];
625 625
             }
626 626
 
627 627
             if (is_object($user)) {
@@ -635,9 +635,9 @@  discard block
 block discarded – undo
635 635
                     $fullname = $user->getVar('name');
636 636
                 }
637 637
                 if (!empty($fullname)) {
638
-                    $linkeduser = "$fullname [<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . $ts->htmlSpecialChars($username) . '</a>]';
638
+                    $linkeduser = "$fullname [<a href='".XOOPS_URL.'/userinfo.php?uid='.$userid."'>".$ts->htmlSpecialChars($username).'</a>]';
639 639
                 } else {
640
-                    $linkeduser = "<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . ucwords($ts->htmlSpecialChars($username)) . '</a>';
640
+                    $linkeduser = "<a href='".XOOPS_URL.'/userinfo.php?uid='.$userid."'>".ucwords($ts->htmlSpecialChars($username)).'</a>';
641 641
                 }
642 642
 
643 643
                 return $linkeduser;
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
             //-->
720 720
         </script>
721 721
         <?php
722
-        echo "<h3 style=\"color: #2F5376; margin: 6px 0 0 0; \"><a href='#' onClick=\"toggle('" . $tablename . "'); toggleIcon('" . $iconname . "');\">";
722
+        echo "<h3 style=\"color: #2F5376; margin: 6px 0 0 0; \"><a href='#' onClick=\"toggle('".$tablename."'); toggleIcon('".$iconname."');\">";
723 723
     }
724 724
 
725 725
     /**
@@ -732,16 +732,16 @@  discard block
 block discarded – undo
732 732
         static $handlers;
733 733
         $name = strtolower(trim($name));
734 734
         if (!isset($handlers[$name])) {
735
-            if (file_exists($hnd_file = XOOPS_ROOT_PATH . '/modules/smartfaq/class/' . $name . '.php')) {
735
+            if (file_exists($hnd_file = XOOPS_ROOT_PATH.'/modules/smartfaq/class/'.$name.'.php')) {
736 736
                 require_once $hnd_file;
737 737
             }
738
-            $class = 'sf' . ucfirst($name) . 'Handler';
738
+            $class = 'sf'.ucfirst($name).'Handler';
739 739
             if (class_exists($class)) {
740 740
                 $handlers[$name] = new $class($GLOBALS['xoopsDB']);
741 741
             }
742 742
         }
743 743
         if (!$optional && !isset($handlers[$name])) {
744
-            trigger_error('Class <b>' . $class . '</b> does not exist<br>Handler Name: ' . $name, E_USER_ERROR);
744
+            trigger_error('Class <b>'.$class.'</b> does not exist<br>Handler Name: '.$name, E_USER_ERROR);
745 745
         }
746 746
         $false = false;
747 747
 
Please login to merge, or discard this patch.
class/answer.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
         if (!$attach_key) {
92 92
             return false;
93 93
         }
94
-        $this->attachment_array[(string)$attach_key]['num_download']++;
94
+        $this->attachment_array[(string) $attach_key]['num_download']++;
95 95
 
96
-        return $this->attachment_array[(string)$attach_key]['num_download'];
96
+        return $this->attachment_array[(string) $attach_key]['num_download'];
97 97
     }
98 98
 
99 99
     /**
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
             $attachment_save = base64_encode(serialize($this->attachment_array));
107 107
         }
108 108
         $this->setVar('attachment', $attachment_save);
109
-        $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('smartfaq_answers') . ' SET attachment=' . $GLOBALS['xoopsDB']->quoteString($attachment_save) . ' WHERE post_id = ' . $this->getVar('answerid');
109
+        $sql = 'UPDATE '.$GLOBALS['xoopsDB']->prefix('smartfaq_answers').' SET attachment='.$GLOBALS['xoopsDB']->quoteString($attachment_save).' WHERE post_id = '.$this->getVar('answerid');
110 110
         if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) {
111 111
             //xoops_error($GLOBALS["xoopsDB"]->error());
112 112
             return false;
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
 
139 139
         foreach ($attach_old as $key => $attach) {
140 140
             if (in_array($key, $attach_array)) {
141
-                @unlink(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attach['name_saved']);
142
-                @unlink(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/thumbs/' . $attach['name_saved']); // delete thumbnails
141
+                @unlink(XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/'.$attach['name_saved']);
142
+                @unlink(XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/thumbs/'.$attach['name_saved']); // delete thumbnails
143 143
                 continue;
144 144
             }
145 145
             $this->attachment_array[$key] = $attach;
@@ -165,12 +165,12 @@  discard block
 block discarded – undo
165 165
         static $counter = 0;
166 166
         $this->attachment_array = $this->getAttachment();
167 167
         if ($name_saved) {
168
-            $key                          = (string)(time() + ($counter++));
168
+            $key                          = (string) (time()+($counter++));
169 169
             $this->attachment_array[$key] = [
170 170
                 'name_saved'   => $name_saved,
171 171
                 'name_display' => isset($name_display) ? $name_display : $name_saved,
172 172
                 'mimetype'     => $mimetype,
173
-                'num_download' => isset($num_download) ? (int)$num_download : 0
173
+                'num_download' => isset($num_download) ? (int) $num_download : 0
174 174
             ];
175 175
         }
176 176
         $attachment_save = null;
@@ -196,24 +196,24 @@  discard block
 block discarded – undo
196 196
         if (is_array($attachments) && count($attachments) > 0) {
197 197
             $iconHandler = sf_getIconHandler();
198 198
             $mime_path   = $iconHandler->getPath('mime');
199
-            require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/include/functions.image.php';
199
+            require_once XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname', 'n').'/include/functions.image.php';
200 200
             $image_extensions = ['jpg', 'jpeg', 'gif', 'png', 'bmp']; // need improve !!!
201
-            $post_attachment  .= '<br><strong>' . _MD_ATTACHMENT . '</strong>:';
201
+            $post_attachment  .= '<br><strong>'._MD_ATTACHMENT.'</strong>:';
202 202
             $post_attachment  .= '<br><hr size="1" noshade="noshade"><br>';
203 203
             foreach ($attachments as $key => $att) {
204 204
                 $file_extension = ltrim(strrchr($att['name_saved'], '.'), '.');
205 205
                 $filetype       = $file_extension;
206
-                if (file_exists(XOOPS_ROOT_PATH . '/' . $mime_path . '/' . $filetype . '.gif')) {
207
-                    $icon_filetype = XOOPS_URL . '/' . $mime_path . '/' . $filetype . '.gif';
206
+                if (file_exists(XOOPS_ROOT_PATH.'/'.$mime_path.'/'.$filetype.'.gif')) {
207
+                    $icon_filetype = XOOPS_URL.'/'.$mime_path.'/'.$filetype.'.gif';
208 208
                 } else {
209
-                    $icon_filetype = XOOPS_URL . '/' . $mime_path . '/unknown.gif';
209
+                    $icon_filetype = XOOPS_URL.'/'.$mime_path.'/unknown.gif';
210 210
                 }
211
-                $file_size = @filesize(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $att['name_saved']);
212
-                $file_size = number_format($file_size / 1024, 2) . ' KB';
211
+                $file_size = @filesize(XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/'.$att['name_saved']);
212
+                $file_size = number_format($file_size / 1024, 2).' KB';
213 213
                 if ($xoopsModuleConfig['media_allowed'] && in_array(strtolower($file_extension), $image_extensions)) {
214
-                    $post_attachment .= '<br><img src="' . $icon_filetype . '" alt="' . $filetype . '"><strong>&nbsp; ' . $att['name_display'] . '</strong> <small>(' . $file_size . ')</small>';
215
-                    $post_attachment .= '<br>' . sf_attachmentImage($att['name_saved']);
216
-                    $isDisplayed     = true;
214
+                    $post_attachment .= '<br><img src="'.$icon_filetype.'" alt="'.$filetype.'"><strong>&nbsp; '.$att['name_display'].'</strong> <small>('.$file_size.')</small>';
215
+                    $post_attachment .= '<br>'.sf_attachmentImage($att['name_saved']);
216
+                    $isDisplayed = true;
217 217
                 } else {
218 218
                     global $xoopsUser;
219 219
                     if (empty($xoopsModuleConfig['show_userattach'])) {
@@ -370,9 +370,9 @@  discard block
 block discarded – undo
370 370
         $tags                  = [];
371 371
         $tags['MODULE_NAME']   = $myts->displayTarea($smartModule->getVar('name'));
372 372
         $tags['FAQ_NAME']      = $faqObj->question();
373
-        $tags['FAQ_URL']       = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/faq.php?faqid=' . $faqObj->faqid();
373
+        $tags['FAQ_URL']       = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/faq.php?faqid='.$faqObj->faqid();
374 374
         $tags['CATEGORY_NAME'] = $faqObj->getCategoryName();
375
-        $tags['CATEGORY_URL']  = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/category.php?categoryid=' . $faqObj->categoryid();
375
+        $tags['CATEGORY_URL']  = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/category.php?categoryid='.$faqObj->categoryid();
376 376
         $tags['FAQ_QUESTION']  = $faqObj->question();
377 377
 
378 378
         // TODO : Not sure about the 'formpreview' ...
@@ -429,8 +429,8 @@  discard block
 block discarded – undo
429 429
      */
430 430
     public function get($id = null, $fields = null)
431 431
     {
432
-        if ((int)$id > 0) {
433
-            $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_answers') . ' WHERE answerid=' . $id;
432
+        if ((int) $id > 0) {
433
+            $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_answers').' WHERE answerid='.$id;
434 434
             if (!$result = $this->db->query($sql)) {
435 435
                 return false;
436 436
             }
@@ -558,11 +558,11 @@  discard block
 block discarded – undo
558 558
     {
559 559
         $ret   = [];
560 560
         $limit = $start = 0;
561
-        $sql   = 'SELECT * FROM ' . $this->db->prefix('smartfaq_answers');
561
+        $sql   = 'SELECT * FROM '.$this->db->prefix('smartfaq_answers');
562 562
         if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
563
-            $sql .= ' ' . $criteria->renderWhere();
563
+            $sql .= ' '.$criteria->renderWhere();
564 564
             if ('' != $criteria->getSort()) {
565
-                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
565
+                $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
566 566
             }
567 567
             $limit = $criteria->getLimit();
568 568
             $start = $criteria->getStart();
@@ -576,9 +576,9 @@  discard block
 block discarded – undo
576 576
             $answer = new sfAnswer();
577 577
             $answer->assignVars($myrow);
578 578
             if (!$id_as_key) {
579
-                $ret[] =& $answer;
579
+                $ret[] = & $answer;
580 580
             } else {
581
-                $ret[$myrow['answerid']] =& $answer;
581
+                $ret[$myrow['answerid']] = & $answer;
582 582
             }
583 583
             unset($answer);
584 584
         }
@@ -659,9 +659,9 @@  discard block
 block discarded – undo
659 659
      */
660 660
     public function getCount(CriteriaElement $criteria = null)
661 661
     {
662
-        $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_answers');
662
+        $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('smartfaq_answers');
663 663
         if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
664
-            $sql .= ' ' . $criteria->renderWhere();
664
+            $sql .= ' '.$criteria->renderWhere();
665 665
         }
666 666
         $result = $this->db->query($sql);
667 667
         if (!$result) {
@@ -680,10 +680,10 @@  discard block
 block discarded – undo
680 680
      */
681 681
     public function getCountByFAQ($criteria = null)
682 682
     {
683
-        $sql = 'SELECT faqid, COUNT(*) FROM ' . $this->db->prefix('smartfaq_answers');
683
+        $sql = 'SELECT faqid, COUNT(*) FROM '.$this->db->prefix('smartfaq_answers');
684 684
         if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
685
-            $sql .= ' ' . $criteria->renderWhere();
686
-            $sql .= ' ' . $criteria->getGroupby();
685
+            $sql .= ' '.$criteria->renderWhere();
686
+            $sql .= ' '.$criteria->getGroupby();
687 687
         }
688 688
 
689 689
         //echo "<br>$sql<br>";
@@ -710,9 +710,9 @@  discard block
 block discarded – undo
710 710
      */
711 711
     public function deleteAll(CriteriaElement $criteria = null, $force = true, $asObject = false)
712 712
     {
713
-        $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_answers');
713
+        $sql = 'DELETE FROM '.$this->db->prefix('smartfaq_answers');
714 714
         if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
715
-            $sql .= ' ' . $criteria->renderWhere();
715
+            $sql .= ' '.$criteria->renderWhere();
716 716
         }
717 717
         if (!$this->db->query($sql)) {
718 718
             return false;
@@ -732,10 +732,10 @@  discard block
 block discarded – undo
732 732
      */
733 733
     public function updateAll($fieldname, $fieldvalue, CriteriaElement $criteria = null, $force = false)
734 734
     {
735
-        $set_clause = is_numeric($fieldvalue) ? $fieldname . ' = ' . $fieldvalue : $fieldname . ' = ' . $this->db->quoteString($fieldvalue);
736
-        $sql        = 'UPDATE ' . $this->db->prefix('smartfaq_answers') . ' SET ' . $set_clause;
735
+        $set_clause = is_numeric($fieldvalue) ? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue);
736
+        $sql        = 'UPDATE '.$this->db->prefix('smartfaq_answers').' SET '.$set_clause;
737 737
         if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
738
-            $sql .= ' ' . $criteria->renderWhere();
738
+            $sql .= ' '.$criteria->renderWhere();
739 739
         }
740 740
         //echo "<br>" . $sql . "<br>";
741 741
         if (!$this->db->queryF($sql)) {
@@ -752,8 +752,8 @@  discard block
 block discarded – undo
752 752
     public function getLastPublishedByFaq($faqids)
753 753
     {
754 754
         $ret    = [];
755
-        $sql    = 'SELECT faqid, answer, uid, datesub FROM ' . $this->db->prefix('smartfaq_answers') . '
756
-               WHERE faqid IN (' . implode(',', $faqids) . ') AND status = ' . _SF_AN_STATUS_APPROVED . ' GROUP BY faqid';
755
+        $sql    = 'SELECT faqid, answer, uid, datesub FROM '.$this->db->prefix('smartfaq_answers').'
756
+               WHERE faqid IN (' . implode(',', $faqids).') AND status = '._SF_AN_STATUS_APPROVED.' GROUP BY faqid';
757 757
         $result = $this->db->query($sql);
758 758
         if (!$result) {
759 759
             return $ret;
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
         while ($row = $this->db->fetchArray($result)) {
762 762
             $answer = new sfAnswer();
763 763
             $answer->assignVars($row);
764
-            $ret[$row['faqid']] =& $answer;
764
+            $ret[$row['faqid']] = & $answer;
765 765
             unset($answer);
766 766
         }
767 767
 
Please login to merge, or discard this patch.
class/category.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
                 $this->assignVars($id);
49 49
             } else {
50 50
                 $categoryHandler = new sfCategoryHandler($this->db);
51
-                $category        =& $categoryHandler->get($id);
51
+                $category        = & $categoryHandler->get($id);
52 52
                 foreach ($category->vars as $k => $v) {
53 53
                     $this->assignVar($k, $v['value']);
54 54
                 }
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public function checkPermission()
83 83
     {
84
-        require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php';
84
+        require_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php';
85 85
 
86 86
         $userIsAdmin = sf_userIsAdmin();
87 87
         if ($userIsAdmin) {
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
             $filename = 'open_category.php';
159 159
         }
160 160
         if ($withAllLink) {
161
-            $ret = "<a href='" . XOOPS_URL . '/modules/smartfaq/' . $filename . '?categoryid=' . $this->categoryid() . "'>" . $this->name() . '</a>';
161
+            $ret = "<a href='".XOOPS_URL.'/modules/smartfaq/'.$filename.'?categoryid='.$this->categoryid()."'>".$this->name().'</a>';
162 162
         } else {
163 163
             $ret = $this->name();
164 164
         }
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
                 exit;
171 171
             }
172 172
             $parentid = $parentObj->parentid();
173
-            $ret      = $parentObj->getCategoryPath(true, $open) . ' > ' . $ret;
173
+            $ret      = $parentObj->getCategoryPath(true, $open).' > '.$ret;
174 174
         }
175 175
 
176 176
         return $ret;
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
         $tags                  = [];
225 225
         $tags['MODULE_NAME']   = $myts->htmlSpecialChars($smartModule->getVar('name'));
226 226
         $tags['CATEGORY_NAME'] = $this->name();
227
-        $tags['CATEGORY_URL']  = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/category.php?categoryid=' . $this->categoryid();
227
+        $tags['CATEGORY_URL']  = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/category.php?categoryid='.$this->categoryid();
228 228
 
229 229
         $notificationHandler = xoops_getHandler('notification');
230 230
         $notificationHandler->triggerEvent('global_faq', 0, 'category_created', $tags);
@@ -240,9 +240,9 @@  discard block
 block discarded – undo
240 240
         $category['categoryid'] = $this->categoryid();
241 241
         $category['name']       = $this->name();
242 242
         if (false !== $open) {
243
-            $category['categorylink'] = "<a href='" . XOOPS_URL . '/modules/smartfaq/open_category.php?categoryid=' . $this->categoryid() . "'>" . $this->name() . '</a>';
243
+            $category['categorylink'] = "<a href='".XOOPS_URL.'/modules/smartfaq/open_category.php?categoryid='.$this->categoryid()."'>".$this->name().'</a>';
244 244
         } else {
245
-            $category['categorylink'] = "<a href='" . XOOPS_URL . '/modules/smartfaq/category.php?categoryid=' . $this->categoryid() . "'>" . $this->name() . '</a>';
245
+            $category['categorylink'] = "<a href='".XOOPS_URL.'/modules/smartfaq/category.php?categoryid='.$this->categoryid()."'>".$this->name().'</a>';
246 246
         }
247 247
         $category['total']       = $this->getVar('faqcount');
248 248
         $category['description'] = $this->description();
@@ -291,8 +291,8 @@  discard block
 block discarded – undo
291 291
     public function get($id)
292 292
     {
293 293
         $false = false;
294
-        if ((int)$id > 0) {
295
-            $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_categories') . ' WHERE categoryid=' . $id;
294
+        if ((int) $id > 0) {
295
+            $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_categories').' WHERE categoryid='.$id;
296 296
             if (!$result = $this->db->query($sql)) {
297 297
                 return $false;
298 298
             }
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
         }
394 394
 
395 395
         // Deleteing the sub categories
396
-        $subcats =& $this->getCategories(0, 0, $category->categoryid());
396
+        $subcats = & $this->getCategories(0, 0, $category->categoryid());
397 397
         foreach ($subcats as $subcat) {
398 398
             $this->delete($subcat);
399 399
         }
@@ -430,11 +430,11 @@  discard block
 block discarded – undo
430 430
     {
431 431
         $ret   = [];
432 432
         $limit = $start = 0;
433
-        $sql   = 'SELECT * FROM ' . $this->db->prefix('smartfaq_categories');
433
+        $sql   = 'SELECT * FROM '.$this->db->prefix('smartfaq_categories');
434 434
         if (null !== $criteria && is_subclass_of($criteria, 'criteriaelement')) {
435
-            $sql .= ' ' . $criteria->renderWhere();
435
+            $sql .= ' '.$criteria->renderWhere();
436 436
             if ('' != $criteria->getSort()) {
437
-                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
437
+                $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
438 438
             }
439 439
             $limit = $criteria->getLimit();
440 440
             $start = $criteria->getStart();
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
         $order = 'ASC',
477 477
         $id_as_key = true
478 478
     ) {
479
-        require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php';
479
+        require_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php';
480 480
 
481 481
         $criteria = new CriteriaCompo();
482 482
 
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
             $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq');
491 491
 
492 492
             $categoriesGranted = $smartPermHandler->getPermissions('category');
493
-            $criteria->add(new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'));
493
+            $criteria->add(new Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN'));
494 494
         }
495 495
         $criteria->setStart($start);
496 496
         $criteria->setLimit($limit);
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
         $sort = 'weight',
515 515
         $order = 'ASC'
516 516
     ) {
517
-        require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php';
517
+        require_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php';
518 518
 
519 519
         $criteria = new CriteriaCompo();
520 520
 
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
             $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq');
529 529
 
530 530
             $categoriesGranted = $smartPermHandler->getPermissions('category');
531
-            $criteria->add(new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'));
531
+            $criteria->add(new Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN'));
532 532
         }
533 533
 
534 534
         $criteria->add(new Criteria('f.status', _SF_STATUS_OPENED));
@@ -537,11 +537,11 @@  discard block
 block discarded – undo
537 537
 
538 538
         $ret   = [];
539 539
         $limit = $start = 0;
540
-        $sql   = 'SELECT DISTINCT c.categoryid, c.parentid, c.name, c.description, c.total, c.weight, c.created FROM ' . $this->db->prefix('smartfaq_categories') . ' AS c INNER JOIN ' . $this->db->prefix('smartfaq_faq') . ' AS f ON c.categoryid = f.categoryid';
540
+        $sql   = 'SELECT DISTINCT c.categoryid, c.parentid, c.name, c.description, c.total, c.weight, c.created FROM '.$this->db->prefix('smartfaq_categories').' AS c INNER JOIN '.$this->db->prefix('smartfaq_faq').' AS f ON c.categoryid = f.categoryid';
541 541
         if (null !== ($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
542
-            $sql .= ' ' . $criteria->renderWhere();
542
+            $sql .= ' '.$criteria->renderWhere();
543 543
             if ('' != $criteria->getSort()) {
544
-                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
544
+                $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
545 545
             }
546 546
             $limit = $criteria->getLimit();
547 547
             $start = $criteria->getStart();
@@ -570,9 +570,9 @@  discard block
 block discarded – undo
570 570
      */
571 571
     public function getCount($criteria = null)
572 572
     {
573
-        $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_categories');
573
+        $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('smartfaq_categories');
574 574
         if (null !== ($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
575
-            $sql .= ' ' . $criteria->renderWhere();
575
+            $sql .= ' '.$criteria->renderWhere();
576 576
         }
577 577
         $result = $this->db->query($sql);
578 578
         if (!$result) {
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
                 $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq');
600 600
 
601 601
                 $categoriesGranted = $smartPermHandler->getPermissions('category');
602
-                $criteria->add(new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'));
602
+                $criteria->add(new Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN'));
603 603
             }
604 604
         }
605 605
 
@@ -622,16 +622,16 @@  discard block
 block discarded – undo
622 622
                 $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq');
623 623
 
624 624
                 $categoriesGranted = $smartPermHandler->getPermissions('category');
625
-                $criteria->add(new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'));
625
+                $criteria->add(new Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN'));
626 626
             }
627 627
         }
628 628
 
629 629
         $criteria->add(new Criteria('f.status', _SF_STATUS_OPENED));
630 630
 
631
-        $sql = 'SELECT COUNT(c.categoryid) FROM ' . $this->db->prefix('smartfaq_categories') . ' AS c INNER JOIN ' . $this->db->prefix('smartfaq_faq') . ' AS f ON c.categoryid = f.categoryid';
631
+        $sql = 'SELECT COUNT(c.categoryid) FROM '.$this->db->prefix('smartfaq_categories').' AS c INNER JOIN '.$this->db->prefix('smartfaq_faq').' AS f ON c.categoryid = f.categoryid';
632 632
 
633 633
         if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
634
-            $sql .= ' ' . $criteria->renderWhere();
634
+            $sql .= ' '.$criteria->renderWhere();
635 635
         }
636 636
 
637 637
         $result = $this->db->query($sql);
@@ -649,13 +649,13 @@  discard block
 block discarded – undo
649 649
      */
650 650
     public function getSubCats($categories)
651 651
     {
652
-        $criteria = new CriteriaCompo(new Criteria('parentid', '(' . implode(',', array_keys($categories)) . ')'), 'IN');
652
+        $criteria = new CriteriaCompo(new Criteria('parentid', '('.implode(',', array_keys($categories)).')'), 'IN');
653 653
         $ret      = [];
654 654
         if (!sf_userIsAdmin()) {
655 655
             $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq');
656 656
 
657 657
             $categoriesGranted = $smartPermHandler->getPermissions('category');
658
-            $criteria->add(new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'));
658
+            $criteria->add(new Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN'));
659 659
         }
660 660
         $subcats = $this->getObjects($criteria, true);
661 661
         foreach ($subcats as $subcat_id => $subcat) {
@@ -673,9 +673,9 @@  discard block
 block discarded – undo
673 673
      */
674 674
     public function deleteAll($criteria = null)
675 675
     {
676
-        $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_categories');
676
+        $sql = 'DELETE FROM '.$this->db->prefix('smartfaq_categories');
677 677
         if (null !== ($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
678
-            $sql .= ' ' . $criteria->renderWhere();
678
+            $sql .= ' '.$criteria->renderWhere();
679 679
         }
680 680
         if (!$this->db->query($sql)) {
681 681
             return false;
@@ -697,10 +697,10 @@  discard block
 block discarded – undo
697 697
      **/
698 698
     public function updateAll($fieldname, $fieldvalue, CriteriaElement $criteria = null)
699 699
     {
700
-        $set_clause = is_numeric($fieldvalue) ? $fieldname . ' = ' . $fieldvalue : $fieldname . ' = ' . $this->db->quoteString($fieldvalue);
701
-        $sql        = 'UPDATE ' . $this->db->prefix('smartfaq_categories') . ' SET ' . $set_clause;
700
+        $set_clause = is_numeric($fieldvalue) ? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue);
701
+        $sql        = 'UPDATE '.$this->db->prefix('smartfaq_categories').' SET '.$set_clause;
702 702
         if (null !== ($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
703
-            $sql .= ' ' . $criteria->renderWhere();
703
+            $sql .= ' '.$criteria->renderWhere();
704 704
         }
705 705
         if (!$this->db->queryF($sql)) {
706 706
             return false;
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
     public function faqsCount($cat_id = 0, $status = '')
727 727
     {
728 728
         global $xoopsUser;
729
-        require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php';
729
+        require_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php';
730 730
 
731 731
         $faqHandler = sf_gethandler('faq');
732 732
 
Please login to merge, or discard this patch.
class/faq.php 1 patch
Spacing   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 // defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
10 10
 
11
-require_once XOOPS_ROOT_PATH . '/modules/smartfaq/class/category.php';
11
+require_once XOOPS_ROOT_PATH.'/modules/smartfaq/class/category.php';
12 12
 
13 13
 // FAQ status
14 14
 define('_SF_STATUS_NOTSET', -1);
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 
105 105
         if (null !== $id) {
106 106
             $faqHandler = new sfFaqHandler($this->db);
107
-            $faq        =& $faqHandler->get($id);
107
+            $faq        = & $faqHandler->get($id);
108 108
             foreach ($faq->vars as $k => $v) {
109 109
                 $this->assignVar($k, $v['value']);
110 110
             }
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
      */
129 129
     public function checkPermission()
130 130
     {
131
-        require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php';
131
+        require_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php';
132 132
 
133 133
         $userIsAdmin = sf_userIsAdmin();
134 134
         if ($userIsAdmin) {
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         if (0 != $maxLength) {
205 205
             if (!XOOPS_USE_MULTIBYTES) {
206 206
                 if (strlen($ret) >= $maxLength) {
207
-                    $ret = substr($ret, 0, $maxLength - 1) . '...';
207
+                    $ret = substr($ret, 0, $maxLength-1).'...';
208 208
                 }
209 209
             }
210 210
         }
@@ -396,14 +396,14 @@  discard block
 block discarded – undo
396 396
                 $theAnswers = $answerHandler->getAllAnswers($this->faqid(), _SF_AN_STATUS_APPROVED, 1, 0);
397 397
                 //echo "test";
398 398
                 //exit;
399
-                $this->answer =& $theAnswers[0];
399
+                $this->answer = & $theAnswers[0];
400 400
                 break;
401 401
 
402 402
             case _SF_STATUS_ANSWERED:
403 403
                 $theAnswers = $answerHandler->getAllAnswers($this->faqid(), _SF_AN_STATUS_PROPOSED, 1, 0);
404 404
                 //echo "test";
405 405
                 //exit;
406
-                $this->answer =& $theAnswers[0];
406
+                $this->answer = & $theAnswers[0];
407 407
                 break;
408 408
 
409 409
             case _SF_STATUS_PUBLISHED:
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
         $tags['MODULE_NAME']   = $myts->displayTarea($smartModule->getVar('name'));
490 490
         $tags['FAQ_NAME']      = $this->question();
491 491
         $tags['CATEGORY_NAME'] = $this->getCategoryName();
492
-        $tags['CATEGORY_URL']  = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/category.php?categoryid=' . $this->categoryid();
492
+        $tags['CATEGORY_URL']  = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/category.php?categoryid='.$this->categoryid();
493 493
         $tags['FAQ_QUESTION']  = $this->question();
494 494
         $answerObj             = $this->answer();
495 495
         if (is_object($answerObj)) {
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
         foreach ($notifications as $notification) {
502 502
             switch ($notification) {
503 503
                 case _SF_NOT_FAQ_PUBLISHED:
504
-                    $tags['FAQ_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/faq.php?faqid=' . $this->faqid();
504
+                    $tags['FAQ_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/faq.php?faqid='.$this->faqid();
505 505
 
506 506
                     $notificationHandler->triggerEvent('global_faq', 0, 'published', $tags);
507 507
                     $notificationHandler->triggerEvent('category_faq', $this->categoryid(), 'published', $tags);
@@ -509,20 +509,20 @@  discard block
 block discarded – undo
509 509
                     break;
510 510
 
511 511
                 case _SF_NOT_FAQ_SUBMITTED:
512
-                    $tags['WAITINGFILES_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/admin/faq.php?faqid=' . $this->faqid();
512
+                    $tags['WAITINGFILES_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/admin/faq.php?faqid='.$this->faqid();
513 513
                     $notificationHandler->triggerEvent('global_faq', 0, 'submitted', $tags);
514 514
                     $notificationHandler->triggerEvent('category_faq', $this->categoryid(), 'submitted', $tags);
515 515
                     break;
516 516
 
517 517
                 case _SF_NOT_QUESTION_PUBLISHED:
518
-                    $tags['FAQ_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/answer.php?faqid=' . $this->faqid();
518
+                    $tags['FAQ_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/answer.php?faqid='.$this->faqid();
519 519
                     $notificationHandler->triggerEvent('global_question', 0, 'published', $tags);
520 520
                     $notificationHandler->triggerEvent('category_question', $this->categoryid(), 'published', $tags);
521 521
                     $notificationHandler->triggerEvent('question', $this->faqid(), 'approved', $tags);
522 522
                     break;
523 523
 
524 524
                 case _SF_NOT_QUESTION_SUBMITTED:
525
-                    $tags['WAITINGFILES_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/admin/question.php?op=mod&faqid=' . $this->faqid();
525
+                    $tags['WAITINGFILES_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/admin/question.php?op=mod&faqid='.$this->faqid();
526 526
                     $notificationHandler->triggerEvent('global_question', 0, 'submitted', $tags);
527 527
                     $notificationHandler->triggerEvent('category_question', $this->categoryid(), 'submitted', $tags);
528 528
                     break;
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
                     break;
533 533
 
534 534
                 case _SF_NOT_NEW_ANSWER_PROPOSED:
535
-                    $tags['WAITINGFILES_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/admin/answer.php?op=mod&faqid=' . $this->faqid();
535
+                    $tags['WAITINGFILES_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/admin/answer.php?op=mod&faqid='.$this->faqid();
536 536
                     $notificationHandler->triggerEvent('global_faq', 0, 'answer_proposed', $tags);
537 537
                     $notificationHandler->triggerEvent('category_faq', $this->categoryid(), 'answer_proposed', $tags);
538 538
                     break;
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
             $text = _MD_SF_FAQCOMEFROM;
647 647
         }
648 648
 
649
-        return $text . $xoopsConfig['sitename'] . ' : <a href=' . XOOPS_URL . '/modules/smartfaq/faq.php?faqid=' . $this->faqid() . '>' . XOOPS_URL . '/modules/smartfaq/faq.php?faqid=' . $this->faqid() . '</a>';
649
+        return $text.$xoopsConfig['sitename'].' : <a href='.XOOPS_URL.'/modules/smartfaq/faq.php?faqid='.$this->faqid().'>'.XOOPS_URL.'/modules/smartfaq/faq.php?faqid='.$this->faqid().'</a>';
650 650
     }
651 651
 
652 652
     /**
@@ -658,16 +658,16 @@  discard block
 block discarded – undo
658 658
     public function toArray($faq = [], $category = null, $linkInQuestion = true)
659 659
     {
660 660
         global $xoopsModuleConfig;
661
-        $lastfaqsize = (int)$xoopsModuleConfig['lastfaqsize'];
661
+        $lastfaqsize = (int) $xoopsModuleConfig['lastfaqsize'];
662 662
 
663 663
         $faq['id']         = $this->faqid();
664 664
         $faq['categoryid'] = $this->categoryid();
665 665
         $faq['question']   = $this->question();
666 666
         $page              = (_SF_STATUS_OPENED == $this->status()) ? 'answer.php' : 'faq.php';
667 667
 
668
-        $faq['questionlink'] = "<a href='$page?faqid=" . $this->faqid() . "'>" . $this->question($lastfaqsize) . '</a>';
668
+        $faq['questionlink'] = "<a href='$page?faqid=".$this->faqid()."'>".$this->question($lastfaqsize).'</a>';
669 669
         if ($linkInQuestion) {
670
-            $faq['fullquestionlink'] = "<a href='$page?faqid=" . $this->faqid() . "'>" . $this->question() . '</a>';
670
+            $faq['fullquestionlink'] = "<a href='$page?faqid=".$this->faqid()."'>".$this->question().'</a>';
671 671
         } else {
672 672
             $faq['fullquestionlink'] = $this->question();
673 673
         }
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
                 $categoryObj = $category[$this->categoryid()];
684 684
             }
685 685
             $faq['categoryname'] = $categoryObj->getVar('name');
686
-            $faq['categorylink'] = "<a href='" . XOOPS_URL . '/modules/smartfaq/category.php?categoryid=' . $this->categoryid() . "'>" . $categoryObj->getVar('name') . '</a>';
686
+            $faq['categorylink'] = "<a href='".XOOPS_URL.'/modules/smartfaq/category.php?categoryid='.$this->categoryid()."'>".$categoryObj->getVar('name').'</a>';
687 687
         }
688 688
 
689 689
         return $faq;
@@ -723,8 +723,8 @@  discard block
 block discarded – undo
723 723
      */
724 724
     public function get($id)
725 725
     {
726
-        if ((int)$id > 0) {
727
-            $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_faq') . ' WHERE faqid=' . $id;
726
+        if ((int) $id > 0) {
727
+            $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_faq').' WHERE faqid='.$id;
728 728
             if (!$result = $this->db->query($sql)) {
729 729
                 return false;
730 730
             }
@@ -886,26 +886,26 @@  discard block
 block discarded – undo
886 886
     {
887 887
         $ret   = [];
888 888
         $limit = $start = 0;
889
-        $sql   = 'SELECT * FROM ' . $this->db->prefix('smartfaq_faq');
889
+        $sql   = 'SELECT * FROM '.$this->db->prefix('smartfaq_faq');
890 890
 
891 891
         if (null !== $criteria && is_subclass_of($criteria, 'criteriaelement')) {
892 892
             $whereClause = $criteria->renderWhere();
893 893
 
894 894
             if ('WHERE ()' !== $whereClause) {
895
-                $sql .= ' ' . $criteria->renderWhere();
895
+                $sql .= ' '.$criteria->renderWhere();
896 896
                 if (!empty($notNullFields)) {
897 897
                     $sql .= $this->NotNullFieldClause($notNullFields, true);
898 898
                 }
899 899
             } elseif (!empty($notNullFields)) {
900
-                $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
900
+                $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
901 901
             }
902 902
             if ('' != $criteria->getSort()) {
903
-                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
903
+                $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
904 904
             }
905 905
             $limit = $criteria->getLimit();
906 906
             $start = $criteria->getStart();
907 907
         } elseif (!empty($notNullFields)) {
908
-            $sql .= $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
908
+            $sql .= $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
909 909
         }
910 910
 
911 911
         //echo "<br>" . $sql . "<br>";
@@ -923,9 +923,9 @@  discard block
 block discarded – undo
923 923
             $faq->assignVars($myrow);
924 924
 
925 925
             if (!$id_as_key) {
926
-                $ret[] =& $faq;
926
+                $ret[] = & $faq;
927 927
             } else {
928
-                $ret[$myrow['faqid']] =& $faq;
928
+                $ret[$myrow['faqid']] = & $faq;
929 929
             }
930 930
             unset($faq);
931 931
         }
@@ -965,26 +965,26 @@  discard block
 block discarded – undo
965 965
                             faq.modulelink AS modulelink,
966 966
                             faq.contextpage AS contextpage,
967 967
                             faq.exacturl AS exacturl
968
-                FROM ' . $this->db->prefix('smartfaq_faq') . ' AS faq INNER JOIN ' . $this->db->prefix('smartfaq_categories') . ' AS category ON faq.categoryid = category.categoryid ';
968
+                FROM ' . $this->db->prefix('smartfaq_faq').' AS faq INNER JOIN '.$this->db->prefix('smartfaq_categories').' AS category ON faq.categoryid = category.categoryid ';
969 969
 
970 970
         if (null !== $criteria && is_subclass_of($criteria, 'criteriaelement')) {
971 971
             $whereClause = $criteria->renderWhere();
972 972
 
973 973
             if ('WHERE ()' !== $whereClause) {
974
-                $sql .= ' ' . $criteria->renderWhere();
974
+                $sql .= ' '.$criteria->renderWhere();
975 975
                 if (!empty($notNullFields)) {
976 976
                     $sql .= $this->NotNullFieldClause($notNullFields, true);
977 977
                 }
978 978
             } elseif (!empty($notNullFields)) {
979
-                $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
979
+                $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
980 980
             }
981 981
             if ('' != $criteria->getSort()) {
982
-                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
982
+                $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
983 983
             }
984 984
             $limit = $criteria->getLimit();
985 985
             $start = $criteria->getStart();
986 986
         } elseif (!empty($notNullFields)) {
987
-            $sql .= $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
987
+            $sql .= $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
988 988
         }
989 989
 
990 990
         //echo "<br>" . $sql . "<br>";
@@ -1002,9 +1002,9 @@  discard block
 block discarded – undo
1002 1002
             $faq->assignVars($myrow);
1003 1003
 
1004 1004
             if (!$id_as_key) {
1005
-                $ret[] =& $faq;
1005
+                $ret[] = & $faq;
1006 1006
             } else {
1007
-                $ret[$myrow['faqid']] =& $faq;
1007
+                $ret[$myrow['faqid']] = & $faq;
1008 1008
             }
1009 1009
             unset($faq);
1010 1010
         }
@@ -1034,19 +1034,19 @@  discard block
 block discarded – undo
1034 1034
      */
1035 1035
     public function getCount($criteria = null, $notNullFields = '')
1036 1036
     {
1037
-        $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_faq');
1037
+        $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('smartfaq_faq');
1038 1038
         if (null !== $criteria && is_subclass_of($criteria, 'criteriaelement')) {
1039 1039
             $whereClause = $criteria->renderWhere();
1040 1040
             if ('WHERE ()' !== $whereClause) {
1041
-                $sql .= ' ' . $criteria->renderWhere();
1041
+                $sql .= ' '.$criteria->renderWhere();
1042 1042
                 if (!empty($notNullFields)) {
1043 1043
                     $sql .= $this->NotNullFieldClause($notNullFields, true);
1044 1044
                 }
1045 1045
             } elseif (!empty($notNullFields)) {
1046
-                $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
1046
+                $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
1047 1047
             }
1048 1048
         } elseif (!empty($notNullFields)) {
1049
-            $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
1049
+            $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
1050 1050
         }
1051 1051
 
1052 1052
         //echo "<br>" . $sql . "<br>";
@@ -1079,11 +1079,11 @@  discard block
 block discarded – undo
1079 1079
             $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq');
1080 1080
 
1081 1081
             $categoriesGranted = $smartPermHandler->getPermissions('category');
1082
-            $grantedCategories = new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN');
1082
+            $grantedCategories = new Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN');
1083 1083
 
1084 1084
             $faqsGranted = $smartPermHandler->getPermissions('item');
1085 1085
             $grantedFaq  = new CriteriaCompo();
1086
-            $grantedFaq->add(new Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR');
1086
+            $grantedFaq->add(new Criteria('faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR');
1087 1087
             // If user is anonymous, check if the FAQ allow partialview
1088 1088
             if (!is_object($xoopsUser)) {
1089 1089
                 $grantedFaq->add(new Criteria('partialview', '1'), 'OR');
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
      */
1131 1131
     public function getFaqsCountByStatus()
1132 1132
     {
1133
-        $sql    = 'SELECT status, COUNT(*) FROM ' . $this->db->prefix('smartfaq_faq') . ' GROUP BY status';
1133
+        $sql    = 'SELECT status, COUNT(*) FROM '.$this->db->prefix('smartfaq_faq').' GROUP BY status';
1134 1134
         $result = $this->db->query($sql);
1135 1135
         if (!$result) {
1136 1136
             return [];
@@ -1187,7 +1187,7 @@  discard block
 block discarded – undo
1187 1187
         $otherCriteria = null
1188 1188
     ) {
1189 1189
         global $xoopsUser;
1190
-        require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php';
1190
+        require_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php';
1191 1191
 
1192 1192
         //if ( ($categoryid == -1) && (empty($status) || ($status == -1)) && ($limit == 0) && ($start ==0) ) {
1193 1193
         //  return $this->getObjects();
@@ -1199,11 +1199,11 @@  discard block
 block discarded – undo
1199 1199
             $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq');
1200 1200
 
1201 1201
             $categoriesGranted = $smartPermHandler->getPermissions('category');
1202
-            $grantedCategories = new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN');
1202
+            $grantedCategories = new Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN');
1203 1203
 
1204 1204
             $faqsGranted = $smartPermHandler->getPermissions('item');
1205 1205
             $grantedFaq  = new CriteriaCompo();
1206
-            $grantedFaq->add(new Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR');
1206
+            $grantedFaq->add(new Criteria('faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR');
1207 1207
             // If user is anonymous, check if the FAQ allow partialview
1208 1208
             if (!is_object($xoopsUser)) {
1209 1209
                 $grantedFaq->add(new Criteria('partialview', '1'), 'OR');
@@ -1212,9 +1212,9 @@  discard block
 block discarded – undo
1212 1212
 
1213 1213
         if (isset($categoryid) && ($categoryid != -1)) {
1214 1214
             if (is_array($categoryid)) {
1215
-                $criteriaCategory = new Criteria('categoryid', '(' . implode(',', $categoryid) . ')', 'IN');
1215
+                $criteriaCategory = new Criteria('categoryid', '('.implode(',', $categoryid).')', 'IN');
1216 1216
             } else {
1217
-                $criteriaCategory = new Criteria('categoryid', (int)$categoryid);
1217
+                $criteriaCategory = new Criteria('categoryid', (int) $categoryid);
1218 1218
             }
1219 1219
         }
1220 1220
 
@@ -1281,7 +1281,7 @@  discard block
 block discarded – undo
1281 1281
         $asobject = true,
1282 1282
         $otherCriteria = null
1283 1283
     ) {
1284
-        require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php';
1284
+        require_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php';
1285 1285
 
1286 1286
         $smartModule = sf_getModuleInfo();
1287 1287
 
@@ -1340,11 +1340,11 @@  discard block
 block discarded – undo
1340 1340
 
1341 1341
         if ($totalFaqs > 0) {
1342 1342
             --$totalFaqs;
1343
-            mt_srand((double)microtime() * 1000000);
1343
+            mt_srand((double) microtime() * 1000000);
1344 1344
             $entrynumber = mt_rand(0, $totalFaqs);
1345 1345
             $faq         = $this->getFaqs(1, $entrynumber, $status, -1, 'datesub', 'DESC', $notNullFields);
1346 1346
             if ($faq) {
1347
-                $ret =& $faq[0];
1347
+                $ret = & $faq[0];
1348 1348
             }
1349 1349
         }
1350 1350
 
@@ -1375,10 +1375,10 @@  discard block
 block discarded – undo
1375 1375
                 $httphost    = $_SERVER['HTTP_HOST'];
1376 1376
                 $querystring = $_SERVER['QUERY_STRING'];
1377 1377
                 if ('' != $querystring) {
1378
-                    $querystring = '?' . $querystring;
1378
+                    $querystring = '?'.$querystring;
1379 1379
                 }
1380
-                $currenturl     = $http . $httphost . $phpself . $querystring;
1381
-                $fullcontexturl = XOOPS_URL . '/' . $faqsObj[$i]->contextpage();
1380
+                $currenturl     = $http.$httphost.$phpself.$querystring;
1381
+                $fullcontexturl = XOOPS_URL.'/'.$faqsObj[$i]->contextpage();
1382 1382
                 switch ($faqsObj[$i]->modulelink()) {
1383 1383
                     case '':
1384 1384
                         $display = false;
@@ -1397,7 +1397,7 @@  discard block
 block discarded – undo
1397 1397
                         }
1398 1398
                         break;
1399 1399
                     default:
1400
-                        if (false === strpos($currenturl, XOOPS_URL . '/modules/')) {
1400
+                        if (false === strpos($currenturl, XOOPS_URL.'/modules/')) {
1401 1401
                             $display = false;
1402 1402
                         } else {
1403 1403
                             if (false === strpos($currenturl, $faqsObj[$i]->modulelink())) {
@@ -1409,19 +1409,19 @@  discard block
 block discarded – undo
1409 1409
                         break;
1410 1410
                 }
1411 1411
                 if ($display) {
1412
-                    $randomFaqs[] =& $faqsObj[$i];
1412
+                    $randomFaqs[] = & $faqsObj[$i];
1413 1413
                 }
1414 1414
             }
1415 1415
         }
1416 1416
 
1417 1417
         if (count($randomFaqs) > $limit) {
1418
-            mt_srand((float)microtime() * 10000000);
1418
+            mt_srand((float) microtime() * 10000000);
1419 1419
             $rand_keys = array_rand($randomFaqs, $limit);
1420 1420
             for ($j = 0, $jMax = count($rand_keys); $j < $jMax; ++$j) {
1421
-                $ret[] =& $randomFaqs[$rand_keys[$j]];
1421
+                $ret[] = & $randomFaqs[$rand_keys[$j]];
1422 1422
             }
1423 1423
         } else {
1424
-            $ret =& $randomFaqs;
1424
+            $ret = & $randomFaqs;
1425 1425
         }
1426 1426
 
1427 1427
         return $ret;
@@ -1438,14 +1438,14 @@  discard block
 block discarded – undo
1438 1438
         if (!sf_userIsAdmin()) {
1439 1439
             $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq');
1440 1440
             $items            = $smartPermHandler->getPermissions('item');
1441
-            $faqclause        = ' AND faqid IN (' . implode(',', $items) . ')';
1441
+            $faqclause        = ' AND faqid IN ('.implode(',', $items).')';
1442 1442
         }
1443 1443
 
1444 1444
         $sql  = "CREATE TEMPORARY TABLE tmp (categoryid INT(8) UNSIGNED NOT NULL,datesub INT(11) DEFAULT '0' NOT NULL);";
1445
-        $sql2 = ' LOCK TABLES ' . $this->db->prefix('smartfaq_faq') . ' READ;';
1446
-        $sql3 = ' INSERT INTO tmp SELECT categoryid, MAX(datesub) FROM ' . $this->db->prefix('smartfaq_faq') . ' WHERE status IN (' . implode(',', $status) . ") $faqclause GROUP BY categoryid;";
1447
-        $sql4 = ' SELECT ' . $this->db->prefix('smartfaq_faq') . '.categoryid, faqid, question, uid, ' . $this->db->prefix('smartfaq_faq') . '.datesub FROM ' . $this->db->prefix('smartfaq_faq') . ', tmp
1448
-                              WHERE ' . $this->db->prefix('smartfaq_faq') . '.categoryid=tmp.categoryid AND ' . $this->db->prefix('smartfaq_faq') . '.datesub=tmp.datesub;';
1445
+        $sql2 = ' LOCK TABLES '.$this->db->prefix('smartfaq_faq').' READ;';
1446
+        $sql3 = ' INSERT INTO tmp SELECT categoryid, MAX(datesub) FROM '.$this->db->prefix('smartfaq_faq').' WHERE status IN ('.implode(',', $status).") $faqclause GROUP BY categoryid;";
1447
+        $sql4 = ' SELECT '.$this->db->prefix('smartfaq_faq').'.categoryid, faqid, question, uid, '.$this->db->prefix('smartfaq_faq').'.datesub FROM '.$this->db->prefix('smartfaq_faq').', tmp
1448
+                              WHERE ' . $this->db->prefix('smartfaq_faq').'.categoryid=tmp.categoryid AND '.$this->db->prefix('smartfaq_faq').'.datesub=tmp.datesub;';
1449 1449
         /*
1450 1450
         //Old implementation
1451 1451
         $sql = "SELECT categoryid, faqid, question, uid, MAX(datesub) AS datesub FROM ".$this->db->prefix("smartfaq_faq")."
@@ -1460,14 +1460,14 @@  discard block
 block discarded – undo
1460 1460
         $this->db->queryF('UNLOCK TABLES;');
1461 1461
         $this->db->queryF('DROP TABLE tmp;');
1462 1462
         if (!$result) {
1463
-            trigger_error('Error in getLastPublishedByCat SQL: ' . $error);
1463
+            trigger_error('Error in getLastPublishedByCat SQL: '.$error);
1464 1464
 
1465 1465
             return $ret;
1466 1466
         }
1467 1467
         while ($row = $this->db->fetchArray($result)) {
1468 1468
             $faq = new sfFaq();
1469 1469
             $faq->assignVars($row);
1470
-            $ret[$row['categoryid']] =& $faq;
1470
+            $ret[$row['categoryid']] = & $faq;
1471 1471
             unset($faq);
1472 1472
         }
1473 1473
 
@@ -1482,9 +1482,9 @@  discard block
 block discarded – undo
1482 1482
      */
1483 1483
     public function deleteAll($criteria = null)
1484 1484
     {
1485
-        $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_faq');
1485
+        $sql = 'DELETE FROM '.$this->db->prefix('smartfaq_faq');
1486 1486
         if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
1487
-            $sql .= ' ' . $criteria->renderWhere();
1487
+            $sql .= ' '.$criteria->renderWhere();
1488 1488
         }
1489 1489
         if (!$this->db->query($sql)) {
1490 1490
             return false;
@@ -1505,10 +1505,10 @@  discard block
 block discarded – undo
1505 1505
      **/
1506 1506
     public function updateAll($fieldname, $fieldvalue, $criteria = null)
1507 1507
     {
1508
-        $set_clause = is_numeric($fieldvalue) ? $fieldname . ' = ' . $fieldvalue : $fieldname . ' = ' . $this->db->quoteString($fieldvalue);
1509
-        $sql        = 'UPDATE ' . $this->db->prefix('smartfaq_faq') . ' SET ' . $set_clause;
1508
+        $set_clause = is_numeric($fieldvalue) ? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue);
1509
+        $sql        = 'UPDATE '.$this->db->prefix('smartfaq_faq').' SET '.$set_clause;
1510 1510
         if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
1511
-            $sql .= ' ' . $criteria->renderWhere();
1511
+            $sql .= ' '.$criteria->renderWhere();
1512 1512
         }
1513 1513
         if (!$this->db->queryF($sql)) {
1514 1514
             return false;
@@ -1523,7 +1523,7 @@  discard block
 block discarded – undo
1523 1523
      */
1524 1524
     public function updateCounter($faqid)
1525 1525
     {
1526
-        $sql = 'UPDATE ' . $this->db->prefix('smartfaq_faq') . ' SET counter=counter+1 WHERE faqid = ' . $faqid;
1526
+        $sql = 'UPDATE '.$this->db->prefix('smartfaq_faq').' SET counter=counter+1 WHERE faqid = '.$faqid;
1527 1527
         if ($this->db->queryF($sql)) {
1528 1528
             return true;
1529 1529
         } else {
@@ -1579,8 +1579,8 @@  discard block
 block discarded – undo
1579 1579
             $criteriaKeywords = new CriteriaCompo();
1580 1580
             for ($i = 0, $iMax = count($queryarray); $i < $iMax; ++$i) {
1581 1581
                 $criteriaKeyword = new CriteriaCompo();
1582
-                $criteriaKeyword->add(new Criteria('faq.question', '%' . $queryarray[$i] . '%', 'LIKE'), 'OR');
1583
-                $criteriaKeyword->add(new Criteria('answer.answer', '%' . $queryarray[$i] . '%', 'LIKE'), 'OR');
1582
+                $criteriaKeyword->add(new Criteria('faq.question', '%'.$queryarray[$i].'%', 'LIKE'), 'OR');
1583
+                $criteriaKeyword->add(new Criteria('answer.answer', '%'.$queryarray[$i].'%', 'LIKE'), 'OR');
1584 1584
                 $criteriaKeywords->add($criteriaKeyword, $andor);
1585 1585
                 unset($criteriaKeyword);
1586 1586
             }
@@ -1598,9 +1598,9 @@  discard block
 block discarded – undo
1598 1598
             if (!$faqsGranted) {
1599 1599
                 return $ret;
1600 1600
             }
1601
-            $grantedCategories = new Criteria('faq.categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN');
1601
+            $grantedCategories = new Criteria('faq.categoryid', '('.implode(',', $categoriesGranted).')', 'IN');
1602 1602
             $grantedFaq        = new CriteriaCompo();
1603
-            $grantedFaq->add(new Criteria('faq.faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR');
1603
+            $grantedFaq->add(new Criteria('faq.faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR');
1604 1604
             // If user is anonymous, check if the FAQ allow partialview
1605 1605
             if (!is_object($xoopsUser)) {
1606 1606
                 $grantedFaq->add(new Criteria('partialview', '1'), 'OR');
@@ -1646,15 +1646,15 @@  discard block
 block discarded – undo
1646 1646
         $criteria->setSort('faq.datesub');
1647 1647
         $criteria->setOrder('DESC');
1648 1648
 
1649
-        $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';
1649
+        $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';
1650 1650
 
1651 1651
         if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
1652 1652
             $whereClause = $criteria->renderWhere();
1653 1653
 
1654 1654
             if ('WHERE ()' !== $whereClause) {
1655
-                $sql .= ' ' . $criteria->renderWhere();
1655
+                $sql .= ' '.$criteria->renderWhere();
1656 1656
                 if ('' != $criteria->getSort()) {
1657
-                    $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
1657
+                    $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
1658 1658
                 }
1659 1659
                 $limit = $criteria->getLimit();
1660 1660
                 $start = $criteria->getStart();
@@ -1677,7 +1677,7 @@  discard block
 block discarded – undo
1677 1677
         while ($myrow = $this->db->fetchArray($result)) {
1678 1678
             $faq = new sfFaq();
1679 1679
             $faq->assignVars($myrow);
1680
-            $ret[] =& $faq;
1680
+            $ret[] = & $faq;
1681 1681
             unset($faq);
1682 1682
         }
1683 1683
 
@@ -1693,19 +1693,19 @@  discard block
 block discarded – undo
1693 1693
     {
1694 1694
         global $xoopsUser;
1695 1695
         $ret = [];
1696
-        $sql = 'SELECT categoryid, COUNT(*) AS count FROM ' . $this->db->prefix('smartfaq_faq');
1697
-        if ((int)$cat_id > 0) {
1698
-            $sql .= ' WHERE categoryid = ' . (int)$cat_id;
1699
-            $sql .= ' AND status IN (' . implode(',', $status) . ')';
1696
+        $sql = 'SELECT categoryid, COUNT(*) AS count FROM '.$this->db->prefix('smartfaq_faq');
1697
+        if ((int) $cat_id > 0) {
1698
+            $sql .= ' WHERE categoryid = '.(int) $cat_id;
1699
+            $sql .= ' AND status IN ('.implode(',', $status).')';
1700 1700
         } else {
1701
-            $sql .= ' WHERE status IN (' . implode(',', $status) . ')';
1701
+            $sql .= ' WHERE status IN ('.implode(',', $status).')';
1702 1702
             if (!sf_userIsAdmin()) {
1703 1703
                 $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq');
1704 1704
                 $items            = $smartPermHandler->getPermissions('item');
1705 1705
                 if (is_object($xoopsUser)) {
1706
-                    $sql .= ' AND faqid IN (' . implode(',', $items) . ')';
1706
+                    $sql .= ' AND faqid IN ('.implode(',', $items).')';
1707 1707
                 } else {
1708
-                    $sql .= ' AND (faqid IN (' . implode(',', $items) . ') OR partialview = 1)';
1708
+                    $sql .= ' AND (faqid IN ('.implode(',', $items).') OR partialview = 1)';
1709 1709
                 }
1710 1710
             }
1711 1711
         }
@@ -1718,7 +1718,7 @@  discard block
 block discarded – undo
1718 1718
             return $ret;
1719 1719
         }
1720 1720
         while ($row = $this->db->fetchArray($result)) {
1721
-            $ret[$row['categoryid']] = (int)$row['count'];
1721
+            $ret[$row['categoryid']] = (int) $row['count'];
1722 1722
         }
1723 1723
 
1724 1724
         return $ret;
Please login to merge, or discard this patch.
open_index.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -6,15 +6,15 @@  discard block
 block discarded – undo
6 6
  * Licence: GNU
7 7
  */
8 8
 
9
-require_once __DIR__ . '/header.php';
9
+require_once __DIR__.'/header.php';
10 10
 
11 11
 global $xoopsConfig, $xoopsModuleConfig, $xoopsModule;
12 12
 
13 13
 // At which record shall we start for the Categories
14
-$catstart = isset($_GET['catstart']) ? (int)$_GET['catstart'] : 0;
14
+$catstart = isset($_GET['catstart']) ? (int) $_GET['catstart'] : 0;
15 15
 
16 16
 // At which record shall we start for the FAQs
17
-$start = isset($_GET['start']) ? (int)$_GET['start'] : 0;
17
+$start = isset($_GET['start']) ? (int) $_GET['start'] : 0;
18 18
 
19 19
 // Creating the category handler object
20 20
 $categoryHandler = sf_gethandler('category');
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 
43 43
 $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_index.tpl';
44 44
 
45
-require_once XOOPS_ROOT_PATH . '/header.php';
46
-require_once __DIR__ . '/footer.php';
45
+require_once XOOPS_ROOT_PATH.'/header.php';
46
+require_once __DIR__.'/footer.php';
47 47
 
48 48
 //get all categories for future reference
49 49
 $allcategories = $categoryHandler->getObjects(null, true);
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
             if (isset($totalQnas[$subcat_id]) && $totalQnas[$subcat_id] > 0) {
66 66
                 if (isset($last_qnaObj[$subcat_id])) {
67 67
                     $subcat->setVar('last_faqid', $last_qnaObj[$subcat_id]->getVar('faqid'));
68
-                    $subcat->setVar('last_question_link', "<a href='faq.php?faqid=" . $last_qnaObj[$subcat_id]->getVar('faqid') . "'>" . $last_qnaObj[$subcat_id]->question(50) . '</a>');
68
+                    $subcat->setVar('last_question_link', "<a href='faq.php?faqid=".$last_qnaObj[$subcat_id]->getVar('faqid')."'>".$last_qnaObj[$subcat_id]->question(50).'</a>');
69 69
                 }
70 70
                 $subcat->setVar('faqcount', $totalQnas[$subcat_id]);
71 71
                 $categories[$cat_id]['subcats'][$subcat_id] = $subcat->toArray(null, true);
72
-                $total                                      += $totalQnas[$subcat_id];
72
+                $total += $totalQnas[$subcat_id];
73 73
             }
74 74
         }
75 75
     }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         }
102 102
 
103 103
         $memberHandler = xoops_getHandler('member');
104
-        $users         = $memberHandler->getUsers(new Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN'), true);
104
+        $users         = $memberHandler->getUsers(new Criteria('uid', '('.implode(',', array_keys($userids)).')', 'IN'), true);
105 105
         for ($i = 0; $i < $totalQnasOnPage; ++$i) {
106 106
             $faq = $faqsObj[$i]->toArray(null, $allcategories);
107 107
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     }
115 115
 }
116 116
 // Language constants
117
-$moduleName =& $myts->displayTarea($xoopsModule->getVar('name'));
117
+$moduleName = & $myts->displayTarea($xoopsModule->getVar('name'));
118 118
 $xoopsTpl->assign([
119 119
                       'lang_on'       => _MD_SF_ON,
120 120
                       'lang_postedby' => _MD_SF_POSTEDBY,
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
                       'lang_hits'     => _MD_SF_HITS
125 125
                   ]);
126 126
 
127
-$moduleName =& $myts->displayTarea($xoopsModule->getVar('name'));
127
+$moduleName = & $myts->displayTarea($xoopsModule->getVar('name'));
128 128
 $xoopsTpl->assign('lang_mainhead', sprintf(_MD_SF_OPEN_WELCOME, $xoopsConfig['sitename']));
129 129
 $xoopsTpl->assign('lang_mainintro', $myts->displayTarea($xoopsModuleConfig['openquestionintromsg'], 1));
130 130
 $xoopsTpl->assign('lang_total', _MD_SF_TOTAL_QUESTIONS);
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 $xoopsTpl->assign('lang_description', _MD_SF_DESCRIPTION);
133 133
 $xoopsTpl->assign('lang_category', _MD_SF_CATEGORY);
134 134
 $xoopsTpl->assign('sectionname', $moduleName);
135
-$xoopsTpl->assign('whereInSection', "<a href='index.php'>" . $moduleName . '</a> > ' . _MD_SF_OPEN_SECTION);
135
+$xoopsTpl->assign('whereInSection', "<a href='index.php'>".$moduleName.'</a> > '._MD_SF_OPEN_SECTION);
136 136
 
137 137
 $xoopsTpl->assign('displayFull', false);
138 138
 $xoopsTpl->assign('displaylastfaqs', $xoopsModuleConfig['displaylastfaqs']);
@@ -148,25 +148,25 @@  discard block
 block discarded – undo
148 148
 $xoopsTpl->assign('lang_category', _MD_SF_CATEGORY);
149 149
 
150 150
 // Category Navigation Bar
151
-require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
151
+require_once XOOPS_ROOT_PATH.'/class/pagenav.php';
152 152
 $pagenav = new XoopsPageNav($totalCategories, $xoopsModuleConfig['catperpage'], $catstart, 'catstart', '');
153 153
 if (1 == $xoopsModuleConfig['useimagenavpage']) {
154
-    $xoopsTpl->assign('catnavbar', '<div style="text-align:right;">' . $pagenav->renderImageNav() . '</div>');
154
+    $xoopsTpl->assign('catnavbar', '<div style="text-align:right;">'.$pagenav->renderImageNav().'</div>');
155 155
 } else {
156
-    $xoopsTpl->assign('catnavbar', '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>');
156
+    $xoopsTpl->assign('catnavbar', '<div style="text-align:right;">'.$pagenav->renderNav().'</div>');
157 157
 }
158 158
 
159 159
 // FAQ Navigation Bar
160 160
 $pagenav = new XoopsPageNav($totalFaqs, $xoopsModuleConfig['indexperpage'], $start, 'start', '');
161 161
 if (1 == $xoopsModuleConfig['useimagenavpage']) {
162
-    $xoopsTpl->assign('navbar', '<div style="text-align:right;">' . $pagenav->renderImageNav() . '</div>');
162
+    $xoopsTpl->assign('navbar', '<div style="text-align:right;">'.$pagenav->renderImageNav().'</div>');
163 163
 } else {
164
-    $xoopsTpl->assign('navbar', '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>');
164
+    $xoopsTpl->assign('navbar', '<div style="text-align:right;">'.$pagenav->renderNav().'</div>');
165 165
 }
166 166
 
167 167
 // Page Title Hack by marcan
168 168
 $module_name = $myts->htmlSpecialChars($xoopsModule->getVar('name'));
169
-$xoopsTpl->assign('xoops_pagetitle', $module_name . ' - ' . $category->getVar('name'));
169
+$xoopsTpl->assign('xoops_pagetitle', $module_name.' - '.$category->getVar('name'));
170 170
 // End Page Title Hack by marcan
171 171
 
172
-require_once XOOPS_ROOT_PATH . '/footer.php';
172
+require_once XOOPS_ROOT_PATH.'/footer.php';
Please login to merge, or discard this patch.
faq.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -6,9 +6,9 @@  discard block
 block discarded – undo
6 6
  * Licence: GNU
7 7
  */
8 8
 
9
-require_once __DIR__ . '/header.php';
9
+require_once __DIR__.'/header.php';
10 10
 
11
-$faqid = isset($_GET['faqid']) ? (int)$_GET['faqid'] : 0;
11
+$faqid = isset($_GET['faqid']) ? (int) $_GET['faqid'] : 0;
12 12
 
13 13
 if (0 == $faqid) {
14 14
     redirect_header('javascript:history.go(-1)', 1, _MD_SF_NOFAQSELECTED);
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
     $faqObj->updateCounter();
45 45
 }
46 46
 $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_faq.tpl';
47
-require_once XOOPS_ROOT_PATH . '/header.php';
48
-require_once __DIR__ . '/footer.php';
47
+require_once XOOPS_ROOT_PATH.'/header.php';
48
+require_once __DIR__.'/footer.php';
49 49
 
50 50
 $faq = $faqObj->toArray(null, $categoryObj, false);
51 51
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 $xoopsTpl->assign('display_categoryname', false);
81 81
 
82 82
 $xoopsTpl->assign('xcodes', $faqObj->getVar('xcodes'));
83
-$xoopsTpl->assign('mail_link', 'mailto:?subject=' . sprintf(_MD_SF_INTARTICLE, $xoopsConfig['sitename']) . '&amp;body=' . sprintf(_MD_SF_INTARTFOUND, $xoopsConfig['sitename']) . ':  ' . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/faq.php?faqid=' . $faqObj->getVar('faqid'));
83
+$xoopsTpl->assign('mail_link', 'mailto:?subject='.sprintf(_MD_SF_INTARTICLE, $xoopsConfig['sitename']).'&amp;body='.sprintf(_MD_SF_INTARTFOUND, $xoopsConfig['sitename']).':  '.XOOPS_URL.'/modules/'.$xoopsModule->dirname().'/faq.php?faqid='.$faqObj->getVar('faqid'));
84 84
 $xoopsTpl->assign('lang_printerpage', _MD_SF_PRINTERFRIENDLY);
85 85
 $xoopsTpl->assign('lang_sendstory', _MD_SF_SENDSTORY);
86 86
 $xoopsTpl->assign('faqid', $faqObj->getVar('faqid'));
@@ -96,19 +96,19 @@  discard block
 block discarded – undo
96 96
 
97 97
 // Page Title Hack by marcan
98 98
 $module_name = $myts->htmlSpecialChars($xoopsModule->getVar('name'));
99
-$xoopsTpl->assign('xoops_pagetitle', $module_name . ' - ' . $categoryObj->name() . ' - ' . $faq['question']);
99
+$xoopsTpl->assign('xoops_pagetitle', $module_name.' - '.$categoryObj->name().' - '.$faq['question']);
100 100
 // End Page Title Hack by marcan
101 101
 
102 102
 // Include the comments if the selected FAQ supports comments
103 103
 if (1 == $faqObj->cancomment()) {
104
-    require_once XOOPS_ROOT_PATH . '/include/comment_view.php';
104
+    require_once XOOPS_ROOT_PATH.'/include/comment_view.php';
105 105
 }
106 106
 
107 107
 //code to include smartie
108
-if (file_exists(XOOPS_ROOT_PATH . '/modules/smarttie/smarttie_links.php')) {
109
-    require_once XOOPS_ROOT_PATH . '/modules/smarttie/smarttie_links.php';
108
+if (file_exists(XOOPS_ROOT_PATH.'/modules/smarttie/smarttie_links.php')) {
109
+    require_once XOOPS_ROOT_PATH.'/modules/smarttie/smarttie_links.php';
110 110
     $xoopsTpl->assign('smarttie', 1);
111 111
 }
112 112
 //end code for smarttie
113 113
 
114
-require_once XOOPS_ROOT_PATH . '/footer.php';
114
+require_once XOOPS_ROOT_PATH.'/footer.php';
Please login to merge, or discard this patch.
admin/mygroupperm.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -15,14 +15,14 @@  discard block
 block discarded – undo
15 15
 
16 16
 function myDeleteByModule(XoopsDatabase $db, $gperm_modid, $gperm_name = null, $gperm_itemid = null)
17 17
 {
18
-    $criteria = new CriteriaCompo(new Criteria('gperm_modid', (int)$gperm_modid));
18
+    $criteria = new CriteriaCompo(new Criteria('gperm_modid', (int) $gperm_modid));
19 19
     if (null !== $gperm_name) {
20 20
         $criteria->add(new Criteria('gperm_name', $gperm_name));
21 21
         if (null !== $gperm_itemid) {
22
-            $criteria->add(new Criteria('gperm_itemid', (int)$gperm_itemid));
22
+            $criteria->add(new Criteria('gperm_itemid', (int) $gperm_itemid));
23 23
         }
24 24
     }
25
-    $sql = 'DELETE FROM ' . $db->prefix('group_permission') . ' ' . $criteria->renderWhere();
25
+    $sql = 'DELETE FROM '.$db->prefix('group_permission').' '.$criteria->renderWhere();
26 26
     if (!$result = $db->query($sql)) {
27 27
         return false;
28 28
     }
@@ -31,19 +31,19 @@  discard block
 block discarded – undo
31 31
 }
32 32
 
33 33
 // require_once __DIR__ . '/../../../include/cp_header.php'; GIJ
34
-$modid = isset($HTTP_POST_VARS['modid']) ? (int)$HTTP_POST_VARS['modid'] : 1;
34
+$modid = isset($HTTP_POST_VARS['modid']) ? (int) $HTTP_POST_VARS['modid'] : 1;
35 35
 // we dont want system module permissions to be changed here ( 1 -> 0 GIJ)
36 36
 if ($modid <= 0 || !is_object($xoopsUser) || !$xoopsUser->isAdmin($modid)) {
37
-    redirect_header(XOOPS_URL . '/user.php', 1, _NOPERM);
37
+    redirect_header(XOOPS_URL.'/user.php', 1, _NOPERM);
38 38
 }
39 39
 /** @var XoopsModuleHandler $moduleHandler */
40 40
 $moduleHandler = xoops_getHandler('module');
41 41
 $module        = $moduleHandler->get($modid);
42 42
 if (!is_object($module) || !$module->getVar('isactive')) {
43
-    redirect_header(XOOPS_URL . '/admin.php', 1, _MODULENOEXIST);
43
+    redirect_header(XOOPS_URL.'/admin.php', 1, _MODULENOEXIST);
44 44
 }
45 45
 $memberHandler = xoops_getHandler('member');
46
-$group_list    =& $memberHandler->getGroupList();
46
+$group_list    = & $memberHandler->getGroupList();
47 47
 if (is_array($HTTP_POST_VARS['perms']) && !empty($HTTP_POST_VARS['perms'])) {
48 48
     $gpermHandler = xoops_getHandler('groupperm');
49 49
     foreach ($HTTP_POST_VARS['perms'] as $perm_name => $perm_data) {
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
                             foreach ($parent_ids as $pid) {
67 67
                                 if (0 != $pid && !in_array($pid, array_keys($item_ids))) {
68 68
                                     // one of the parent items were not selected, so skip this item
69
-                                    $msg[] = sprintf(_MD_AM_PERMADDNG, '<b>' . $perm_name . '</b>', '<b>' . $perm_data['itemname'][$item_id] . '</b>', '<b>' . $group_list[$group_id] . '</b>') . ' (' . _MD_AM_PERMADDNGP . ')';
69
+                                    $msg[] = sprintf(_MD_AM_PERMADDNG, '<b>'.$perm_name.'</b>', '<b>'.$perm_data['itemname'][$item_id].'</b>', '<b>'.$group_list[$group_id].'</b>').' ('._MD_AM_PERMADDNGP.')';
70 70
                                     continue 2;
71 71
                                 }
72 72
                             }
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
                         $gperm->setVar('gperm_modid', $modid);
78 78
                         $gperm->setVar('gperm_itemid', $item_id);
79 79
                         if (!$gpermHandler->insert($gperm)) {
80
-                            $msg[] = sprintf(_MD_AM_PERMADDNG, '<b>' . $perm_name . '</b>', '<b>' . $perm_data['itemname'][$item_id] . '</b>', '<b>' . $group_list[$group_id] . '</b>');
80
+                            $msg[] = sprintf(_MD_AM_PERMADDNG, '<b>'.$perm_name.'</b>', '<b>'.$perm_data['itemname'][$item_id].'</b>', '<b>'.$group_list[$group_id].'</b>');
81 81
                         } else {
82
-                            $msg[] = sprintf(_MD_AM_PERMADDOK, '<b>' . $perm_name . '</b>', '<b>' . $perm_data['itemname'][$item_id] . '</b>', '<b>' . $group_list[$group_id] . '</b>');
82
+                            $msg[] = sprintf(_MD_AM_PERMADDOK, '<b>'.$perm_name.'</b>', '<b>'.$perm_data['itemname'][$item_id].'</b>', '<b>'.$group_list[$group_id].'</b>');
83 83
                         }
84 84
                         unset($gperm);
85 85
                     }
Please login to merge, or discard this patch.