Passed
Branch master (4e30dc)
by Michael
02:20
created
class/Utility.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
                 break;
72 72
 
73 73
             case 'inside':
74
-                return XOOPS_URL . '/modules/smartfaq/doc/';
74
+                return XOOPS_URL.'/modules/smartfaq/doc/';
75 75
                 break;
76 76
 
77 77
             case 'custom':
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     {
89 89
         $ret = '';
90 90
         foreach ($errors as $key => $value) {
91
-            $ret .= '<br> - ' . $value;
91
+            $ret .= '<br> - '.$value;
92 92
         }
93 93
 
94 94
         return $ret;
@@ -112,13 +112,13 @@  discard block
 block discarded – undo
112 112
             $spaces .= '--';
113 113
         }
114 114
 
115
-        $ret .= "<option value='" . $categoryObj->categoryid() . "'";
115
+        $ret .= "<option value='".$categoryObj->categoryid()."'";
116 116
         if ($selectedid == $categoryObj->categoryid()) {
117 117
             $ret .= ' selected';
118 118
         }
119
-        $ret .= '>' . $spaces . $categoryObj->name() . "</option>\n";
119
+        $ret .= '>'.$spaces.$categoryObj->name()."</option>\n";
120 120
 
121
-        $subCategoriesObj =& $categoryHandler->getCategories(0, 0, $categoryObj->categoryid());
121
+        $subCategoriesObj = & $categoryHandler->getCategories(0, 0, $categoryObj->categoryid());
122 122
         if (count($subCategoriesObj) > 0) {
123 123
             ++$level;
124 124
             foreach ($subCategoriesObj as $catID => $subCategoryObj) {
@@ -137,10 +137,10 @@  discard block
 block discarded – undo
137 137
      */
138 138
     public static function createCategorySelect($selectedid = 0, $parentcategory = 0, $allCatOption = true)
139 139
     {
140
-        $ret = '' . _MB_SF_SELECTCAT . "&nbsp;<select name='options[]'>";
140
+        $ret = ''._MB_SF_SELECTCAT."&nbsp;<select name='options[]'>";
141 141
         if ($allCatOption) {
142 142
             $ret .= "<option value='0'";
143
-            $ret .= '>' . _MB_SF_ALLCAT . "</option>\n";
143
+            $ret .= '>'._MB_SF_ALLCAT."</option>\n";
144 144
         }
145 145
 
146 146
         // Creating the category handler object
@@ -209,9 +209,9 @@  discard block
 block discarded – undo
209 209
     {
210 210
         $smartModule = self::getModuleInfo();
211 211
 
212
-        $modfootertxt = 'Module ' . $smartModule->getInfo('name') . ' - Version ' . $smartModule->getInfo('version') . '';
212
+        $modfootertxt = 'Module '.$smartModule->getInfo('name').' - Version '.$smartModule->getInfo('version').'';
213 213
 
214
-        $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>";
214
+        $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>";
215 215
 
216 216
         return $modfooter;
217 217
     }
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
         $module_id   = $smartModule->getVar('mid');
234 234
 
235 235
         if (!empty($xoopsUser)) {
236
-            $groups =& $xoopsUser->getGroups();
236
+            $groups = & $xoopsUser->getGroups();
237 237
             $result = in_array(XOOPS_GROUP_ADMIN, $groups) || $xoopsUser->isAdmin($module_id);
238 238
         }
239 239
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 
308 308
         $gpermHandler = xoops_getHandler('groupperm');
309 309
 
310
-        $sql    = 'SELECT faqid FROM ' . $xoopsDB->prefix('smartfaq_faq') . " WHERE categoryid = '$categoryid' ";
310
+        $sql    = 'SELECT faqid FROM '.$xoopsDB->prefix('smartfaq_faq')." WHERE categoryid = '$categoryid' ";
311 311
         $result = $xoopsDB->queryF($sql);
312 312
 
313 313
         if ($GLOBALS['xoopsDB']->getRowsNum($result) > 0) {
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
         $ret = [];
423 423
         global $xoopsDB;
424 424
 
425
-        $result = $xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('smartfaq_faq') . " WHERE faqid = '$faqid'");
425
+        $result = $xoopsDB->queryF('SELECT * FROM '.$xoopsDB->prefix('smartfaq_faq')." WHERE faqid = '$faqid'");
426 426
         $ret    = $xoopsDB->fetchArray($result);
427 427
 
428 428
         return $ret;
@@ -441,26 +441,26 @@  discard block
 block discarded – undo
441 441
     {
442 442
         global $xoopsUser, $xoopsModule, $xoopsModuleConfig, $xoopsConfig;
443 443
         $adminLinks = '';
444
-        $modulePath = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/';
444
+        $modulePath = XOOPS_URL.'/modules/'.$xoopsModule->dirname().'/';
445 445
         $page       = $open ? 'question.php' : 'faq.php';
446 446
         if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->getVar('mid'))) {
447 447
             // Edit button
448
-            $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>";
448
+            $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>";
449 449
             $adminLinks .= ' ';
450 450
             // Delete button
451
-            $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>";
451
+            $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>";
452 452
             $adminLinks .= ' ';
453 453
         }
454 454
         // Print button
455
-        $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>";
455
+        $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>";
456 456
         $adminLinks .= ' ';
457 457
         // Email button
458
-        $maillink   = 'mailto:?subject=' . sprintf(_MD_SF_INTARTICLE, $xoopsConfig['sitename']) . '&amp;body=' . sprintf(_MD_SF_INTARTFOUND, $xoopsConfig['sitename']) . ':  ' . $modulePath . 'faq.php?faqid=' . $faqid;
459
-        $adminLinks .= '<a href="' . $maillink . "\"><img src='" . $modulePath . "assets/images/links/friend.gif' title='" . _MD_SF_MAIL . "' alt='" . _MD_SF_MAIL . "'></a>";
458
+        $maillink = 'mailto:?subject='.sprintf(_MD_SF_INTARTICLE, $xoopsConfig['sitename']).'&amp;body='.sprintf(_MD_SF_INTARTFOUND, $xoopsConfig['sitename']).':  '.$modulePath.'faq.php?faqid='.$faqid;
459
+        $adminLinks .= '<a href="'.$maillink."\"><img src='".$modulePath."assets/images/links/friend.gif' title='"._MD_SF_MAIL."' alt='"._MD_SF_MAIL."'></a>";
460 460
         $adminLinks .= ' ';
461 461
         // Submit New Answer button
462 462
         if ($xoopsModuleConfig['allownewanswer'] && (is_object($xoopsUser) || $xoopsModuleConfig['anonpost'])) {
463
-            $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>";
463
+            $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>";
464 464
             $adminLinks .= ' ';
465 465
         }
466 466
 
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
                 if (!isset($users[$userid])) {
492 492
                     return $GLOBALS['xoopsConfig']['anonymous'];
493 493
                 }
494
-                $user =& $users[$userid];
494
+                $user = & $users[$userid];
495 495
             }
496 496
 
497 497
             if (is_object($user)) {
@@ -505,9 +505,9 @@  discard block
 block discarded – undo
505 505
                     $fullname = $user->getVar('name');
506 506
                 }
507 507
                 if (!empty($fullname)) {
508
-                    $linkeduser = "$fullname [<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . $ts->htmlSpecialChars($username) . '</a>]';
508
+                    $linkeduser = "$fullname [<a href='".XOOPS_URL.'/userinfo.php?uid='.$userid."'>".$ts->htmlSpecialChars($username).'</a>]';
509 509
                 } else {
510
-                    $linkeduser = "<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . ucwords($ts->htmlSpecialChars($username)) . '</a>';
510
+                    $linkeduser = "<a href='".XOOPS_URL.'/userinfo.php?uid='.$userid."'>".ucwords($ts->htmlSpecialChars($username)).'</a>';
511 511
                 }
512 512
 
513 513
                 return $linkeduser;
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
             //-->
590 590
         </script>
591 591
         <?php
592
-        echo "<h3 style=\"color: #2F5376; margin: 6px 0 0 0; \"><a href='#' onClick=\"toggle('" . $tablename . "'); toggleIcon('" . $iconname . "');\">";
592
+        echo "<h3 style=\"color: #2F5376; margin: 6px 0 0 0; \"><a href='#' onClick=\"toggle('".$tablename."'); toggleIcon('".$iconname."');\">";
593 593
     }
594 594
 
