Passed
Push — master ( 719c50...721049 )
by Michael
02:08
created
footer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 $uid     = $xoopsUser ? $xoopsUser->getVar('uid') : 0;
14 14
 $isAdmin = (Smartfaq\Utility::userIsAdmin() || Smartfaq\Utility::hasModerator());
15 15
 
16
-$xoopsTpl->assign('sf_adminpage', "<a href='" . XOOPS_URL . "/modules/smartfaq/admin/index.php'>" . _MD_SF_ADMIN_PAGE . '</a>');
16
+$xoopsTpl->assign('sf_adminpage', "<a href='".XOOPS_URL."/modules/smartfaq/admin/index.php'>"._MD_SF_ADMIN_PAGE.'</a>');
17 17
 $xoopsTpl->assign('isAdmin', $isAdmin);
18 18
 
19 19
 $xoopsTpl->assign([
@@ -36,4 +36,4 @@  discard block
 block discarded – undo
36 36
 
37 37
 $xoopsTpl->assign('ref_smartfaq', 'SmartFAQ is developed by The SmartFactory (http://www.smartfactory.ca), a division of InBox Solutions (http://www.inboxsolutions.net)');
38 38
 
39
-$xoopsTpl->assign('xoops_module_header', "<link rel='stylesheet' type='text/css' href='" . XOOPS_URL . "/modules/smartfaq/assets/css/smartfaq.css'>");
39
+$xoopsTpl->assign('xoops_module_header', "<link rel='stylesheet' type='text/css' href='".XOOPS_URL."/modules/smartfaq/assets/css/smartfaq.css'>");
Please login to merge, or discard this patch.
admin/mygroupperm.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 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
     }
@@ -34,16 +34,16 @@  discard block
 block discarded – undo
34 34
 $modid = isset($_POST['modid']) ? (int)$_POST['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($_POST['perms']) && !empty($_POST['perms'])) {
48 48
     $gpermHandler = xoops_getHandler('groupperm');
49 49
     foreach ($_POST['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.
include/blocksadmin.inc.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
 if (!is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid())) {
29 29
     exit('Access Denied');
30 30
 }
31
-require_once XOOPS_ROOT_PATH . '/class/xoopsblock.php';
32
-include XOOPS_ROOT_PATH . '/modules/system/admin/blocksadmin/blocksadmin.php';
31
+require_once XOOPS_ROOT_PATH.'/class/xoopsblock.php';
32
+include XOOPS_ROOT_PATH.'/modules/system/admin/blocksadmin/blocksadmin.php';
33 33
 
34 34
 $op = 'list';
35 35
 if (isset($_POST)) {
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 
50 50
 if (isset($previewblock)) {
51 51
     xoops_cp_header();
52
-    require_once XOOPS_ROOT_PATH . '/class/template.php';
52
+    require_once XOOPS_ROOT_PATH.'/class/template.php';
53 53
     $xoopsTpl = new \XoopsTpl();
54
-    $xoopsTpl->caching= 0;
54
+    $xoopsTpl->caching = 0;
55 55
     if (isset($bid)) {
56 56
         $block['bid']        = $bid;
57 57
         $block['form_title'] = _AM_EDITBLOCK;
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
                  . $myblock->getContent('S', $bctype)
84 84
                  . '</td></tr></table></body></html>';
85 85
 
86
-    $dummyfile = '_dummyfile_' . time() . '.html';
87
-    $fp        = fopen(XOOPS_CACHE_PATH . '/' . $dummyfile, 'w');
86
+    $dummyfile = '_dummyfile_'.time().'.html';
87
+    $fp        = fopen(XOOPS_CACHE_PATH.'/'.$dummyfile, 'w');
88 88
     fwrite($fp, $dummyhtml);
89 89
     fclose($fp);
90 90
     $block['edit_form'] = false;
@@ -95,24 +95,24 @@  discard block
 block discarded – undo
95 95
     $block['visible']   = $bvisible;
96 96
     $block['title']     = $myblock->getVar('title', 'E');
97 97
     $block['content']   = $myblock->getVar('content', 'E');
98
-    $block['modules']   =& $bmodule;
98
+    $block['modules']   = & $bmodule;
99 99
     $block['ctype']     = isset($bctype) ? $bctype : $myblock->getVar('c_type');
100 100
     $block['is_custom'] = true;
101 101
     $block['cachetime'] = (int)$bcachetime;
102
-    echo '<a href="admin.php?fct=blocksadmin">' . _AM_BADMIN . '</a>&nbsp;<span style="font-weight:bold;">&raquo;&raquo;</span>&nbsp;' . $block['form_title'] . '<br><br>';
103
-    include XOOPS_ROOT_PATH . '/modules/system/admin/blocksadmin/blockform.php';
102
+    echo '<a href="admin.php?fct=blocksadmin">'._AM_BADMIN.'</a>&nbsp;<span style="font-weight:bold;">&raquo;&raquo;</span>&nbsp;'.$block['form_title'].'<br><br>';
103
+    include XOOPS_ROOT_PATH.'/modules/system/admin/blocksadmin/blockform.php';
104 104
     $form->display();
105 105
     xoops_cp_footer();
106 106
     echo '<script type="text/javascript">
107 107
     <!--//
108
-    preview_window = openWithSelfMain("' . XOOPS_URL . '/modules/system/admin.php?fct=blocksadmin&op=previewpopup&file=' . $dummyfile . '", "popup", 250, 200);
108
+    preview_window = openWithSelfMain("' . XOOPS_URL.'/modules/system/admin.php?fct=blocksadmin&op=previewpopup&file='.$dummyfile.'", "popup", 250, 200);
109 109
     //-->
110 110
     </script>';
111 111
     exit();
112 112
 }
113 113
 
114 114
 if ('previewpopup' === $op) {
115
-    $file = str_replace('..', '', XOOPS_CACHE_PATH . '/' . trim($_GET['file']));
115
+    $file = str_replace('..', '', XOOPS_CACHE_PATH.'/'.trim($_GET['file']));
116 116
     if (file_exists($file)) {
117 117
         include $file;
118 118
         @unlink($file);
@@ -254,24 +254,24 @@  discard block
 block discarded – undo
254 254
             $sql = sprintf('INSERT INTO `%s` (block_id, module_id) VALUES (`%u`, `%d`)', $db->prefix('block_module_link'), $bid, (int)$bmid);
255 255
             $db->query($sql);
256 256
         }
257
-        require_once XOOPS_ROOT_PATH . '/class/template.php';
257
+        require_once XOOPS_ROOT_PATH.'/class/template.php';
258 258
         $xoopsTpl = new \XoopsTpl();
259
-        $xoopsTpl->caching= 2;
259
+        $xoopsTpl->caching = 2;
260 260
         if ('' != $myblock->getVar('template')) {
261
-            if ($xoopsTpl->is_cached('db:' . $myblock->getVar('template'))) {
262
-                if (!$xoopsTpl->clear_cache('db:' . $myblock->getVar('template'))) {
263
-                    $msg = 'Unable to clear cache for block ID' . $bid;
261
+            if ($xoopsTpl->is_cached('db:'.$myblock->getVar('template'))) {
262
+                if (!$xoopsTpl->clear_cache('db:'.$myblock->getVar('template'))) {
263
+                    $msg = 'Unable to clear cache for block ID'.$bid;
264 264
                 }
265 265
             }
266 266
         } else {
267
-            if ($xoopsTpl->is_cached('db:system_dummy.tpl', 'block' . $bid)) {
268
-                if (!$xoopsTpl->clear_cache('db:system_dummy.tpl', 'block' . $bid)) {
269
-                    $msg = 'Unable to clear cache for block ID' . $bid;
267
+            if ($xoopsTpl->is_cached('db:system_dummy.tpl', 'block'.$bid)) {
268
+                if (!$xoopsTpl->clear_cache('db:system_dummy.tpl', 'block'.$bid)) {
269
+                    $msg = 'Unable to clear cache for block ID'.$bid;
270 270
                 }
271 271
             }
272 272
         }
273 273
     } else {
274
-        $msg = 'Failed update of block. ID:' . $bid;
274
+        $msg = 'Failed update of block. ID:'.$bid;
275 275
     }
276 276
 
277 277
     return $msg; // GIJ +
Please login to merge, or discard this patch.
class/Utility.php 1 patch
Spacing   +23 added lines, -23 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,6 +589,6 @@  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
 }
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 : '';
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   +25 added lines, -25 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 = 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);
@@ -283,10 +283,10 @@  discard block
 block discarded – undo
283 283
         }
284 284
         if (!Smartfaq\Utility::userIsAdmin()) {
285 285
             /** @var Smartfaq\PermissionHandler $smartPermHandler */
286
-            $smartPermHandler =Smartfaq\Helper::getInstance()->getHandler('Permission');
286
+            $smartPermHandler = 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 = 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 = 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 Smartfaq\PermissionHandler $smartPermHandler */
416 416
             $smartPermHandler = 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/SmartDbTable.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     //Verifies that a MySQL table exists
23 23
     $xoopsDB  = \XoopsDatabaseFactory::getDatabaseConnection();
24 24
     $realname = $xoopsDB->prefix($table);
25
-    $sql      = 'SHOW TABLES FROM ' . XOOPS_DB_NAME;
25
+    $sql      = 'SHOW TABLES FROM '.XOOPS_DB_NAME;
26 26
     $ret      = $xoopsDB->queryF($sql);
27 27
     while (false !== (list($m_table) = $xoopsDB->fetchRow($ret))) {
28 28
         if ($m_table == $realname) {
@@ -163,14 +163,14 @@  discard block
 block discarded – undo
163 163
     public function getExistingFieldsArray()
164 164
     {
165 165
         global $xoopsDB;
166
-        $result = $xoopsDB->queryF('SHOW COLUMNS FROM ' . $this->name());
166
+        $result = $xoopsDB->queryF('SHOW COLUMNS FROM '.$this->name());
167 167
         while (false !== ($existing_field = $xoopsDB->fetchArray($result))) {
168 168
             $fields[$existing_field['Field']] = $existing_field['Type'];
169 169
             if ('YES' !== $existing_field['Null']) {
170 170
                 $fields[$existing_field['Field']] .= ' NOT NULL';
171 171
             }
172 172
             if ($existing_field['Extra']) {
173
-                $fields[$existing_field['Field']] .= ' ' . $existing_field['Extra'];
173
+                $fields[$existing_field['Field']] .= ' '.$existing_field['Extra'];
174 174
             }
175 175
         }
176 176
 
@@ -246,9 +246,9 @@  discard block
 block discarded – undo
246 246
             $query = sprintf('INSERT INTO `%s` VALUES ("%s")', $this->name(), $data);
247 247
             $ret   = $xoopsDB->queryF($query);
248 248
             if (!$ret) {
249
-                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_ADD_DATA_ERR, $this->name()) . '<br>';
249
+                echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_ADD_DATA_ERR, $this->name()).'<br>';
250 250
             } else {
251
-                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_ADD_DATA, $this->name()) . '<br>';
251
+                echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_ADD_DATA, $this->name()).'<br>';
252 252
             }
253 253
         }
254 254
 
@@ -413,9 +413,9 @@  discard block
 block discarded – undo
413 413
 
414 414
         $ret = $xoopsDB->queryF($query);
415 415
         if (!$ret) {
416
-            echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_CREATE_TABLE_ERR, $this->name()) . '<br>';
416
+            echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_CREATE_TABLE_ERR, $this->name()).'<br>';
417 417
         } else {
418
-            echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_CREATE_TABLE, $this->name()) . '<br>';
418
+            echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_CREATE_TABLE, $this->name()).'<br>';
419 419
         }
420 420
 
421 421
         return $ret;
@@ -434,11 +434,11 @@  discard block
 block discarded – undo
434 434
         $query = sprintf('DROP TABLE `%s`', $this->name());
435 435
         $ret   = $xoopsDB->queryF($query);
436 436
         if (!$ret) {
437
-            echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_DROP_TABLE_ERR, $this->name()) . '<br>';
437
+            echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_DROP_TABLE_ERR, $this->name()).'<br>';
438 438
 
