Completed
Push — master ( deff52...719c50 )
by Michael
02:17
created
print.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use XoopsModules\Smartfaq;
10 10
 
11
-require_once __DIR__ . '/header.php';
11
+require_once __DIR__.'/header.php';
12 12
 
13 13
 $faqid = isset($_GET['faqid']) ? (int)$_GET['faqid'] : 0;
14 14
 
@@ -46,23 +46,23 @@  discard block
 block discarded – undo
46 46
 
47 47
 echo "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>\n";
48 48
 echo "<html>\n<head>\n";
49
-echo '<title>' . _MD_SF_FAQCOMEFROM . ' ' . $xoopsConfig['sitename'] . "</title>\n";
50
-echo "<meta http-equiv='Content-Type' content='text/html; charset=" . _CHARSET . "'>\n";
51
-echo "<meta name='AUTHOR' content='" . $xoopsConfig['sitename'] . "'>\n";
52
-echo "<meta name='COPYRIGHT' content='Copyright (c) 2001 by " . $xoopsConfig['sitename'] . "'>\n";
53
-echo "<meta name='DESCRIPTION' content='" . $xoopsConfig['slogan'] . "'>\n";
54
-echo "<meta name='GENERATOR' content='" . XOOPS_VERSION . "'>\n\n\n";
49
+echo '<title>'._MD_SF_FAQCOMEFROM.' '.$xoopsConfig['sitename']."</title>\n";
50
+echo "<meta http-equiv='Content-Type' content='text/html; charset="._CHARSET."'>\n";
51
+echo "<meta name='AUTHOR' content='".$xoopsConfig['sitename']."'>\n";
52
+echo "<meta name='COPYRIGHT' content='Copyright (c) 2001 by ".$xoopsConfig['sitename']."'>\n";
53
+echo "<meta name='DESCRIPTION' content='".$xoopsConfig['slogan']."'>\n";
54
+echo "<meta name='GENERATOR' content='".XOOPS_VERSION."'>\n\n\n";
55 55
 
56 56
 echo "<body bgcolor='#ffffff' text='#000000' onload='window.print()'>
57 57
      <div style='width: 650px; border: 1px solid #000; padding: 20px;'>
58
-     <div style='text-align: center; display: block; margin: 0 0 6px 0;'><img src='" . XOOPS_URL . "/modules/smartfaq/assets/images/logo_module.png' border='0' alt=''><h2 style='margin: 0;'>" . $faqObj->question() . "</h2></div>
59
-     <div align='center'>" . $who_where . "</div>
58
+     <div style='text-align: center; display: block; margin: 0 0 6px 0;'><img src='" . XOOPS_URL."/modules/smartfaq/assets/images/logo_module.png' border='0' alt=''><h2 style='margin: 0;'>".$faqObj->question()."</h2></div>
59
+     <div align='center'>" . $who_where."</div>
60 60
                 <div style='text-align: center; display: block; padding-bottom: 12px; margin: 0 0 6px 0; border-bottom: 2px solid #ccc;'></div>
61 61
                 <div></div>
62
-                <b><p>" . $faqObj->question() . '</p></b>
63
-                <p>' . $answerObj->answer() . "</p>
62
+                <b><p>" . $faqObj->question().'</p></b>
63
+                <p>' . $answerObj->answer()."</p>
64 64
                 <div style='padding-top: 12px; border-top: 2px solid #ccc;'></div>
65
-                <p>" . $comeFrom . '</p>
65
+                <p>" . $comeFrom.'</p>
66 66
             </div>
67 67
     <br>';
68 68
 
Please login to merge, or discard this patch.
include/functions.image.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -28,24 +28,24 @@  discard block
 block discarded – undo