595 595
     /**
@@ -602,16 +602,16 @@  discard block
 block discarded – undo
602 602
         static $handlers;
603 603
         $name = strtolower(trim($name));
604 604
         if (!isset($handlers[$name])) {
605
-            if (file_exists($hnd_file = XOOPS_ROOT_PATH . '/modules/smartfaq/class/' . $name . '.php')) {
605
+            if (file_exists($hnd_file = XOOPS_ROOT_PATH.'/modules/smartfaq/class/'.$name.'.php')) {
606 606
                 require_once $hnd_file;
607 607
             }
608
-            $class = 'sf' . ucfirst($name) . 'Handler';
608
+            $class = 'sf'.ucfirst($name).'Handler';
609 609
             if (class_exists($class)) {
610 610
                 $handlers[$name] = new $class($GLOBALS['xoopsDB']);
611 611
             }
612 612
         }
613 613
         if (!$optional && !isset($handlers[$name])) {
614
-            trigger_error('Class <b>' . $class . '</b> does not exist<br>Handler Name: ' . $name, E_USER_ERROR);
614
+            trigger_error('Class <b>'.$class.'</b> does not exist<br>Handler Name: '.$name, E_USER_ERROR);
615 615
         }
616 616
         $false = false;
617 617
 
Please login to merge, or discard this patch.
class/Answer.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
             $attachment_save = base64_encode(serialize($this->attachment_array));
101 101
         }
102 102
         $this->setVar('attachment', $attachment_save);
103
-        $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('smartfaq_answers') . ' SET attachment=' . $GLOBALS['xoopsDB']->quoteString($attachment_save) . ' WHERE post_id = ' . $this->getVar('answerid');
103
+        $sql = 'UPDATE '.$GLOBALS['xoopsDB']->prefix('smartfaq_answers').' SET attachment='.$GLOBALS['xoopsDB']->quoteString($attachment_save).' WHERE post_id = '.$this->getVar('answerid');
104 104
         if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) {
105 105
             //xoops_error($GLOBALS["xoopsDB"]->error());
106 106
             return false;
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 
133 133
         foreach ($attach_old as $key => $attach) {
134 134
             if (in_array($key, $attach_array)) {
135
-                @unlink(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attach['name_saved']);
136
-                @unlink(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/thumbs/' . $attach['name_saved']); // delete thumbnails
135
+                @unlink(XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/'.$attach['name_saved']);
136
+                @unlink(XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/thumbs/'.$attach['name_saved']); // delete thumbnails
137 137
                 continue;
138 138
             }
139 139
             $this->attachment_array[$key] = $attach;
@@ -190,24 +190,24 @@  discard block
 block discarded – undo
190 190
         if (is_array($attachments) && count($attachments) > 0) {
191 191
             $iconHandler = sf_getIconHandler();
192 192
             $mime_path   = $iconHandler->getPath('mime');
193
-            require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/include/functions.image.php';
193
+            require_once XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname', 'n').'/include/functions.image.php';
194 194
             $image_extensions = ['jpg', 'jpeg', 'gif', 'png', 'bmp']; // need improve !!!
195
-            $post_attachment  .= '<br><strong>' . _MD_ATTACHMENT . '</strong>:';
195
+            $post_attachment  .= '<br><strong>'._MD_ATTACHMENT.'</strong>:';
196 196
             $post_attachment  .= '<br><hr size="1" noshade="noshade"><br>';
197 197
             foreach ($attachments as $key => $att) {
198 198
                 $file_extension = ltrim(strrchr($att['name_saved'], '.'), '.');
199 199
                 $filetype       = $file_extension;
200
-                if (file_exists(XOOPS_ROOT_PATH . '/' . $mime_path . '/' . $filetype . '.gif')) {
201
-                    $icon_filetype = XOOPS_URL . '/' . $mime_path . '/' . $filetype . '.gif';
200
+                if (file_exists(XOOPS_ROOT_PATH.'/'.$mime_path.'/'.$filetype.'.gif')) {
201
+                    $icon_filetype = XOOPS_URL.'/'.$mime_path.'/'.$filetype.'.gif';
202 202
                 } else {
203
-                    $icon_filetype = XOOPS_URL . '/' . $mime_path . '/unknown.gif';
203
+                    $icon_filetype = XOOPS_URL.'/'.$mime_path.'/unknown.gif';
204 204
                 }
205
-                $file_size = @filesize(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $att['name_saved']);
206
-                $file_size = number_format($file_size / 1024, 2) . ' KB';
205
+                $file_size = @filesize(XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/'.$att['name_saved']);
206
+                $file_size = number_format($file_size / 1024, 2).' KB';
207 207
                 if ($xoopsModuleConfig['media_allowed'] && in_array(strtolower($file_extension), $image_extensions)) {
208
-                    $post_attachment .= '<br><img src="' . $icon_filetype . '" alt="' . $filetype . '"><strong>&nbsp; ' . $att['name_display'] . '</strong> <small>(' . $file_size . ')</small>';
209
-                    $post_attachment .= '<br>' . sf_attachmentImage($att['name_saved']);
210
-                    $isDisplayed     = true;
208
+                    $post_attachment .= '<br><img src="'.$icon_filetype.'" alt="'.$filetype.'"><strong>&nbsp; '.$att['name_display'].'</strong> <small>('.$file_size.')</small>';
209
+                    $post_attachment .= '<br>'.sf_attachmentImage($att['name_saved']);
210
+                    $isDisplayed = true;
211 211
                 } else {
212 212
                     global $xoopsUser;
213 213
                     if (empty($xoopsModuleConfig['show_userattach'])) {
@@ -364,9 +364,9 @@  discard block
 block discarded – undo
364 364
         $tags                  = [];
365 365
         $tags['MODULE_NAME']   = $myts->displayTarea($smartModule->getVar('name'));
366 366
         $tags['FAQ_NAME']      = $faqObj->question();
367
-        $tags['FAQ_URL']       = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/faq.php?faqid=' . $faqObj->faqid();
367
+        $tags['FAQ_URL']       = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/faq.php?faqid='.$faqObj->faqid();
368 368
         $tags['CATEGORY_NAME'] = $faqObj->getCategoryName();
369
-        $tags['CATEGORY_URL']  = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/category.php?categoryid=' . $faqObj->categoryid();
369
+        $tags['CATEGORY_URL']  = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/category.php?categoryid='.$faqObj->categoryid();
370 370
         $tags['FAQ_QUESTION']  = $faqObj->question();
371 371
 
372 372
         // TODO : Not sure about the 'formpreview' ...
Please login to merge, or discard this patch.
class/Faq.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
         if (0 != $maxLength) {
188 188
             if (!XOOPS_USE_MULTIBYTES) {
189 189
                 if (strlen($ret) >= $maxLength) {
190
-                    $ret = substr($ret, 0, $maxLength - 1) . '...';
190
+                    $ret = substr($ret, 0, $maxLength - 1).'...';
191 191
                 }
192 192
             }
193 193
         }
@@ -379,14 +379,14 @@  discard block
 block discarded – undo
379 379
                 $theAnswers = $answerHandler->getAllAnswers($this->faqid(), Constants::SF_AN_STATUS_APPROVED, 1, 0);
380 380
                 //echo "test";
381 381
                 //exit;
382
-                $this->answer =& $theAnswers[0];
382
+                $this->answer = & $theAnswers[0];
383 383
                 break;
384 384
 
385 385
             case Constants::SF_STATUS_ANSWERED:
386 386
                 $theAnswers = $answerHandler->getAllAnswers($this->faqid(), Constants::SF_AN_STATUS_PROPOSED, 1, 0);
387 387
                 //echo "test";
388 388
                 //exit;
389
-                $this->answer =& $theAnswers[0];
389
+                $this->answer = & $theAnswers[0];
390 390
                 break;
391 391
 
392 392
             case Constants::SF_STATUS_PUBLISHED:
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
         $tags['MODULE_NAME']   = $myts->displayTarea($smartModule->getVar('name'));
473 473
         $tags['FAQ_NAME']      = $this->question();
474 474
         $tags['CATEGORY_NAME'] = $this->getCategoryName();
475
-        $tags['CATEGORY_URL']  = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/category.php?categoryid=' . $this->categoryid();
475
+        $tags['CATEGORY_URL']  = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/category.php?categoryid='.$this->categoryid();
476 476
         $tags['FAQ_QUESTION']  = $this->question();
477 477
         $answerObj             = $this->answer();
478 478
         if (is_object($answerObj)) {
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
         foreach ($notifications as $notification) {
485 485
             switch ($notification) {
486 486
                 case Constants::SF_NOT_FAQ_PUBLISHED:
487
-                    $tags['FAQ_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/faq.php?faqid=' . $this->faqid();
487
+                    $tags['FAQ_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/faq.php?faqid='.$this->faqid();
488 488
 
489 489
                     $notificationHandler->triggerEvent('global_faq', 0, 'published', $tags);
490 490
                     $notificationHandler->triggerEvent('category_faq', $this->categoryid(), 'published', $tags);
@@ -492,20 +492,20 @@  discard block
 block discarded – undo
492 492
                     break;
493 493
 
494 494
                 case Constants::SF_NOT_FAQ_SUBMITTED:
495
-                    $tags['WAITINGFILES_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/admin/faq.php?faqid=' . $this->faqid();
495
+                    $tags['WAITINGFILES_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/admin/faq.php?faqid='.$this->faqid();
496 496
                     $notificationHandler->triggerEvent('global_faq', 0, 'submitted', $tags);
497 497
                     $notificationHandler->triggerEvent('category_faq', $this->categoryid(), 'submitted', $tags);
498 498
                     break;
499 499
 
500 500
                 case Constants::SF_NOT_QUESTION_PUBLISHED:
501
-                    $tags['FAQ_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/answer.php?faqid=' . $this->faqid();
501
+                    $tags['FAQ_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/answer.php?faqid='.$this->faqid();
502 502
                     $notificationHandler->triggerEvent('global_question', 0, 'published', $tags);
503 503
                     $notificationHandler->triggerEvent('category_question', $this->categoryid(), 'published', $tags);
504 504
                     $notificationHandler->triggerEvent('question', $this->faqid(), 'approved', $tags);
505 505
                     break;
506 506
 
507 507
                 case Constants::SF_NOT_QUESTION_SUBMITTED:
508
-                    $tags['WAITINGFILES_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/admin/question.php?op=mod&faqid=' . $this->faqid();
508
+                    $tags['WAITINGFILES_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/admin/question.php?op=mod&faqid='.$this->faqid();
509 509
                     $notificationHandler->triggerEvent('global_question', 0, 'submitted', $tags);
510 510
                     $notificationHandler->triggerEvent('category_question', $this->categoryid(), 'submitted', $tags);
511 511
                     break;
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
                     break;
516 516
 
517 517
                 case Constants::SF_NOT_NEW_ANSWER_PROPOSED:
518
-                    $tags['WAITINGFILES_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/admin/answer.php?op=mod&faqid=' . $this->faqid();
518
+                    $tags['WAITINGFILES_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/admin/answer.php?op=mod&faqid='.$this->faqid();
519 519
                     $notificationHandler->triggerEvent('global_faq', 0, 'answer_proposed', $tags);
520 520
                     $notificationHandler->triggerEvent('category_faq', $this->categoryid(), 'answer_proposed', $tags);
521 521
                     break;
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
             $text = _MD_SF_FAQCOMEFROM;
630 630
         }
631 631
 
632
-        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>';
632
+        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>';
633 633
     }
634 634
 
635 635
     /**
@@ -648,9 +648,9 @@  discard block
 block discarded – undo
648 648
         $faq['question']   = $this->question();
649 649
         $page              = (Constants::SF_STATUS_OPENED == $this->status()) ? 'answer.php' : 'faq.php';
650 650
 
651
-        $faq['questionlink'] = "<a href='$page?faqid=" . $this->faqid() . "'>" . $this->question($lastfaqsize) . '</a>';
651
+        $faq['questionlink'] = "<a href='$page?faqid=".$this->faqid()."'>".$this->question($lastfaqsize).'</a>';
652 652
         if ($linkInQuestion) {
653
-            $faq['fullquestionlink'] = "<a href='$page?faqid=" . $this->faqid() . "'>" . $this->question() . '</a>';
653
+            $faq['fullquestionlink'] = "<a href='$page?faqid=".$this->faqid()."'>".$this->question().'</a>';
654 654
         } else {
655 655
             $faq['fullquestionlink'] = $this->question();
656 656
         }
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
                 $categoryObj = $category[$this->categoryid()];
667 667
             }
668 668
             $faq['categoryname'] = $categoryObj->getVar('name');
669
-            $faq['categorylink'] = "<a href='" . XOOPS_URL . '/modules/smartfaq/category.php?categoryid=' . $this->categoryid() . "'>" . $categoryObj->getVar('name') . '</a>';
669
+            $faq['categorylink'] = "<a href='".XOOPS_URL.'/modules/smartfaq/category.php?categoryid='.$this->categoryid()."'>".$categoryObj->getVar('name').'</a>';
670 670
         }
671 671
 
672 672
         return $faq;
Please login to merge, or discard this patch.
class/FaqHandler.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     public function get($id)
49 49
     {
50 50
         if ((int)$id > 0) {
51
-            $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_faq') . ' WHERE faqid=' . $id;
51
+            $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_faq').' WHERE faqid='.$id;
52 52
             if (!$result = $this->db->query($sql)) {
53 53
                 return false;
54 54
             }
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 //            $faq->setError($this->db->error());
165 165
 
166 166
 
167
-            trigger_error('Class ' . $faq . ' could not be saved ' . __FILE__ . ' at line ' . __LINE__, E_USER_WARNING);
167
+            trigger_error('Class '.$faq.' could not be saved '.__FILE__.' at line '.__LINE__, E_USER_WARNING);
168 168
 
169 169
             return false;
170 170
         }
@@ -230,26 +230,26 @@  discard block
 block discarded – undo
230 230
     {
231 231
         $ret   = [];
232 232
         $limit = $start = 0;
233
-        $sql   = 'SELECT * FROM ' . $this->db->prefix('smartfaq_faq');
233
+        $sql   = 'SELECT * FROM '.$this->db->prefix('smartfaq_faq');
234 234
 
235 235
         if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) {
236 236
             $whereClause = $criteria->renderWhere();
237 237
 
238 238
             if ('WHERE ()' !== $whereClause) {
239
-                $sql .= ' ' . $criteria->renderWhere();
239
+                $sql .= ' '.$criteria->renderWhere();
240 240
                 if (!empty($notNullFields)) {
241 241
                     $sql .= $this->NotNullFieldClause($notNullFields, true);
242 242
                 }
243 243
             } elseif (!empty($notNullFields)) {
244
-                $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
244
+                $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
245 245
             }
246 246
             if ('' != $criteria->getSort()) {
247
-                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
247
+                $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
248 248
             }
249 249
             $limit = $criteria->getLimit();
250 250
             $start = $criteria->getStart();
251 251
         } elseif (!empty($notNullFields)) {
252
-            $sql .= $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
252
+            $sql .= $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
253 253
         }
254 254
 
255 255
         //echo "<br>" . $sql . "<br>";
@@ -268,9 +268,9 @@  discard block
 block discarded – undo
268 268
             $faq->assignVars($myrow);
269 269
 
270 270
             if (!$id_as_key) {
271
-                $ret[] =& $faq;
271
+                $ret[] = & $faq;
272 272
             } else {
273
-                $ret[$myrow['faqid']] =& $faq;
273
+                $ret[$myrow['faqid']] = & $faq;
274 274
             }
275 275
             unset($faq);
276 276
         }
@@ -310,26 +310,26 @@  discard block
 block discarded – undo
310 310
                             faq.modulelink AS modulelink,
311 311
                             faq.contextpage AS contextpage,
312 312
                             faq.exacturl AS exacturl
313
-                FROM ' . $this->db->prefix('smartfaq_faq') . ' AS faq INNER JOIN ' . $this->db->prefix('smartfaq_categories') . ' AS category ON faq.categoryid = category.categoryid ';
313
+                FROM ' . $this->db->prefix('smartfaq_faq').' AS faq INNER JOIN '.$this->db->prefix('smartfaq_categories').' AS category ON faq.categoryid = category.categoryid ';
314 314
 
315 315
         if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) {
316 316
             $whereClause = $criteria->renderWhere();
317 317
 
318 318
             if ('WHERE ()' !== $whereClause) {
319
-                $sql .= ' ' . $criteria->renderWhere();
319
+                $sql .= ' '.$criteria->renderWhere();
320 320
                 if (!empty($notNullFields)) {
321 321
                     $sql .= $this->NotNullFieldClause($notNullFields, true);
322 322
                 }
323 323
             } elseif (!empty($notNullFields)) {
324
-                $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
324
+                $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
325 325
             }
326 326
             if ('' != $criteria->getSort()) {
327
-                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
327
+                $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
328 328
             }
329 329
             $limit = $criteria->getLimit();
330 330
             $start = $criteria->getStart();
331 331
         } elseif (!empty($notNullFields)) {
332
-            $sql .= $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
332
+            $sql .= $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
333 333
         }
334 334
 
335 335
         //echo "<br>" . $sql . "<br>";
@@ -347,9 +347,9 @@  discard block
 block discarded – undo
347 347
             $faq->assignVars($myrow);
348 348
 
349 349
             if (!$id_as_key) {
350
-                $ret[] =& $faq;
350
+                $ret[] = & $faq;
351 351
             } else {
352
-                $ret[$myrow['faqid']] =& $faq;
352
+                $ret[$myrow['faqid']] = & $faq;
353 353
             }
354 354
             unset($faq);
355 355
         }
@@ -379,19 +379,19 @@  discard block
 block discarded – undo
379 379
      */
