Completed
Push — master ( 8e5652...4e30dc )
by Michael
02:28
created
class/Answer.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 
22 22
     /**
23 23
      * constructor
24
-     * @param null $id
24
+     * @param integer $id
25 25
      */
26 26
     public function __construct($id = null)
27 27
     {
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
         if (!$attach_key) {
86 86
             return false;
87 87
         }
88
-        $this->attachment_array[(string)$attach_key]['num_download']++;
88
+        $this->attachment_array[(string) $attach_key]['num_download']++;
89 89
 
90
-        return $this->attachment_array[(string)$attach_key]['num_download'];
90
+        return $this->attachment_array[(string) $attach_key]['num_download'];
91 91
     }
92 92
 
93 93
     /**
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
             $attachment_save = base64_encode(serialize($this->attachment_array));
101 101
         }
102 102
         $this->setVar('attachment', $attachment_save);
103
-        $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('smartfaq_answers') . ' SET attachment=' . $GLOBALS['xoopsDB']->quoteString($attachment_save) . ' WHERE post_id = ' . $this->getVar('answerid');
103
+        $sql = 'UPDATE '.$GLOBALS['xoopsDB']->prefix('smartfaq_answers').' SET attachment='.$GLOBALS['xoopsDB']->quoteString($attachment_save).' WHERE post_id = '.$this->getVar('answerid');
104 104
         if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) {
105 105
             //xoops_error($GLOBALS["xoopsDB"]->error());
106 106
             return false;
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 
133 133
         foreach ($attach_old as $key => $attach) {
134 134
             if (in_array($key, $attach_array)) {
135
-                @unlink(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attach['name_saved']);
136
-                @unlink(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/thumbs/' . $attach['name_saved']); // delete thumbnails
135
+                @unlink(XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/'.$attach['name_saved']);
136
+                @unlink(XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/thumbs/'.$attach['name_saved']); // delete thumbnails
137 137
                 continue;
138 138
             }
139 139
             $this->attachment_array[$key] = $attach;
@@ -159,12 +159,12 @@  discard block
 block discarded – undo
159 159
         static $counter = 0;
160 160
         $this->attachment_array = $this->getAttachment();
161 161
         if ($name_saved) {
162
-            $key                          = (string)(time() + ($counter++));
162
+            $key                          = (string) (time()+($counter++));
163 163
             $this->attachment_array[$key] = [
164 164
                 'name_saved'   => $name_saved,
165 165
                 'name_display' => isset($name_display) ? $name_display : $name_saved,
166 166
                 'mimetype'     => $mimetype,
167
-                'num_download' => isset($num_download) ? (int)$num_download : 0
167
+                'num_download' => isset($num_download) ? (int) $num_download : 0
168 168
             ];
169 169
         }
170 170
         $attachment_save = null;
@@ -190,24 +190,24 @@  discard block
 block discarded – undo
190 190
         if (is_array($attachments) && count($attachments) > 0) {
191 191
             $iconHandler = sf_getIconHandler();
192 192
             $mime_path   = $iconHandler->getPath('mime');
193
-            require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/include/functions.image.php';
193
+            require_once XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname', 'n').'/include/functions.image.php';
194 194
             $image_extensions = ['jpg', 'jpeg', 'gif', 'png', 'bmp']; // need improve !!!
195
-            $post_attachment  .= '<br><strong>' . _MD_ATTACHMENT . '</strong>:';
195
+            $post_attachment  .= '<br><strong>'._MD_ATTACHMENT.'</strong>:';
196 196
             $post_attachment  .= '<br><hr size="1" noshade="noshade"><br>';
197 197
             foreach ($attachments as $key => $att) {
198 198
                 $file_extension = ltrim(strrchr($att['name_saved'], '.'), '.');
199 199
                 $filetype       = $file_extension;
200
-                if (file_exists(XOOPS_ROOT_PATH . '/' . $mime_path . '/' . $filetype . '.gif')) {
201
-                    $icon_filetype = XOOPS_URL . '/' . $mime_path . '/' . $filetype . '.gif';
200
+                if (file_exists(XOOPS_ROOT_PATH.'/'.$mime_path.'/'.$filetype.'.gif')) {
201
+                    $icon_filetype = XOOPS_URL.'/'.$mime_path.'/'.$filetype.'.gif';
202 202
                 } else {
203
-                    $icon_filetype = XOOPS_URL . '/' . $mime_path . '/unknown.gif';
203
+                    $icon_filetype = XOOPS_URL.'/'.$mime_path.'/unknown.gif';
204 204
                 }
205
-                $file_size = @filesize(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $att['name_saved']);
206
-                $file_size = number_format($file_size / 1024, 2) . ' KB';
205
+                $file_size = @filesize(XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/'.$att['name_saved']);
206
+                $file_size = number_format($file_size / 1024, 2).' KB';
207 207
                 if ($xoopsModuleConfig['media_allowed'] && in_array(strtolower($file_extension), $image_extensions)) {
208
-                    $post_attachment .= '<br><img src="' . $icon_filetype . '" alt="' . $filetype . '"><strong>&nbsp; ' . $att['name_display'] . '</strong> <small>(' . $file_size . ')</small>';
209
-                    $post_attachment .= '<br>' . sf_attachmentImage($att['name_saved']);
210
-                    $isDisplayed     = true;
208
+                    $post_attachment .= '<br><img src="'.$icon_filetype.'" alt="'.$filetype.'"><strong>&nbsp; '.$att['name_display'].'</strong> <small>('.$file_size.')</small>';
209
+                    $post_attachment .= '<br>'.sf_attachmentImage($att['name_saved']);
210
+                    $isDisplayed = true;
211 211
                 } else {
212 212
                     global $xoopsUser;
213 213
                     if (empty($xoopsModuleConfig['show_userattach'])) {
@@ -364,9 +364,9 @@  discard block
 block discarded – undo
364 364
         $tags                  = [];
365 365
         $tags['MODULE_NAME']   = $myts->displayTarea($smartModule->getVar('name'));
366 366
         $tags['FAQ_NAME']      = $faqObj->question();
367
-        $tags['FAQ_URL']       = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/faq.php?faqid=' . $faqObj->faqid();
367
+        $tags['FAQ_URL']       = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/faq.php?faqid='.$faqObj->faqid();
368 368
         $tags['CATEGORY_NAME'] = $faqObj->getCategoryName();
369
-        $tags['CATEGORY_URL']  = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/category.php?categoryid=' . $faqObj->categoryid();
369
+        $tags['CATEGORY_URL']  = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/category.php?categoryid='.$faqObj->categoryid();
370 370
         $tags['FAQ_QUESTION']  = $faqObj->question();
371 371
 
372 372
         // TODO : Not sure about the 'formpreview' ...
Please login to merge, or discard this patch.
class/AnswerHandler.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      * create a new answer
28 28
      *
29 29
      * @param  bool $isNew flag the new objects as "new"?
30
-     * @return object Answer
30
+     * @return Answer Answer
31 31
      */
32 32
     public function create($isNew = true)