28 28
     {
29 29
         global $xoopsModuleConfig;
30 30
 
31
-        $img_path   = XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'];
32
-        $img_url    = XOOPS_URL . '/' . $xoopsModuleConfig['dir_attachments'];
33
-        $thumb_path = $img_path . '/thumbs';
34
-        $thumb_url  = $img_url . '/thumbs';
31
+        $img_path   = XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'];
32
+        $img_url    = XOOPS_URL.'/'.$xoopsModuleConfig['dir_attachments'];
33
+        $thumb_path = $img_path.'/thumbs';
34
+        $thumb_url  = $img_url.'/thumbs';
35 35
 
36
-        $thumb     = $thumb_path . '/' . $source;
37
-        $image     = $img_path . '/' . $source;
38
-        $thumb_url = $thumb_url . '/' . $source;
39
-        $image_url = $img_url . '/' . $source;
36
+        $thumb     = $thumb_path.'/'.$source;
37
+        $image     = $img_path.'/'.$source;
38
+        $thumb_url = $thumb_url.'/'.$source;
39
+        $image_url = $img_url.'/'.$source;
40 40
 
41 41
         $imginfo  = @getimagesize($image);
42
-        $img_info = (count($imginfo) > 0) ? $imginfo[0] . 'X' . $imginfo[1] . ' px' : '';
42
+        $img_info = (count($imginfo) > 0) ? $imginfo[0].'X'.$imginfo[1].' px' : '';
43 43
 
44 44
         if ($xoopsModuleConfig['max_image_width'] > 0 && $xoopsModuleConfig['max_image_height'] > 0) {
45 45
             if ($imginfo[0] > $xoopsModuleConfig['max_image_width']
46 46
                 || $imginfo[1] > $xoopsModuleConfig['max_image_height']) {
47 47
                 //if (!file_exists($thumb_path.'/'.$source) && $imginfo[0] > $xoopsModuleConfig['max_img_width']) {
48
-                if (!file_exists($thumb_path . '/' . $source)) {
48
+                if (!file_exists($thumb_path.'/'.$source)) {
49 49
                     sf_createThumbnail($source, $xoopsModuleConfig['max_image_width']);
50 50
                 }
51 51
             }
@@ -54,27 +54,27 @@  discard block
 block discarded – undo
54 54
                 || $imginfo[1] > $xoopsModuleConfig['max_image_height']) {
55 55
                 $pseudo_width  = $xoopsModuleConfig['max_image_width'];
56 56
                 $pseudo_height = $xoopsModuleConfig['max_image_width'] * ($imginfo[1] / $imginfo[0]);
57
-                $pseudo_size   = "width='" . $pseudo_width . "px' height='" . $pseudo_height . "px'";
57
+                $pseudo_size   = "width='".$pseudo_width."px' height='".$pseudo_height."px'";
58 58
             }
59 59
             // irmtfan to fix Undefined variable: pseudo_height
60 60
             if (!empty($pseudo_height) && $xoopsModuleConfig['max_image_height'] > 0
61 61
                 && $pseudo_height > $xoopsModuleConfig['max_image_height']) {
62 62
                 $pseudo_height = $xoopsModuleConfig['max_image_height'];
63 63
                 $pseudo_width  = $xoopsModuleConfig['max_image_height'] * ($imginfo[0] / $imginfo[1]);
64
-                $pseudo_size   = "width='" . $pseudo_width . "px' height='" . $pseudo_height . "px'";
64
+                $pseudo_size   = "width='".$pseudo_width."px' height='".$pseudo_height."px'";
65 65
             }
66 66
         }
67 67
 
68 68
         if (file_exists($thumb)) {
69
-            $attachmentImage = '<a href="' . $image_url . '" title="' . $source . ' ' . $img_info . '" target="_blank">';
70
-            $attachmentImage .= '<img src="' . $thumb_url . '" alt="' . $source . ' ' . $img_info . '">';
69
+            $attachmentImage = '<a href="'.$image_url.'" title="'.$source.' '.$img_info.'" target="_blank">';
70
+            $attachmentImage .= '<img src="'.$thumb_url.'" alt="'.$source.' '.$img_info.'">';
71 71
             $attachmentImage .= '</a>';
72 72
         } elseif (!empty($pseudo_size)) {
73
-            $attachmentImage = '<a href="' . $image_url . '" title="' . $source . ' ' . $img_info . '" target="_blank">';
74
-            $attachmentImage .= '<img src="' . $image_url . '" ' . $pseudo_size . ' alt="' . $source . ' ' . $img_info . '">';
73
+            $attachmentImage = '<a href="'.$image_url.'" title="'.$source.' '.$img_info.'" target="_blank">';
74
+            $attachmentImage .= '<img src="'.$image_url.'" '.$pseudo_size.' alt="'.$source.' '.$img_info.'">';
75 75
             $attachmentImage .= '</a>';
76 76
         } elseif (file_exists($image)) {
77
-            $attachmentImage = '<img src="' . $image_url . '" alt="' . $source . ' ' . $img_info . '">';
77
+            $attachmentImage = '<img src="'.$image_url.'" alt="'.$source.' '.$img_info.'">';
78 78
         } else {
79 79
             $attachmentImage = '';
80 80
         }
@@ -91,10 +91,10 @@  discard block
 block discarded – undo
91 91
     {
92 92
         global $xoopsModuleConfig;
93 93
 
94
-        $img_path   = XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'];
95
-        $thumb_path = $img_path . '/thumbs';
96
-        $src_file   = $img_path . '/' . $source;
97
-        $new_file   = $thumb_path . '/' . $source;
94
+        $img_path   = XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'];
95
+        $thumb_path = $img_path.'/thumbs';
96
+        $src_file   = $img_path.'/'.$source;
97
+        $new_file   = $thumb_path.'/'.$source;
98 98
         //$imageLibs = sf_getImageLibs();
99 99
 
100 100
         if (!filesize($src_file) || !is_readable($src_file)) {
@@ -120,14 +120,14 @@  discard block
 block discarded – undo
120 120
         if (1 == $xoopsModuleConfig['image_lib'] or 0 == $xoopsModuleConfig['image_lib']) {
121 121
             if (preg_match("#[A-Z]:|\\\\#Ai", __FILE__)) {
122 122
                 $cur_dir     = __DIR__;
123
-                $src_file_im = '"' . $cur_dir . '\\' . str_replace('/', '\\', $src_file) . '"';
124
-                $new_file_im = '"' . $cur_dir . '\\' . str_replace('/', '\\', $new_file) . '"';
123
+                $src_file_im = '"'.$cur_dir.'\\'.str_replace('/', '\\', $src_file).'"';
124
+                $new_file_im = '"'.$cur_dir.'\\'.str_replace('/', '\\', $new_file).'"';
125 125
             } else {
126 126
                 $src_file_im = @escapeshellarg($src_file);
127 127
                 $new_file_im = @escapeshellarg($new_file);
128 128
             }
129
-            $path           = empty($xoopsModuleConfig['path_magick']) ? '' : $xoopsModuleConfig['path_magick'] . '/';
130
-            $magick_command = $path . 'convert -quality 85 -antialias -sample ' . $newWidth . 'x' . $newHeight . ' ' . $src_file_im . ' +profile "*" ' . str_replace('\\', '/', $new_file_im) . '';
129
+            $path           = empty($xoopsModuleConfig['path_magick']) ? '' : $xoopsModuleConfig['path_magick'].'/';
130
+            $magick_command = $path.'convert -quality 85 -antialias -sample '.$newWidth.'x'.$newHeight.' '.$src_file_im.' +profile "*" '.str_replace('\\', '/', $new_file_im).'';
131 131
 
132 132
             @passthru($magick_command);
133 133
             if (file_exists($new_file)) {
@@ -136,13 +136,13 @@  discard block
 block discarded – undo
136 136
         }
137 137
 
138 138
         if (2 == $xoopsModuleConfig['image_lib'] or 0 == $xoopsModuleConfig['image_lib']) {
139
-            $path = empty($xoopsModuleConfig['path_netpbm']) ? '' : $xoopsModuleConfig['path_netpbm'] . '/';
139
+            $path = empty($xoopsModuleConfig['path_netpbm']) ? '' : $xoopsModuleConfig['path_netpbm'].'/';
140 140
             if (preg_match("/\.png/i", $source)) {
141
-                $cmd = $path . "pngtopnm $src_file | " . $path . "pnmscale -xysize $newWidth $newHeight | " . $path . "pnmtopng > $new_file";
141
+                $cmd = $path."pngtopnm $src_file | ".$path."pnmscale -xysize $newWidth $newHeight | ".$path."pnmtopng > $new_file";
142 142
             } elseif (preg_match("/\.(jpg|jpeg)/i", $source)) {
143
-                $cmd = $path . "jpegtopnm $src_file | " . $path . "pnmscale -xysize $newWidth $newHeight | " . $path . "ppmtojpeg -quality=90 > $new_file";
143
+                $cmd = $path."jpegtopnm $src_file | ".$path."pnmscale -xysize $newWidth $newHeight | ".$path."ppmtojpeg -quality=90 > $new_file";
144 144
             } elseif (preg_match("/\.gif/i", $source)) {
145
-                $cmd = $path . "giftopnm $src_file | " . $path . "pnmscale -xysize $newWidth $newHeight | ppmquant 256 | " . $path . "ppmtogif > $new_file";
145
+                $cmd = $path."giftopnm $src_file | ".$path."pnmscale -xysize $newWidth $newHeight | ppmquant 256 | ".$path."ppmtogif > $new_file";
146 146
             }
147 147
 
148 148
             @exec($cmd, $output, $retval);
Please login to merge, or discard this patch.
include/searchform.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
     $searchcat = new \XoopsFormSelect(_MD_WB_CATEGORY, 'categoryID', $categoryID);
22 22
     $searchcat->addOption('0', _MD_WB_ALLOFTHEM);
23 23
 
24
-    $resultcat = $xoopsDB->queryF('SELECT categoryID, name FROM ' . $xoopsDB->prefix('wbcategories') . ' ORDER BY categoryID');
24
+    $resultcat = $xoopsDB->queryF('SELECT categoryID, name FROM '.$xoopsDB->prefix('wbcategories').' ORDER BY categoryID');
25 25
 
26 26
     while (list($categoryID, $name) = $xoopsDB->fetchRow($resultcat)) {
27 27
         $searchcat->addOption('categoryID', "$categoryID : $name");
Please login to merge, or discard this patch.
include/config.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -22,25 +22,25 @@  discard block
 block discarded – undo
22 22
     $moduleDirName      = basename(dirname(__DIR__));
23 23
     $moduleDirNameUpper = strtoupper($moduleDirName);
24 24
     return (object)[
25
-        'name'           => strtoupper($moduleDirName) . ' Module Configurator',
25
+        'name'           => strtoupper($moduleDirName).' Module Configurator',
26 26
         'paths'          => [
27 27
             'dirname'    => $moduleDirName,
28
-            'admin'      => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin',
29
-            'modPath'    => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName,
30
-            'modUrl'     => XOOPS_URL . '/modules/' . $moduleDirName,
31
-            'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName,
32
-            'uploadUrl'  => XOOPS_UPLOAD_URL . '/' . $moduleDirName,
28
+            'admin'      => XOOPS_ROOT_PATH.'/modules/'.$moduleDirName.'/admin',
29
+            'modPath'    => XOOPS_ROOT_PATH.'/modules/'.$moduleDirName,
30
+            'modUrl'     => XOOPS_URL.'/modules/'.$moduleDirName,
31
+            'uploadPath' => XOOPS_UPLOAD_PATH.'/'.$moduleDirName,
32
+            'uploadUrl'  => XOOPS_UPLOAD_URL.'/'.$moduleDirName,
33 33
         ],
34 34
         'uploadFolders'  => [
35
-            constant($moduleDirNameUpper . '_UPLOAD_PATH'),
36
-            constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/category',
37
-            constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/screenshots',
35
+            constant($moduleDirNameUpper.'_UPLOAD_PATH'),
36
+            constant($moduleDirNameUpper.'_UPLOAD_PATH').'/category',
37
+            constant($moduleDirNameUpper.'_UPLOAD_PATH').'/screenshots',
38 38
             //XOOPS_UPLOAD_PATH . '/flags'
39 39
         ],
40 40
         'copyBlankFiles' => [
41
-            constant($moduleDirNameUpper . '_UPLOAD_PATH'),
42
-            constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/category',
43
-            constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/screenshots',
41
+            constant($moduleDirNameUpper.'_UPLOAD_PATH'),
42
+            constant($moduleDirNameUpper.'_UPLOAD_PATH').'/category',
43
+            constant($moduleDirNameUpper.'_UPLOAD_PATH').'/screenshots',
44 44
             //XOOPS_UPLOAD_PATH . '/flags'
45 45
         ],
46 46
 
@@ -75,6 +75,6 @@  discard block
 block discarded – undo
75 75
             '/images',
76 76
         ],
77 77
         'modCopyright'    => "<a href='https://xoops.org' title='XOOPS Project' target='_blank'>
78
-                     <img src='" . constant($moduleDirNameUpper . '_AUTHOR_LOGOIMG') . '\' alt=\'XOOPS Project\' /></a>',
78
+                     <img src='" . constant($moduleDirNameUpper.'_AUTHOR_LOGOIMG').'\' alt=\'XOOPS Project\' /></a>',
79 79
     ];
80 80
 }
Please login to merge, or discard this patch.
category.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use XoopsModules\Smartfaq;
10 10
 
11
-require_once __DIR__ . '/header.php';
11
+require_once __DIR__.'/header.php';
12 12
 
13 13
 $categoryid = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : 0;
14 14
 
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
 }
36 36
 $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_category.tpl';
37 37
 
38
-require_once XOOPS_ROOT_PATH . '/header.php';
39
-require_once __DIR__ . '/footer.php';
38
+require_once XOOPS_ROOT_PATH.'/header.php';
39
+require_once __DIR__.'/footer.php';
40 40
 
41 41
 // At which record shall we start
42 42
 $start = isset($_GET['start']) ? (int)$_GET['start'] : 0;
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 }
77 77
 $lastfaqsize = (int)$xoopsModuleConfig['lastfaqsize'];
78 78
 // Creating the sub-categories objects that belong to the selected category
79
-$subcatsObj    =& $categoryHandler->getCategories(0, 0, $categoryid);
79
+$subcatsObj    = & $categoryHandler->getCategories(0, 0, $categoryid);
80 80
 $total_subcats = count($subcatsObj);
81 81
 $total_faqs    = 0;
82 82
 if (0 != $total_subcats) {
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
         if (isset($totalQnas[$subcat_id]) && $totalQnas[$subcat_id] > 0) {
87 87
             if (isset($last_qnaObj[$subcat_id])) {
88 88
                 $subcatsObj[$i]->setVar('last_faqid', $last_qnaObj[$subcat_id]->getVar('faqid'));
89
-                $subcatsObj[$i]->setVar('last_question_link', "<a href='faq.php?faqid=" . $last_qnaObj[$subcat_id]->getVar('faqid') . "'>" . $last_qnaObj[$subcat_id]->question($lastfaqsize) . '</a>');
89
+                $subcatsObj[$i]->setVar('last_question_link', "<a href='faq.php?faqid=".$last_qnaObj[$subcat_id]->getVar('faqid')."'>".$last_qnaObj[$subcat_id]->question($lastfaqsize).'</a>');
90 90
             }
91 91
         }
92 92
         $subcatsObj[$i]->setVar('faqcount', $totalQnas[$subcat_id]);
93 93
         $subcats[$subcat_id] = $subcatsObj[$i]->toArray();
94
-        $total_faqs          += $totalQnas[$subcat_id];
94
+        $total_faqs += $totalQnas[$subcat_id];
95 95
         //}replacé ligne 92
96 96
     }
97 97
     $xoopsTpl->assign('subcats', $subcats);
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     }
115 115
 
116 116
     $memberHandler = xoops_getHandler('member');
117
-    $users         = $memberHandler->getUsers(new \Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN'), true);
117
+    $users         = $memberHandler->getUsers(new \Criteria('uid', '('.implode(',', array_keys($userids)).')', 'IN'), true);
118 118
     // Adding the Q&As of the selected category
119 119
     foreach ($faqsObj as $iValue) {
120 120
         $faq = $iValue->toArray(null, $categoryObj);
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 
141 141
     if (isset($last_qnaObj) && $last_qnaObj) {
142 142
         $category['last_faqid']         = $last_qnaObj[$categoryObj->getVar('categoryid')]->getVar('faqid');
143
-        $category['last_question_link'] = "<a href='faq.php?faqid=" . $last_qnaObj[$categoryObj->getVar('categoryid')]->getVar('faqid') . "'>" . $last_qnaObj[$categoryObj->getVar('categoryid')]->question($lastfaqsize) . '</a>';
143
+        $category['last_question_link'] = "<a href='faq.php?faqid=".$last_qnaObj[$categoryObj->getVar('categoryid')]->getVar('faqid')."'>".$last_qnaObj[$categoryObj->getVar('categoryid')]->question($lastfaqsize).'</a>';
144 144
     }
145 145
 }
146 146
 
@@ -165,26 +165,26 @@  discard block
 block discarded – undo
165 165
 $xoopsTpl->assign('lang_comments', _MD_SF_COMMENTS);
166 166
 
167 167
 // The Navigation Bar
168
-require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
169
-$pagenav = new \XoopsPageNav($thiscategory_faqcount, $xoopsModuleConfig['indexperpage'], $start, 'start', 'categoryid=' . $categoryObj->getVar('categoryid'));
168
+require_once XOOPS_ROOT_PATH.'/class/pagenav.php';
169
+$pagenav = new \XoopsPageNav($thiscategory_faqcount, $xoopsModuleConfig['indexperpage'], $start, 'start', 'categoryid='.$categoryObj->getVar('categoryid'));
170 170
 if (1 == $xoopsModuleConfig['useimagenavpage']) {
171
-    $xoopsTpl->assign('navbar', '<div style="text-align:right;">' . $pagenav->renderImageNav() . '</div>');
171
+    $xoopsTpl->assign('navbar', '<div style="text-align:right;">'.$pagenav->renderImageNav().'</div>');
172 172
 } else {
173
-    $xoopsTpl->assign('navbar', '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>');
173
+    $xoopsTpl->assign('navbar', '<div style="text-align:right;">'.$pagenav->renderNav().'</div>');
174 174
 }
175 175
 
176 176
 $xoopsTpl->assign('category', $category);
177 177
 
178 178
 // Page Title Hack by marcan
179 179
 $module_name = $myts->htmlSpecialChars($xoopsModule->getVar('name'));
180
-$xoopsTpl->assign('xoops_pagetitle', $module_name . ' - ' . $category['name']);
180
+$xoopsTpl->assign('xoops_pagetitle', $module_name.' - '.$category['name']);
181 181
 // End Page Title Hack by marcan
182 182
 
183 183
 //code to include smartie
184
-if (file_exists(XOOPS_ROOT_PATH . '/modules/smarttie/smarttie_links.php')) {
185
-    require_once XOOPS_ROOT_PATH . '/modules/smarttie/smarttie_links.php';
184
+if (file_exists(XOOPS_ROOT_PATH.'/modules/smarttie/smarttie_links.php')) {
185
+    require_once XOOPS_ROOT_PATH.'/modules/smarttie/smarttie_links.php';
186 186
     $xoopsTpl->assign('smarttie', 1);
187 187
 }
188 188
 //end code for smarttie
189 189
 
190
-require_once XOOPS_ROOT_PATH . '/footer.php';
190
+require_once XOOPS_ROOT_PATH.'/footer.php';
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 (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 ($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/CategoryHandler.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             $sql = sprintf(
93 93
                 'INSERT INTO `%s` (parentid, name, description, total, weight, created) VALUES (%u, %s, %s, %u, %u, %u)',
94 94
                 $this->db->prefix('smartfaq_categories'),
95
-                           $parentid,
95
+                            $parentid,
96 96
                 $this->db->quoteString($name),
97 97
                 $this->db->quoteString($description),
98 98
                 $total,
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
                 'UPDATE `%s` SET parentid = %u, name = %s, description = %s, total = %s, weight = %u, created = %u WHERE categoryid = %u',
105 105
                 $this->db->prefix('smartfaq_categories'),
106 106
                 $parentid,
107
-                           $this->db->quoteString($name),
107
+                            $this->db->quoteString($name),
108 108
                 $this->db->quoteString($description),
109 109
                 $total,
110 110
                 $weight,
Please login to merge, or discard this 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/FaqHandler.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@
 block discarded – undo
93 93
 
94 94
         if ($faq->isNew()) {
95 95
             $sql = sprintf('INSERT INTO `%s` (faqid, categoryid, question, howdoi, diduno, uid, datesub, status, counter, weight, html, smiley, xcodes, cancomment, comments, notifypub, modulelink, contextpage, exacturl, partialview) VALUES (NULL, %u, %s, %s, %s, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %s, %s, %u, %u)',
96
-                           $this->db->prefix('smartfaq_faq'),
96
+                            $this->db->prefix('smartfaq_faq'),
97 97
                 $categoryid,
98 98
                 $this->db->quoteString($question),
99 99
                 $this->db->quoteString($howdoi),
Please login to merge, or discard this 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 ($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.
class/SmartobjectDbupdater.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,11 +61,11 @@
 block discarded – undo
61 61
         $query = sprintf('ALTER TABLE `%s` RENAME %s', $from, $to);
62 62
         $ret   = $xoopsDB->queryF($query);
63 63
         if (!$ret) {
64
-            echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_RENAME_TABLE_ERR, $from) . '<br>';
64
+            echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_RENAME_TABLE_ERR, $from).'<br>';
65 65
 
66 66
             return false;
67 67
         } else {
68
-            echo '&nbsp;&nbsp;' . sprintf(_SDU_MSG_RENAME_TABLE, $from, $to) . '<br>';
68
+            echo '&nbsp;&nbsp;'.sprintf(_SDU_MSG_RENAME_TABLE, $from, $to).'<br>';
69 69
 
70 70
             return true;
71 71
         }
Please login to merge, or discard this patch.