380 380
     public function getCount($criteria = null, $notNullFields = '')
381 381
     {
382
-        $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_faq');
382
+        $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('smartfaq_faq');
383 383
         if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) {
384 384
             $whereClause = $criteria->renderWhere();
385 385
             if ('WHERE ()' !== $whereClause) {
386
-                $sql .= ' ' . $criteria->renderWhere();
386
+                $sql .= ' '.$criteria->renderWhere();
387 387
                 if (!empty($notNullFields)) {
388 388
                     $sql .= $this->NotNullFieldClause($notNullFields, true);
389 389
                 }
390 390
             } elseif (!empty($notNullFields)) {
391
-                $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
391
+                $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
392 392
             }
393 393
         } elseif (!empty($notNullFields)) {
394
-            $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
394
+            $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
395 395
         }
396 396
 
397 397
         //echo "<br>" . $sql . "<br>";
@@ -425,11 +425,11 @@  discard block
 block discarded – undo
425 425
             $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission');
426 426
 
427 427
             $categoriesGranted = $smartPermHandler->getPermissions('category');
428
-            $grantedCategories = new \Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN');
428
+            $grantedCategories = new \Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN');
429 429
 
430 430
             $faqsGranted = $smartPermHandler->getPermissions('item');
431 431
             $grantedFaq  = new \CriteriaCompo();
