@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | //$modversion['icons32'] = '../../Frameworks/moduleclasses/icons/32'; |
26 | 26 | $modversion['modicons16'] = 'assets/images/icons/16'; |
27 | 27 | $modversion['modicons32'] = 'assets/images/icons/32'; |
28 | -$modversion['release_file'] = XOOPS_URL . '/modules/' . $modversion['dirname'] . '/docs/changelog.txt'; |
|
28 | +$modversion['release_file'] = XOOPS_URL.'/modules/'.$modversion['dirname'].'/docs/changelog.txt'; |
|
29 | 29 | $modversion['module_website_url'] = 'www.xoops.org'; |
30 | 30 | $modversion['module_website_name'] = 'XOOPS'; |
31 | 31 | $modversion['min_php'] = '5.5'; |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | |
96 | 96 | // Tables created by sql file (without prefix!) |
97 | 97 | $modversion['tables'] = [ |
98 | - $moduleDirName . '_' . 'categories', |
|
99 | - $moduleDirName . '_' . 'faq', |
|
100 | - $moduleDirName . '_' . 'answers' |
|
98 | + $moduleDirName.'_'.'categories', |
|
99 | + $moduleDirName.'_'.'faq', |
|
100 | + $moduleDirName.'_'.'answers' |
|
101 | 101 | ]; |
102 | 102 | |
103 | 103 | // Search |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $modversion['sub'][2]['url'] = 'request.php?op=add'; |
152 | 152 | } |
153 | 153 | |
154 | - include_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; |
|
154 | + include_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php'; |
|
155 | 155 | |
156 | 156 | // Creating the FAQ handler object |
157 | 157 | $faqHandler = sf_gethandler('faq'); |
@@ -6,9 +6,9 @@ discard block |
||
6 | 6 | * Licence: GNU |
7 | 7 | */ |
8 | 8 | |
9 | -include_once __DIR__ . '/header.php'; |
|
9 | +include_once __DIR__.'/header.php'; |
|
10 | 10 | |
11 | -$faqid = isset($_GET['faqid']) ? (int)$_GET['faqid'] : 0; |
|
11 | +$faqid = isset($_GET['faqid']) ? (int) $_GET['faqid'] : 0; |
|
12 | 12 | |
13 | 13 | if ($faqid == 0) { |
14 | 14 | redirect_header('javascript:history.go(-1)', 1, _MD_SF_NOFAQSELECTED); |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | |
44 | 44 | echo "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>\n"; |
45 | 45 | echo "<html>\n<head>\n"; |
46 | -echo '<title>' . _MD_SF_FAQCOMEFROM . ' ' . $xoopsConfig['sitename'] . "</title>\n"; |
|
47 | -echo "<meta http-equiv='Content-Type' content='text/html; charset=" . _CHARSET . "' />\n"; |
|
48 | -echo "<meta name='AUTHOR' content='" . $xoopsConfig['sitename'] . "' />\n"; |
|
49 | -echo "<meta name='COPYRIGHT' content='Copyright (c) 2001 by " . $xoopsConfig['sitename'] . "' />\n"; |
|
50 | -echo "<meta name='DESCRIPTION' content='" . $xoopsConfig['slogan'] . "' />\n"; |
|
51 | -echo "<meta name='GENERATOR' content='" . XOOPS_VERSION . "' />\n\n\n"; |
|
46 | +echo '<title>'._MD_SF_FAQCOMEFROM.' '.$xoopsConfig['sitename']."</title>\n"; |
|
47 | +echo "<meta http-equiv='Content-Type' content='text/html; charset="._CHARSET."' />\n"; |
|
48 | +echo "<meta name='AUTHOR' content='".$xoopsConfig['sitename']."' />\n"; |
|
49 | +echo "<meta name='COPYRIGHT' content='Copyright (c) 2001 by ".$xoopsConfig['sitename']."' />\n"; |
|
50 | +echo "<meta name='DESCRIPTION' content='".$xoopsConfig['slogan']."' />\n"; |
|
51 | +echo "<meta name='GENERATOR' content='".XOOPS_VERSION."' />\n\n\n"; |
|
52 | 52 | |
53 | 53 | echo "<body bgcolor='#ffffff' text='#000000' onload='window.print()'> |
54 | 54 | <div style='width: 650px; border: 1px solid #000; padding: 20px;'> |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | use Xmf\Request; |
10 | 10 | |
11 | -include_once __DIR__ . '/header.php'; |
|
11 | +include_once __DIR__.'/header.php'; |
|
12 | 12 | |
13 | 13 | global $xoopsUser, $xoopsConfig, $xoopsModuleConfig, $xoopsModule; |
14 | 14 | |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | |
130 | 130 | // Storing the FAQ object in the database |
131 | 131 | if (!$faqObj->store()) { |
132 | - redirect_header('javascript:history.go(-1)', 3, _MD_SF_SUBMIT_ERROR . sf_formatErrors($faqObj->getErrors())); |
|
132 | + redirect_header('javascript:history.go(-1)', 3, _MD_SF_SUBMIT_ERROR.sf_formatErrors($faqObj->getErrors())); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | // Storing the answer object in the database |
136 | 136 | if (!$newAnswerObj->store()) { |
137 | - redirect_header('javascript:history.go(-1)', 3, _MD_SF_SUBMIT_ERROR . sf_formatErrors($newAnswerObj->getErrors())); |
|
137 | + redirect_header('javascript:history.go(-1)', 3, _MD_SF_SUBMIT_ERROR.sf_formatErrors($newAnswerObj->getErrors())); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | $notificationHandler = xoops_getHandler('notification'); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | case 2: |
151 | 151 | // Answer for an open question submitted, auto-approved; became Q&A, need approbation |
152 | 152 | if (isset($_POST['notifypub']) && $_POST['notifypub'] == 1) { |
153 | - include_once XOOPS_ROOT_PATH . '/include/notification_constants.php'; |
|
153 | + include_once XOOPS_ROOT_PATH.'/include/notification_constants.php'; |
|
154 | 154 | $notificationHandler->subscribe('faq', $faqObj->faqid(), 'approved', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE); |
155 | 155 | } |
156 | 156 | // Send notifications |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | case 3: |
161 | 161 | // Answer submitted, needs approbation |
162 | 162 | if (isset($_POST['notifypub']) && $_POST['notifypub'] == 1) { |
163 | - include_once XOOPS_ROOT_PATH . '/include/notification_constants.php'; |
|
163 | + include_once XOOPS_ROOT_PATH.'/include/notification_constants.php'; |
|
164 | 164 | $notificationHandler->subscribe('question', $newAnswerObj->answerid(), 'approved', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE); |
165 | 165 | } |
166 | 166 | // Send notifications |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | // New answer submitted for a published Q&A, need approbation |
176 | 176 | // Send notifications |
177 | 177 | if (isset($_POST['notifypub']) && $_POST['notifypub'] == 1) { |
178 | - include_once XOOPS_ROOT_PATH . '/include/notification_constants.php'; |
|
178 | + include_once XOOPS_ROOT_PATH.'/include/notification_constants.php'; |
|
179 | 179 | $notificationHandler->subscribe('faq', $newAnswerObj->answerid(), 'answer_approved', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE); |
180 | 180 | } |
181 | 181 | |
@@ -212,20 +212,20 @@ discard block |
||
212 | 212 | } |
213 | 213 | |
214 | 214 | $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.tpl'; |
215 | - include_once XOOPS_ROOT_PATH . '/header.php'; |
|
216 | - include_once __DIR__ . '/footer.php'; |
|
215 | + include_once XOOPS_ROOT_PATH.'/header.php'; |
|
216 | + include_once __DIR__.'/footer.php'; |
|
217 | 217 | |
218 | 218 | $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous'; |
219 | 219 | |
220 | - $moduleName =& $myts->displayTarea($xoopsModule->getVar('name')); |
|
220 | + $moduleName = & $myts->displayTarea($xoopsModule->getVar('name')); |
|
221 | 221 | $xoopsTpl->assign('whereInSection', $moduleName); |
222 | 222 | $xoopsTpl->assign('lang_submit', _MD_SF_SUBMITANSWER); |
223 | 223 | |
224 | 224 | $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUBMITANSWERTO, ucwords($xoopsModule->name()))); |
225 | - $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUBMITANSWER_INTRO); |
|
225 | + $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY."<b>$name</b>, "._MD_SF_SUBMITANSWER_INTRO); |
|
226 | 226 | |
227 | - include_once __DIR__ . '/include/answer.inc.php'; |
|
227 | + include_once __DIR__.'/include/answer.inc.php'; |
|
228 | 228 | |
229 | - include_once XOOPS_ROOT_PATH . '/footer.php'; |
|
229 | + include_once XOOPS_ROOT_PATH.'/footer.php'; |
|
230 | 230 | break; |
231 | 231 | } |
@@ -5,13 +5,13 @@ discard block |
||
5 | 5 | * Author: The SmartFactory <www.smartfactory.ca> |
6 | 6 | * Licence: GNU |
7 | 7 | */ |
8 | -include_once __DIR__ . '/header.php'; |
|
8 | +include_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'); |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | |
38 | 38 | $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_index.tpl'; |
39 | 39 | |
40 | -include_once XOOPS_ROOT_PATH . '/header.php'; |
|
41 | -include_once __DIR__ . '/footer.php'; |
|
40 | +include_once XOOPS_ROOT_PATH.'/header.php'; |
|
41 | +include_once __DIR__.'/footer.php'; |
|
42 | 42 | |
43 | 43 | // Creating the categories objects |
44 | 44 | $categoriesObj = $categoryHandler->getCategories($xoopsModuleConfig['catperpage'], $catstart); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | // Get the last smartfaq in each category |
62 | 62 | $last_qnaObj = $faqHandler->getLastPublishedByCat(); |
63 | 63 | } |
64 | -$lastfaqsize = (int)$xoopsModuleConfig['lastfaqsize']; |
|
64 | +$lastfaqsize = (int) $xoopsModuleConfig['lastfaqsize']; |
|
65 | 65 | $categories = array(); |
66 | 66 | foreach ($categoriesObj as $cat_id => $category) { |
67 | 67 | $total = 0; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | if (isset($totalQnas[$subcat_id]) && $totalQnas[$subcat_id] > 0) { |
72 | 72 | if (isset($last_qnaObj[$subcat_id])) { |
73 | 73 | $subcat->setVar('last_faqid', $last_qnaObj[$subcat_id]->getVar('faqid')); |
74 | - $subcat->setVar('last_question_link', "<a href='faq.php?faqid=" . $last_qnaObj[$subcat_id]->getVar('faqid') . "'>" . $last_qnaObj[$subcat_id]->question($lastfaqsize) . '</a>'); |
|
74 | + $subcat->setVar('last_question_link', "<a href='faq.php?faqid=".$last_qnaObj[$subcat_id]->getVar('faqid')."'>".$last_qnaObj[$subcat_id]->question($lastfaqsize).'</a>'); |
|
75 | 75 | } |
76 | 76 | $subcat->setVar('faqcount', $totalQnas[$subcat_id]); |
77 | 77 | if ($xoopsModuleConfig['displaysubcatonindex']) { |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | if ($total > 0) { |
90 | 90 | if (isset($last_qnaObj[$cat_id])) { |
91 | 91 | $category->setVar('last_faqid', $last_qnaObj[$cat_id]->getVar('faqid')); |
92 | - $category->setVar('last_question_link', "<a href='faq.php?faqid=" . $last_qnaObj[$cat_id]->getVar('faqid') . "'>" . $last_qnaObj[$cat_id]->question($lastfaqsize) . '</a>'); |
|
92 | + $category->setVar('last_question_link', "<a href='faq.php?faqid=".$last_qnaObj[$cat_id]->getVar('faqid')."'>".$last_qnaObj[$cat_id]->question($lastfaqsize).'</a>'); |
|
93 | 93 | } |
94 | 94 | $category->setVar('faqcount', $total); |
95 | 95 | if (!isset($categories[$cat_id])) { |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | } |
128 | 128 | |
129 | 129 | $memberHandler = xoops_getHandler('member'); |
130 | - $users = $memberHandler->getUsers(new Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN'), true); |
|
130 | + $users = $memberHandler->getUsers(new Criteria('uid', '('.implode(',', array_keys($userids)).')', 'IN'), true); |
|
131 | 131 | for ($i = 0; $i < $totalQnasOnPage; ++$i) { |
132 | 132 | $faq = $faqsObj[$i]->toArray(null, $allcategories); |
133 | 133 | |
@@ -153,14 +153,14 @@ discard block |
||
153 | 153 | } |
154 | 154 | |
155 | 155 | // Language constants |
156 | -$moduleName =& $myts->displayTarea($xoopsModule->getVar('name')); |
|
156 | +$moduleName = & $myts->displayTarea($xoopsModule->getVar('name')); |
|
157 | 157 | $xoopsTpl->assign('whereInSection', $moduleName); |
158 | 158 | $xoopsTpl->assign('displaysubcatonindex', $xoopsModuleConfig['displaysubcatonindex']); |
159 | 159 | $xoopsTpl->assign('displaylastfaqs', $xoopsModuleConfig['displaylastfaqs']); |
160 | 160 | $xoopsTpl->assign('display_categoryname', true); |
161 | 161 | $xoopsTpl->assign('displayFull', $xoopsModuleConfig['displaytype'] === 'full'); |
162 | 162 | |
163 | -$xoopsTpl->assign('lang_mainhead', _MD_SF_MAINHEAD . ' ' . $moduleName); |
|
163 | +$xoopsTpl->assign('lang_mainhead', _MD_SF_MAINHEAD.' '.$moduleName); |
|
164 | 164 | $xoopsTpl->assign('lang_mainintro', $myts->displayTarea($xoopsModuleConfig['indexwelcomemsg'], 1)); |
165 | 165 | $xoopsTpl->assign('lang_total', _MD_SF_TOTAL_SMARTFAQS); |
166 | 166 | $xoopsTpl->assign('lang_home', _MD_SF_HOME); |
@@ -179,20 +179,20 @@ discard block |
||
179 | 179 | $xoopsTpl->assign('lang_comments', _MD_SF_COMMENTS); |
180 | 180 | |
181 | 181 | // Category Navigation Bar |
182 | -include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
182 | +include_once XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
183 | 183 | $pagenav = new XoopsPageNav($totalCategories, $xoopsModuleConfig['catperpage'], $catstart, 'catstart', ''); |
184 | 184 | if ($xoopsModuleConfig['useimagenavpage'] == 1) { |
185 | - $xoopsTpl->assign('catnavbar', '<div style="text-align:right;">' . $pagenav->renderImageNav() . '</div>'); |
|
185 | + $xoopsTpl->assign('catnavbar', '<div style="text-align:right;">'.$pagenav->renderImageNav().'</div>'); |
|
186 | 186 | } else { |
187 | - $xoopsTpl->assign('catnavbar', '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'); |
|
187 | + $xoopsTpl->assign('catnavbar', '<div style="text-align:right;">'.$pagenav->renderNav().'</div>'); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | // FAQ Navigation Bar |
191 | 191 | $pagenav = new XoopsPageNav($totalFaqs, $xoopsModuleConfig['indexperpage'], $start, 'start', ''); |
192 | 192 | if ($xoopsModuleConfig['useimagenavpage'] == 1) { |
193 | - $xoopsTpl->assign('navbar', '<div style="text-align:right;">' . $pagenav->renderImageNav() . '</div>'); |
|
193 | + $xoopsTpl->assign('navbar', '<div style="text-align:right;">'.$pagenav->renderImageNav().'</div>'); |
|
194 | 194 | } else { |
195 | - $xoopsTpl->assign('navbar', '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'); |
|
195 | + $xoopsTpl->assign('navbar', '<div style="text-align:right;">'.$pagenav->renderNav().'</div>'); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | // Page Title Hack by marcan |
@@ -200,4 +200,4 @@ discard block |
||
200 | 200 | $xoopsTpl->assign('xoops_pagetitle', $module_name); |
201 | 201 | // End Page Title Hack by marcan |
202 | 202 | |
203 | -include_once XOOPS_ROOT_PATH . '/footer.php'; |
|
203 | +include_once XOOPS_ROOT_PATH.'/footer.php'; |
@@ -132,7 +132,7 @@ |
||
132 | 132 | define('_MD_SF_SPECIFIC_URL_SELECT', 'Specific URL...'); |
133 | 133 | define('_MD_SF_SENDSTORY', 'Send this Q&A to a friend'); |
134 | 134 | define('_MD_SF_SPECIFIC_URL', 'Specific URL'); |
135 | -define('_MD_SF_SPECIFIC_URL_DSC', "If you have set the 'Contextually link to this module' to <i>" . _MD_SF_SPECIFIC_URL_SELECT . "</i>, please specify the URL.<br>\n<b>Example :</b> modules/newbb"); |
|
135 | +define('_MD_SF_SPECIFIC_URL_DSC', "If you have set the 'Contextually link to this module' to <i>"._MD_SF_SPECIFIC_URL_SELECT."</i>, please specify the URL.<br>\n<b>Example :</b> modules/newbb"); |
|
136 | 136 | define('_MD_SF_SUB_INTRO', 'please fill this form to send your Q&A. The site administrator will review it and then publish it as soon as possible. Thank you in advance for your contribution.'); |
137 | 137 | define('_MD_SF_SUB_SNEWNAME', 'Submit a Q&A'); |
138 | 138 | define('_MD_SF_SUB_SMNAME', 'Submit a Q&A'); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $this->assignVars($id); |
48 | 48 | } else { |
49 | 49 | $categoryHandler = new sfCategoryHandler($this->db); |
50 | - $category =& $categoryHandler->get($id); |
|
50 | + $category = & $categoryHandler->get($id); |
|
51 | 51 | foreach ($category->vars as $k => $v) { |
52 | 52 | $this->assignVar($k, $v['value']); |
53 | 53 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function checkPermission() |
82 | 82 | { |
83 | - include_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; |
|
83 | + include_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php'; |
|
84 | 84 | |
85 | 85 | $userIsAdmin = sf_userIsAdmin(); |
86 | 86 | if ($userIsAdmin) { |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $filename = 'open_category.php'; |
158 | 158 | } |
159 | 159 | if ($withAllLink) { |
160 | - $ret = "<a href='" . XOOPS_URL . '/modules/smartfaq/' . $filename . '?categoryid=' . $this->categoryid() . "'>" . $this->name() . '</a>'; |
|
160 | + $ret = "<a href='".XOOPS_URL.'/modules/smartfaq/'.$filename.'?categoryid='.$this->categoryid()."'>".$this->name().'</a>'; |
|
161 | 161 | } else { |
162 | 162 | $ret = $this->name(); |
163 | 163 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | exit; |
170 | 170 | } |
171 | 171 | $parentid = $parentObj->parentid(); |
172 | - $ret = $parentObj->getCategoryPath(true, $open) . ' > ' . $ret; |
|
172 | + $ret = $parentObj->getCategoryPath(true, $open).' > '.$ret; |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | return $ret; |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | $tags = array(); |
224 | 224 | $tags['MODULE_NAME'] = $myts->htmlSpecialChars($smartModule->getVar('name')); |
225 | 225 | $tags['CATEGORY_NAME'] = $this->name(); |
226 | - $tags['CATEGORY_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/category.php?categoryid=' . $this->categoryid(); |
|
226 | + $tags['CATEGORY_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/category.php?categoryid='.$this->categoryid(); |
|
227 | 227 | |
228 | 228 | $notificationHandler = xoops_getHandler('notification'); |
229 | 229 | $notificationHandler->triggerEvent('global_faq', 0, 'category_created', $tags); |
@@ -239,9 +239,9 @@ discard block |
||
239 | 239 | $category['categoryid'] = $this->categoryid(); |
240 | 240 | $category['name'] = $this->name(); |
241 | 241 | if ($open !== false) { |
242 | - $category['categorylink'] = "<a href='" . XOOPS_URL . '/modules/smartfaq/open_category.php?categoryid=' . $this->categoryid() . "'>" . $this->name() . '</a>'; |
|
242 | + $category['categorylink'] = "<a href='".XOOPS_URL.'/modules/smartfaq/open_category.php?categoryid='.$this->categoryid()."'>".$this->name().'</a>'; |
|
243 | 243 | } else { |
244 | - $category['categorylink'] = "<a href='" . XOOPS_URL . '/modules/smartfaq/category.php?categoryid=' . $this->categoryid() . "'>" . $this->name() . '</a>'; |
|
244 | + $category['categorylink'] = "<a href='".XOOPS_URL.'/modules/smartfaq/category.php?categoryid='.$this->categoryid()."'>".$this->name().'</a>'; |
|
245 | 245 | } |
246 | 246 | $category['total'] = $this->getVar('faqcount'); |
247 | 247 | $category['description'] = $this->description(); |
@@ -290,8 +290,8 @@ discard block |
||
290 | 290 | public function &get($id) |
291 | 291 | { |
292 | 292 | $false = false; |
293 | - if ((int)$id > 0) { |
|
294 | - $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_categories') . ' WHERE categoryid=' . $id; |
|
293 | + if ((int) $id > 0) { |
|
294 | + $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_categories').' WHERE categoryid='.$id; |
|
295 | 295 | if (!$result = $this->db->query($sql)) { |
296 | 296 | return $false; |
297 | 297 | } |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | } |
376 | 376 | |
377 | 377 | // Deleteing the sub categories |
378 | - $subcats =& $this->getCategories(0, 0, $category->categoryid()); |
|
378 | + $subcats = & $this->getCategories(0, 0, $category->categoryid()); |
|
379 | 379 | foreach ($subcats as $subcat) { |
380 | 380 | $this->delete($subcat); |
381 | 381 | } |
@@ -412,11 +412,11 @@ discard block |
||
412 | 412 | { |
413 | 413 | $ret = array(); |
414 | 414 | $limit = $start = 0; |
415 | - $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_categories'); |
|
415 | + $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_categories'); |
|
416 | 416 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
417 | - $sql .= ' ' . $criteria->renderWhere(); |
|
417 | + $sql .= ' '.$criteria->renderWhere(); |
|
418 | 418 | if ($criteria->getSort() != '') { |
419 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
419 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
420 | 420 | } |
421 | 421 | $limit = $criteria->getLimit(); |
422 | 422 | $start = $criteria->getStart(); |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | $order = 'ASC', |
459 | 459 | $id_as_key = true |
460 | 460 | ) { |
461 | - include_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; |
|
461 | + include_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php'; |
|
462 | 462 | |
463 | 463 | $criteria = new CriteriaCompo(); |
464 | 464 | |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq'); |
473 | 473 | |
474 | 474 | $categoriesGranted = $smartPermHandler->getPermissions('category'); |
475 | - $criteria->add(new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN')); |
|
475 | + $criteria->add(new Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN')); |
|
476 | 476 | } |
477 | 477 | $criteria->setStart($start); |
478 | 478 | $criteria->setLimit($limit); |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | $sort = 'weight', |
497 | 497 | $order = 'ASC' |
498 | 498 | ) { |
499 | - include_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; |
|
499 | + include_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php'; |
|
500 | 500 | |
501 | 501 | $criteria = new CriteriaCompo(); |
502 | 502 | |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq'); |
511 | 511 | |
512 | 512 | $categoriesGranted = $smartPermHandler->getPermissions('category'); |
513 | - $criteria->add(new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN')); |
|
513 | + $criteria->add(new Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN')); |
|
514 | 514 | } |
515 | 515 | |
516 | 516 | $criteria->add(new Criteria('f.status', _SF_STATUS_OPENED)); |
@@ -525,9 +525,9 @@ discard block |
||
525 | 525 | . $this->db->prefix('smartfaq_faq') |
526 | 526 | . ' AS f ON c.categoryid = f.categoryid'; |
527 | 527 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
528 | - $sql .= ' ' . $criteria->renderWhere(); |
|
528 | + $sql .= ' '.$criteria->renderWhere(); |
|
529 | 529 | if ($criteria->getSort() != '') { |
530 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
530 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
531 | 531 | } |
532 | 532 | $limit = $criteria->getLimit(); |
533 | 533 | $start = $criteria->getStart(); |
@@ -556,9 +556,9 @@ discard block |
||
556 | 556 | */ |
557 | 557 | public function getCount($criteria = null) |
558 | 558 | { |
559 | - $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_categories'); |
|
559 | + $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('smartfaq_categories'); |
|
560 | 560 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
561 | - $sql .= ' ' . $criteria->renderWhere(); |
|
561 | + $sql .= ' '.$criteria->renderWhere(); |
|
562 | 562 | } |
563 | 563 | $result = $this->db->query($sql); |
564 | 564 | if (!$result) { |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq'); |
586 | 586 | |
587 | 587 | $categoriesGranted = $smartPermHandler->getPermissions('category'); |
588 | - $criteria->add(new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN')); |
|
588 | + $criteria->add(new Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN')); |
|
589 | 589 | } |
590 | 590 | } |
591 | 591 | |
@@ -608,16 +608,16 @@ discard block |
||
608 | 608 | $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq'); |
609 | 609 | |
610 | 610 | $categoriesGranted = $smartPermHandler->getPermissions('category'); |
611 | - $criteria->add(new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN')); |
|
611 | + $criteria->add(new Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN')); |
|
612 | 612 | } |
613 | 613 | } |
614 | 614 | |
615 | 615 | $criteria->add(new Criteria('f.status', _SF_STATUS_OPENED)); |
616 | 616 | |
617 | - $sql = 'SELECT COUNT(c.categoryid) FROM ' . $this->db->prefix('smartfaq_categories') . ' AS c INNER JOIN ' . $this->db->prefix('smartfaq_faq') . ' AS f ON c.categoryid = f.categoryid'; |
|
617 | + $sql = 'SELECT COUNT(c.categoryid) FROM '.$this->db->prefix('smartfaq_categories').' AS c INNER JOIN '.$this->db->prefix('smartfaq_faq').' AS f ON c.categoryid = f.categoryid'; |
|
618 | 618 | |
619 | 619 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
620 | - $sql .= ' ' . $criteria->renderWhere(); |
|
620 | + $sql .= ' '.$criteria->renderWhere(); |
|
621 | 621 | } |
622 | 622 | |
623 | 623 | $result = $this->db->query($sql); |
@@ -635,13 +635,13 @@ discard block |
||
635 | 635 | */ |
636 | 636 | public function getSubCats($categories) |
637 | 637 | { |
638 | - $criteria = new CriteriaCompo(new Criteria('parentid', '(' . implode(',', array_keys($categories)) . ')'), 'IN'); |
|
638 | + $criteria = new CriteriaCompo(new Criteria('parentid', '('.implode(',', array_keys($categories)).')'), 'IN'); |
|
639 | 639 | $ret = array(); |
640 | 640 | if (!sf_userIsAdmin()) { |
641 | 641 | $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq'); |
642 | 642 | |
643 | 643 | $categoriesGranted = $smartPermHandler->getPermissions('category'); |
644 | - $criteria->add(new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN')); |
|
644 | + $criteria->add(new Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN')); |
|
645 | 645 | } |
646 | 646 | $subcats = $this->getObjects($criteria, true); |
647 | 647 | foreach ($subcats as $subcat_id => $subcat) { |
@@ -659,9 +659,9 @@ discard block |
||
659 | 659 | */ |
660 | 660 | public function deleteAll($criteria = null) |
661 | 661 | { |
662 | - $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_categories'); |
|
662 | + $sql = 'DELETE FROM '.$this->db->prefix('smartfaq_categories'); |
|
663 | 663 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
664 | - $sql .= ' ' . $criteria->renderWhere(); |
|
664 | + $sql .= ' '.$criteria->renderWhere(); |
|
665 | 665 | } |
666 | 666 | if (!$this->db->query($sql)) { |
667 | 667 | return false; |
@@ -683,10 +683,10 @@ discard block |
||
683 | 683 | **/ |
684 | 684 | public function updateAll($fieldname, $fieldvalue, $criteria = null) |
685 | 685 | { |
686 | - $set_clause = is_numeric($fieldvalue) ? $fieldname . ' = ' . $fieldvalue : $fieldname . ' = ' . $this->db->quoteString($fieldvalue); |
|
687 | - $sql = 'UPDATE ' . $this->db->prefix('smartfaq_categories') . ' SET ' . $set_clause; |
|
686 | + $set_clause = is_numeric($fieldvalue) ? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue); |
|
687 | + $sql = 'UPDATE '.$this->db->prefix('smartfaq_categories').' SET '.$set_clause; |
|
688 | 688 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
689 | - $sql .= ' ' . $criteria->renderWhere(); |
|
689 | + $sql .= ' '.$criteria->renderWhere(); |
|
690 | 690 | } |
691 | 691 | if (!$this->db->queryF($sql)) { |
692 | 692 | return false; |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | public function faqsCount($cat_id = 0, $status = '') |
713 | 713 | { |
714 | 714 | global $xoopsUser; |
715 | - include_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; |
|
715 | + include_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php'; |
|
716 | 716 | |
717 | 717 | $faqHandler = sf_gethandler('faq'); |
718 | 718 |
@@ -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->query('SHOW COLUMNS FROM ' . $this->name()); |
|
155 | + $result = $xoopsDB->query('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->query($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->query($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->query($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->query($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->query($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->query($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->query($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->query($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->query($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 | } |
@@ -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 | - include_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/include/functions.image.php'; |
|
199 | + include_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' ... |
@@ -431,8 +431,8 @@ discard block |
||
431 | 431 | */ |
432 | 432 | public function get($id = null, $fields = null) |
433 | 433 | { |
434 | - if ((int)$id > 0) { |
|
435 | - $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_answers') . ' WHERE answerid=' . $id; |
|
434 | + if ((int) $id > 0) { |
|
435 | + $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_answers').' WHERE answerid='.$id; |
|
436 | 436 | if (!$result = $this->db->query($sql)) { |
437 | 437 | return false; |
438 | 438 | } |
@@ -562,11 +562,11 @@ discard block |
||
562 | 562 | { |
563 | 563 | $ret = array(); |
564 | 564 | $limit = $start = 0; |
565 | - $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_answers'); |
|
565 | + $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_answers'); |
|
566 | 566 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
567 | - $sql .= ' ' . $criteria->renderWhere(); |
|
567 | + $sql .= ' '.$criteria->renderWhere(); |
|
568 | 568 | if ($criteria->getSort() != '') { |
569 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
569 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
570 | 570 | } |
571 | 571 | $limit = $criteria->getLimit(); |
572 | 572 | $start = $criteria->getStart(); |
@@ -580,9 +580,9 @@ discard block |
||
580 | 580 | $answer = new sfAnswer(); |
581 | 581 | $answer->assignVars($myrow); |
582 | 582 | if (!$id_as_key) { |
583 | - $ret[] =& $answer; |
|
583 | + $ret[] = & $answer; |
|
584 | 584 | } else { |
585 | - $ret[$myrow['answerid']] =& $answer; |
|
585 | + $ret[$myrow['answerid']] = & $answer; |
|
586 | 586 | } |
587 | 587 | unset($answer); |
588 | 588 | } |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | $criteria->setOrder($order); |
651 | 651 | $criteria->setLimit($limit); |
652 | 652 | $criteria->setStart($start); |
653 | - $ret =& $this->getObjects($criteria); |
|
653 | + $ret = & $this->getObjects($criteria); |
|
654 | 654 | |
655 | 655 | return $ret; |
656 | 656 | } |
@@ -663,9 +663,9 @@ discard block |
||
663 | 663 | */ |
664 | 664 | public function getCount(CriteriaElement $criteria = null) |
665 | 665 | { |
666 | - $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_answers'); |
|
666 | + $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('smartfaq_answers'); |
|
667 | 667 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
668 | - $sql .= ' ' . $criteria->renderWhere(); |
|
668 | + $sql .= ' '.$criteria->renderWhere(); |
|
669 | 669 | } |
670 | 670 | $result = $this->db->query($sql); |
671 | 671 | if (!$result) { |
@@ -684,10 +684,10 @@ discard block |
||
684 | 684 | */ |
685 | 685 | public function getCountByFAQ($criteria = null) |
686 | 686 | { |
687 | - $sql = 'SELECT faqid, COUNT(*) FROM ' . $this->db->prefix('smartfaq_answers'); |
|
687 | + $sql = 'SELECT faqid, COUNT(*) FROM '.$this->db->prefix('smartfaq_answers'); |
|
688 | 688 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
689 | - $sql .= ' ' . $criteria->renderWhere(); |
|
690 | - $sql .= ' ' . $criteria->getGroupby(); |
|
689 | + $sql .= ' '.$criteria->renderWhere(); |
|
690 | + $sql .= ' '.$criteria->getGroupby(); |
|
691 | 691 | } |
692 | 692 | |
693 | 693 | //echo "<br>$sql<br>"; |
@@ -714,9 +714,9 @@ discard block |
||
714 | 714 | */ |
715 | 715 | public function deleteAll(CriteriaElement $criteria = null, $force = true, $asObject = false) |
716 | 716 | { |
717 | - $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_answers'); |
|
717 | + $sql = 'DELETE FROM '.$this->db->prefix('smartfaq_answers'); |
|
718 | 718 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
719 | - $sql .= ' ' . $criteria->renderWhere(); |
|
719 | + $sql .= ' '.$criteria->renderWhere(); |
|
720 | 720 | } |
721 | 721 | if (!$this->db->query($sql)) { |
722 | 722 | return false; |
@@ -736,10 +736,10 @@ discard block |
||
736 | 736 | */ |
737 | 737 | public function updateAll($fieldname, $fieldvalue, CriteriaElement $criteria = null, $force = false) |
738 | 738 | { |
739 | - $set_clause = is_numeric($fieldvalue) ? $fieldname . ' = ' . $fieldvalue : $fieldname . ' = ' . $this->db->quoteString($fieldvalue); |
|
740 | - $sql = 'UPDATE ' . $this->db->prefix('smartfaq_answers') . ' SET ' . $set_clause; |
|
739 | + $set_clause = is_numeric($fieldvalue) ? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue); |
|
740 | + $sql = 'UPDATE '.$this->db->prefix('smartfaq_answers').' SET '.$set_clause; |
|
741 | 741 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
742 | - $sql .= ' ' . $criteria->renderWhere(); |
|
742 | + $sql .= ' '.$criteria->renderWhere(); |
|
743 | 743 | } |
744 | 744 | //echo "<br>" . $sql . "<br>"; |
745 | 745 | if (!$this->db->queryF($sql)) { |
@@ -756,8 +756,8 @@ discard block |
||
756 | 756 | public function getLastPublishedByFaq($faqids) |
757 | 757 | { |
758 | 758 | $ret = array(); |
759 | - $sql = 'SELECT faqid, answer, uid, datesub FROM ' . $this->db->prefix('smartfaq_answers') . ' |
|
760 | - WHERE faqid IN (' . implode(',', $faqids) . ') AND status = ' . _SF_AN_STATUS_APPROVED . ' GROUP BY faqid'; |
|
759 | + $sql = 'SELECT faqid, answer, uid, datesub FROM '.$this->db->prefix('smartfaq_answers').' |
|
760 | + WHERE faqid IN (' . implode(',', $faqids).') AND status = '._SF_AN_STATUS_APPROVED.' GROUP BY faqid'; |
|
761 | 761 | $result = $this->db->query($sql); |
762 | 762 | if (!$result) { |
763 | 763 | return $ret; |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | while ($row = $this->db->fetchArray($result)) { |
766 | 766 | $answer = new sfAnswer(); |
767 | 767 | $answer->assignVars($row); |
768 | - $ret[$row['faqid']] =& $answer; |
|
768 | + $ret[$row['faqid']] = & $answer; |
|
769 | 769 | unset($answer); |
770 | 770 | } |
771 | 771 |
@@ -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); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public function checkPermission() |
130 | 130 | { |
131 | - include_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; |
|
131 | + include_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 | } |
@@ -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; |
@@ -668,16 +668,16 @@ discard block |
||
668 | 668 | public function toArray($faq = array(), $category = null, $linkInQuestion = true) |
669 | 669 | { |
670 | 670 | global $xoopsModuleConfig; |
671 | - $lastfaqsize = (int)$xoopsModuleConfig['lastfaqsize']; |
|
671 | + $lastfaqsize = (int) $xoopsModuleConfig['lastfaqsize']; |
|
672 | 672 | |
673 | 673 | $faq['id'] = $this->faqid(); |
674 | 674 | $faq['categoryid'] = $this->categoryid(); |
675 | 675 | $faq['question'] = $this->question(); |
676 | 676 | $page = ($this->status() == _SF_STATUS_OPENED) ? 'answer.php' : 'faq.php'; |
677 | 677 | |
678 | - $faq['questionlink'] = "<a href='$page?faqid=" . $this->faqid() . "'>" . $this->question($lastfaqsize) . '</a>'; |
|
678 | + $faq['questionlink'] = "<a href='$page?faqid=".$this->faqid()."'>".$this->question($lastfaqsize).'</a>'; |
|
679 | 679 | if ($linkInQuestion) { |
680 | - $faq['fullquestionlink'] = "<a href='$page?faqid=" . $this->faqid() . "'>" . $this->question() . '</a>'; |
|
680 | + $faq['fullquestionlink'] = "<a href='$page?faqid=".$this->faqid()."'>".$this->question().'</a>'; |
|
681 | 681 | } else { |
682 | 682 | $faq['fullquestionlink'] = $this->question(); |
683 | 683 | } |
@@ -693,7 +693,7 @@ discard block |
||
693 | 693 | $categoryObj = $category[$this->categoryid()]; |
694 | 694 | } |
695 | 695 | $faq['categoryname'] = $categoryObj->getVar('name'); |
696 | - $faq['categorylink'] = "<a href='" . XOOPS_URL . '/modules/smartfaq/category.php?categoryid=' . $this->categoryid() . "'>" . $categoryObj->getVar('name') . '</a>'; |
|
696 | + $faq['categorylink'] = "<a href='".XOOPS_URL.'/modules/smartfaq/category.php?categoryid='.$this->categoryid()."'>".$categoryObj->getVar('name').'</a>'; |
|
697 | 697 | } |
698 | 698 | |
699 | 699 | return $faq; |
@@ -733,8 +733,8 @@ discard block |
||
733 | 733 | */ |
734 | 734 | public function & get($id) |
735 | 735 | { |
736 | - if ((int)$id > 0) { |
|
737 | - $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_faq') . ' WHERE faqid=' . $id; |
|
736 | + if ((int) $id > 0) { |
|
737 | + $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_faq').' WHERE faqid='.$id; |
|
738 | 738 | if (!$result = $this->db->query($sql)) { |
739 | 739 | return false; |
740 | 740 | } |
@@ -857,26 +857,26 @@ discard block |
||
857 | 857 | { |
858 | 858 | $ret = array(); |
859 | 859 | $limit = $start = 0; |
860 | - $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_faq'); |
|
860 | + $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_faq'); |
|
861 | 861 | |
862 | 862 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
863 | 863 | $whereClause = $criteria->renderWhere(); |
864 | 864 | |
865 | 865 | if ($whereClause !== 'WHERE ()') { |
866 | - $sql .= ' ' . $criteria->renderWhere(); |
|
866 | + $sql .= ' '.$criteria->renderWhere(); |
|
867 | 867 | if (!empty($notNullFields)) { |
868 | 868 | $sql .= $this->NotNullFieldClause($notNullFields, true); |
869 | 869 | } |
870 | 870 | } elseif (!empty($notNullFields)) { |
871 | - $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
871 | + $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
872 | 872 | } |
873 | 873 | if ($criteria->getSort() != '') { |
874 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
874 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
875 | 875 | } |
876 | 876 | $limit = $criteria->getLimit(); |
877 | 877 | $start = $criteria->getStart(); |
878 | 878 | } elseif (!empty($notNullFields)) { |
879 | - $sql .= $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
879 | + $sql .= $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
880 | 880 | } |
881 | 881 | |
882 | 882 | //echo "<br>" . $sql . "<br>"; |
@@ -936,26 +936,26 @@ discard block |
||
936 | 936 | faq.modulelink AS modulelink, |
937 | 937 | faq.contextpage AS contextpage, |
938 | 938 | faq.exacturl AS exacturl |
939 | - FROM ' . $this->db->prefix('smartfaq_faq') . ' AS faq INNER JOIN ' . $this->db->prefix('smartfaq_categories') . ' AS category ON faq.categoryid = category.categoryid '; |
|
939 | + FROM ' . $this->db->prefix('smartfaq_faq').' AS faq INNER JOIN '.$this->db->prefix('smartfaq_categories').' AS category ON faq.categoryid = category.categoryid '; |
|
940 | 940 | |
941 | 941 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
942 | 942 | $whereClause = $criteria->renderWhere(); |
943 | 943 | |
944 | 944 | if ($whereClause !== 'WHERE ()') { |
945 | - $sql .= ' ' . $criteria->renderWhere(); |
|
945 | + $sql .= ' '.$criteria->renderWhere(); |
|
946 | 946 | if (!empty($notNullFields)) { |
947 | 947 | $sql .= $this->NotNullFieldClause($notNullFields, true); |
948 | 948 | } |
949 | 949 | } elseif (!empty($notNullFields)) { |
950 | - $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
950 | + $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
951 | 951 | } |
952 | 952 | if ($criteria->getSort() != '') { |
953 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
953 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
954 | 954 | } |
955 | 955 | $limit = $criteria->getLimit(); |
956 | 956 | $start = $criteria->getStart(); |
957 | 957 | } elseif (!empty($notNullFields)) { |
958 | - $sql .= $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
958 | + $sql .= $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
959 | 959 | } |
960 | 960 | |
961 | 961 | //echo "<br>" . $sql . "<br>"; |
@@ -1005,19 +1005,19 @@ discard block |
||
1005 | 1005 | */ |
1006 | 1006 | public function getCount($criteria = null, $notNullFields = '') |
1007 | 1007 | { |
1008 | - $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_faq'); |
|
1008 | + $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('smartfaq_faq'); |
|
1009 | 1009 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
1010 | 1010 | $whereClause = $criteria->renderWhere(); |
1011 | 1011 | if ($whereClause !== 'WHERE ()') { |
1012 | - $sql .= ' ' . $criteria->renderWhere(); |
|
1012 | + $sql .= ' '.$criteria->renderWhere(); |
|
1013 | 1013 | if (!empty($notNullFields)) { |
1014 | 1014 | $sql .= $this->NotNullFieldClause($notNullFields, true); |
1015 | 1015 | } |
1016 | 1016 | } elseif (!empty($notNullFields)) { |
1017 | - $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
1017 | + $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
1018 | 1018 | } |
1019 | 1019 | } elseif (!empty($notNullFields)) { |
1020 | - $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
1020 | + $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
1021 | 1021 | } |
1022 | 1022 | |
1023 | 1023 | //echo "<br>" . $sql . "<br>"; |
@@ -1050,11 +1050,11 @@ discard block |
||
1050 | 1050 | $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq'); |
1051 | 1051 | |
1052 | 1052 | $categoriesGranted = $smartPermHandler->getPermissions('category'); |
1053 | - $grantedCategories = new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'); |
|
1053 | + $grantedCategories = new Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN'); |
|
1054 | 1054 | |
1055 | 1055 | $faqsGranted = $smartPermHandler->getPermissions('item'); |
1056 | 1056 | $grantedFaq = new CriteriaCompo(); |
1057 | - $grantedFaq->add(new Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR'); |
|
1057 | + $grantedFaq->add(new Criteria('faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR'); |
|
1058 | 1058 | // If user is anonymous, check if the FAQ allow partialview |
1059 | 1059 | if (!is_object($xoopsUser)) { |
1060 | 1060 | $grantedFaq->add(new Criteria('partialview', '1'), 'OR'); |
@@ -1101,7 +1101,7 @@ discard block |
||
1101 | 1101 | */ |
1102 | 1102 | public function getFaqsCountByStatus() |
1103 | 1103 | { |
1104 | - $sql = 'SELECT status, COUNT(*) FROM ' . $this->db->prefix('smartfaq_faq') . ' GROUP BY status'; |
|
1104 | + $sql = 'SELECT status, COUNT(*) FROM '.$this->db->prefix('smartfaq_faq').' GROUP BY status'; |
|
1105 | 1105 | $result = $this->db->query($sql); |
1106 | 1106 | if (!$result) { |
1107 | 1107 | return array(); |
@@ -1158,7 +1158,7 @@ discard block |
||
1158 | 1158 | $otherCriteria = null |
1159 | 1159 | ) { |
1160 | 1160 | global $xoopsUser; |
1161 | - include_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; |
|
1161 | + include_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php'; |
|
1162 | 1162 | |
1163 | 1163 | //if ( ($categoryid == -1) && (empty($status) || ($status == -1)) && ($limit == 0) && ($start ==0) ) { |
1164 | 1164 | // return $this->getObjects(); |
@@ -1170,11 +1170,11 @@ discard block |
||
1170 | 1170 | $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq'); |
1171 | 1171 | |
1172 | 1172 | $categoriesGranted = $smartPermHandler->getPermissions('category'); |
1173 | - $grantedCategories = new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'); |
|
1173 | + $grantedCategories = new Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN'); |
|
1174 | 1174 | |
1175 | 1175 | $faqsGranted = $smartPermHandler->getPermissions('item'); |
1176 | 1176 | $grantedFaq = new CriteriaCompo(); |
1177 | - $grantedFaq->add(new Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR'); |
|
1177 | + $grantedFaq->add(new Criteria('faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR'); |
|
1178 | 1178 | // If user is anonymous, check if the FAQ allow partialview |
1179 | 1179 | if (!is_object($xoopsUser)) { |
1180 | 1180 | $grantedFaq->add(new Criteria('partialview', '1'), 'OR'); |
@@ -1183,9 +1183,9 @@ discard block |
||
1183 | 1183 | |
1184 | 1184 | if (isset($categoryid) && ($categoryid != -1)) { |
1185 | 1185 | if (is_array($categoryid)) { |
1186 | - $criteriaCategory = new Criteria('categoryid', '(' . implode(',', $categoryid) . ')', 'IN'); |
|
1186 | + $criteriaCategory = new Criteria('categoryid', '('.implode(',', $categoryid).')', 'IN'); |
|
1187 | 1187 | } else { |
1188 | - $criteriaCategory = new Criteria('categoryid', (int)$categoryid); |
|
1188 | + $criteriaCategory = new Criteria('categoryid', (int) $categoryid); |
|
1189 | 1189 | } |
1190 | 1190 | } |
1191 | 1191 | |
@@ -1252,7 +1252,7 @@ discard block |
||
1252 | 1252 | $asobject = true, |
1253 | 1253 | $otherCriteria = null |
1254 | 1254 | ) { |
1255 | - include_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; |
|
1255 | + include_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php'; |
|
1256 | 1256 | |
1257 | 1257 | $smartModule = sf_getModuleInfo(); |
1258 | 1258 | |
@@ -1311,7 +1311,7 @@ discard block |
||
1311 | 1311 | |
1312 | 1312 | if ($totalFaqs > 0) { |
1313 | 1313 | --$totalFaqs; |
1314 | - mt_srand((double)microtime() * 1000000); |
|
1314 | + mt_srand((double) microtime() * 1000000); |
|
1315 | 1315 | $entrynumber = mt_rand(0, $totalFaqs); |
1316 | 1316 | $faq = $this->getFaqs(1, $entrynumber, $status, -1, 'datesub', 'DESC', $notNullFields); |
1317 | 1317 | if ($faq) { |
@@ -1346,10 +1346,10 @@ discard block |
||
1346 | 1346 | $httphost = $_SERVER['HTTP_HOST']; |
1347 | 1347 | $querystring = $_SERVER['QUERY_STRING']; |
1348 | 1348 | if ($querystring != '') { |
1349 | - $querystring = '?' . $querystring; |
|
1349 | + $querystring = '?'.$querystring; |
|
1350 | 1350 | } |
1351 | - $currenturl = $http . $httphost . $phpself . $querystring; |
|
1352 | - $fullcontexturl = XOOPS_URL . '/' . $faqsObj[$i]->contextpage(); |
|
1351 | + $currenturl = $http.$httphost.$phpself.$querystring; |
|
1352 | + $fullcontexturl = XOOPS_URL.'/'.$faqsObj[$i]->contextpage(); |
|
1353 | 1353 | switch ($faqsObj[$i]->modulelink()) { |
1354 | 1354 | case '': |
1355 | 1355 | $display = false; |
@@ -1368,7 +1368,7 @@ discard block |
||
1368 | 1368 | } |
1369 | 1369 | break; |
1370 | 1370 | default: |
1371 | - if (strpos($currenturl, XOOPS_URL . '/modules/') === false) { |
|
1371 | + if (strpos($currenturl, XOOPS_URL.'/modules/') === false) { |
|
1372 | 1372 | $display = false; |
1373 | 1373 | } else { |
1374 | 1374 | if (strpos($currenturl, $faqsObj[$i]->modulelink()) === false) { |
@@ -1386,7 +1386,7 @@ discard block |
||
1386 | 1386 | } |
1387 | 1387 | |
1388 | 1388 | if (count($randomFaqs) > $limit) { |
1389 | - mt_srand((float)microtime() * 10000000); |
|
1389 | + mt_srand((float) microtime() * 10000000); |
|
1390 | 1390 | $rand_keys = array_rand($randomFaqs, $limit); |
1391 | 1391 | for ($j = 0, $jMax = count($rand_keys); $j < $jMax; ++$j) { |
1392 | 1392 | $ret[] = &$randomFaqs[$rand_keys[$j]]; |
@@ -1409,14 +1409,14 @@ discard block |
||
1409 | 1409 | if (!sf_userIsAdmin()) { |
1410 | 1410 | $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq'); |
1411 | 1411 | $items = $smartPermHandler->getPermissions('item'); |
1412 | - $faqclause = ' AND faqid IN (' . implode(',', $items) . ')'; |
|
1412 | + $faqclause = ' AND faqid IN ('.implode(',', $items).')'; |
|
1413 | 1413 | } |
1414 | 1414 | |
1415 | 1415 | $sql = "CREATE TEMPORARY TABLE tmp (categoryid INT(8) UNSIGNED NOT NULL,datesub INT(11) DEFAULT '0' NOT NULL);"; |
1416 | - $sql2 = ' LOCK TABLES ' . $this->db->prefix('smartfaq_faq') . ' READ;'; |
|
1417 | - $sql3 = ' INSERT INTO tmp SELECT categoryid, MAX(datesub) FROM ' . $this->db->prefix('smartfaq_faq') . ' WHERE status IN (' . implode(',', $status) . ") $faqclause GROUP BY categoryid;"; |
|
1418 | - $sql4 = ' SELECT ' . $this->db->prefix('smartfaq_faq') . '.categoryid, faqid, question, uid, ' . $this->db->prefix('smartfaq_faq') . '.datesub FROM ' . $this->db->prefix('smartfaq_faq') . ', tmp |
|
1419 | - WHERE ' . $this->db->prefix('smartfaq_faq') . '.categoryid=tmp.categoryid AND ' . $this->db->prefix('smartfaq_faq') . '.datesub=tmp.datesub;'; |
|
1416 | + $sql2 = ' LOCK TABLES '.$this->db->prefix('smartfaq_faq').' READ;'; |
|
1417 | + $sql3 = ' INSERT INTO tmp SELECT categoryid, MAX(datesub) FROM '.$this->db->prefix('smartfaq_faq').' WHERE status IN ('.implode(',', $status).") $faqclause GROUP BY categoryid;"; |
|
1418 | + $sql4 = ' SELECT '.$this->db->prefix('smartfaq_faq').'.categoryid, faqid, question, uid, '.$this->db->prefix('smartfaq_faq').'.datesub FROM '.$this->db->prefix('smartfaq_faq').', tmp |
|
1419 | + WHERE ' . $this->db->prefix('smartfaq_faq').'.categoryid=tmp.categoryid AND '.$this->db->prefix('smartfaq_faq').'.datesub=tmp.datesub;'; |
|
1420 | 1420 | /* |
1421 | 1421 | //Old implementation |
1422 | 1422 | $sql = "SELECT categoryid, faqid, question, uid, MAX(datesub) AS datesub FROM ".$this->db->prefix("smartfaq_faq")." |
@@ -1431,7 +1431,7 @@ discard block |
||
1431 | 1431 | $this->db->queryF('UNLOCK TABLES;'); |
1432 | 1432 | $this->db->queryF('DROP TABLE tmp;'); |
1433 | 1433 | if (!$result) { |
1434 | - trigger_error('Error in getLastPublishedByCat SQL: ' . $error); |
|
1434 | + trigger_error('Error in getLastPublishedByCat SQL: '.$error); |
|
1435 | 1435 | |
1436 | 1436 | return $ret; |
1437 | 1437 | } |
@@ -1453,9 +1453,9 @@ discard block |
||
1453 | 1453 | */ |
1454 | 1454 | public function deleteAll($criteria = null) |
1455 | 1455 | { |
1456 | - $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_faq'); |
|
1456 | + $sql = 'DELETE FROM '.$this->db->prefix('smartfaq_faq'); |
|
1457 | 1457 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
1458 | - $sql .= ' ' . $criteria->renderWhere(); |
|
1458 | + $sql .= ' '.$criteria->renderWhere(); |
|
1459 | 1459 | } |
1460 | 1460 | if (!$this->db->query($sql)) { |
1461 | 1461 | return false; |
@@ -1476,10 +1476,10 @@ discard block |
||
1476 | 1476 | **/ |
1477 | 1477 | public function updateAll($fieldname, $fieldvalue, $criteria = null) |
1478 | 1478 | { |
1479 | - $set_clause = is_numeric($fieldvalue) ? $fieldname . ' = ' . $fieldvalue : $fieldname . ' = ' . $this->db->quoteString($fieldvalue); |
|
1480 | - $sql = 'UPDATE ' . $this->db->prefix('smartfaq_faq') . ' SET ' . $set_clause; |
|
1479 | + $set_clause = is_numeric($fieldvalue) ? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue); |
|
1480 | + $sql = 'UPDATE '.$this->db->prefix('smartfaq_faq').' SET '.$set_clause; |
|
1481 | 1481 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
1482 | - $sql .= ' ' . $criteria->renderWhere(); |
|
1482 | + $sql .= ' '.$criteria->renderWhere(); |
|
1483 | 1483 | } |
1484 | 1484 | if (!$this->db->queryF($sql)) { |
1485 | 1485 | return false; |
@@ -1494,7 +1494,7 @@ discard block |
||
1494 | 1494 | */ |
1495 | 1495 | public function updateCounter($faqid) |
1496 | 1496 | { |
1497 | - $sql = 'UPDATE ' . $this->db->prefix('smartfaq_faq') . ' SET counter=counter+1 WHERE faqid = ' . $faqid; |
|
1497 | + $sql = 'UPDATE '.$this->db->prefix('smartfaq_faq').' SET counter=counter+1 WHERE faqid = '.$faqid; |
|
1498 | 1498 | if ($this->db->queryF($sql)) { |
1499 | 1499 | return true; |
1500 | 1500 | } else { |
@@ -1550,8 +1550,8 @@ discard block |
||
1550 | 1550 | $criteriaKeywords = new CriteriaCompo(); |
1551 | 1551 | for ($i = 0, $iMax = count($queryarray); $i < $iMax; ++$i) { |
1552 | 1552 | $criteriaKeyword = new CriteriaCompo(); |
1553 | - $criteriaKeyword->add(new Criteria('faq.question', '%' . $queryarray[$i] . '%', 'LIKE'), 'OR'); |
|
1554 | - $criteriaKeyword->add(new Criteria('answer.answer', '%' . $queryarray[$i] . '%', 'LIKE'), 'OR'); |
|
1553 | + $criteriaKeyword->add(new Criteria('faq.question', '%'.$queryarray[$i].'%', 'LIKE'), 'OR'); |
|
1554 | + $criteriaKeyword->add(new Criteria('answer.answer', '%'.$queryarray[$i].'%', 'LIKE'), 'OR'); |
|
1555 | 1555 | $criteriaKeywords->add($criteriaKeyword, $andor); |
1556 | 1556 | unset($criteriaKeyword); |
1557 | 1557 | } |
@@ -1569,9 +1569,9 @@ discard block |
||
1569 | 1569 | if (!$faqsGranted) { |
1570 | 1570 | return $ret; |
1571 | 1571 | } |
1572 | - $grantedCategories = new Criteria('faq.categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'); |
|
1572 | + $grantedCategories = new Criteria('faq.categoryid', '('.implode(',', $categoriesGranted).')', 'IN'); |
|
1573 | 1573 | $grantedFaq = new CriteriaCompo(); |
1574 | - $grantedFaq->add(new Criteria('faq.faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR'); |
|
1574 | + $grantedFaq->add(new Criteria('faq.faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR'); |
|
1575 | 1575 | // If user is anonymous, check if the FAQ allow partialview |
1576 | 1576 | if (!is_object($xoopsUser)) { |
1577 | 1577 | $grantedFaq->add(new Criteria('partialview', '1'), 'OR'); |
@@ -1627,9 +1627,9 @@ discard block |
||
1627 | 1627 | $whereClause = $criteria->renderWhere(); |
1628 | 1628 | |
1629 | 1629 | if ($whereClause !== 'WHERE ()') { |
1630 | - $sql .= ' ' . $criteria->renderWhere(); |
|
1630 | + $sql .= ' '.$criteria->renderWhere(); |
|
1631 | 1631 | if ($criteria->getSort() != '') { |
1632 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
1632 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
1633 | 1633 | } |
1634 | 1634 | $limit = $criteria->getLimit(); |
1635 | 1635 | $start = $criteria->getStart(); |
@@ -1668,19 +1668,19 @@ discard block |
||
1668 | 1668 | { |
1669 | 1669 | global $xoopsUser; |
1670 | 1670 | $ret = array(); |
1671 | - $sql = 'SELECT categoryid, COUNT(*) AS count FROM ' . $this->db->prefix('smartfaq_faq'); |
|
1672 | - if ((int)$cat_id > 0) { |
|
1673 | - $sql .= ' WHERE categoryid = ' . (int)$cat_id; |
|
1674 | - $sql .= ' AND status IN (' . implode(',', $status) . ')'; |
|
1671 | + $sql = 'SELECT categoryid, COUNT(*) AS count FROM '.$this->db->prefix('smartfaq_faq'); |
|
1672 | + if ((int) $cat_id > 0) { |
|
1673 | + $sql .= ' WHERE categoryid = '.(int) $cat_id; |
|
1674 | + $sql .= ' AND status IN ('.implode(',', $status).')'; |
|
1675 | 1675 | } else { |
1676 | - $sql .= ' WHERE status IN (' . implode(',', $status) . ')'; |
|
1676 | + $sql .= ' WHERE status IN ('.implode(',', $status).')'; |
|
1677 | 1677 | if (!sf_userIsAdmin()) { |
1678 | 1678 | $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq'); |
1679 | 1679 | $items = $smartPermHandler->getPermissions('item'); |
1680 | 1680 | if (is_object($xoopsUser)) { |
1681 | - $sql .= ' AND faqid IN (' . implode(',', $items) . ')'; |
|
1681 | + $sql .= ' AND faqid IN ('.implode(',', $items).')'; |
|
1682 | 1682 | } else { |
1683 | - $sql .= ' AND (faqid IN (' . implode(',', $items) . ') OR partialview = 1)'; |
|
1683 | + $sql .= ' AND (faqid IN ('.implode(',', $items).') OR partialview = 1)'; |
|
1684 | 1684 | } |
1685 | 1685 | } |
1686 | 1686 | } |
@@ -1693,7 +1693,7 @@ discard block |
||
1693 | 1693 | return $ret; |
1694 | 1694 | } |
1695 | 1695 | while ($row = $this->db->fetchArray($result)) { |
1696 | - $ret[$row['categoryid']] = (int)$row['count']; |
|
1696 | + $ret[$row['categoryid']] = (int) $row['count']; |
|
1697 | 1697 | } |
1698 | 1698 | |
1699 | 1699 | return $ret; |