33 33
     {
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     /**
70 70
      * insert a new answer in the database
71 71
      *
72
-     * @param \XoopsObject $answerObj reference to the <a href='psi_element://sfAnswer'>sfAnswer</a> object
72
+     * @param Answer $answerObj reference to the <a href='psi_element://sfAnswer'>sfAnswer</a> object
73 73
      * @param  bool        $force
74 74
      * @return bool        FALSE if failed, TRUE if already present and unchanged or successful
75 75
      */
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
      */
49 49
     public function get($id = null, $fields = null)
50 50
     {
51
-        if ((int)$id > 0) {
52
-            $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_answers') . ' WHERE answerid=' . $id;
51
+        if ((int) $id > 0) {
52
+            $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_answers').' WHERE answerid='.$id;
53 53
             if (!$result = $this->db->query($sql)) {
54 54
                 return false;
55 55
             }
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
     {
178 178
         $ret   = [];
179 179
         $limit = $start = 0;
180
-        $sql   = 'SELECT * FROM ' . $this->db->prefix('smartfaq_answers');
180
+        $sql   = 'SELECT * FROM '.$this->db->prefix('smartfaq_answers');
181 181
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
182
-            $sql .= ' ' . $criteria->renderWhere();
182
+            $sql .= ' '.$criteria->renderWhere();
183 183
             if ('' != $criteria->getSort()) {
184
-                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
184
+                $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
185 185
             }
186 186
             $limit = $criteria->getLimit();
187 187
             $start = $criteria->getStart();
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
             $answer = new Smartfaq\Answer();
196 196
             $answer->assignVars($myrow);
197 197
             if (!$id_as_key) {
198
-                $ret[] =& $answer;
198
+                $ret[] = & $answer;
199 199
             } else {
200 200
                 $ret[$myrow['answerid']] = $answer;
201 201
             }
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         $criteria->setOrder($order);
266 266
         $criteria->setLimit($limit);
267 267
         $criteria->setStart($start);
268
-        $ret =& $this->getObjects($criteria);
268
+        $ret = & $this->getObjects($criteria);
269 269
 
270 270
         return $ret;
271 271
     }
@@ -278,9 +278,9 @@  discard block
 block discarded – undo
278 278
      */
279 279
     public function getCount(\CriteriaElement $criteria = null)
280 280
     {
281
-        $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_answers');
281
+        $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('smartfaq_answers');
282 282
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
283
-            $sql .= ' ' . $criteria->renderWhere();
283
+            $sql .= ' '.$criteria->renderWhere();
284 284
         }
285 285
         $result = $this->db->query($sql);
286 286
         if (!$result) {
@@ -299,10 +299,10 @@  discard block
 block discarded – undo
299 299
      */
300 300
     public function getCountByFAQ($criteria = null)
301 301
     {
302
-        $sql = 'SELECT faqid, COUNT(*) FROM ' . $this->db->prefix('smartfaq_answers');
302
+        $sql = 'SELECT faqid, COUNT(*) FROM '.$this->db->prefix('smartfaq_answers');
303 303
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
304
-            $sql .= ' ' . $criteria->renderWhere();
305
-            $sql .= ' ' . $criteria->getGroupby();
304
+            $sql .= ' '.$criteria->renderWhere();
305
+            $sql .= ' '.$criteria->getGroupby();
306 306
         }
307 307
 
308 308
         //echo "<br>$sql<br>";
@@ -329,9 +329,9 @@  discard block
 block discarded – undo
329 329
      */
330 330
     public function deleteAll(\CriteriaElement $criteria = null, $force = true, $asObject = false)
331 331
     {
332
-        $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_answers');
332
+        $sql = 'DELETE FROM '.$this->db->prefix('smartfaq_answers');
333 333
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
334
-            $sql .= ' ' . $criteria->renderWhere();
334
+            $sql .= ' '.$criteria->renderWhere();
335 335
         }
336 336
         if (!$this->db->query($sql)) {
337 337
             return false;
@@ -351,10 +351,10 @@  discard block
 block discarded – undo
351 351
      */
352 352
     public function updateAll($fieldname, $fieldvalue, \CriteriaElement $criteria = null, $force = false)
353 353
     {
354
-        $set_clause = is_numeric($fieldvalue) ? $fieldname . ' = ' . $fieldvalue : $fieldname . ' = ' . $this->db->quoteString($fieldvalue);
355
-        $sql        = 'UPDATE ' . $this->db->prefix('smartfaq_answers') . ' SET ' . $set_clause;
354
+        $set_clause = is_numeric($fieldvalue) ? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue);
355
+        $sql        = 'UPDATE '.$this->db->prefix('smartfaq_answers').' SET '.$set_clause;
356 356
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
357
-            $sql .= ' ' . $criteria->renderWhere();
357
+            $sql .= ' '.$criteria->renderWhere();
358 358
         }
359 359
         //echo "<br>" . $sql . "<br>";
360 360
         if (!$this->db->queryF($sql)) {
@@ -371,8 +371,8 @@  discard block
 block discarded – undo
371 371
     public function getLastPublishedByFaq($faqids)
372 372
     {
373 373
         $ret    = [];
374
-        $sql    = 'SELECT faqid, answer, uid, datesub FROM ' . $this->db->prefix('smartfaq_answers') . '
375
-               WHERE faqid IN (' . implode(',', $faqids) . ') AND status = ' . Constants::SF_AN_STATUS_APPROVED . ' GROUP BY faqid';
374
+        $sql    = 'SELECT faqid, answer, uid, datesub FROM '.$this->db->prefix('smartfaq_answers').'
375
+               WHERE faqid IN (' . implode(',', $faqids).') AND status = '.Constants::SF_AN_STATUS_APPROVED.' GROUP BY faqid';
376 376
         $result = $this->db->query($sql);
377 377
         if (!$result) {
378 378
             return $ret;
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
         while ($row = $this->db->fetchArray($result)) {
381 381
             $answer = new Smartfaq\Answer();
382 382
             $answer->assignVars($row);
383
-            $ret[$row['faqid']] =& $answer;
383
+            $ret[$row['faqid']] = & $answer;
384 384
             unset($answer);
385 385
         }
386 386
 
Please login to merge, or discard this patch.
class/Category.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@
 block discarded – undo
115 115
     }
116 116
 
117 117
     /**
118
-     * @return mixed
118
+     * @return integer
119 119
      */
120 120
     public function parentid()
121 121
     {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
             $filename = 'open_category.php';
167 167
         }
168 168
         if ($withAllLink) {
169
-            $ret = "<a href='" . XOOPS_URL . '/modules/smartfaq/' . $filename . '?categoryid=' . $this->categoryid() . "'>" . $this->name() . '</a>';
169
+            $ret = "<a href='".XOOPS_URL.'/modules/smartfaq/'.$filename.'?categoryid='.$this->categoryid()."'>".$this->name().'</a>';
170 170
         } else {
171 171
             $ret = $this->name();
172 172
         }
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
                 exit;
180 180
             }
181 181
             $parentid = $parentObj->parentid();
182
-            $ret      = $parentObj->getCategoryPath(true, $open) . ' > ' . $ret;
182
+            $ret      = $parentObj->getCategoryPath(true, $open).' > '.$ret;
183 183
         }
184 184
 
185 185
         return $ret;
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
         $tags                  = [];
237 237
         $tags['MODULE_NAME']   = $myts->htmlSpecialChars($smartModule->getVar('name'));
238 238
         $tags['CATEGORY_NAME'] = $this->name();
239
-        $tags['CATEGORY_URL']  = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/category.php?categoryid=' . $this->categoryid();
239
+        $tags['CATEGORY_URL']  = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/category.php?categoryid='.$this->categoryid();
240 240
 
241 241
         $notificationHandler = xoops_getHandler('notification');
242 242
         $notificationHandler->triggerEvent('global_faq', 0, 'category_created', $tags);
@@ -252,9 +252,9 @@  discard block
 block discarded – undo
252 252
         $category['categoryid'] = $this->categoryid();
253 253
         $category['name']       = $this->name();
254 254
         if (false !== $open) {
255
-            $category['categorylink'] = "<a href='" . XOOPS_URL . '/modules/smartfaq/open_category.php?categoryid=' . $this->categoryid() . "'>" . $this->name() . '</a>';
255
+            $category['categorylink'] = "<a href='".XOOPS_URL.'/modules/smartfaq/open_category.php?categoryid='.$this->categoryid()."'>".$this->name().'</a>';
256 256
         } else {
257
-            $category['categorylink'] = "<a href='" . XOOPS_URL . '/modules/smartfaq/category.php?categoryid=' . $this->categoryid() . "'>" . $this->name() . '</a>';
257
+            $category['categorylink'] = "<a href='".XOOPS_URL.'/modules/smartfaq/category.php?categoryid='.$this->categoryid()."'>".$this->name().'</a>';
258 258
         }
259 259
         $category['total']       = $this->getVar('faqcount');
260 260
         $category['description'] = $this->description();
Please login to merge, or discard this patch.
class/CategoryHandler.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      * create a new category
26 26
      *
27 27
      * @param  bool $isNew flag the new objects as "new"?
28
-     * @return object Smartfaq\Category
28
+     * @return Category Smartfaq\Category
29 29
      */
30 30
     public function create($isNew = true)
31 31
     {
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     /**
68 68
      * insert a new category in the database
69 69
      *
70
-     * @param \XoopsObject $category reference to the {@link Smartfaq\Category}
70
+     * @param Category $category reference to the {@link Smartfaq\Category}
71 71
      *                               object
72 72
      * @param  bool        $force
73 73
      * @return bool        FALSE if failed, TRUE if already present and unchanged or successful
Please login to merge, or discard this patch.
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
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
     public function get($id)
47 47
     {
48 48
         $false = false;
49
-        if ((int)$id > 0) {
50
-            $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_categories') . ' WHERE categoryid=' . $id;
49
+        if ((int) $id > 0) {
50
+            $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_categories').' WHERE categoryid='.$id;
51 51
             if (!$result = $this->db->query($sql)) {
52 52
                 return $false;
53 53
             }
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         }
150 150
 
151 151
         // Deleteing the sub categories
152
-        $subcats =& $this->getCategories(0, 0, $category->categoryid());
152
+        $subcats = & $this->getCategories(0, 0, $category->categoryid());
153 153
         foreach ($subcats as $subcat) {
154 154
             $this->delete($subcat);
155 155
         }
@@ -186,11 +186,11 @@  discard block
 block discarded – undo
186 186
     {
187 187
         $ret   = [];
188 188
         $limit = $start = 0;
189
-        $sql   = 'SELECT * FROM ' . $this->db->prefix('smartfaq_categories');
189
+        $sql   = 'SELECT * FROM '.$this->db->prefix('smartfaq_categories');
190 190
         if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) {
191
-            $sql .= ' ' . $criteria->renderWhere();
191
+            $sql .= ' '.$criteria->renderWhere();
192 192
             if ('' != $criteria->getSort()) {
193
-                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
193
+                $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
194 194
             }
195 195
             $limit = $criteria->getLimit();
196 196
             $start = $criteria->getStart();
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
             $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission');
248 248
 
249 249
             $categoriesGranted = $smartPermHandler->getPermissions('category');
250
-            $criteria->add(new \Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'));
250
+            $criteria->add(new \Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN'));
251 251
         }
252 252
         $criteria->setStart($start);
253 253
         $criteria->setLimit($limit);
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
             $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission');
287 287
 
288 288
             $categoriesGranted = $smartPermHandler->getPermissions('category');
289
-            $criteria->add(new \Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'));
289
+            $criteria->add(new \Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN'));
290 290
         }
291 291
 
292 292
         $criteria->add(new \Criteria('f.status', Constants::SF_STATUS_OPENED));
@@ -295,11 +295,11 @@  discard block
 block discarded – undo
295 295
 
296 296
         $ret   = [];
297 297
         $limit = $start = 0;
298
-        $sql   = 'SELECT DISTINCT c.categoryid, c.parentid, c.name, c.description, c.total, c.weight, c.created FROM ' . $this->db->prefix('smartfaq_categories') . ' AS c INNER JOIN ' . $this->db->prefix('smartfaq_faq') . ' AS f ON c.categoryid = f.categoryid';
298
+        $sql   = 'SELECT DISTINCT c.categoryid, c.parentid, c.name, c.description, c.total, c.weight, c.created FROM '.$this->db->prefix('smartfaq_categories').' AS c INNER JOIN '.$this->db->prefix('smartfaq_faq').' AS f ON c.categoryid = f.categoryid';
299 299
         if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) {
300
-            $sql .= ' ' . $criteria->renderWhere();
300
+            $sql .= ' '.$criteria->renderWhere();
301 301
             if ('' != $criteria->getSort()) {
302
-                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
302
+                $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
303 303
             }
304 304
             $limit = $criteria->getLimit();
305 305
             $start = $criteria->getStart();
@@ -328,9 +328,9 @@  discard block
 block discarded – undo
328 328
      */
329 329
     public function getCount($criteria = null)
330 330
     {
331
-        $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_categories');
331
+        $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('smartfaq_categories');
332 332
         if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) {
333
-            $sql .= ' ' . $criteria->renderWhere();
333
+            $sql .= ' '.$criteria->renderWhere();
334 334
         }
335 335
         $result = $this->db->query($sql);
336 336
         if (!$result) {
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
                 $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission');
359 359
 
360 360
                 $categoriesGranted = $smartPermHandler->getPermissions('category');
361
-                $criteria->add(new \Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'));
361
+                $criteria->add(new \Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN'));
362 362
             }
363 363
         }
364 364
 
@@ -382,16 +382,16 @@  discard block
 block discarded – undo
382 382
                 $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission');
383 383
 
384 384
                 $categoriesGranted = $smartPermHandler->getPermissions('category');
385
-                $criteria->add(new \Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'));
385
+                $criteria->add(new \Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN'));
386 386
             }
387 387
         }
388 388
 
389 389
         $criteria->add(new \Criteria('f.status', Constants::SF_STATUS_OPENED));
390 390
 
391
-        $sql = 'SELECT COUNT(c.categoryid) FROM ' . $this->db->prefix('smartfaq_categories') . ' AS c INNER JOIN ' . $this->db->prefix('smartfaq_faq') . ' AS f ON c.categoryid = f.categoryid';
391
+        $sql = 'SELECT COUNT(c.categoryid) FROM '.$this->db->prefix('smartfaq_categories').' AS c INNER JOIN '.$this->db->prefix('smartfaq_faq').' AS f ON c.categoryid = f.categoryid';
392 392
 
393 393
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
394
-            $sql .= ' ' . $criteria->renderWhere();
394
+            $sql .= ' '.$criteria->renderWhere();
395 395
         }
396 396
 
397 397
         $result = $this->db->query($sql);
@@ -409,16 +409,16 @@  discard block
 block discarded – undo
409 409
      */
410 410
     public function getSubCats($categories)
411 411
     {
412
-        $criteria = new \CriteriaCompo(new \Criteria('parentid', '(' . implode(',', array_keys($categories)) . ')'), 'IN');
412
+        $criteria = new \CriteriaCompo(new \Criteria('parentid', '('.implode(',', array_keys($categories)).')'), 'IN');
413 413
         $ret      = [];
414 414
         if (!Smartfaq\Utility::userIsAdmin()) {
415 415
             /** @var \XoopsModules\Smartfaq\PermissionHandler $smartPermHandler */
416 416
             $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission');
417 417
 
418 418
             $categoriesGranted = $smartPermHandler->getPermissions('category');
419
-            $criteria->add(new \Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'));
419
+            $criteria->add(new \Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN'));
420 420
         }
421
-        $subcats =& $this->getObjects($criteria, true);
421
+        $subcats = & $this->getObjects($criteria, true);
422 422
         foreach ($subcats as $subcat_id => $subcat) {
423 423
             $ret[$subcat->getVar('parentid')][$subcat->getVar('categoryid')] = $subcat;
424 424
         }
@@ -434,9 +434,9 @@  discard block
 block discarded – undo
434 434
      */
435 435
     public function deleteAll($criteria = null)
436 436
     {
437
-        $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_categories');
437
+        $sql = 'DELETE FROM '.$this->db->prefix('smartfaq_categories');
438 438
         if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) {
439
-            $sql .= ' ' . $criteria->renderWhere();
439
+            $sql .= ' '.$criteria->renderWhere();
440 440
         }
441 441
         if (!$this->db->query($sql)) {
442 442
             return false;
@@ -458,10 +458,10 @@  discard block
 block discarded – undo
458 458
      **/
459 459
     public function updateAll($fieldname, $fieldvalue, \CriteriaElement $criteria = null)
460 460
     {
461
-        $set_clause = is_numeric($fieldvalue) ? $fieldname . ' = ' . $fieldvalue : $fieldname . ' = ' . $this->db->quoteString($fieldvalue);
462
-        $sql        = 'UPDATE ' . $this->db->prefix('smartfaq_categories') . ' SET ' . $set_clause;
461
+        $set_clause = is_numeric($fieldvalue) ? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue);
462
+        $sql        = 'UPDATE '.$this->db->prefix('smartfaq_categories').' SET '.$set_clause;
463 463
         if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) {
464
-            $sql .= ' ' . $criteria->renderWhere();
464
+            $sql .= ' '.$criteria->renderWhere();
465 465
         }
466 466
         if (!$this->db->queryF($sql)) {
467 467
             return false;
Please login to merge, or discard this patch.
class/Faq.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -226,7 +226,7 @@
 block discarded – undo
226 226
     }
227 227
 
228 228
     /**
229
-     * @return mixed
229
+     * @return integer
230 230
      */
231 231
     public function uid()
232 232
     {
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
         if (0 != $maxLength) {
188 188
             if (!XOOPS_USE_MULTIBYTES) {
189 189
                 if (strlen($ret) >= $maxLength) {
190
-                    $ret = substr($ret, 0, $maxLength - 1) . '...';
190
+                    $ret = substr($ret, 0, $maxLength-1).'...';
191 191
                 }
192 192
             }
193 193
         }
@@ -379,14 +379,14 @@  discard block
 block discarded – undo
379 379
                 $theAnswers = $answerHandler->getAllAnswers($this->faqid(), Constants::SF_AN_STATUS_APPROVED, 1, 0);
380 380
                 //echo "test";
381 381
                 //exit;
382
-                $this->answer =& $theAnswers[0];
382
+                $this->answer = & $theAnswers[0];
383 383
                 break;
384 384
 
385 385
             case Constants::SF_STATUS_ANSWERED:
386 386
                 $theAnswers = $answerHandler->getAllAnswers($this->faqid(), Constants::SF_AN_STATUS_PROPOSED, 1, 0);
387 387
                 //echo "test";
388 388
                 //exit;
389
-                $this->answer =& $theAnswers[0];
389
+                $this->answer = & $theAnswers[0];
390 390
                 break;
391 391
 
392 392
             case Constants::SF_STATUS_PUBLISHED:
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
         $tags['MODULE_NAME']   = $myts->displayTarea($smartModule->getVar('name'));
473 473
         $tags['FAQ_NAME']      = $this->question();
474 474
         $tags['CATEGORY_NAME'] = $this->getCategoryName();
475
-        $tags['CATEGORY_URL']  = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/category.php?categoryid=' . $this->categoryid();
475
+        $tags['CATEGORY_URL']  = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/category.php?categoryid='.$this->categoryid();
476 476
         $tags['FAQ_QUESTION']  = $this->question();
477 477
         $answerObj             = $this->answer();
478 478
         if (is_object($answerObj)) {
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
         foreach ($notifications as $notification) {
485 485
             switch ($notification) {
486 486
                 case Constants::SF_NOT_FAQ_PUBLISHED:
487
-                    $tags['FAQ_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/faq.php?faqid=' . $this->faqid();
487
+                    $tags['FAQ_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/faq.php?faqid='.$this->faqid();
488 488
 
489 489
                     $notificationHandler->triggerEvent('global_faq', 0, 'published', $tags);
490 490
                     $notificationHandler->triggerEvent('category_faq', $this->categoryid(), 'published', $tags);
@@ -492,20 +492,20 @@  discard block
 block discarded – undo
492 492
                     break;
493 493
 
494 494
                 case Constants::SF_NOT_FAQ_SUBMITTED:
495
-                    $tags['WAITINGFILES_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/admin/faq.php?faqid=' . $this->faqid();
495
+                    $tags['WAITINGFILES_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/admin/faq.php?faqid='.$this->faqid();
496 496
                     $notificationHandler->triggerEvent('global_faq', 0, 'submitted', $tags);
497 497
                     $notificationHandler->triggerEvent('category_faq', $this->categoryid(), 'submitted', $tags);
498 498
                     break;
499 499
 
500 500
                 case Constants::SF_NOT_QUESTION_PUBLISHED:
501
-                    $tags['FAQ_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/answer.php?faqid=' . $this->faqid();
501
+                    $tags['FAQ_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/answer.php?faqid='.$this->faqid();
502 502
                     $notificationHandler->triggerEvent('global_question', 0, 'published', $tags);
503 503
                     $notificationHandler->triggerEvent('category_question', $this->categoryid(), 'published', $tags);
504 504
                     $notificationHandler->triggerEvent('question', $this->faqid(), 'approved', $tags);
505 505
                     break;
506 506
 
507 507
                 case Constants::SF_NOT_QUESTION_SUBMITTED:
508
-                    $tags['WAITINGFILES_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/admin/question.php?op=mod&faqid=' . $this->faqid();
508
+                    $tags['WAITINGFILES_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/admin/question.php?op=mod&faqid='.$this->faqid();
509 509
                     $notificationHandler->triggerEvent('global_question', 0, 'submitted', $tags);
510 510
                     $notificationHandler->triggerEvent('category_question', $this->categoryid(), 'submitted', $tags);
511 511
                     break;
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
                     break;
516 516
 
517 517
                 case Constants::SF_NOT_NEW_ANSWER_PROPOSED:
518
-                    $tags['WAITINGFILES_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/admin/answer.php?op=mod&faqid=' . $this->faqid();
518
+                    $tags['WAITINGFILES_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/admin/answer.php?op=mod&faqid='.$this->faqid();
519 519
                     $notificationHandler->triggerEvent('global_faq', 0, 'answer_proposed', $tags);
520 520
                     $notificationHandler->triggerEvent('category_faq', $this->categoryid(), 'answer_proposed', $tags);
521 521
                     break;
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
             $text = _MD_SF_FAQCOMEFROM;
630 630
         }
631 631
 
632
-        return $text . $xoopsConfig['sitename'] . ' : <a href=' . XOOPS_URL . '/modules/smartfaq/faq.php?faqid=' . $this->faqid() . '>' . XOOPS_URL . '/modules/smartfaq/faq.php?faqid=' . $this->faqid() . '</a>';
632
+        return $text.$xoopsConfig['sitename'].' : <a href='.XOOPS_URL.'/modules/smartfaq/faq.php?faqid='.$this->faqid().'>'.XOOPS_URL.'/modules/smartfaq/faq.php?faqid='.$this->faqid().'</a>';
633 633
     }
634 634
 
635 635
     /**
@@ -641,16 +641,16 @@  discard block
 block discarded – undo
641 641
     public function toArray($faq = [], $category = null, $linkInQuestion = true)
642 642
     {
643 643
         global $xoopsModuleConfig;
644
-        $lastfaqsize = (int)$xoopsModuleConfig['lastfaqsize'];
644
+        $lastfaqsize = (int) $xoopsModuleConfig['lastfaqsize'];
645 645
 
646 646
         $faq['id']         = $this->faqid();
647 647
         $faq['categoryid'] = $this->categoryid();
648 648
         $faq['question']   = $this->question();
649 649
         $page              = (Constants::SF_STATUS_OPENED == $this->status()) ? 'answer.php' : 'faq.php';
650 650
 
651
-        $faq['questionlink'] = "<a href='$page?faqid=" . $this->faqid() . "'>" . $this->question($lastfaqsize) . '</a>';
651
+        $faq['questionlink'] = "<a href='$page?faqid=".$this->faqid()."'>".$this->question($lastfaqsize).'</a>';
652 652
         if ($linkInQuestion) {
653
-            $faq['fullquestionlink'] = "<a href='$page?faqid=" . $this->faqid() . "'>" . $this->question() . '</a>';
653
+            $faq['fullquestionlink'] = "<a href='$page?faqid=".$this->faqid()."'>".$this->question().'</a>';
654 654
         } else {
655 655
             $faq['fullquestionlink'] = $this->question();
656 656
         }
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
                 $categoryObj = $category[$this->categoryid()];
667 667
             }
668 668
             $faq['categoryname'] = $categoryObj->getVar('name');
669
-            $faq['categorylink'] = "<a href='" . XOOPS_URL . '/modules/smartfaq/category.php?categoryid=' . $this->categoryid() . "'>" . $categoryObj->getVar('name') . '</a>';
669
+            $faq['categorylink'] = "<a href='".XOOPS_URL.'/modules/smartfaq/category.php?categoryid='.$this->categoryid()."'>".$categoryObj->getVar('name').'</a>';
670 670
         }
671 671
 
672 672
         return $faq;
Please login to merge, or discard this patch.
class/FaqHandler.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     /**
69 69
      * insert a new faq in the database
70 70
      *
71
-     * @param \XoopsObject $faq reference to the {@link Smartfaq\Faq}
71
+     * @param Faq $faq reference to the {@link Smartfaq\Faq}
72 72
      *                          object
73 73
      * @param  bool        $force
74 74
      * @return bool        FALSE if failed, TRUE if already present and unchanged or successful
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
      * @param  string $order
519 519
      * @param  string $notNullFields
520 520
      * @param  bool   $asobject
521
-     * @param  null   $otherCriteria
521
+     * @param  null|\CriteriaCompo   $otherCriteria
522 522
      * @return array
523 523
      */
524 524
     public function getFaqs(
@@ -1035,7 +1035,7 @@  discard block
 block discarded – undo
1035 1035
 
1036 1036
     /**
1037 1037
      * @param  int   $cat_id
1038
-     * @param        $status
1038
+     * @param        string $status
1039 1039
      * @return array
1040 1040
      */
1041 1041
     public function getCountsByCat($cat_id = 0, $status)
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@
 block discarded – undo
94 94
         if ($faq->isNew()) {
95 95
             $sql = sprintf(
96 96
                 'INSERT INTO %s (faqid, categoryid, question, howdoi, diduno, uid, datesub, `status`, counter, weight, html, smiley, xcodes, cancomment, comments, notifypub, modulelink, contextpage, exacturl, partialview) VALUES (NULL, %u, %s, %s, %s, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %s, %s, %u, %u)',
97
-                           $this->db->prefix('smartfaq_faq'),
97
+                            $this->db->prefix('smartfaq_faq'),
98 98
                 $categoryid,
99 99
                 $this->db->quoteString($question),
100 100
                 $this->db->quoteString($howdoi),
Please login to merge, or discard this patch.
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
      */
48 48
     public function get($id)
49 49
     {
50
-        if ((int)$id > 0) {
51
-            $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_faq') . ' WHERE faqid=' . $id;
50
+        if ((int) $id > 0) {
51
+            $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_faq').' WHERE faqid='.$id;
52 52
             if (!$result = $this->db->query($sql)) {
53 53
                 return false;
54 54
             }
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 //            $faq->setError($this->db->error());
165 165
 
166 166
 
167
-            trigger_error('Class ' . $faq . ' could not be saved ' . __FILE__ . ' at line ' . __LINE__, E_USER_WARNING);
167
+            trigger_error('Class '.$faq.' could not be saved '.__FILE__.' at line '.__LINE__, E_USER_WARNING);
168 168
 
169 169
             return false;
170 170
         }
@@ -230,26 +230,26 @@  discard block
 block discarded – undo
230 230
     {
231 231
         $ret   = [];
232 232
         $limit = $start = 0;
233
-        $sql   = 'SELECT * FROM ' . $this->db->prefix('smartfaq_faq');
233
+        $sql   = 'SELECT * FROM '.$this->db->prefix('smartfaq_faq');
234 234
 
235 235
         if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) {
236 236
             $whereClause = $criteria->renderWhere();
237 237
 
238 238
             if ('WHERE ()' !== $whereClause) {
239
-                $sql .= ' ' . $criteria->renderWhere();
239
+                $sql .= ' '.$criteria->renderWhere();
240 240
                 if (!empty($notNullFields)) {
241 241
                     $sql .= $this->NotNullFieldClause($notNullFields, true);
242 242
                 }
243 243
             } elseif (!empty($notNullFields)) {
244
-                $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
244
+                $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
245 245
             }
246 246
             if ('' != $criteria->getSort()) {
247
-                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
247
+                $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
248 248
             }
249 249
             $limit = $criteria->getLimit();
250 250
             $start = $criteria->getStart();
251 251
         } elseif (!empty($notNullFields)) {
252
-            $sql .= $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
252
+            $sql .= $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
253 253
         }
254 254
 
255 255
         //echo "<br>" . $sql . "<br>";
@@ -268,9 +268,9 @@  discard block
 block discarded – undo
268 268
             $faq->assignVars($myrow);
269 269
 
270 270
             if (!$id_as_key) {
271
-                $ret[] =& $faq;
271
+                $ret[] = & $faq;
272 272
             } else {
273
-                $ret[$myrow['faqid']] =& $faq;
273
+                $ret[$myrow['faqid']] = & $faq;
274 274
             }
275 275
             unset($faq);
276 276
         }
@@ -310,26 +310,26 @@  discard block
 block discarded – undo
310 310
                             faq.modulelink AS modulelink,
311 311
                             faq.contextpage AS contextpage,
312 312
                             faq.exacturl AS exacturl
313
-                FROM ' . $this->db->prefix('smartfaq_faq') . ' AS faq INNER JOIN ' . $this->db->prefix('smartfaq_categories') . ' AS category ON faq.categoryid = category.categoryid ';
313
+                FROM ' . $this->db->prefix('smartfaq_faq').' AS faq INNER JOIN '.$this->db->prefix('smartfaq_categories').' AS category ON faq.categoryid = category.categoryid ';
314 314
 
315 315
         if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) {
316 316
             $whereClause = $criteria->renderWhere();
317 317
 
318 318
             if ('WHERE ()' !== $whereClause) {
319
-                $sql .= ' ' . $criteria->renderWhere();
319
+                $sql .= ' '.$criteria->renderWhere();
320 320
                 if (!empty($notNullFields)) {
321 321
                     $sql .= $this->NotNullFieldClause($notNullFields, true);
322 322
                 }
323 323
             } elseif (!empty($notNullFields)) {
324
-                $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
324
+                $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
325 325
             }
326 326
             if ('' != $criteria->getSort()) {
327
-                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
327
+                $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
328 328
             }
329 329
             $limit = $criteria->getLimit();
330 330
             $start = $criteria->getStart();
331 331
         } elseif (!empty($notNullFields)) {
332
-            $sql .= $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
332
+            $sql .= $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
333 333
         }
334 334
 
335 335
         //echo "<br>" . $sql . "<br>";
@@ -347,9 +347,9 @@  discard block
 block discarded – undo
347 347
             $faq->assignVars($myrow);
348 348
 
349 349
             if (!$id_as_key) {
350
-                $ret[] =& $faq;
350
+                $ret[] = & $faq;
351 351
             } else {
352
-                $ret[$myrow['faqid']] =& $faq;
352
+                $ret[$myrow['faqid']] = & $faq;
353 353
             }
354 354
             unset($faq);
355 355
         }
@@ -379,19 +379,19 @@  discard block
 block discarded – undo
379 379
      */
380 380
     public function getCount($criteria = null, $notNullFields = '')
381 381
     {
382
-        $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_faq');
382
+        $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('smartfaq_faq');
383 383
         if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) {
384 384
             $whereClause = $criteria->renderWhere();
385 385
             if ('WHERE ()' !== $whereClause) {
386
-                $sql .= ' ' . $criteria->renderWhere();
386
+                $sql .= ' '.$criteria->renderWhere();
387 387
                 if (!empty($notNullFields)) {
388 388
                     $sql .= $this->NotNullFieldClause($notNullFields, true);
389 389
                 }
390 390
             } elseif (!empty($notNullFields)) {
391
-                $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
391
+                $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
392 392
             }
393 393
         } elseif (!empty($notNullFields)) {
394
-            $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields);
394
+            $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields);
395 395
         }
396 396
 
397 397
         //echo "<br>" . $sql . "<br>";
@@ -425,11 +425,11 @@  discard block
 block discarded – undo
425 425
             $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission');
426 426
 
427 427
             $categoriesGranted = $smartPermHandler->getPermissions('category');
428
-            $grantedCategories = new \Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN');
428
+            $grantedCategories = new \Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN');
429 429
 
430 430
             $faqsGranted = $smartPermHandler->getPermissions('item');
431 431
             $grantedFaq  = new \CriteriaCompo();
432
-            $grantedFaq->add(new \Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR');
432
+            $grantedFaq->add(new \Criteria('faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR');
433 433
             // If user is anonymous, check if the FAQ allow partialview
434 434
             if (!is_object($xoopsUser)) {
435 435
                 $grantedFaq->add(new \Criteria('partialview', '1'), 'OR');
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
      */
477 477
     public function getFaqsCountByStatus()
478 478
     {
479
-        $sql    = 'SELECT status, COUNT(*) FROM ' . $this->db->prefix('smartfaq_faq') . ' GROUP BY status';
479
+        $sql    = 'SELECT status, COUNT(*) FROM '.$this->db->prefix('smartfaq_faq').' GROUP BY status';
480 480
         $result = $this->db->query($sql);
481 481
         if (!$result) {
482 482
             return [];
@@ -546,11 +546,11 @@  discard block
 block discarded – undo
546 546
             $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission');
547 547
 
548 548
             $categoriesGranted = $smartPermHandler->getPermissions('category');
549
-            $grantedCategories = new \Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN');
549
+            $grantedCategories = new \Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN');
550 550
 
551 551
             $faqsGranted = $smartPermHandler->getPermissions('item');
552 552
             $grantedFaq  = new \CriteriaCompo();
553
-            $grantedFaq->add(new \Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR');
553
+            $grantedFaq->add(new \Criteria('faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR');
554 554
             // If user is anonymous, check if the FAQ allow partialview
555 555
             if (!is_object($xoopsUser)) {
556 556
                 $grantedFaq->add(new \Criteria('partialview', '1'), 'OR');
@@ -559,9 +559,9 @@  discard block
 block discarded – undo
559 559
 
560 560
         if (isset($categoryid) && (-1 != $categoryid)) {
561 561
             if (is_array($categoryid)) {
562
-                $criteriaCategory = new \Criteria('categoryid', '(' . implode(',', $categoryid) . ')', 'IN');
562
+                $criteriaCategory = new \Criteria('categoryid', '('.implode(',', $categoryid).')', 'IN');
563 563
             } else {
564
-                $criteriaCategory = new \Criteria('categoryid', (int)$categoryid);
564
+                $criteriaCategory = new \Criteria('categoryid', (int) $categoryid);
565 565
             }
566 566
         }
567 567
 
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
         $criteria->setStart($start);
603 603
         $criteria->setSort($sort);
604 604
         $criteria->setOrder($order);
605
-        $ret =& $this->getObjects($criteria, false, $notNullFields);
605
+        $ret = & $this->getObjects($criteria, false, $notNullFields);
606 606
 
607 607
         return $ret;
608 608
     }
@@ -687,11 +687,11 @@  discard block
 block discarded – undo
687 687
 
688 688
         if ($totalFaqs > 0) {
689 689
             --$totalFaqs;
690
-            mt_srand((double)microtime() * 1000000);
690
+            mt_srand((double) microtime() * 1000000);
691 691
             $entrynumber = mt_rand(0, $totalFaqs);
692 692
             $faq         = $this->getFaqs(1, $entrynumber, $status, -1, 'datesub', 'DESC', $notNullFields);
693 693
             if ($faq) {
694
-                $ret =& $faq[0];
694
+                $ret = & $faq[0];
695 695
             }
696 696
         }
697 697
 
@@ -722,10 +722,10 @@  discard block
 block discarded – undo
722 722
                 $httphost    = $_SERVER['HTTP_HOST'];
723 723
                 $querystring = $_SERVER['QUERY_STRING'];
724 724
                 if ('' != $querystring) {
725
-                    $querystring = '?' . $querystring;
725
+                    $querystring = '?'.$querystring;
726 726
                 }
727
-                $currenturl     = $http . $httphost . $phpself . $querystring;
728
-                $fullcontexturl = XOOPS_URL . '/' . $iValue->contextpage();
727
+                $currenturl     = $http.$httphost.$phpself.$querystring;
728
+                $fullcontexturl = XOOPS_URL.'/'.$iValue->contextpage();
729 729
                 switch ($iValue->modulelink()) {
730 730
                     case '':
731 731
                         $display = false;
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
                         }
745 745
                         break;
746 746
                     default:
747
-                        if (false === strpos($currenturl, XOOPS_URL . '/modules/')) {
747
+                        if (false === strpos($currenturl, XOOPS_URL.'/modules/')) {
748 748
                             $display = false;
749 749
                         } else {
750 750
                             if (false === strpos($currenturl, $iValue->modulelink())) {
@@ -756,19 +756,19 @@  discard block
 block discarded – undo
756 756
                         break;
757 757
                 }
758 758
                 if ($display) {
759
-                    $randomFaqs[] =& $faqsObj[$i];
759
+                    $randomFaqs[] = & $faqsObj[$i];
760 760
                 }
761 761
             }
762 762
         }
763 763
 
764 764
         if (count($randomFaqs) > $limit) {
765
-            mt_srand((float)microtime() * 10000000);
765
+            mt_srand((float) microtime() * 10000000);
766 766
             $rand_keys = array_rand($randomFaqs, $limit);
767 767
             for ($j = 0, $jMax = count($rand_keys); $j < $jMax; ++$j) {
768
-                $ret[] =& $randomFaqs[$rand_keys[$j]];
768
+                $ret[] = & $randomFaqs[$rand_keys[$j]];
769 769
             }
770 770
         } else {
771
-            $ret =& $randomFaqs;
771
+            $ret = & $randomFaqs;
772 772
         }
773 773
 
774 774
         return $ret;
@@ -786,14 +786,14 @@  discard block
 block discarded – undo
786 786
             /** @var \XoopsModules\Smartfaq\PermissionHandler $smartPermHandler */
787 787
             $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission');
788 788
             $items            = $smartPermHandler->getPermissions('item');
789
-            $faqclause        = ' AND faqid IN (' . implode(',', $items) . ')';
789
+            $faqclause        = ' AND faqid IN ('.implode(',', $items).')';
790 790
         }
791 791
 
792 792
         $sql  = "CREATE TEMPORARY TABLE tmp (categoryid INT(8) UNSIGNED NOT NULL,datesub INT(11) DEFAULT '0' NOT NULL);";
793
-        $sql2 = ' LOCK TABLES ' . $this->db->prefix('smartfaq_faq') . ' READ;';
794
-        $sql3 = ' INSERT INTO tmp SELECT categoryid, MAX(datesub) FROM ' . $this->db->prefix('smartfaq_faq') . ' WHERE status IN (' . implode(',', $status) . ") $faqclause GROUP BY categoryid;";
795
-        $sql4 = ' SELECT ' . $this->db->prefix('smartfaq_faq') . '.categoryid, faqid, question, uid, ' . $this->db->prefix('smartfaq_faq') . '.datesub FROM ' . $this->db->prefix('smartfaq_faq') . ', tmp
796
-                              WHERE ' . $this->db->prefix('smartfaq_faq') . '.categoryid=tmp.categoryid AND ' . $this->db->prefix('smartfaq_faq') . '.datesub=tmp.datesub;';
793
+        $sql2 = ' LOCK TABLES '.$this->db->prefix('smartfaq_faq').' READ;';
794
+        $sql3 = ' INSERT INTO tmp SELECT categoryid, MAX(datesub) FROM '.$this->db->prefix('smartfaq_faq').' WHERE status IN ('.implode(',', $status).") $faqclause GROUP BY categoryid;";
795
+        $sql4 = ' SELECT '.$this->db->prefix('smartfaq_faq').'.categoryid, faqid, question, uid, '.$this->db->prefix('smartfaq_faq').'.datesub FROM '.$this->db->prefix('smartfaq_faq').', tmp
796
+                              WHERE ' . $this->db->prefix('smartfaq_faq').'.categoryid=tmp.categoryid AND '.$this->db->prefix('smartfaq_faq').'.datesub=tmp.datesub;';
797 797
         /*
798 798
         //Old implementation
799 799
         $sql = "SELECT categoryid, faqid, question, uid, MAX(datesub) AS datesub FROM ".$this->db->prefix("smartfaq_faq")."
@@ -808,14 +808,14 @@  discard block
 block discarded – undo
808 808
         $this->db->queryF('UNLOCK TABLES;');
809 809
         $this->db->queryF('DROP TABLE tmp;');
810 810
         if (!$result) {
811
-            trigger_error('Error in getLastPublishedByCat SQL: ' . $error);
811
+            trigger_error('Error in getLastPublishedByCat SQL: '.$error);
812 812
 
813 813
             return $ret;
814 814
         }
815 815
         while ($row = $this->db->fetchArray($result)) {
816 816
             $faq = new Smartfaq\Faq();
817 817
             $faq->assignVars($row);
818
-            $ret[$row['categoryid']] =& $faq;
818
+            $ret[$row['categoryid']] = & $faq;
819 819
             unset($faq);
820 820
         }
821 821
 
@@ -830,9 +830,9 @@  discard block
 block discarded – undo
830 830
      */
831 831
     public function deleteAll($criteria = null)
832 832
     {
833
-        $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_faq');
833
+        $sql = 'DELETE FROM '.$this->db->prefix('smartfaq_faq');
834 834
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
835
-            $sql .= ' ' . $criteria->renderWhere();
835
+            $sql .= ' '.$criteria->renderWhere();
836 836
         }
837 837
         if (!$this->db->query($sql)) {
838 838
             return false;
@@ -853,10 +853,10 @@  discard block
 block discarded – undo
853 853
      **/
854 854
     public function updateAll($fieldname, $fieldvalue, $criteria = null)
855 855
     {
856
-        $set_clause = is_numeric($fieldvalue) ? $fieldname . ' = ' . $fieldvalue : $fieldname . ' = ' . $this->db->quoteString($fieldvalue);
857
-        $sql        = 'UPDATE ' . $this->db->prefix('smartfaq_faq') . ' SET ' . $set_clause;
856
+        $set_clause = is_numeric($fieldvalue) ? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue);
857
+        $sql        = 'UPDATE '.$this->db->prefix('smartfaq_faq').' SET '.$set_clause;
858 858
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
859
-            $sql .= ' ' . $criteria->renderWhere();
859
+            $sql .= ' '.$criteria->renderWhere();
860 860
         }
861 861
         if (!$this->db->queryF($sql)) {
862 862
             return false;
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
      */
872 872
     public function updateCounter($faqid)
873 873
     {
874
-        $sql = 'UPDATE ' . $this->db->prefix('smartfaq_faq') . ' SET counter=counter+1 WHERE faqid = ' . $faqid;
874
+        $sql = 'UPDATE '.$this->db->prefix('smartfaq_faq').' SET counter=counter+1 WHERE faqid = '.$faqid;
875 875
         if ($this->db->queryF($sql)) {
876 876
             return true;
877 877
         } else {
@@ -927,8 +927,8 @@  discard block
 block discarded – undo
927 927
             $criteriaKeywords = new \CriteriaCompo();
928 928
             foreach ($queryarray as $iValue) {
929 929
                 $criteriaKeyword = new \CriteriaCompo();
930
-                $criteriaKeyword->add(new \Criteria('faq.question', '%' . $iValue . '%', 'LIKE'), 'OR');
931
-                $criteriaKeyword->add(new \Criteria('answer.answer', '%' . $iValue . '%', 'LIKE'), 'OR');
930
+                $criteriaKeyword->add(new \Criteria('faq.question', '%'.$iValue.'%', 'LIKE'), 'OR');
931
+                $criteriaKeyword->add(new \Criteria('answer.answer', '%'.$iValue.'%', 'LIKE'), 'OR');
932 932
                 $criteriaKeywords->add($criteriaKeyword, $andor);
933 933
                 unset($criteriaKeyword);
934 934
             }
@@ -947,9 +947,9 @@  discard block
 block discarded – undo
947 947
             if (!$faqsGranted) {
948 948
                 return $ret;
949 949
             }
950
-            $grantedCategories = new \Criteria('faq.categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN');
950
+            $grantedCategories = new \Criteria('faq.categoryid', '('.implode(',', $categoriesGranted).')', 'IN');
951 951
             $grantedFaq        = new \CriteriaCompo();
952
-            $grantedFaq->add(new \Criteria('faq.faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR');
952
+            $grantedFaq->add(new \Criteria('faq.faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR');
953 953
             // If user is anonymous, check if the FAQ allow partialview
954 954
             if (!is_object($xoopsUser)) {
955 955
                 $grantedFaq->add(new \Criteria('partialview', '1'), 'OR');
@@ -995,15 +995,15 @@  discard block
 block discarded – undo
995 995
         $criteria->setSort('faq.datesub');
996 996
         $criteria->setOrder('DESC');
997 997
 
998
-        $sql = 'SELECT faq.faqid, faq.question, faq.datesub, faq.uid FROM ' . $this->db->prefix('smartfaq_faq') . ' AS faq INNER JOIN ' . $this->db->prefix('smartfaq_answers') . ' AS answer ON faq.faqid = answer.faqid';
998
+        $sql = 'SELECT faq.faqid, faq.question, faq.datesub, faq.uid FROM '.$this->db->prefix('smartfaq_faq').' AS faq INNER JOIN '.$this->db->prefix('smartfaq_answers').' AS answer ON faq.faqid = answer.faqid';
999 999
 
1000 1000
         if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
1001 1001
             $whereClause = $criteria->renderWhere();
1002 1002
 
1003 1003
             if ('WHERE ()' !== $whereClause) {
1004
-                $sql .= ' ' . $criteria->renderWhere();
1004
+                $sql .= ' '.$criteria->renderWhere();
1005 1005
                 if ('' != $criteria->getSort()) {
1006
-                    $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
1006
+                    $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder();
1007 1007
                 }
1008 1008
                 $limit = $criteria->getLimit();
1009 1009
                 $start = $criteria->getStart();
@@ -1026,7 +1026,7 @@  discard block
 block discarded – undo
1026 1026
         while (false !== ($myrow = $this->db->fetchArray($result))) {
1027 1027
             $faq = new Smartfaq\Faq();
1028 1028
             $faq->assignVars($myrow);
1029
-            $ret[] =& $faq;
1029
+            $ret[] = & $faq;
1030 1030
             unset($faq);
1031 1031
         }
1032 1032
 
@@ -1042,20 +1042,20 @@  discard block
 block discarded – undo
1042 1042
     {
1043 1043
         global $xoopsUser;
1044 1044
         $ret = [];
1045
-        $sql = 'SELECT categoryid, COUNT(*) AS count FROM ' . $this->db->prefix('smartfaq_faq');
1046
-        if ((int)$cat_id > 0) {
1047
-            $sql .= ' WHERE categoryid = ' . (int)$cat_id;
1048
-            $sql .= ' AND status IN (' . implode(',', $status) . ')';
1045
+        $sql = 'SELECT categoryid, COUNT(*) AS count FROM '.$this->db->prefix('smartfaq_faq');
1046
+        if ((int) $cat_id > 0) {
1047
+            $sql .= ' WHERE categoryid = '.(int) $cat_id;
1048
+            $sql .= ' AND status IN ('.implode(',', $status).')';
1049 1049
         } else {
1050
-            $sql .= ' WHERE status IN (' . implode(',', $status) . ')';
1050
+            $sql .= ' WHERE status IN ('.implode(',', $status).')';
1051 1051
             if (!Smartfaq\Utility::userIsAdmin()) {
1052 1052
                 /** @var \XoopsModules\Smartfaq\PermissionHandler $smartPermHandler */
1053 1053
                 $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission');
1054 1054
                 $items            = $smartPermHandler->getPermissions('item');
1055 1055
                 if (is_object($xoopsUser)) {
1056
-                    $sql .= ' AND faqid IN (' . implode(',', $items) . ')';
1056
+                    $sql .= ' AND faqid IN ('.implode(',', $items).')';
1057 1057
                 } else {
1058
-                    $sql .= ' AND (faqid IN (' . implode(',', $items) . ') OR partialview = 1)';
1058
+                    $sql .= ' AND (faqid IN ('.implode(',', $items).') OR partialview = 1)';
1059 1059
                 }
1060 1060
             }
1061 1061
         }
@@ -1068,7 +1068,7 @@  discard block
 block discarded – undo
1068 1068
             return $ret;
1069 1069
         }
1070 1070
         while ($row = $this->db->fetchArray($result)) {
1071
-            $ret[$row['categoryid']] = (int)$row['count'];
1071
+            $ret[$row['categoryid']] = (int) $row['count'];
1072 1072
         }
1073 1073
 
1074 1074
         return $ret;
Please login to merge, or discard this patch.
class/GroupFormCheckBox.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
     /**
71 71
      * Constructor
72 72
      * @param      $caption
73
-     * @param      $name
73
+     * @param      string $name
74 74
      * @param      $groupId
75 75
      * @param null $values
76 76
      */
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
 
28 28
 // defined('XOOPS_ROOT_PATH') || die('Restricted access');
29 29
 
30
-require_once XOOPS_ROOT_PATH . '/class/xoopsform/formelement.php';
31
-require_once XOOPS_ROOT_PATH . '/class/xoopsform/formhidden.php';
32
-require_once XOOPS_ROOT_PATH . '/class/xoopsform/formhiddentoken.php';
33
-require_once XOOPS_ROOT_PATH . '/class/xoopsform/formbutton.php';
34
-require_once XOOPS_ROOT_PATH . '/class/xoopsform/formelementtray.php';
35
-require_once XOOPS_ROOT_PATH . '/class/xoopsform/form.php';
30
+require_once XOOPS_ROOT_PATH.'/class/xoopsform/formelement.php';
31
+require_once XOOPS_ROOT_PATH.'/class/xoopsform/formhidden.php';
32
+require_once XOOPS_ROOT_PATH.'/class/xoopsform/formhiddentoken.php';
33
+require_once XOOPS_ROOT_PATH.'/class/xoopsform/formbutton.php';
34
+require_once XOOPS_ROOT_PATH.'/class/xoopsform/formelementtray.php';
35
+require_once XOOPS_ROOT_PATH.'/class/xoopsform/form.php';
36 36
 
37 37
 /**
38 38
  * Renders checkbox options for a group permission form
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public function setOptionTree(&$optionTree)
111 111
     {
112
-        $this->_optionTree =& $optionTree;
112
+        $this->_optionTree = & $optionTree;
113 113
     }
114 114
 
115 115
     /**
@@ -134,34 +134,34 @@  discard block
 block discarded – undo
134 134
         $ret = '';
135 135
 
136 136
         if (count($this->_appendix) > 0) {
137
-            $ret  .= '<table class="outer"><tr>';
137
+            $ret .= '<table class="outer"><tr>';
138 138
             $cols = 1;
139 139
             foreach ($this->_appendix as $append) {
140 140
                 if ($cols > 4) {
141
-                    $ret  .= '</tr><tr>';
141
+                    $ret .= '</tr><tr>';
142 142
                     $cols = 1;
143 143
                 }
144 144
                 $checked = $append['selected'] ? 'checked' : '';
145
-                $name    = 'perms[' . $append['permname'] . ']';
145
+                $name    = 'perms['.$append['permname'].']';
146 146
                 $itemid  = $append['itemid'];
147 147
                 $itemid  = $append['itemid'];
148
-                $ret     .= "<td class=\"odd\"><input type=\"checkbox\" name=\"{$name}[groups][$this->_groupId][$itemid]\" id=\"{$name}[groups][$this->_groupId][$itemid]\" value=\"1\" $checked>{$append['itemname']}<input type=\"hidden\" name=\"{$name}[parents][$itemid]\" value=\"\"><input type=\"hidden\" name=\"{$name}[itemname][$itemid]\" value=\"{$append['itemname']}\"><br></td>";
148
+                $ret .= "<td class=\"odd\"><input type=\"checkbox\" name=\"{$name}[groups][$this->_groupId][$itemid]\" id=\"{$name}[groups][$this->_groupId][$itemid]\" value=\"1\" $checked>{$append['itemname']}<input type=\"hidden\" name=\"{$name}[parents][$itemid]\" value=\"\"><input type=\"hidden\" name=\"{$name}[itemname][$itemid]\" value=\"{$append['itemname']}\"><br></td>";
149 149
                 ++$cols;
150 150
             }
151 151
             $ret .= '</tr></table>';
152 152
         }
153 153
 
154
-        $ret  .= '<table class="outer"><tr>';
154
+        $ret .= '<table class="outer"><tr>';
155 155
         $cols = 1;
156 156
         foreach ($this->_optionTree[0]['children'] as $topitem) {
157 157
             if ($cols > 4) {
158
-                $ret  .= '</tr><tr>';
158
+                $ret .= '</tr><tr>';
159 159
                 $cols = 1;
160 160
             }
161 161
             $tree   = '<td class="odd">';
162 162
             $prefix = '';
163 163
             $this->renderOptionTree($tree, $this->_optionTree[$topitem], $prefix);
164
-            $ret .= $tree . '</td>';
164
+            $ret .= $tree.'</td>';
165 165
             ++$cols;
166 166
         }
167 167
         $ret .= '</tr></table>';
@@ -180,21 +180,21 @@  discard block
 block discarded – undo
180 180
      */
181 181
     private function renderOptionTree(&$tree, $option, $prefix, $parentIds = [])
182 182
     {
183
-        $tree .= $prefix . '<input type="checkbox" name="' . $this->getName() . '[groups][' . $this->_groupId . '][' . $option['id'] . ']" id="' . $this->getName() . '[groups][' . $this->_groupId . '][' . $option['id'] . ']" onclick="';
183
+        $tree .= $prefix.'<input type="checkbox" name="'.$this->getName().'[groups]['.$this->_groupId.']['.$option['id'].']" id="'.$this->getName().'[groups]['.$this->_groupId.']['.$option['id'].']" onclick="';
184 184
         // If there are parent elements, add javascript that will
185 185
         // make them selecteded when this element is checked to make
186 186
         // sure permissions to parent items are added as well.
187 187
         foreach ($parentIds as $pid) {
188
-            $parent_ele = $this->getName() . '[groups][' . $this->_groupId . '][' . $pid . ']';
189
-            $tree       .= "var ele = xoopsGetElementById('" . $parent_ele . "'); if (ele.checked !== true) {ele.checked = this.checked;}";
188
+            $parent_ele = $this->getName().'[groups]['.$this->_groupId.']['.$pid.']';
189
+            $tree .= "var ele = xoopsGetElementById('".$parent_ele."'); if (ele.checked !== true) {ele.checked = this.checked;}";
190 190
         }
191 191
         // If there are child elements, add javascript that will
192 192
         // make them unchecked when this element is unchecked to make
193 193
         // sure permissions to child items are not added when there
194 194
         // is no permission to this item.
195 195
         foreach ($option['allchild'] as $cid) {
196
-            $child_ele = $this->getName() . '[groups][' . $this->_groupId . '][' . $cid . ']';
197
-            $tree      .= "var ele = xoopsGetElementById('" . $child_ele . "'); if (this.checked !== true) {ele.checked = false;}";
196
+            $child_ele = $this->getName().'[groups]['.$this->_groupId.']['.$cid.']';
197
+            $tree .= "var ele = xoopsGetElementById('".$child_ele."'); if (this.checked !== true) {ele.checked = false;}";
198 198
         }
199 199
         $tree .= '" value="1"';
200 200
         if (null !== $this->_value && in_array($option['id'], $this->_value)) {
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
         if (isset($option['children'])) {
219 219
             foreach ($option['children'] as $child) {
220 220
                 array_push($parentIds, $option['id']);
221
-                $this->renderOptionTree($tree, $this->_optionTree[$child], $prefix . '&nbsp;-', $parentIds);
221
+                $this->renderOptionTree($tree, $this->_optionTree[$child], $prefix.'&nbsp;-', $parentIds);
222 222
             }
223 223
         }
224 224
     }
Please login to merge, or discard this patch.
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -379,20 +379,20 @@
 block discarded – undo
379 379
             $tree .= ' checked';
380 380
         }
381 381
         $tree .= '>'
382
-                 . $option['name']
383
-                 . '<input type="hidden" name="'
384
-                 . $this->getName()
385
-                 . '[parents]['
386
-                 . $option['id']
387
-                 . ']" value="'
388
-                 . implode(':', $parentIds)
389
-                 . '"><input type="hidden" name="'
390
-                 . $this->getName()
391
-                 . '[itemname]['
392
-                 . $option['id']
393
-                 . ']" value="'
394
-                 . htmlspecialchars($option['name'], ENT_QUOTES)
395
-                 . "\"><br>\n";
382
+                    . $option['name']
383
+                    . '<input type="hidden" name="'
384
+                    . $this->getName()
385
+                    . '[parents]['
386
+                    . $option['id']
387
+                    . ']" value="'
388
+                    . implode(':', $parentIds)
389
+                    . '"><input type="hidden" name="'
390
+                    . $this->getName()
391
+                    . '[itemname]['
392
+                    . $option['id']
393
+                    . ']" value="'
394
+                    . htmlspecialchars($option['name'], ENT_QUOTES)
395
+                    . "\"><br>\n";
396 396
         if (isset($option['children'])) {
397 397
             foreach ($option['children'] as $child) {
398 398
                 array_push($parentIds, $option['id']);
Please login to merge, or discard this patch.
class/SmartDbTable.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -178,7 +178,7 @@
 block discarded – undo
178 178
     }
179 179
 
180 180
     /**
181
-     * @param $field
181
+     * @param string $field
182 182
      * @return bool
183 183
      */
184 184
     public function fieldExists($field)
Please login to merge, or discard this 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/Uploader.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
      * Constructor
26 26
      *
27 27
      * @param string    $uploadDir
28
-     * @param array|int $allowedMimeTypes
28
+     * @param integer $allowedMimeTypes
29 29
      * @param int       $maxFileSize
30 30
      * @param int       $maxWidth
31 31
      * @param int       $maxHeight
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 
13 13
 // defined('XOOPS_ROOT_PATH') || die('Restricted access');
14 14
 
15
-require_once XOOPS_ROOT_PATH . '/class/uploader.php';
15
+require_once XOOPS_ROOT_PATH.'/class/uploader.php';
16 16
 
17 17
 /**
18 18
  * Class Uploader
Please login to merge, or discard this patch.