439 439
             return false;
440 440
         } else {
441
-            echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_DROP_TABLE, $this->name()) . '<br>';
441
+            echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_DROP_TABLE, $this->name()).'<br>';
442 442
 
443 443
             return true;
444 444
         }
@@ -462,9 +462,9 @@  discard block
 block discarded – undo
462 462
             $ret = $ret && $xoopsDB->queryF($query);
463 463
             if ($alteredField['showerror']) {
464 464
                 if (!$ret) {
465
-                    echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_CHGFIELD_ERR, $alteredField['name'], $this->name()) . '<br>';
465
+                    echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_CHGFIELD_ERR, $alteredField['name'], $this->name()).'<br>';
466 466
                 } else {
467
-                    echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_CHGFIELD, $alteredField['name'], $this->name()) . '<br>';
467
+                    echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_CHGFIELD, $alteredField['name'], $this->name()).'<br>';
468 468
                 }
469 469
             }
470 470
         }
@@ -488,9 +488,9 @@  discard block
 block discarded – undo
488 488
             //echo $query;
489 489
             $ret = $ret && $xoopsDB->queryF($query);
490 490
             if (!$ret) {
491
-                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_NEWFIELD_ERR, $newField['name'], $this->name()) . '<br>';
491
+                echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_NEWFIELD_ERR, $newField['name'], $this->name()).'<br>';
492 492
             } else {
493
-                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_NEWFIELD, $newField['name'], $this->name()) . '<br>';
493
+                echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_NEWFIELD, $newField['name'], $this->name()).'<br>';
494 494
             }
