@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | if (!$attach_key) { |
92 | 92 | return false; |
93 | 93 | } |
94 | - $this->attachment_array[(string)$attach_key]['num_download']++; |
|
94 | + $this->attachment_array[(string) $attach_key]['num_download']++; |
|
95 | 95 | |
96 | - return $this->attachment_array[(string)$attach_key]['num_download']; |
|
96 | + return $this->attachment_array[(string) $attach_key]['num_download']; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $attachment_save = base64_encode(serialize($this->attachment_array)); |
107 | 107 | } |
108 | 108 | $this->setVar('attachment', $attachment_save); |
109 | - $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('smartfaq_answers') . ' SET attachment=' . $GLOBALS['xoopsDB']->quoteString($attachment_save) . ' WHERE post_id = ' . $this->getVar('answerid'); |
|
109 | + $sql = 'UPDATE '.$GLOBALS['xoopsDB']->prefix('smartfaq_answers').' SET attachment='.$GLOBALS['xoopsDB']->quoteString($attachment_save).' WHERE post_id = '.$this->getVar('answerid'); |
|
110 | 110 | if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { |
111 | 111 | //xoops_error($GLOBALS["xoopsDB"]->error()); |
112 | 112 | return false; |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | |
139 | 139 | foreach ($attach_old as $key => $attach) { |
140 | 140 | if (in_array($key, $attach_array)) { |
141 | - @unlink(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attach['name_saved']); |
|
142 | - @unlink(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/thumbs/' . $attach['name_saved']); // delete thumbnails |
|
141 | + @unlink(XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/'.$attach['name_saved']); |
|
142 | + @unlink(XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/thumbs/'.$attach['name_saved']); // delete thumbnails |
|
143 | 143 | continue; |
144 | 144 | } |
145 | 145 | $this->attachment_array[$key] = $attach; |
@@ -165,12 +165,12 @@ discard block |
||
165 | 165 | static $counter = 0; |
166 | 166 | $this->attachment_array = $this->getAttachment(); |
167 | 167 | if ($name_saved) { |
168 | - $key = (string)(time() + ($counter++)); |
|
168 | + $key = (string) (time()+($counter++)); |
|
169 | 169 | $this->attachment_array[$key] = array( |
170 | 170 | 'name_saved' => $name_saved, |
171 | 171 | 'name_display' => isset($name_display) ? $name_display : $name_saved, |
172 | 172 | 'mimetype' => $mimetype, |
173 | - 'num_download' => isset($num_download) ? (int)$num_download : 0 |
|
173 | + 'num_download' => isset($num_download) ? (int) $num_download : 0 |
|
174 | 174 | ); |
175 | 175 | } |
176 | 176 | $attachment_save = null; |
@@ -196,24 +196,24 @@ discard block |
||
196 | 196 | if (is_array($attachments) && count($attachments) > 0) { |
197 | 197 | $iconHandler = sf_getIconHandler(); |
198 | 198 | $mime_path = $iconHandler->getPath('mime'); |
199 | - include_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/include/functions.image.php'; |
|
199 | + include_once XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname', 'n').'/include/functions.image.php'; |
|
200 | 200 | $image_extensions = array('jpg', 'jpeg', 'gif', 'png', 'bmp'); // need improve !!! |
201 | - $post_attachment .= '<br><strong>' . _MD_ATTACHMENT . '</strong>:'; |
|
201 | + $post_attachment .= '<br><strong>'._MD_ATTACHMENT.'</strong>:'; |
|
202 | 202 | $post_attachment .= '<br><hr size="1" noshade="noshade" /><br>'; |
203 | 203 | foreach ($attachments as $key => $att) { |
204 | 204 | $file_extension = ltrim(strrchr($att['name_saved'], '.'), '.'); |
205 | 205 | $filetype = $file_extension; |
206 | - if (file_exists(XOOPS_ROOT_PATH . '/' . $mime_path . '/' . $filetype . '.gif')) { |
|
207 | - $icon_filetype = XOOPS_URL . '/' . $mime_path . '/' . $filetype . '.gif'; |
|
206 | + if (file_exists(XOOPS_ROOT_PATH.'/'.$mime_path.'/'.$filetype.'.gif')) { |
|
207 | + $icon_filetype = XOOPS_URL.'/'.$mime_path.'/'.$filetype.'.gif'; |
|
208 | 208 | } else { |
209 | - $icon_filetype = XOOPS_URL . '/' . $mime_path . '/unknown.gif'; |
|
209 | + $icon_filetype = XOOPS_URL.'/'.$mime_path.'/unknown.gif'; |
|
210 | 210 | } |
211 | - $file_size = @filesize(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $att['name_saved']); |
|
212 | - $file_size = number_format($file_size / 1024, 2) . ' KB'; |
|
211 | + $file_size = @filesize(XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/'.$att['name_saved']); |
|
212 | + $file_size = number_format($file_size / 1024, 2).' KB'; |
|
213 | 213 | if ($xoopsModuleConfig['media_allowed'] && in_array(strtolower($file_extension), $image_extensions)) { |
214 | - $post_attachment .= '<br><img src="' . $icon_filetype . '" alt="' . $filetype . '" /><strong> ' . $att['name_display'] . '</strong> <small>(' . $file_size . ')</small>'; |
|
215 | - $post_attachment .= '<br>' . sf_attachmentImage($att['name_saved']); |
|
216 | - $isDisplayed = true; |
|
214 | + $post_attachment .= '<br><img src="'.$icon_filetype.'" alt="'.$filetype.'" /><strong> '.$att['name_display'].'</strong> <small>('.$file_size.')</small>'; |
|
215 | + $post_attachment .= '<br>'.sf_attachmentImage($att['name_saved']); |
|
216 | + $isDisplayed = true; |
|
217 | 217 | } else { |
218 | 218 | global $xoopsUser; |
219 | 219 | if (empty($xoopsModuleConfig['show_userattach'])) { |
@@ -370,9 +370,9 @@ discard block |
||
370 | 370 | $tags = array(); |
371 | 371 | $tags['MODULE_NAME'] = $myts->displayTarea($smartModule->getVar('name')); |
372 | 372 | $tags['FAQ_NAME'] = $faqObj->question(); |
373 | - $tags['FAQ_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/faq.php?faqid=' . $faqObj->faqid(); |
|
373 | + $tags['FAQ_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/faq.php?faqid='.$faqObj->faqid(); |
|
374 | 374 | $tags['CATEGORY_NAME'] = $faqObj->getCategoryName(); |
375 | - $tags['CATEGORY_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/category.php?categoryid=' . $faqObj->categoryid(); |
|
375 | + $tags['CATEGORY_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/category.php?categoryid='.$faqObj->categoryid(); |
|
376 | 376 | $tags['FAQ_QUESTION'] = $faqObj->question(); |
377 | 377 | |
378 | 378 | // TODO : Not sure about the 'formpreview' ... |
@@ -429,8 +429,8 @@ discard block |
||
429 | 429 | */ |
430 | 430 | public function get($id = null, $fields = null) |
431 | 431 | { |
432 | - if ((int)$id > 0) { |
|
433 | - $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_answers') . ' WHERE answerid=' . $id; |
|
432 | + if ((int) $id > 0) { |
|
433 | + $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_answers').' WHERE answerid='.$id; |
|
434 | 434 | if (!$result = $this->db->query($sql)) { |
435 | 435 | return false; |
436 | 436 | } |
@@ -560,11 +560,11 @@ discard block |
||
560 | 560 | { |
561 | 561 | $ret = array(); |
562 | 562 | $limit = $start = 0; |
563 | - $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_answers'); |
|
563 | + $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_answers'); |
|
564 | 564 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
565 | - $sql .= ' ' . $criteria->renderWhere(); |
|
565 | + $sql .= ' '.$criteria->renderWhere(); |
|
566 | 566 | if ($criteria->getSort() != '') { |
567 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
567 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
568 | 568 | } |
569 | 569 | $limit = $criteria->getLimit(); |
570 | 570 | $start = $criteria->getStart(); |
@@ -578,9 +578,9 @@ discard block |
||
578 | 578 | $answer = new sfAnswer(); |
579 | 579 | $answer->assignVars($myrow); |
580 | 580 | if (!$id_as_key) { |
581 | - $ret[] =& $answer; |
|
581 | + $ret[] = & $answer; |
|
582 | 582 | } else { |
583 | - $ret[$myrow['answerid']] =& $answer; |
|
583 | + $ret[$myrow['answerid']] = & $answer; |
|
584 | 584 | } |
585 | 585 | unset($answer); |
586 | 586 | } |
@@ -661,9 +661,9 @@ discard block |
||
661 | 661 | */ |
662 | 662 | public function getCount(CriteriaElement $criteria = null) |
663 | 663 | { |
664 | - $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_answers'); |
|
664 | + $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('smartfaq_answers'); |
|
665 | 665 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
666 | - $sql .= ' ' . $criteria->renderWhere(); |
|
666 | + $sql .= ' '.$criteria->renderWhere(); |
|
667 | 667 | } |
668 | 668 | $result = $this->db->query($sql); |
669 | 669 | if (!$result) { |
@@ -682,10 +682,10 @@ discard block |
||
682 | 682 | */ |
683 | 683 | public function getCountByFAQ($criteria = null) |
684 | 684 | { |
685 | - $sql = 'SELECT faqid, COUNT(*) FROM ' . $this->db->prefix('smartfaq_answers'); |
|
685 | + $sql = 'SELECT faqid, COUNT(*) FROM '.$this->db->prefix('smartfaq_answers'); |
|
686 | 686 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
687 | - $sql .= ' ' . $criteria->renderWhere(); |
|
688 | - $sql .= ' ' . $criteria->getGroupby(); |
|
687 | + $sql .= ' '.$criteria->renderWhere(); |
|
688 | + $sql .= ' '.$criteria->getGroupby(); |
|
689 | 689 | } |
690 | 690 | |
691 | 691 | //echo "<br>$sql<br>"; |
@@ -712,9 +712,9 @@ discard block |
||
712 | 712 | */ |
713 | 713 | public function deleteAll(CriteriaElement $criteria = null, $force = true, $asObject = false) |
714 | 714 | { |
715 | - $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_answers'); |
|
715 | + $sql = 'DELETE FROM '.$this->db->prefix('smartfaq_answers'); |
|
716 | 716 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
717 | - $sql .= ' ' . $criteria->renderWhere(); |
|
717 | + $sql .= ' '.$criteria->renderWhere(); |
|
718 | 718 | } |
719 | 719 | if (!$this->db->query($sql)) { |
720 | 720 | return false; |
@@ -734,10 +734,10 @@ discard block |
||
734 | 734 | */ |
735 | 735 | public function updateAll($fieldname, $fieldvalue, CriteriaElement $criteria = null, $force = false) |
736 | 736 | { |
737 | - $set_clause = is_numeric($fieldvalue) ? $fieldname . ' = ' . $fieldvalue : $fieldname . ' = ' . $this->db->quoteString($fieldvalue); |
|
738 | - $sql = 'UPDATE ' . $this->db->prefix('smartfaq_answers') . ' SET ' . $set_clause; |
|
737 | + $set_clause = is_numeric($fieldvalue) ? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue); |
|
738 | + $sql = 'UPDATE '.$this->db->prefix('smartfaq_answers').' SET '.$set_clause; |
|
739 | 739 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
740 | - $sql .= ' ' . $criteria->renderWhere(); |
|
740 | + $sql .= ' '.$criteria->renderWhere(); |
|
741 | 741 | } |
742 | 742 | //echo "<br>" . $sql . "<br>"; |
743 | 743 | if (!$this->db->queryF($sql)) { |
@@ -754,8 +754,8 @@ discard block |
||
754 | 754 | public function getLastPublishedByFaq($faqids) |
755 | 755 | { |
756 | 756 | $ret = array(); |
757 | - $sql = 'SELECT faqid, answer, uid, datesub FROM ' . $this->db->prefix('smartfaq_answers') . ' |
|
758 | - WHERE faqid IN (' . implode(',', $faqids) . ') AND status = ' . _SF_AN_STATUS_APPROVED . ' GROUP BY faqid'; |
|
757 | + $sql = 'SELECT faqid, answer, uid, datesub FROM '.$this->db->prefix('smartfaq_answers').' |
|
758 | + WHERE faqid IN (' . implode(',', $faqids).') AND status = '._SF_AN_STATUS_APPROVED.' GROUP BY faqid'; |
|
759 | 759 | $result = $this->db->query($sql); |
760 | 760 | if (!$result) { |
761 | 761 | return $ret; |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | while ($row = $this->db->fetchArray($result)) { |
764 | 764 | $answer = new sfAnswer(); |
765 | 765 | $answer->assignVars($row); |
766 | - $ret[$row['faqid']] =& $answer; |
|
766 | + $ret[$row['faqid']] = & $answer; |
|
767 | 767 | unset($answer); |
768 | 768 | } |
769 | 769 |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | |
24 | 24 | sf_collapsableBar('toptable', 'toptableicon'); |
25 | 25 | |
26 | -echo "<img id='toptableicon' src=" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt='' /></a> " . $faqs_title . '</h3>'; |
|
26 | +echo "<img id='toptableicon' src=".XOOPS_URL.'/modules/'.$xoopsModule->dirname()."/assets/images/icon/close12.gif alt='' /></a> ".$faqs_title.'</h3>'; |
|
27 | 27 | echo "<div id='toptable'>"; |
28 | -echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . $faqs_info . '</span>'; |
|
28 | +echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">'.$faqs_info.'</span>'; |
|
29 | 29 | |
30 | 30 | // Get the total number of published FAQs |
31 | 31 | $totalfaqs = $faqHandler->getFaqsCount($sel_cat, array(_SF_STATUS_PUBLISHED, _SF_STATUS_NEW_ANSWER)); |
@@ -36,15 +36,15 @@ discard block |
||
36 | 36 | $allCats = $categoryHandler->getObjects(null, true); |
37 | 37 | echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>"; |
38 | 38 | echo '<tr>'; |
39 | -echo "<th width='40' class='bg3' align='center'><b>" . _AM_SF_ARTID . '</b></td>'; |
|
40 | -echo "<th width='20%' class='bg3' align='left'><b>" . _AM_SF_ARTCOLNAME . '</b></td>'; |
|
41 | -echo "<th class='bg3' align='left'><b>" . _AM_SF_QUESTION . '</b></td>'; |
|
39 | +echo "<th width='40' class='bg3' align='center'><b>"._AM_SF_ARTID.'</b></td>'; |
|
40 | +echo "<th width='20%' class='bg3' align='left'><b>"._AM_SF_ARTCOLNAME.'</b></td>'; |
|
41 | +echo "<th class='bg3' align='left'><b>"._AM_SF_QUESTION.'</b></td>'; |
|
42 | 42 | |
43 | -echo "<th width='90' class='bg3' align='center'><b>" . _AM_SF_ASKED . '</b></td>'; |
|
44 | -echo "<th width='90' class='bg3' align='center'><b>" . _AM_SF_ANSWERED . '</b></td>'; |
|
43 | +echo "<th width='90' class='bg3' align='center'><b>"._AM_SF_ASKED.'</b></td>'; |
|
44 | +echo "<th width='90' class='bg3' align='center'><b>"._AM_SF_ANSWERED.'</b></td>'; |
|
45 | 45 | |
46 | -echo "<th width='90' class='bg3' align='center'><b>" . _AM_SF_CREATED . '</b></td>'; |
|
47 | -echo "<th width='60' class='bg3' align='center'><b>" . _AM_SF_ACTION . '</b></td>'; |
|
46 | +echo "<th width='90' class='bg3' align='center'><b>"._AM_SF_CREATED.'</b></td>'; |
|
47 | +echo "<th width='60' class='bg3' align='center'><b>"._AM_SF_ACTION.'</b></td>'; |
|
48 | 48 | echo '</tr>'; |
49 | 49 | if ($totalfaqs > 0) { |
50 | 50 | global $pathIcon16, $smartModuleConfig; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | . "' alt='" |
61 | 61 | . _AM_SF_EDITART |
62 | 62 | . "' /></a>"; |
63 | - $delete = "<a href='faq.php?op=del&faqid=" |
|
63 | + $delete = "<a href='faq.php?op=del&faqid=" |
|
64 | 64 | . $faqsObj[$i]->faqid() |
65 | 65 | . "'><img src='" |
66 | 66 | . $pathIcon16 |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | echo '<tr>'; |
100 | - echo "<td class='head' align='center'>" . $faqsObj[$i]->faqid() . '</td>'; |
|
101 | - echo "<td class='even' align='left'>" . $categoryObj->name() . '</td>'; |
|
100 | + echo "<td class='head' align='center'>".$faqsObj[$i]->faqid().'</td>'; |
|
101 | + echo "<td class='even' align='left'>".$categoryObj->name().'</td>'; |
|
102 | 102 | echo "<td class='even' align='left'><a href='" |
103 | 103 | . XOOPS_URL |
104 | 104 | . '/modules/' |
@@ -109,22 +109,22 @@ discard block |
||
109 | 109 | . $faqsObj[$i]->question(100) |
110 | 110 | . '</a></td>'; |
111 | 111 | |
112 | - echo "<td class='even' align='center'>" . $requester . '</td>'; |
|
113 | - echo "<td class='even' align='center'>" . $answerSubmitter . '</td>'; |
|
112 | + echo "<td class='even' align='center'>".$requester.'</td>'; |
|
113 | + echo "<td class='even' align='center'>".$answerSubmitter.'</td>'; |
|
114 | 114 | |
115 | - echo "<td class='even' align='center'>" . $faqsObj[$i]->datesub('s') . '</td>'; |
|
115 | + echo "<td class='even' align='center'>".$faqsObj[$i]->datesub('s').'</td>'; |
|
116 | 116 | echo "<td class='even' align='center'> $modify $delete </td>"; |
117 | 117 | echo '</tr>'; |
118 | 118 | } |
119 | 119 | } else { |
120 | 120 | $faqid = -1; |
121 | 121 | echo '<tr>'; |
122 | - echo "<td class='head' align='center' colspan= '7'>" . _AM_SF_NOFAQS . '</td>'; |
|
122 | + echo "<td class='head' align='center' colspan= '7'>"._AM_SF_NOFAQS.'</td>'; |
|
123 | 123 | echo '</tr>'; |
124 | 124 | } |
125 | 125 | echo "</table>\n"; |
126 | 126 | echo "<br>\n"; |
127 | 127 | |
128 | 128 | $pagenav = new XoopsPageNav($totalfaqs, $xoopsModuleConfig['perpage'], $startfaq, 'startfaq', $pagenav_extra_args); |
129 | -echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'; |
|
129 | +echo '<div style="text-align:right;">'.$pagenav->renderNav().'</div>'; |
|
130 | 130 | echo '</div>'; |