@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | * Add appendix |
121 | 121 | * |
122 | 122 | * @access public |
123 | - * @param $permName |
|
123 | + * @param string $permName |
|
124 | 124 | * @param $itemId |
125 | - * @param $itemName |
|
125 | + * @param string $itemName |
|
126 | 126 | */ |
127 | 127 | public function addAppendix($permName, $itemId, $itemName) |
128 | 128 | { |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | /** |
257 | 257 | * Constructor |
258 | 258 | * @param $caption |
259 | - * @param $name |
|
259 | + * @param string $name |
|
260 | 260 | * @param $groupId |
261 | 261 | * @param null $values |
262 | 262 | */ |
@@ -37,12 +37,12 @@ discard block |
||
37 | 37 | // ------------------------------------------------------------------------- // |
38 | 38 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
39 | 39 | |
40 | -require_once XOOPS_ROOT_PATH . '/class/xoopsform/formelement.php'; |
|
41 | -require_once XOOPS_ROOT_PATH . '/class/xoopsform/formhidden.php'; |
|
42 | -require_once XOOPS_ROOT_PATH . '/class/xoopsform/formhiddentoken.php'; |
|
43 | -require_once XOOPS_ROOT_PATH . '/class/xoopsform/formbutton.php'; |
|
44 | -require_once XOOPS_ROOT_PATH . '/class/xoopsform/formelementtray.php'; |
|
45 | -require_once XOOPS_ROOT_PATH . '/class/xoopsform/form.php'; |
|
40 | +require_once XOOPS_ROOT_PATH.'/class/xoopsform/formelement.php'; |
|
41 | +require_once XOOPS_ROOT_PATH.'/class/xoopsform/formhidden.php'; |
|
42 | +require_once XOOPS_ROOT_PATH.'/class/xoopsform/formhiddentoken.php'; |
|
43 | +require_once XOOPS_ROOT_PATH.'/class/xoopsform/formbutton.php'; |
|
44 | +require_once XOOPS_ROOT_PATH.'/class/xoopsform/formelementtray.php'; |
|
45 | +require_once XOOPS_ROOT_PATH.'/class/xoopsform/form.php'; |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Renders a form for setting module specific group permissions |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | { |
94 | 94 | // $this->XoopsForm($title, 'groupperm_form', XOOPS_URL.'/modules/system/admin/groupperm.php', 'post'); GIJ |
95 | 95 | parent::__construct($title, 'groupperm_form', '', 'post'); |
96 | - $this->_modid = (int)$modid; |
|
96 | + $this->_modid = (int) $modid; |
|
97 | 97 | $this->_permName = $permname; |
98 | 98 | $this->_permDesc = $permdesc; |
99 | 99 | $this->addElement(new XoopsFormHidden('modid', $this->_modid)); |
@@ -167,11 +167,11 @@ discard block |
||
167 | 167 | } |
168 | 168 | $gpermHandler = xoops_getHandler('groupperm'); |
169 | 169 | $memberHandler = xoops_getHandler('member'); |
170 | - $glist =& $memberHandler->getGroupList(); |
|
170 | + $glist = & $memberHandler->getGroupList(); |
|
171 | 171 | foreach (array_keys($glist) as $i) { |
172 | 172 | // get selected item id(s) for each group |
173 | 173 | $selected = $gpermHandler->getItemIds($this->_permName, $i, $this->_modid); |
174 | - $ele = new MyXoopsGroupFormCheckBox($glist[$i], 'perms[' . $this->_permName . ']', $i, $selected); |
|
174 | + $ele = new MyXoopsGroupFormCheckBox($glist[$i], 'perms['.$this->_permName.']', $i, $selected); |
|
175 | 175 | $ele->setOptionTree($this->_itemTree); |
176 | 176 | |
177 | 177 | foreach ($this->_appendix as $key => $append) { |
@@ -198,18 +198,18 @@ discard block |
||
198 | 198 | $tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
199 | 199 | $this->addElement($tray); |
200 | 200 | |
201 | - $ret = '<h4>' . $this->getTitle() . '</h4>' . $this->_permDesc . '<br />'; |
|
202 | - $ret .= "<form name='" . $this->getName() . "' id='" . $this->getName() . "' action='" . $this->getAction() . "' method='" . $this->getMethod() . "'" . $this->getExtra() . ">\n<table width='100%' class='outer' cellspacing='1'>\n"; |
|
203 | - $elements =& $this->getElements(); |
|
201 | + $ret = '<h4>'.$this->getTitle().'</h4>'.$this->_permDesc.'<br />'; |
|
202 | + $ret .= "<form name='".$this->getName()."' id='".$this->getName()."' action='".$this->getAction()."' method='".$this->getMethod()."'".$this->getExtra().">\n<table width='100%' class='outer' cellspacing='1'>\n"; |
|
203 | + $elements = & $this->getElements(); |
|
204 | 204 | foreach (array_keys($elements) as $i) { |
205 | 205 | if (!is_object($elements[$i])) { |
206 | 206 | $ret .= $elements[$i]; |
207 | 207 | } elseif (!$elements[$i]->isHidden()) { |
208 | - $ret .= "<tr valign='top' align='left'><td class='head'>" . $elements[$i]->getCaption(); |
|
208 | + $ret .= "<tr valign='top' align='left'><td class='head'>".$elements[$i]->getCaption(); |
|
209 | 209 | if ($elements[$i]->getDescription() != '') { |
210 | - $ret .= '<br /><br /><span style="font-weight: normal;">' . $elements[$i]->getDescription() . '</span>'; |
|
210 | + $ret .= '<br /><br /><span style="font-weight: normal;">'.$elements[$i]->getDescription().'</span>'; |
|
211 | 211 | } |
212 | - $ret .= "</td>\n<td class='even'>\n" . $elements[$i]->render() . "\n</td></tr>\n"; |
|
212 | + $ret .= "</td>\n<td class='even'>\n".$elements[$i]->render()."\n</td></tr>\n"; |
|
213 | 213 | } else { |
214 | 214 | $ret .= $elements[$i]->render(); |
215 | 215 | } |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | */ |
296 | 296 | public function setOptionTree(&$optionTree) |
297 | 297 | { |
298 | - $this->_optionTree =& $optionTree; |
|
298 | + $this->_optionTree = & $optionTree; |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | /** |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | $cols = 1; |
329 | 329 | } |
330 | 330 | $checked = $append['selected'] ? 'checked="checked"' : ''; |
331 | - $name = 'perms[' . $append['permname'] . ']'; |
|
331 | + $name = 'perms['.$append['permname'].']'; |
|
332 | 332 | $itemid = $append['itemid']; |
333 | 333 | $itemid = $append['itemid']; |
334 | 334 | $ret .= "<td class=\"odd\"><input type=\"checkbox\" name=\"{$name}[groups][$this->_groupId][$itemid]\" id=\"{$name}[groups][$this->_groupId][$itemid]\" value=\"1\" $checked />{$append['itemname']}<input type=\"hidden\" name=\"{$name}[parents][$itemid]\" value=\"\" /><input type=\"hidden\" name=\"{$name}[itemname][$itemid]\" value=\"{$append['itemname']}\" /><br /></td>"; |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | $tree = '<td class="odd">'; |
348 | 348 | $prefix = ''; |
349 | 349 | $this->renderOptionTree($tree, $this->_optionTree[$topitem], $prefix); |
350 | - $ret .= $tree . '</td>'; |
|
350 | + $ret .= $tree.'</td>'; |
|
351 | 351 | ++$cols; |
352 | 352 | } |
353 | 353 | $ret .= '</tr></table>'; |
@@ -366,31 +366,31 @@ discard block |
||
366 | 366 | */ |
367 | 367 | private function renderOptionTree(&$tree, $option, $prefix, $parentIds = array()) |
368 | 368 | { |
369 | - $tree .= $prefix . "<input type=\"checkbox\" name=\"" . $this->getName() . '[groups][' . $this->_groupId . '][' . $option['id'] . "]\" id=\"" . $this->getName() . '[groups][' . $this->_groupId . '][' . $option['id'] . "]\" onclick=\""; |
|
369 | + $tree .= $prefix."<input type=\"checkbox\" name=\"".$this->getName().'[groups]['.$this->_groupId.']['.$option['id']."]\" id=\"".$this->getName().'[groups]['.$this->_groupId.']['.$option['id']."]\" onclick=\""; |
|
370 | 370 | // If there are parent elements, add javascript that will |
371 | 371 | // make them selecteded when this element is checked to make |
372 | 372 | // sure permissions to parent items are added as well. |
373 | 373 | foreach ($parentIds as $pid) { |
374 | - $parent_ele = $this->getName() . '[groups][' . $this->_groupId . '][' . $pid . ']'; |
|
375 | - $tree .= "var ele = xoopsGetElementById('" . $parent_ele . "'); if (ele.checked != true) {ele.checked = this.checked;}"; |
|
374 | + $parent_ele = $this->getName().'[groups]['.$this->_groupId.']['.$pid.']'; |
|
375 | + $tree .= "var ele = xoopsGetElementById('".$parent_ele."'); if (ele.checked != true) {ele.checked = this.checked;}"; |
|
376 | 376 | } |
377 | 377 | // If there are child elements, add javascript that will |
378 | 378 | // make them unchecked when this element is unchecked to make |
379 | 379 | // sure permissions to child items are not added when there |
380 | 380 | // is no permission to this item. |
381 | 381 | foreach ($option['allchild'] as $cid) { |
382 | - $child_ele = $this->getName() . '[groups][' . $this->_groupId . '][' . $cid . ']'; |
|
383 | - $tree .= "var ele = xoopsGetElementById('" . $child_ele . "'); if (this.checked != true) {ele.checked = false;}"; |
|
382 | + $child_ele = $this->getName().'[groups]['.$this->_groupId.']['.$cid.']'; |
|
383 | + $tree .= "var ele = xoopsGetElementById('".$child_ele."'); if (this.checked != true) {ele.checked = false;}"; |
|
384 | 384 | } |
385 | 385 | $tree .= '" value="1"'; |
386 | 386 | if (isset($this->_value) && in_array($option['id'], $this->_value)) { |
387 | 387 | $tree .= ' checked="checked"'; |
388 | 388 | } |
389 | - $tree .= ' />' . $option['name'] . "<input type=\"hidden\" name=\"" . $this->getName() . '[parents][' . $option['id'] . "]\" value=\"" . implode(':', $parentIds) . "\" /><input type=\"hidden\" name=\"" . $this->getName() . '[itemname][' . $option['id'] . "]\" value=\"" . htmlspecialchars($option['name']) . "\" /><br />\n"; |
|
389 | + $tree .= ' />'.$option['name']."<input type=\"hidden\" name=\"".$this->getName().'[parents]['.$option['id']."]\" value=\"".implode(':', $parentIds)."\" /><input type=\"hidden\" name=\"".$this->getName().'[itemname]['.$option['id']."]\" value=\"".htmlspecialchars($option['name'])."\" /><br />\n"; |
|
390 | 390 | if (isset($option['children'])) { |
391 | 391 | foreach ($option['children'] as $child) { |
392 | 392 | array_push($parentIds, $option['id']); |
393 | - $this->renderOptionTree($tree, $this->_optionTree[$child], $prefix . ' -', $parentIds); |
|
393 | + $this->renderOptionTree($tree, $this->_optionTree[$child], $prefix.' -', $parentIds); |
|
394 | 394 | } |
395 | 395 | } |
396 | 396 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | $startfaq = isset($_GET['startfaq']) ? (int)$_GET['startfaq'] : 0; |
27 | 27 | |
28 | 28 | /** |
29 | - * @param bool $showmenu |
|
29 | + * @param string $showmenu |
|
30 | 30 | * @param int $faqid |
31 | 31 | */ |
32 | 32 | function editfaq($showmenu = false, $faqid = -1) |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * Licence: GNU |
7 | 7 | */ |
8 | 8 | |
9 | -include_once __DIR__ . '/admin_header.php'; |
|
9 | +include_once __DIR__.'/admin_header.php'; |
|
10 | 10 | |
11 | 11 | // Creating the faq handler object |
12 | 12 | $faqHandler = sf_gethandler('faq'); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | } |
24 | 24 | |
25 | 25 | // Where shall we start? |
26 | -$startfaq = isset($_GET['startfaq']) ? (int)$_GET['startfaq'] : 0; |
|
26 | +$startfaq = isset($_GET['startfaq']) ? (int) $_GET['startfaq'] : 0; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * @param bool $showmenu |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | global $faqHandler, $categoryHandler, $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $modify, $xoopsModuleConfig, $xoopsModule, $XOOPS_URL, $myts; |
35 | 35 | |
36 | - include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
36 | + include_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
37 | 37 | // If there is a parameter, and the id exists, retrieve data: we're editing a faq |
38 | 38 | if ($faqid != -1) { |
39 | 39 | // Creating the FAQ object |
@@ -65,12 +65,12 @@ discard block |
||
65 | 65 | |
66 | 66 | echo "<br />\n"; |
67 | 67 | sf_collapsableBar('bottomtable', 'bottomtableicon'); |
68 | - echo "<img id='bottomtableicon' src=" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt='' /></a> " . $collapsableBar_title . '</h3>'; |
|
68 | + echo "<img id='bottomtableicon' src=".XOOPS_URL.'/modules/'.$xoopsModule->dirname()."/assets/images/icon/close12.gif alt='' /></a> ".$collapsableBar_title.'</h3>'; |
|
69 | 69 | echo "<div id='bottomtable'>"; |
70 | - echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . $collapsableBar_info . '</span>'; |
|
70 | + echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">".$collapsableBar_info.'</span>'; |
|
71 | 71 | } else { |
72 | 72 | // there's no parameter, so we're adding a faq |
73 | - $faqObj =& $faqHandler->create(); |
|
73 | + $faqObj = & $faqHandler->create(); |
|
74 | 74 | $faqObj->setVar('uid', $xoopsUser->getVar('uid')); |
75 | 75 | $categoryObj = $categoryHandler->create(); |
76 | 76 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $button_caption = _AM_SF_CREATE; |
79 | 79 | |
80 | 80 | sf_collapsableBar('bottomtable', 'bottomtableicon'); |
81 | - echo "<img id='bottomtableicon' src=" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt='' /></a> " . _AM_SF_CREATEQUESTION . '</h3>'; |
|
81 | + echo "<img id='bottomtableicon' src=".XOOPS_URL.'/modules/'.$xoopsModule->dirname()."/assets/images/icon/close12.gif alt='' /></a> "._AM_SF_CREATEQUESTION.'</h3>'; |
|
82 | 82 | echo "<div id='bottomtable'>"; |
83 | 83 | } |
84 | 84 | $sform = new XoopsThemeForm(_AM_SF_OPEN_QUESTION, 'op', xoops_getenv('PHP_SELF')); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $button_tray->addElement($butt_create); |
153 | 153 | |
154 | 154 | $butt_edit = new XoopsFormButton('', '', _AM_SF_OPEN_QUESTION_EDIT, 'button'); |
155 | - $butt_edit->setExtra("onclick=\"location='faq.php?op=mod&faqid=" . $faqid . "'\""); |
|
155 | + $butt_edit->setExtra("onclick=\"location='faq.php?op=mod&faqid=".$faqid."'\""); |
|
156 | 156 | $button_tray->addElement($butt_edit); |
157 | 157 | |
158 | 158 | $butt_cancel = new XoopsFormButton('', '', _AM_SF_CANCEL, 'button'); |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | xoops_cp_header(); |
185 | 185 | |
186 | 186 | echo $indexAdmin->addNavigation(basename(__FILE__)); |
187 | - include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
187 | + include_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
188 | 188 | |
189 | 189 | editfaq(true, $faqid); |
190 | 190 | break; |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $uid = $xoopsUser->uid(); |
203 | 203 | } |
204 | 204 | |
205 | - $faqid = isset($_POST['faqid']) ? (int)$_POST['faqid'] : -1; |
|
205 | + $faqid = isset($_POST['faqid']) ? (int) $_POST['faqid'] : -1; |
|
206 | 206 | |
207 | 207 | // Creating the FAQ |
208 | 208 | if ($faqid != -1) { |
@@ -213,9 +213,9 @@ discard block |
||
213 | 213 | |
214 | 214 | // Putting the values in the FAQ object |
215 | 215 | $faqObj->setGroups_read(isset($_POST['groups']) ? $_POST['groups'] : array()); |
216 | - $faqObj->setVar('categoryid', isset($_POST['categoryid']) ? (int)$_POST['categoryid'] : 0); |
|
216 | + $faqObj->setVar('categoryid', isset($_POST['categoryid']) ? (int) $_POST['categoryid'] : 0); |
|
217 | 217 | $faqObj->setVar('question', $_POST['question']); |
218 | - $faqObj->setVar('status', isset($_POST['status']) ? (int)$_POST['status'] : _SF_STATUS_ASKED); |
|
218 | + $faqObj->setVar('status', isset($_POST['status']) ? (int) $_POST['status'] : _SF_STATUS_ASKED); |
|
219 | 219 | |
220 | 220 | $notifToDo = null; |
221 | 221 | |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | |
248 | 248 | // Storing the FAQ |
249 | 249 | if (!$faqObj->store()) { |
250 | - redirect_header('javascript:history.go(-1)', 3, _AM_SF_ERROR . sf_formatErrors($faqObj->getErrors())); |
|
250 | + redirect_header('javascript:history.go(-1)', 3, _AM_SF_ERROR.sf_formatErrors($faqObj->getErrors())); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | // Send notifications |
@@ -265,8 +265,8 @@ discard block |
||
265 | 265 | $module_id = $xoopsModule->getVar('mid'); |
266 | 266 | $gpermHandler = xoops_getHandler('groupperm'); |
267 | 267 | |
268 | - $faqid = isset($_POST['faqid']) ? (int)$_POST['faqid'] : 0; |
|
269 | - $faqid = isset($_GET['faqid']) ? (int)$_GET['faqid'] : $faqid; |
|
268 | + $faqid = isset($_POST['faqid']) ? (int) $_POST['faqid'] : 0; |
|
269 | + $faqid = isset($_GET['faqid']) ? (int) $_GET['faqid'] : $faqid; |
|
270 | 270 | |
271 | 271 | $faqObj = new sfFaq($faqid); |
272 | 272 | |
@@ -281,9 +281,9 @@ discard block |
||
281 | 281 | redirect_header('question.php', 2, sprintf(_AM_SF_QUESTIONISDELETED, $faqObj->question())); |
282 | 282 | } else { |
283 | 283 | // no confirm: show deletion condition |
284 | - $faqid = isset($_GET['faqid']) ? (int)$_GET['faqid'] : 0; |
|
284 | + $faqid = isset($_GET['faqid']) ? (int) $_GET['faqid'] : 0; |
|
285 | 285 | xoops_cp_header(); |
286 | - xoops_confirm(array('op' => 'del', 'faqid' => $faqObj->faqid(), 'confirm' => 1, 'name' => $faqObj->question()), 'question.php', _AM_SF_DELETETHISQUESTION . " <br />'" . $faqObj->question() . "'. <br /> <br />", _AM_SF_DELETE); |
|
286 | + xoops_confirm(array('op' => 'del', 'faqid' => $faqObj->faqid(), 'confirm' => 1, 'name' => $faqObj->question()), 'question.php', _AM_SF_DELETETHISQUESTION." <br />'".$faqObj->question()."'. <br /> <br />", _AM_SF_DELETE); |
|
287 | 287 | xoops_cp_footer(); |
288 | 288 | } |
289 | 289 | |
@@ -296,8 +296,8 @@ discard block |
||
296 | 296 | xoops_cp_header(); |
297 | 297 | echo $indexAdmin->addNavigation(basename(__FILE__)); |
298 | 298 | |
299 | - include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
300 | - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
299 | + include_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
300 | + include_once XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
301 | 301 | |
302 | 302 | global $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $xoopsModuleConfig, $xoopsModule, $smartModuleConfig; |
303 | 303 | |
@@ -305,9 +305,9 @@ discard block |
||
305 | 305 | |
306 | 306 | sf_collapsableBar('toptable', 'toptableicon'); |
307 | 307 | |
308 | - echo "<img id='toptableicon' src=" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt='' /></a> " . _AM_SF_OPENED_TITLE . '</h3>'; |
|
308 | + echo "<img id='toptableicon' src=".XOOPS_URL.'/modules/'.$xoopsModule->dirname()."/assets/images/icon/close12.gif alt='' /></a> "._AM_SF_OPENED_TITLE.'</h3>'; |
|
309 | 309 | echo "<div id='toptable'>"; |
310 | - echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . _AM_SF_OPENED_DSC . '</span>'; |
|
310 | + echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">"._AM_SF_OPENED_DSC.'</span>'; |
|
311 | 311 | |
312 | 312 | // Get the total number of published FAQs |
313 | 313 | $totalfaqs = $faqHandler->getFaqsCount(-1, array(_SF_STATUS_OPENED)); |
@@ -317,48 +317,48 @@ discard block |
||
317 | 317 | $allcats = $categoryHandler->getObjects(null, true); |
318 | 318 | echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>"; |
319 | 319 | echo '<tr>'; |
320 | - echo "<th width='40' class='bg3' align='center'><b>" . _AM_SF_ARTID . '</b></td>'; |
|
321 | - echo "<th width='20%' class='bg3' align='left'><b>" . _AM_SF_ARTCOLNAME . '</b></td>'; |
|
322 | - echo "<th class='bg3' align='left'><b>" . _AM_SF_QUESTION . '</b></td>'; |
|
320 | + echo "<th width='40' class='bg3' align='center'><b>"._AM_SF_ARTID.'</b></td>'; |
|
321 | + echo "<th width='20%' class='bg3' align='left'><b>"._AM_SF_ARTCOLNAME.'</b></td>'; |
|
322 | + echo "<th class='bg3' align='left'><b>"._AM_SF_QUESTION.'</b></td>'; |
|
323 | 323 | |
324 | - echo "<th width='90' class='bg3' align='center'><b>" . _AM_SF_ASKED . '</b></td>'; |
|
324 | + echo "<th width='90' class='bg3' align='center'><b>"._AM_SF_ASKED.'</b></td>'; |
|
325 | 325 | |
326 | - echo "<th width='90' class='bg3' align='center'><b>" . _AM_SF_CREATED . '</b></td>'; |
|
327 | - echo "<th width='60' class='bg3' align='center'><b>" . _AM_SF_ACTION . '</b></td>'; |
|
326 | + echo "<th width='90' class='bg3' align='center'><b>"._AM_SF_CREATED.'</b></td>'; |
|
327 | + echo "<th width='60' class='bg3' align='center'><b>"._AM_SF_ACTION.'</b></td>'; |
|
328 | 328 | echo '</tr>'; |
329 | 329 | //var_dump( $faqsObj); |
330 | 330 | if ($totalfaqs > 0) { |
331 | 331 | global $pathIcon16; |
332 | 332 | foreach (array_keys($faqsObj) as $i) { |
333 | - $categoryObj =& $allcats[$faqsObj[$i]->categoryid()]; |
|
333 | + $categoryObj = & $allcats[$faqsObj[$i]->categoryid()]; |
|
334 | 334 | |
335 | - $modify = "<a href='question.php?op=mod&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . $pathIcon16 . '/edit.png' . "' title='" . _AM_SF_EDITART . "' alt='" . _AM_SF_EDITART . "'></a>"; |
|
336 | - $delete = "<a href='question.php?op=del&faqid=" . $faqsObj[$i]->faqid() . "'><img src='" . $pathIcon16 . '/delete.png' . "' title='" . _AM_SF_DELETEART . "' alt='" . _AM_SF_DELETEART . "'></a>"; |
|
335 | + $modify = "<a href='question.php?op=mod&faqid=".$faqsObj[$i]->faqid()."'><img src='".$pathIcon16.'/edit.png'."' title='"._AM_SF_EDITART."' alt='"._AM_SF_EDITART."'></a>"; |
|
336 | + $delete = "<a href='question.php?op=del&faqid=".$faqsObj[$i]->faqid()."'><img src='".$pathIcon16.'/delete.png'."' title='"._AM_SF_DELETEART."' alt='"._AM_SF_DELETEART."'></a>"; |
|
337 | 337 | |
338 | 338 | $requester = sf_getLinkedUnameFromId($faqsObj[$i]->uid(), $smartModuleConfig['userealname']); |
339 | 339 | |
340 | 340 | echo '<tr>'; |
341 | - echo "<td class='head' align='center'>" . $faqsObj[$i]->faqid() . '</td>'; |
|
342 | - echo "<td class='even' align='left'>" . $categoryObj->name() . '</td>'; |
|
343 | - echo "<td class='even' align='left'><a href='" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/answer.php?faqid=' . $faqsObj[$i]->faqid() . "'>" . $faqsObj[$i]->question(100) . '</a></td>'; |
|
341 | + echo "<td class='head' align='center'>".$faqsObj[$i]->faqid().'</td>'; |
|
342 | + echo "<td class='even' align='left'>".$categoryObj->name().'</td>'; |
|
343 | + echo "<td class='even' align='left'><a href='".XOOPS_URL.'/modules/'.$xoopsModule->dirname().'/answer.php?faqid='.$faqsObj[$i]->faqid()."'>".$faqsObj[$i]->question(100).'</a></td>'; |
|
344 | 344 | |
345 | - echo "<td class='even' align='center'>" . $requester . '</td>'; |
|
345 | + echo "<td class='even' align='center'>".$requester.'</td>'; |
|
346 | 346 | |
347 | - echo "<td class='even' align='center'>" . $faqsObj[$i]->datesub('s') . '</td>'; |
|
347 | + echo "<td class='even' align='center'>".$faqsObj[$i]->datesub('s').'</td>'; |
|
348 | 348 | echo "<td class='even' align='center'> $modify $delete </td>"; |
349 | 349 | echo '</tr>'; |
350 | 350 | } |
351 | 351 | } else { |
352 | 352 | $faqid = -1; |
353 | 353 | echo '<tr>'; |
354 | - echo "<td class='head' align='center' colspan= '7'>" . _AM_SF_NOQUEUED . '</td>'; |
|
354 | + echo "<td class='head' align='center' colspan= '7'>"._AM_SF_NOQUEUED.'</td>'; |
|
355 | 355 | echo '</tr>'; |
356 | 356 | } |
357 | 357 | echo "</table>\n"; |
358 | 358 | echo "<br />\n"; |
359 | 359 | |
360 | 360 | $pagenav = new XoopsPageNav($totalfaqs, $xoopsModuleConfig['perpage'], $startfaq, 'startfaq'); |
361 | - echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'; |
|
361 | + echo '<div style="text-align:right;">'.$pagenav->renderNav().'</div>'; |
|
362 | 362 | echo '</div>'; |
363 | 363 | |
364 | 364 | $totalcategories = $categoryHandler->getCategoriesCount(-1); |
@@ -369,4 +369,4 @@ discard block |
||
369 | 369 | break; |
370 | 370 | } |
371 | 371 | |
372 | -include_once __DIR__ . '/admin_footer.php'; |
|
372 | +include_once __DIR__.'/admin_footer.php'; |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | /** |
29 | 29 | * constructor |
30 | - * @param null $id |
|
30 | + * @param integer $id |
|
31 | 31 | */ |
32 | 32 | public function __construct($id = null) |
33 | 33 | { |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | * create a new answer |
369 | 369 | * |
370 | 370 | * @param bool $isNew flag the new objects as "new"? |
371 | - * @return object sfAnswer |
|
371 | + * @return sfAnswer sfAnswer |
|
372 | 372 | */ |
373 | 373 | public function create($isNew = true) |
374 | 374 | { |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | /** |
411 | 411 | * insert a new answer in the database |
412 | 412 | * |
413 | - * @param XoopsObject $answerObj reference to the <a href='psi_element://sfAnswer'>sfAnswer</a> object |
|
413 | + * @param sfAnswer $answerObj reference to the <a href='psi_element://sfAnswer'>sfAnswer</a> object |
|
414 | 414 | * @param bool $force |
415 | 415 | * @return bool FALSE if failed, TRUE if already present and unchanged or successful |
416 | 416 | */ |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | if (!$attach_key) { |
92 | 92 | return false; |
93 | 93 | } |
94 | - $this->attachment_array[(string)$attach_key]['num_download']++; |
|
94 | + $this->attachment_array[(string) $attach_key]['num_download']++; |
|
95 | 95 | |
96 | - return $this->attachment_array[(string)$attach_key]['num_download']; |
|
96 | + return $this->attachment_array[(string) $attach_key]['num_download']; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $attachment_save = base64_encode(serialize($this->attachment_array)); |
107 | 107 | } |
108 | 108 | $this->setVar('attachment', $attachment_save); |
109 | - $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('smartfaq_answers') . ' SET attachment=' . $GLOBALS['xoopsDB']->quoteString($attachment_save) . ' WHERE post_id = ' . $this->getVar('answerid'); |
|
109 | + $sql = 'UPDATE '.$GLOBALS['xoopsDB']->prefix('smartfaq_answers').' SET attachment='.$GLOBALS['xoopsDB']->quoteString($attachment_save).' WHERE post_id = '.$this->getVar('answerid'); |
|
110 | 110 | if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { |
111 | 111 | //xoops_error($GLOBALS["xoopsDB"]->error()); |
112 | 112 | return false; |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | |
139 | 139 | foreach ($attach_old as $key => $attach) { |
140 | 140 | if (in_array($key, $attach_array)) { |
141 | - @unlink(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attach['name_saved']); |
|
142 | - @unlink(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/thumbs/' . $attach['name_saved']); // delete thumbnails |
|
141 | + @unlink(XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/'.$attach['name_saved']); |
|
142 | + @unlink(XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/thumbs/'.$attach['name_saved']); // delete thumbnails |
|
143 | 143 | continue; |
144 | 144 | } |
145 | 145 | $this->attachment_array[$key] = $attach; |
@@ -165,12 +165,12 @@ discard block |
||
165 | 165 | static $counter = 0; |
166 | 166 | $this->attachment_array = $this->getAttachment(); |
167 | 167 | if ($name_saved) { |
168 | - $key = (string)(time() + ($counter++)); |
|
168 | + $key = (string) (time()+($counter++)); |
|
169 | 169 | $this->attachment_array[$key] = array( |
170 | 170 | 'name_saved' => $name_saved, |
171 | 171 | 'name_display' => isset($name_display) ? $name_display : $name_saved, |
172 | 172 | 'mimetype' => $mimetype, |
173 | - 'num_download' => isset($num_download) ? (int)$num_download : 0 |
|
173 | + 'num_download' => isset($num_download) ? (int) $num_download : 0 |
|
174 | 174 | ); |
175 | 175 | } |
176 | 176 | $attachment_save = null; |
@@ -196,30 +196,30 @@ 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']); |
|
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 | 216 | $isDisplayed = true; |
217 | 217 | } else { |
218 | 218 | global $xoopsUser; |
219 | 219 | if (empty($xoopsModuleConfig['show_userattach'])) { |
220 | - $post_attachment .= '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/dl_attachment.php?attachid=' . $key . '&post_id=' . $this->getVar('post_id') . '"> <img src="' . $icon_filetype . '" alt="' . $filetype . '" /> ' . $att['name_display'] . '</a> ' . _MD_FILESIZE . ': ' . $file_size . '; ' . _MD_HITS . ': ' . $att['num_download']; |
|
220 | + $post_attachment .= '<a href="'.XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname', 'n').'/dl_attachment.php?attachid='.$key.'&post_id='.$this->getVar('post_id').'"> <img src="'.$icon_filetype.'" alt="'.$filetype.'" /> '.$att['name_display'].'</a> '._MD_FILESIZE.': '.$file_size.'; '._MD_HITS.': '.$att['num_download']; |
|
221 | 221 | } elseif ($xoopsUser && $xoopsUser->uid() > 0 && $xoopsUser->isactive()) { |
222 | - $post_attachment .= '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/dl_attachment.php?attachid=' . $key . '&post_id=' . $this->getVar('post_id') . '"> <img src="' . $icon_filetype . '" alt="' . $filetype . '" /> ' . $att['name_display'] . '</a> ' . _MD_FILESIZE . ': ' . $file_size . '; ' . _MD_HITS . ': ' . $att['num_download']; |
|
222 | + $post_attachment .= '<a href="'.XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname', 'n').'/dl_attachment.php?attachid='.$key.'&post_id='.$this->getVar('post_id').'"> <img src="'.$icon_filetype.'" alt="'.$filetype.'" /> '.$att['name_display'].'</a> '._MD_FILESIZE.': '.$file_size.'; '._MD_HITS.': '.$att['num_download']; |
|
223 | 223 | } else { |
224 | 224 | $post_attachment .= _MD_NEWBB_SEENOTGUEST; |
225 | 225 | } |
@@ -328,9 +328,9 @@ discard block |
||
328 | 328 | $tags = array(); |
329 | 329 | $tags['MODULE_NAME'] = $myts->displayTarea($smartModule->getVar('name')); |
330 | 330 | $tags['FAQ_NAME'] = $faqObj->question(); |
331 | - $tags['FAQ_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/faq.php?faqid=' . $faqObj->faqid(); |
|
331 | + $tags['FAQ_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/faq.php?faqid='.$faqObj->faqid(); |
|
332 | 332 | $tags['CATEGORY_NAME'] = $faqObj->getCategoryName(); |
333 | - $tags['CATEGORY_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/category.php?categoryid=' . $faqObj->categoryid(); |
|
333 | + $tags['CATEGORY_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/category.php?categoryid='.$faqObj->categoryid(); |
|
334 | 334 | $tags['FAQ_QUESTION'] = $faqObj->question(); |
335 | 335 | |
336 | 336 | // TODO : Not sure about the 'formpreview' ... |
@@ -389,8 +389,8 @@ discard block |
||
389 | 389 | */ |
390 | 390 | public function get($id = null, $fields = null) |
391 | 391 | { |
392 | - if ((int)$id > 0) { |
|
393 | - $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_answers') . ' WHERE answerid=' . $id; |
|
392 | + if ((int) $id > 0) { |
|
393 | + $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_answers').' WHERE answerid='.$id; |
|
394 | 394 | if (!$result = $this->db->query($sql)) { |
395 | 395 | return false; |
396 | 396 | } |
@@ -518,11 +518,11 @@ discard block |
||
518 | 518 | { |
519 | 519 | $ret = array(); |
520 | 520 | $limit = $start = 0; |
521 | - $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_answers'); |
|
521 | + $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_answers'); |
|
522 | 522 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
523 | - $sql .= ' ' . $criteria->renderWhere(); |
|
523 | + $sql .= ' '.$criteria->renderWhere(); |
|
524 | 524 | if ($criteria->getSort() != '') { |
525 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
525 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
526 | 526 | } |
527 | 527 | $limit = $criteria->getLimit(); |
528 | 528 | $start = $criteria->getStart(); |
@@ -536,9 +536,9 @@ discard block |
||
536 | 536 | $answer = new sfAnswer(); |
537 | 537 | $answer->assignVars($myrow); |
538 | 538 | if (!$id_as_key) { |
539 | - $ret[] =& $answer; |
|
539 | + $ret[] = & $answer; |
|
540 | 540 | } else { |
541 | - $ret[$myrow['answerid']] =& $answer; |
|
541 | + $ret[$myrow['answerid']] = & $answer; |
|
542 | 542 | } |
543 | 543 | unset($answer); |
544 | 544 | } |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | $criteria->setOrder($order); |
601 | 601 | $criteria->setLimit($limit); |
602 | 602 | $criteria->setStart($start); |
603 | - $ret =& $this->getObjects($criteria); |
|
603 | + $ret = & $this->getObjects($criteria); |
|
604 | 604 | |
605 | 605 | return $ret; |
606 | 606 | } |
@@ -613,9 +613,9 @@ discard block |
||
613 | 613 | */ |
614 | 614 | public function getCount(CriteriaElement $criteria = null) |
615 | 615 | { |
616 | - $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_answers'); |
|
616 | + $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('smartfaq_answers'); |
|
617 | 617 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
618 | - $sql .= ' ' . $criteria->renderWhere(); |
|
618 | + $sql .= ' '.$criteria->renderWhere(); |
|
619 | 619 | } |
620 | 620 | $result = $this->db->query($sql); |
621 | 621 | if (!$result) { |
@@ -634,10 +634,10 @@ discard block |
||
634 | 634 | */ |
635 | 635 | public function getCountByFAQ($criteria = null) |
636 | 636 | { |
637 | - $sql = 'SELECT faqid, COUNT(*) FROM ' . $this->db->prefix('smartfaq_answers'); |
|
637 | + $sql = 'SELECT faqid, COUNT(*) FROM '.$this->db->prefix('smartfaq_answers'); |
|
638 | 638 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
639 | - $sql .= ' ' . $criteria->renderWhere(); |
|
640 | - $sql .= ' ' . $criteria->getGroupby(); |
|
639 | + $sql .= ' '.$criteria->renderWhere(); |
|
640 | + $sql .= ' '.$criteria->getGroupby(); |
|
641 | 641 | } |
642 | 642 | |
643 | 643 | //echo "<br />$sql<br />"; |
@@ -664,9 +664,9 @@ discard block |
||
664 | 664 | */ |
665 | 665 | public function deleteAll(CriteriaElement $criteria = null, $force = true, $asObject = false) |
666 | 666 | { |
667 | - $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_answers'); |
|
667 | + $sql = 'DELETE FROM '.$this->db->prefix('smartfaq_answers'); |
|
668 | 668 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
669 | - $sql .= ' ' . $criteria->renderWhere(); |
|
669 | + $sql .= ' '.$criteria->renderWhere(); |
|
670 | 670 | } |
671 | 671 | if (!$this->db->query($sql)) { |
672 | 672 | return false; |
@@ -686,10 +686,10 @@ discard block |
||
686 | 686 | */ |
687 | 687 | public function updateAll($fieldname, $fieldvalue, CriteriaElement $criteria = null, $force = false) |
688 | 688 | { |
689 | - $set_clause = is_numeric($fieldvalue) ? $fieldname . ' = ' . $fieldvalue : $fieldname . ' = ' . $this->db->quoteString($fieldvalue); |
|
690 | - $sql = 'UPDATE ' . $this->db->prefix('smartfaq_answers') . ' SET ' . $set_clause; |
|
689 | + $set_clause = is_numeric($fieldvalue) ? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue); |
|
690 | + $sql = 'UPDATE '.$this->db->prefix('smartfaq_answers').' SET '.$set_clause; |
|
691 | 691 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
692 | - $sql .= ' ' . $criteria->renderWhere(); |
|
692 | + $sql .= ' '.$criteria->renderWhere(); |
|
693 | 693 | } |
694 | 694 | //echo "<br />" . $sql . "<br />"; |
695 | 695 | if (!$this->db->queryF($sql)) { |
@@ -706,8 +706,8 @@ discard block |
||
706 | 706 | public function getLastPublishedByFaq($faqids) |
707 | 707 | { |
708 | 708 | $ret = array(); |
709 | - $sql = 'SELECT faqid, answer, uid, datesub FROM ' . $this->db->prefix('smartfaq_answers') . ' |
|
710 | - WHERE faqid IN (' . implode(',', $faqids) . ') AND status = ' . _SF_AN_STATUS_APPROVED . ' GROUP BY faqid'; |
|
709 | + $sql = 'SELECT faqid, answer, uid, datesub FROM '.$this->db->prefix('smartfaq_answers').' |
|
710 | + WHERE faqid IN (' . implode(',', $faqids).') AND status = '._SF_AN_STATUS_APPROVED.' GROUP BY faqid'; |
|
711 | 711 | $result = $this->db->query($sql); |
712 | 712 | if (!$result) { |
713 | 713 | return $ret; |
@@ -715,7 +715,7 @@ discard block |
||
715 | 715 | while ($row = $this->db->fetchArray($result)) { |
716 | 716 | $answer = new sfAnswer(); |
717 | 717 | $answer->assignVars($row); |
718 | - $ret[$row['faqid']] =& $answer; |
|
718 | + $ret[$row['faqid']] = & $answer; |
|
719 | 719 | unset($answer); |
720 | 720 | } |
721 | 721 |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | * create a new category |
270 | 270 | * |
271 | 271 | * @param bool $isNew flag the new objects as "new"? |
272 | - * @return object sfCategory |
|
272 | + * @return sfCategory sfCategory |
|
273 | 273 | */ |
274 | 274 | public function &create($isNew = true) |
275 | 275 | { |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | /** |
312 | 312 | * insert a new category in the database |
313 | 313 | * |
314 | - * @param XoopsObject $category reference to the {@link sfCategory} object |
|
314 | + * @param sfCategory $category reference to the {@link sfCategory} object |
|
315 | 315 | * @param bool $force |
316 | 316 | * @return bool FALSE if failed, TRUE if already present and unchanged or successful |
317 | 317 | */ |
@@ -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 | } |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | } |
374 | 374 | |
375 | 375 | // Deleteing the sub categories |
376 | - $subcats =& $this->getCategories(0, 0, $category->categoryid()); |
|
376 | + $subcats = & $this->getCategories(0, 0, $category->categoryid()); |
|
377 | 377 | foreach ($subcats as $subcat) { |
378 | 378 | $this->delete($subcat); |
379 | 379 | } |
@@ -410,11 +410,11 @@ discard block |
||
410 | 410 | { |
411 | 411 | $ret = array(); |
412 | 412 | $limit = $start = 0; |
413 | - $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_categories'); |
|
413 | + $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_categories'); |
|
414 | 414 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
415 | - $sql .= ' ' . $criteria->renderWhere(); |
|
415 | + $sql .= ' '.$criteria->renderWhere(); |
|
416 | 416 | if ($criteria->getSort() != '') { |
417 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
417 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
418 | 418 | } |
419 | 419 | $limit = $criteria->getLimit(); |
420 | 420 | $start = $criteria->getStart(); |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | */ |
451 | 451 | public function &getCategories($limit = 0, $start = 0, $parentid = 0, $sort = 'weight', $order = 'ASC', $id_as_key = true) |
452 | 452 | { |
453 | - include_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; |
|
453 | + include_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php'; |
|
454 | 454 | |
455 | 455 | $criteria = new CriteriaCompo(); |
456 | 456 | |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq'); |
465 | 465 | |
466 | 466 | $categoriesGranted = $smartPermHandler->getPermissions('category'); |
467 | - $criteria->add(new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN')); |
|
467 | + $criteria->add(new Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN')); |
|
468 | 468 | } |
469 | 469 | $criteria->setStart($start); |
470 | 470 | $criteria->setLimit($limit); |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | */ |
484 | 484 | public function &getCategoriesWithOpenQuestion($limit = 0, $start = 0, $parentid = 0, $sort = 'weight', $order = 'ASC') |
485 | 485 | { |
486 | - include_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; |
|
486 | + include_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php'; |
|
487 | 487 | |
488 | 488 | $criteria = new CriteriaCompo(); |
489 | 489 | |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq'); |
498 | 498 | |
499 | 499 | $categoriesGranted = $smartPermHandler->getPermissions('category'); |
500 | - $criteria->add(new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN')); |
|
500 | + $criteria->add(new Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN')); |
|
501 | 501 | } |
502 | 502 | |
503 | 503 | $criteria->add(new Criteria('f.status', _SF_STATUS_OPENED)); |
@@ -506,11 +506,11 @@ discard block |
||
506 | 506 | |
507 | 507 | $ret = array(); |
508 | 508 | $limit = $start = 0; |
509 | - $sql = 'SELECT DISTINCT c.categoryid, c.parentid, c.name, c.description, c.total, c.weight, c.created FROM ' . $this->db->prefix('smartfaq_categories') . ' AS c INNER JOIN ' . $this->db->prefix('smartfaq_faq') . ' AS f ON c.categoryid = f.categoryid'; |
|
509 | + $sql = 'SELECT DISTINCT c.categoryid, c.parentid, c.name, c.description, c.total, c.weight, c.created FROM '.$this->db->prefix('smartfaq_categories').' AS c INNER JOIN '.$this->db->prefix('smartfaq_faq').' AS f ON c.categoryid = f.categoryid'; |
|
510 | 510 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
511 | - $sql .= ' ' . $criteria->renderWhere(); |
|
511 | + $sql .= ' '.$criteria->renderWhere(); |
|
512 | 512 | if ($criteria->getSort() != '') { |
513 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
513 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
514 | 514 | } |
515 | 515 | $limit = $criteria->getLimit(); |
516 | 516 | $start = $criteria->getStart(); |
@@ -539,9 +539,9 @@ discard block |
||
539 | 539 | */ |
540 | 540 | public function getCount($criteria = null) |
541 | 541 | { |
542 | - $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_categories'); |
|
542 | + $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('smartfaq_categories'); |
|
543 | 543 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
544 | - $sql .= ' ' . $criteria->renderWhere(); |
|
544 | + $sql .= ' '.$criteria->renderWhere(); |
|
545 | 545 | } |
546 | 546 | $result = $this->db->query($sql); |
547 | 547 | if (!$result) { |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq'); |
569 | 569 | |
570 | 570 | $categoriesGranted = $smartPermHandler->getPermissions('category'); |
571 | - $criteria->add(new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN')); |
|
571 | + $criteria->add(new Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN')); |
|
572 | 572 | } |
573 | 573 | } |
574 | 574 | |
@@ -591,16 +591,16 @@ discard block |
||
591 | 591 | $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq'); |
592 | 592 | |
593 | 593 | $categoriesGranted = $smartPermHandler->getPermissions('category'); |
594 | - $criteria->add(new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN')); |
|
594 | + $criteria->add(new Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN')); |
|
595 | 595 | } |
596 | 596 | } |
597 | 597 | |
598 | 598 | $criteria->add(new Criteria('f.status', _SF_STATUS_OPENED)); |
599 | 599 | |
600 | - $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'; |
|
600 | + $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'; |
|
601 | 601 | |
602 | 602 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
603 | - $sql .= ' ' . $criteria->renderWhere(); |
|
603 | + $sql .= ' '.$criteria->renderWhere(); |
|
604 | 604 | } |
605 | 605 | |
606 | 606 | $result = $this->db->query($sql); |
@@ -618,13 +618,13 @@ discard block |
||
618 | 618 | */ |
619 | 619 | public function getSubCats($categories) |
620 | 620 | { |
621 | - $criteria = new CriteriaCompo(new Criteria('parentid', '(' . implode(',', array_keys($categories)) . ')'), 'IN'); |
|
621 | + $criteria = new CriteriaCompo(new Criteria('parentid', '('.implode(',', array_keys($categories)).')'), 'IN'); |
|
622 | 622 | $ret = array(); |
623 | 623 | if (!sf_userIsAdmin()) { |
624 | 624 | $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq'); |
625 | 625 | |
626 | 626 | $categoriesGranted = $smartPermHandler->getPermissions('category'); |
627 | - $criteria->add(new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN')); |
|
627 | + $criteria->add(new Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN')); |
|
628 | 628 | } |
629 | 629 | $subcats = $this->getObjects($criteria, true); |
630 | 630 | foreach ($subcats as $subcat_id => $subcat) { |
@@ -642,9 +642,9 @@ discard block |
||
642 | 642 | */ |
643 | 643 | public function deleteAll($criteria = null) |
644 | 644 | { |
645 | - $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_categories'); |
|
645 | + $sql = 'DELETE FROM '.$this->db->prefix('smartfaq_categories'); |
|
646 | 646 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
647 | - $sql .= ' ' . $criteria->renderWhere(); |
|
647 | + $sql .= ' '.$criteria->renderWhere(); |
|
648 | 648 | } |
649 | 649 | if (!$this->db->query($sql)) { |
650 | 650 | return false; |
@@ -666,10 +666,10 @@ discard block |
||
666 | 666 | **/ |
667 | 667 | public function updateAll($fieldname, $fieldvalue, $criteria = null) |
668 | 668 | { |
669 | - $set_clause = is_numeric($fieldvalue) ? $fieldname . ' = ' . $fieldvalue : $fieldname . ' = ' . $this->db->quoteString($fieldvalue); |
|
670 | - $sql = 'UPDATE ' . $this->db->prefix('smartfaq_categories') . ' SET ' . $set_clause; |
|
669 | + $set_clause = is_numeric($fieldvalue) ? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue); |
|
670 | + $sql = 'UPDATE '.$this->db->prefix('smartfaq_categories').' SET '.$set_clause; |
|
671 | 671 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
672 | - $sql .= ' ' . $criteria->renderWhere(); |
|
672 | + $sql .= ' '.$criteria->renderWhere(); |
|
673 | 673 | } |
674 | 674 | if (!$this->db->queryF($sql)) { |
675 | 675 | return false; |
@@ -695,7 +695,7 @@ discard block |
||
695 | 695 | public function faqsCount($cat_id = 0, $status = '') |
696 | 696 | { |
697 | 697 | global $xoopsUser; |
698 | - include_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; |
|
698 | + include_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php'; |
|
699 | 699 | |
700 | 700 | $faqHandler = sf_gethandler('faq'); |
701 | 701 |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
246 | - * @return mixed |
|
246 | + * @return integer |
|
247 | 247 | */ |
248 | 248 | public function uid() |
249 | 249 | { |
@@ -744,7 +744,7 @@ discard block |
||
744 | 744 | /** |
745 | 745 | * insert a new faq in the database |
746 | 746 | * |
747 | - * @param XoopsObject $faq reference to the {@link sfFaq} object |
|
747 | + * @param sfFaq $faq reference to the {@link sfFaq} object |
|
748 | 748 | * @param bool $force |
749 | 749 | * @return bool FALSE if failed, TRUE if already present and unchanged or successful |
750 | 750 | */ |
@@ -1121,7 +1121,7 @@ discard block |
||
1121 | 1121 | * @param string $order |
1122 | 1122 | * @param string $notNullFields |
1123 | 1123 | * @param bool $asobject |
1124 | - * @param null $otherCriteria |
|
1124 | + * @param null|CriteriaCompo $otherCriteria |
|
1125 | 1125 | * @return array |
1126 | 1126 | */ |
1127 | 1127 | public function getFaqs($limit = 0, $start = 0, $status = '', $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $asobject = true, $otherCriteria = null) |
@@ -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; |
@@ -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 | } |
@@ -841,26 +841,26 @@ discard block |
||
841 | 841 | { |
842 | 842 | $ret = array(); |
843 | 843 | $limit = $start = 0; |
844 | - $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_faq'); |
|
844 | + $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_faq'); |
|
845 | 845 | |
846 | 846 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
847 | 847 | $whereClause = $criteria->renderWhere(); |
848 | 848 | |
849 | 849 | if ($whereClause !== 'WHERE ()') { |
850 | - $sql .= ' ' . $criteria->renderWhere(); |
|
850 | + $sql .= ' '.$criteria->renderWhere(); |
|
851 | 851 | if (!empty($notNullFields)) { |
852 | 852 | $sql .= $this->NotNullFieldClause($notNullFields, true); |
853 | 853 | } |
854 | 854 | } elseif (!empty($notNullFields)) { |
855 | - $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
855 | + $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
856 | 856 | } |
857 | 857 | if ($criteria->getSort() != '') { |
858 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
858 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
859 | 859 | } |
860 | 860 | $limit = $criteria->getLimit(); |
861 | 861 | $start = $criteria->getStart(); |
862 | 862 | } elseif (!empty($notNullFields)) { |
863 | - $sql .= $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
863 | + $sql .= $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
864 | 864 | } |
865 | 865 | |
866 | 866 | //echo "<br />" . $sql . "<br />"; |
@@ -920,26 +920,26 @@ discard block |
||
920 | 920 | faq.modulelink AS modulelink, |
921 | 921 | faq.contextpage AS contextpage, |
922 | 922 | faq.exacturl AS exacturl |
923 | - FROM ' . $this->db->prefix('smartfaq_faq') . ' AS faq INNER JOIN ' . $this->db->prefix('smartfaq_categories') . ' AS category ON faq.categoryid = category.categoryid '; |
|
923 | + FROM ' . $this->db->prefix('smartfaq_faq').' AS faq INNER JOIN '.$this->db->prefix('smartfaq_categories').' AS category ON faq.categoryid = category.categoryid '; |
|
924 | 924 | |
925 | 925 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
926 | 926 | $whereClause = $criteria->renderWhere(); |
927 | 927 | |
928 | 928 | if ($whereClause !== 'WHERE ()') { |
929 | - $sql .= ' ' . $criteria->renderWhere(); |
|
929 | + $sql .= ' '.$criteria->renderWhere(); |
|
930 | 930 | if (!empty($notNullFields)) { |
931 | 931 | $sql .= $this->NotNullFieldClause($notNullFields, true); |
932 | 932 | } |
933 | 933 | } elseif (!empty($notNullFields)) { |
934 | - $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
934 | + $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
935 | 935 | } |
936 | 936 | if ($criteria->getSort() != '') { |
937 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
937 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
938 | 938 | } |
939 | 939 | $limit = $criteria->getLimit(); |
940 | 940 | $start = $criteria->getStart(); |
941 | 941 | } elseif (!empty($notNullFields)) { |
942 | - $sql .= $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
942 | + $sql .= $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
943 | 943 | } |
944 | 944 | |
945 | 945 | //echo "<br />" . $sql . "<br />"; |
@@ -989,19 +989,19 @@ discard block |
||
989 | 989 | */ |
990 | 990 | public function getCount($criteria = null, $notNullFields = '') |
991 | 991 | { |
992 | - $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_faq'); |
|
992 | + $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('smartfaq_faq'); |
|
993 | 993 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
994 | 994 | $whereClause = $criteria->renderWhere(); |
995 | 995 | if ($whereClause !== 'WHERE ()') { |
996 | - $sql .= ' ' . $criteria->renderWhere(); |
|
996 | + $sql .= ' '.$criteria->renderWhere(); |
|
997 | 997 | if (!empty($notNullFields)) { |
998 | 998 | $sql .= $this->NotNullFieldClause($notNullFields, true); |
999 | 999 | } |
1000 | 1000 | } elseif (!empty($notNullFields)) { |
1001 | - $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
1001 | + $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
1002 | 1002 | } |
1003 | 1003 | } elseif (!empty($notNullFields)) { |
1004 | - $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
1004 | + $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
1005 | 1005 | } |
1006 | 1006 | |
1007 | 1007 | //echo "<br />" . $sql . "<br />"; |
@@ -1034,11 +1034,11 @@ discard block |
||
1034 | 1034 | $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq'); |
1035 | 1035 | |
1036 | 1036 | $categoriesGranted = $smartPermHandler->getPermissions('category'); |
1037 | - $grantedCategories = new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'); |
|
1037 | + $grantedCategories = new Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN'); |
|
1038 | 1038 | |
1039 | 1039 | $faqsGranted = $smartPermHandler->getPermissions('item'); |
1040 | 1040 | $grantedFaq = new CriteriaCompo(); |
1041 | - $grantedFaq->add(new Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR'); |
|
1041 | + $grantedFaq->add(new Criteria('faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR'); |
|
1042 | 1042 | // If user is anonymous, check if the FAQ allow partialview |
1043 | 1043 | if (!is_object($xoopsUser)) { |
1044 | 1044 | $grantedFaq->add(new Criteria('partialview', '1'), 'OR'); |
@@ -1085,7 +1085,7 @@ discard block |
||
1085 | 1085 | */ |
1086 | 1086 | public function getFaqsCountByStatus() |
1087 | 1087 | { |
1088 | - $sql = 'SELECT status, COUNT(*) FROM ' . $this->db->prefix('smartfaq_faq') . ' GROUP BY status'; |
|
1088 | + $sql = 'SELECT status, COUNT(*) FROM '.$this->db->prefix('smartfaq_faq').' GROUP BY status'; |
|
1089 | 1089 | $result = $this->db->query($sql); |
1090 | 1090 | if (!$result) { |
1091 | 1091 | return array(); |
@@ -1127,7 +1127,7 @@ discard block |
||
1127 | 1127 | public function getFaqs($limit = 0, $start = 0, $status = '', $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $asobject = true, $otherCriteria = null) |
1128 | 1128 | { |
1129 | 1129 | global $xoopsUser; |
1130 | - include_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; |
|
1130 | + include_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php'; |
|
1131 | 1131 | |
1132 | 1132 | //if ( ($categoryid == -1) && (empty($status) || ($status == -1)) && ($limit == 0) && ($start ==0) ) { |
1133 | 1133 | // return $this->getObjects(); |
@@ -1139,11 +1139,11 @@ discard block |
||
1139 | 1139 | $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq'); |
1140 | 1140 | |
1141 | 1141 | $categoriesGranted = $smartPermHandler->getPermissions('category'); |
1142 | - $grantedCategories = new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'); |
|
1142 | + $grantedCategories = new Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN'); |
|
1143 | 1143 | |
1144 | 1144 | $faqsGranted = $smartPermHandler->getPermissions('item'); |
1145 | 1145 | $grantedFaq = new CriteriaCompo(); |
1146 | - $grantedFaq->add(new Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR'); |
|
1146 | + $grantedFaq->add(new Criteria('faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR'); |
|
1147 | 1147 | // If user is anonymous, check if the FAQ allow partialview |
1148 | 1148 | if (!is_object($xoopsUser)) { |
1149 | 1149 | $grantedFaq->add(new Criteria('partialview', '1'), 'OR'); |
@@ -1152,9 +1152,9 @@ discard block |
||
1152 | 1152 | |
1153 | 1153 | if (isset($categoryid) && ($categoryid != -1)) { |
1154 | 1154 | if (is_array($categoryid)) { |
1155 | - $criteriaCategory = new Criteria('categoryid', '(' . implode(',', $categoryid) . ')', 'IN'); |
|
1155 | + $criteriaCategory = new Criteria('categoryid', '('.implode(',', $categoryid).')', 'IN'); |
|
1156 | 1156 | } else { |
1157 | - $criteriaCategory = new Criteria('categoryid', (int)$categoryid); |
|
1157 | + $criteriaCategory = new Criteria('categoryid', (int) $categoryid); |
|
1158 | 1158 | } |
1159 | 1159 | } |
1160 | 1160 | |
@@ -1213,7 +1213,7 @@ discard block |
||
1213 | 1213 | */ |
1214 | 1214 | public function getFaqsAdminSide($limit = 0, $start = 0, $status = '', $categoryid = -1, $sort = 'datesub', $order = 'DESC', $asobject = true, $otherCriteria = null) |
1215 | 1215 | { |
1216 | - include_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; |
|
1216 | + include_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php'; |
|
1217 | 1217 | |
1218 | 1218 | $smartModule = sf_getModuleInfo(); |
1219 | 1219 | |
@@ -1272,7 +1272,7 @@ discard block |
||
1272 | 1272 | |
1273 | 1273 | if ($totalFaqs > 0) { |
1274 | 1274 | --$totalFaqs; |
1275 | - mt_srand((double)microtime() * 1000000); |
|
1275 | + mt_srand((double) microtime() * 1000000); |
|
1276 | 1276 | $entrynumber = mt_rand(0, $totalFaqs); |
1277 | 1277 | $faq = $this->getFaqs(1, $entrynumber, $status, -1, 'datesub', 'DESC', $notNullFields); |
1278 | 1278 | if ($faq) { |
@@ -1307,10 +1307,10 @@ discard block |
||
1307 | 1307 | $httphost = $_SERVER['HTTP_HOST']; |
1308 | 1308 | $querystring = $_SERVER['QUERY_STRING']; |
1309 | 1309 | if ($querystring != '') { |
1310 | - $querystring = '?' . $querystring; |
|
1310 | + $querystring = '?'.$querystring; |
|
1311 | 1311 | } |
1312 | - $currenturl = $http . $httphost . $phpself . $querystring; |
|
1313 | - $fullcontexturl = XOOPS_URL . '/' . $faqsObj[$i]->contextpage(); |
|
1312 | + $currenturl = $http.$httphost.$phpself.$querystring; |
|
1313 | + $fullcontexturl = XOOPS_URL.'/'.$faqsObj[$i]->contextpage(); |
|
1314 | 1314 | switch ($faqsObj[$i]->modulelink()) { |
1315 | 1315 | case '': |
1316 | 1316 | $display = false; |
@@ -1329,7 +1329,7 @@ discard block |
||
1329 | 1329 | } |
1330 | 1330 | break; |
1331 | 1331 | default: |
1332 | - if (strpos($currenturl, XOOPS_URL . '/modules/') === false) { |
|
1332 | + if (strpos($currenturl, XOOPS_URL.'/modules/') === false) { |
|
1333 | 1333 | $display = false; |
1334 | 1334 | } else { |
1335 | 1335 | if (strpos($currenturl, $faqsObj[$i]->modulelink()) === false) { |
@@ -1347,7 +1347,7 @@ discard block |
||
1347 | 1347 | } |
1348 | 1348 | |
1349 | 1349 | if (count($randomFaqs) > $limit) { |
1350 | - mt_srand((float)microtime() * 10000000); |
|
1350 | + mt_srand((float) microtime() * 10000000); |
|
1351 | 1351 | $rand_keys = array_rand($randomFaqs, $limit); |
1352 | 1352 | for ($j = 0, $jMax = count($rand_keys); $j < $jMax; ++$j) { |
1353 | 1353 | $ret[] = &$randomFaqs[$rand_keys[$j]]; |
@@ -1370,14 +1370,14 @@ discard block |
||
1370 | 1370 | if (!sf_userIsAdmin()) { |
1371 | 1371 | $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq'); |
1372 | 1372 | $items = $smartPermHandler->getPermissions('item'); |
1373 | - $faqclause = ' AND faqid IN (' . implode(',', $items) . ')'; |
|
1373 | + $faqclause = ' AND faqid IN ('.implode(',', $items).')'; |
|
1374 | 1374 | } |
1375 | 1375 | |
1376 | 1376 | $sql = "CREATE TEMPORARY TABLE tmp (categoryid INT(8) UNSIGNED NOT NULL,datesub int(11) DEFAULT '0' NOT NULL);"; |
1377 | - $sql2 = ' LOCK TABLES ' . $this->db->prefix('smartfaq_faq') . ' READ;'; |
|
1378 | - $sql3 = ' INSERT INTO tmp SELECT categoryid, MAX(datesub) FROM ' . $this->db->prefix('smartfaq_faq') . ' WHERE status IN (' . implode(',', $status) . ") $faqclause GROUP BY categoryid;"; |
|
1379 | - $sql4 = ' SELECT ' . $this->db->prefix('smartfaq_faq') . '.categoryid, faqid, question, uid, ' . $this->db->prefix('smartfaq_faq') . '.datesub FROM ' . $this->db->prefix('smartfaq_faq') . ', tmp |
|
1380 | - WHERE ' . $this->db->prefix('smartfaq_faq') . '.categoryid=tmp.categoryid AND ' . $this->db->prefix('smartfaq_faq') . '.datesub=tmp.datesub;'; |
|
1377 | + $sql2 = ' LOCK TABLES '.$this->db->prefix('smartfaq_faq').' READ;'; |
|
1378 | + $sql3 = ' INSERT INTO tmp SELECT categoryid, MAX(datesub) FROM '.$this->db->prefix('smartfaq_faq').' WHERE status IN ('.implode(',', $status).") $faqclause GROUP BY categoryid;"; |
|
1379 | + $sql4 = ' SELECT '.$this->db->prefix('smartfaq_faq').'.categoryid, faqid, question, uid, '.$this->db->prefix('smartfaq_faq').'.datesub FROM '.$this->db->prefix('smartfaq_faq').', tmp |
|
1380 | + WHERE ' . $this->db->prefix('smartfaq_faq').'.categoryid=tmp.categoryid AND '.$this->db->prefix('smartfaq_faq').'.datesub=tmp.datesub;'; |
|
1381 | 1381 | /* |
1382 | 1382 | //Old implementation |
1383 | 1383 | $sql = "SELECT categoryid, faqid, question, uid, MAX(datesub) AS datesub FROM ".$this->db->prefix("smartfaq_faq")." |
@@ -1392,7 +1392,7 @@ discard block |
||
1392 | 1392 | $this->db->queryF('UNLOCK TABLES;'); |
1393 | 1393 | $this->db->queryF('DROP TABLE tmp;'); |
1394 | 1394 | if (!$result) { |
1395 | - trigger_error('Error in getLastPublishedByCat SQL: ' . $error); |
|
1395 | + trigger_error('Error in getLastPublishedByCat SQL: '.$error); |
|
1396 | 1396 | |
1397 | 1397 | return $ret; |
1398 | 1398 | } |
@@ -1414,9 +1414,9 @@ discard block |
||
1414 | 1414 | */ |
1415 | 1415 | public function deleteAll($criteria = null) |
1416 | 1416 | { |
1417 | - $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_faq'); |
|
1417 | + $sql = 'DELETE FROM '.$this->db->prefix('smartfaq_faq'); |
|
1418 | 1418 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
1419 | - $sql .= ' ' . $criteria->renderWhere(); |
|
1419 | + $sql .= ' '.$criteria->renderWhere(); |
|
1420 | 1420 | } |
1421 | 1421 | if (!$this->db->query($sql)) { |
1422 | 1422 | return false; |
@@ -1437,10 +1437,10 @@ discard block |
||
1437 | 1437 | **/ |
1438 | 1438 | public function updateAll($fieldname, $fieldvalue, $criteria = null) |
1439 | 1439 | { |
1440 | - $set_clause = is_numeric($fieldvalue) ? $fieldname . ' = ' . $fieldvalue : $fieldname . ' = ' . $this->db->quoteString($fieldvalue); |
|
1441 | - $sql = 'UPDATE ' . $this->db->prefix('smartfaq_faq') . ' SET ' . $set_clause; |
|
1440 | + $set_clause = is_numeric($fieldvalue) ? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue); |
|
1441 | + $sql = 'UPDATE '.$this->db->prefix('smartfaq_faq').' SET '.$set_clause; |
|
1442 | 1442 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
1443 | - $sql .= ' ' . $criteria->renderWhere(); |
|
1443 | + $sql .= ' '.$criteria->renderWhere(); |
|
1444 | 1444 | } |
1445 | 1445 | if (!$this->db->queryF($sql)) { |
1446 | 1446 | return false; |
@@ -1455,7 +1455,7 @@ discard block |
||
1455 | 1455 | */ |
1456 | 1456 | public function updateCounter($faqid) |
1457 | 1457 | { |
1458 | - $sql = 'UPDATE ' . $this->db->prefix('smartfaq_faq') . ' SET counter=counter+1 WHERE faqid = ' . $faqid; |
|
1458 | + $sql = 'UPDATE '.$this->db->prefix('smartfaq_faq').' SET counter=counter+1 WHERE faqid = '.$faqid; |
|
1459 | 1459 | if ($this->db->queryF($sql)) { |
1460 | 1460 | return true; |
1461 | 1461 | } else { |
@@ -1511,8 +1511,8 @@ discard block |
||
1511 | 1511 | $criteriaKeywords = new CriteriaCompo(); |
1512 | 1512 | for ($i = 0, $iMax = count($queryarray); $i < $iMax; ++$i) { |
1513 | 1513 | $criteriaKeyword = new CriteriaCompo(); |
1514 | - $criteriaKeyword->add(new Criteria('faq.question', '%' . $queryarray[$i] . '%', 'LIKE'), 'OR'); |
|
1515 | - $criteriaKeyword->add(new Criteria('answer.answer', '%' . $queryarray[$i] . '%', 'LIKE'), 'OR'); |
|
1514 | + $criteriaKeyword->add(new Criteria('faq.question', '%'.$queryarray[$i].'%', 'LIKE'), 'OR'); |
|
1515 | + $criteriaKeyword->add(new Criteria('answer.answer', '%'.$queryarray[$i].'%', 'LIKE'), 'OR'); |
|
1516 | 1516 | $criteriaKeywords->add($criteriaKeyword, $andor); |
1517 | 1517 | unset($criteriaKeyword); |
1518 | 1518 | } |
@@ -1530,9 +1530,9 @@ discard block |
||
1530 | 1530 | if (!$faqsGranted) { |
1531 | 1531 | return $ret; |
1532 | 1532 | } |
1533 | - $grantedCategories = new Criteria('faq.categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'); |
|
1533 | + $grantedCategories = new Criteria('faq.categoryid', '('.implode(',', $categoriesGranted).')', 'IN'); |
|
1534 | 1534 | $grantedFaq = new CriteriaCompo(); |
1535 | - $grantedFaq->add(new Criteria('faq.faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR'); |
|
1535 | + $grantedFaq->add(new Criteria('faq.faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR'); |
|
1536 | 1536 | // If user is anonymous, check if the FAQ allow partialview |
1537 | 1537 | if (!is_object($xoopsUser)) { |
1538 | 1538 | $grantedFaq->add(new Criteria('partialview', '1'), 'OR'); |
@@ -1578,15 +1578,15 @@ discard block |
||
1578 | 1578 | $criteria->setSort('faq.datesub'); |
1579 | 1579 | $criteria->setOrder('DESC'); |
1580 | 1580 | |
1581 | - $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'; |
|
1581 | + $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'; |
|
1582 | 1582 | |
1583 | 1583 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
1584 | 1584 | $whereClause = $criteria->renderWhere(); |
1585 | 1585 | |
1586 | 1586 | if ($whereClause !== 'WHERE ()') { |
1587 | - $sql .= ' ' . $criteria->renderWhere(); |
|
1587 | + $sql .= ' '.$criteria->renderWhere(); |
|
1588 | 1588 | if ($criteria->getSort() != '') { |
1589 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
1589 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
1590 | 1590 | } |
1591 | 1591 | $limit = $criteria->getLimit(); |
1592 | 1592 | $start = $criteria->getStart(); |
@@ -1625,19 +1625,19 @@ discard block |
||
1625 | 1625 | { |
1626 | 1626 | global $xoopsUser; |
1627 | 1627 | $ret = array(); |
1628 | - $sql = 'SELECT categoryid, COUNT(*) AS count FROM ' . $this->db->prefix('smartfaq_faq'); |
|
1629 | - if ((int)$cat_id > 0) { |
|
1630 | - $sql .= ' WHERE categoryid = ' . (int)$cat_id; |
|
1631 | - $sql .= ' AND status IN (' . implode(',', $status) . ')'; |
|
1628 | + $sql = 'SELECT categoryid, COUNT(*) AS count FROM '.$this->db->prefix('smartfaq_faq'); |
|
1629 | + if ((int) $cat_id > 0) { |
|
1630 | + $sql .= ' WHERE categoryid = '.(int) $cat_id; |
|
1631 | + $sql .= ' AND status IN ('.implode(',', $status).')'; |
|
1632 | 1632 | } else { |
1633 | - $sql .= ' WHERE status IN (' . implode(',', $status) . ')'; |
|
1633 | + $sql .= ' WHERE status IN ('.implode(',', $status).')'; |
|
1634 | 1634 | if (!sf_userIsAdmin()) { |
1635 | 1635 | $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq'); |
1636 | 1636 | $items = $smartPermHandler->getPermissions('item'); |
1637 | 1637 | if (is_object($xoopsUser)) { |
1638 | - $sql .= ' AND faqid IN (' . implode(',', $items) . ')'; |
|
1638 | + $sql .= ' AND faqid IN ('.implode(',', $items).')'; |
|
1639 | 1639 | } else { |
1640 | - $sql .= ' AND (faqid IN (' . implode(',', $items) . ') OR partialview = 1)'; |
|
1640 | + $sql .= ' AND (faqid IN ('.implode(',', $items).') OR partialview = 1)'; |
|
1641 | 1641 | } |
1642 | 1642 | } |
1643 | 1643 | } |
@@ -1650,7 +1650,7 @@ discard block |
||
1650 | 1650 | return $ret; |
1651 | 1651 | } |
1652 | 1652 | while ($row = $this->db->fetchArray($result)) { |
1653 | - $ret[$row['categoryid']] = (int)$row['count']; |
|
1653 | + $ret[$row['categoryid']] = (int) $row['count']; |
|
1654 | 1654 | } |
1655 | 1655 | |
1656 | 1656 | return $ret; |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
170 | - * @param $field |
|
170 | + * @param string $field |
|
171 | 171 | * @return bool |
172 | 172 | */ |
173 | 173 | public function fieldExists($field) |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | /** |
629 | 629 | * Use to update a table |
630 | 630 | * |
631 | - * @param object $table {@link SmartDbTable} that will be updated |
|
631 | + * @param SmartDbTable $table {@link SmartDbTable} that will be updated |
|
632 | 632 | * |
633 | 633 | * @see SmartDbTable |
634 | 634 | * |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | //Verifies that a MySQL table exists |
17 | 17 | $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection(); |
18 | 18 | $realname = $xoopsDB->prefix($table); |
19 | - $sql = 'SHOW TABLES FROM ' . XOOPS_DB_NAME; |
|
19 | + $sql = 'SHOW TABLES FROM '.XOOPS_DB_NAME; |
|
20 | 20 | $ret = $xoopsDB->queryF($sql); |
21 | 21 | while (list($m_table) = $xoopsDB->fetchRow($ret)) { |
22 | 22 | if ($m_table == $realname) { |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | * Include the language constants for the SmartObjectDBUpdater |
54 | 54 | */ |
55 | 55 | global $xoopsConfig; |
56 | -$common_file = XOOPS_ROOT_PATH . '/modules/smartfaq/language/' . $xoopsConfig['language'] . '/smartdbupdater.php'; |
|
56 | +$common_file = XOOPS_ROOT_PATH.'/modules/smartfaq/language/'.$xoopsConfig['language'].'/smartdbupdater.php'; |
|
57 | 57 | if (!file_exists($common_file)) { |
58 | - $common_file = XOOPS_ROOT_PATH . '/modules/smartfaq/language/english/smartdbupdater.php'; |
|
58 | + $common_file = XOOPS_ROOT_PATH.'/modules/smartfaq/language/english/smartdbupdater.php'; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | include($common_file); |
@@ -152,14 +152,14 @@ discard block |
||
152 | 152 | public function getExistingFieldsArray() |
153 | 153 | { |
154 | 154 | global $xoopsDB; |
155 | - $result = $xoopsDB->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 | |
@@ -393,9 +393,9 @@ discard block |
||
393 | 393 | |
394 | 394 | $ret = $xoopsDB->query($query); |
395 | 395 | if (!$ret) { |
396 | - echo ' ' . sprintf(_SDU_MSG_CREATE_TABLE_ERR, $this->name()) . '<br />'; |
|
396 | + echo ' '.sprintf(_SDU_MSG_CREATE_TABLE_ERR, $this->name()).'<br />'; |
|
397 | 397 | } else { |
398 | - echo ' ' . sprintf(_SDU_MSG_CREATE_TABLE, $this->name()) . '<br />'; |
|
398 | + echo ' '.sprintf(_SDU_MSG_CREATE_TABLE, $this->name()).'<br />'; |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | return $ret; |
@@ -414,11 +414,11 @@ discard block |
||
414 | 414 | $query = sprintf('DROP TABLE %s', $this->name()); |
415 | 415 | $ret = $xoopsDB->query($query); |
416 | 416 | if (!$ret) { |
417 | - echo ' ' . sprintf(_SDU_MSG_DROP_TABLE_ERR, $this->name()) . '<br />'; |
|
417 | + echo ' '.sprintf(_SDU_MSG_DROP_TABLE_ERR, $this->name()).'<br />'; |
|
418 | 418 | |
419 | 419 | return false; |
420 | 420 | } else { |
421 | - echo ' ' . sprintf(_SDU_MSG_DROP_TABLE, $this->name()) . '<br />'; |
|
421 | + echo ' '.sprintf(_SDU_MSG_DROP_TABLE, $this->name()).'<br />'; |
|
422 | 422 | |
423 | 423 | return true; |
424 | 424 | } |
@@ -442,9 +442,9 @@ discard block |
||
442 | 442 | $ret = $ret && $xoopsDB->query($query); |
443 | 443 | if ($alteredField['showerror']) { |
444 | 444 | if (!$ret) { |
445 | - echo ' ' . sprintf(_SDU_MSG_CHGFIELD_ERR, $alteredField['name'], $this->name()) . '<br />'; |
|
445 | + echo ' '.sprintf(_SDU_MSG_CHGFIELD_ERR, $alteredField['name'], $this->name()).'<br />'; |
|
446 | 446 | } else { |
447 | - echo ' ' . sprintf(_SDU_MSG_CHGFIELD, $alteredField['name'], $this->name()) . '<br />'; |
|
447 | + echo ' '.sprintf(_SDU_MSG_CHGFIELD, $alteredField['name'], $this->name()).'<br />'; |
|
448 | 448 | } |
449 | 449 | } |
450 | 450 | } |
@@ -468,9 +468,9 @@ discard block |
||
468 | 468 | //echo $query; |
469 | 469 | $ret = $ret && $xoopsDB->query($query); |
470 | 470 | if (!$ret) { |
471 | - echo ' ' . sprintf(_SDU_MSG_NEWFIELD_ERR, $newField['name'], $this->name()) . '<br />'; |
|
471 | + echo ' '.sprintf(_SDU_MSG_NEWFIELD_ERR, $newField['name'], $this->name()).'<br />'; |
|
472 | 472 | } else { |
473 | - echo ' ' . sprintf(_SDU_MSG_NEWFIELD, $newField['name'], $this->name()) . '<br />'; |
|
473 | + echo ' '.sprintf(_SDU_MSG_NEWFIELD, $newField['name'], $this->name()).'<br />'; |
|
474 | 474 | } |
475 | 475 | } |
476 | 476 | |
@@ -493,9 +493,9 @@ discard block |
||
493 | 493 | $query = sprintf('UPDATE %s SET %s = %s', $this->name(), $updatedField['name'], $updatedField['value']); |
494 | 494 | $ret = $ret && $xoopsDB->query($query); |
495 | 495 | if (!$ret) { |
496 | - echo ' ' . sprintf(_SDU_MSG_UPDATE_TABLE_ERR, $this->name()) . '<br />'; |
|
496 | + echo ' '.sprintf(_SDU_MSG_UPDATE_TABLE_ERR, $this->name()).'<br />'; |
|
497 | 497 | } else { |
498 | - echo ' ' . sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()) . '<br />'; |
|
498 | + echo ' '.sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()).'<br />'; |
|
499 | 499 | } |
500 | 500 | } |
501 | 501 | |
@@ -518,9 +518,9 @@ discard block |
||
518 | 518 | //echo $query."<br>"; |
519 | 519 | $ret = $ret && $xoopsDB->query($query); |
520 | 520 | if (!$ret) { |
521 | - echo ' ' . sprintf(_SDU_MSG_UPDATE_TABLE_ERR, $this->name()) . '<br />'; |
|
521 | + echo ' '.sprintf(_SDU_MSG_UPDATE_TABLE_ERR, $this->name()).'<br />'; |
|
522 | 522 | } else { |
523 | - echo ' ' . sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()) . '<br />'; |
|
523 | + echo ' '.sprintf(_SDU_MSG_UPDATE_TABLE, $this->name()).'<br />'; |
|
524 | 524 | } |
525 | 525 | } |
526 | 526 | |
@@ -544,9 +544,9 @@ discard block |
||
544 | 544 | |
545 | 545 | $ret = $ret && $xoopsDB->query($query); |
546 | 546 | if (!$ret) { |
547 | - echo ' ' . sprintf(_SDU_MSG_DROPFIELD_ERR, $droppedField, $this->name()) . '<br />'; |
|
547 | + echo ' '.sprintf(_SDU_MSG_DROPFIELD_ERR, $droppedField, $this->name()).'<br />'; |
|
548 | 548 | } else { |
549 | - echo ' ' . sprintf(_SDU_MSG_DROPFIELD, $droppedField, $this->name()) . '<br />'; |
|
549 | + echo ' '.sprintf(_SDU_MSG_DROPFIELD, $droppedField, $this->name()).'<br />'; |
|
550 | 550 | } |
551 | 551 | } |
552 | 552 | |
@@ -615,11 +615,11 @@ discard block |
||
615 | 615 | $query = sprintf('ALTER TABLE %s RENAME %s', $from, $to); |
616 | 616 | $ret = $xoopsDB->query($query); |
617 | 617 | if (!$ret) { |
618 | - echo ' ' . sprintf(_SDU_MSG_RENAME_TABLE_ERR, $from) . '<br />'; |
|
618 | + echo ' '.sprintf(_SDU_MSG_RENAME_TABLE_ERR, $from).'<br />'; |
|
619 | 619 | |
620 | 620 | return false; |
621 | 621 | } else { |
622 | - echo ' ' . sprintf(_SDU_MSG_RENAME_TABLE, $from, $to) . '<br />'; |
|
622 | + echo ' '.sprintf(_SDU_MSG_RENAME_TABLE, $from, $to).'<br />'; |
|
623 | 623 | |
624 | 624 | return true; |
625 | 625 | } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | * Constructor |
26 | 26 | * |
27 | 27 | * @param string $uploadDir |
28 | - * @param array|int $allowedMimeTypes |
|
28 | + * @param integer $allowedMimeTypes |
|
29 | 29 | * @param int $maxFileSize |
30 | 30 | * @param int $maxWidth |
31 | 31 | * @param int $maxHeight |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * CBB, XOOPS forum module |
|
4 | - * |
|
5 | - * @copyright The XOOPS Project http://xoops.sf.net |
|
6 | - * @license http://www.fsf.org/copyleft/gpl.html GNU public license |
|
7 | - * @author Taiwen Jiang (phppp or D.J.) <[email protected]> |
|
8 | - * @since 4.00 |
|
9 | - * @package module::newbb |
|
10 | - */ |
|
3 | + * CBB, XOOPS forum module |
|
4 | + * |
|
5 | + * @copyright The XOOPS Project http://xoops.sf.net |
|
6 | + * @license http://www.fsf.org/copyleft/gpl.html GNU public license |
|
7 | + * @author Taiwen Jiang (phppp or D.J.) <[email protected]> |
|
8 | + * @since 4.00 |
|
9 | + * @package module::newbb |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
13 | 13 |
@@ -11,7 +11,7 @@ |
||
11 | 11 | |
12 | 12 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
13 | 13 | |
14 | -include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
14 | +include_once XOOPS_ROOT_PATH.'/class/uploader.php'; |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * Class sfUploader |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | |
510 | 510 | /** |
511 | 511 | * @param string $url |
512 | - * @return mixed|string |
|
512 | + * @return string |
|
513 | 513 | */ |
514 | 514 | function sf_getxoopslink($url = '') |
515 | 515 | { |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | } |
583 | 583 | |
584 | 584 | /** |
585 | - * @param $name |
|
585 | + * @param string $name |
|
586 | 586 | * @param bool $optional |
587 | 587 | * @return bool |
588 | 588 | */ |
@@ -7,9 +7,9 @@ discard block |
||
7 | 7 | */ |
8 | 8 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
9 | 9 | |
10 | -include_once XOOPS_ROOT_PATH . '/modules/smartfaq/class/category.php'; |
|
11 | -include_once XOOPS_ROOT_PATH . '/modules/smartfaq/class/faq.php'; |
|
12 | -include_once XOOPS_ROOT_PATH . '/modules/smartfaq/class/answer.php'; |
|
10 | +include_once XOOPS_ROOT_PATH.'/modules/smartfaq/class/category.php'; |
|
11 | +include_once XOOPS_ROOT_PATH.'/modules/smartfaq/class/faq.php'; |
|
12 | +include_once XOOPS_ROOT_PATH.'/modules/smartfaq/class/answer.php'; |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * @return mixed|null |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | break; |
64 | 64 | |
65 | 65 | case 'inside' : |
66 | - return XOOPS_URL . '/modules/smartfaq/doc/'; |
|
66 | + return XOOPS_URL.'/modules/smartfaq/doc/'; |
|
67 | 67 | break; |
68 | 68 | |
69 | 69 | case 'custom' : |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | { |
81 | 81 | $ret = ''; |
82 | 82 | foreach ($errors as $key => $value) { |
83 | - $ret .= '<br /> - ' . $value; |
|
83 | + $ret .= '<br /> - '.$value; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | return $ret; |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | $spaces .= '--'; |
104 | 104 | } |
105 | 105 | |
106 | - $ret .= "<option value='" . $categoryObj->categoryid() . "'"; |
|
106 | + $ret .= "<option value='".$categoryObj->categoryid()."'"; |
|
107 | 107 | if ($selectedid == $categoryObj->categoryid()) { |
108 | 108 | $ret .= " selected='selected'"; |
109 | 109 | } |
110 | - $ret .= '>' . $spaces . $categoryObj->name() . "</option>\n"; |
|
110 | + $ret .= '>'.$spaces.$categoryObj->name()."</option>\n"; |
|
111 | 111 | |
112 | 112 | $subCategoriesObj = $categoryHandler->getCategories(0, 0, $categoryObj->categoryid()); |
113 | 113 | if (count($subCategoriesObj) > 0) { |
@@ -128,10 +128,10 @@ discard block |
||
128 | 128 | */ |
129 | 129 | function sf_createCategorySelect($selectedid = 0, $parentcategory = 0, $allCatOption = true) |
130 | 130 | { |
131 | - $ret = '' . _MB_SF_SELECTCAT . " <select name='options[]'>"; |
|
131 | + $ret = ''._MB_SF_SELECTCAT." <select name='options[]'>"; |
|
132 | 132 | if ($allCatOption) { |
133 | 133 | $ret .= "<option value='0'"; |
134 | - $ret .= '>' . _MB_SF_ALLCAT . "</option>\n"; |
|
134 | + $ret .= '>'._MB_SF_ALLCAT."</option>\n"; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | // Creating the category handler object |
@@ -199,9 +199,9 @@ discard block |
||
199 | 199 | { |
200 | 200 | $smartModule = sf_getModuleInfo(); |
201 | 201 | |
202 | - $modfootertxt = 'Module ' . $smartModule->getInfo('name') . ' - Version ' . $smartModule->getInfo('version') . ''; |
|
202 | + $modfootertxt = 'Module '.$smartModule->getInfo('name').' - Version '.$smartModule->getInfo('version').''; |
|
203 | 203 | |
204 | - $modfooter = "<a href='" . $smartModule->getInfo('support_site_url') . "' target='_blank'><img src='" . XOOPS_URL . "/modules/smartfaq/assets/images/sfcssbutton.gif' title='" . $modfootertxt . "' alt='" . $modfootertxt . "'/></a>"; |
|
204 | + $modfooter = "<a href='".$smartModule->getInfo('support_site_url')."' target='_blank'><img src='".XOOPS_URL."/modules/smartfaq/assets/images/sfcssbutton.gif' title='".$modfootertxt."' alt='".$modfootertxt."'/></a>"; |
|
205 | 205 | |
206 | 206 | return $modfooter; |
207 | 207 | } |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | |
298 | 298 | $gpermHandler = xoops_getHandler('groupperm'); |
299 | 299 | |
300 | - $sql = 'SELECT faqid FROM ' . $xoopsDB->prefix('smartfaq_faq') . " WHERE categoryid = '$categoryid' "; |
|
300 | + $sql = 'SELECT faqid FROM '.$xoopsDB->prefix('smartfaq_faq')." WHERE categoryid = '$categoryid' "; |
|
301 | 301 | $result = $xoopsDB->query($sql); |
302 | 302 | |
303 | 303 | if (count($result) > 0) { |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | $ret = array(); |
413 | 413 | global $xoopsDB; |
414 | 414 | |
415 | - $result = $xoopsDB->query('SELECT * FROM ' . $xoopsDB->prefix('smartfaq_faq') . " WHERE faqid = '$faqid'"); |
|
415 | + $result = $xoopsDB->query('SELECT * FROM '.$xoopsDB->prefix('smartfaq_faq')." WHERE faqid = '$faqid'"); |
|
416 | 416 | $ret = $xoopsDB->fetcharray($result); |
417 | 417 | |
418 | 418 | return $ret; |
@@ -431,26 +431,26 @@ discard block |
||
431 | 431 | { |
432 | 432 | global $xoopsUser, $xoopsModule, $xoopsModuleConfig, $xoopsConfig; |
433 | 433 | $adminLinks = ''; |
434 | - $modulePath = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/'; |
|
434 | + $modulePath = XOOPS_URL.'/modules/'.$xoopsModule->dirname().'/'; |
|
435 | 435 | $page = $open ? 'question.php' : 'faq.php'; |
436 | 436 | if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->getVar('mid'))) { |
437 | 437 | // Edit button |
438 | - $adminLinks .= "<a href='" . $modulePath . "admin/$page?op=mod&faqid=" . $faqid . "'><img src='" . $modulePath . "assets/images/links/edit.gif'" . " title='" . _MD_SF_EDIT . "' alt='" . _MD_SF_EDIT . "'/></a>"; |
|
438 | + $adminLinks .= "<a href='".$modulePath."admin/$page?op=mod&faqid=".$faqid."'><img src='".$modulePath."assets/images/links/edit.gif'"." title='"._MD_SF_EDIT."' alt='"._MD_SF_EDIT."'/></a>"; |
|
439 | 439 | $adminLinks .= ' '; |
440 | 440 | // Delete button |
441 | - $adminLinks .= "<a href='" . $modulePath . "admin/$page?op=del&faqid=" . $faqid . "'><img src='" . $modulePath . "assets/images/links/delete.gif'" . " title='" . _MD_SF_DELETE . "' alt='" . _MD_SF_DELETE . "'/></a>"; |
|
441 | + $adminLinks .= "<a href='".$modulePath."admin/$page?op=del&faqid=".$faqid."'><img src='".$modulePath."assets/images/links/delete.gif'"." title='"._MD_SF_DELETE."' alt='"._MD_SF_DELETE."'/></a>"; |
|
442 | 442 | $adminLinks .= ' '; |
443 | 443 | } |
444 | 444 | // Print button |
445 | - $adminLinks .= "<a href='" . $modulePath . 'print.php?faqid=' . $faqid . "'><img src='" . $modulePath . "assets/images/links/print.gif' title='" . _MD_SF_PRINT . "' alt='" . _MD_SF_PRINT . "'/></a>"; |
|
445 | + $adminLinks .= "<a href='".$modulePath.'print.php?faqid='.$faqid."'><img src='".$modulePath."assets/images/links/print.gif' title='"._MD_SF_PRINT."' alt='"._MD_SF_PRINT."'/></a>"; |
|
446 | 446 | $adminLinks .= ' '; |
447 | 447 | // Email button |
448 | - $maillink = 'mailto:?subject=' . sprintf(_MD_SF_INTARTICLE, $xoopsConfig['sitename']) . '&body=' . sprintf(_MD_SF_INTARTFOUND, $xoopsConfig['sitename']) . ': ' . $modulePath . 'faq.php?faqid=' . $faqid; |
|
449 | - $adminLinks .= "<a href=\"" . $maillink . "\"><img src='" . $modulePath . "assets/images/links/friend.gif' title='" . _MD_SF_MAIL . "' alt='" . _MD_SF_MAIL . "'/></a>"; |
|
448 | + $maillink = 'mailto:?subject='.sprintf(_MD_SF_INTARTICLE, $xoopsConfig['sitename']).'&body='.sprintf(_MD_SF_INTARTFOUND, $xoopsConfig['sitename']).': '.$modulePath.'faq.php?faqid='.$faqid; |
|
449 | + $adminLinks .= "<a href=\"".$maillink."\"><img src='".$modulePath."assets/images/links/friend.gif' title='"._MD_SF_MAIL."' alt='"._MD_SF_MAIL."'/></a>"; |
|
450 | 450 | $adminLinks .= ' '; |
451 | 451 | // Submit New Answer button |
452 | 452 | if ($xoopsModuleConfig['allownewanswer'] && (is_object($xoopsUser) || $xoopsModuleConfig['anonpost'])) { |
453 | - $adminLinks .= "<a href='" . $modulePath . 'answer.php?faqid=' . $faqid . "'><img src='" . $modulePath . "assets/images/links/newanswer.gif' title='" . _MD_SF_SUBMITANSWER . "' alt='" . _MD_SF_SUBMITANSWER . "'/></a>"; |
|
453 | + $adminLinks .= "<a href='".$modulePath.'answer.php?faqid='.$faqid."'><img src='".$modulePath."assets/images/links/newanswer.gif' title='"._MD_SF_SUBMITANSWER."' alt='"._MD_SF_SUBMITANSWER."'/></a>"; |
|
454 | 454 | $adminLinks .= ' '; |
455 | 455 | } |
456 | 456 | |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | return $userid; |
472 | 472 | } |
473 | 473 | |
474 | - $userid = (int)$userid; |
|
474 | + $userid = (int) $userid; |
|
475 | 475 | if ($userid > 0) { |
476 | 476 | if ($users == array()) { |
477 | 477 | //fetching users |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | if (!isset($users[$userid])) { |
482 | 482 | return $GLOBALS['xoopsConfig']['anonymous']; |
483 | 483 | } |
484 | - $user =& $users[$userid]; |
|
484 | + $user = & $users[$userid]; |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | if (is_object($user)) { |
@@ -495,9 +495,9 @@ discard block |
||
495 | 495 | $fullname = $user->getVar('name'); |
496 | 496 | } |
497 | 497 | if (!empty($fullname)) { |
498 | - $linkeduser = "$fullname [<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . $ts->htmlSpecialChars($username) . '</a>]'; |
|
498 | + $linkeduser = "$fullname [<a href='".XOOPS_URL.'/userinfo.php?uid='.$userid."'>".$ts->htmlSpecialChars($username).'</a>]'; |
|
499 | 499 | } else { |
500 | - $linkeduser = "<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . ucwords($ts->htmlSpecialChars($username)) . '</a>'; |
|
500 | + $linkeduser = "<a href='".XOOPS_URL.'/userinfo.php?uid='.$userid."'>".ucwords($ts->htmlSpecialChars($username)).'</a>'; |
|
501 | 501 | } |
502 | 502 | |
503 | 503 | return $linkeduser; |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | //--> |
579 | 579 | </script> |
580 | 580 | <?php |
581 | - echo "<h3 style=\"color: #2F5376; margin: 6px 0 0 0; \"><a href='#' onClick=\"toggle('" . $tablename . "'); toggleIcon('" . $iconname . "');\">"; |
|
581 | + echo "<h3 style=\"color: #2F5376; margin: 6px 0 0 0; \"><a href='#' onClick=\"toggle('".$tablename."'); toggleIcon('".$iconname."');\">"; |
|
582 | 582 | } |
583 | 583 | |
584 | 584 | /** |
@@ -591,16 +591,16 @@ discard block |
||
591 | 591 | static $handlers; |
592 | 592 | $name = strtolower(trim($name)); |
593 | 593 | if (!isset($handlers[$name])) { |
594 | - if (file_exists($hnd_file = XOOPS_ROOT_PATH . '/modules/smartfaq/class/' . $name . '.php')) { |
|
594 | + if (file_exists($hnd_file = XOOPS_ROOT_PATH.'/modules/smartfaq/class/'.$name.'.php')) { |
|
595 | 595 | require_once $hnd_file; |
596 | 596 | } |
597 | - $class = 'sf' . ucfirst($name) . 'Handler'; |
|
597 | + $class = 'sf'.ucfirst($name).'Handler'; |
|
598 | 598 | if (class_exists($class)) { |
599 | 599 | $handlers[$name] = new $class($GLOBALS['xoopsDB']); |
600 | 600 | } |
601 | 601 | } |
602 | 602 | if (!$optional && !isset($handlers[$name])) { |
603 | - trigger_error('Class <b>' . $class . '</b> does not exist<br />Handler Name: ' . $name, E_USER_ERROR); |
|
603 | + trigger_error('Class <b>'.$class.'</b> does not exist<br />Handler Name: '.$name, E_USER_ERROR); |
|
604 | 604 | } |
605 | 605 | $false = false; |
606 | 606 |
@@ -6,16 +6,16 @@ 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 | 11 | global $xoopsConfig, $xoopsModuleConfig, $xoopsModule; |
12 | 12 | |
13 | 13 | $xoopsOption['template_main'] = 'smartfaq_category.tpl'; |
14 | 14 | |
15 | -include_once(XOOPS_ROOT_PATH . '/header.php'); |
|
16 | -include_once __DIR__ . '/footer.php'; |
|
15 | +include_once(XOOPS_ROOT_PATH.'/header.php'); |
|
16 | +include_once __DIR__.'/footer.php'; |
|
17 | 17 | |
18 | -$categoryid = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : 0; |
|
18 | +$categoryid = isset($_GET['categoryid']) ? (int) $_GET['categoryid'] : 0; |
|
19 | 19 | |
20 | 20 | // Creating the category object for the selected category |
21 | 21 | $categoryObj = new sfCategory($categoryid); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $categoryHandler = sf_gethandler('category'); |
35 | 35 | |
36 | 36 | // At which record shall we start |
37 | -$start = isset($_GET['start']) ? (int)$_GET['start'] : 0; |
|
37 | +$start = isset($_GET['start']) ? (int) $_GET['start'] : 0; |
|
38 | 38 | |
39 | 39 | // Creating the faq handler object |
40 | 40 | $faqHandler = sf_gethandler('faq'); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $last_qnaObj = $faqHandler->getLastPublishedByCat(array(_SF_STATUS_OPENED)); |
59 | 59 | if (isset($last_qnaObj[$categoryid])) { |
60 | 60 | $categoryObj->setVar('last_faqid', $last_qnaObj[$categoryid]->getVar('faqid')); |
61 | - $categoryObj->setVar('last_question_link', "<a href='faq.php?faqid=" . $last_qnaObj[$categoryid]->getVar('faqid') . "'>" . $last_qnaObj[$categoryid]->question(50) . '</a>'); |
|
61 | + $categoryObj->setVar('last_question_link', "<a href='faq.php?faqid=".$last_qnaObj[$categoryid]->getVar('faqid')."'>".$last_qnaObj[$categoryid]->question(50).'</a>'); |
|
62 | 62 | } |
63 | 63 | // Populating the smarty variables with informations related to the selected category |
64 | 64 | $category = $categoryObj->toArray(null, true); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | if (isset($totalQnas[$subcat_id]) && $totalQnas[$subcat_id] > 0) { |
78 | 78 | if (isset($last_qnaObj[$subcat_id])) { |
79 | 79 | $subcat->setVar('last_faqid', $last_qnaObj[$subcat_id]->getVar('faqid')); |
80 | - $subcat->setVar('last_question_link', "<a href='faq.php?faqid=" . $last_qnaObj[$subcat_id]->getVar('faqid') . "'>" . $last_qnaObj[$subcat_id]->question(50) . '</a>'); |
|
80 | + $subcat->setVar('last_question_link', "<a href='faq.php?faqid=".$last_qnaObj[$subcat_id]->getVar('faqid')."'>".$last_qnaObj[$subcat_id]->question(50).'</a>'); |
|
81 | 81 | } |
82 | 82 | $subcat->setVar('faqcount', $totalQnas[$subcat_id]); |
83 | 83 | $subcats[$subcat_id] = $subcat->toArray(null, true); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | $xoopsTpl->assign('subcats', $subcats); |
88 | 88 | } |
89 | -$category['total'] = $catQnasWithSub + $totalQnas[$categoryid]; |
|
89 | +$category['total'] = $catQnasWithSub+$totalQnas[$categoryid]; |
|
90 | 90 | if ($faqsObj) { |
91 | 91 | $userids = array(); |
92 | 92 | foreach ($faqsObj as $key => $thisfaq) { |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | } |
96 | 96 | |
97 | 97 | $memberHandler = xoops_getHandler('member'); |
98 | - $users = $memberHandler->getUsers(new Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN'), true); |
|
98 | + $users = $memberHandler->getUsers(new Criteria('uid', '('.implode(',', array_keys($userids)).')', 'IN'), true); |
|
99 | 99 | for ($i = 0; $i < $totalQnasOnPage; ++$i) { |
100 | 100 | $faq = $faqsObj[$i]->toArray(null, $allcategories); |
101 | 101 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | } |
109 | 109 | // Language constants |
110 | -$xoopsTpl->assign('whereInSection', $myts->htmlSpecialChars($xoopsModule->getVar('name')) . " > <a href='open_index.php'>" . _MD_SF_OPEN_SECTION . '</a>'); |
|
110 | +$xoopsTpl->assign('whereInSection', $myts->htmlSpecialChars($xoopsModule->getVar('name'))." > <a href='open_index.php'>"._MD_SF_OPEN_SECTION.'</a>'); |
|
111 | 111 | $xoopsTpl->assign('modulename', $xoopsModule->dirname()); |
112 | 112 | |
113 | 113 | $xoopsTpl->assign('displaylastfaqs', true); |
@@ -124,19 +124,19 @@ discard block |
||
124 | 124 | $xoopsTpl->assign('lang_category', _MD_SF_CATEGORY); |
125 | 125 | |
126 | 126 | // The Navigation Bar |
127 | -include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
128 | -$pagenav = new XoopsPageNav($totalQnas[$categoryid], $xoopsModuleConfig['indexperpage'], $start, 'start', 'categoryid=' . $categoryObj->getVar('categoryid')); |
|
127 | +include_once XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
128 | +$pagenav = new XoopsPageNav($totalQnas[$categoryid], $xoopsModuleConfig['indexperpage'], $start, 'start', 'categoryid='.$categoryObj->getVar('categoryid')); |
|
129 | 129 | if ($xoopsModuleConfig['useimagenavpage'] == 1) { |
130 | - $category['navbar'] = '<div style="text-align:right;">' . $pagenav->renderImageNav() . '</div>'; |
|
130 | + $category['navbar'] = '<div style="text-align:right;">'.$pagenav->renderImageNav().'</div>'; |
|
131 | 131 | } else { |
132 | - $category['navbar'] = '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'; |
|
132 | + $category['navbar'] = '<div style="text-align:right;">'.$pagenav->renderNav().'</div>'; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | $xoopsTpl->assign('category', $category); |
136 | 136 | |
137 | 137 | // Page Title Hack by marcan |
138 | 138 | $module_name = $myts->htmlSpecialChars($xoopsModule->getVar('name')); |
139 | -$xoopsTpl->assign('xoops_pagetitle', $module_name . ' - ' . $category['name']); |
|
139 | +$xoopsTpl->assign('xoops_pagetitle', $module_name.' - '.$category['name']); |
|
140 | 140 | // End Page Title Hack by marcan |
141 | 141 | |
142 | -include_once(XOOPS_ROOT_PATH . '/footer.php'); |
|
142 | +include_once(XOOPS_ROOT_PATH.'/footer.php'); |