495 495
         }
496 496
 
@@ -513,9 +513,9 @@  discard block
 block discarded – undo
513 513
             $query = sprintf('UPDATE `%s` SET %s = %s', $this->name(), $updatedField['name'], $updatedField['value']);
514 514
             $ret   = $ret && $xoopsDB->queryF($query);
515 515
             if (!$ret) {
516
-                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_UPDATE_TABLE_ERR, $this->name()) . '<br>';
516
+                echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_UPDATE_TABLE_ERR, $this->name()).'<br>';
517 517
             } else {
518
-                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()) . '<br>';
518
+                echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()).'<br>';
519 519
             }
520 520
         }
521 521
 
@@ -538,9 +538,9 @@  discard block
 block discarded – undo
538 538
             //echo $query."<br>";
539 539
             $ret = $ret && $xoopsDB->queryF($query);
540 540
             if (!$ret) {
541
-                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_UPDATE_TABLE_ERR, $this->name()) . '<br>';
541
+                echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_UPDATE_TABLE_ERR, $this->name()).'<br>';
542 542
             } else {
543
-                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()) . '<br>';
543
+                echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()).'<br>';
544 544
             }
545 545
         }
546 546
 
@@ -564,9 +564,9 @@  discard block
 block discarded – undo
564 564
 
