@@ -100,7 +100,7 @@ discard block |
||
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 |
||
132 | 132 | |
133 | 133 | foreach ($attach_old as $key => $attach) { |
134 | 134 | if (in_array($key, $attach_array)) { |
135 | - @unlink(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attach['name_saved']); |
|
136 | - @unlink(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/thumbs/' . $attach['name_saved']); // delete thumbnails |
|
135 | + @unlink(XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/'.$attach['name_saved']); |
|
136 | + @unlink(XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/thumbs/'.$attach['name_saved']); // delete thumbnails |
|
137 | 137 | continue; |
138 | 138 | } |
139 | 139 | $this->attachment_array[$key] = $attach; |
@@ -190,24 +190,24 @@ discard block |
||
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> ' . $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> '.$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 |
||
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' ... |
@@ -187,7 +187,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
629 | 629 | $text = _MD_SF_FAQCOMEFROM; |
630 | 630 | } |
631 | 631 | |
632 | - return $text . $xoopsConfig['sitename'] . ' : <a href=' . XOOPS_URL . '/modules/smartfaq/faq.php?faqid=' . $this->faqid() . '>' . XOOPS_URL . '/modules/smartfaq/faq.php?faqid=' . $this->faqid() . '</a>'; |
|
632 | + return $text.$xoopsConfig['sitename'].' : <a href='.XOOPS_URL.'/modules/smartfaq/faq.php?faqid='.$this->faqid().'>'.XOOPS_URL.'/modules/smartfaq/faq.php?faqid='.$this->faqid().'</a>'; |
|
633 | 633 | } |
634 | 634 | |
635 | 635 | /** |
@@ -648,9 +648,9 @@ discard block |
||
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 |
||
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; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | public function get($id) |
49 | 49 | { |
50 | 50 | if ((int)$id > 0) { |
51 | - $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_faq') . ' WHERE faqid=' . $id; |
|
51 | + $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_faq').' WHERE faqid='.$id; |
|
52 | 52 | if (!$result = $this->db->query($sql)) { |
53 | 53 | return false; |
54 | 54 | } |
@@ -164,7 +164,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
546 | 546 | $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission'); |
547 | 547 | |
548 | 548 | $categoriesGranted = $smartPermHandler->getPermissions('category'); |
549 | - $grantedCategories = new \Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'); |
|
549 | + $grantedCategories = new \Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN'); |
|
550 | 550 | |
551 | 551 | $faqsGranted = $smartPermHandler->getPermissions('item'); |
552 | 552 | $grantedFaq = new \CriteriaCompo(); |
553 | - $grantedFaq->add(new \Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR'); |
|
553 | + $grantedFaq->add(new \Criteria('faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR'); |
|
554 | 554 | // If user is anonymous, check if the FAQ allow partialview |
555 | 555 | if (!is_object($xoopsUser)) { |
556 | 556 | $grantedFaq->add(new \Criteria('partialview', '1'), 'OR'); |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | |
560 | 560 | if (isset($categoryid) && (-1 != $categoryid)) { |
561 | 561 | if (is_array($categoryid)) { |
562 | - $criteriaCategory = new \Criteria('categoryid', '(' . implode(',', $categoryid) . ')', 'IN'); |
|
562 | + $criteriaCategory = new \Criteria('categoryid', '('.implode(',', $categoryid).')', 'IN'); |
|
563 | 563 | } else { |
564 | 564 | $criteriaCategory = new \Criteria('categoryid', (int)$categoryid); |
565 | 565 | } |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | $criteria->setStart($start); |
603 | 603 | $criteria->setSort($sort); |
604 | 604 | $criteria->setOrder($order); |
605 | - $ret =& $this->getObjects($criteria, false, $notNullFields); |
|
605 | + $ret = & $this->getObjects($criteria, false, $notNullFields); |
|
606 | 606 | |
607 | 607 | return $ret; |
608 | 608 | } |
@@ -691,7 +691,7 @@ discard block |
||
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 |
||
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 |
||
744 | 744 | } |
745 | 745 | break; |
746 | 746 | default: |
747 | - if (false === strpos($currenturl, XOOPS_URL . '/modules/')) { |
|
747 | + if (false === strpos($currenturl, XOOPS_URL.'/modules/')) { |
|
748 | 748 | $display = false; |
749 | 749 | } else { |
750 | 750 | if (false === strpos($currenturl, $iValue->modulelink())) { |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | break; |
757 | 757 | } |
758 | 758 | if ($display) { |
759 | - $randomFaqs[] =& $faqsObj[$i]; |
|
759 | + $randomFaqs[] = & $faqsObj[$i]; |
|
760 | 760 | } |
761 | 761 | } |
762 | 762 | } |
@@ -765,10 +765,10 @@ discard block |
||
765 | 765 | mt_srand((float)microtime() * 10000000); |
766 | 766 | $rand_keys = array_rand($randomFaqs, $limit); |
767 | 767 | for ($j = 0, $jMax = count($rand_keys); $j < $jMax; ++$j) { |
768 | - $ret[] =& $randomFaqs[$rand_keys[$j]]; |
|
768 | + $ret[] = & $randomFaqs[$rand_keys[$j]]; |
|
769 | 769 | } |
770 | 770 | } else { |
771 | - $ret =& $randomFaqs; |
|
771 | + $ret = & $randomFaqs; |
|
772 | 772 | } |
773 | 773 | |
774 | 774 | return $ret; |
@@ -786,14 +786,14 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
1042 | 1042 | { |
1043 | 1043 | global $xoopsUser; |
1044 | 1044 | $ret = []; |
1045 | - $sql = 'SELECT categoryid, COUNT(*) AS count FROM ' . $this->db->prefix('smartfaq_faq'); |
|
1045 | + $sql = 'SELECT categoryid, COUNT(*) AS count FROM '.$this->db->prefix('smartfaq_faq'); |
|
1046 | 1046 | if ((int)$cat_id > 0) { |
1047 | - $sql .= ' WHERE categoryid = ' . (int)$cat_id; |
|
1048 | - $sql .= ' AND status IN (' . implode(',', $status) . ')'; |
|
1047 | + $sql .= ' WHERE categoryid = '.(int)$cat_id; |
|
1048 | + $sql .= ' AND status IN ('.implode(',', $status).')'; |
|
1049 | 1049 | } else { |
1050 | - $sql .= ' WHERE status IN (' . implode(',', $status) . ')'; |
|
1050 | + $sql .= ' WHERE status IN ('.implode(',', $status).')'; |
|
1051 | 1051 | if (!Smartfaq\Utility::userIsAdmin()) { |
1052 | 1052 | /** @var \XoopsModules\Smartfaq\PermissionHandler $smartPermHandler */ |
1053 | 1053 | $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission'); |
1054 | 1054 | $items = $smartPermHandler->getPermissions('item'); |
1055 | 1055 | if (is_object($xoopsUser)) { |
1056 | - $sql .= ' AND faqid IN (' . implode(',', $items) . ')'; |
|
1056 | + $sql .= ' AND faqid IN ('.implode(',', $items).')'; |
|
1057 | 1057 | } else { |
1058 | - $sql .= ' AND (faqid IN (' . implode(',', $items) . ') OR partialview = 1)'; |
|
1058 | + $sql .= ' AND (faqid IN ('.implode(',', $items).') OR partialview = 1)'; |
|
1059 | 1059 | } |
1060 | 1060 | } |
1061 | 1061 | } |
@@ -93,7 +93,7 @@ |
||
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), |
@@ -47,7 +47,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -92,7 +92,7 @@ discard block |
||
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 |
||
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, |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | |
28 | 28 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
29 | 29 | |
30 | -require_once XOOPS_ROOT_PATH . '/class/xoopsform/formelement.php'; |
|
31 | -require_once XOOPS_ROOT_PATH . '/class/xoopsform/formhidden.php'; |
|
32 | -require_once XOOPS_ROOT_PATH . '/class/xoopsform/formhiddentoken.php'; |
|
33 | -require_once XOOPS_ROOT_PATH . '/class/xoopsform/formbutton.php'; |
|
34 | -require_once XOOPS_ROOT_PATH . '/class/xoopsform/formelementtray.php'; |
|
35 | -require_once XOOPS_ROOT_PATH . '/class/xoopsform/form.php'; |
|
30 | +require_once XOOPS_ROOT_PATH.'/class/xoopsform/formelement.php'; |
|
31 | +require_once XOOPS_ROOT_PATH.'/class/xoopsform/formhidden.php'; |
|
32 | +require_once XOOPS_ROOT_PATH.'/class/xoopsform/formhiddentoken.php'; |
|
33 | +require_once XOOPS_ROOT_PATH.'/class/xoopsform/formbutton.php'; |
|
34 | +require_once XOOPS_ROOT_PATH.'/class/xoopsform/formelementtray.php'; |
|
35 | +require_once XOOPS_ROOT_PATH.'/class/xoopsform/form.php'; |
|
36 | 36 | |
37 | 37 | /** |
38 | 38 | * Renders a form for setting module specific group permissions |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | } |
163 | 163 | $gpermHandler = xoops_getHandler('groupperm'); |
164 | 164 | $memberHandler = xoops_getHandler('member'); |
165 | - $glist =& $memberHandler->getGroupList(); |
|
165 | + $glist = & $memberHandler->getGroupList(); |
|
166 | 166 | foreach (array_keys($glist) as $i) { |
167 | 167 | // get selected item id(s) for each group |
168 | 168 | $selected = $gpermHandler->getItemIds($this->_permName, $i, $this->_modid); |
169 | - $ele = new Smartfaq\GroupFormCheckBox($glist[$i], 'perms[' . $this->_permName . ']', $i, $selected); |
|
169 | + $ele = new Smartfaq\GroupFormCheckBox($glist[$i], 'perms['.$this->_permName.']', $i, $selected); |
|
170 | 170 | $ele->setOptionTree($this->_itemTree); |
171 | 171 | |
172 | 172 | foreach ($this->_appendix as $key => $append) { |
@@ -193,18 +193,18 @@ discard block |
||
193 | 193 | $tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
194 | 194 | $this->addElement($tray); |
195 | 195 | |
196 | - $ret = '<h4>' . $this->getTitle() . '</h4>' . $this->_permDesc . '<br>'; |
|
197 | - $ret .= "<form name='" . $this->getName() . "' id='" . $this->getName() . "' action='" . $this->getAction() . "' method='" . $this->getMethod() . "'" . $this->getExtra() . ">\n<table width='100%' class='outer' cellspacing='1'>\n"; |
|
198 | - $elements =& $this->getElements(); |
|
196 | + $ret = '<h4>'.$this->getTitle().'</h4>'.$this->_permDesc.'<br>'; |
|
197 | + $ret .= "<form name='".$this->getName()."' id='".$this->getName()."' action='".$this->getAction()."' method='".$this->getMethod()."'".$this->getExtra().">\n<table width='100%' class='outer' cellspacing='1'>\n"; |
|
198 | + $elements = & $this->getElements(); |
|
199 | 199 | foreach (array_keys($elements) as $i) { |
200 | 200 | if (!is_object($elements[$i])) { |
201 | 201 | $ret .= $elements[$i]; |
202 | 202 | } elseif (!$elements[$i]->isHidden()) { |
203 | - $ret .= "<tr valign='top' align='left'><td class='head'>" . $elements[$i]->getCaption(); |
|
203 | + $ret .= "<tr valign='top' align='left'><td class='head'>".$elements[$i]->getCaption(); |
|
204 | 204 | if ('' != $elements[$i]->getDescription()) { |
205 | - $ret .= '<br><br><span style="font-weight: normal;">' . $elements[$i]->getDescription() . '</span>'; |
|
205 | + $ret .= '<br><br><span style="font-weight: normal;">'.$elements[$i]->getDescription().'</span>'; |
|
206 | 206 | } |
207 | - $ret .= "</td>\n<td class='even'>\n" . $elements[$i]->render() . "\n</td></tr>\n"; |
|
207 | + $ret .= "</td>\n<td class='even'>\n".$elements[$i]->render()."\n</td></tr>\n"; |
|
208 | 208 | } else { |
209 | 209 | $ret .= $elements[$i]->render(); |
210 | 210 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | public function get($id = null, $fields = null) |
50 | 50 | { |
51 | 51 | if ((int)$id > 0) { |
52 | - $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_answers') . ' WHERE answerid=' . $id; |
|
52 | + $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_answers').' WHERE answerid='.$id; |
|
53 | 53 | if (!$result = $this->db->query($sql)) { |
54 | 54 | return false; |
55 | 55 | } |
@@ -177,11 +177,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -8,7 +8,7 @@ discard block |
||
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 |
||
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 |
@@ -28,24 +28,24 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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); |
@@ -21,7 +21,7 @@ |
||
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"); |