432
-            $grantedFaq->add(new \Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR');
432
+            $grantedFaq->add(new \Criteria('faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR');
433 433
             // If user is anonymous, check if the FAQ allow partialview
434 434
             if (!is_object($xoopsUser)) {
435 435
                 $grantedFaq->add(new \Criteria('partialview', '1'), 'OR');
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
      */
477 477
     public function getFaqsCountByStatus()
478 478
     {
479
-        $sql    = 'SELECT status, COUNT(*) FROM ' . $this->db->prefix('smartfaq_faq') . ' GROUP BY status';
479
+        $sql    = 'SELECT status, COUNT(*) FROM '.$this->db->prefix('smartfaq_faq').' GROUP BY status';
480 480
         $result = $this->db->query($sql);
481 481
         if (!$result) {
482 482
             return [];
@@ -546,11 +546,11 @@  discard block
 block discarded – undo
546 546
             $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission');
547 547
 
548 548
             $categoriesGranted = $smartPermHandler->getPermissions('category');
549
-            $grantedCategories = new \Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN');
549
+            $grantedCategories = new \Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN');
550 550
 
551 551
             $faqsGranted = $smartPermHandler->getPermissions('item');
552 552
             $grantedFaq  = new \CriteriaCompo();
553
-            $grantedFaq->add(new \Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR');
553
+            $grantedFaq->add(new \Criteria('faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR');
554 554
             // If user is anonymous, check if the FAQ allow partialview
555 555
             if (!is_object($xoopsUser)) {
556 556
                 $grantedFaq->add(new \Criteria('partialview', '1'), 'OR');
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 
560 560
         if (isset($categoryid) && (-1 != $categoryid)) {
561 561
             if (is_array($categoryid)) {
562
-                $criteriaCategory = new \Criteria('categoryid', '(' . implode(',', $categoryid) . ')', 'IN');
562
+                $criteriaCategory = new \Criteria('categoryid', '('.implode(',', $categoryid).')', 'IN');
563 563
             } else {
564 564
                 $criteriaCategory = new \Criteria('categoryid', (int)$categoryid);
565 565
             }
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
         $criteria->setStart($start);
603 603
         $criteria->setSort($sort);
604 604
         $criteria->setOrder($order);
605
-        $ret =& $this->getObjects($criteria, false, $notNullFields);
605
+        $ret = & $this->getObjects($criteria, false, $notNullFields);
606 606
 
607 607
         return $ret;
608 608
     }
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
             $entrynumber = mt_rand(0, $totalFaqs);
692 692
             $faq         = $this->getFaqs(1, $entrynumber, $status, -1, 'datesub', 'DESC', $notNullFields);
693 693
             if ($faq) {
694
-                $ret =& $faq[0];
694
+                $ret = & $faq[0];
695 695
             }
696 696
         }
697 697
 
@@ -722,10 +722,10 @@  discard block
 block discarded – undo
722 722
                 $httphost    = $_SERVER['HTTP_HOST'];
723 723
                 $querystring = $_SERVER['QUERY_STRING'];
724 724
                 if ('' != $querystring) {
725
-                    $querystring = '?' . $querystring;
725
+                    $querystring = '?'.$querystring;
726 726
                 }
727
-                $currenturl     = $http . $httphost . $phpself . $querystring;
728
-                $fullcontexturl = XOOPS_URL . '/' . $iValue->contextpage();
727
+                $currenturl     = $http.$httphost.$phpself.$querystring;
728
+                $fullcontexturl = XOOPS_URL.'/'.$iValue->contextpage();
729 729
                 switch ($iValue->modulelink()) {
730 730
                     case '':
731 731
                         $display = false;
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
                         }
745 745
                         break;
746 746
                     default:
747
-                        if (false === strpos($currenturl, XOOPS_URL . '/modules/')) {
747
+                        if (false === strpos($currenturl, XOOPS_URL.'/modules/')) {
748 748
                             $display = false;
749 749
                         } else {
750 750
                             if (false === strpos($currenturl, $iValue->modulelink())) {
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
                         break;
757 757
                 }
758 758
                 if ($display) {
759
-                    $randomFaqs[] =& $faqsObj[$i];
759
+                    $randomFaqs[] = & $faqsObj[$i];
760 760
                 }
761 761
             }
762 762
         }
@@ -765,10 +765,10 @@  discard block
 block discarded – undo
765 765
             mt_srand((float)microtime() * 10000000);
766 766
             $rand_keys = array_rand($randomFaqs, $limit);
767 767
             for ($j = 0, $jMax = count($rand_keys); $j < $jMax; ++$j) {
768
-                $ret[] =& $randomFaqs[$rand_keys[$j]];
768
+                $ret[] = & $randomFaqs[$rand_keys[$j]];
769 769
             }
770 770
         } else {
771
-            $ret =& $randomFaqs;
771
+            $ret = & $randomFaqs;
772 772
         }
773 773
 
774 774
         return $ret;
@@ -786,14 +786,14 @@  discard block
 block discarded – undo
786 786
             /** @var \XoopsModules\Smartfaq\PermissionHandler $smartPermHandler */
787 787
             $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission');
788 788
             $items            = $smartPermHandler->getPermissions('item');
789
-            $faqclause        = ' AND faqid IN (' . implode(',', $items) . ')';
789
+            $faqclause        = ' AND faqid IN ('.implode(',', $items).')';
790 790
         }
791 791
 
792 792
         $sql  = "CREATE TEMPORARY TABLE tmp (categoryid INT(8) UNSIGNED NOT NULL,datesub INT(11) DEFAULT '0' NOT NULL);";
793
-        $sql2 = ' LOCK TABLES ' . $this->db->prefix('smartfaq_faq') . ' READ;';
794
-        $sql3 = ' INSERT INTO tmp SELECT categoryid, MAX(datesub) FROM ' . $this->db->prefix('smartfaq_faq') . ' WHERE status IN (' . implode(',', $status) . ") $faqclause GROUP BY categoryid;";
795
-        $sql4 = ' SELECT ' . $this->db->prefix('smartfaq_faq') . '.categoryid, faqid, question, uid, ' . $this->db->prefix('smartfaq_faq') . '.datesub FROM ' . $this->db->prefix('smartfaq_faq') . ', tmp
796
-                              WHERE ' . $this->db->prefix('smartfaq_faq') . '.categoryid=tmp.categoryid AND ' . $this->db->prefix('smartfaq_faq') . '.datesub=tmp.datesub;';
793
+        $sql2 = ' LOCK TABLES '.$this->db->prefix('smartfaq_faq').' READ;';
794
+        $sql3 = ' INSERT INTO tmp SELECT categoryid, MAX(datesub) FROM '.$this->db->prefix('smartfaq_faq').' WHERE status IN ('.implode(',', $status).") $faqclause GROUP BY categoryid;";
795
+        $sql4 = ' SELECT '.$this->db->prefix('smartfaq_faq').'.categoryid, faqid, question, uid, '.$this->db->prefix('smartfaq_faq').'.datesub FROM '.$this->db->prefix('smartfaq_faq').', tmp
796
+                              WHERE ' . $this->db->prefix('smartfaq_faq').'.categoryid=tmp.categoryid AND '.$this->db->prefix('smartfaq_faq').'.datesub=tmp.datesub;';
797 797
         /*
798 798
         //Old implementation
799 799
         $sql = "SELECT categoryid, faqid, question, uid, MAX(datesub) AS datesub FROM ".$this->db->prefix("smartfaq_faq")."
@@ -808,14 +808,14 @@  discard block
 block discarded – undo
808 808
         $this->db->queryF('UNLOCK TABLES;');
809 809
         $this->db->queryF('DROP TABLE tmp;');
810 810
         if (!$result) {
811
-            trigger_error('Error in getLastPublishedByCat SQL: ' . $error);
811
+            trigger_error('Error in getLastPublishedByCat SQL: '.$error);
812 812
 
813 813
             return $ret;
814 814
         }
815 815
         while ($row = $this->db->fetchArray($result)) {
816 816
             $faq = new Smartfaq\Faq();
817 817
             $faq->assignVars($row);
818
-            $ret[$row['categoryid']] =& $faq;
818
+            $ret[$row['categoryid']] = & $faq;
819 819
             unset($faq);
820 820
         }
821 821
 
@@ -830,9 +830,9 @@  discard block
 block discarded – undo
830 830
      */
831 831
     public function deleteAll($criteria = null)
832 832
     {
833
-        $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_faq');
833
+        $sql = 'DELETE FROM '.$this->db->prefix('smartfaq_faq');
834 834
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
835
-            $sql .= ' ' . $criteria->renderWhere();
835
+            $sql .= ' '.$criteria->renderWhere();
836 836
         }
837 837
         if (!$this->db->query($sql)) {
838 838
             return false;
@@ -853,10 +853,10 @@  discard block
 block discarded – undo
853 853
      **/
854 854
     public function updateAll($fieldname, $fieldvalue, $criteria = null)
855 855
     {
856
-        $set_clause = is_numeric($fieldvalue) ? $fieldname . ' = ' . $fieldvalue : $fieldname . ' = ' . $this->db->quoteString($fieldvalue);
857
-        $sql        = 'UPDATE ' . $this->db->prefix('smartfaq_faq') . ' SET ' . $set_clause;
856
+        $set_clause = is_numeric($fieldvalue) ? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue);
857
+        $sql        = 'UPDATE '.$this->db->prefix('smartfaq_faq').' SET '.$set_clause;
858 858
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
859
-            $sql .= ' ' . $criteria->renderWhere();
859
+            $sql .= ' '.$criteria->renderWhere();
860 860
         }
861 861
         if (!$this->db->queryF($sql)) {
862 862
             return false;
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
      */
872 872
     public function updateCounter($faqid)
873 873
     {
874
-        $sql = 'UPDATE ' . $this->db->prefix('smartfaq_faq') . ' SET counter=counter+1 WHERE faqid = ' . $faqid;
874
+        $sql = 'UPDATE '.$this->db->prefix('smartfaq_faq').' SET counter=counter+1 WHERE faqid = '.$faqid;
875 875
         if ($this->db->queryF($sql)) {
876 876
             return true;
877 877
         } else {
@@ -927,8 +927,8 @@  discard block
 block discarded – undo
927 927
             $criteriaKeywords = new \CriteriaCompo();
928 928
             foreach ($queryarray as $iValue) {
929 929
                 $criteriaKeyword = new \CriteriaCompo();
930
-                $criteriaKeyword->add(new \Criteria('faq.question', '%' . $iValue . '%', 'LIKE'), 'OR');
931
-                $criteriaKeyword->add(new \Criteria('answer.answer', '%' . $iValue . '%', 'LIKE'), 'OR');
930
+                $criteriaKeyword->add(new \Criteria('faq.question', '%'.$iValue.'%', 'LIKE'), 'OR');
931
+                $criteriaKeyword->add(new \Criteria('answer.answer', '%'.$iValue.'%', 'LIKE'), 'OR');
932 932
                 $criteriaKeywords->add($criteriaKeyword, $andor);
933 933
                 unset($criteriaKeyword);
934 934
             }
@@ -947,9 +947,9 @@  discard block
 block discarded – undo
947 947
             if (!$faqsGranted) {
948 948
                 return $ret;
949 949
             }
950
-            $grantedCategories = new \Criteria('faq.categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN');
950
+            $grantedCategories = new \Criteria('faq.categoryid', '('.implode(',', $categoriesGranted).')', 'IN');
951 951
             $grantedFaq        = new \CriteriaCompo();
952
-            $grantedFaq->add(new \Criteria('faq.faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR');
952
+            $grantedFaq->add(new \Criteria('faq.faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR');
953 953
             // If user is anonymous, check if the FAQ allow partialview
954 954
             if (!is_object($xoopsUser)) {
955 955
                 $grantedFaq->add(new \Criteria('partialview', '1'), 'OR');
@@ -995,15 +995,15 @@  discard block
 block discarded – undo
995 995
         $criteria->setSort('faq.datesub');
996 996
         $criteria->setOrder('DESC');
997 997
 
998
-        $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';
998
+        $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';
999 999
 
1000 1000
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
1001 1001
             $whereClause = $criteria->renderWhere();
1002 1002
 
1003 1003
             if ('WHERE ()' !== $whereClause) {
1004
-                $sql .= ' ' . $criteria->renderWhere();
1004
+                $sql .= ' '.$criteria->renderWhere();
1005 1005
                 if ('' != $criteria->getSort()) {
1006
-                    $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
1006
+                    $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
1007 1007
                 }
1008 1008
                 $limit = $criteria->getLimit();
1009 1009
                 $start = $criteria->getStart();
@@ -1026,7 +1026,7 @@  discard block
 block discarded – undo
1026 1026
         while (false !== ($myrow = $this->db->fetchArray($result))) {
1027 1027
             $faq = new Smartfaq\Faq();
1028 1028
             $faq->assignVars($myrow);
1029
-            $ret[] =& $faq;
1029
+            $ret[] = & $faq;
1030 1030
             unset($faq);
1031 1031
         }
1032 1032
 
@@ -1042,20 +1042,20 @@  discard block
 block discarded – undo
1042 1042
     {
1043 1043
         global $xoopsUser;
1044 1044
         $ret = [];
1045
-        $sql = 'SELECT categoryid, COUNT(*) AS count FROM ' . $this->db->prefix('smartfaq_faq');
1045
+        $sql = 'SELECT categoryid, COUNT(*) AS count FROM '.$this->db->prefix('smartfaq_faq');
1046 1046
         if ((int)$cat_id > 0) {
1047
-            $sql .= ' WHERE categoryid = ' . (int)$cat_id;
1048
-            $sql .= ' AND status IN (' . implode(',', $status) . ')';
1047
+            $sql .= ' WHERE categoryid = '.(int)$cat_id;
1048
+            $sql .= ' AND status IN ('.implode(',', $status).')';
1049 1049
         } else {
1050
-            $sql .= ' WHERE status IN (' . implode(',', $status) . ')';
1050
+            $sql .= ' WHERE status IN ('.implode(',', $status).')';
1051 1051
             if (!Smartfaq\Utility::userIsAdmin()) {
1052 1052
                 /** @var \XoopsModules\Smartfaq\PermissionHandler $smartPermHandler */
1053 1053
                 $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission');
1054 1054
                 $items            = $smartPermHandler->getPermissions('item');
1055 1055
                 if (is_object($xoopsUser)) {
1056
-                    $sql .= ' AND faqid IN (' . implode(',', $items) . ')';
1056
+                    $sql .= ' AND faqid IN ('.implode(',', $items).')';
1057 1057
                 } else {
1058
-                    $sql .= ' AND (faqid IN (' . implode(',', $items) . ') OR partialview = 1)';
1058
+                    $sql .= ' AND (faqid IN ('.implode(',', $items).') OR partialview = 1)';
1059 1059
                 }
1060 1060
             }
1061 1061
         }
Please login to merge, or discard this patch.
class/Tree.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     {
70 70
         $selectId = (int)$selectId;
71 71
         $arr      = [];
72
-        $sql      = 'SELECT * FROM ' . $this->table . ' WHERE ' . $this->pid . '=' . $selectId . '';
72
+        $sql      = 'SELECT * FROM '.$this->table.' WHERE '.$this->pid.'='.$selectId.'';
73 73
         if ('' !== $order) {
74 74
             $sql .= " ORDER BY $order";
75 75
         }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     {
97 97
         $selectId = (int)$selectId;
98 98
         $idarray  = [];
99
-        $result   = $this->db->query('SELECT ' . $this->id . ' FROM ' . $this->table . ' WHERE ' . $this->pid . '=' . $selectId . '');
99
+        $result   = $this->db->query('SELECT '.$this->id.' FROM '.$this->table.' WHERE '.$this->pid.'='.$selectId.'');
100 100
         $count    = $this->db->getRowsNum($result);
101 101
         if (0 == $count) {
102 102
             return $idarray;
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
     public function getAllChildId($selectId, $order = '', array $idarray = [])
121 121
     {
122 122
         $selectId = (int)$selectId;
123
-        $sql      = 'SELECT ' . $this->id . ' FROM ' . $this->table . ' WHERE ' . $this->pid . '=' . $selectId . '';
123
+        $sql      = 'SELECT '.$this->id.' FROM '.$this->table.' WHERE '.$this->pid.'='.$selectId.'';
124 124
         if ('' !== $order) {
125 125
             $sql .= " ORDER BY $order";
126 126
         }
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
     public function getAllParentId($selectId, $order = '', array $idarray = [])
150 150
     {
151 151
         $selectId = (int)$selectId;
152
-        $sql      = 'SELECT ' . $this->pid . ' FROM ' . $this->table . ' WHERE ' . $this->id . '=' . $selectId . '';
152
+        $sql      = 'SELECT '.$this->pid.' FROM '.$this->table.' WHERE '.$this->id.'='.$selectId.'';
153 153
         if ('' !== $order) {
154 154
             $sql .= " ORDER BY $order";
155 155
         }
@@ -176,14 +176,14 @@  discard block
 block discarded – undo
176 176
     public function getPathFromId($selectId, $title, $path = '')
177 177
     {
178 178
         $selectId = (int)$selectId;
179
-        $result   = $this->db->query('SELECT ' . $this->pid . ', ' . $title . ' FROM ' . $this->table . ' WHERE ' . $this->id . "=$selectId");
179
+        $result   = $this->db->query('SELECT '.$this->pid.', '.$title.' FROM '.$this->table.' WHERE '.$this->id."=$selectId");
180 180
         if (0 == $this->db->getRowsNum($result)) {
181 181
             return $path;
182 182
         }
183 183
         list($parentid, $name) = $this->db->fetchRow($result);
184 184
         $myts = \MyTextSanitizer::getInstance();
185 185
         $name = $myts->htmlspecialchars($name);
186
-        $path = '/' . $name . $path . '';
186
+        $path = '/'.$name.$path.'';
187 187
         if (0 == $parentid) {
188 188
             return $path;
189 189
         }
@@ -209,12 +209,12 @@  discard block
 block discarded – undo
209 209
             $sel_name = $this->id;
210 210
         }
211 211
         $myts = \MyTextSanitizer::getInstance();
212
-        echo "<select name='" . $sel_name . "'";
212
+        echo "<select name='".$sel_name."'";
213 213
         if ('' !== $onchange) {
214
-            echo " onchange='" . $onchange . "'";
214
+            echo " onchange='".$onchange."'";
215 215
         }
216 216
         echo ">\n";
217
-        $sql = 'SELECT ' . $this->id . ', ' . $title . ' FROM ' . $this->table . ' WHERE ' . $this->pid . '=0';
217
+        $sql = 'SELECT '.$this->id.', '.$title.' FROM '.$this->table.' WHERE '.$this->pid.'=0';
218 218
         if ('' !== $order) {
219 219
             $sql .= " ORDER BY $order";
220 220
         }
@@ -232,11 +232,11 @@  discard block
 block discarded – undo
232 232
             $arr = $this->getChildTreeArray($catid, $order);
233 233
             foreach ($arr as $option) {
234 234
                 $option['prefix'] = str_replace('.', '--', $option['prefix']);
235
-                $catpath          = $option['prefix'] . '&nbsp;' . $myts->htmlspecialchars($option[$title]);
235
+                $catpath          = $option['prefix'].'&nbsp;'.$myts->htmlspecialchars($option[$title]);
236 236
                 if ($option[$this->id] == $preset_id) {
237 237
                     $sel = " selected='selected'";
238 238
                 }
239
-                echo "<option value='" . $option[$this->id] . "'$sel>$catpath</option>\n";
239
+                echo "<option value='".$option[$this->id]."'$sel>$catpath</option>\n";
240 240
                 $sel = '';
241 241
             }
242 242
         }
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
     {
258 258
         $path     = !empty($path) ? $path : $path;
259 259
         $selectId = (int)$selectId;
260
-        $sql      = 'SELECT ' . $this->pid . ', ' . $title . ' FROM ' . $this->table . ' WHERE ' . $this->id . "=$selectId";
260
+        $sql      = 'SELECT '.$this->pid.', '.$title.' FROM '.$this->table.' WHERE '.$this->id."=$selectId";
261 261
         $result   = $this->db->query($sql);
262 262
         if (0 == $this->db->getRowsNum($result)) {
263 263
             return $path;
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         list($parentid, $name) = $this->db->fetchRow($result);
266 266
         $myts = \MyTextSanitizer::getInstance();
267 267
         $name = $myts->htmlspecialchars($name);
268
-        $path = "<li><a href='" . $funcURL . '&amp;' . $this->id . '=' . $selectId . "'>" . $name . '</a></li>' . $path . '';
268
+        $path = "<li><a href='".$funcURL.'&amp;'.$this->id.'='.$selectId."'>".$name.'</a></li>'.$path.'';
269 269
         if (0 == $parentid) {
270 270
             return $path;
271 271
         }
@@ -285,12 +285,12 @@  discard block
 block discarded – undo
285 285
     public function getIdPathFromId($selectId, $path = '')
286 286
     {
287 287
         $selectId = (int)$selectId;
288
-        $result   = $this->db->query('SELECT ' . $this->pid . ' FROM ' . $this->table . ' WHERE ' . $this->id . "=$selectId");
288
+        $result   = $this->db->query('SELECT '.$this->pid.' FROM '.$this->table.' WHERE '.$this->id."=$selectId");
289 289
         if (0 == $this->db->getRowsNum($result)) {
290 290
             return $path;
291 291
         }
292 292
         list($parentid) = $this->db->fetchRow($result);
293
-        $path = '/' . $selectId . $path . '';
293
+        $path = '/'.$selectId.$path.'';
294 294
         if (0 == $parentid) {
295 295
             return $path;
296 296
         }
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
     public function getAllChild($selectId = 0, $order = '', array $parray = [])
312 312
     {
313 313
         $selectId = (int)$selectId;
314
-        $sql      = 'SELECT * FROM ' . $this->table . ' WHERE ' . $this->pid . '=' . $selectId . '';
314
+        $sql      = 'SELECT * FROM '.$this->table.' WHERE '.$this->pid.'='.$selectId.'';
315 315
         if ('' !== $order) {
316 316
             $sql .= " ORDER BY $order";
317 317
         }
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
     public function getChildTreeArray($selectId = 0, $order = '', array $parray = [], $r_prefix = '')
342 342
     {
343 343
         $selectId = (int)$selectId;
344
-        $sql      = 'SELECT * FROM ' . $this->table . ' WHERE ' . $this->pid . '=' . $selectId . '';
344
+        $sql      = 'SELECT * FROM '.$this->table.' WHERE '.$this->pid.'='.$selectId.'';
345 345
         if ('' !== $order) {
346 346
             $sql .= " ORDER BY $order";
347 347
         }
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
             return $parray;
352 352
         }
353 353
         while (false !== ($row = $this->db->fetchArray($result))) {
354
-            $row['prefix'] = $r_prefix . '.';
354
+            $row['prefix'] = $r_prefix.'.';
355 355
             array_push($parray, $row);
356 356
             $parray = $this->getChildTreeArray($row[$this->id], $order, $parray, $row['prefix']);
357 357
         }
Please login to merge, or discard this patch.
class/CategoryHandler.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     {
48 48
         $false = false;
49 49
         if ((int)$id > 0) {
50
-            $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_categories') . ' WHERE categoryid=' . $id;
50
+            $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_categories').' WHERE categoryid='.$id;
51 51
             if (!$result = $this->db->query($sql)) {
52 52
                 return $false;
53 53
             }
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         }
150 150
 
151 151
         // Deleteing the sub categories
152
-        $subcats =& $this->getCategories(0, 0, $category->categoryid());
152
+        $subcats = & $this->getCategories(0, 0, $category->categoryid());
153 153
         foreach ($subcats as $subcat) {
154 154
             $this->delete($subcat);
155 155
         }
@@ -186,11 +186,11 @@  discard block
 block discarded – undo
186 186
     {
187 187
         $ret   = [];
188 188
         $limit = $start = 0;
189
-        $sql   = 'SELECT * FROM ' . $this->db->prefix('smartfaq_categories');
189
+        $sql   = 'SELECT * FROM '.$this->db->prefix('smartfaq_categories');
190 190
         if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) {
191
-            $sql .= ' ' . $criteria->renderWhere();
191
+            $sql .= ' '.$criteria->renderWhere();
192 192
             if ('' != $criteria->getSort()) {
193
-                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
193
+                $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
194 194
             }
195 195
             $limit = $criteria->getLimit();
196 196
             $start = $criteria->getStart();
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
             $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission');
248 248
 
249 249
             $categoriesGranted = $smartPermHandler->getPermissions('category');
250
-            $criteria->add(new \Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'));
250
+            $criteria->add(new \Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN'));
251 251
         }
252 252
         $criteria->setStart($start);
253 253
         $criteria->setLimit($limit);
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
             $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission');
287 287
 
288 288
             $categoriesGranted = $smartPermHandler->getPermissions('category');
289
-            $criteria->add(new \Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'));
289
+            $criteria->add(new \Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN'));
290 290
         }
291 291
 
292 292
         $criteria->add(new \Criteria('f.status', Constants::SF_STATUS_OPENED));
@@ -295,11 +295,11 @@  discard block
 block discarded – undo
295 295
 
296 296
         $ret   = [];
297 297
         $limit = $start = 0;
298
-        $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';
298
+        $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';
299 299
         if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) {
300
-            $sql .= ' ' . $criteria->renderWhere();
300
+            $sql .= ' '.$criteria->renderWhere();
301 301
             if ('' != $criteria->getSort()) {
302
-                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
302
+                $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
303 303
             }
304 304
             $limit = $criteria->getLimit();
305 305
             $start = $criteria->getStart();
@@ -328,9 +328,9 @@  discard block
 block discarded – undo
328 328
      */
329 329
     public function getCount($criteria = null)
330 330
     {
331
-        $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_categories');
331
+        $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('smartfaq_categories');
332 332
         if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) {
333
-            $sql .= ' ' . $criteria->renderWhere();
333
+            $sql .= ' '.$criteria->renderWhere();
334 334
         }
335 335
         $result = $this->db->query($sql);
336 336
         if (!$result) {
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
                 $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission');
359 359
 
360 360
                 $categoriesGranted = $smartPermHandler->getPermissions('category');
361
-                $criteria->add(new \Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'));
361
+                $criteria->add(new \Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN'));
362 362
             }
363 363
         }
364 364
 
@@ -382,16 +382,16 @@  discard block
 block discarded – undo
382 382
                 $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission');
383 383
 
384 384
                 $categoriesGranted = $smartPermHandler->getPermissions('category');
385
-                $criteria->add(new \Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'));
385
+                $criteria->add(new \Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN'));
386 386
             }
387 387
         }
388 388
 
389 389
         $criteria->add(new \Criteria('f.status', Constants::SF_STATUS_OPENED));
390 390
 
391
-        $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';
391
+        $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';
392 392
 
393 393
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
394
-            $sql .= ' ' . $criteria->renderWhere();
394
+            $sql .= ' '.$criteria->renderWhere();
395 395
         }
396 396
 
397 397
         $result = $this->db->query($sql);
@@ -409,16 +409,16 @@  discard block
 block discarded – undo
409 409
      */
410 410
     public function getSubCats($categories)
411 411
     {
412
-        $criteria = new \CriteriaCompo(new \Criteria('parentid', '(' . implode(',', array_keys($categories)) . ')'), 'IN');
412
+        $criteria = new \CriteriaCompo(new \Criteria('parentid', '('.implode(',', array_keys($categories)).')'), 'IN');
413 413
         $ret      = [];
414 414
         if (!Smartfaq\Utility::userIsAdmin()) {
415 415
             /** @var \XoopsModules\Smartfaq\PermissionHandler $smartPermHandler */
416 416
             $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission');
417 417
 
418 418
             $categoriesGranted = $smartPermHandler->getPermissions('category');
419
-            $criteria->add(new \Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'));
419
+            $criteria->add(new \Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN'));
420 420
         }
421
-        $subcats =& $this->getObjects($criteria, true);
421
+        $subcats = & $this->getObjects($criteria, true);
422 422
         foreach ($subcats as $subcat_id => $subcat) {
423 423
             $ret[$subcat->getVar('parentid')][$subcat->getVar('categoryid')] = $subcat;
424 424
         }
@@ -434,9 +434,9 @@  discard block
 block discarded – undo
434 434
      */
435 435
     public function deleteAll($criteria = null)
436 436
     {
437
-        $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_categories');
437
+        $sql = 'DELETE FROM '.$this->db->prefix('smartfaq_categories');
438 438
         if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) {
439
-            $sql .= ' ' . $criteria->renderWhere();
439
+            $sql .= ' '.$criteria->renderWhere();
440 440
         }
441 441
         if (!$this->db->query($sql)) {
442 442
             return false;
@@ -458,10 +458,10 @@  discard block
 block discarded – undo
458 458
      **/
459 459
     public function updateAll($fieldname, $fieldvalue, \CriteriaElement $criteria = null)
460 460
     {
461
-        $set_clause = is_numeric($fieldvalue) ? $fieldname . ' = ' . $fieldvalue : $fieldname . ' = ' . $this->db->quoteString($fieldvalue);
462
-        $sql        = 'UPDATE ' . $this->db->prefix('smartfaq_categories') . ' SET ' . $set_clause;
461
+        $set_clause = is_numeric($fieldvalue) ? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue);
462
+        $sql        = 'UPDATE '.$this->db->prefix('smartfaq_categories').' SET '.$set_clause;
463 463
         if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) {
464
-            $sql .= ' ' . $criteria->renderWhere();
464
+            $sql .= ' '.$criteria->renderWhere();
465 465
         }
466 466
         if (!$this->db->queryF($sql)) {
467 467
             return false;
Please login to merge, or discard this patch.
class/GroupPermForm.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
 
28 28
 // defined('XOOPS_ROOT_PATH') || die('Restricted access');
29 29
 
30
-require_once XOOPS_ROOT_PATH . '/class/xoopsform/formelement.php';
31
-require_once XOOPS_ROOT_PATH . '/class/xoopsform/formhidden.php';
32
-require_once XOOPS_ROOT_PATH . '/class/xoopsform/formhiddentoken.php';
33
-require_once XOOPS_ROOT_PATH . '/class/xoopsform/formbutton.php';
34
-require_once XOOPS_ROOT_PATH . '/class/xoopsform/formelementtray.php';
35
-require_once XOOPS_ROOT_PATH . '/class/xoopsform/form.php';
30
+require_once XOOPS_ROOT_PATH.'/class/xoopsform/formelement.php';
31
+require_once XOOPS_ROOT_PATH.'/class/xoopsform/formhidden.php';
32
+require_once XOOPS_ROOT_PATH.'/class/xoopsform/formhiddentoken.php';
33
+require_once XOOPS_ROOT_PATH.'/class/xoopsform/formbutton.php';
34
+require_once XOOPS_ROOT_PATH.'/class/xoopsform/formelementtray.php';
35
+require_once XOOPS_ROOT_PATH.'/class/xoopsform/form.php';
36 36
 
37 37
 /**
38 38
  * Renders a form for setting module specific group permissions
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
         }
163 163
         $gpermHandler  = xoops_getHandler('groupperm');
164 164
         $memberHandler = xoops_getHandler('member');
165
-        $glist         =& $memberHandler->getGroupList();
165
+        $glist         = & $memberHandler->getGroupList();
166 166
         foreach (array_keys($glist) as $i) {
167 167
             // get selected item id(s) for each group
168 168
             $selected = $gpermHandler->getItemIds($this->_permName, $i, $this->_modid);
169
-            $ele      = new Smartfaq\GroupFormCheckBox($glist[$i], 'perms[' . $this->_permName . ']', $i, $selected);
169
+            $ele      = new Smartfaq\GroupFormCheckBox($glist[$i], 'perms['.$this->_permName.']', $i, $selected);
170 170
             $ele->setOptionTree($this->_itemTree);
171 171
 
172 172
             foreach ($this->_appendix as $key => $append) {
@@ -193,18 +193,18 @@  discard block
 block discarded – undo
193 193
         $tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
194 194
         $this->addElement($tray);
195 195
 
196
-        $ret      = '<h4>' . $this->getTitle() . '</h4>' . $this->_permDesc . '<br>';
197
-        $ret      .= "<form name='" . $this->getName() . "' id='" . $this->getName() . "' action='" . $this->getAction() . "' method='" . $this->getMethod() . "'" . $this->getExtra() . ">\n<table width='100%' class='outer' cellspacing='1'>\n";
198
-        $elements =& $this->getElements();
196
+        $ret      = '<h4>'.$this->getTitle().'</h4>'.$this->_permDesc.'<br>';
197
+        $ret .= "<form name='".$this->getName()."' id='".$this->getName()."' action='".$this->getAction()."' method='".$this->getMethod()."'".$this->getExtra().">\n<table width='100%' class='outer' cellspacing='1'>\n";
198
+        $elements = & $this->getElements();
199 199
         foreach (array_keys($elements) as $i) {
200 200
             if (!is_object($elements[$i])) {
201 201
                 $ret .= $elements[$i];
202 202
             } elseif (!$elements[$i]->isHidden()) {
203
-                $ret .= "<tr valign='top' align='left'><td class='head'>" . $elements[$i]->getCaption();
203
+                $ret .= "<tr valign='top' align='left'><td class='head'>".$elements[$i]->getCaption();
204 204
                 if ('' != $elements[$i]->getDescription()) {
205
-                    $ret .= '<br><br><span style="font-weight: normal;">' . $elements[$i]->getDescription() . '</span>';
205
+                    $ret .= '<br><br><span style="font-weight: normal;">'.$elements[$i]->getDescription().'</span>';
206 206
                 }
207
-                $ret .= "</td>\n<td class='even'>\n" . $elements[$i]->render() . "\n</td></tr>\n";
207
+                $ret .= "</td>\n<td class='even'>\n".$elements[$i]->render()."\n</td></tr>\n";
208 208
             } else {
209 209
                 $ret .= $elements[$i]->render();
210 210
             }
Please login to merge, or discard this patch.
class/AnswerHandler.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     public function get($id = null, $fields = null)
50 50
     {
51 51
         if ((int)$id > 0) {
52
-            $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_answers') . ' WHERE answerid=' . $id;
52
+            $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_answers').' WHERE answerid='.$id;
53 53
             if (!$result = $this->db->query($sql)) {
54 54
                 return false;
55 55
             }
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
     {
178 178
         $ret   = [];
179 179
         $limit = $start = 0;
180
-        $sql   = 'SELECT * FROM ' . $this->db->prefix('smartfaq_answers');
180
+        $sql   = 'SELECT * FROM '.$this->db->prefix('smartfaq_answers');
181 181
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
182
-            $sql .= ' ' . $criteria->renderWhere();
182
+            $sql .= ' '.$criteria->renderWhere();
183 183
             if ('' != $criteria->getSort()) {
184
-                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
184
+                $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
185 185
             }
186 186
             $limit = $criteria->getLimit();
187 187
             $start = $criteria->getStart();
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
             $answer = new Smartfaq\Answer();
196 196
             $answer->assignVars($myrow);
197 197
             if (!$id_as_key) {
198
-                $ret[] =& $answer;
198
+                $ret[] = & $answer;
199 199
             } else {
200 200
                 $ret[$myrow['answerid']] = $answer;
201 201
             }
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         $criteria->setOrder($order);
266 266
         $criteria->setLimit($limit);
267 267
         $criteria->setStart($start);
268
-        $ret =& $this->getObjects($criteria);
268
+        $ret = & $this->getObjects($criteria);
269 269
 
270 270
         return $ret;
271 271
     }
@@ -278,9 +278,9 @@  discard block
 block discarded – undo
278 278
      */
279 279
     public function getCount(\CriteriaElement $criteria = null)
280 280
     {
281
-        $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_answers');
281
+        $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('smartfaq_answers');
282 282
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
283
-            $sql .= ' ' . $criteria->renderWhere();
283
+            $sql .= ' '.$criteria->renderWhere();
284 284
         }
285 285
         $result = $this->db->query($sql);
286 286
         if (!$result) {
@@ -299,10 +299,10 @@  discard block
 block discarded – undo
299 299
      */
300 300
     public function getCountByFAQ($criteria = null)
301 301
     {
302
-        $sql = 'SELECT faqid, COUNT(*) FROM ' . $this->db->prefix('smartfaq_answers');
302
+        $sql = 'SELECT faqid, COUNT(*) FROM '.$this->db->prefix('smartfaq_answers');
303 303
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
304
-            $sql .= ' ' . $criteria->renderWhere();
305
-            $sql .= ' ' . $criteria->getGroupby();
304
+            $sql .= ' '.$criteria->renderWhere();
305
+            $sql .= ' '.$criteria->getGroupby();
306 306
         }
307 307
 
308 308
         //echo "<br>$sql<br>";
@@ -329,9 +329,9 @@  discard block
 block discarded – undo
329 329
      */
330 330
     public function deleteAll(\CriteriaElement $criteria = null, $force = true, $asObject = false)
331 331
     {
332
-        $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_answers');
332
+        $sql = 'DELETE FROM '.$this->db->prefix('smartfaq_answers');
333 333
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
334
-            $sql .= ' ' . $criteria->renderWhere();
334
+            $sql .= ' '.$criteria->renderWhere();
335 335
         }
336 336
         if (!$this->db->query($sql)) {
337 337
             return false;
@@ -351,10 +351,10 @@  discard block
 block discarded – undo
351 351
      */
352 352
     public function updateAll($fieldname, $fieldvalue, \CriteriaElement $criteria = null, $force = false)
353 353
     {
354
-        $set_clause = is_numeric($fieldvalue) ? $fieldname . ' = ' . $fieldvalue : $fieldname . ' = ' . $this->db->quoteString($fieldvalue);
355
-        $sql        = 'UPDATE ' . $this->db->prefix('smartfaq_answers') . ' SET ' . $set_clause;
354
+        $set_clause = is_numeric($fieldvalue) ? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue);
355
+        $sql        = 'UPDATE '.$this->db->prefix('smartfaq_answers').' SET '.$set_clause;
356 356
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
357
-            $sql .= ' ' . $criteria->renderWhere();
357
+            $sql .= ' '.$criteria->renderWhere();
358 358
         }
359 359
         //echo "<br>" . $sql . "<br>";
360 360
         if (!$this->db->queryF($sql)) {
@@ -371,8 +371,8 @@  discard block
 block discarded – undo
371 371
     public function getLastPublishedByFaq($faqids)
372 372
     {
373 373
         $ret    = [];
374
-        $sql    = 'SELECT faqid, answer, uid, datesub FROM ' . $this->db->prefix('smartfaq_answers') . '
375
-               WHERE faqid IN (' . implode(',', $faqids) . ') AND status = ' . Constants::SF_AN_STATUS_APPROVED . ' GROUP BY faqid';
374
+        $sql    = 'SELECT faqid, answer, uid, datesub FROM '.$this->db->prefix('smartfaq_answers').'
375
+               WHERE faqid IN (' . implode(',', $faqids).') AND status = '.Constants::SF_AN_STATUS_APPROVED.' GROUP BY faqid';
376 376
         $result = $this->db->query($sql);
377 377
         if (!$result) {
378 378
             return $ret;
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
         while ($row = $this->db->fetchArray($result)) {
381 381
             $answer = new Smartfaq\Answer();
382 382
             $answer->assignVars($row);
383
-            $ret[$row['faqid']] =& $answer;
383
+            $ret[$row['faqid']] = & $answer;
384 384
             unset($answer);
385 385
         }
386 386
 
Please login to merge, or discard this patch.
open_index.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 use XoopsModules\Smartfaq;
10 10
 use XoopsModules\Smartfaq\Constants;
11 11
 
12
-require_once __DIR__ . '/header.php';
12
+require_once __DIR__.'/header.php';
13 13
 
14 14
 global $xoopsConfig, $xoopsModuleConfig, $xoopsModule;
15 15
 
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 
47 47
 $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_index.tpl';
48 48
 
49
-require_once XOOPS_ROOT_PATH . '/header.php';
50
-require_once __DIR__ . '/footer.php';
49
+require_once XOOPS_ROOT_PATH.'/header.php';
50
+require_once __DIR__.'/footer.php';
51 51
 
52 52
 //get all categories for future reference
53 53
 $allcategories = $categoryHandler->getObjects(null, true);
@@ -69,11 +69,11 @@  discard block
 block discarded – undo
69 69
             if (isset($totalQnas[$subcat_id]) && $totalQnas[$subcat_id] > 0) {
70 70
                 if (isset($last_qnaObj[$subcat_id])) {
71 71
                     $subcat->setVar('last_faqid', $last_qnaObj[$subcat_id]->getVar('faqid'));
72
-                    $subcat->setVar('last_question_link', "<a href='faq.php?faqid=" . $last_qnaObj[$subcat_id]->getVar('faqid') . "'>" . $last_qnaObj[$subcat_id]->question(50) . '</a>');
72
+                    $subcat->setVar('last_question_link', "<a href='faq.php?faqid=".$last_qnaObj[$subcat_id]->getVar('faqid')."'>".$last_qnaObj[$subcat_id]->question(50).'</a>');
73 73
                 }
74 74
                 $subcat->setVar('faqcount', $totalQnas[$subcat_id]);
75 75
                 $categories[$cat_id]['subcats'][$subcat_id] = $subcat->toArray(null, true);
76
-                $total                                      += $totalQnas[$subcat_id];
76
+                $total += $totalQnas[$subcat_id];
77 77
             }
78 78
         }
79 79
     }
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         }
106 106
 
107 107
         $memberHandler = xoops_getHandler('member');
108
-        $users         = $memberHandler->getUsers(new \Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN'), true);
108
+        $users         = $memberHandler->getUsers(new \Criteria('uid', '('.implode(',', array_keys($userids)).')', 'IN'), true);
109 109
         for ($i = 0; $i < $totalQnasOnPage; ++$i) {
110 110
             $faq = $faqsObj[$i]->toArray(null, $allcategories);
111 111
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
     }
119 119
 }
120 120
 // Language constants
121
-$moduleName =& $myts->displayTarea($xoopsModule->getVar('name'));
121
+$moduleName = & $myts->displayTarea($xoopsModule->getVar('name'));
122 122
 $xoopsTpl->assign([
123 123
                       'lang_on'       => _MD_SF_ON,
124 124
                       'lang_postedby' => _MD_SF_POSTEDBY,
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
                       'lang_hits'     => _MD_SF_HITS
129 129
                   ]);
130 130
 
131
-$moduleName =& $myts->displayTarea($xoopsModule->getVar('name'));
131
+$moduleName = & $myts->displayTarea($xoopsModule->getVar('name'));
132 132
 $xoopsTpl->assign('lang_mainhead', sprintf(_MD_SF_OPEN_WELCOME, $xoopsConfig['sitename']));
133 133
 $xoopsTpl->assign('lang_mainintro', $myts->displayTarea($xoopsModuleConfig['openquestionintromsg'], 1));
134 134
 $xoopsTpl->assign('lang_total', _MD_SF_TOTAL_QUESTIONS);
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 $xoopsTpl->assign('lang_description', _MD_SF_DESCRIPTION);
137 137
 $xoopsTpl->assign('lang_category', _MD_SF_CATEGORY);
138 138
 $xoopsTpl->assign('sectionname', $moduleName);
139
-$xoopsTpl->assign('whereInSection', "<a href='index.php'>" . $moduleName . '</a> > ' . _MD_SF_OPEN_SECTION);
139
+$xoopsTpl->assign('whereInSection', "<a href='index.php'>".$moduleName.'</a> > '._MD_SF_OPEN_SECTION);
140 140
 
141 141
 $xoopsTpl->assign('displayFull', false);
142 142
 $xoopsTpl->assign('displaylastfaqs', $xoopsModuleConfig['displaylastfaqs']);
@@ -152,25 +152,25 @@  discard block
 block discarded – undo
152 152
 $xoopsTpl->assign('lang_category', _MD_SF_CATEGORY);
153 153
 
154 154
 // Category Navigation Bar
155
-require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
155
+require_once XOOPS_ROOT_PATH.'/class/pagenav.php';
156 156
 $pagenav = new \XoopsPageNav($totalCategories, $xoopsModuleConfig['catperpage'], $catstart, 'catstart', '');
157 157
 if (1 == $xoopsModuleConfig['useimagenavpage']) {
158
-    $xoopsTpl->assign('catnavbar', '<div style="text-align:right;">' . $pagenav->renderImageNav() . '</div>');
158
+    $xoopsTpl->assign('catnavbar', '<div style="text-align:right;">'.$pagenav->renderImageNav().'</div>');
159 159
 } else {
160
-    $xoopsTpl->assign('catnavbar', '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>');
160
+    $xoopsTpl->assign('catnavbar', '<div style="text-align:right;">'.$pagenav->renderNav().'</div>');
161 161
 }
162 162
 
163 163
 // FAQ Navigation Bar
164 164
 $pagenav = new \XoopsPageNav($totalFaqs, $xoopsModuleConfig['indexperpage'], $start, 'start', '');
165 165
 if (1 == $xoopsModuleConfig['useimagenavpage']) {
166
-    $xoopsTpl->assign('navbar', '<div style="text-align:right;">' . $pagenav->renderImageNav() . '</div>');
166
+    $xoopsTpl->assign('navbar', '<div style="text-align:right;">'.$pagenav->renderImageNav().'</div>');
167 167
 } else {
168
-    $xoopsTpl->assign('navbar', '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>');
168
+    $xoopsTpl->assign('navbar', '<div style="text-align:right;">'.$pagenav->renderNav().'</div>');
169 169
 }
170 170
 
171 171
 // Page Title Hack by marcan
172 172
 $module_name = $myts->htmlSpecialChars($xoopsModule->getVar('name'));
173
-$xoopsTpl->assign('xoops_pagetitle', $module_name . ' - ' . $category->getVar('name'));
173
+$xoopsTpl->assign('xoops_pagetitle', $module_name.' - '.$category->getVar('name'));
174 174
 // End Page Title Hack by marcan
175 175
 
176
-require_once XOOPS_ROOT_PATH . '/footer.php';
176
+require_once XOOPS_ROOT_PATH.'/footer.php';
Please login to merge, or discard this patch.