565 565
             $ret = $ret && $xoopsDB->queryF($query);
566 566
             if (!$ret) {
567
-                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_DROPFIELD_ERR, $droppedField, $this->name()) . '<br>';
567
+                echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_DROPFIELD_ERR, $droppedField, $this->name()).'<br>';
568 568
             } else {
569
-                echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_DROPFIELD, $droppedField, $this->name()) . '<br>';
569
+                echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_DROPFIELD, $droppedField, $this->name()).'<br>';
570 570
             }
571 571
         }
572 572
 
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 (false !== ($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.
class/FaqHandler.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     public function get($id)
49 49
     {
50 50
         if ((int)$id > 0) {
51
-            $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_faq') . ' WHERE faqid=' . $id;
51
+            $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_faq').' WHERE faqid='.$id;
52 52
             if (!$result = $this->db->query($sql)) {
53 53
                 return false;
54 54
             }
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 //            $faq->setError($this->db->error());
163 163
 
164 164
 
165
-            trigger_error('Class ' . $faq . ' could not be saved ' . __FILE__ . ' at line ' . __LINE__, E_USER_WARNING);
165
+            trigger_error('Class '.$faq.' could not be saved '.__FILE__.' at line '.__LINE__, E_USER_WARNING);
166 166
 
167 167
             return false;
168 168
         }
@@ -228,26 +228,26 @@  discard block
 block discarded – undo
228 228
     {
229 229
         $ret   = [];
230 230
         $limit = $start = 0;
231
-        $sql   = 'SELECT * FROM ' . $this->db->prefix('smartfaq_faq');
231
+        $sql   = 'SELECT * FROM '.$this->db->prefix('smartfaq_faq');
232 232
 
233 233
         if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) {
234 234
             $whereClause = $criteria->renderWhere();
235 235
 
236 236
             if ('WHERE ()' !== $whereClause) {
237
-                $sql .= ' ' . $criteria->renderWhere();
237
+                $sql .= ' '.$criteria->renderWhere();
238 238
                 if (!empty($notNullFields)) {
239 239
                     $sql .= $this->NotNullFieldClause($notNullFields, true);
240 240
                 }
241 241
             } elseif (!empty($notNullFields)) {
242
-                $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
242
+                $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
243 243
             }
244 244
             if ('' != $criteria->getSort()) {
245
-                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
245
+                $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
246 246
             }
247 247
             $limit = $criteria->getLimit();
248 248
             $start = $criteria->getStart();
249 249
         } elseif (!empty($notNullFields)) {
250
-            $sql .= $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
250
+            $sql .= $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
251 251
         }
252 252
 
253 253
         //echo "<br>" . $sql . "<br>";
@@ -266,9 +266,9 @@  discard block
 block discarded – undo
266 266
             $faq->assignVars($myrow);
267 267
 
268 268
             if (!$id_as_key) {
269
-                $ret[] =& $faq;
269
+                $ret[] = & $faq;
270 270
             } else {
271
-                $ret[$myrow['faqid']] =& $faq;
271
+                $ret[$myrow['faqid']] = & $faq;
272 272
             }
273 273
             unset($faq);
274 274
         }
@@ -308,26 +308,26 @@  discard block
 block discarded – undo
308 308
                             faq.modulelink AS modulelink,
309 309
                             faq.contextpage AS contextpage,
310 310
                             faq.exacturl AS exacturl
311
-                FROM ' . $this->db->prefix('smartfaq_faq') . ' AS faq INNER JOIN ' . $this->db->prefix('smartfaq_categories') . ' AS category ON faq.categoryid = category.categoryid ';
311
+                FROM ' . $this->db->prefix('smartfaq_faq').' AS faq INNER JOIN '.$this->db->prefix('smartfaq_categories').' AS category ON faq.categoryid = category.categoryid ';
312 312
 
313 313
         if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) {
314 314
             $whereClause = $criteria->renderWhere();
315 315
 
316 316
             if ('WHERE ()' !== $whereClause) {
317
-                $sql .= ' ' . $criteria->renderWhere();
317
+                $sql .= ' '.$criteria->renderWhere();
318 318
                 if (!empty($notNullFields)) {
319 319
                     $sql .= $this->NotNullFieldClause($notNullFields, true);
320 320
                 }
321 321
             } elseif (!empty($notNullFields)) {
322
-                $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
322
+                $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
323 323
             }
324 324
             if ('' != $criteria->getSort()) {
325
-                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
325
+                $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
326 326
             }
327 327
             $limit = $criteria->getLimit();
328 328
             $start = $criteria->getStart();
329 329
         } elseif (!empty($notNullFields)) {
330
-            $sql .= $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
330
+            $sql .= $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
331 331
         }
332 332
 
333 333
         //echo "<br>" . $sql . "<br>";
@@ -345,9 +345,9 @@  discard block
 block discarded – undo
345 345
             $faq->assignVars($myrow);
346 346
 
347 347
             if (!$id_as_key) {
348
-                $ret[] =& $faq;
348
+                $ret[] = & $faq;
349 349
             } else {
350
-                $ret[$myrow['faqid']] =& $faq;
350
+                $ret[$myrow['faqid']] = & $faq;
351 351
             }
352 352
             unset($faq);
353 353
         }
