@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | function xoops_module_update_smartfaq($module) |
10 | 10 | { |
11 | 11 | // Load SmartDbUpdater from the SmartObject Framework if present |
12 | - $smartdbupdater = XOOPS_ROOT_PATH . '/modules/smartobject/class/smartdbupdater.php'; |
|
12 | + $smartdbupdater = XOOPS_ROOT_PATH.'/modules/smartobject/class/smartdbupdater.php'; |
|
13 | 13 | if (!file_exists($smartdbupdater)) { |
14 | - $smartdbupdater = XOOPS_ROOT_PATH . '/modules/smartfaq/class/smartdbupdater.php'; |
|
14 | + $smartdbupdater = XOOPS_ROOT_PATH.'/modules/smartfaq/class/smartdbupdater.php'; |
|
15 | 15 | } |
16 | 16 | require_once $smartdbupdater; |
17 | 17 | |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | ob_start(); |
21 | 21 | |
22 | - echo '<code>' . _SDU_UPDATE_UPDATING_DATABASE . '<br>'; |
|
22 | + echo '<code>'._SDU_UPDATE_UPDATING_DATABASE.'<br>'; |
|
23 | 23 | |
24 | 24 | // Adding partialview field |
25 | 25 | $table = new SmartDbTable('smartfaq_faq'); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | /** |
71 | 71 | * Check for items with categoryid=0 |
72 | 72 | */ |
73 | - require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; |
|
73 | + require_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php'; |
|
74 | 74 | $smartfaq_faqHandler = $answerHandler = sf_gethandler('faq'); |
75 | 75 | $smartfaq_categoryHandler = $answerHandler = sf_gethandler('category'); |
76 | 76 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | { |
105 | 105 | ob_start(); |
106 | 106 | |
107 | - require_once XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname') . '/include/functions.php'; |
|
107 | + require_once XOOPS_ROOT_PATH.'/modules/'.$module->getVar('dirname').'/include/functions.php'; |
|
108 | 108 | |
109 | 109 | $feedback = ob_get_clean(); |
110 | 110 | if (method_exists($module, 'setMessage')) { |
@@ -6,15 +6,15 @@ discard block |
||
6 | 6 | * Licence: GNU |
7 | 7 | */ |
8 | 8 | |
9 | -require_once __DIR__ . '/header.php'; |
|
9 | +require_once __DIR__.'/header.php'; |
|
10 | 10 | |
11 | 11 | global $xoopsConfig, $xoopsModuleConfig, $xoopsModule; |
12 | 12 | |
13 | 13 | // At which record shall we start for the Categories |
14 | -$catstart = isset($_GET['catstart']) ? (int)$_GET['catstart'] : 0; |
|
14 | +$catstart = isset($_GET['catstart']) ? (int) $_GET['catstart'] : 0; |
|
15 | 15 | |
16 | 16 | // At which record shall we start for the FAQs |
17 | -$start = isset($_GET['start']) ? (int)$_GET['start'] : 0; |
|
17 | +$start = isset($_GET['start']) ? (int) $_GET['start'] : 0; |
|
18 | 18 | |
19 | 19 | // Creating the category handler object |
20 | 20 | $categoryHandler = sf_gethandler('category'); |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | |
43 | 43 | $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_index.tpl'; |
44 | 44 | |
45 | -require_once XOOPS_ROOT_PATH . '/header.php'; |
|
46 | -require_once __DIR__ . '/footer.php'; |
|
45 | +require_once XOOPS_ROOT_PATH.'/header.php'; |
|
46 | +require_once __DIR__.'/footer.php'; |
|
47 | 47 | |
48 | 48 | //get all categories for future reference |
49 | 49 | $allcategories = $categoryHandler->getObjects(null, true); |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | if (isset($totalQnas[$subcat_id]) && $totalQnas[$subcat_id] > 0) { |
66 | 66 | if (isset($last_qnaObj[$subcat_id])) { |
67 | 67 | $subcat->setVar('last_faqid', $last_qnaObj[$subcat_id]->getVar('faqid')); |
68 | - $subcat->setVar('last_question_link', "<a href='faq.php?faqid=" . $last_qnaObj[$subcat_id]->getVar('faqid') . "'>" . $last_qnaObj[$subcat_id]->question(50) . '</a>'); |
|
68 | + $subcat->setVar('last_question_link', "<a href='faq.php?faqid=".$last_qnaObj[$subcat_id]->getVar('faqid')."'>".$last_qnaObj[$subcat_id]->question(50).'</a>'); |
|
69 | 69 | } |
70 | 70 | $subcat->setVar('faqcount', $totalQnas[$subcat_id]); |
71 | 71 | $categories[$cat_id]['subcats'][$subcat_id] = $subcat->toArray(null, true); |
72 | - $total += $totalQnas[$subcat_id]; |
|
72 | + $total += $totalQnas[$subcat_id]; |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | $memberHandler = xoops_getHandler('member'); |
104 | - $users = $memberHandler->getUsers(new Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN'), true); |
|
104 | + $users = $memberHandler->getUsers(new Criteria('uid', '('.implode(',', array_keys($userids)).')', 'IN'), true); |
|
105 | 105 | for ($i = 0; $i < $totalQnasOnPage; ++$i) { |
106 | 106 | $faq = $faqsObj[$i]->toArray(null, $allcategories); |
107 | 107 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | } |
115 | 115 | } |
116 | 116 | // Language constants |
117 | -$moduleName =& $myts->displayTarea($xoopsModule->getVar('name')); |
|
117 | +$moduleName = & $myts->displayTarea($xoopsModule->getVar('name')); |
|
118 | 118 | $xoopsTpl->assign(array( |
119 | 119 | 'lang_on' => _MD_SF_ON, |
120 | 120 | 'lang_postedby' => _MD_SF_POSTEDBY, |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | 'lang_hits' => _MD_SF_HITS |
125 | 125 | )); |
126 | 126 | |
127 | -$moduleName =& $myts->displayTarea($xoopsModule->getVar('name')); |
|
127 | +$moduleName = & $myts->displayTarea($xoopsModule->getVar('name')); |
|
128 | 128 | $xoopsTpl->assign('lang_mainhead', sprintf(_MD_SF_OPEN_WELCOME, $xoopsConfig['sitename'])); |
129 | 129 | $xoopsTpl->assign('lang_mainintro', $myts->displayTarea($xoopsModuleConfig['openquestionintromsg'], 1)); |
130 | 130 | $xoopsTpl->assign('lang_total', _MD_SF_TOTAL_QUESTIONS); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | $xoopsTpl->assign('lang_description', _MD_SF_DESCRIPTION); |
133 | 133 | $xoopsTpl->assign('lang_category', _MD_SF_CATEGORY); |
134 | 134 | $xoopsTpl->assign('sectionname', $moduleName); |
135 | -$xoopsTpl->assign('whereInSection', "<a href='index.php'>" . $moduleName . '</a> > ' . _MD_SF_OPEN_SECTION); |
|
135 | +$xoopsTpl->assign('whereInSection', "<a href='index.php'>".$moduleName.'</a> > '._MD_SF_OPEN_SECTION); |
|
136 | 136 | |
137 | 137 | $xoopsTpl->assign('displayFull', false); |
138 | 138 | $xoopsTpl->assign('displaylastfaqs', $xoopsModuleConfig['displaylastfaqs']); |
@@ -148,25 +148,25 @@ discard block |
||
148 | 148 | $xoopsTpl->assign('lang_category', _MD_SF_CATEGORY); |
149 | 149 | |
150 | 150 | // Category Navigation Bar |
151 | -require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
151 | +require_once XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
152 | 152 | $pagenav = new XoopsPageNav($totalCategories, $xoopsModuleConfig['catperpage'], $catstart, 'catstart', ''); |
153 | 153 | if ($xoopsModuleConfig['useimagenavpage'] == 1) { |
154 | - $xoopsTpl->assign('catnavbar', '<div style="text-align:right;">' . $pagenav->renderImageNav() . '</div>'); |
|
154 | + $xoopsTpl->assign('catnavbar', '<div style="text-align:right;">'.$pagenav->renderImageNav().'</div>'); |
|
155 | 155 | } else { |
156 | - $xoopsTpl->assign('catnavbar', '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'); |
|
156 | + $xoopsTpl->assign('catnavbar', '<div style="text-align:right;">'.$pagenav->renderNav().'</div>'); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | // FAQ Navigation Bar |
160 | 160 | $pagenav = new XoopsPageNav($totalFaqs, $xoopsModuleConfig['indexperpage'], $start, 'start', ''); |
161 | 161 | if ($xoopsModuleConfig['useimagenavpage'] == 1) { |
162 | - $xoopsTpl->assign('navbar', '<div style="text-align:right;">' . $pagenav->renderImageNav() . '</div>'); |
|
162 | + $xoopsTpl->assign('navbar', '<div style="text-align:right;">'.$pagenav->renderImageNav().'</div>'); |
|
163 | 163 | } else { |
164 | - $xoopsTpl->assign('navbar', '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'); |
|
164 | + $xoopsTpl->assign('navbar', '<div style="text-align:right;">'.$pagenav->renderNav().'</div>'); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | // Page Title Hack by marcan |
168 | 168 | $module_name = $myts->htmlSpecialChars($xoopsModule->getVar('name')); |
169 | -$xoopsTpl->assign('xoops_pagetitle', $module_name . ' - ' . $category->getVar('name')); |
|
169 | +$xoopsTpl->assign('xoops_pagetitle', $module_name.' - '.$category->getVar('name')); |
|
170 | 170 | // End Page Title Hack by marcan |
171 | 171 | |
172 | -require_once XOOPS_ROOT_PATH . '/footer.php'; |
|
172 | +require_once XOOPS_ROOT_PATH.'/footer.php'; |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | $uid = $xoopsUser ? $xoopsUser->getVar('uid') : 0; |
12 | 12 | $isAdmin = (sf_userIsAdmin() || sf_moderator()); |
13 | 13 | |
14 | -$xoopsTpl->assign('sf_adminpage', "<a href='" . XOOPS_URL . "/modules/smartfaq/admin/index.php'>" . _MD_SF_ADMIN_PAGE . '</a>'); |
|
14 | +$xoopsTpl->assign('sf_adminpage', "<a href='".XOOPS_URL."/modules/smartfaq/admin/index.php'>"._MD_SF_ADMIN_PAGE.'</a>'); |
|
15 | 15 | $xoopsTpl->assign('isAdmin', $isAdmin); |
16 | 16 | |
17 | 17 | $xoopsTpl->assign(array( |
@@ -34,4 +34,4 @@ discard block |
||
34 | 34 | |
35 | 35 | $xoopsTpl->assign('ref_smartfaq', 'SmartFAQ is developed by The SmartFactory (http://www.smartfactory.ca), a division of InBox Solutions (http://www.inboxsolutions.net)'); |
36 | 36 | |
37 | -$xoopsTpl->assign('xoops_module_header', "<link rel='stylesheet' type='text/css' href='" . XOOPS_URL . "/modules/smartfaq/assets/css/smartfaq.css'>"); |
|
37 | +$xoopsTpl->assign('xoops_module_header', "<link rel='stylesheet' type='text/css' href='".XOOPS_URL."/modules/smartfaq/assets/css/smartfaq.css'>"); |
@@ -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; |
@@ -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 |
@@ -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 |
@@ -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 | } |
@@ -5,13 +5,13 @@ discard block |
||
5 | 5 | * Author: The SmartFactory <www.smartfactory.ca> |
6 | 6 | * Licence: GNU |
7 | 7 | */ |
8 | -require_once __DIR__ . '/header.php'; |
|
8 | +require_once __DIR__.'/header.php'; |
|
9 | 9 | |
10 | 10 | // At which record shall we start for the Categories |
11 | -$catstart = isset($_GET['catstart']) ? (int)$_GET['catstart'] : 0; |
|
11 | +$catstart = isset($_GET['catstart']) ? (int) $_GET['catstart'] : 0; |
|
12 | 12 | |
13 | 13 | // At which record shall we start for the FAQ |
14 | -$start = isset($_GET['start']) ? (int)$_GET['start'] : 0; |
|
14 | +$start = isset($_GET['start']) ? (int) $_GET['start'] : 0; |
|
15 | 15 | |
16 | 16 | // Creating the category handler object |
17 | 17 | $categoryHandler = sf_gethandler('category'); |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | |
37 | 37 | $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_index.tpl'; |
38 | 38 | |
39 | -require_once XOOPS_ROOT_PATH . '/header.php'; |
|
40 | -require_once __DIR__ . '/footer.php'; |
|
39 | +require_once XOOPS_ROOT_PATH.'/header.php'; |
|
40 | +require_once __DIR__.'/footer.php'; |
|
41 | 41 | |
42 | 42 | // Creating the categories objects |
43 | 43 | $categoriesObj = $categoryHandler->getCategories($xoopsModuleConfig['catperpage'], $catstart); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | // Get the last smartfaq in each category |
61 | 61 | $last_qnaObj = $faqHandler->getLastPublishedByCat(); |
62 | 62 | } |
63 | -$lastfaqsize = (int)$xoopsModuleConfig['lastfaqsize']; |
|
63 | +$lastfaqsize = (int) $xoopsModuleConfig['lastfaqsize']; |
|
64 | 64 | $categories = array(); |
65 | 65 | foreach ($categoriesObj as $cat_id => $category) { |
66 | 66 | $total = 0; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | if (isset($totalQnas[$subcat_id]) && $totalQnas[$subcat_id] > 0) { |
71 | 71 | if (isset($last_qnaObj[$subcat_id])) { |
72 | 72 | $subcat->setVar('last_faqid', $last_qnaObj[$subcat_id]->getVar('faqid')); |
73 | - $subcat->setVar('last_question_link', "<a href='faq.php?faqid=" . $last_qnaObj[$subcat_id]->getVar('faqid') . "'>" . $last_qnaObj[$subcat_id]->question($lastfaqsize) . '</a>'); |
|
73 | + $subcat->setVar('last_question_link', "<a href='faq.php?faqid=".$last_qnaObj[$subcat_id]->getVar('faqid')."'>".$last_qnaObj[$subcat_id]->question($lastfaqsize).'</a>'); |
|
74 | 74 | } |
75 | 75 | $subcat->setVar('faqcount', $totalQnas[$subcat_id]); |
76 | 76 | if ($xoopsModuleConfig['displaysubcatonindex']) { |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | if ($total > 0) { |
89 | 89 | if (isset($last_qnaObj[$cat_id])) { |
90 | 90 | $category->setVar('last_faqid', $last_qnaObj[$cat_id]->getVar('faqid')); |
91 | - $category->setVar('last_question_link', "<a href='faq.php?faqid=" . $last_qnaObj[$cat_id]->getVar('faqid') . "'>" . $last_qnaObj[$cat_id]->question($lastfaqsize) . '</a>'); |
|
91 | + $category->setVar('last_question_link', "<a href='faq.php?faqid=".$last_qnaObj[$cat_id]->getVar('faqid')."'>".$last_qnaObj[$cat_id]->question($lastfaqsize).'</a>'); |
|
92 | 92 | } |
93 | 93 | $category->setVar('faqcount', $total); |
94 | 94 | if (!isset($categories[$cat_id])) { |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | $memberHandler = xoops_getHandler('member'); |
129 | - $users = $memberHandler->getUsers(new Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN'), true); |
|
129 | + $users = $memberHandler->getUsers(new Criteria('uid', '('.implode(',', array_keys($userids)).')', 'IN'), true); |
|
130 | 130 | for ($i = 0; $i < $totalQnasOnPage; ++$i) { |
131 | 131 | $faq = $faqsObj[$i]->toArray(null, $allcategories); |
132 | 132 | |
@@ -152,14 +152,14 @@ discard block |
||
152 | 152 | } |
153 | 153 | |
154 | 154 | // Language constants |
155 | -$moduleName =& $myts->displayTarea($xoopsModule->getVar('name')); |
|
155 | +$moduleName = & $myts->displayTarea($xoopsModule->getVar('name')); |
|
156 | 156 | $xoopsTpl->assign('whereInSection', $moduleName); |
157 | 157 | $xoopsTpl->assign('displaysubcatonindex', $xoopsModuleConfig['displaysubcatonindex']); |
158 | 158 | $xoopsTpl->assign('displaylastfaqs', $xoopsModuleConfig['displaylastfaqs']); |
159 | 159 | $xoopsTpl->assign('display_categoryname', true); |
160 | 160 | $xoopsTpl->assign('displayFull', $xoopsModuleConfig['displaytype'] === 'full'); |
161 | 161 | |
162 | -$xoopsTpl->assign('lang_mainhead', _MD_SF_MAINHEAD . ' ' . $moduleName); |
|
162 | +$xoopsTpl->assign('lang_mainhead', _MD_SF_MAINHEAD.' '.$moduleName); |
|
163 | 163 | $xoopsTpl->assign('lang_mainintro', $myts->displayTarea($xoopsModuleConfig['indexwelcomemsg'], 1)); |
164 | 164 | $xoopsTpl->assign('lang_total', _MD_SF_TOTAL_SMARTFAQS); |
165 | 165 | $xoopsTpl->assign('lang_home', _MD_SF_HOME); |
@@ -178,20 +178,20 @@ discard block |
||
178 | 178 | $xoopsTpl->assign('lang_comments', _MD_SF_COMMENTS); |
179 | 179 | |
180 | 180 | // Category Navigation Bar |
181 | -require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
181 | +require_once XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
182 | 182 | $pagenav = new XoopsPageNav($totalCategories, $xoopsModuleConfig['catperpage'], $catstart, 'catstart', ''); |
183 | 183 | if ($xoopsModuleConfig['useimagenavpage'] == 1) { |
184 | - $xoopsTpl->assign('catnavbar', '<div style="text-align:right;">' . $pagenav->renderImageNav() . '</div>'); |
|
184 | + $xoopsTpl->assign('catnavbar', '<div style="text-align:right;">'.$pagenav->renderImageNav().'</div>'); |
|
185 | 185 | } else { |
186 | - $xoopsTpl->assign('catnavbar', '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'); |
|
186 | + $xoopsTpl->assign('catnavbar', '<div style="text-align:right;">'.$pagenav->renderNav().'</div>'); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | // FAQ Navigation Bar |
190 | 190 | $pagenav = new XoopsPageNav($totalFaqs, $xoopsModuleConfig['indexperpage'], $start, 'start', ''); |
191 | 191 | if ($xoopsModuleConfig['useimagenavpage'] == 1) { |
192 | - $xoopsTpl->assign('navbar', '<div style="text-align:right;">' . $pagenav->renderImageNav() . '</div>'); |
|
192 | + $xoopsTpl->assign('navbar', '<div style="text-align:right;">'.$pagenav->renderImageNav().'</div>'); |
|
193 | 193 | } else { |
194 | - $xoopsTpl->assign('navbar', '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'); |
|
194 | + $xoopsTpl->assign('navbar', '<div style="text-align:right;">'.$pagenav->renderNav().'</div>'); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | // Page Title Hack by marcan |
@@ -199,4 +199,4 @@ discard block |
||
199 | 199 | $xoopsTpl->assign('xoops_pagetitle', $module_name); |
200 | 200 | // End Page Title Hack by marcan |
201 | 201 | |
202 | -require_once XOOPS_ROOT_PATH . '/footer.php'; |
|
202 | +require_once XOOPS_ROOT_PATH.'/footer.php'; |
@@ -6,5 +6,5 @@ |
||
6 | 6 | * Licence: GNU |
7 | 7 | */ |
8 | 8 | |
9 | -include __DIR__ . '/../../mainfile.php'; |
|
10 | -require_once XOOPS_ROOT_PATH . '/include/comment_new.php'; |
|
9 | +include __DIR__.'/../../mainfile.php'; |
|
10 | +require_once XOOPS_ROOT_PATH.'/include/comment_new.php'; |