@@ -29,7 +29,7 @@ |
||
29 | 29 | $startfaq = isset($_GET['startfaq']) ? (int)$_GET['startfaq'] : 0; |
30 | 30 | |
31 | 31 | /** |
32 | - * @param bool $showmenu |
|
32 | + * @param string $showmenu |
|
33 | 33 | * @param int $faqid |
34 | 34 | * @param int $answerid |
35 | 35 | * @param bool $merge |
@@ -549,11 +549,11 @@ |
||
549 | 549 | $faqid = isset($_GET['faqid']) ? (int)$_GET['faqid'] : 0; |
550 | 550 | xoops_cp_header(); |
551 | 551 | xoops_confirm(array( |
552 | - 'op' => 'del', |
|
553 | - 'faqid' => $faqObj->faqid(), |
|
554 | - 'confirm' => 1, |
|
555 | - 'name' => $faqObj->question() |
|
556 | - ), 'faq.php', _AM_SF_DELETETHISARTICLE . " <br>'" . $faqObj->question() . "'. <br> <br>", _AM_SF_DELETE); |
|
552 | + 'op' => 'del', |
|
553 | + 'faqid' => $faqObj->faqid(), |
|
554 | + 'confirm' => 1, |
|
555 | + 'name' => $faqObj->question() |
|
556 | + ), 'faq.php', _AM_SF_DELETETHISARTICLE . " <br>'" . $faqObj->question() . "'. <br> <br>", _AM_SF_DELETE); |
|
557 | 557 | xoops_cp_footer(); |
558 | 558 | } |
559 | 559 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * Licence: GNU |
7 | 7 | */ |
8 | 8 | |
9 | -require_once __DIR__ . '/admin_header.php'; |
|
9 | +require_once __DIR__.'/admin_header.php'; |
|
10 | 10 | |
11 | 11 | // Creating the faq handler object |
12 | 12 | $faqHandler = sf_gethandler('faq'); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | } |
27 | 27 | |
28 | 28 | // Where shall we start? |
29 | -$startfaq = isset($_GET['startfaq']) ? (int)$_GET['startfaq'] : 0; |
|
29 | +$startfaq = isset($_GET['startfaq']) ? (int) $_GET['startfaq'] : 0; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * @param bool $showmenu |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | { |
39 | 39 | global $answerHandler, $faqHandler, $categoryHandler, $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $modify, $xoopsModuleConfig, $xoopsModule, $XOOPS_URL, $myts; |
40 | 40 | |
41 | - require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
41 | + require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
42 | 42 | // If there is a parameter, and the id exists, retrieve data: we're editing a faq |
43 | 43 | if ($faqid != -1) { |
44 | 44 | // Creating the FAQ object |
@@ -140,9 +140,9 @@ discard block |
||
140 | 140 | |
141 | 141 | echo "<br>\n"; |
142 | 142 | sf_collapsableBar('bottomtable', 'bottomtableicon'); |
143 | - echo "<img id='bottomtableicon' src=" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt=''></a> " . $collapsableBar_title . '</h3>'; |
|
143 | + echo "<img id='bottomtableicon' src=".XOOPS_URL.'/modules/'.$xoopsModule->dirname()."/assets/images/icon/close12.gif alt=''></a> ".$collapsableBar_title.'</h3>'; |
|
144 | 144 | echo "<div id='bottomtable'>"; |
145 | - echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . $collapsableBar_info . '</span>'; |
|
145 | + echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">'.$collapsableBar_info.'</span>'; |
|
146 | 146 | } else { |
147 | 147 | // there's no parameter, so we're adding a faq |
148 | 148 | $faqObj = $faqHandler->create(); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $button_caption = _AM_SF_CREATE; |
157 | 157 | |
158 | 158 | sf_collapsableBar('bottomtable', 'bottomtableicon'); |
159 | - echo "<img id='bottomtableicon' src=" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt=''></a> " . _AM_SF_CREATESMARTFAQ . '</h3>'; |
|
159 | + echo "<img id='bottomtableicon' src=".XOOPS_URL.'/modules/'.$xoopsModule->dirname()."/assets/images/icon/close12.gif alt=''></a> "._AM_SF_CREATESMARTFAQ.'</h3>'; |
|
160 | 160 | echo "<div id='bottomtable'>"; |
161 | 161 | } |
162 | 162 | $sform = new XoopsThemeForm(_AM_SF_SMARTFAQ, 'op', xoops_getenv('PHP_SELF'), 'post', true); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | |
188 | 188 | // ANSWER |
189 | 189 | if ($merge) { |
190 | - $theanswer = $originalAnswerObj->answer('e') . "\n\n" . sprintf(_AM_SF_NEW_CONTRIBUTION, sf_getLinkedUnameFromId($answerObj->uid(), $xoopsModuleConfig['userealname']), $answerObj->datesub(), $answerObj->answer('e')); |
|
190 | + $theanswer = $originalAnswerObj->answer('e')."\n\n".sprintf(_AM_SF_NEW_CONTRIBUTION, sf_getLinkedUnameFromId($answerObj->uid(), $xoopsModuleConfig['userealname']), $answerObj->datesub(), $answerObj->answer('e')); |
|
191 | 191 | } else { |
192 | 192 | $theanswer = $answerObj->answer('e'); |
193 | 193 | } |
@@ -236,14 +236,14 @@ discard block |
||
236 | 236 | $sform->addElement(new XoopsFormText(_AM_SF_SPECIFIC_URL, 'contextpage', 50, 60, $faqObj->contextpage()), false); |
237 | 237 | |
238 | 238 | // EXACT URL? |
239 | - $excaturl_radio = new XoopsFormRadioYN(_AM_SF_EXACTURL, 'exacturl', $faqObj->exacturl(), ' ' . _AM_SF_YES . '', ' ' . _AM_SF_NO . ''); |
|
239 | + $excaturl_radio = new XoopsFormRadioYN(_AM_SF_EXACTURL, 'exacturl', $faqObj->exacturl(), ' '._AM_SF_YES.'', ' '._AM_SF_NO.''); |
|
240 | 240 | $sform->addElement($excaturl_radio); |
241 | 241 | // WEIGHT |
242 | 242 | $sform->addElement(new XoopsFormText(_AM_SF_WEIGHT, 'weight', 5, 5, $faqObj->weight()), true); |
243 | 243 | |
244 | 244 | // COMMENTS |
245 | 245 | // Code to allow comments |
246 | - $addcomments_radio = new XoopsFormRadioYN(_AM_SF_ALLOWCOMMENTS, 'cancomment', $faqObj->cancomment(), ' ' . _AM_SF_YES . '', ' ' . _AM_SF_NO . ''); |
|
246 | + $addcomments_radio = new XoopsFormRadioYN(_AM_SF_ALLOWCOMMENTS, 'cancomment', $faqObj->cancomment(), ' '._AM_SF_YES.'', ' '._AM_SF_NO.''); |
|
247 | 247 | $sform->addElement($addcomments_radio); |
248 | 248 | |
249 | 249 | // PER ITEM PERMISSIONS |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | } |
258 | 258 | $sform->addElement($groups_checkbox); |
259 | 259 | |
260 | - $partial_view = new XoopsFormRadioYN(_AM_SF_PARTIALVIEW, 'partialview', $faqObj->partialview(), ' ' . _AM_SF_YES . '', ' ' . _AM_SF_NO . ''); |
|
260 | + $partial_view = new XoopsFormRadioYN(_AM_SF_PARTIALVIEW, 'partialview', $faqObj->partialview(), ' '._AM_SF_YES.'', ' '._AM_SF_NO.''); |
|
261 | 261 | $sform->addElement($partial_view); |
262 | 262 | |
263 | 263 | // VARIOUS OPTIONS |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | // OFFLINE |
281 | 281 | if ($faqObj->status() == _SF_STATUS_OFFLINE) { |
282 | 282 | // Back OnLine |
283 | - $offline_radio = new XoopsFormRadioYN(_AM_SF_OFFLINE_FIELD, 'offline', 1, ' ' . _AM_SF_YES . '', ' ' . _AM_SF_NO . ''); |
|
283 | + $offline_radio = new XoopsFormRadioYN(_AM_SF_OFFLINE_FIELD, 'offline', 1, ' '._AM_SF_YES.'', ' '._AM_SF_NO.''); |
|
284 | 284 | $sform->addElement($offline_radio); |
285 | 285 | } |
286 | 286 | |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | } |
355 | 355 | |
356 | 356 | xoops_cp_header(); |
357 | - require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
357 | + require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
358 | 358 | |
359 | 359 | editfaq(true, $faqid, $answerid, true); |
360 | 360 | break; |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | xoops_cp_header(); |
376 | 376 | |
377 | 377 | $adminObject->displayNavigation(basename(__FILE__)); |
378 | - require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
378 | + require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
379 | 379 | |
380 | 380 | editfaq(true, $faqid, $answerid); |
381 | 381 | break; |
@@ -383,9 +383,9 @@ discard block |
||
383 | 383 | case 'addfaq': |
384 | 384 | global $xoopsUser; |
385 | 385 | |
386 | - $faqid = isset($_POST['faqid']) ? (int)$_POST['faqid'] : -1; |
|
387 | - $requester_uid = isset($_POST['requester_uid']) ? (int)$_POST['requester_uid'] : 0; |
|
388 | - $answerer_uid = isset($_POST['answerer_uid']) ? (int)$_POST['answerer_uid'] : 0; |
|
386 | + $faqid = isset($_POST['faqid']) ? (int) $_POST['faqid'] : -1; |
|
387 | + $requester_uid = isset($_POST['requester_uid']) ? (int) $_POST['requester_uid'] : 0; |
|
388 | + $answerer_uid = isset($_POST['answerer_uid']) ? (int) $_POST['answerer_uid'] : 0; |
|
389 | 389 | |
390 | 390 | // Creating the FAQ and answer objects |
391 | 391 | if ($faqid != -1) { |
@@ -406,23 +406,23 @@ discard block |
||
406 | 406 | } else { |
407 | 407 | $faqObj->setGroups_read(); |
408 | 408 | } |
409 | - $faqObj->setVar('categoryid', isset($_POST['categoryid']) ? (int)$_POST['categoryid'] : 0); |
|
409 | + $faqObj->setVar('categoryid', isset($_POST['categoryid']) ? (int) $_POST['categoryid'] : 0); |
|
410 | 410 | $faqObj->setVar('question', $_POST['question']); |
411 | 411 | $faqObj->setVar('howdoi', $_POST['howdoi']); |
412 | 412 | $faqObj->setVar('diduno', $_POST['diduno']); |
413 | 413 | |
414 | - $faqObj->setVar('status', isset($_POST['status']) ? (int)$_POST['status'] : _SF_STATUS_ASKED); |
|
414 | + $faqObj->setVar('status', isset($_POST['status']) ? (int) $_POST['status'] : _SF_STATUS_ASKED); |
|
415 | 415 | |
416 | 416 | // If this SmartFAQ is offline and the user set this option to No |
417 | 417 | $offline = isset($_POST['offline']) ? $_POST['offline'] : 1; |
418 | 418 | if ((0 == $offline) && ($faqObj->status() == _SF_STATUS_OFFLINE)) { |
419 | 419 | $faqObj->setVar('status', _SF_STATUS_PUBLISHED); |
420 | 420 | } |
421 | - $faqObj->setVar('weight', isset($_POST['weight']) ? (int)$_POST['weight'] : $faqObj->weight()); |
|
422 | - $faqObj->setVar('html', isset($_POST['html']) ? (int)$_POST['html'] : 0); |
|
423 | - $faqObj->setVar('smiley', isset($_POST['smiley']) ? (int)$_POST['smiley'] : 0); |
|
424 | - $faqObj->setVar('xcodes', isset($_POST['xcodes']) ? (int)$_POST['xcodes'] : 0); |
|
425 | - $faqObj->setVar('cancomment', isset($_POST['cancomment']) ? (int)$_POST['cancomment'] : 0); |
|
421 | + $faqObj->setVar('weight', isset($_POST['weight']) ? (int) $_POST['weight'] : $faqObj->weight()); |
|
422 | + $faqObj->setVar('html', isset($_POST['html']) ? (int) $_POST['html'] : 0); |
|
423 | + $faqObj->setVar('smiley', isset($_POST['smiley']) ? (int) $_POST['smiley'] : 0); |
|
424 | + $faqObj->setVar('xcodes', isset($_POST['xcodes']) ? (int) $_POST['xcodes'] : 0); |
|
425 | + $faqObj->setVar('cancomment', isset($_POST['cancomment']) ? (int) $_POST['cancomment'] : 0); |
|
426 | 426 | $faqObj->setVar('modulelink', $_POST['modulelink']); |
427 | 427 | $faqObj->setVar('contextpage', $_POST['contextpage']); |
428 | 428 | $faqObj->setVar('exacturl', $_POST['exacturl']); |
@@ -506,13 +506,13 @@ discard block |
||
506 | 506 | |
507 | 507 | // Storing the FAQ |
508 | 508 | if (!$faqObj->store()) { |
509 | - redirect_header('javascript:history.go(-1)', 3, $error_msg . sf_formatErrors($faqObj->getErrors())); |
|
509 | + redirect_header('javascript:history.go(-1)', 3, $error_msg.sf_formatErrors($faqObj->getErrors())); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | // Storing the answer |
513 | 513 | $answerObj->setVar('faqid', $faqObj->faqid()); |
514 | 514 | if (!$answerObj->store()) { |
515 | - redirect_header('javascript:history.go(-1)', 3, $error_msg . sf_formatErrors($answerObj->getErrors())); |
|
515 | + redirect_header('javascript:history.go(-1)', 3, $error_msg.sf_formatErrors($answerObj->getErrors())); |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | // Send notifications |
@@ -529,8 +529,8 @@ discard block |
||
529 | 529 | $module_id = $xoopsModule->getVar('mid'); |
530 | 530 | $gpermHandler = xoops_getHandler('groupperm'); |
531 | 531 | |
532 | - $faqid = isset($_POST['faqid']) ? (int)$_POST['faqid'] : 0; |
|
533 | - $faqid = isset($_GET['faqid']) ? (int)$_GET['faqid'] : $faqid; |
|
532 | + $faqid = isset($_POST['faqid']) ? (int) $_POST['faqid'] : 0; |
|
533 | + $faqid = isset($_GET['faqid']) ? (int) $_GET['faqid'] : $faqid; |
|
534 | 534 | |
535 | 535 | $faqObj = new sfFaq($faqid); |
536 | 536 | |
@@ -539,20 +539,20 @@ discard block |
||
539 | 539 | |
540 | 540 | if ($confirm) { |
541 | 541 | if (!$faqHandler->delete($faqObj)) { |
542 | - redirect_header('faq.php', 2, _AM_SF_FAQ_DELETE_ERROR . sf_formatErrors($faqObj->getErrors())); |
|
542 | + redirect_header('faq.php', 2, _AM_SF_FAQ_DELETE_ERROR.sf_formatErrors($faqObj->getErrors())); |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | redirect_header('faq.php', 2, sprintf(_AM_SF_ARTISDELETED, $faqObj->question())); |
546 | 546 | } else { |
547 | 547 | // no confirm: show deletion condition |
548 | - $faqid = isset($_GET['faqid']) ? (int)$_GET['faqid'] : 0; |
|
548 | + $faqid = isset($_GET['faqid']) ? (int) $_GET['faqid'] : 0; |
|
549 | 549 | xoops_cp_header(); |
550 | 550 | xoops_confirm(array( |
551 | 551 | 'op' => 'del', |
552 | 552 | 'faqid' => $faqObj->faqid(), |
553 | 553 | 'confirm' => 1, |
554 | 554 | 'name' => $faqObj->question() |
555 | - ), 'faq.php', _AM_SF_DELETETHISARTICLE . " <br>'" . $faqObj->question() . "'. <br> <br>", _AM_SF_DELETE); |
|
555 | + ), 'faq.php', _AM_SF_DELETETHISARTICLE." <br>'".$faqObj->question()."'. <br> <br>", _AM_SF_DELETE); |
|
556 | 556 | xoops_cp_footer(); |
557 | 557 | } |
558 | 558 | |
@@ -566,10 +566,10 @@ discard block |
||
566 | 566 | |
567 | 567 | $adminObject->displayNavigation(basename(__FILE__)); |
568 | 568 | |
569 | - require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
570 | - require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
569 | + require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
570 | + require_once XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
571 | 571 | |
572 | - require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/displayfaqs.php'; |
|
572 | + require_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/displayfaqs.php'; |
|
573 | 573 | |
574 | 574 | $totalcategories = $categoryHandler->getCategoriesCount(-1); |
575 | 575 | if ($totalcategories > 0) { |
@@ -579,4 +579,4 @@ discard block |
||
579 | 579 | break; |
580 | 580 | } |
581 | 581 | |
582 | -require_once __DIR__ . '/admin_footer.php'; |
|
582 | +require_once __DIR__.'/admin_footer.php'; |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | * Add appendix |
121 | 121 | * |
122 | 122 | * @access public |
123 | - * @param $permName |
|
123 | + * @param string $permName |
|
124 | 124 | * @param $itemId |
125 | - * @param $itemName |
|
125 | + * @param string $itemName |
|
126 | 126 | */ |
127 | 127 | public function addAppendix($permName, $itemId, $itemName) |
128 | 128 | { |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | /** |
257 | 257 | * Constructor |
258 | 258 | * @param $caption |
259 | - * @param $name |
|
259 | + * @param string $name |
|
260 | 260 | * @param $groupId |
261 | 261 | * @param null $values |
262 | 262 | */ |
@@ -379,20 +379,20 @@ |
||
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']) |
|
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']) |
|
395 | + . "\"><br>\n"; |
|
396 | 396 | if (isset($option['children'])) { |
397 | 397 | foreach ($option['children'] as $child) { |
398 | 398 | array_push($parentIds, $option['id']); |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | |
25 | 25 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
26 | 26 | |
27 | -require_once XOOPS_ROOT_PATH . '/class/xoopsform/formelement.php'; |
|
28 | -require_once XOOPS_ROOT_PATH . '/class/xoopsform/formhidden.php'; |
|
29 | -require_once XOOPS_ROOT_PATH . '/class/xoopsform/formhiddentoken.php'; |
|
30 | -require_once XOOPS_ROOT_PATH . '/class/xoopsform/formbutton.php'; |
|
31 | -require_once XOOPS_ROOT_PATH . '/class/xoopsform/formelementtray.php'; |
|
32 | -require_once XOOPS_ROOT_PATH . '/class/xoopsform/form.php'; |
|
27 | +require_once XOOPS_ROOT_PATH.'/class/xoopsform/formelement.php'; |
|
28 | +require_once XOOPS_ROOT_PATH.'/class/xoopsform/formhidden.php'; |
|
29 | +require_once XOOPS_ROOT_PATH.'/class/xoopsform/formhiddentoken.php'; |
|
30 | +require_once XOOPS_ROOT_PATH.'/class/xoopsform/formbutton.php'; |
|
31 | +require_once XOOPS_ROOT_PATH.'/class/xoopsform/formelementtray.php'; |
|
32 | +require_once XOOPS_ROOT_PATH.'/class/xoopsform/form.php'; |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Renders a form for setting module specific group permissions |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | { |
81 | 81 | // $this->XoopsForm($title, 'groupperm_form', XOOPS_URL.'/modules/system/admin/groupperm.php', 'post'); GIJ |
82 | 82 | parent::__construct($title, 'groupperm_form', '', 'post'); |
83 | - $this->_modid = (int)$modid; |
|
83 | + $this->_modid = (int) $modid; |
|
84 | 84 | $this->_permName = $permname; |
85 | 85 | $this->_permDesc = $permdesc; |
86 | 86 | $this->addElement(new XoopsFormHidden('modid', $this->_modid)); |
@@ -159,11 +159,11 @@ discard block |
||
159 | 159 | } |
160 | 160 | $gpermHandler = xoops_getHandler('groupperm'); |
161 | 161 | $memberHandler = xoops_getHandler('member'); |
162 | - $glist =& $memberHandler->getGroupList(); |
|
162 | + $glist = & $memberHandler->getGroupList(); |
|
163 | 163 | foreach (array_keys($glist) as $i) { |
164 | 164 | // get selected item id(s) for each group |
165 | 165 | $selected = $gpermHandler->getItemIds($this->_permName, $i, $this->_modid); |
166 | - $ele = new MyXoopsGroupFormCheckBox($glist[$i], 'perms[' . $this->_permName . ']', $i, $selected); |
|
166 | + $ele = new MyXoopsGroupFormCheckBox($glist[$i], 'perms['.$this->_permName.']', $i, $selected); |
|
167 | 167 | $ele->setOptionTree($this->_itemTree); |
168 | 168 | |
169 | 169 | foreach ($this->_appendix as $key => $append) { |
@@ -190,18 +190,18 @@ discard block |
||
190 | 190 | $tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
191 | 191 | $this->addElement($tray); |
192 | 192 | |
193 | - $ret = '<h4>' . $this->getTitle() . '</h4>' . $this->_permDesc . '<br>'; |
|
194 | - $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"; |
|
195 | - $elements =& $this->getElements(); |
|
193 | + $ret = '<h4>'.$this->getTitle().'</h4>'.$this->_permDesc.'<br>'; |
|
194 | + $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"; |
|
195 | + $elements = & $this->getElements(); |
|
196 | 196 | foreach (array_keys($elements) as $i) { |
197 | 197 | if (!is_object($elements[$i])) { |
198 | 198 | $ret .= $elements[$i]; |
199 | 199 | } elseif (!$elements[$i]->isHidden()) { |
200 | - $ret .= "<tr valign='top' align='left'><td class='head'>" . $elements[$i]->getCaption(); |
|
200 | + $ret .= "<tr valign='top' align='left'><td class='head'>".$elements[$i]->getCaption(); |
|
201 | 201 | if ($elements[$i]->getDescription() != '') { |
202 | - $ret .= '<br><br><span style="font-weight: normal;">' . $elements[$i]->getDescription() . '</span>'; |
|
202 | + $ret .= '<br><br><span style="font-weight: normal;">'.$elements[$i]->getDescription().'</span>'; |
|
203 | 203 | } |
204 | - $ret .= "</td>\n<td class='even'>\n" . $elements[$i]->render() . "\n</td></tr>\n"; |
|
204 | + $ret .= "</td>\n<td class='even'>\n".$elements[$i]->render()."\n</td></tr>\n"; |
|
205 | 205 | } else { |
206 | 206 | $ret .= $elements[$i]->render(); |
207 | 207 | } |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | */ |
288 | 288 | public function setOptionTree(&$optionTree) |
289 | 289 | { |
290 | - $this->_optionTree =& $optionTree; |
|
290 | + $this->_optionTree = & $optionTree; |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | /** |
@@ -312,34 +312,34 @@ discard block |
||
312 | 312 | $ret = ''; |
313 | 313 | |
314 | 314 | if (count($this->_appendix) > 0) { |
315 | - $ret .= '<table class="outer"><tr>'; |
|
315 | + $ret .= '<table class="outer"><tr>'; |
|
316 | 316 | $cols = 1; |
317 | 317 | foreach ($this->_appendix as $append) { |
318 | 318 | if ($cols > 4) { |
319 | - $ret .= '</tr><tr>'; |
|
319 | + $ret .= '</tr><tr>'; |
|
320 | 320 | $cols = 1; |
321 | 321 | } |
322 | 322 | $checked = $append['selected'] ? 'checked' : ''; |
323 | - $name = 'perms[' . $append['permname'] . ']'; |
|
323 | + $name = 'perms['.$append['permname'].']'; |
|
324 | 324 | $itemid = $append['itemid']; |
325 | 325 | $itemid = $append['itemid']; |
326 | - $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>"; |
|
326 | + $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>"; |
|
327 | 327 | ++$cols; |
328 | 328 | } |
329 | 329 | $ret .= '</tr></table>'; |
330 | 330 | } |
331 | 331 | |
332 | - $ret .= '<table class="outer"><tr>'; |
|
332 | + $ret .= '<table class="outer"><tr>'; |
|
333 | 333 | $cols = 1; |
334 | 334 | foreach ($this->_optionTree[0]['children'] as $topitem) { |
335 | 335 | if ($cols > 4) { |
336 | - $ret .= '</tr><tr>'; |
|
336 | + $ret .= '</tr><tr>'; |
|
337 | 337 | $cols = 1; |
338 | 338 | } |
339 | 339 | $tree = '<td class="odd">'; |
340 | 340 | $prefix = ''; |
341 | 341 | $this->renderOptionTree($tree, $this->_optionTree[$topitem], $prefix); |
342 | - $ret .= $tree . '</td>'; |
|
342 | + $ret .= $tree.'</td>'; |
|
343 | 343 | ++$cols; |
344 | 344 | } |
345 | 345 | $ret .= '</tr></table>'; |
@@ -358,21 +358,21 @@ discard block |
||
358 | 358 | */ |
359 | 359 | private function renderOptionTree(&$tree, $option, $prefix, $parentIds = array()) |
360 | 360 | { |
361 | - $tree .= $prefix . '<input type="checkbox" name="' . $this->getName() . '[groups][' . $this->_groupId . '][' . $option['id'] . ']" id="' . $this->getName() . '[groups][' . $this->_groupId . '][' . $option['id'] . ']" onclick="'; |
|
361 | + $tree .= $prefix.'<input type="checkbox" name="'.$this->getName().'[groups]['.$this->_groupId.']['.$option['id'].']" id="'.$this->getName().'[groups]['.$this->_groupId.']['.$option['id'].']" onclick="'; |
|
362 | 362 | // If there are parent elements, add javascript that will |
363 | 363 | // make them selecteded when this element is checked to make |
364 | 364 | // sure permissions to parent items are added as well. |
365 | 365 | foreach ($parentIds as $pid) { |
366 | - $parent_ele = $this->getName() . '[groups][' . $this->_groupId . '][' . $pid . ']'; |
|
367 | - $tree .= "var ele = xoopsGetElementById('" . $parent_ele . "'); if (ele.checked !== true) {ele.checked = this.checked;}"; |
|
366 | + $parent_ele = $this->getName().'[groups]['.$this->_groupId.']['.$pid.']'; |
|
367 | + $tree .= "var ele = xoopsGetElementById('".$parent_ele."'); if (ele.checked !== true) {ele.checked = this.checked;}"; |
|
368 | 368 | } |
369 | 369 | // If there are child elements, add javascript that will |
370 | 370 | // make them unchecked when this element is unchecked to make |
371 | 371 | // sure permissions to child items are not added when there |
372 | 372 | // is no permission to this item. |
373 | 373 | foreach ($option['allchild'] as $cid) { |
374 | - $child_ele = $this->getName() . '[groups][' . $this->_groupId . '][' . $cid . ']'; |
|
375 | - $tree .= "var ele = xoopsGetElementById('" . $child_ele . "'); if (this.checked !== true) {ele.checked = false;}"; |
|
374 | + $child_ele = $this->getName().'[groups]['.$this->_groupId.']['.$cid.']'; |
|
375 | + $tree .= "var ele = xoopsGetElementById('".$child_ele."'); if (this.checked !== true) {ele.checked = false;}"; |
|
376 | 376 | } |
377 | 377 | $tree .= '" value="1"'; |
378 | 378 | if (null !== $this->_value && in_array($option['id'], $this->_value)) { |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | if (isset($option['children'])) { |
397 | 397 | foreach ($option['children'] as $child) { |
398 | 398 | array_push($parentIds, $option['id']); |
399 | - $this->renderOptionTree($tree, $this->_optionTree[$child], $prefix . ' -', $parentIds); |
|
399 | + $this->renderOptionTree($tree, $this->_optionTree[$child], $prefix.' -', $parentIds); |
|
400 | 400 | } |
401 | 401 | } |
402 | 402 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | $startfaq = isset($_GET['startfaq']) ? (int)$_GET['startfaq'] : 0; |
27 | 27 | |
28 | 28 | /** |
29 | - * @param bool $showmenu |
|
29 | + * @param string $showmenu |
|
30 | 30 | * @param int $faqid |
31 | 31 | */ |
32 | 32 | function editfaq($showmenu = false, $faqid = -1) |
@@ -284,11 +284,11 @@ |
||
284 | 284 | $faqid = isset($_GET['faqid']) ? (int)$_GET['faqid'] : 0; |
285 | 285 | xoops_cp_header(); |
286 | 286 | xoops_confirm(array( |
287 | - 'op' => 'del', |
|
288 | - 'faqid' => $faqObj->faqid(), |
|
289 | - 'confirm' => 1, |
|
290 | - 'name' => $faqObj->question() |
|
291 | - ), 'question.php', _AM_SF_DELETETHISQUESTION . " <br>'" . $faqObj->question() . "'. <br> <br>", _AM_SF_DELETE); |
|
287 | + 'op' => 'del', |
|
288 | + 'faqid' => $faqObj->faqid(), |
|
289 | + 'confirm' => 1, |
|
290 | + 'name' => $faqObj->question() |
|
291 | + ), 'question.php', _AM_SF_DELETETHISQUESTION . " <br>'" . $faqObj->question() . "'. <br> <br>", _AM_SF_DELETE); |
|
292 | 292 | xoops_cp_footer(); |
293 | 293 | } |
294 | 294 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * Licence: GNU |
7 | 7 | */ |
8 | 8 | |
9 | -require_once __DIR__ . '/admin_header.php'; |
|
9 | +require_once __DIR__.'/admin_header.php'; |
|
10 | 10 | |
11 | 11 | // Creating the faq handler object |
12 | 12 | $faqHandler = sf_gethandler('faq'); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | } |
24 | 24 | |
25 | 25 | // Where shall we start? |
26 | -$startfaq = isset($_GET['startfaq']) ? (int)$_GET['startfaq'] : 0; |
|
26 | +$startfaq = isset($_GET['startfaq']) ? (int) $_GET['startfaq'] : 0; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * @param bool $showmenu |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | global $faqHandler, $categoryHandler, $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $modify, $xoopsModuleConfig, $xoopsModule, $XOOPS_URL, $myts; |
35 | 35 | |
36 | - require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
36 | + require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
37 | 37 | // If there is a parameter, and the id exists, retrieve data: we're editing a faq |
38 | 38 | if ($faqid != -1) { |
39 | 39 | // Creating the FAQ object |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | |
66 | 66 | echo "<br>\n"; |
67 | 67 | sf_collapsableBar('bottomtable', 'bottomtableicon'); |
68 | - echo "<img id='bottomtableicon' src=" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt=''></a> " . $collapsableBar_title . '</h3>'; |
|
68 | + echo "<img id='bottomtableicon' src=".XOOPS_URL.'/modules/'.$xoopsModule->dirname()."/assets/images/icon/close12.gif alt=''></a> ".$collapsableBar_title.'</h3>'; |
|
69 | 69 | echo "<div id='bottomtable'>"; |
70 | - echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . $collapsableBar_info . '</span>'; |
|
70 | + echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">'.$collapsableBar_info.'</span>'; |
|
71 | 71 | } else { |
72 | 72 | // there's no parameter, so we're adding a faq |
73 | 73 | $faqObj = $faqHandler->create(); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $button_caption = _AM_SF_CREATE; |
79 | 79 | |
80 | 80 | sf_collapsableBar('bottomtable', 'bottomtableicon'); |
81 | - echo "<img id='bottomtableicon' src=" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt=''></a> " . _AM_SF_CREATEQUESTION . '</h3>'; |
|
81 | + echo "<img id='bottomtableicon' src=".XOOPS_URL.'/modules/'.$xoopsModule->dirname()."/assets/images/icon/close12.gif alt=''></a> "._AM_SF_CREATEQUESTION.'</h3>'; |
|
82 | 82 | echo "<div id='bottomtable'>"; |
83 | 83 | } |
84 | 84 | $sform = new XoopsThemeForm(_AM_SF_OPEN_QUESTION, 'op', xoops_getenv('PHP_SELF'), 'post', true); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $button_tray->addElement($butt_create); |
153 | 153 | |
154 | 154 | $butt_edit = new XoopsFormButton('', '', _AM_SF_OPEN_QUESTION_EDIT, 'button'); |
155 | - $butt_edit->setExtra("onclick=\"location='faq.php?op=mod&faqid=" . $faqid . "'\""); |
|
155 | + $butt_edit->setExtra("onclick=\"location='faq.php?op=mod&faqid=".$faqid."'\""); |
|
156 | 156 | $button_tray->addElement($butt_edit); |
157 | 157 | |
158 | 158 | $butt_cancel = new XoopsFormButton('', '', _AM_SF_CANCEL, 'button'); |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | xoops_cp_header(); |
185 | 185 | |
186 | 186 | $adminObject->displayNavigation(basename(__FILE__)); |
187 | - require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
187 | + require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
188 | 188 | |
189 | 189 | editfaq(true, $faqid); |
190 | 190 | break; |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $uid = $xoopsUser->uid(); |
203 | 203 | } |
204 | 204 | |
205 | - $faqid = isset($_POST['faqid']) ? (int)$_POST['faqid'] : -1; |
|
205 | + $faqid = isset($_POST['faqid']) ? (int) $_POST['faqid'] : -1; |
|
206 | 206 | |
207 | 207 | // Creating the FAQ |
208 | 208 | if ($faqid != -1) { |
@@ -213,9 +213,9 @@ discard block |
||
213 | 213 | |
214 | 214 | // Putting the values in the FAQ object |
215 | 215 | $faqObj->setGroups_read(isset($_POST['groups']) ? $_POST['groups'] : array()); |
216 | - $faqObj->setVar('categoryid', isset($_POST['categoryid']) ? (int)$_POST['categoryid'] : 0); |
|
216 | + $faqObj->setVar('categoryid', isset($_POST['categoryid']) ? (int) $_POST['categoryid'] : 0); |
|
217 | 217 | $faqObj->setVar('question', $_POST['question']); |
218 | - $faqObj->setVar('status', isset($_POST['status']) ? (int)$_POST['status'] : _SF_STATUS_ASKED); |
|
218 | + $faqObj->setVar('status', isset($_POST['status']) ? (int) $_POST['status'] : _SF_STATUS_ASKED); |
|
219 | 219 | |
220 | 220 | $notifToDo = null; |
221 | 221 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | |
248 | 248 | // Storing the FAQ |
249 | 249 | if (!$faqObj->store()) { |
250 | - redirect_header('javascript:history.go(-1)', 3, _AM_SF_ERROR . sf_formatErrors($faqObj->getErrors())); |
|
250 | + redirect_header('javascript:history.go(-1)', 3, _AM_SF_ERROR.sf_formatErrors($faqObj->getErrors())); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | // Send notifications |
@@ -265,8 +265,8 @@ discard block |
||
265 | 265 | $module_id = $xoopsModule->getVar('mid'); |
266 | 266 | $gpermHandler = xoops_getHandler('groupperm'); |
267 | 267 | |
268 | - $faqid = isset($_POST['faqid']) ? (int)$_POST['faqid'] : 0; |
|
269 | - $faqid = isset($_GET['faqid']) ? (int)$_GET['faqid'] : $faqid; |
|
268 | + $faqid = isset($_POST['faqid']) ? (int) $_POST['faqid'] : 0; |
|
269 | + $faqid = isset($_GET['faqid']) ? (int) $_GET['faqid'] : $faqid; |
|
270 | 270 | |
271 | 271 | $faqObj = new sfFaq($faqid); |
272 | 272 | |
@@ -281,14 +281,14 @@ discard block |
||
281 | 281 | redirect_header('question.php', 2, sprintf(_AM_SF_QUESTIONISDELETED, $faqObj->question())); |
282 | 282 | } else { |
283 | 283 | // no confirm: show deletion condition |
284 | - $faqid = isset($_GET['faqid']) ? (int)$_GET['faqid'] : 0; |
|
284 | + $faqid = isset($_GET['faqid']) ? (int) $_GET['faqid'] : 0; |
|
285 | 285 | xoops_cp_header(); |
286 | 286 | xoops_confirm(array( |
287 | 287 | 'op' => 'del', |
288 | 288 | 'faqid' => $faqObj->faqid(), |
289 | 289 | 'confirm' => 1, |
290 | 290 | 'name' => $faqObj->question() |
291 | - ), 'question.php', _AM_SF_DELETETHISQUESTION . " <br>'" . $faqObj->question() . "'. <br> <br>", _AM_SF_DELETE); |
|
291 | + ), 'question.php', _AM_SF_DELETETHISQUESTION." <br>'".$faqObj->question()."'. <br> <br>", _AM_SF_DELETE); |
|
292 | 292 | xoops_cp_footer(); |
293 | 293 | } |
294 | 294 | |
@@ -301,8 +301,8 @@ discard block |
||
301 | 301 | xoops_cp_header(); |
302 | 302 | $adminObject->displayNavigation(basename(__FILE__)); |
303 | 303 | |
304 | - require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
305 | - require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
304 | + require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
305 | + require_once XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
306 | 306 | |
307 | 307 | global $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $xoopsModuleConfig, $xoopsModule, $smartModuleConfig; |
308 | 308 | |
@@ -310,9 +310,9 @@ discard block |
||
310 | 310 | |
311 | 311 | sf_collapsableBar('toptable', 'toptableicon'); |
312 | 312 | |
313 | - echo "<img id='toptableicon' src=" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt=''></a> " . _AM_SF_OPENED_TITLE . '</h3>'; |
|
313 | + echo "<img id='toptableicon' src=".XOOPS_URL.'/modules/'.$xoopsModule->dirname()."/assets/images/icon/close12.gif alt=''></a> "._AM_SF_OPENED_TITLE.'</h3>'; |
|
314 | 314 | echo "<div id='toptable'>"; |
315 | - echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . _AM_SF_OPENED_DSC . '</span>'; |
|
315 | + echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">'._AM_SF_OPENED_DSC.'</span>'; |
|
316 | 316 | |
317 | 317 | // Get the total number of published FAQs |
318 | 318 | $totalfaqs = $faqHandler->getFaqsCount(-1, array(_SF_STATUS_OPENED)); |
@@ -322,14 +322,14 @@ discard block |
||
322 | 322 | $allCats = $categoryHandler->getObjects(null, true); |
323 | 323 | echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>"; |
324 | 324 | echo '<tr>'; |
325 | - echo "<th width='40' class='bg3' align='center'><b>" . _AM_SF_ARTID . '</b></td>'; |
|
326 | - echo "<th width='20%' class='bg3' align='left'><b>" . _AM_SF_ARTCOLNAME . '</b></td>'; |
|
327 | - echo "<th class='bg3' align='left'><b>" . _AM_SF_QUESTION . '</b></td>'; |
|
325 | + echo "<th width='40' class='bg3' align='center'><b>"._AM_SF_ARTID.'</b></td>'; |
|
326 | + echo "<th width='20%' class='bg3' align='left'><b>"._AM_SF_ARTCOLNAME.'</b></td>'; |
|
327 | + echo "<th class='bg3' align='left'><b>"._AM_SF_QUESTION.'</b></td>'; |
|
328 | 328 | |
329 | - echo "<th width='90' class='bg3' align='center'><b>" . _AM_SF_ASKED . '</b></td>'; |
|
329 | + echo "<th width='90' class='bg3' align='center'><b>"._AM_SF_ASKED.'</b></td>'; |
|
330 | 330 | |
331 | - echo "<th width='90' class='bg3' align='center'><b>" . _AM_SF_CREATED . '</b></td>'; |
|
332 | - echo "<th width='60' class='bg3' align='center'><b>" . _AM_SF_ACTION . '</b></td>'; |
|
331 | + echo "<th width='90' class='bg3' align='center'><b>"._AM_SF_CREATED.'</b></td>'; |
|
332 | + echo "<th width='60' class='bg3' align='center'><b>"._AM_SF_ACTION.'</b></td>'; |
|
333 | 333 | echo '</tr>'; |
334 | 334 | //var_dump( $faqsObj); |
335 | 335 | if ($totalfaqs > 0) { |
@@ -337,33 +337,33 @@ discard block |
||
337 | 337 | foreach (array_keys($faqsObj) as $i) { |
338 | 338 | $categoryObj = $allCats[$faqsObj[$i]->categoryid()]; |
339 | 339 | |
340 | - $modify = "<a href='question.php?op=mod&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . $pathIcon16 . '/edit.png' . "' title='" . _AM_SF_EDITART . "' alt='" . _AM_SF_EDITART . "'></a>"; |
|
341 | - $delete = "<a href='question.php?op=del&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . $pathIcon16 . '/delete.png' . "' title='" . _AM_SF_DELETEART . "' alt='" . _AM_SF_DELETEART . "'></a>"; |
|
340 | + $modify = "<a href='question.php?op=mod&faqid=".$faqsObj[$i]->faqid()."'><img src='".$pathIcon16.'/edit.png'."' title='"._AM_SF_EDITART."' alt='"._AM_SF_EDITART."'></a>"; |
|
341 | + $delete = "<a href='question.php?op=del&faqid=".$faqsObj[$i]->faqid()."'><img src='".$pathIcon16.'/delete.png'."' title='"._AM_SF_DELETEART."' alt='"._AM_SF_DELETEART."'></a>"; |
|
342 | 342 | |
343 | 343 | $requester = sf_getLinkedUnameFromId($faqsObj[$i]->uid(), $smartModuleConfig['userealname']); |
344 | 344 | |
345 | 345 | echo '<tr>'; |
346 | - echo "<td class='head' align='center'>" . $faqsObj[$i]->faqid() . '</td>'; |
|
347 | - echo "<td class='even' align='left'>" . $categoryObj->name() . '</td>'; |
|
348 | - echo "<td class='even' align='left'><a href='" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/answer.php?faqid=' . $faqsObj[$i]->faqid() . "'>" . $faqsObj[$i]->question(100) . '</a></td>'; |
|
346 | + echo "<td class='head' align='center'>".$faqsObj[$i]->faqid().'</td>'; |
|
347 | + echo "<td class='even' align='left'>".$categoryObj->name().'</td>'; |
|
348 | + echo "<td class='even' align='left'><a href='".XOOPS_URL.'/modules/'.$xoopsModule->dirname().'/answer.php?faqid='.$faqsObj[$i]->faqid()."'>".$faqsObj[$i]->question(100).'</a></td>'; |
|
349 | 349 | |
350 | - echo "<td class='even' align='center'>" . $requester . '</td>'; |
|
350 | + echo "<td class='even' align='center'>".$requester.'</td>'; |
|
351 | 351 | |
352 | - echo "<td class='even' align='center'>" . $faqsObj[$i]->datesub('s') . '</td>'; |
|
352 | + echo "<td class='even' align='center'>".$faqsObj[$i]->datesub('s').'</td>'; |
|
353 | 353 | echo "<td class='even' align='center'> $modify $delete </td>"; |
354 | 354 | echo '</tr>'; |
355 | 355 | } |
356 | 356 | } else { |
357 | 357 | $faqid = -1; |
358 | 358 | echo '<tr>'; |
359 | - echo "<td class='head' align='center' colspan= '7'>" . _AM_SF_NOQUEUED . '</td>'; |
|
359 | + echo "<td class='head' align='center' colspan= '7'>"._AM_SF_NOQUEUED.'</td>'; |
|
360 | 360 | echo '</tr>'; |
361 | 361 | } |
362 | 362 | echo "</table>\n"; |
363 | 363 | echo "<br>\n"; |
364 | 364 | |
365 | 365 | $pagenav = new XoopsPageNav($totalfaqs, $xoopsModuleConfig['perpage'], $startfaq, 'startfaq'); |
366 | - echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'; |
|
366 | + echo '<div style="text-align:right;">'.$pagenav->renderNav().'</div>'; |
|
367 | 367 | echo '</div>'; |
368 | 368 | |
369 | 369 | $totalcategories = $categoryHandler->getCategoriesCount(-1); |
@@ -374,4 +374,4 @@ discard block |
||
374 | 374 | break; |
375 | 375 | } |
376 | 376 | |
377 | -require_once __DIR__ . '/admin_footer.php'; |
|
377 | +require_once __DIR__.'/admin_footer.php'; |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | /** |
29 | 29 | * constructor |
30 | - * @param null $id |
|
30 | + * @param integer $id |
|
31 | 31 | */ |
32 | 32 | public function __construct($id = null) |
33 | 33 | { |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | * create a new answer |
369 | 369 | * |
370 | 370 | * @param bool $isNew flag the new objects as "new"? |
371 | - * @return object sfAnswer |
|
371 | + * @return sfAnswer sfAnswer |
|
372 | 372 | */ |
373 | 373 | public function create($isNew = true) |
374 | 374 | { |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | /** |
411 | 411 | * insert a new answer in the database |
412 | 412 | * |
413 | - * @param XoopsObject $answerObj reference to the <a href='psi_element://sfAnswer'>sfAnswer</a> object |
|
413 | + * @param sfAnswer $answerObj reference to the <a href='psi_element://sfAnswer'>sfAnswer</a> object |
|
414 | 414 | * @param bool $force |
415 | 415 | * @return bool FALSE if failed, TRUE if already present and unchanged or successful |
416 | 416 | */ |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | if (!$attach_key) { |
92 | 92 | return false; |
93 | 93 | } |
94 | - $this->attachment_array[(string)$attach_key]['num_download']++; |
|
94 | + $this->attachment_array[(string) $attach_key]['num_download']++; |
|
95 | 95 | |
96 | - return $this->attachment_array[(string)$attach_key]['num_download']; |
|
96 | + return $this->attachment_array[(string) $attach_key]['num_download']; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $attachment_save = base64_encode(serialize($this->attachment_array)); |
107 | 107 | } |
108 | 108 | $this->setVar('attachment', $attachment_save); |
109 | - $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('smartfaq_answers') . ' SET attachment=' . $GLOBALS['xoopsDB']->quoteString($attachment_save) . ' WHERE post_id = ' . $this->getVar('answerid'); |
|
109 | + $sql = 'UPDATE '.$GLOBALS['xoopsDB']->prefix('smartfaq_answers').' SET attachment='.$GLOBALS['xoopsDB']->quoteString($attachment_save).' WHERE post_id = '.$this->getVar('answerid'); |
|
110 | 110 | if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { |
111 | 111 | //xoops_error($GLOBALS["xoopsDB"]->error()); |
112 | 112 | return false; |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | |
139 | 139 | foreach ($attach_old as $key => $attach) { |
140 | 140 | if (in_array($key, $attach_array)) { |
141 | - @unlink(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attach['name_saved']); |
|
142 | - @unlink(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/thumbs/' . $attach['name_saved']); // delete thumbnails |
|
141 | + @unlink(XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/'.$attach['name_saved']); |
|
142 | + @unlink(XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/thumbs/'.$attach['name_saved']); // delete thumbnails |
|
143 | 143 | continue; |
144 | 144 | } |
145 | 145 | $this->attachment_array[$key] = $attach; |
@@ -165,12 +165,12 @@ discard block |
||
165 | 165 | static $counter = 0; |
166 | 166 | $this->attachment_array = $this->getAttachment(); |
167 | 167 | if ($name_saved) { |
168 | - $key = (string)(time() + ($counter++)); |
|
168 | + $key = (string) (time()+($counter++)); |
|
169 | 169 | $this->attachment_array[$key] = array( |
170 | 170 | 'name_saved' => $name_saved, |
171 | 171 | 'name_display' => isset($name_display) ? $name_display : $name_saved, |
172 | 172 | 'mimetype' => $mimetype, |
173 | - 'num_download' => isset($num_download) ? (int)$num_download : 0 |
|
173 | + 'num_download' => isset($num_download) ? (int) $num_download : 0 |
|
174 | 174 | ); |
175 | 175 | } |
176 | 176 | $attachment_save = null; |
@@ -196,24 +196,24 @@ discard block |
||
196 | 196 | if (is_array($attachments) && count($attachments) > 0) { |
197 | 197 | $iconHandler = sf_getIconHandler(); |
198 | 198 | $mime_path = $iconHandler->getPath('mime'); |
199 | - require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/include/functions.image.php'; |
|
199 | + require_once XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname', 'n').'/include/functions.image.php'; |
|
200 | 200 | $image_extensions = array('jpg', 'jpeg', 'gif', 'png', 'bmp'); // need improve !!! |
201 | - $post_attachment .= '<br><strong>' . _MD_ATTACHMENT . '</strong>:'; |
|
201 | + $post_attachment .= '<br><strong>'._MD_ATTACHMENT.'</strong>:'; |
|
202 | 202 | $post_attachment .= '<br><hr size="1" noshade="noshade"><br>'; |
203 | 203 | foreach ($attachments as $key => $att) { |
204 | 204 | $file_extension = ltrim(strrchr($att['name_saved'], '.'), '.'); |
205 | 205 | $filetype = $file_extension; |
206 | - if (file_exists(XOOPS_ROOT_PATH . '/' . $mime_path . '/' . $filetype . '.gif')) { |
|
207 | - $icon_filetype = XOOPS_URL . '/' . $mime_path . '/' . $filetype . '.gif'; |
|
206 | + if (file_exists(XOOPS_ROOT_PATH.'/'.$mime_path.'/'.$filetype.'.gif')) { |
|
207 | + $icon_filetype = XOOPS_URL.'/'.$mime_path.'/'.$filetype.'.gif'; |
|
208 | 208 | } else { |
209 | - $icon_filetype = XOOPS_URL . '/' . $mime_path . '/unknown.gif'; |
|
209 | + $icon_filetype = XOOPS_URL.'/'.$mime_path.'/unknown.gif'; |
|
210 | 210 | } |
211 | - $file_size = @filesize(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $att['name_saved']); |
|
212 | - $file_size = number_format($file_size / 1024, 2) . ' KB'; |
|
211 | + $file_size = @filesize(XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/'.$att['name_saved']); |
|
212 | + $file_size = number_format($file_size / 1024, 2).' KB'; |
|
213 | 213 | if ($xoopsModuleConfig['media_allowed'] && in_array(strtolower($file_extension), $image_extensions)) { |
214 | - $post_attachment .= '<br><img src="' . $icon_filetype . '" alt="' . $filetype . '"><strong> ' . $att['name_display'] . '</strong> <small>(' . $file_size . ')</small>'; |
|
215 | - $post_attachment .= '<br>' . sf_attachmentImage($att['name_saved']); |
|
216 | - $isDisplayed = true; |
|
214 | + $post_attachment .= '<br><img src="'.$icon_filetype.'" alt="'.$filetype.'"><strong> '.$att['name_display'].'</strong> <small>('.$file_size.')</small>'; |
|
215 | + $post_attachment .= '<br>'.sf_attachmentImage($att['name_saved']); |
|
216 | + $isDisplayed = true; |
|
217 | 217 | } else { |
218 | 218 | global $xoopsUser; |
219 | 219 | if (empty($xoopsModuleConfig['show_userattach'])) { |
@@ -370,9 +370,9 @@ discard block |
||
370 | 370 | $tags = array(); |
371 | 371 | $tags['MODULE_NAME'] = $myts->displayTarea($smartModule->getVar('name')); |
372 | 372 | $tags['FAQ_NAME'] = $faqObj->question(); |
373 | - $tags['FAQ_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/faq.php?faqid=' . $faqObj->faqid(); |
|
373 | + $tags['FAQ_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/faq.php?faqid='.$faqObj->faqid(); |
|
374 | 374 | $tags['CATEGORY_NAME'] = $faqObj->getCategoryName(); |
375 | - $tags['CATEGORY_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/category.php?categoryid=' . $faqObj->categoryid(); |
|
375 | + $tags['CATEGORY_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/category.php?categoryid='.$faqObj->categoryid(); |
|
376 | 376 | $tags['FAQ_QUESTION'] = $faqObj->question(); |
377 | 377 | |
378 | 378 | // TODO : Not sure about the 'formpreview' ... |
@@ -429,8 +429,8 @@ discard block |
||
429 | 429 | */ |
430 | 430 | public function get($id = null, $fields = null) |
431 | 431 | { |
432 | - if ((int)$id > 0) { |
|
433 | - $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_answers') . ' WHERE answerid=' . $id; |
|
432 | + if ((int) $id > 0) { |
|
433 | + $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_answers').' WHERE answerid='.$id; |
|
434 | 434 | if (!$result = $this->db->query($sql)) { |
435 | 435 | return false; |
436 | 436 | } |
@@ -558,11 +558,11 @@ discard block |
||
558 | 558 | { |
559 | 559 | $ret = array(); |
560 | 560 | $limit = $start = 0; |
561 | - $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_answers'); |
|
561 | + $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_answers'); |
|
562 | 562 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
563 | - $sql .= ' ' . $criteria->renderWhere(); |
|
563 | + $sql .= ' '.$criteria->renderWhere(); |
|
564 | 564 | if ($criteria->getSort() != '') { |
565 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
565 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
566 | 566 | } |
567 | 567 | $limit = $criteria->getLimit(); |
568 | 568 | $start = $criteria->getStart(); |
@@ -576,9 +576,9 @@ discard block |
||
576 | 576 | $answer = new sfAnswer(); |
577 | 577 | $answer->assignVars($myrow); |
578 | 578 | if (!$id_as_key) { |
579 | - $ret[] =& $answer; |
|
579 | + $ret[] = & $answer; |
|
580 | 580 | } else { |
581 | - $ret[$myrow['answerid']] =& $answer; |
|
581 | + $ret[$myrow['answerid']] = & $answer; |
|
582 | 582 | } |
583 | 583 | unset($answer); |
584 | 584 | } |
@@ -659,9 +659,9 @@ discard block |
||
659 | 659 | */ |
660 | 660 | public function getCount(CriteriaElement $criteria = null) |
661 | 661 | { |
662 | - $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_answers'); |
|
662 | + $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('smartfaq_answers'); |
|
663 | 663 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
664 | - $sql .= ' ' . $criteria->renderWhere(); |
|
664 | + $sql .= ' '.$criteria->renderWhere(); |
|
665 | 665 | } |
666 | 666 | $result = $this->db->query($sql); |
667 | 667 | if (!$result) { |
@@ -680,10 +680,10 @@ discard block |
||
680 | 680 | */ |
681 | 681 | public function getCountByFAQ($criteria = null) |
682 | 682 | { |
683 | - $sql = 'SELECT faqid, COUNT(*) FROM ' . $this->db->prefix('smartfaq_answers'); |
|
683 | + $sql = 'SELECT faqid, COUNT(*) FROM '.$this->db->prefix('smartfaq_answers'); |
|
684 | 684 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
685 | - $sql .= ' ' . $criteria->renderWhere(); |
|
686 | - $sql .= ' ' . $criteria->getGroupby(); |
|
685 | + $sql .= ' '.$criteria->renderWhere(); |
|
686 | + $sql .= ' '.$criteria->getGroupby(); |
|
687 | 687 | } |
688 | 688 | |
689 | 689 | //echo "<br>$sql<br>"; |
@@ -710,9 +710,9 @@ discard block |
||
710 | 710 | */ |
711 | 711 | public function deleteAll(CriteriaElement $criteria = null, $force = true, $asObject = false) |
712 | 712 | { |
713 | - $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_answers'); |
|
713 | + $sql = 'DELETE FROM '.$this->db->prefix('smartfaq_answers'); |
|
714 | 714 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
715 | - $sql .= ' ' . $criteria->renderWhere(); |
|
715 | + $sql .= ' '.$criteria->renderWhere(); |
|
716 | 716 | } |
717 | 717 | if (!$this->db->query($sql)) { |
718 | 718 | return false; |
@@ -732,10 +732,10 @@ discard block |
||
732 | 732 | */ |
733 | 733 | public function updateAll($fieldname, $fieldvalue, CriteriaElement $criteria = null, $force = false) |
734 | 734 | { |
735 | - $set_clause = is_numeric($fieldvalue) ? $fieldname . ' = ' . $fieldvalue : $fieldname . ' = ' . $this->db->quoteString($fieldvalue); |
|
736 | - $sql = 'UPDATE ' . $this->db->prefix('smartfaq_answers') . ' SET ' . $set_clause; |
|
735 | + $set_clause = is_numeric($fieldvalue) ? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue); |
|
736 | + $sql = 'UPDATE '.$this->db->prefix('smartfaq_answers').' SET '.$set_clause; |
|
737 | 737 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
738 | - $sql .= ' ' . $criteria->renderWhere(); |
|
738 | + $sql .= ' '.$criteria->renderWhere(); |
|
739 | 739 | } |
740 | 740 | //echo "<br>" . $sql . "<br>"; |
741 | 741 | if (!$this->db->queryF($sql)) { |
@@ -752,8 +752,8 @@ discard block |
||
752 | 752 | public function getLastPublishedByFaq($faqids) |
753 | 753 | { |
754 | 754 | $ret = array(); |
755 | - $sql = 'SELECT faqid, answer, uid, datesub FROM ' . $this->db->prefix('smartfaq_answers') . ' |
|
756 | - WHERE faqid IN (' . implode(',', $faqids) . ') AND status = ' . _SF_AN_STATUS_APPROVED . ' GROUP BY faqid'; |
|
755 | + $sql = 'SELECT faqid, answer, uid, datesub FROM '.$this->db->prefix('smartfaq_answers').' |
|
756 | + WHERE faqid IN (' . implode(',', $faqids).') AND status = '._SF_AN_STATUS_APPROVED.' GROUP BY faqid'; |
|
757 | 757 | $result = $this->db->query($sql); |
758 | 758 | if (!$result) { |
759 | 759 | return $ret; |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | while ($row = $this->db->fetchArray($result)) { |
762 | 762 | $answer = new sfAnswer(); |
763 | 763 | $answer->assignVars($row); |
764 | - $ret[$row['faqid']] =& $answer; |
|
764 | + $ret[$row['faqid']] = & $answer; |
|
765 | 765 | unset($answer); |
766 | 766 | } |
767 | 767 |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
170 | - * @param $field |
|
170 | + * @param string $field |
|
171 | 171 | * @return bool |
172 | 172 | */ |
173 | 173 | public function fieldExists($field) |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | /** |
629 | 629 | * Use to update a table |
630 | 630 | * |
631 | - * @param object $table {@link SmartDbTable} that will be updated |
|
631 | + * @param SmartDbTable $table {@link SmartDbTable} that will be updated |
|
632 | 632 | * |
633 | 633 | * @see SmartDbTable |
634 | 634 | * |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | //Verifies that a MySQL table exists |
17 | 17 | $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection(); |
18 | 18 | $realname = $xoopsDB->prefix($table); |
19 | - $sql = 'SHOW TABLES FROM ' . XOOPS_DB_NAME; |
|
19 | + $sql = 'SHOW TABLES FROM '.XOOPS_DB_NAME; |
|
20 | 20 | $ret = $xoopsDB->queryF($sql); |
21 | 21 | while (list($m_table) = $xoopsDB->fetchRow($ret)) { |
22 | 22 | if ($m_table == $realname) { |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | * Include the language constants for the SmartObjectDBUpdater |
54 | 54 | */ |
55 | 55 | global $xoopsConfig; |
56 | -$common_file = XOOPS_ROOT_PATH . '/modules/smartfaq/language/' . $xoopsConfig['language'] . '/smartdbupdater.php'; |
|
56 | +$common_file = XOOPS_ROOT_PATH.'/modules/smartfaq/language/'.$xoopsConfig['language'].'/smartdbupdater.php'; |
|
57 | 57 | if (!file_exists($common_file)) { |
58 | - $common_file = XOOPS_ROOT_PATH . '/modules/smartfaq/language/english/smartdbupdater.php'; |
|
58 | + $common_file = XOOPS_ROOT_PATH.'/modules/smartfaq/language/english/smartdbupdater.php'; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | include $common_file; |
@@ -152,14 +152,14 @@ discard block |
||
152 | 152 | public function getExistingFieldsArray() |
153 | 153 | { |
154 | 154 | global $xoopsDB; |
155 | - $result = $xoopsDB->queryF('SHOW COLUMNS FROM ' . $this->name()); |
|
155 | + $result = $xoopsDB->queryF('SHOW COLUMNS FROM '.$this->name()); |
|
156 | 156 | while ($existing_field = $xoopsDB->fetchArray($result)) { |
157 | 157 | $fields[$existing_field['Field']] = $existing_field['Type']; |
158 | 158 | if ($existing_field['Null'] !== 'YES') { |
159 | 159 | $fields[$existing_field['Field']] .= ' NOT NULL'; |
160 | 160 | } |
161 | 161 | if ($existing_field['Extra']) { |
162 | - $fields[$existing_field['Field']] .= ' ' . $existing_field['Extra']; |
|
162 | + $fields[$existing_field['Field']] .= ' '.$existing_field['Extra']; |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
@@ -235,9 +235,9 @@ discard block |
||
235 | 235 | $query = sprintf('INSERT INTO "%s" VALUES ("%s")', $this->name(), $data); |
236 | 236 | $ret = $xoopsDB->queryF($query); |
237 | 237 | if (!$ret) { |
238 | - echo ' ' . sprintf(_SDU_MSG_ADD_DATA_ERR, $this->name()) . '<br>'; |
|
238 | + echo ' '.sprintf(_SDU_MSG_ADD_DATA_ERR, $this->name()).'<br>'; |
|
239 | 239 | } else { |
240 | - echo ' ' . sprintf(_SDU_MSG_ADD_DATA, $this->name()) . '<br>'; |
|
240 | + echo ' '.sprintf(_SDU_MSG_ADD_DATA, $this->name()).'<br>'; |
|
241 | 241 | } |
242 | 242 | } |
243 | 243 | |
@@ -402,9 +402,9 @@ discard block |
||
402 | 402 | |
403 | 403 | $ret = $xoopsDB->queryF($query); |
404 | 404 | if (!$ret) { |
405 | - echo ' ' . sprintf(_SDU_MSG_CREATE_TABLE_ERR, $this->name()) . '<br>'; |
|
405 | + echo ' '.sprintf(_SDU_MSG_CREATE_TABLE_ERR, $this->name()).'<br>'; |
|
406 | 406 | } else { |
407 | - echo ' ' . sprintf(_SDU_MSG_CREATE_TABLE, $this->name()) . '<br>'; |
|
407 | + echo ' '.sprintf(_SDU_MSG_CREATE_TABLE, $this->name()).'<br>'; |
|
408 | 408 | } |
409 | 409 | |
410 | 410 | return $ret; |
@@ -423,11 +423,11 @@ discard block |
||
423 | 423 | $query = sprintf('DROP TABLE %s', $this->name()); |
424 | 424 | $ret = $xoopsDB->queryF($query); |
425 | 425 | if (!$ret) { |
426 | - echo ' ' . sprintf(_SDU_MSG_DROP_TABLE_ERR, $this->name()) . '<br>'; |
|
426 | + echo ' '.sprintf(_SDU_MSG_DROP_TABLE_ERR, $this->name()).'<br>'; |
|
427 | 427 | |
428 | 428 | return false; |
429 | 429 | } else { |
430 | - echo ' ' . sprintf(_SDU_MSG_DROP_TABLE, $this->name()) . '<br>'; |
|
430 | + echo ' '.sprintf(_SDU_MSG_DROP_TABLE, $this->name()).'<br>'; |
|
431 | 431 | |
432 | 432 | return true; |
433 | 433 | } |
@@ -451,9 +451,9 @@ discard block |
||
451 | 451 | $ret = $ret && $xoopsDB->queryF($query); |
452 | 452 | if ($alteredField['showerror']) { |
453 | 453 | if (!$ret) { |
454 | - echo ' ' . sprintf(_SDU_MSG_CHGFIELD_ERR, $alteredField['name'], $this->name()) . '<br>'; |
|
454 | + echo ' '.sprintf(_SDU_MSG_CHGFIELD_ERR, $alteredField['name'], $this->name()).'<br>'; |
|
455 | 455 | } else { |
456 | - echo ' ' . sprintf(_SDU_MSG_CHGFIELD, $alteredField['name'], $this->name()) . '<br>'; |
|
456 | + echo ' '.sprintf(_SDU_MSG_CHGFIELD, $alteredField['name'], $this->name()).'<br>'; |
|
457 | 457 | } |
458 | 458 | } |
459 | 459 | } |
@@ -477,9 +477,9 @@ discard block |
||
477 | 477 | //echo $query; |
478 | 478 | $ret = $ret && $xoopsDB->queryF($query); |
479 | 479 | if (!$ret) { |
480 | - echo ' ' . sprintf(_SDU_MSG_NEWFIELD_ERR, $newField['name'], $this->name()) . '<br>'; |
|
480 | + echo ' '.sprintf(_SDU_MSG_NEWFIELD_ERR, $newField['name'], $this->name()).'<br>'; |
|
481 | 481 | } else { |
482 | - echo ' ' . sprintf(_SDU_MSG_NEWFIELD, $newField['name'], $this->name()) . '<br>'; |
|
482 | + echo ' '.sprintf(_SDU_MSG_NEWFIELD, $newField['name'], $this->name()).'<br>'; |
|
483 | 483 | } |
484 | 484 | } |
485 | 485 | |
@@ -502,9 +502,9 @@ discard block |
||
502 | 502 | $query = sprintf('UPDATE %s SET %s = %s', $this->name(), $updatedField['name'], $updatedField['value']); |
503 | 503 | $ret = $ret && $xoopsDB->queryF($query); |
504 | 504 | if (!$ret) { |
505 | - echo ' ' . sprintf(_SDU_MSG_UPDATE_TABLE_ERR, $this->name()) . '<br>'; |
|
505 | + echo ' '.sprintf(_SDU_MSG_UPDATE_TABLE_ERR, $this->name()).'<br>'; |
|
506 | 506 | } else { |
507 | - echo ' ' . sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()) . '<br>'; |
|
507 | + echo ' '.sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()).'<br>'; |
|
508 | 508 | } |
509 | 509 | } |
510 | 510 | |
@@ -527,9 +527,9 @@ discard block |
||
527 | 527 | //echo $query."<br>"; |
528 | 528 | $ret = $ret && $xoopsDB->queryF($query); |
529 | 529 | if (!$ret) { |
530 | - echo ' ' . sprintf(_SDU_MSG_UPDATE_TABLE_ERR, $this->name()) . '<br>'; |
|
530 | + echo ' '.sprintf(_SDU_MSG_UPDATE_TABLE_ERR, $this->name()).'<br>'; |
|
531 | 531 | } else { |
532 | - echo ' ' . sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()) . '<br>'; |
|
532 | + echo ' '.sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()).'<br>'; |
|
533 | 533 | } |
534 | 534 | } |
535 | 535 | |
@@ -553,9 +553,9 @@ discard block |
||
553 | 553 | |
554 | 554 | $ret = $ret && $xoopsDB->queryF($query); |
555 | 555 | if (!$ret) { |
556 | - echo ' ' . sprintf(_SDU_MSG_DROPFIELD_ERR, $droppedField, $this->name()) . '<br>'; |
|
556 | + echo ' '.sprintf(_SDU_MSG_DROPFIELD_ERR, $droppedField, $this->name()).'<br>'; |
|
557 | 557 | } else { |
558 | - echo ' ' . sprintf(_SDU_MSG_DROPFIELD, $droppedField, $this->name()) . '<br>'; |
|
558 | + echo ' '.sprintf(_SDU_MSG_DROPFIELD, $droppedField, $this->name()).'<br>'; |
|
559 | 559 | } |
560 | 560 | } |
561 | 561 | |
@@ -624,11 +624,11 @@ discard block |
||
624 | 624 | $query = sprintf('ALTER TABLE %s RENAME %s', $from, $to); |
625 | 625 | $ret = $xoopsDB->queryF($query); |
626 | 626 | if (!$ret) { |
627 | - echo ' ' . sprintf(_SDU_MSG_RENAME_TABLE_ERR, $from) . '<br>'; |
|
627 | + echo ' '.sprintf(_SDU_MSG_RENAME_TABLE_ERR, $from).'<br>'; |
|
628 | 628 | |
629 | 629 | return false; |
630 | 630 | } else { |
631 | - echo ' ' . sprintf(_SDU_MSG_RENAME_TABLE, $from, $to) . '<br>'; |
|
631 | + echo ' '.sprintf(_SDU_MSG_RENAME_TABLE, $from, $to).'<br>'; |
|
632 | 632 | |
633 | 633 | return true; |
634 | 634 | } |
@@ -25,7 +25,7 @@ |
||
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 |
@@ -11,7 +11,7 @@ |
||
11 | 11 | |
12 | 12 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
13 | 13 | |
14 | -require_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
14 | +require_once XOOPS_ROOT_PATH.'/class/uploader.php'; |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * Class sfUploader |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | |
510 | 510 | /** |
511 | 511 | * @param string $url |
512 | - * @return mixed|string |
|
512 | + * @return string |
|
513 | 513 | */ |
514 | 514 | function sf_getxoopslink($url = '') |
515 | 515 | { |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | } |
583 | 583 | |
584 | 584 | /** |
585 | - * @param $name |
|
585 | + * @param string $name |
|
586 | 586 | * @param bool $optional |
587 | 587 | * @return bool |
588 | 588 | */ |
@@ -7,9 +7,9 @@ discard block |
||
7 | 7 | */ |
8 | 8 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
9 | 9 | |
10 | -require_once XOOPS_ROOT_PATH . '/modules/smartfaq/class/category.php'; |
|
11 | -require_once XOOPS_ROOT_PATH . '/modules/smartfaq/class/faq.php'; |
|
12 | -require_once XOOPS_ROOT_PATH . '/modules/smartfaq/class/answer.php'; |
|
10 | +require_once XOOPS_ROOT_PATH.'/modules/smartfaq/class/category.php'; |
|
11 | +require_once XOOPS_ROOT_PATH.'/modules/smartfaq/class/faq.php'; |
|
12 | +require_once XOOPS_ROOT_PATH.'/modules/smartfaq/class/answer.php'; |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * @return mixed|null |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | break; |
64 | 64 | |
65 | 65 | case 'inside': |
66 | - return XOOPS_URL . '/modules/smartfaq/doc/'; |
|
66 | + return XOOPS_URL.'/modules/smartfaq/doc/'; |
|
67 | 67 | break; |
68 | 68 | |
69 | 69 | case 'custom': |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | { |
81 | 81 | $ret = ''; |
82 | 82 | foreach ($errors as $key => $value) { |
83 | - $ret .= '<br> - ' . $value; |
|
83 | + $ret .= '<br> - '.$value; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | return $ret; |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | $spaces .= '--'; |
104 | 104 | } |
105 | 105 | |
106 | - $ret .= "<option value='" . $categoryObj->categoryid() . "'"; |
|
106 | + $ret .= "<option value='".$categoryObj->categoryid()."'"; |
|
107 | 107 | if ($selectedid == $categoryObj->categoryid()) { |
108 | 108 | $ret .= ' selected'; |
109 | 109 | } |
110 | - $ret .= '>' . $spaces . $categoryObj->name() . "</option>\n"; |
|
110 | + $ret .= '>'.$spaces.$categoryObj->name()."</option>\n"; |
|
111 | 111 | |
112 | 112 | $subCategoriesObj = $categoryHandler->getCategories(0, 0, $categoryObj->categoryid()); |
113 | 113 | if (count($subCategoriesObj) > 0) { |
@@ -128,10 +128,10 @@ discard block |
||
128 | 128 | */ |
129 | 129 | function sf_createCategorySelect($selectedid = 0, $parentcategory = 0, $allCatOption = true) |
130 | 130 | { |
131 | - $ret = '' . _MB_SF_SELECTCAT . " <select name='options[]'>"; |
|
131 | + $ret = ''._MB_SF_SELECTCAT." <select name='options[]'>"; |
|
132 | 132 | if ($allCatOption) { |
133 | 133 | $ret .= "<option value='0'"; |
134 | - $ret .= '>' . _MB_SF_ALLCAT . "</option>\n"; |
|
134 | + $ret .= '>'._MB_SF_ALLCAT."</option>\n"; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | // Creating the category handler object |
@@ -199,9 +199,9 @@ discard block |
||
199 | 199 | { |
200 | 200 | $smartModule = sf_getModuleInfo(); |
201 | 201 | |
202 | - $modfootertxt = 'Module ' . $smartModule->getInfo('name') . ' - Version ' . $smartModule->getInfo('version') . ''; |
|
202 | + $modfootertxt = 'Module '.$smartModule->getInfo('name').' - Version '.$smartModule->getInfo('version').''; |
|
203 | 203 | |
204 | - $modfooter = "<a href='" . $smartModule->getInfo('support_site_url') . "' target='_blank'><img src='" . XOOPS_URL . "/modules/smartfaq/assets/images/sfcssbutton.gif' title='" . $modfootertxt . "' alt='" . $modfootertxt . "'></a>"; |
|
204 | + $modfooter = "<a href='".$smartModule->getInfo('support_site_url')."' target='_blank'><img src='".XOOPS_URL."/modules/smartfaq/assets/images/sfcssbutton.gif' title='".$modfootertxt."' alt='".$modfootertxt."'></a>"; |
|
205 | 205 | |
206 | 206 | return $modfooter; |
207 | 207 | } |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | |
298 | 298 | $gpermHandler = xoops_getHandler('groupperm'); |
299 | 299 | |
300 | - $sql = 'SELECT faqid FROM ' . $xoopsDB->prefix('smartfaq_faq') . " WHERE categoryid = '$categoryid' "; |
|
300 | + $sql = 'SELECT faqid FROM '.$xoopsDB->prefix('smartfaq_faq')." WHERE categoryid = '$categoryid' "; |
|
301 | 301 | $result = $xoopsDB->queryF($sql); |
302 | 302 | |
303 | 303 | if (count($result) > 0) { |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | $ret = array(); |
413 | 413 | global $xoopsDB; |
414 | 414 | |
415 | - $result = $xoopsDB->queryF('SELECT * FROM ' . $xoopsDB->prefix('smartfaq_faq') . " WHERE faqid = '$faqid'"); |
|
415 | + $result = $xoopsDB->queryF('SELECT * FROM '.$xoopsDB->prefix('smartfaq_faq')." WHERE faqid = '$faqid'"); |
|
416 | 416 | $ret = $xoopsDB->fetcharray($result); |
417 | 417 | |
418 | 418 | return $ret; |
@@ -431,26 +431,26 @@ discard block |
||
431 | 431 | { |
432 | 432 | global $xoopsUser, $xoopsModule, $xoopsModuleConfig, $xoopsConfig; |
433 | 433 | $adminLinks = ''; |
434 | - $modulePath = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/'; |
|
434 | + $modulePath = XOOPS_URL.'/modules/'.$xoopsModule->dirname().'/'; |
|
435 | 435 | $page = $open ? 'question.php' : 'faq.php'; |
436 | 436 | if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->getVar('mid'))) { |
437 | 437 | // Edit button |
438 | - $adminLinks .= "<a href='" . $modulePath . "admin/$page?op=mod&faqid=" . $faqid . "'><img src='" . $modulePath . "assets/images/links/edit.gif'" . " title='" . _MD_SF_EDIT . "' alt='" . _MD_SF_EDIT . "'></a>"; |
|
438 | + $adminLinks .= "<a href='".$modulePath."admin/$page?op=mod&faqid=".$faqid."'><img src='".$modulePath."assets/images/links/edit.gif'"." title='"._MD_SF_EDIT."' alt='"._MD_SF_EDIT."'></a>"; |
|
439 | 439 | $adminLinks .= ' '; |
440 | 440 | // Delete button |
441 | - $adminLinks .= "<a href='" . $modulePath . "admin/$page?op=del&faqid=" . $faqid . "'><img src='" . $modulePath . "assets/images/links/delete.gif'" . " title='" . _MD_SF_DELETE . "' alt='" . _MD_SF_DELETE . "'></a>"; |
|
441 | + $adminLinks .= "<a href='".$modulePath."admin/$page?op=del&faqid=".$faqid."'><img src='".$modulePath."assets/images/links/delete.gif'"." title='"._MD_SF_DELETE."' alt='"._MD_SF_DELETE."'></a>"; |
|
442 | 442 | $adminLinks .= ' '; |
443 | 443 | } |
444 | 444 | // Print button |
445 | - $adminLinks .= "<a href='" . $modulePath . 'print.php?faqid=' . $faqid . "'><img src='" . $modulePath . "assets/images/links/print.gif' title='" . _MD_SF_PRINT . "' alt='" . _MD_SF_PRINT . "'></a>"; |
|
445 | + $adminLinks .= "<a href='".$modulePath.'print.php?faqid='.$faqid."'><img src='".$modulePath."assets/images/links/print.gif' title='"._MD_SF_PRINT."' alt='"._MD_SF_PRINT."'></a>"; |
|
446 | 446 | $adminLinks .= ' '; |
447 | 447 | // Email button |
448 | - $maillink = 'mailto:?subject=' . sprintf(_MD_SF_INTARTICLE, $xoopsConfig['sitename']) . '&body=' . sprintf(_MD_SF_INTARTFOUND, $xoopsConfig['sitename']) . ': ' . $modulePath . 'faq.php?faqid=' . $faqid; |
|
449 | - $adminLinks .= '<a href="' . $maillink . "\"><img src='" . $modulePath . "assets/images/links/friend.gif' title='" . _MD_SF_MAIL . "' alt='" . _MD_SF_MAIL . "'></a>"; |
|
448 | + $maillink = 'mailto:?subject='.sprintf(_MD_SF_INTARTICLE, $xoopsConfig['sitename']).'&body='.sprintf(_MD_SF_INTARTFOUND, $xoopsConfig['sitename']).': '.$modulePath.'faq.php?faqid='.$faqid; |
|
449 | + $adminLinks .= '<a href="'.$maillink."\"><img src='".$modulePath."assets/images/links/friend.gif' title='"._MD_SF_MAIL."' alt='"._MD_SF_MAIL."'></a>"; |
|
450 | 450 | $adminLinks .= ' '; |
451 | 451 | // Submit New Answer button |
452 | 452 | if ($xoopsModuleConfig['allownewanswer'] && (is_object($xoopsUser) || $xoopsModuleConfig['anonpost'])) { |
453 | - $adminLinks .= "<a href='" . $modulePath . 'answer.php?faqid=' . $faqid . "'><img src='" . $modulePath . "assets/images/links/newanswer.gif' title='" . _MD_SF_SUBMITANSWER . "' alt='" . _MD_SF_SUBMITANSWER . "'></a>"; |
|
453 | + $adminLinks .= "<a href='".$modulePath.'answer.php?faqid='.$faqid."'><img src='".$modulePath."assets/images/links/newanswer.gif' title='"._MD_SF_SUBMITANSWER."' alt='"._MD_SF_SUBMITANSWER."'></a>"; |
|
454 | 454 | $adminLinks .= ' '; |
455 | 455 | } |
456 | 456 | |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | return $userid; |
472 | 472 | } |
473 | 473 | |
474 | - $userid = (int)$userid; |
|
474 | + $userid = (int) $userid; |
|
475 | 475 | if ($userid > 0) { |
476 | 476 | if ($users == array()) { |
477 | 477 | //fetching users |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | if (!isset($users[$userid])) { |
482 | 482 | return $GLOBALS['xoopsConfig']['anonymous']; |
483 | 483 | } |
484 | - $user =& $users[$userid]; |
|
484 | + $user = & $users[$userid]; |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | if (is_object($user)) { |
@@ -495,9 +495,9 @@ discard block |
||
495 | 495 | $fullname = $user->getVar('name'); |
496 | 496 | } |
497 | 497 | if (!empty($fullname)) { |
498 | - $linkeduser = "$fullname [<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . $ts->htmlSpecialChars($username) . '</a>]'; |
|
498 | + $linkeduser = "$fullname [<a href='".XOOPS_URL.'/userinfo.php?uid='.$userid."'>".$ts->htmlSpecialChars($username).'</a>]'; |
|
499 | 499 | } else { |
500 | - $linkeduser = "<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . ucwords($ts->htmlSpecialChars($username)) . '</a>'; |
|
500 | + $linkeduser = "<a href='".XOOPS_URL.'/userinfo.php?uid='.$userid."'>".ucwords($ts->htmlSpecialChars($username)).'</a>'; |
|
501 | 501 | } |
502 | 502 | |
503 | 503 | return $linkeduser; |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | //--> |
580 | 580 | </script> |
581 | 581 | <?php |
582 | - echo "<h3 style=\"color: #2F5376; margin: 6px 0 0 0; \"><a href='#' onClick=\"toggle('" . $tablename . "'); toggleIcon('" . $iconname . "');\">"; |
|
582 | + echo "<h3 style=\"color: #2F5376; margin: 6px 0 0 0; \"><a href='#' onClick=\"toggle('".$tablename."'); toggleIcon('".$iconname."');\">"; |
|
583 | 583 | } |
584 | 584 | |
585 | 585 | /** |
@@ -592,16 +592,16 @@ discard block |
||
592 | 592 | static $handlers; |
593 | 593 | $name = strtolower(trim($name)); |
594 | 594 | if (!isset($handlers[$name])) { |
595 | - if (file_exists($hnd_file = XOOPS_ROOT_PATH . '/modules/smartfaq/class/' . $name . '.php')) { |
|
595 | + if (file_exists($hnd_file = XOOPS_ROOT_PATH.'/modules/smartfaq/class/'.$name.'.php')) { |
|
596 | 596 | require_once $hnd_file; |
597 | 597 | } |
598 | - $class = 'sf' . ucfirst($name) . 'Handler'; |
|
598 | + $class = 'sf'.ucfirst($name).'Handler'; |
|
599 | 599 | if (class_exists($class)) { |
600 | 600 | $handlers[$name] = new $class($GLOBALS['xoopsDB']); |
601 | 601 | } |
602 | 602 | } |
603 | 603 | if (!$optional && !isset($handlers[$name])) { |
604 | - trigger_error('Class <b>' . $class . '</b> does not exist<br>Handler Name: ' . $name, E_USER_ERROR); |
|
604 | + trigger_error('Class <b>'.$class.'</b> does not exist<br>Handler Name: '.$name, E_USER_ERROR); |
|
605 | 605 | } |
606 | 606 | $false = false; |
607 | 607 |
@@ -11,7 +11,7 @@ |
||
11 | 11 | function smartfaq_com_update($faq_id, $total_num) |
12 | 12 | { |
13 | 13 | $db = XoopsDatabaseFactory::getDatabaseConnection(); |
14 | - $sql = 'UPDATE ' . $db->prefix('smartfaq_faq') . ' SET comments = ' . $total_num . ' WHERE faqid = ' . $faq_id; |
|
14 | + $sql = 'UPDATE '.$db->prefix('smartfaq_faq').' SET comments = '.$total_num.' WHERE faqid = '.$faq_id; |
|
15 | 15 | $db->query($sql); |
16 | 16 | } |
17 | 17 |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
246 | - * @return mixed |
|
246 | + * @return integer |
|
247 | 247 | */ |
248 | 248 | public function uid() |
249 | 249 | { |
@@ -754,7 +754,7 @@ discard block |
||
754 | 754 | /** |
755 | 755 | * insert a new faq in the database |
756 | 756 | * |
757 | - * @param XoopsObject $faq reference to the {@link sfFaq} object |
|
757 | + * @param sfFaq $faq reference to the {@link sfFaq} object |
|
758 | 758 | * @param bool $force |
759 | 759 | * @return bool FALSE if failed, TRUE if already present and unchanged or successful |
760 | 760 | */ |
@@ -1143,7 +1143,7 @@ discard block |
||
1143 | 1143 | * @param string $order |
1144 | 1144 | * @param string $notNullFields |
1145 | 1145 | * @param bool $asobject |
1146 | - * @param null $otherCriteria |
|
1146 | + * @param null|CriteriaCompo $otherCriteria |
|
1147 | 1147 | * @return array |
1148 | 1148 | */ |
1149 | 1149 | public function getFaqs( |
@@ -768,12 +768,12 @@ |
||
768 | 768 | |
769 | 769 | if ($faq->isNew()) { |
770 | 770 | $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)', |
771 | - $this->db->prefix('smartfaq_faq'), $categoryid, $this->db->quoteString($question), $this->db->quoteString($howdoi), $this->db->quoteString($diduno), $uid, time(), $status, $counter, $weight, $html, $smiley, $xcodes, $cancomment, $comments, $notifypub, |
|
772 | - $this->db->quoteString($modulelink), $this->db->quoteString($contextpage), $exacturl, $partialview); |
|
771 | + $this->db->prefix('smartfaq_faq'), $categoryid, $this->db->quoteString($question), $this->db->quoteString($howdoi), $this->db->quoteString($diduno), $uid, time(), $status, $counter, $weight, $html, $smiley, $xcodes, $cancomment, $comments, $notifypub, |
|
772 | + $this->db->quoteString($modulelink), $this->db->quoteString($contextpage), $exacturl, $partialview); |
|
773 | 773 | } else { |
774 | 774 | $sql = sprintf('UPDATE "%s" SET categoryid = "%u", question = "%s", howdoi = "%s", diduno = "%s", uid = "%u", datesub = "%u", `status` = "%u", counter = "%u", weight = "%u", html = "%u", smiley = "%u", xcodes = "%u", cancomment = "%u", comments = "%u", notifypub = "%u", modulelink = "%s", contextpage = "%s", exacturl = "%u", partialview = "%u" WHERE faqid = "%u"', |
775 | - $this->db->prefix('smartfaq_faq'), $categoryid, $this->db->quoteString($question), $this->db->quoteString($howdoi), $this->db->quoteString($diduno), $uid, $datesub, $status, $counter, $weight, $html, $smiley, $xcodes, $cancomment, $comments, $notifypub, |
|
776 | - $this->db->quoteString($modulelink), $this->db->quoteString($contextpage), $exacturl, $partialview, $faqid); |
|
775 | + $this->db->prefix('smartfaq_faq'), $categoryid, $this->db->quoteString($question), $this->db->quoteString($howdoi), $this->db->quoteString($diduno), $uid, $datesub, $status, $counter, $weight, $html, $smiley, $xcodes, $cancomment, $comments, $notifypub, |
|
776 | + $this->db->quoteString($modulelink), $this->db->quoteString($contextpage), $exacturl, $partialview, $faqid); |
|
777 | 777 | } |
778 | 778 | if (false !== $force) { |
779 | 779 | $result = $this->db->queryF($sql); |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
10 | 10 | |
11 | -require_once XOOPS_ROOT_PATH . '/modules/smartfaq/class/category.php'; |
|
11 | +require_once XOOPS_ROOT_PATH.'/modules/smartfaq/class/category.php'; |
|
12 | 12 | |
13 | 13 | // FAQ status |
14 | 14 | define('_SF_STATUS_NOTSET', -1); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | if (null !== $id) { |
106 | 106 | $faqHandler = new sfFaqHandler($this->db); |
107 | - $faq =& $faqHandler->get($id); |
|
107 | + $faq = & $faqHandler->get($id); |
|
108 | 108 | foreach ($faq->vars as $k => $v) { |
109 | 109 | $this->assignVar($k, $v['value']); |
110 | 110 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public function checkPermission() |
130 | 130 | { |
131 | - require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; |
|
131 | + require_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php'; |
|
132 | 132 | |
133 | 133 | $userIsAdmin = sf_userIsAdmin(); |
134 | 134 | if ($userIsAdmin) { |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | if ($maxLength != 0) { |
205 | 205 | if (!XOOPS_USE_MULTIBYTES) { |
206 | 206 | if (strlen($ret) >= $maxLength) { |
207 | - $ret = substr($ret, 0, $maxLength - 1) . '...'; |
|
207 | + $ret = substr($ret, 0, $maxLength-1).'...'; |
|
208 | 208 | } |
209 | 209 | } |
210 | 210 | } |
@@ -396,14 +396,14 @@ discard block |
||
396 | 396 | $theAnswers = $answerHandler->getAllAnswers($this->faqid(), _SF_AN_STATUS_APPROVED, 1, 0); |
397 | 397 | //echo "test"; |
398 | 398 | //exit; |
399 | - $this->answer =& $theAnswers[0]; |
|
399 | + $this->answer = & $theAnswers[0]; |
|
400 | 400 | break; |
401 | 401 | |
402 | 402 | case _SF_STATUS_ANSWERED: |
403 | 403 | $theAnswers = $answerHandler->getAllAnswers($this->faqid(), _SF_AN_STATUS_PROPOSED, 1, 0); |
404 | 404 | //echo "test"; |
405 | 405 | //exit; |
406 | - $this->answer =& $theAnswers[0]; |
|
406 | + $this->answer = & $theAnswers[0]; |
|
407 | 407 | break; |
408 | 408 | |
409 | 409 | case _SF_STATUS_PUBLISHED: |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | $tags['MODULE_NAME'] = $myts->displayTarea($smartModule->getVar('name')); |
490 | 490 | $tags['FAQ_NAME'] = $this->question(); |
491 | 491 | $tags['CATEGORY_NAME'] = $this->getCategoryName(); |
492 | - $tags['CATEGORY_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/category.php?categoryid=' . $this->categoryid(); |
|
492 | + $tags['CATEGORY_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/category.php?categoryid='.$this->categoryid(); |
|
493 | 493 | $tags['FAQ_QUESTION'] = $this->question(); |
494 | 494 | $answerObj = $this->answer(); |
495 | 495 | if (is_object($answerObj)) { |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | foreach ($notifications as $notification) { |
502 | 502 | switch ($notification) { |
503 | 503 | case _SF_NOT_FAQ_PUBLISHED: |
504 | - $tags['FAQ_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/faq.php?faqid=' . $this->faqid(); |
|
504 | + $tags['FAQ_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/faq.php?faqid='.$this->faqid(); |
|
505 | 505 | |
506 | 506 | $notificationHandler->triggerEvent('global_faq', 0, 'published', $tags); |
507 | 507 | $notificationHandler->triggerEvent('category_faq', $this->categoryid(), 'published', $tags); |
@@ -509,20 +509,20 @@ discard block |
||
509 | 509 | break; |
510 | 510 | |
511 | 511 | case _SF_NOT_FAQ_SUBMITTED: |
512 | - $tags['WAITINGFILES_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/admin/faq.php?faqid=' . $this->faqid(); |
|
512 | + $tags['WAITINGFILES_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/admin/faq.php?faqid='.$this->faqid(); |
|
513 | 513 | $notificationHandler->triggerEvent('global_faq', 0, 'submitted', $tags); |
514 | 514 | $notificationHandler->triggerEvent('category_faq', $this->categoryid(), 'submitted', $tags); |
515 | 515 | break; |
516 | 516 | |
517 | 517 | case _SF_NOT_QUESTION_PUBLISHED: |
518 | - $tags['FAQ_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/answer.php?faqid=' . $this->faqid(); |
|
518 | + $tags['FAQ_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/answer.php?faqid='.$this->faqid(); |
|
519 | 519 | $notificationHandler->triggerEvent('global_question', 0, 'published', $tags); |
520 | 520 | $notificationHandler->triggerEvent('category_question', $this->categoryid(), 'published', $tags); |
521 | 521 | $notificationHandler->triggerEvent('question', $this->faqid(), 'approved', $tags); |
522 | 522 | break; |
523 | 523 | |
524 | 524 | case _SF_NOT_QUESTION_SUBMITTED: |
525 | - $tags['WAITINGFILES_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/admin/question.php?op=mod&faqid=' . $this->faqid(); |
|
525 | + $tags['WAITINGFILES_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/admin/question.php?op=mod&faqid='.$this->faqid(); |
|
526 | 526 | $notificationHandler->triggerEvent('global_question', 0, 'submitted', $tags); |
527 | 527 | $notificationHandler->triggerEvent('category_question', $this->categoryid(), 'submitted', $tags); |
528 | 528 | break; |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | break; |
533 | 533 | |
534 | 534 | case _SF_NOT_NEW_ANSWER_PROPOSED: |
535 | - $tags['WAITINGFILES_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/admin/answer.php?op=mod&faqid=' . $this->faqid(); |
|
535 | + $tags['WAITINGFILES_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/admin/answer.php?op=mod&faqid='.$this->faqid(); |
|
536 | 536 | $notificationHandler->triggerEvent('global_faq', 0, 'answer_proposed', $tags); |
537 | 537 | $notificationHandler->triggerEvent('category_faq', $this->categoryid(), 'answer_proposed', $tags); |
538 | 538 | break; |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | $text = _MD_SF_FAQCOMEFROM; |
647 | 647 | } |
648 | 648 | |
649 | - 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>'; |
|
649 | + 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>'; |
|
650 | 650 | } |
651 | 651 | |
652 | 652 | /** |
@@ -658,16 +658,16 @@ discard block |
||
658 | 658 | public function toArray($faq = array(), $category = null, $linkInQuestion = true) |
659 | 659 | { |
660 | 660 | global $xoopsModuleConfig; |
661 | - $lastfaqsize = (int)$xoopsModuleConfig['lastfaqsize']; |
|
661 | + $lastfaqsize = (int) $xoopsModuleConfig['lastfaqsize']; |
|
662 | 662 | |
663 | 663 | $faq['id'] = $this->faqid(); |
664 | 664 | $faq['categoryid'] = $this->categoryid(); |
665 | 665 | $faq['question'] = $this->question(); |
666 | 666 | $page = ($this->status() == _SF_STATUS_OPENED) ? 'answer.php' : 'faq.php'; |
667 | 667 | |
668 | - $faq['questionlink'] = "<a href='$page?faqid=" . $this->faqid() . "'>" . $this->question($lastfaqsize) . '</a>'; |
|
668 | + $faq['questionlink'] = "<a href='$page?faqid=".$this->faqid()."'>".$this->question($lastfaqsize).'</a>'; |
|
669 | 669 | if ($linkInQuestion) { |
670 | - $faq['fullquestionlink'] = "<a href='$page?faqid=" . $this->faqid() . "'>" . $this->question() . '</a>'; |
|
670 | + $faq['fullquestionlink'] = "<a href='$page?faqid=".$this->faqid()."'>".$this->question().'</a>'; |
|
671 | 671 | } else { |
672 | 672 | $faq['fullquestionlink'] = $this->question(); |
673 | 673 | } |
@@ -683,7 +683,7 @@ discard block |
||
683 | 683 | $categoryObj = $category[$this->categoryid()]; |
684 | 684 | } |
685 | 685 | $faq['categoryname'] = $categoryObj->getVar('name'); |
686 | - $faq['categorylink'] = "<a href='" . XOOPS_URL . '/modules/smartfaq/category.php?categoryid=' . $this->categoryid() . "'>" . $categoryObj->getVar('name') . '</a>'; |
|
686 | + $faq['categorylink'] = "<a href='".XOOPS_URL.'/modules/smartfaq/category.php?categoryid='.$this->categoryid()."'>".$categoryObj->getVar('name').'</a>'; |
|
687 | 687 | } |
688 | 688 | |
689 | 689 | return $faq; |
@@ -723,8 +723,8 @@ discard block |
||
723 | 723 | */ |
724 | 724 | public function get($id) |
725 | 725 | { |
726 | - if ((int)$id > 0) { |
|
727 | - $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_faq') . ' WHERE faqid=' . $id; |
|
726 | + if ((int) $id > 0) { |
|
727 | + $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_faq').' WHERE faqid='.$id; |
|
728 | 728 | if (!$result = $this->db->query($sql)) { |
729 | 729 | return false; |
730 | 730 | } |
@@ -845,26 +845,26 @@ discard block |
||
845 | 845 | { |
846 | 846 | $ret = array(); |
847 | 847 | $limit = $start = 0; |
848 | - $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_faq'); |
|
848 | + $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_faq'); |
|
849 | 849 | |
850 | 850 | if (null !== $criteria && is_subclass_of($criteria, 'criteriaelement')) { |
851 | 851 | $whereClause = $criteria->renderWhere(); |
852 | 852 | |
853 | 853 | if ($whereClause !== 'WHERE ()') { |
854 | - $sql .= ' ' . $criteria->renderWhere(); |
|
854 | + $sql .= ' '.$criteria->renderWhere(); |
|
855 | 855 | if (!empty($notNullFields)) { |
856 | 856 | $sql .= $this->NotNullFieldClause($notNullFields, true); |
857 | 857 | } |
858 | 858 | } elseif (!empty($notNullFields)) { |
859 | - $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
859 | + $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
860 | 860 | } |
861 | 861 | if ($criteria->getSort() != '') { |
862 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
862 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
863 | 863 | } |
864 | 864 | $limit = $criteria->getLimit(); |
865 | 865 | $start = $criteria->getStart(); |
866 | 866 | } elseif (!empty($notNullFields)) { |
867 | - $sql .= $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
867 | + $sql .= $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
868 | 868 | } |
869 | 869 | |
870 | 870 | //echo "<br>" . $sql . "<br>"; |
@@ -882,9 +882,9 @@ discard block |
||
882 | 882 | $faq->assignVars($myrow); |
883 | 883 | |
884 | 884 | if (!$id_as_key) { |
885 | - $ret[] =& $faq; |
|
885 | + $ret[] = & $faq; |
|
886 | 886 | } else { |
887 | - $ret[$myrow['faqid']] =& $faq; |
|
887 | + $ret[$myrow['faqid']] = & $faq; |
|
888 | 888 | } |
889 | 889 | unset($faq); |
890 | 890 | } |
@@ -924,26 +924,26 @@ discard block |
||
924 | 924 | faq.modulelink AS modulelink, |
925 | 925 | faq.contextpage AS contextpage, |
926 | 926 | faq.exacturl AS exacturl |
927 | - FROM ' . $this->db->prefix('smartfaq_faq') . ' AS faq INNER JOIN ' . $this->db->prefix('smartfaq_categories') . ' AS category ON faq.categoryid = category.categoryid '; |
|
927 | + FROM ' . $this->db->prefix('smartfaq_faq').' AS faq INNER JOIN '.$this->db->prefix('smartfaq_categories').' AS category ON faq.categoryid = category.categoryid '; |
|
928 | 928 | |
929 | 929 | if (null !== $criteria && is_subclass_of($criteria, 'criteriaelement')) { |
930 | 930 | $whereClause = $criteria->renderWhere(); |
931 | 931 | |
932 | 932 | if ($whereClause !== 'WHERE ()') { |
933 | - $sql .= ' ' . $criteria->renderWhere(); |
|
933 | + $sql .= ' '.$criteria->renderWhere(); |
|
934 | 934 | if (!empty($notNullFields)) { |
935 | 935 | $sql .= $this->NotNullFieldClause($notNullFields, true); |
936 | 936 | } |
937 | 937 | } elseif (!empty($notNullFields)) { |
938 | - $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
938 | + $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
939 | 939 | } |
940 | 940 | if ($criteria->getSort() != '') { |
941 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
941 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
942 | 942 | } |
943 | 943 | $limit = $criteria->getLimit(); |
944 | 944 | $start = $criteria->getStart(); |
945 | 945 | } elseif (!empty($notNullFields)) { |
946 | - $sql .= $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
946 | + $sql .= $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
947 | 947 | } |
948 | 948 | |
949 | 949 | //echo "<br>" . $sql . "<br>"; |
@@ -961,9 +961,9 @@ discard block |
||
961 | 961 | $faq->assignVars($myrow); |
962 | 962 | |
963 | 963 | if (!$id_as_key) { |
964 | - $ret[] =& $faq; |
|
964 | + $ret[] = & $faq; |
|
965 | 965 | } else { |
966 | - $ret[$myrow['faqid']] =& $faq; |
|
966 | + $ret[$myrow['faqid']] = & $faq; |
|
967 | 967 | } |
968 | 968 | unset($faq); |
969 | 969 | } |
@@ -993,19 +993,19 @@ discard block |
||
993 | 993 | */ |
994 | 994 | public function getCount($criteria = null, $notNullFields = '') |
995 | 995 | { |
996 | - $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_faq'); |
|
996 | + $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('smartfaq_faq'); |
|
997 | 997 | if (null !== $criteria && is_subclass_of($criteria, 'criteriaelement')) { |
998 | 998 | $whereClause = $criteria->renderWhere(); |
999 | 999 | if ($whereClause !== 'WHERE ()') { |
1000 | - $sql .= ' ' . $criteria->renderWhere(); |
|
1000 | + $sql .= ' '.$criteria->renderWhere(); |
|
1001 | 1001 | if (!empty($notNullFields)) { |
1002 | 1002 | $sql .= $this->NotNullFieldClause($notNullFields, true); |
1003 | 1003 | } |
1004 | 1004 | } elseif (!empty($notNullFields)) { |
1005 | - $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
1005 | + $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
1006 | 1006 | } |
1007 | 1007 | } elseif (!empty($notNullFields)) { |
1008 | - $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
1008 | + $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
1009 | 1009 | } |
1010 | 1010 | |
1011 | 1011 | //echo "<br>" . $sql . "<br>"; |
@@ -1038,11 +1038,11 @@ discard block |
||
1038 | 1038 | $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq'); |
1039 | 1039 | |
1040 | 1040 | $categoriesGranted = $smartPermHandler->getPermissions('category'); |
1041 | - $grantedCategories = new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'); |
|
1041 | + $grantedCategories = new Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN'); |
|
1042 | 1042 | |
1043 | 1043 | $faqsGranted = $smartPermHandler->getPermissions('item'); |
1044 | 1044 | $grantedFaq = new CriteriaCompo(); |
1045 | - $grantedFaq->add(new Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR'); |
|
1045 | + $grantedFaq->add(new Criteria('faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR'); |
|
1046 | 1046 | // If user is anonymous, check if the FAQ allow partialview |
1047 | 1047 | if (!is_object($xoopsUser)) { |
1048 | 1048 | $grantedFaq->add(new Criteria('partialview', '1'), 'OR'); |
@@ -1089,7 +1089,7 @@ discard block |
||
1089 | 1089 | */ |
1090 | 1090 | public function getFaqsCountByStatus() |
1091 | 1091 | { |
1092 | - $sql = 'SELECT status, COUNT(*) FROM ' . $this->db->prefix('smartfaq_faq') . ' GROUP BY status'; |
|
1092 | + $sql = 'SELECT status, COUNT(*) FROM '.$this->db->prefix('smartfaq_faq').' GROUP BY status'; |
|
1093 | 1093 | $result = $this->db->query($sql); |
1094 | 1094 | if (!$result) { |
1095 | 1095 | return array(); |
@@ -1146,7 +1146,7 @@ discard block |
||
1146 | 1146 | $otherCriteria = null |
1147 | 1147 | ) { |
1148 | 1148 | global $xoopsUser; |
1149 | - require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; |
|
1149 | + require_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php'; |
|
1150 | 1150 | |
1151 | 1151 | //if ( ($categoryid == -1) && (empty($status) || ($status == -1)) && ($limit == 0) && ($start ==0) ) { |
1152 | 1152 | // return $this->getObjects(); |
@@ -1158,11 +1158,11 @@ discard block |
||
1158 | 1158 | $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq'); |
1159 | 1159 | |
1160 | 1160 | $categoriesGranted = $smartPermHandler->getPermissions('category'); |
1161 | - $grantedCategories = new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'); |
|
1161 | + $grantedCategories = new Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN'); |
|
1162 | 1162 | |
1163 | 1163 | $faqsGranted = $smartPermHandler->getPermissions('item'); |
1164 | 1164 | $grantedFaq = new CriteriaCompo(); |
1165 | - $grantedFaq->add(new Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR'); |
|
1165 | + $grantedFaq->add(new Criteria('faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR'); |
|
1166 | 1166 | // If user is anonymous, check if the FAQ allow partialview |
1167 | 1167 | if (!is_object($xoopsUser)) { |
1168 | 1168 | $grantedFaq->add(new Criteria('partialview', '1'), 'OR'); |
@@ -1171,9 +1171,9 @@ discard block |
||
1171 | 1171 | |
1172 | 1172 | if (isset($categoryid) && ($categoryid != -1)) { |
1173 | 1173 | if (is_array($categoryid)) { |
1174 | - $criteriaCategory = new Criteria('categoryid', '(' . implode(',', $categoryid) . ')', 'IN'); |
|
1174 | + $criteriaCategory = new Criteria('categoryid', '('.implode(',', $categoryid).')', 'IN'); |
|
1175 | 1175 | } else { |
1176 | - $criteriaCategory = new Criteria('categoryid', (int)$categoryid); |
|
1176 | + $criteriaCategory = new Criteria('categoryid', (int) $categoryid); |
|
1177 | 1177 | } |
1178 | 1178 | } |
1179 | 1179 | |
@@ -1240,7 +1240,7 @@ discard block |
||
1240 | 1240 | $asobject = true, |
1241 | 1241 | $otherCriteria = null |
1242 | 1242 | ) { |
1243 | - require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; |
|
1243 | + require_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php'; |
|
1244 | 1244 | |
1245 | 1245 | $smartModule = sf_getModuleInfo(); |
1246 | 1246 | |
@@ -1299,11 +1299,11 @@ discard block |
||
1299 | 1299 | |
1300 | 1300 | if ($totalFaqs > 0) { |
1301 | 1301 | --$totalFaqs; |
1302 | - mt_srand((double)microtime() * 1000000); |
|
1302 | + mt_srand((double) microtime() * 1000000); |
|
1303 | 1303 | $entrynumber = mt_rand(0, $totalFaqs); |
1304 | 1304 | $faq = $this->getFaqs(1, $entrynumber, $status, -1, 'datesub', 'DESC', $notNullFields); |
1305 | 1305 | if ($faq) { |
1306 | - $ret =& $faq[0]; |
|
1306 | + $ret = & $faq[0]; |
|
1307 | 1307 | } |
1308 | 1308 | } |
1309 | 1309 | |
@@ -1334,10 +1334,10 @@ discard block |
||
1334 | 1334 | $httphost = $_SERVER['HTTP_HOST']; |
1335 | 1335 | $querystring = $_SERVER['QUERY_STRING']; |
1336 | 1336 | if ($querystring != '') { |
1337 | - $querystring = '?' . $querystring; |
|
1337 | + $querystring = '?'.$querystring; |
|
1338 | 1338 | } |
1339 | - $currenturl = $http . $httphost . $phpself . $querystring; |
|
1340 | - $fullcontexturl = XOOPS_URL . '/' . $faqsObj[$i]->contextpage(); |
|
1339 | + $currenturl = $http.$httphost.$phpself.$querystring; |
|
1340 | + $fullcontexturl = XOOPS_URL.'/'.$faqsObj[$i]->contextpage(); |
|
1341 | 1341 | switch ($faqsObj[$i]->modulelink()) { |
1342 | 1342 | case '': |
1343 | 1343 | $display = false; |
@@ -1356,7 +1356,7 @@ discard block |
||
1356 | 1356 | } |
1357 | 1357 | break; |
1358 | 1358 | default: |
1359 | - if (strpos($currenturl, XOOPS_URL . '/modules/') === false) { |
|
1359 | + if (strpos($currenturl, XOOPS_URL.'/modules/') === false) { |
|
1360 | 1360 | $display = false; |
1361 | 1361 | } else { |
1362 | 1362 | if (strpos($currenturl, $faqsObj[$i]->modulelink()) === false) { |
@@ -1368,19 +1368,19 @@ discard block |
||
1368 | 1368 | break; |
1369 | 1369 | } |
1370 | 1370 | if ($display) { |
1371 | - $randomFaqs[] =& $faqsObj[$i]; |
|
1371 | + $randomFaqs[] = & $faqsObj[$i]; |
|
1372 | 1372 | } |
1373 | 1373 | } |
1374 | 1374 | } |
1375 | 1375 | |
1376 | 1376 | if (count($randomFaqs) > $limit) { |
1377 | - mt_srand((float)microtime() * 10000000); |
|
1377 | + mt_srand((float) microtime() * 10000000); |
|
1378 | 1378 | $rand_keys = array_rand($randomFaqs, $limit); |
1379 | 1379 | for ($j = 0, $jMax = count($rand_keys); $j < $jMax; ++$j) { |
1380 | - $ret[] =& $randomFaqs[$rand_keys[$j]]; |
|
1380 | + $ret[] = & $randomFaqs[$rand_keys[$j]]; |
|
1381 | 1381 | } |
1382 | 1382 | } else { |
1383 | - $ret =& $randomFaqs; |
|
1383 | + $ret = & $randomFaqs; |
|
1384 | 1384 | } |
1385 | 1385 | |
1386 | 1386 | return $ret; |
@@ -1397,14 +1397,14 @@ discard block |
||
1397 | 1397 | if (!sf_userIsAdmin()) { |
1398 | 1398 | $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq'); |
1399 | 1399 | $items = $smartPermHandler->getPermissions('item'); |
1400 | - $faqclause = ' AND faqid IN (' . implode(',', $items) . ')'; |
|
1400 | + $faqclause = ' AND faqid IN ('.implode(',', $items).')'; |
|
1401 | 1401 | } |
1402 | 1402 | |
1403 | 1403 | $sql = "CREATE TEMPORARY TABLE tmp (categoryid INT(8) UNSIGNED NOT NULL,datesub INT(11) DEFAULT '0' NOT NULL);"; |
1404 | - $sql2 = ' LOCK TABLES ' . $this->db->prefix('smartfaq_faq') . ' READ;'; |
|
1405 | - $sql3 = ' INSERT INTO tmp SELECT categoryid, MAX(datesub) FROM ' . $this->db->prefix('smartfaq_faq') . ' WHERE status IN (' . implode(',', $status) . ") $faqclause GROUP BY categoryid;"; |
|
1406 | - $sql4 = ' SELECT ' . $this->db->prefix('smartfaq_faq') . '.categoryid, faqid, question, uid, ' . $this->db->prefix('smartfaq_faq') . '.datesub FROM ' . $this->db->prefix('smartfaq_faq') . ', tmp |
|
1407 | - WHERE ' . $this->db->prefix('smartfaq_faq') . '.categoryid=tmp.categoryid AND ' . $this->db->prefix('smartfaq_faq') . '.datesub=tmp.datesub;'; |
|
1404 | + $sql2 = ' LOCK TABLES '.$this->db->prefix('smartfaq_faq').' READ;'; |
|
1405 | + $sql3 = ' INSERT INTO tmp SELECT categoryid, MAX(datesub) FROM '.$this->db->prefix('smartfaq_faq').' WHERE status IN ('.implode(',', $status).") $faqclause GROUP BY categoryid;"; |
|
1406 | + $sql4 = ' SELECT '.$this->db->prefix('smartfaq_faq').'.categoryid, faqid, question, uid, '.$this->db->prefix('smartfaq_faq').'.datesub FROM '.$this->db->prefix('smartfaq_faq').', tmp |
|
1407 | + WHERE ' . $this->db->prefix('smartfaq_faq').'.categoryid=tmp.categoryid AND '.$this->db->prefix('smartfaq_faq').'.datesub=tmp.datesub;'; |
|
1408 | 1408 | /* |
1409 | 1409 | //Old implementation |
1410 | 1410 | $sql = "SELECT categoryid, faqid, question, uid, MAX(datesub) AS datesub FROM ".$this->db->prefix("smartfaq_faq")." |
@@ -1419,14 +1419,14 @@ discard block |
||
1419 | 1419 | $this->db->queryF('UNLOCK TABLES;'); |
1420 | 1420 | $this->db->queryF('DROP TABLE tmp;'); |
1421 | 1421 | if (!$result) { |
1422 | - trigger_error('Error in getLastPublishedByCat SQL: ' . $error); |
|
1422 | + trigger_error('Error in getLastPublishedByCat SQL: '.$error); |
|
1423 | 1423 | |
1424 | 1424 | return $ret; |
1425 | 1425 | } |
1426 | 1426 | while ($row = $this->db->fetchArray($result)) { |
1427 | 1427 | $faq = new sfFaq(); |
1428 | 1428 | $faq->assignVars($row); |
1429 | - $ret[$row['categoryid']] =& $faq; |
|
1429 | + $ret[$row['categoryid']] = & $faq; |
|
1430 | 1430 | unset($faq); |
1431 | 1431 | } |
1432 | 1432 | |
@@ -1441,9 +1441,9 @@ discard block |
||
1441 | 1441 | */ |
1442 | 1442 | public function deleteAll($criteria = null) |
1443 | 1443 | { |
1444 | - $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_faq'); |
|
1444 | + $sql = 'DELETE FROM '.$this->db->prefix('smartfaq_faq'); |
|
1445 | 1445 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
1446 | - $sql .= ' ' . $criteria->renderWhere(); |
|
1446 | + $sql .= ' '.$criteria->renderWhere(); |
|
1447 | 1447 | } |
1448 | 1448 | if (!$this->db->query($sql)) { |
1449 | 1449 | return false; |
@@ -1464,10 +1464,10 @@ discard block |
||
1464 | 1464 | **/ |
1465 | 1465 | public function updateAll($fieldname, $fieldvalue, $criteria = null) |
1466 | 1466 | { |
1467 | - $set_clause = is_numeric($fieldvalue) ? $fieldname . ' = ' . $fieldvalue : $fieldname . ' = ' . $this->db->quoteString($fieldvalue); |
|
1468 | - $sql = 'UPDATE ' . $this->db->prefix('smartfaq_faq') . ' SET ' . $set_clause; |
|
1467 | + $set_clause = is_numeric($fieldvalue) ? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue); |
|
1468 | + $sql = 'UPDATE '.$this->db->prefix('smartfaq_faq').' SET '.$set_clause; |
|
1469 | 1469 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
1470 | - $sql .= ' ' . $criteria->renderWhere(); |
|
1470 | + $sql .= ' '.$criteria->renderWhere(); |
|
1471 | 1471 | } |
1472 | 1472 | if (!$this->db->queryF($sql)) { |
1473 | 1473 | return false; |
@@ -1482,7 +1482,7 @@ discard block |
||
1482 | 1482 | */ |
1483 | 1483 | public function updateCounter($faqid) |
1484 | 1484 | { |
1485 | - $sql = 'UPDATE ' . $this->db->prefix('smartfaq_faq') . ' SET counter=counter+1 WHERE faqid = ' . $faqid; |
|
1485 | + $sql = 'UPDATE '.$this->db->prefix('smartfaq_faq').' SET counter=counter+1 WHERE faqid = '.$faqid; |
|
1486 | 1486 | if ($this->db->queryF($sql)) { |
1487 | 1487 | return true; |
1488 | 1488 | } else { |
@@ -1538,8 +1538,8 @@ discard block |
||
1538 | 1538 | $criteriaKeywords = new CriteriaCompo(); |
1539 | 1539 | for ($i = 0, $iMax = count($queryarray); $i < $iMax; ++$i) { |
1540 | 1540 | $criteriaKeyword = new CriteriaCompo(); |
1541 | - $criteriaKeyword->add(new Criteria('faq.question', '%' . $queryarray[$i] . '%', 'LIKE'), 'OR'); |
|
1542 | - $criteriaKeyword->add(new Criteria('answer.answer', '%' . $queryarray[$i] . '%', 'LIKE'), 'OR'); |
|
1541 | + $criteriaKeyword->add(new Criteria('faq.question', '%'.$queryarray[$i].'%', 'LIKE'), 'OR'); |
|
1542 | + $criteriaKeyword->add(new Criteria('answer.answer', '%'.$queryarray[$i].'%', 'LIKE'), 'OR'); |
|
1543 | 1543 | $criteriaKeywords->add($criteriaKeyword, $andor); |
1544 | 1544 | unset($criteriaKeyword); |
1545 | 1545 | } |
@@ -1557,9 +1557,9 @@ discard block |
||
1557 | 1557 | if (!$faqsGranted) { |
1558 | 1558 | return $ret; |
1559 | 1559 | } |
1560 | - $grantedCategories = new Criteria('faq.categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'); |
|
1560 | + $grantedCategories = new Criteria('faq.categoryid', '('.implode(',', $categoriesGranted).')', 'IN'); |
|
1561 | 1561 | $grantedFaq = new CriteriaCompo(); |
1562 | - $grantedFaq->add(new Criteria('faq.faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR'); |
|
1562 | + $grantedFaq->add(new Criteria('faq.faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR'); |
|
1563 | 1563 | // If user is anonymous, check if the FAQ allow partialview |
1564 | 1564 | if (!is_object($xoopsUser)) { |
1565 | 1565 | $grantedFaq->add(new Criteria('partialview', '1'), 'OR'); |
@@ -1605,15 +1605,15 @@ discard block |
||
1605 | 1605 | $criteria->setSort('faq.datesub'); |
1606 | 1606 | $criteria->setOrder('DESC'); |
1607 | 1607 | |
1608 | - $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'; |
|
1608 | + $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'; |
|
1609 | 1609 | |
1610 | 1610 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
1611 | 1611 | $whereClause = $criteria->renderWhere(); |
1612 | 1612 | |
1613 | 1613 | if ($whereClause !== 'WHERE ()') { |
1614 | - $sql .= ' ' . $criteria->renderWhere(); |
|
1614 | + $sql .= ' '.$criteria->renderWhere(); |
|
1615 | 1615 | if ($criteria->getSort() != '') { |
1616 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
1616 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
1617 | 1617 | } |
1618 | 1618 | $limit = $criteria->getLimit(); |
1619 | 1619 | $start = $criteria->getStart(); |
@@ -1636,7 +1636,7 @@ discard block |
||
1636 | 1636 | while ($myrow = $this->db->fetchArray($result)) { |
1637 | 1637 | $faq = new sfFaq(); |
1638 | 1638 | $faq->assignVars($myrow); |
1639 | - $ret[] =& $faq; |
|
1639 | + $ret[] = & $faq; |
|
1640 | 1640 | unset($faq); |
1641 | 1641 | } |
1642 | 1642 | |
@@ -1652,19 +1652,19 @@ discard block |
||
1652 | 1652 | { |
1653 | 1653 | global $xoopsUser; |
1654 | 1654 | $ret = array(); |
1655 | - $sql = 'SELECT categoryid, COUNT(*) AS count FROM ' . $this->db->prefix('smartfaq_faq'); |
|
1656 | - if ((int)$cat_id > 0) { |
|
1657 | - $sql .= ' WHERE categoryid = ' . (int)$cat_id; |
|
1658 | - $sql .= ' AND status IN (' . implode(',', $status) . ')'; |
|
1655 | + $sql = 'SELECT categoryid, COUNT(*) AS count FROM '.$this->db->prefix('smartfaq_faq'); |
|
1656 | + if ((int) $cat_id > 0) { |
|
1657 | + $sql .= ' WHERE categoryid = '.(int) $cat_id; |
|
1658 | + $sql .= ' AND status IN ('.implode(',', $status).')'; |
|
1659 | 1659 | } else { |
1660 | - $sql .= ' WHERE status IN (' . implode(',', $status) . ')'; |
|
1660 | + $sql .= ' WHERE status IN ('.implode(',', $status).')'; |
|
1661 | 1661 | if (!sf_userIsAdmin()) { |
1662 | 1662 | $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq'); |
1663 | 1663 | $items = $smartPermHandler->getPermissions('item'); |
1664 | 1664 | if (is_object($xoopsUser)) { |
1665 | - $sql .= ' AND faqid IN (' . implode(',', $items) . ')'; |
|
1665 | + $sql .= ' AND faqid IN ('.implode(',', $items).')'; |
|
1666 | 1666 | } else { |
1667 | - $sql .= ' AND (faqid IN (' . implode(',', $items) . ') OR partialview = 1)'; |
|
1667 | + $sql .= ' AND (faqid IN ('.implode(',', $items).') OR partialview = 1)'; |
|
1668 | 1668 | } |
1669 | 1669 | } |
1670 | 1670 | } |
@@ -1677,7 +1677,7 @@ discard block |
||
1677 | 1677 | return $ret; |
1678 | 1678 | } |
1679 | 1679 | while ($row = $this->db->fetchArray($result)) { |
1680 | - $ret[$row['categoryid']] = (int)$row['count']; |
|
1680 | + $ret[$row['categoryid']] = (int) $row['count']; |
|
1681 | 1681 | } |
1682 | 1682 | |
1683 | 1683 | return $ret; |