@@ -377,19 +377,19 @@  discard block
 block discarded – undo
377 377
      */
378 378
     public function getCount($criteria = null, $notNullFields = '')
379 379
     {
380
-        $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_faq');
380
+        $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('smartfaq_faq');
381 381
         if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) {
382 382
             $whereClause = $criteria->renderWhere();
383 383
             if ('WHERE ()' !== $whereClause) {
384
-                $sql .= ' ' . $criteria->renderWhere();
384
+                $sql .= ' '.$criteria->renderWhere();
385 385
                 if (!empty($notNullFields)) {
386 386
                     $sql .= $this->NotNullFieldClause($notNullFields, true);
387 387
                 }
388 388
             } elseif (!empty($notNullFields)) {
389
-                $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
389
+                $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
390 390
             }
391 391
         } elseif (!empty($notNullFields)) {
392
-            $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
392
+            $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
393 393
         }
394 394
 
395 395
         //echo "<br>" . $sql . "<br>";
@@ -423,11 +423,11 @@  discard block
 block discarded – undo
423 423
             $smartPermHandler = Smartfaq\Helper::getInstance()->getHandler('Permission');
424 424
 
425 425
             $categoriesGranted = $smartPermHandler->getPermissions('category');
426
-            $grantedCategories = new \Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN');
426
+            $grantedCategories = new \Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN');
427 427
 
428 428
             $faqsGranted = $smartPermHandler->getPermissions('item');
429 429
             $grantedFaq  = new \CriteriaCompo();
430
-            $grantedFaq->add(new \Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR');
430
+            $grantedFaq->add(new \Criteria('faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR');
431 431
             // If user is anonymous, check if the FAQ allow partialview
432 432
             if (!is_object($xoopsUser)) {
433 433
                 $grantedFaq->add(new \Criteria('partialview', '1'), 'OR');
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
      */
475 475
     public function getFaqsCountByStatus()
476 476
     {
477
-        $sql    = 'SELECT status, COUNT(*) FROM ' . $this->db->prefix('smartfaq_faq') . ' GROUP BY status';
477
+        $sql    = 'SELECT status, COUNT(*) FROM '.$this->db->prefix('smartfaq_faq').' GROUP BY status';
478 478
         $result = $this->db->query($sql);
479 479
         if (!$result) {
480 480
             return [];
@@ -544,11 +544,11 @@  discard block
 block discarded – undo
544 544
             $smartPermHandler = Smartfaq\Helper::getInstance()->getHandler('Permission');
545 545
 
546 546
             $categoriesGranted = $smartPermHandler->getPermissions('category');
547
-            $grantedCategories = new \Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN');
547
+            $grantedCategories = new \Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN');
548 548
 
549 549
             $faqsGranted = $smartPermHandler->getPermissions('item');
550 550
             $grantedFaq  = new \CriteriaCompo();
551
-            $grantedFaq->add(new \Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR');
551
+            $grantedFaq->add(new \Criteria('faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR');
552 552
             // If user is anonymous, check if the FAQ allow partialview
553 553
             if (!is_object($xoopsUser)) {
554 554
                 $grantedFaq->add(new \Criteria('partialview', '1'), 'OR');
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 
558 558
         if (isset($categoryid) && (-1 != $categoryid)) {
559 559
             if (is_array($categoryid)) {
560
-                $criteriaCategory = new \Criteria('categoryid', '(' . implode(',', $categoryid) . ')', 'IN');
560
+                $criteriaCategory = new \Criteria('categoryid', '('.implode(',', $categoryid).')', 'IN');
561 561
             } else {
562 562
                 $criteriaCategory = new \Criteria('categoryid', (int)$categoryid);
563 563
             }
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
         $criteria->setStart($start);
601 601
         $criteria->setSort($sort);
602 602
         $criteria->setOrder($order);
603
-        $ret =& $this->getObjects($criteria, false, $notNullFields);
603
+        $ret = & $this->getObjects($criteria, false, $notNullFields);
604 604
 
605 605
         return $ret;
606 606
     }
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
             $entrynumber = mt_rand(0, $totalFaqs);
690 690
             $faq         = $this->getFaqs(1, $entrynumber, $status, -1, 'datesub', 'DESC', $notNullFields);
691 691
             if ($faq) {
692
-                $ret =& $faq[0];
692
+                $ret = & $faq[0];
693 693
             }
694 694
         }
695 695
 
@@ -720,10 +720,10 @@  discard block
 block discarded – undo
720 720
                 $httphost    = $_SERVER['HTTP_HOST'];
721 721
                 $querystring = $_SERVER['QUERY_STRING'];
722 722
                 if ('' != $querystring) {
723
-                    $querystring = '?' . $querystring;
723
+                    $querystring = '?'.$querystring;
724 724
                 }
725
-                $currenturl     = $http . $httphost . $phpself . $querystring;
726
-                $fullcontexturl = XOOPS_URL . '/' . $iValue->contextpage();
725
+                $currenturl     = $http.$httphost.$phpself.$querystring;
726
+                $fullcontexturl = XOOPS_URL.'/'.$iValue->contextpage();
727 727
                 switch ($iValue->modulelink()) {
728 728
                     case '':
729 729
                         $display = false;
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
                         }
743 743
                         break;
744 744
                     default:
745
-                        if (false === strpos($currenturl, XOOPS_URL . '/modules/')) {
745
+                        if (false === strpos($currenturl, XOOPS_URL.'/modules/')) {
746 746
                             $display = false;
747 747
                         } else {
748 748
                             if (false === strpos($currenturl, $iValue->modulelink())) {
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
                         break;
755 755
                 }
756 756
                 if ($display) {
757
-                    $randomFaqs[] =& $faqsObj[$i];
757
+                    $randomFaqs[] = & $faqsObj[$i];
758 758
                 }
759 759
             }
760 760
         }
@@ -763,10 +763,10 @@  discard block
 block discarded – undo
763 763
             mt_srand((float)microtime() * 10000000);
764 764
             $rand_keys = array_rand($randomFaqs, $limit);
765 765
             for ($j = 0, $jMax = count($rand_keys); $j < $jMax; ++$j) {
766
-                $ret[] =& $randomFaqs[$rand_keys[$j]];
766
+                $ret[] = & $randomFaqs[$rand_keys[$j]];
767 767
             }
768 768
         } else {
769
-            $ret =& $randomFaqs;
769
+            $ret = & $randomFaqs;
770 770
         }
771 771
 
772 772
         return $ret;
@@ -784,14 +784,14 @@  discard block
 block discarded – undo
784 784
             /** @var Smartfaq\PermissionHandler $smartPermHandler */
785 785
             $smartPermHandler = Smartfaq\Helper::getInstance()->getHandler('Permission');
786 786
             $items            = $smartPermHandler->getPermissions('item');
787
-            $faqclause        = ' AND faqid IN (' . implode(',', $items) . ')';
787
+            $faqclause        = ' AND faqid IN ('.implode(',', $items).')';
788 788
         }
789 789
 
790 790
         $sql  = "CREATE TEMPORARY TABLE tmp (categoryid INT(8) UNSIGNED NOT NULL,datesub INT(11) DEFAULT '0' NOT NULL);";
791
-        $sql2 = ' LOCK TABLES ' . $this->db->prefix('smartfaq_faq') . ' READ;';
792
-        $sql3 = ' INSERT INTO tmp SELECT categoryid, MAX(datesub) FROM ' . $this->db->prefix('smartfaq_faq') . ' WHERE status IN (' . implode(',', $status) . ") $faqclause GROUP BY categoryid;";
793
-        $sql4 = ' SELECT ' . $this->db->prefix('smartfaq_faq') . '.categoryid, faqid, question, uid, ' . $this->db->prefix('smartfaq_faq') . '.datesub FROM ' . $this->db->prefix('smartfaq_faq') . ', tmp
794
-                              WHERE ' . $this->db->prefix('smartfaq_faq') . '.categoryid=tmp.categoryid AND ' . $this->db->prefix('smartfaq_faq') . '.datesub=tmp.datesub;';
791
+        $sql2 = ' LOCK TABLES '.$this->db->prefix('smartfaq_faq').' READ;';
792
+        $sql3 = ' INSERT INTO tmp SELECT categoryid, MAX(datesub) FROM '.$this->db->prefix('smartfaq_faq').' WHERE status IN ('.implode(',', $status).") $faqclause GROUP BY categoryid;";
793
+        $sql4 = ' SELECT '.$this->db->prefix('smartfaq_faq').'.categoryid, faqid, question, uid, '.$this->db->prefix('smartfaq_faq').'.datesub FROM '.$this->db->prefix('smartfaq_faq').', tmp
794
+                              WHERE ' . $this->db->prefix('smartfaq_faq').'.categoryid=tmp.categoryid AND '.$this->db->prefix('smartfaq_faq').'.datesub=tmp.datesub;';
795 795
         /*
796 796
         //Old implementation
797 797
         $sql = "SELECT categoryid, faqid, question, uid, MAX(datesub) AS datesub FROM ".$this->db->prefix("smartfaq_faq")."
@@ -806,14 +806,14 @@  discard block
 block discarded – undo
806 806
         $this->db->queryF('UNLOCK TABLES;');
807 807
         $this->db->queryF('DROP TABLE tmp;');
808 808
         if (!$result) {
809
-            trigger_error('Error in getLastPublishedByCat SQL: ' . $error);
809
+            trigger_error('Error in getLastPublishedByCat SQL: '.$error);
810 810
 
811 811
             return $ret;
812 812
         }
813 813
         while (false !== ($row = $this->db->fetchArray($result))) {
814 814
             $faq = new Smartfaq\Faq();
815 815
             $faq->assignVars($row);
816
-            $ret[$row['categoryid']] =& $faq;
816
+            $ret[$row['categoryid']] = & $faq;
817 817
             unset($faq);
818 818
         }
819 819
 
@@ -828,9 +828,9 @@  discard block
 block discarded – undo
828 828
      */
829 829
     public function deleteAll($criteria = null)
830 830
     {
831
-        $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_faq');
831
+        $sql = 'DELETE FROM '.$this->db->prefix('smartfaq_faq');
832 832
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
833
-            $sql .= ' ' . $criteria->renderWhere();
833
+            $sql .= ' '.$criteria->renderWhere();
834 834
         }
835 835
         if (!$this->db->query($sql)) {
836 836
             return false;
@@ -851,10 +851,10 @@  discard block
 block discarded – undo
851 851
      **/
852 852
     public function updateAll($fieldname, $fieldvalue, $criteria = null)
853 853
     {
854
-        $set_clause = is_numeric($fieldvalue) ? $fieldname . ' = ' . $fieldvalue : $fieldname . ' = ' . $this->db->quoteString($fieldvalue);
855
-        $sql        = 'UPDATE ' . $this->db->prefix('smartfaq_faq') . ' SET ' . $set_clause;
854
+        $set_clause = is_numeric($fieldvalue) ? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue);
855
+        $sql        = 'UPDATE '.$this->db->prefix('smartfaq_faq').' SET '.$set_clause;
856 856
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
857
-            $sql .= ' ' . $criteria->renderWhere();
857
+            $sql .= ' '.$criteria->renderWhere();
858 858
         }
859 859
         if (!$this->db->queryF($sql)) {
860 860
             return false;
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
      */
870 870
     public function updateCounter($faqid)
871 871
     {
872
-        $sql = 'UPDATE ' . $this->db->prefix('smartfaq_faq') . ' SET counter=counter+1 WHERE faqid = ' . $faqid;
872
+        $sql = 'UPDATE '.$this->db->prefix('smartfaq_faq').' SET counter=counter+1 WHERE faqid = '.$faqid;
873 873
         if ($this->db->queryF($sql)) {
874 874
             return true;
875 875
         } else {
@@ -921,12 +921,12 @@  discard block
 block discarded – undo
921 921
             $criteriaUser->add(new \Criteria('answer.uid', $userid), 'OR');
922 922
         }
923 923
 
924
-        if (! empty($queryarray)) {
924
+        if (!empty($queryarray)) {
925 925
             $criteriaKeywords = new \CriteriaCompo();
926 926
             foreach ($queryarray as $iValue) {
927 927
                 $criteriaKeyword = new \CriteriaCompo();
928
-                $criteriaKeyword->add(new \Criteria('faq.question', '%' . $iValue . '%', 'LIKE'), 'OR');
929
-                $criteriaKeyword->add(new \Criteria('answer.answer', '%' . $iValue . '%', 'LIKE'), 'OR');
928
+                $criteriaKeyword->add(new \Criteria('faq.question', '%'.$iValue.'%', 'LIKE'), 'OR');
929
+                $criteriaKeyword->add(new \Criteria('answer.answer', '%'.$iValue.'%', 'LIKE'), 'OR');
930 930
                 $criteriaKeywords->add($criteriaKeyword, $andor);
931 931
                 unset($criteriaKeyword);
932 932
             }
@@ -945,9 +945,9 @@  discard block
 block discarded – undo
945 945
             if (empty($faqsGranted)) {
946 946
                 return $ret;
947 947
             }
948
-            $grantedCategories = new \Criteria('faq.categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN');
948
+            $grantedCategories = new \Criteria('faq.categoryid', '('.implode(',', $categoriesGranted).')', 'IN');
949 949
             $grantedFaq        = new \CriteriaCompo();
950
-            $grantedFaq->add(new \Criteria('faq.faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR');
950
+            $grantedFaq->add(new \Criteria('faq.faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR');
951 951
             // If user is anonymous, check if the FAQ allow partialview
952 952
             if (!is_object($xoopsUser)) {
953 953
                 $grantedFaq->add(new \Criteria('partialview', '1'), 'OR');
@@ -993,15 +993,15 @@  discard block
 block discarded – undo
993 993
         $criteria->setSort('faq.datesub');
994 994
         $criteria->setOrder('DESC');
995 995
 
996
-        $sql = 'SELECT faq.faqid, faq.question, faq.datesub, faq.uid FROM ' . $this->db->prefix('smartfaq_faq') . ' AS faq INNER JOIN ' . $this->db->prefix('smartfaq_answers') . ' AS answer ON faq.faqid = answer.faqid';
996
+        $sql = 'SELECT faq.faqid, faq.question, faq.datesub, faq.uid FROM '.$this->db->prefix('smartfaq_faq').' AS faq INNER JOIN '.$this->db->prefix('smartfaq_answers').' AS answer ON faq.faqid = answer.faqid';
997 997
 
998 998
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
999 999
             $whereClause = $criteria->renderWhere();
1000 1000
 
1001 1001
             if ('WHERE ()' !== $whereClause) {
1002
-                $sql .= ' ' . $criteria->renderWhere();
1002
+                $sql .= ' '.$criteria->renderWhere();
1003 1003
                 if ('' != $criteria->getSort()) {
1004
-                    $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
1004
+                    $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
1005 1005
                 }
1006 1006
                 $limit = $criteria->getLimit();
1007 1007
                 $start = $criteria->getStart();
@@ -1024,7 +1024,7 @@  discard block
 block discarded – undo
1024 1024
         while (false !== ($myrow = $this->db->fetchArray($result))) {
1025 1025
             $faq = new Smartfaq\Faq();
1026 1026
             $faq->assignVars($myrow);
1027
-            $ret[] =& $faq;
1027
+            $ret[] = & $faq;
1028 1028
             unset($faq);
1029 1029
         }
1030 1030
 
@@ -1040,20 +1040,20 @@  discard block
 block discarded – undo
1040 1040
     {
1041 1041
         global $xoopsUser;
1042 1042
         $ret = [];
1043
-        $sql = 'SELECT categoryid, COUNT(*) AS count FROM ' . $this->db->prefix('smartfaq_faq');
1043
+        $sql = 'SELECT categoryid, COUNT(*) AS count FROM '.$this->db->prefix('smartfaq_faq');
1044 1044
         if ((int)$cat_id > 0) {
1045
-            $sql .= ' WHERE categoryid = ' . (int)$cat_id;
1046
-            $sql .= ' AND status IN (' . implode(',', $status) . ')';
1045
+            $sql .= ' WHERE categoryid = '.(int)$cat_id;
1046
+            $sql .= ' AND status IN ('.implode(',', $status).')';
1047 1047
         } else {
1048
-            $sql .= ' WHERE status IN (' . implode(',', $status) . ')';
1048
+            $sql .= ' WHERE status IN ('.implode(',', $status).')';
1049 1049
             if (!Smartfaq\Utility::userIsAdmin()) {
1050 1050
                 /** @var Smartfaq\PermissionHandler $smartPermHandler */
1051 1051
                 $smartPermHandler = Smartfaq\Helper::getInstance()->getHandler('Permission');
1052 1052
                 $items            = $smartPermHandler->getPermissions('item');
1053 1053
                 if (is_object($xoopsUser)) {
1054
-                    $sql .= ' AND faqid IN (' . implode(',', $items) . ')';
1054
+                    $sql .= ' AND faqid IN ('.implode(',', $items).')';
1055 1055
                 } else {
1056
-                    $sql .= ' AND (faqid IN (' . implode(',', $items) . ') OR partialview = 1)';
1056
+                    $sql .= ' AND (faqid IN ('.implode(',', $items).') OR partialview = 1)';
1057 1057
                 }
1058 1058
             }
1059 1059
         }
Please login to merge, or discard this patch.