@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
246 | - * @return mixed |
|
246 | + * @return integer |
|
247 | 247 | */ |
248 | 248 | public function uid() |
249 | 249 | { |
@@ -754,7 +754,7 @@ discard block |
||
754 | 754 | /** |
755 | 755 | * insert a new faq in the database |
756 | 756 | * |
757 | - * @param XoopsObject $faq reference to the {@link sfFaq} object |
|
757 | + * @param sfFaq $faq reference to the {@link sfFaq} object |
|
758 | 758 | * @param bool $force |
759 | 759 | * @return bool FALSE if failed, TRUE if already present and unchanged or successful |
760 | 760 | */ |
@@ -1143,7 +1143,7 @@ discard block |
||
1143 | 1143 | * @param string $order |
1144 | 1144 | * @param string $notNullFields |
1145 | 1145 | * @param bool $asobject |
1146 | - * @param null $otherCriteria |
|
1146 | + * @param null|CriteriaCompo $otherCriteria |
|
1147 | 1147 | * @return array |
1148 | 1148 | */ |
1149 | 1149 | public function getFaqs( |
@@ -647,16 +647,16 @@ discard block |
||
647 | 647 | } |
648 | 648 | |
649 | 649 | return $text |
650 | - . $xoopsConfig['sitename'] |
|
651 | - . ' : <a href=' |
|
652 | - . XOOPS_URL |
|
653 | - . '/modules/smartfaq/faq.php?faqid=' |
|
654 | - . $this->faqid() |
|
655 | - . '>' |
|
656 | - . XOOPS_URL |
|
657 | - . '/modules/smartfaq/faq.php?faqid=' |
|
658 | - . $this->faqid() |
|
659 | - . '</a>'; |
|
650 | + . $xoopsConfig['sitename'] |
|
651 | + . ' : <a href=' |
|
652 | + . XOOPS_URL |
|
653 | + . '/modules/smartfaq/faq.php?faqid=' |
|
654 | + . $this->faqid() |
|
655 | + . '>' |
|
656 | + . XOOPS_URL |
|
657 | + . '/modules/smartfaq/faq.php?faqid=' |
|
658 | + . $this->faqid() |
|
659 | + . '</a>'; |
|
660 | 660 | } |
661 | 661 | |
662 | 662 | /** |
@@ -778,14 +778,14 @@ discard block |
||
778 | 778 | |
779 | 779 | if ($faq->isNew()) { |
780 | 780 | $sql = sprintf('INSERT INTO %s (faqid, categoryid, question, howdoi, diduno, uid, datesub, `status`, counter, weight, html, smiley, xcodes, cancomment, comments, notifypub, modulelink, contextpage, exacturl, partialview) VALUES (NULL, %u, %s, %s, %s, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %s, %s, %u, %u)', |
781 | - $this->db->prefix('smartfaq_faq'), $categoryid, $this->db->quoteString($question), $this->db->quoteString($howdoi), $this->db->quoteString($diduno), $uid, time(), $status, |
|
782 | - $counter, $weight, $html, $smiley, $xcodes, $cancomment, $comments, $notifypub, $this->db->quoteString($modulelink), $this->db->quoteString($contextpage), $exacturl, |
|
783 | - $partialview); |
|
781 | + $this->db->prefix('smartfaq_faq'), $categoryid, $this->db->quoteString($question), $this->db->quoteString($howdoi), $this->db->quoteString($diduno), $uid, time(), $status, |
|
782 | + $counter, $weight, $html, $smiley, $xcodes, $cancomment, $comments, $notifypub, $this->db->quoteString($modulelink), $this->db->quoteString($contextpage), $exacturl, |
|
783 | + $partialview); |
|
784 | 784 | } else { |
785 | 785 | $sql = sprintf('UPDATE %s SET categoryid = %u, question = %s, howdoi = %s, diduno = %s, uid = %u, datesub = %u, `status` = %u, counter = %u, weight = %u, html = %u, smiley = %u, xcodes = %u, cancomment = %u, comments = %u, notifypub = %u, modulelink = %s, contextpage = %s, exacturl = %u, partialview = %u WHERE faqid = %u', |
786 | - $this->db->prefix('smartfaq_faq'), $categoryid, $this->db->quoteString($question), $this->db->quoteString($howdoi), $this->db->quoteString($diduno), $uid, $datesub, $status, |
|
787 | - $counter, $weight, $html, $smiley, $xcodes, $cancomment, $comments, $notifypub, $this->db->quoteString($modulelink), $this->db->quoteString($contextpage), $exacturl, |
|
788 | - $partialview, $faqid); |
|
786 | + $this->db->prefix('smartfaq_faq'), $categoryid, $this->db->quoteString($question), $this->db->quoteString($howdoi), $this->db->quoteString($diduno), $uid, $datesub, $status, |
|
787 | + $counter, $weight, $html, $smiley, $xcodes, $cancomment, $comments, $notifypub, $this->db->quoteString($modulelink), $this->db->quoteString($contextpage), $exacturl, |
|
788 | + $partialview, $faqid); |
|
789 | 789 | } |
790 | 790 | if (false != $force) { |
791 | 791 | $result = $this->db->queryF($sql); |
@@ -1618,10 +1618,10 @@ discard block |
||
1618 | 1618 | $criteria->setOrder('DESC'); |
1619 | 1619 | |
1620 | 1620 | $sql = 'SELECT faq.faqid, faq.question, faq.datesub, faq.uid FROM ' |
1621 | - . $this->db->prefix('smartfaq_faq') |
|
1622 | - . ' AS faq INNER JOIN ' |
|
1623 | - . $this->db->prefix('smartfaq_answers') |
|
1624 | - . ' AS answer ON faq.faqid = answer.faqid'; |
|
1621 | + . $this->db->prefix('smartfaq_faq') |
|
1622 | + . ' AS faq INNER JOIN ' |
|
1623 | + . $this->db->prefix('smartfaq_answers') |
|
1624 | + . ' AS answer ON faq.faqid = answer.faqid'; |
|
1625 | 1625 | |
1626 | 1626 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
1627 | 1627 | $whereClause = $criteria->renderWhere(); |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
10 | 10 | |
11 | -require_once XOOPS_ROOT_PATH . '/modules/smartfaq/class/category.php'; |
|
11 | +require_once XOOPS_ROOT_PATH.'/modules/smartfaq/class/category.php'; |
|
12 | 12 | |
13 | 13 | // FAQ status |
14 | 14 | define('_SF_STATUS_NOTSET', -1); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public function checkPermission() |
130 | 130 | { |
131 | - include_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; |
|
131 | + include_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php'; |
|
132 | 132 | |
133 | 133 | $userIsAdmin = sf_userIsAdmin(); |
134 | 134 | if ($userIsAdmin) { |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | if ($maxLength != 0) { |
205 | 205 | if (!XOOPS_USE_MULTIBYTES) { |
206 | 206 | if (strlen($ret) >= $maxLength) { |
207 | - $ret = substr($ret, 0, $maxLength - 1) . '...'; |
|
207 | + $ret = substr($ret, 0, $maxLength-1).'...'; |
|
208 | 208 | } |
209 | 209 | } |
210 | 210 | } |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | $tags['MODULE_NAME'] = $myts->displayTarea($smartModule->getVar('name')); |
490 | 490 | $tags['FAQ_NAME'] = $this->question(); |
491 | 491 | $tags['CATEGORY_NAME'] = $this->getCategoryName(); |
492 | - $tags['CATEGORY_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/category.php?categoryid=' . $this->categoryid(); |
|
492 | + $tags['CATEGORY_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/category.php?categoryid='.$this->categoryid(); |
|
493 | 493 | $tags['FAQ_QUESTION'] = $this->question(); |
494 | 494 | $answerObj = $this->answer(); |
495 | 495 | if (is_object($answerObj)) { |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | foreach ($notifications as $notification) { |
502 | 502 | switch ($notification) { |
503 | 503 | case _SF_NOT_FAQ_PUBLISHED: |
504 | - $tags['FAQ_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/faq.php?faqid=' . $this->faqid(); |
|
504 | + $tags['FAQ_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/faq.php?faqid='.$this->faqid(); |
|
505 | 505 | |
506 | 506 | $notificationHandler->triggerEvent('global_faq', 0, 'published', $tags); |
507 | 507 | $notificationHandler->triggerEvent('category_faq', $this->categoryid(), 'published', $tags); |
@@ -509,20 +509,20 @@ discard block |
||
509 | 509 | break; |
510 | 510 | |
511 | 511 | case _SF_NOT_FAQ_SUBMITTED: |
512 | - $tags['WAITINGFILES_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/admin/faq.php?faqid=' . $this->faqid(); |
|
512 | + $tags['WAITINGFILES_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/admin/faq.php?faqid='.$this->faqid(); |
|
513 | 513 | $notificationHandler->triggerEvent('global_faq', 0, 'submitted', $tags); |
514 | 514 | $notificationHandler->triggerEvent('category_faq', $this->categoryid(), 'submitted', $tags); |
515 | 515 | break; |
516 | 516 | |
517 | 517 | case _SF_NOT_QUESTION_PUBLISHED: |
518 | - $tags['FAQ_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/answer.php?faqid=' . $this->faqid(); |
|
518 | + $tags['FAQ_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/answer.php?faqid='.$this->faqid(); |
|
519 | 519 | $notificationHandler->triggerEvent('global_question', 0, 'published', $tags); |
520 | 520 | $notificationHandler->triggerEvent('category_question', $this->categoryid(), 'published', $tags); |
521 | 521 | $notificationHandler->triggerEvent('question', $this->faqid(), 'approved', $tags); |
522 | 522 | break; |
523 | 523 | |
524 | 524 | case _SF_NOT_QUESTION_SUBMITTED: |
525 | - $tags['WAITINGFILES_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/admin/question.php?op=mod&faqid=' . $this->faqid(); |
|
525 | + $tags['WAITINGFILES_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/admin/question.php?op=mod&faqid='.$this->faqid(); |
|
526 | 526 | $notificationHandler->triggerEvent('global_question', 0, 'submitted', $tags); |
527 | 527 | $notificationHandler->triggerEvent('category_question', $this->categoryid(), 'submitted', $tags); |
528 | 528 | break; |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | break; |
533 | 533 | |
534 | 534 | case _SF_NOT_NEW_ANSWER_PROPOSED: |
535 | - $tags['WAITINGFILES_URL'] = XOOPS_URL . '/modules/' . $smartModule->getVar('dirname') . '/admin/answer.php?op=mod&faqid=' . $this->faqid(); |
|
535 | + $tags['WAITINGFILES_URL'] = XOOPS_URL.'/modules/'.$smartModule->getVar('dirname').'/admin/answer.php?op=mod&faqid='.$this->faqid(); |
|
536 | 536 | $notificationHandler->triggerEvent('global_faq', 0, 'answer_proposed', $tags); |
537 | 537 | $notificationHandler->triggerEvent('category_faq', $this->categoryid(), 'answer_proposed', $tags); |
538 | 538 | break; |
@@ -668,16 +668,16 @@ discard block |
||
668 | 668 | public function toArray($faq = array(), $category = null, $linkInQuestion = true) |
669 | 669 | { |
670 | 670 | global $xoopsModuleConfig; |
671 | - $lastfaqsize = (int)$xoopsModuleConfig['lastfaqsize']; |
|
671 | + $lastfaqsize = (int) $xoopsModuleConfig['lastfaqsize']; |
|
672 | 672 | |
673 | 673 | $faq['id'] = $this->faqid(); |
674 | 674 | $faq['categoryid'] = $this->categoryid(); |
675 | 675 | $faq['question'] = $this->question(); |
676 | 676 | $page = ($this->status() == _SF_STATUS_OPENED) ? 'answer.php' : 'faq.php'; |
677 | 677 | |
678 | - $faq['questionlink'] = "<a href='$page?faqid=" . $this->faqid() . "'>" . $this->question($lastfaqsize) . '</a>'; |
|
678 | + $faq['questionlink'] = "<a href='$page?faqid=".$this->faqid()."'>".$this->question($lastfaqsize).'</a>'; |
|
679 | 679 | if ($linkInQuestion) { |
680 | - $faq['fullquestionlink'] = "<a href='$page?faqid=" . $this->faqid() . "'>" . $this->question() . '</a>'; |
|
680 | + $faq['fullquestionlink'] = "<a href='$page?faqid=".$this->faqid()."'>".$this->question().'</a>'; |
|
681 | 681 | } else { |
682 | 682 | $faq['fullquestionlink'] = $this->question(); |
683 | 683 | } |
@@ -693,7 +693,7 @@ discard block |
||
693 | 693 | $categoryObj = $category[$this->categoryid()]; |
694 | 694 | } |
695 | 695 | $faq['categoryname'] = $categoryObj->getVar('name'); |
696 | - $faq['categorylink'] = "<a href='" . XOOPS_URL . '/modules/smartfaq/category.php?categoryid=' . $this->categoryid() . "'>" . $categoryObj->getVar('name') . '</a>'; |
|
696 | + $faq['categorylink'] = "<a href='".XOOPS_URL.'/modules/smartfaq/category.php?categoryid='.$this->categoryid()."'>".$categoryObj->getVar('name').'</a>'; |
|
697 | 697 | } |
698 | 698 | |
699 | 699 | return $faq; |
@@ -733,8 +733,8 @@ discard block |
||
733 | 733 | */ |
734 | 734 | public function & get($id) |
735 | 735 | { |
736 | - if ((int)$id > 0) { |
|
737 | - $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_faq') . ' WHERE faqid=' . $id; |
|
736 | + if ((int) $id > 0) { |
|
737 | + $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_faq').' WHERE faqid='.$id; |
|
738 | 738 | if (!$result = $this->db->query($sql)) { |
739 | 739 | return false; |
740 | 740 | } |
@@ -857,26 +857,26 @@ discard block |
||
857 | 857 | { |
858 | 858 | $ret = array(); |
859 | 859 | $limit = $start = 0; |
860 | - $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_faq'); |
|
860 | + $sql = 'SELECT * FROM '.$this->db->prefix('smartfaq_faq'); |
|
861 | 861 | |
862 | 862 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
863 | 863 | $whereClause = $criteria->renderWhere(); |
864 | 864 | |
865 | 865 | if ($whereClause !== 'WHERE ()') { |
866 | - $sql .= ' ' . $criteria->renderWhere(); |
|
866 | + $sql .= ' '.$criteria->renderWhere(); |
|
867 | 867 | if (!empty($notNullFields)) { |
868 | 868 | $sql .= $this->NotNullFieldClause($notNullFields, true); |
869 | 869 | } |
870 | 870 | } elseif (!empty($notNullFields)) { |
871 | - $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
871 | + $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
872 | 872 | } |
873 | 873 | if ($criteria->getSort() != '') { |
874 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
874 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
875 | 875 | } |
876 | 876 | $limit = $criteria->getLimit(); |
877 | 877 | $start = $criteria->getStart(); |
878 | 878 | } elseif (!empty($notNullFields)) { |
879 | - $sql .= $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
879 | + $sql .= $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
880 | 880 | } |
881 | 881 | |
882 | 882 | //echo "<br>" . $sql . "<br>"; |
@@ -936,26 +936,26 @@ discard block |
||
936 | 936 | faq.modulelink AS modulelink, |
937 | 937 | faq.contextpage AS contextpage, |
938 | 938 | faq.exacturl AS exacturl |
939 | - FROM ' . $this->db->prefix('smartfaq_faq') . ' AS faq INNER JOIN ' . $this->db->prefix('smartfaq_categories') . ' AS category ON faq.categoryid = category.categoryid '; |
|
939 | + FROM ' . $this->db->prefix('smartfaq_faq').' AS faq INNER JOIN '.$this->db->prefix('smartfaq_categories').' AS category ON faq.categoryid = category.categoryid '; |
|
940 | 940 | |
941 | 941 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
942 | 942 | $whereClause = $criteria->renderWhere(); |
943 | 943 | |
944 | 944 | if ($whereClause !== 'WHERE ()') { |
945 | - $sql .= ' ' . $criteria->renderWhere(); |
|
945 | + $sql .= ' '.$criteria->renderWhere(); |
|
946 | 946 | if (!empty($notNullFields)) { |
947 | 947 | $sql .= $this->NotNullFieldClause($notNullFields, true); |
948 | 948 | } |
949 | 949 | } elseif (!empty($notNullFields)) { |
950 | - $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
950 | + $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
951 | 951 | } |
952 | 952 | if ($criteria->getSort() != '') { |
953 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
953 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
954 | 954 | } |
955 | 955 | $limit = $criteria->getLimit(); |
956 | 956 | $start = $criteria->getStart(); |
957 | 957 | } elseif (!empty($notNullFields)) { |
958 | - $sql .= $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
958 | + $sql .= $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
959 | 959 | } |
960 | 960 | |
961 | 961 | //echo "<br>" . $sql . "<br>"; |
@@ -1005,19 +1005,19 @@ discard block |
||
1005 | 1005 | */ |
1006 | 1006 | public function getCount($criteria = null, $notNullFields = '') |
1007 | 1007 | { |
1008 | - $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_faq'); |
|
1008 | + $sql = 'SELECT COUNT(*) FROM '.$this->db->prefix('smartfaq_faq'); |
|
1009 | 1009 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
1010 | 1010 | $whereClause = $criteria->renderWhere(); |
1011 | 1011 | if ($whereClause !== 'WHERE ()') { |
1012 | - $sql .= ' ' . $criteria->renderWhere(); |
|
1012 | + $sql .= ' '.$criteria->renderWhere(); |
|
1013 | 1013 | if (!empty($notNullFields)) { |
1014 | 1014 | $sql .= $this->NotNullFieldClause($notNullFields, true); |
1015 | 1015 | } |
1016 | 1016 | } elseif (!empty($notNullFields)) { |
1017 | - $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
1017 | + $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
1018 | 1018 | } |
1019 | 1019 | } elseif (!empty($notNullFields)) { |
1020 | - $sql .= ' WHERE ' . $this->NotNullFieldClause($notNullFields); |
|
1020 | + $sql .= ' WHERE '.$this->NotNullFieldClause($notNullFields); |
|
1021 | 1021 | } |
1022 | 1022 | |
1023 | 1023 | //echo "<br>" . $sql . "<br>"; |
@@ -1050,11 +1050,11 @@ discard block |
||
1050 | 1050 | $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq'); |
1051 | 1051 | |
1052 | 1052 | $categoriesGranted = $smartPermHandler->getPermissions('category'); |
1053 | - $grantedCategories = new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'); |
|
1053 | + $grantedCategories = new Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN'); |
|
1054 | 1054 | |
1055 | 1055 | $faqsGranted = $smartPermHandler->getPermissions('item'); |
1056 | 1056 | $grantedFaq = new CriteriaCompo(); |
1057 | - $grantedFaq->add(new Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR'); |
|
1057 | + $grantedFaq->add(new Criteria('faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR'); |
|
1058 | 1058 | // If user is anonymous, check if the FAQ allow partialview |
1059 | 1059 | if (!is_object($xoopsUser)) { |
1060 | 1060 | $grantedFaq->add(new Criteria('partialview', '1'), 'OR'); |
@@ -1101,7 +1101,7 @@ discard block |
||
1101 | 1101 | */ |
1102 | 1102 | public function getFaqsCountByStatus() |
1103 | 1103 | { |
1104 | - $sql = 'SELECT status, COUNT(*) FROM ' . $this->db->prefix('smartfaq_faq') . ' GROUP BY status'; |
|
1104 | + $sql = 'SELECT status, COUNT(*) FROM '.$this->db->prefix('smartfaq_faq').' GROUP BY status'; |
|
1105 | 1105 | $result = $this->db->query($sql); |
1106 | 1106 | if (!$result) { |
1107 | 1107 | return array(); |
@@ -1158,7 +1158,7 @@ discard block |
||
1158 | 1158 | $otherCriteria = null |
1159 | 1159 | ) { |
1160 | 1160 | global $xoopsUser; |
1161 | - include_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; |
|
1161 | + include_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php'; |
|
1162 | 1162 | |
1163 | 1163 | //if ( ($categoryid == -1) && (empty($status) || ($status == -1)) && ($limit == 0) && ($start ==0) ) { |
1164 | 1164 | // return $this->getObjects(); |
@@ -1170,11 +1170,11 @@ discard block |
||
1170 | 1170 | $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq'); |
1171 | 1171 | |
1172 | 1172 | $categoriesGranted = $smartPermHandler->getPermissions('category'); |
1173 | - $grantedCategories = new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'); |
|
1173 | + $grantedCategories = new Criteria('categoryid', '('.implode(',', $categoriesGranted).')', 'IN'); |
|
1174 | 1174 | |
1175 | 1175 | $faqsGranted = $smartPermHandler->getPermissions('item'); |
1176 | 1176 | $grantedFaq = new CriteriaCompo(); |
1177 | - $grantedFaq->add(new Criteria('faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR'); |
|
1177 | + $grantedFaq->add(new Criteria('faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR'); |
|
1178 | 1178 | // If user is anonymous, check if the FAQ allow partialview |
1179 | 1179 | if (!is_object($xoopsUser)) { |
1180 | 1180 | $grantedFaq->add(new Criteria('partialview', '1'), 'OR'); |
@@ -1183,9 +1183,9 @@ discard block |
||
1183 | 1183 | |
1184 | 1184 | if (isset($categoryid) && ($categoryid != -1)) { |
1185 | 1185 | if (is_array($categoryid)) { |
1186 | - $criteriaCategory = new Criteria('categoryid', '(' . implode(',', $categoryid) . ')', 'IN'); |
|
1186 | + $criteriaCategory = new Criteria('categoryid', '('.implode(',', $categoryid).')', 'IN'); |
|
1187 | 1187 | } else { |
1188 | - $criteriaCategory = new Criteria('categoryid', (int)$categoryid); |
|
1188 | + $criteriaCategory = new Criteria('categoryid', (int) $categoryid); |
|
1189 | 1189 | } |
1190 | 1190 | } |
1191 | 1191 | |
@@ -1252,7 +1252,7 @@ discard block |
||
1252 | 1252 | $asobject = true, |
1253 | 1253 | $otherCriteria = null |
1254 | 1254 | ) { |
1255 | - include_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; |
|
1255 | + include_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php'; |
|
1256 | 1256 | |
1257 | 1257 | $smartModule = sf_getModuleInfo(); |
1258 | 1258 | |
@@ -1311,7 +1311,7 @@ discard block |
||
1311 | 1311 | |
1312 | 1312 | if ($totalFaqs > 0) { |
1313 | 1313 | --$totalFaqs; |
1314 | - mt_srand((double)microtime() * 1000000); |
|
1314 | + mt_srand((double) microtime() * 1000000); |
|
1315 | 1315 | $entrynumber = mt_rand(0, $totalFaqs); |
1316 | 1316 | $faq = $this->getFaqs(1, $entrynumber, $status, -1, 'datesub', 'DESC', $notNullFields); |
1317 | 1317 | if ($faq) { |
@@ -1346,10 +1346,10 @@ discard block |
||
1346 | 1346 | $httphost = $_SERVER['HTTP_HOST']; |
1347 | 1347 | $querystring = $_SERVER['QUERY_STRING']; |
1348 | 1348 | if ($querystring != '') { |
1349 | - $querystring = '?' . $querystring; |
|
1349 | + $querystring = '?'.$querystring; |
|
1350 | 1350 | } |
1351 | - $currenturl = $http . $httphost . $phpself . $querystring; |
|
1352 | - $fullcontexturl = XOOPS_URL . '/' . $faqsObj[$i]->contextpage(); |
|
1351 | + $currenturl = $http.$httphost.$phpself.$querystring; |
|
1352 | + $fullcontexturl = XOOPS_URL.'/'.$faqsObj[$i]->contextpage(); |
|
1353 | 1353 | switch ($faqsObj[$i]->modulelink()) { |
1354 | 1354 | case '': |
1355 | 1355 | $display = false; |
@@ -1368,7 +1368,7 @@ discard block |
||
1368 | 1368 | } |
1369 | 1369 | break; |
1370 | 1370 | default: |
1371 | - if (strpos($currenturl, XOOPS_URL . '/modules/') === false) { |
|
1371 | + if (strpos($currenturl, XOOPS_URL.'/modules/') === false) { |
|
1372 | 1372 | $display = false; |
1373 | 1373 | } else { |
1374 | 1374 | if (strpos($currenturl, $faqsObj[$i]->modulelink()) === false) { |
@@ -1386,7 +1386,7 @@ discard block |
||
1386 | 1386 | } |
1387 | 1387 | |
1388 | 1388 | if (count($randomFaqs) > $limit) { |
1389 | - mt_srand((float)microtime() * 10000000); |
|
1389 | + mt_srand((float) microtime() * 10000000); |
|
1390 | 1390 | $rand_keys = array_rand($randomFaqs, $limit); |
1391 | 1391 | for ($j = 0, $jMax = count($rand_keys); $j < $jMax; ++$j) { |
1392 | 1392 | $ret[] = &$randomFaqs[$rand_keys[$j]]; |
@@ -1409,14 +1409,14 @@ discard block |
||
1409 | 1409 | if (!sf_userIsAdmin()) { |
1410 | 1410 | $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq'); |
1411 | 1411 | $items = $smartPermHandler->getPermissions('item'); |
1412 | - $faqclause = ' AND faqid IN (' . implode(',', $items) . ')'; |
|
1412 | + $faqclause = ' AND faqid IN ('.implode(',', $items).')'; |
|
1413 | 1413 | } |
1414 | 1414 | |
1415 | 1415 | $sql = "CREATE TEMPORARY TABLE tmp (categoryid INT(8) UNSIGNED NOT NULL,datesub INT(11) DEFAULT '0' NOT NULL);"; |
1416 | - $sql2 = ' LOCK TABLES ' . $this->db->prefix('smartfaq_faq') . ' READ;'; |
|
1417 | - $sql3 = ' INSERT INTO tmp SELECT categoryid, MAX(datesub) FROM ' . $this->db->prefix('smartfaq_faq') . ' WHERE status IN (' . implode(',', $status) . ") $faqclause GROUP BY categoryid;"; |
|
1418 | - $sql4 = ' SELECT ' . $this->db->prefix('smartfaq_faq') . '.categoryid, faqid, question, uid, ' . $this->db->prefix('smartfaq_faq') . '.datesub FROM ' . $this->db->prefix('smartfaq_faq') . ', tmp |
|
1419 | - WHERE ' . $this->db->prefix('smartfaq_faq') . '.categoryid=tmp.categoryid AND ' . $this->db->prefix('smartfaq_faq') . '.datesub=tmp.datesub;'; |
|
1416 | + $sql2 = ' LOCK TABLES '.$this->db->prefix('smartfaq_faq').' READ;'; |
|
1417 | + $sql3 = ' INSERT INTO tmp SELECT categoryid, MAX(datesub) FROM '.$this->db->prefix('smartfaq_faq').' WHERE status IN ('.implode(',', $status).") $faqclause GROUP BY categoryid;"; |
|
1418 | + $sql4 = ' SELECT '.$this->db->prefix('smartfaq_faq').'.categoryid, faqid, question, uid, '.$this->db->prefix('smartfaq_faq').'.datesub FROM '.$this->db->prefix('smartfaq_faq').', tmp |
|
1419 | + WHERE ' . $this->db->prefix('smartfaq_faq').'.categoryid=tmp.categoryid AND '.$this->db->prefix('smartfaq_faq').'.datesub=tmp.datesub;'; |
|
1420 | 1420 | /* |
1421 | 1421 | //Old implementation |
1422 | 1422 | $sql = "SELECT categoryid, faqid, question, uid, MAX(datesub) AS datesub FROM ".$this->db->prefix("smartfaq_faq")." |
@@ -1431,7 +1431,7 @@ discard block |
||
1431 | 1431 | $this->db->queryF('UNLOCK TABLES;'); |
1432 | 1432 | $this->db->queryF('DROP TABLE tmp;'); |
1433 | 1433 | if (!$result) { |
1434 | - trigger_error('Error in getLastPublishedByCat SQL: ' . $error); |
|
1434 | + trigger_error('Error in getLastPublishedByCat SQL: '.$error); |
|
1435 | 1435 | |
1436 | 1436 | return $ret; |
1437 | 1437 | } |
@@ -1453,9 +1453,9 @@ discard block |
||
1453 | 1453 | */ |
1454 | 1454 | public function deleteAll($criteria = null) |
1455 | 1455 | { |
1456 | - $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_faq'); |
|
1456 | + $sql = 'DELETE FROM '.$this->db->prefix('smartfaq_faq'); |
|
1457 | 1457 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
1458 | - $sql .= ' ' . $criteria->renderWhere(); |
|
1458 | + $sql .= ' '.$criteria->renderWhere(); |
|
1459 | 1459 | } |
1460 | 1460 | if (!$this->db->query($sql)) { |
1461 | 1461 | return false; |
@@ -1476,10 +1476,10 @@ discard block |
||
1476 | 1476 | **/ |
1477 | 1477 | public function updateAll($fieldname, $fieldvalue, $criteria = null) |
1478 | 1478 | { |
1479 | - $set_clause = is_numeric($fieldvalue) ? $fieldname . ' = ' . $fieldvalue : $fieldname . ' = ' . $this->db->quoteString($fieldvalue); |
|
1480 | - $sql = 'UPDATE ' . $this->db->prefix('smartfaq_faq') . ' SET ' . $set_clause; |
|
1479 | + $set_clause = is_numeric($fieldvalue) ? $fieldname.' = '.$fieldvalue : $fieldname.' = '.$this->db->quoteString($fieldvalue); |
|
1480 | + $sql = 'UPDATE '.$this->db->prefix('smartfaq_faq').' SET '.$set_clause; |
|
1481 | 1481 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
1482 | - $sql .= ' ' . $criteria->renderWhere(); |
|
1482 | + $sql .= ' '.$criteria->renderWhere(); |
|
1483 | 1483 | } |
1484 | 1484 | if (!$this->db->queryF($sql)) { |
1485 | 1485 | return false; |
@@ -1494,7 +1494,7 @@ discard block |
||
1494 | 1494 | */ |
1495 | 1495 | public function updateCounter($faqid) |
1496 | 1496 | { |
1497 | - $sql = 'UPDATE ' . $this->db->prefix('smartfaq_faq') . ' SET counter=counter+1 WHERE faqid = ' . $faqid; |
|
1497 | + $sql = 'UPDATE '.$this->db->prefix('smartfaq_faq').' SET counter=counter+1 WHERE faqid = '.$faqid; |
|
1498 | 1498 | if ($this->db->queryF($sql)) { |
1499 | 1499 | return true; |
1500 | 1500 | } else { |
@@ -1550,8 +1550,8 @@ discard block |
||
1550 | 1550 | $criteriaKeywords = new CriteriaCompo(); |
1551 | 1551 | for ($i = 0, $iMax = count($queryarray); $i < $iMax; ++$i) { |
1552 | 1552 | $criteriaKeyword = new CriteriaCompo(); |
1553 | - $criteriaKeyword->add(new Criteria('faq.question', '%' . $queryarray[$i] . '%', 'LIKE'), 'OR'); |
|
1554 | - $criteriaKeyword->add(new Criteria('answer.answer', '%' . $queryarray[$i] . '%', 'LIKE'), 'OR'); |
|
1553 | + $criteriaKeyword->add(new Criteria('faq.question', '%'.$queryarray[$i].'%', 'LIKE'), 'OR'); |
|
1554 | + $criteriaKeyword->add(new Criteria('answer.answer', '%'.$queryarray[$i].'%', 'LIKE'), 'OR'); |
|
1555 | 1555 | $criteriaKeywords->add($criteriaKeyword, $andor); |
1556 | 1556 | unset($criteriaKeyword); |
1557 | 1557 | } |
@@ -1569,9 +1569,9 @@ discard block |
||
1569 | 1569 | if (!$faqsGranted) { |
1570 | 1570 | return $ret; |
1571 | 1571 | } |
1572 | - $grantedCategories = new Criteria('faq.categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'); |
|
1572 | + $grantedCategories = new Criteria('faq.categoryid', '('.implode(',', $categoriesGranted).')', 'IN'); |
|
1573 | 1573 | $grantedFaq = new CriteriaCompo(); |
1574 | - $grantedFaq->add(new Criteria('faq.faqid', '(' . implode(',', $faqsGranted) . ')', 'IN'), 'OR'); |
|
1574 | + $grantedFaq->add(new Criteria('faq.faqid', '('.implode(',', $faqsGranted).')', 'IN'), 'OR'); |
|
1575 | 1575 | // If user is anonymous, check if the FAQ allow partialview |
1576 | 1576 | if (!is_object($xoopsUser)) { |
1577 | 1577 | $grantedFaq->add(new Criteria('partialview', '1'), 'OR'); |
@@ -1627,9 +1627,9 @@ discard block |
||
1627 | 1627 | $whereClause = $criteria->renderWhere(); |
1628 | 1628 | |
1629 | 1629 | if ($whereClause !== 'WHERE ()') { |
1630 | - $sql .= ' ' . $criteria->renderWhere(); |
|
1630 | + $sql .= ' '.$criteria->renderWhere(); |
|
1631 | 1631 | if ($criteria->getSort() != '') { |
1632 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
1632 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
1633 | 1633 | } |
1634 | 1634 | $limit = $criteria->getLimit(); |
1635 | 1635 | $start = $criteria->getStart(); |
@@ -1668,19 +1668,19 @@ discard block |
||
1668 | 1668 | { |
1669 | 1669 | global $xoopsUser; |
1670 | 1670 | $ret = array(); |
1671 | - $sql = 'SELECT categoryid, COUNT(*) AS count FROM ' . $this->db->prefix('smartfaq_faq'); |
|
1672 | - if ((int)$cat_id > 0) { |
|
1673 | - $sql .= ' WHERE categoryid = ' . (int)$cat_id; |
|
1674 | - $sql .= ' AND status IN (' . implode(',', $status) . ')'; |
|
1671 | + $sql = 'SELECT categoryid, COUNT(*) AS count FROM '.$this->db->prefix('smartfaq_faq'); |
|
1672 | + if ((int) $cat_id > 0) { |
|
1673 | + $sql .= ' WHERE categoryid = '.(int) $cat_id; |
|
1674 | + $sql .= ' AND status IN ('.implode(',', $status).')'; |
|
1675 | 1675 | } else { |
1676 | - $sql .= ' WHERE status IN (' . implode(',', $status) . ')'; |
|
1676 | + $sql .= ' WHERE status IN ('.implode(',', $status).')'; |
|
1677 | 1677 | if (!sf_userIsAdmin()) { |
1678 | 1678 | $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq'); |
1679 | 1679 | $items = $smartPermHandler->getPermissions('item'); |
1680 | 1680 | if (is_object($xoopsUser)) { |
1681 | - $sql .= ' AND faqid IN (' . implode(',', $items) . ')'; |
|
1681 | + $sql .= ' AND faqid IN ('.implode(',', $items).')'; |
|
1682 | 1682 | } else { |
1683 | - $sql .= ' AND (faqid IN (' . implode(',', $items) . ') OR partialview = 1)'; |
|
1683 | + $sql .= ' AND (faqid IN ('.implode(',', $items).') OR partialview = 1)'; |
|
1684 | 1684 | } |
1685 | 1685 | } |
1686 | 1686 | } |
@@ -1693,7 +1693,7 @@ discard block |
||
1693 | 1693 | return $ret; |
1694 | 1694 | } |
1695 | 1695 | while ($row = $this->db->fetchArray($result)) { |
1696 | - $ret[$row['categoryid']] = (int)$row['count']; |
|
1696 | + $ret[$row['categoryid']] = (int) $row['count']; |
|
1697 | 1697 | } |
1698 | 1698 | |
1699 | 1699 | return $ret; |
@@ -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 | $GLOBALS['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,16 +77,16 @@ 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); |
84 | - $catQnasWithSub += $subcats[$subcat_id]['total']; |
|
84 | + $catQnasWithSub += $subcats[$subcat_id]['total']; |
|
85 | 85 | } |
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'; |
@@ -116,13 +116,13 @@ |
||
116 | 116 | // Language constants |
117 | 117 | $moduleName =& $myts->displayTarea($xoopsModule->getVar('name')); |
118 | 118 | $xoopsTpl->assign(array( |
119 | - 'lang_on' => _MD_SF_ON, |
|
120 | - 'lang_postedby' => _MD_SF_POSTEDBY, |
|
121 | - 'lang_total' => $totalQnasOnPage, |
|
122 | - 'lang_faq' => _MD_SF_FAQ, |
|
123 | - 'lang_datesub' => _MD_SF_DATESUB, |
|
124 | - 'lang_hits' => _MD_SF_HITS |
|
125 | - )); |
|
119 | + 'lang_on' => _MD_SF_ON, |
|
120 | + 'lang_postedby' => _MD_SF_POSTEDBY, |
|
121 | + 'lang_total' => $totalQnasOnPage, |
|
122 | + 'lang_faq' => _MD_SF_FAQ, |
|
123 | + 'lang_datesub' => _MD_SF_DATESUB, |
|
124 | + 'lang_hits' => _MD_SF_HITS |
|
125 | + )); |
|
126 | 126 | |
127 | 127 | $moduleName =& $myts->displayTarea($xoopsModule->getVar('name')); |
128 | 128 | $xoopsTpl->assign('lang_mainhead', sprintf(_MD_SF_OPEN_WELCOME, $xoopsConfig['sitename'])); |
@@ -6,15 +6,15 @@ 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 | // At which record shall we start for the Categories |
14 | -$catstart = isset($_GET['catstart']) ? (int)$_GET['catstart'] : 0; |
|
14 | +$catstart = isset($_GET['catstart']) ? (int) $_GET['catstart'] : 0; |
|
15 | 15 | |
16 | 16 | // At which record shall we start for the FAQs |
17 | -$start = isset($_GET['start']) ? (int)$_GET['start'] : 0; |
|
17 | +$start = isset($_GET['start']) ? (int) $_GET['start'] : 0; |
|
18 | 18 | |
19 | 19 | // Creating the category handler object |
20 | 20 | $categoryHandler = sf_gethandler('category'); |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | |
43 | 43 | $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_index.tpl'; |
44 | 44 | |
45 | -include_once XOOPS_ROOT_PATH . '/header.php'; |
|
46 | -include_once __DIR__ . '/footer.php'; |
|
45 | +include_once XOOPS_ROOT_PATH.'/header.php'; |
|
46 | +include_once __DIR__.'/footer.php'; |
|
47 | 47 | |
48 | 48 | //get all categories for future reference |
49 | 49 | $allcategories = $categoryHandler->getObjects(null, true); |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | if (isset($totalQnas[$subcat_id]) && $totalQnas[$subcat_id] > 0) { |
66 | 66 | if (isset($last_qnaObj[$subcat_id])) { |
67 | 67 | $subcat->setVar('last_faqid', $last_qnaObj[$subcat_id]->getVar('faqid')); |
68 | - $subcat->setVar('last_question_link', "<a href='faq.php?faqid=" . $last_qnaObj[$subcat_id]->getVar('faqid') . "'>" . $last_qnaObj[$subcat_id]->question(50) . '</a>'); |
|
68 | + $subcat->setVar('last_question_link', "<a href='faq.php?faqid=".$last_qnaObj[$subcat_id]->getVar('faqid')."'>".$last_qnaObj[$subcat_id]->question(50).'</a>'); |
|
69 | 69 | } |
70 | 70 | $subcat->setVar('faqcount', $totalQnas[$subcat_id]); |
71 | 71 | $categories[$cat_id]['subcats'][$subcat_id] = $subcat->toArray(null, true); |
72 | - $total += $totalQnas[$subcat_id]; |
|
72 | + $total += $totalQnas[$subcat_id]; |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | $memberHandler = xoops_getHandler('member'); |
104 | - $users = $memberHandler->getUsers(new Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN'), true); |
|
104 | + $users = $memberHandler->getUsers(new Criteria('uid', '('.implode(',', array_keys($userids)).')', 'IN'), true); |
|
105 | 105 | for ($i = 0; $i < $totalQnasOnPage; ++$i) { |
106 | 106 | $faq = $faqsObj[$i]->toArray(null, $allcategories); |
107 | 107 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | } |
115 | 115 | } |
116 | 116 | // Language constants |
117 | -$moduleName =& $myts->displayTarea($xoopsModule->getVar('name')); |
|
117 | +$moduleName = & $myts->displayTarea($xoopsModule->getVar('name')); |
|
118 | 118 | $xoopsTpl->assign(array( |
119 | 119 | 'lang_on' => _MD_SF_ON, |
120 | 120 | 'lang_postedby' => _MD_SF_POSTEDBY, |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | 'lang_hits' => _MD_SF_HITS |
125 | 125 | )); |
126 | 126 | |
127 | -$moduleName =& $myts->displayTarea($xoopsModule->getVar('name')); |
|
127 | +$moduleName = & $myts->displayTarea($xoopsModule->getVar('name')); |
|
128 | 128 | $xoopsTpl->assign('lang_mainhead', sprintf(_MD_SF_OPEN_WELCOME, $xoopsConfig['sitename'])); |
129 | 129 | $xoopsTpl->assign('lang_mainintro', $myts->displayTarea($xoopsModuleConfig['openquestionintromsg'], 1)); |
130 | 130 | $xoopsTpl->assign('lang_total', _MD_SF_TOTAL_QUESTIONS); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | $xoopsTpl->assign('lang_description', _MD_SF_DESCRIPTION); |
133 | 133 | $xoopsTpl->assign('lang_category', _MD_SF_CATEGORY); |
134 | 134 | $xoopsTpl->assign('sectionname', $moduleName); |
135 | -$xoopsTpl->assign('whereInSection', "<a href='index.php'>" . $moduleName . '</a> > ' . _MD_SF_OPEN_SECTION); |
|
135 | +$xoopsTpl->assign('whereInSection', "<a href='index.php'>".$moduleName.'</a> > '._MD_SF_OPEN_SECTION); |
|
136 | 136 | |
137 | 137 | $xoopsTpl->assign('displayFull', false); |
138 | 138 | $xoopsTpl->assign('displaylastfaqs', $xoopsModuleConfig['displaylastfaqs']); |
@@ -148,25 +148,25 @@ discard block |
||
148 | 148 | $xoopsTpl->assign('lang_category', _MD_SF_CATEGORY); |
149 | 149 | |
150 | 150 | // Category Navigation Bar |
151 | -include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
151 | +include_once XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
152 | 152 | $pagenav = new XoopsPageNav($totalCategories, $xoopsModuleConfig['catperpage'], $catstart, 'catstart', ''); |
153 | 153 | if ($xoopsModuleConfig['useimagenavpage'] == 1) { |
154 | - $xoopsTpl->assign('catnavbar', '<div style="text-align:right;">' . $pagenav->renderImageNav() . '</div>'); |
|
154 | + $xoopsTpl->assign('catnavbar', '<div style="text-align:right;">'.$pagenav->renderImageNav().'</div>'); |
|
155 | 155 | } else { |
156 | - $xoopsTpl->assign('catnavbar', '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'); |
|
156 | + $xoopsTpl->assign('catnavbar', '<div style="text-align:right;">'.$pagenav->renderNav().'</div>'); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | // FAQ Navigation Bar |
160 | 160 | $pagenav = new XoopsPageNav($totalFaqs, $xoopsModuleConfig['indexperpage'], $start, 'start', ''); |
161 | 161 | if ($xoopsModuleConfig['useimagenavpage'] == 1) { |
162 | - $xoopsTpl->assign('navbar', '<div style="text-align:right;">' . $pagenav->renderImageNav() . '</div>'); |
|
162 | + $xoopsTpl->assign('navbar', '<div style="text-align:right;">'.$pagenav->renderImageNav().'</div>'); |
|
163 | 163 | } else { |
164 | - $xoopsTpl->assign('navbar', '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'); |
|
164 | + $xoopsTpl->assign('navbar', '<div style="text-align:right;">'.$pagenav->renderNav().'</div>'); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | // Page Title Hack by marcan |
168 | 168 | $module_name = $myts->htmlSpecialChars($xoopsModule->getVar('name')); |
169 | -$xoopsTpl->assign('xoops_pagetitle', $module_name . ' - ' . $category->getVar('name')); |
|
169 | +$xoopsTpl->assign('xoops_pagetitle', $module_name.' - '.$category->getVar('name')); |
|
170 | 170 | // End Page Title Hack by marcan |
171 | 171 | |
172 | -include_once XOOPS_ROOT_PATH . '/footer.php'; |
|
172 | +include_once XOOPS_ROOT_PATH.'/footer.php'; |
@@ -15,12 +15,12 @@ |
||
15 | 15 | $xoopsTpl->assign('isAdmin', $isAdmin); |
16 | 16 | |
17 | 17 | $xoopsTpl->assign(array( |
18 | - 'lang_on' => _MD_SF_ON, |
|
19 | - 'lang_postedby' => _MD_SF_POSTEDBY, |
|
20 | - 'lang_faq' => _MD_SF_QUESTION, |
|
21 | - 'lang_datesub' => _MD_SF_DATESUB, |
|
22 | - 'lang_hits' => _MD_SF_HITS |
|
23 | - )); |
|
18 | + 'lang_on' => _MD_SF_ON, |
|
19 | + 'lang_postedby' => _MD_SF_POSTEDBY, |
|
20 | + 'lang_faq' => _MD_SF_QUESTION, |
|
21 | + 'lang_datesub' => _MD_SF_DATESUB, |
|
22 | + 'lang_hits' => _MD_SF_HITS |
|
23 | + )); |
|
24 | 24 | $xoopsTpl->assign('sectionname', $myts->displayTarea($xoopsModule->getVar('name'))); |
25 | 25 | |
26 | 26 | $xoopsTpl->assign('modulename', $xoopsModule->dirname()); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | $uid = $xoopsUser ? $xoopsUser->getVar('uid') : 0; |
12 | 12 | $isAdmin = (sf_userIsAdmin() || sf_moderator()); |
13 | 13 | |
14 | -$xoopsTpl->assign('sf_adminpage', "<a href='" . XOOPS_URL . "/modules/smartfaq/admin/index.php'>" . _MD_SF_ADMIN_PAGE . '</a>'); |
|
14 | +$xoopsTpl->assign('sf_adminpage', "<a href='".XOOPS_URL."/modules/smartfaq/admin/index.php'>"._MD_SF_ADMIN_PAGE.'</a>'); |
|
15 | 15 | $xoopsTpl->assign('isAdmin', $isAdmin); |
16 | 16 | |
17 | 17 | $xoopsTpl->assign(array( |
@@ -34,4 +34,4 @@ discard block |
||
34 | 34 | |
35 | 35 | $xoopsTpl->assign('ref_smartfaq', 'SmartFAQ is developed by The SmartFactory (http://www.smartfactory.ca), a division of InBox Solutions (http://www.inboxsolutions.net)'); |
36 | 36 | |
37 | -$xoopsTpl->assign('xoops_module_header', "<link rel='stylesheet' type='text/css' href='" . XOOPS_URL . "/modules/smartfaq/assets/css/smartfaq.css'/>"); |
|
37 | +$xoopsTpl->assign('xoops_module_header', "<link rel='stylesheet' type='text/css' href='".XOOPS_URL."/modules/smartfaq/assets/css/smartfaq.css'/>"); |
@@ -6,11 +6,11 @@ |
||
6 | 6 | * Licence: GNU |
7 | 7 | */ |
8 | 8 | |
9 | -include __DIR__ . '/../../mainfile.php'; |
|
9 | +include __DIR__.'/../../mainfile.php'; |
|
10 | 10 | |
11 | -include_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; |
|
12 | -include_once XOOPS_ROOT_PATH . '/modules/smartfaq/class/category.php'; |
|
13 | -include_once XOOPS_ROOT_PATH . '/modules/smartfaq/class/faq.php'; |
|
14 | -include_once XOOPS_ROOT_PATH . '/modules/smartfaq/class/answer.php'; |
|
11 | +include_once XOOPS_ROOT_PATH.'/modules/smartfaq/include/functions.php'; |
|
12 | +include_once XOOPS_ROOT_PATH.'/modules/smartfaq/class/category.php'; |
|
13 | +include_once XOOPS_ROOT_PATH.'/modules/smartfaq/class/faq.php'; |
|
14 | +include_once XOOPS_ROOT_PATH.'/modules/smartfaq/class/answer.php'; |
|
15 | 15 | |
16 | 16 | $myts = MyTextSanitizer::getInstance(); |
@@ -136,10 +136,10 @@ |
||
136 | 136 | if (isset($last_qnaObj) && $last_qnaObj) { |
137 | 137 | $category['last_faqid'] = $last_qnaObj[$categoryObj->getVar('categoryid')]->getVar('faqid'); |
138 | 138 | $category['last_question_link'] = "<a href='faq.php?faqid=" |
139 | - . $last_qnaObj[$categoryObj->getVar('categoryid')]->getVar('faqid') |
|
140 | - . "'>" |
|
141 | - . $last_qnaObj[$categoryObj->getVar('categoryid')]->question($lastfaqsize) |
|
142 | - . '</a>'; |
|
139 | + . $last_qnaObj[$categoryObj->getVar('categoryid')]->getVar('faqid') |
|
140 | + . "'>" |
|
141 | + . $last_qnaObj[$categoryObj->getVar('categoryid')]->question($lastfaqsize) |
|
142 | + . '</a>'; |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 |
@@ -6,9 +6,9 @@ discard block |
||
6 | 6 | * Licence: GNU |
7 | 7 | */ |
8 | 8 | |
9 | -include_once __DIR__ . '/header.php'; |
|
9 | +include_once __DIR__.'/header.php'; |
|
10 | 10 | |
11 | -$categoryid = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : 0; |
|
11 | +$categoryid = isset($_GET['categoryid']) ? (int) $_GET['categoryid'] : 0; |
|
12 | 12 | |
13 | 13 | // Creating the category handler object |
14 | 14 | $categoryHandler = sf_gethandler('category'); |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | } |
33 | 33 | $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_category.tpl'; |
34 | 34 | |
35 | -include_once XOOPS_ROOT_PATH . '/header.php'; |
|
36 | -include_once __DIR__ . '/footer.php'; |
|
35 | +include_once XOOPS_ROOT_PATH.'/header.php'; |
|
36 | +include_once __DIR__.'/footer.php'; |
|
37 | 37 | |
38 | 38 | // At which record shall we start |
39 | -$start = isset($_GET['start']) ? (int)$_GET['start'] : 0; |
|
39 | +$start = isset($_GET['start']) ? (int) $_GET['start'] : 0; |
|
40 | 40 | |
41 | 41 | // Creating the faq handler object |
42 | 42 | $faqHandler = sf_gethandler('faq'); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | // Get the last smartfaq |
71 | 71 | $last_qnaObj = $faqHandler->getLastPublishedByCat(); |
72 | 72 | } |
73 | -$lastfaqsize = (int)$xoopsModuleConfig['lastfaqsize']; |
|
73 | +$lastfaqsize = (int) $xoopsModuleConfig['lastfaqsize']; |
|
74 | 74 | // Creating the sub-categories objects that belong to the selected category |
75 | 75 | $subcatsObj = $categoryHandler->getCategories(0, 0, $categoryid); |
76 | 76 | $total_subcats = count($subcatsObj); |
@@ -82,18 +82,18 @@ discard block |
||
82 | 82 | if (isset($totalQnas[$subcat_id]) && $totalQnas[$subcat_id] > 0) { |
83 | 83 | if (isset($last_qnaObj[$subcat_id])) { |
84 | 84 | $subcatsObj[$i]->setVar('last_faqid', $last_qnaObj[$subcat_id]->getVar('faqid')); |
85 | - $subcatsObj[$i]->setVar('last_question_link', "<a href='faq.php?faqid=" . $last_qnaObj[$subcat_id]->getVar('faqid') . "'>" . $last_qnaObj[$subcat_id]->question($lastfaqsize) . '</a>'); |
|
85 | + $subcatsObj[$i]->setVar('last_question_link', "<a href='faq.php?faqid=".$last_qnaObj[$subcat_id]->getVar('faqid')."'>".$last_qnaObj[$subcat_id]->question($lastfaqsize).'</a>'); |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | $subcatsObj[$i]->setVar('faqcount', $totalQnas[$subcat_id]); |
89 | 89 | $subcats[$subcat_id] = $subcatsObj[$i]->toArray(); |
90 | - $total_faqs += $totalQnas[$subcat_id]; |
|
90 | + $total_faqs += $totalQnas[$subcat_id]; |
|
91 | 91 | //}replacé ligne 92 |
92 | 92 | } |
93 | 93 | $xoopsTpl->assign('subcats', $subcats); |
94 | 94 | } |
95 | 95 | $thiscategory_faqcount = isset($totalQnas[$categoryid]) ? $totalQnas[$categoryid] : 0; |
96 | -$category['total'] = $thiscategory_faqcount + $total_faqs; |
|
96 | +$category['total'] = $thiscategory_faqcount+$total_faqs; |
|
97 | 97 | |
98 | 98 | if (count($faqsObj) > 0) { |
99 | 99 | $userids = array(); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | } |
110 | 110 | |
111 | 111 | $memberHandler = xoops_getHandler('member'); |
112 | - $users = $memberHandler->getUsers(new Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN'), true); |
|
112 | + $users = $memberHandler->getUsers(new Criteria('uid', '('.implode(',', array_keys($userids)).')', 'IN'), true); |
|
113 | 113 | // Adding the Q&As of the selected category |
114 | 114 | for ($i = 0; $i < $totalQnasOnPage; ++$i) { |
115 | 115 | $faq = $faqsObj[$i]->toArray(null, $categoryObj); |
@@ -164,26 +164,26 @@ discard block |
||
164 | 164 | $xoopsTpl->assign('lang_comments', _MD_SF_COMMENTS); |
165 | 165 | |
166 | 166 | // The Navigation Bar |
167 | -include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
168 | -$pagenav = new XoopsPageNav($thiscategory_faqcount, $xoopsModuleConfig['indexperpage'], $start, 'start', 'categoryid=' . $categoryObj->getVar('categoryid')); |
|
167 | +include_once XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
168 | +$pagenav = new XoopsPageNav($thiscategory_faqcount, $xoopsModuleConfig['indexperpage'], $start, 'start', 'categoryid='.$categoryObj->getVar('categoryid')); |
|
169 | 169 | if ($xoopsModuleConfig['useimagenavpage'] == 1) { |
170 | - $xoopsTpl->assign('navbar', '<div style="text-align:right;">' . $pagenav->renderImageNav() . '</div>'); |
|
170 | + $xoopsTpl->assign('navbar', '<div style="text-align:right;">'.$pagenav->renderImageNav().'</div>'); |
|
171 | 171 | } else { |
172 | - $xoopsTpl->assign('navbar', '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'); |
|
172 | + $xoopsTpl->assign('navbar', '<div style="text-align:right;">'.$pagenav->renderNav().'</div>'); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | $xoopsTpl->assign('category', $category); |
176 | 176 | |
177 | 177 | // Page Title Hack by marcan |
178 | 178 | $module_name = $myts->htmlSpecialChars($xoopsModule->getVar('name')); |
179 | -$xoopsTpl->assign('xoops_pagetitle', $module_name . ' - ' . $category['name']); |
|
179 | +$xoopsTpl->assign('xoops_pagetitle', $module_name.' - '.$category['name']); |
|
180 | 180 | // End Page Title Hack by marcan |
181 | 181 | |
182 | 182 | //code to include smartie |
183 | -if (file_exists(XOOPS_ROOT_PATH . '/modules/smarttie/smarttie_links.php')) { |
|
184 | - include_once XOOPS_ROOT_PATH . '/modules/smarttie/smarttie_links.php'; |
|
183 | +if (file_exists(XOOPS_ROOT_PATH.'/modules/smarttie/smarttie_links.php')) { |
|
184 | + include_once XOOPS_ROOT_PATH.'/modules/smarttie/smarttie_links.php'; |
|
185 | 185 | $xoopsTpl->assign('smarttie', 1); |
186 | 186 | } |
187 | 187 | //end code for smarttie |
188 | 188 | |
189 | -include_once XOOPS_ROOT_PATH . '/footer.php'; |
|
189 | +include_once XOOPS_ROOT_PATH.'/footer.php'; |
@@ -47,154 +47,154 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | switch ($op) { |
50 | - case 'preview': |
|
50 | + case 'preview': |
|
51 | 51 | |
52 | - global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsDB; |
|
52 | + global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsDB; |
|
53 | 53 | |
54 | - $faqObj = $faqHandler->create(); |
|
55 | - $answerObj = $answerHandler->create(); |
|
56 | - $categoryObj = $categoryHandler->get($_POST['categoryid']); |
|
54 | + $faqObj = $faqHandler->create(); |
|
55 | + $answerObj = $answerHandler->create(); |
|
56 | + $categoryObj = $categoryHandler->get($_POST['categoryid']); |
|
57 | 57 | |
58 | - if (!$xoopsUser) { |
|
59 | - if ($xoopsModuleConfig['anonpost'] == 1) { |
|
60 | - $uid = 0; |
|
58 | + if (!$xoopsUser) { |
|
59 | + if ($xoopsModuleConfig['anonpost'] == 1) { |
|
60 | + $uid = 0; |
|
61 | + } else { |
|
62 | + redirect_header('index.php', 3, _NOPERM); |
|
63 | + } |
|
61 | 64 | } else { |
62 | - redirect_header('index.php', 3, _NOPERM); |
|
65 | + $uid = $xoopsUser->uid(); |
|
63 | 66 | } |
64 | - } else { |
|
65 | - $uid = $xoopsUser->uid(); |
|
66 | - } |
|
67 | 67 | |
68 | - $notifypub = isset($_POST['notifypub']) ? $_POST['notifypub'] : 0; |
|
68 | + $notifypub = isset($_POST['notifypub']) ? $_POST['notifypub'] : 0; |
|
69 | 69 | |
70 | - // Putting the values about the FAQ in the FAQ object |
|
71 | - $faqObj->setVar('categoryid', $_POST['categoryid']); |
|
72 | - $faqObj->setVar('uid', $uid); |
|
73 | - $faqObj->setVar('question', $_POST['question']); |
|
74 | - $faqObj->setVar('howdoi', $_POST['howdoi']); |
|
75 | - $faqObj->setVar('diduno', $_POST['diduno']); |
|
76 | - $faqObj->setVar('datesub', time()); |
|
70 | + // Putting the values about the FAQ in the FAQ object |
|
71 | + $faqObj->setVar('categoryid', $_POST['categoryid']); |
|
72 | + $faqObj->setVar('uid', $uid); |
|
73 | + $faqObj->setVar('question', $_POST['question']); |
|
74 | + $faqObj->setVar('howdoi', $_POST['howdoi']); |
|
75 | + $faqObj->setVar('diduno', $_POST['diduno']); |
|
76 | + $faqObj->setVar('datesub', time()); |
|
77 | 77 | |
78 | - // Putting the values in the answer object |
|
79 | - $answerObj->setVar('status', _SF_AN_STATUS_APPROVED); |
|
80 | - $answerObj->setVar('faqid', $faqObj->faqid()); |
|
81 | - $answerObj->setVar('answer', $_POST['answer']); |
|
82 | - $answerObj->setVar('uid', $uid); |
|
78 | + // Putting the values in the answer object |
|
79 | + $answerObj->setVar('status', _SF_AN_STATUS_APPROVED); |
|
80 | + $answerObj->setVar('faqid', $faqObj->faqid()); |
|
81 | + $answerObj->setVar('answer', $_POST['answer']); |
|
82 | + $answerObj->setVar('uid', $uid); |
|
83 | 83 | |
84 | - global $xoopsUser, $myts; |
|
84 | + global $xoopsUser, $myts; |
|
85 | 85 | |
86 | - $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.tpl'; |
|
87 | - include_once XOOPS_ROOT_PATH . '/header.php'; |
|
88 | - include_once __DIR__ . '/footer.php'; |
|
86 | + $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.tpl'; |
|
87 | + include_once XOOPS_ROOT_PATH . '/header.php'; |
|
88 | + include_once __DIR__ . '/footer.php'; |
|
89 | 89 | |
90 | - $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous'; |
|
90 | + $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous'; |
|
91 | 91 | |
92 | - $moduleName =& $myts->displayTarea($xoopsModule->getVar('name')); |
|
93 | - $faq = $faqObj->toArray(null, $categoryObj, false); |
|
94 | - $faq['categoryPath'] = $categoryObj->getCategoryPath(true); |
|
95 | - $faq['answer'] = $answerObj->answer(); |
|
96 | - $faq['who_when'] = $faqObj->getWhoAndWhen(); |
|
92 | + $moduleName =& $myts->displayTarea($xoopsModule->getVar('name')); |
|
93 | + $faq = $faqObj->toArray(null, $categoryObj, false); |
|
94 | + $faq['categoryPath'] = $categoryObj->getCategoryPath(true); |
|
95 | + $faq['answer'] = $answerObj->answer(); |
|
96 | + $faq['who_when'] = $faqObj->getWhoAndWhen(); |
|
97 | 97 | |
98 | - $faq['comments'] = -1; |
|
99 | - $xoopsTpl->assign('faq', $faq); |
|
100 | - $xoopsTpl->assign('op', 'preview'); |
|
101 | - $xoopsTpl->assign('whereInSection', $moduleName); |
|
102 | - $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME); |
|
98 | + $faq['comments'] = -1; |
|
99 | + $xoopsTpl->assign('faq', $faq); |
|
100 | + $xoopsTpl->assign('op', 'preview'); |
|
101 | + $xoopsTpl->assign('whereInSection', $moduleName); |
|
102 | + $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME); |
|
103 | 103 | |
104 | - $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name()))); |
|
105 | - $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO); |
|
104 | + $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name()))); |
|
105 | + $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO); |
|
106 | 106 | |
107 | - include_once __DIR__ . '/include/submit.inc.php'; |
|
107 | + include_once __DIR__ . '/include/submit.inc.php'; |
|
108 | 108 | |
109 | - include_once XOOPS_ROOT_PATH . '/footer.php'; |
|
109 | + include_once XOOPS_ROOT_PATH . '/footer.php'; |
|
110 | 110 | |
111 | - exit(); |
|
112 | - break; |
|
111 | + exit(); |
|
112 | + break; |
|
113 | 113 | |
114 | - case 'post': |
|
114 | + case 'post': |
|
115 | 115 | |
116 | - global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsDB; |
|
116 | + global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsDB; |
|
117 | 117 | |
118 | - $newFaqObj = $faqHandler->create(); |
|
119 | - $newAnswerObj = $answerHandler->create(); |
|
118 | + $newFaqObj = $faqHandler->create(); |
|
119 | + $newAnswerObj = $answerHandler->create(); |
|
120 | 120 | |
121 | - if (!$xoopsUser) { |
|
122 | - if ($xoopsModuleConfig['anonpost'] == 1) { |
|
123 | - $uid = 0; |
|
121 | + if (!$xoopsUser) { |
|
122 | + if ($xoopsModuleConfig['anonpost'] == 1) { |
|
123 | + $uid = 0; |
|
124 | + } else { |
|
125 | + redirect_header('index.php', 3, _NOPERM); |
|
126 | + } |
|
124 | 127 | } else { |
125 | - redirect_header('index.php', 3, _NOPERM); |
|
128 | + $uid = $xoopsUser->uid(); |
|
126 | 129 | } |
127 | - } else { |
|
128 | - $uid = $xoopsUser->uid(); |
|
129 | - } |
|
130 | - |
|
131 | - $notifypub = isset($_POST['notifypub']) ? $_POST['notifypub'] : 0; |
|
132 | - |
|
133 | - // Putting the values about the FAQ in the FAQ object |
|
134 | - $newFaqObj->setVar('categoryid', $_POST['categoryid']); |
|
135 | - $newFaqObj->setVar('uid', $uid); |
|
136 | - $newFaqObj->setVar('question', $_POST['question']); |
|
137 | - $newFaqObj->setVar('howdoi', $_POST['howdoi']); |
|
138 | - $newFaqObj->setVar('diduno', $_POST['diduno']); |
|
139 | - $newFaqObj->setVar('notifypub', $notifypub); |
|
140 | - //$newFaqObj->setVar('modulelink', $_POST['modulelink']); |
|
141 | - //$newFaqObj->setVar('contextpage', $_POST['contextpage']); |
|
142 | 130 | |
143 | - // Setting the status of the FAQ |
|
144 | - |
|
145 | - // if user is admin, FAQ are automatically published |
|
146 | - $isAdmin = sf_userIsAdmin(); |
|
147 | - if ($isAdmin) { |
|
148 | - $newFaqObj->setVar('status', _SF_STATUS_PUBLISHED); |
|
149 | - } elseif ($xoopsModuleConfig['autoapprove_submitted_faq'] == 1) { |
|
150 | - $newFaqObj->setVar('status', _SF_STATUS_PUBLISHED); |
|
151 | - } else { |
|
152 | - $newFaqObj->setVar('status', _SF_STATUS_SUBMITTED); |
|
153 | - } |
|
131 | + $notifypub = isset($_POST['notifypub']) ? $_POST['notifypub'] : 0; |
|
132 | + |
|
133 | + // Putting the values about the FAQ in the FAQ object |
|
134 | + $newFaqObj->setVar('categoryid', $_POST['categoryid']); |
|
135 | + $newFaqObj->setVar('uid', $uid); |
|
136 | + $newFaqObj->setVar('question', $_POST['question']); |
|
137 | + $newFaqObj->setVar('howdoi', $_POST['howdoi']); |
|
138 | + $newFaqObj->setVar('diduno', $_POST['diduno']); |
|
139 | + $newFaqObj->setVar('notifypub', $notifypub); |
|
140 | + //$newFaqObj->setVar('modulelink', $_POST['modulelink']); |
|
141 | + //$newFaqObj->setVar('contextpage', $_POST['contextpage']); |
|
142 | + |
|
143 | + // Setting the status of the FAQ |
|
144 | + |
|
145 | + // if user is admin, FAQ are automatically published |
|
146 | + $isAdmin = sf_userIsAdmin(); |
|
147 | + if ($isAdmin) { |
|
148 | + $newFaqObj->setVar('status', _SF_STATUS_PUBLISHED); |
|
149 | + } elseif ($xoopsModuleConfig['autoapprove_submitted_faq'] == 1) { |
|
150 | + $newFaqObj->setVar('status', _SF_STATUS_PUBLISHED); |
|
151 | + } else { |
|
152 | + $newFaqObj->setVar('status', _SF_STATUS_SUBMITTED); |
|
153 | + } |
|
154 | 154 | |
155 | - // Storing the FAQ object in the database |
|
156 | - if (!$newFaqObj->store()) { |
|
157 | - redirect_header('javascript:history.go(-1)', 2, _MD_SF_SUBMIT_ERROR); |
|
158 | - } |
|
155 | + // Storing the FAQ object in the database |
|
156 | + if (!$newFaqObj->store()) { |
|
157 | + redirect_header('javascript:history.go(-1)', 2, _MD_SF_SUBMIT_ERROR); |
|
158 | + } |
|
159 | 159 | |
160 | - // Putting the values in the answer object |
|
161 | - $newAnswerObj->setVar('status', _SF_AN_STATUS_APPROVED); |
|
162 | - $newAnswerObj->setVar('faqid', $newFaqObj->faqid()); |
|
163 | - $newAnswerObj->setVar('answer', $_POST['answer']); |
|
164 | - $newAnswerObj->setVar('uid', $uid); |
|
165 | - |
|
166 | - //==================================================================================== |
|
167 | - //TODO post Attachment |
|
168 | - $attachments_tmp = array(); |
|
169 | - if (!empty($_POST['attachments_tmp'])) { |
|
170 | - $attachments_tmp = unserialize(base64_decode($_POST['attachments_tmp'])); |
|
171 | - if (isset($_POST['delete_tmp']) && count($_POST['delete_tmp'])) { |
|
172 | - foreach ($_POST['delete_tmp'] as $key) { |
|
173 | - unlink(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attachments_tmp[$key][0]); |
|
174 | - unset($attachments_tmp[$key]); |
|
160 | + // Putting the values in the answer object |
|
161 | + $newAnswerObj->setVar('status', _SF_AN_STATUS_APPROVED); |
|
162 | + $newAnswerObj->setVar('faqid', $newFaqObj->faqid()); |
|
163 | + $newAnswerObj->setVar('answer', $_POST['answer']); |
|
164 | + $newAnswerObj->setVar('uid', $uid); |
|
165 | + |
|
166 | + //==================================================================================== |
|
167 | + //TODO post Attachment |
|
168 | + $attachments_tmp = array(); |
|
169 | + if (!empty($_POST['attachments_tmp'])) { |
|
170 | + $attachments_tmp = unserialize(base64_decode($_POST['attachments_tmp'])); |
|
171 | + if (isset($_POST['delete_tmp']) && count($_POST['delete_tmp'])) { |
|
172 | + foreach ($_POST['delete_tmp'] as $key) { |
|
173 | + unlink(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attachments_tmp[$key][0]); |
|
174 | + unset($attachments_tmp[$key]); |
|
175 | + } |
|
175 | 176 | } |
176 | 177 | } |
177 | - } |
|
178 | - if (count($attachments_tmp)) { |
|
179 | - foreach ($attachments_tmp as $key => $attach) { |
|
180 | - if (rename(XOOPS_CACHE_PATH . '/' . $attachments_tmp[$key][0], XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attachments_tmp[$key][0])) { |
|
181 | - $post_obj->setAttachment($attach[0], $attach[1], $attach[2]); |
|
178 | + if (count($attachments_tmp)) { |
|
179 | + foreach ($attachments_tmp as $key => $attach) { |
|
180 | + if (rename(XOOPS_CACHE_PATH . '/' . $attachments_tmp[$key][0], XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attachments_tmp[$key][0])) { |
|
181 | + $post_obj->setAttachment($attach[0], $attach[1], $attach[2]); |
|
182 | + } |
|
182 | 183 | } |
183 | 184 | } |
184 | - } |
|
185 | - $error_upload = ''; |
|
185 | + $error_upload = ''; |
|
186 | 186 | |
187 | - if (isset($_FILES['userfile']['name']) && $_FILES['userfile']['name'] != '' |
|
188 | - && $topicHandler->getPermission($forum_obj, $topic_status, 'attach') |
|
189 | - ) { |
|
190 | - require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/uploader.php'; |
|
191 | - $maxfilesize = $forum_obj->getVar('attach_maxkb') * 1024; |
|
192 | - $uploaddir = XOOPS_CACHE_PATH; |
|
187 | + if (isset($_FILES['userfile']['name']) && $_FILES['userfile']['name'] != '' |
|
188 | + && $topicHandler->getPermission($forum_obj, $topic_status, 'attach') |
|
189 | + ) { |
|
190 | + require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/uploader.php'; |
|
191 | + $maxfilesize = $forum_obj->getVar('attach_maxkb') * 1024; |
|
192 | + $uploaddir = XOOPS_CACHE_PATH; |
|
193 | 193 | |
194 | - $uploader = new sfUploader($uploaddir, $newAnswerObj->getVar('attach_ext'), (int)$maxfilesize, (int)$xoopsModuleConfig['max_img_width'], (int)$xoopsModuleConfig['max_img_height']); |
|
194 | + $uploader = new sfUploader($uploaddir, $newAnswerObj->getVar('attach_ext'), (int)$maxfilesize, (int)$xoopsModuleConfig['max_img_width'], (int)$xoopsModuleConfig['max_img_height']); |
|
195 | 195 | |
196 | - if ($_FILES['userfile']['error'] > 0) { |
|
197 | - switch ($_FILES['userfile']['error']) { |
|
196 | + if ($_FILES['userfile']['error'] > 0) { |
|
197 | + switch ($_FILES['userfile']['error']) { |
|
198 | 198 | case 1: |
199 | 199 | $error_message[] = _MD_NEWBB_MAXUPLOADFILEINI; |
200 | 200 | break; |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | default: |
205 | 205 | $error_message[] = _MD_NEWBB_UPLOAD_ERRNODEF; |
206 | 206 | break; |
207 | - } |
|
207 | + } |
|
208 | 208 | } else { |
209 | 209 | $uploader->setCheckMediaTypeByExt(); |
210 | 210 | |
@@ -267,30 +267,30 @@ discard block |
||
267 | 267 | redirect_header('index.php', 2, $redirect_msg); |
268 | 268 | break; |
269 | 269 | |
270 | - case 'form': |
|
271 | - default: |
|
270 | + case 'form': |
|
271 | + default: |
|
272 | 272 | |
273 | - global $xoopsUser, $myts; |
|
273 | + global $xoopsUser, $myts; |
|
274 | 274 | |
275 | - $faqObj = $faqHandler->create(); |
|
276 | - $answerObj = $answerHandler->create(); |
|
277 | - $categoryObj = $categoryHandler->create(); |
|
275 | + $faqObj = $faqHandler->create(); |
|
276 | + $answerObj = $answerHandler->create(); |
|
277 | + $categoryObj = $categoryHandler->create(); |
|
278 | 278 | |
279 | - $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.html'; |
|
280 | - include_once XOOPS_ROOT_PATH . '/header.php'; |
|
281 | - include_once __DIR__ . '/footer.php'; |
|
279 | + $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.html'; |
|
280 | + include_once XOOPS_ROOT_PATH . '/header.php'; |
|
281 | + include_once __DIR__ . '/footer.php'; |
|
282 | 282 | |
283 | - $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous'; |
|
284 | - $notifypub = 1; |
|
285 | - $moduleName =& $myts->displayTarea($xoopsModule->getVar('name')); |
|
286 | - $xoopsTpl->assign('whereInSection', $moduleName); |
|
287 | - $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME); |
|
283 | + $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous'; |
|
284 | + $notifypub = 1; |
|
285 | + $moduleName =& $myts->displayTarea($xoopsModule->getVar('name')); |
|
286 | + $xoopsTpl->assign('whereInSection', $moduleName); |
|
287 | + $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME); |
|
288 | 288 | |
289 | - $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name()))); |
|
290 | - $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO); |
|
289 | + $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name()))); |
|
290 | + $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO); |
|
291 | 291 | |
292 | - include_once __DIR__ . '/include/submit.inc.php'; |
|
292 | + include_once __DIR__ . '/include/submit.inc.php'; |
|
293 | 293 | |
294 | - include_once XOOPS_ROOT_PATH . '/footer.php'; |
|
295 | - break; |
|
294 | + include_once XOOPS_ROOT_PATH . '/footer.php'; |
|
295 | + break; |
|
296 | 296 | } |
@@ -6,7 +6,7 @@ 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 $xoopsUser, $xoopsConfig, $xoopsModuleConfig, $xoopsModule; |
12 | 12 | |
@@ -84,12 +84,12 @@ discard block |
||
84 | 84 | global $xoopsUser, $myts; |
85 | 85 | |
86 | 86 | $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.tpl'; |
87 | - include_once XOOPS_ROOT_PATH . '/header.php'; |
|
88 | - include_once __DIR__ . '/footer.php'; |
|
87 | + include_once XOOPS_ROOT_PATH.'/header.php'; |
|
88 | + include_once __DIR__.'/footer.php'; |
|
89 | 89 | |
90 | 90 | $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous'; |
91 | 91 | |
92 | - $moduleName =& $myts->displayTarea($xoopsModule->getVar('name')); |
|
92 | + $moduleName = & $myts->displayTarea($xoopsModule->getVar('name')); |
|
93 | 93 | $faq = $faqObj->toArray(null, $categoryObj, false); |
94 | 94 | $faq['categoryPath'] = $categoryObj->getCategoryPath(true); |
95 | 95 | $faq['answer'] = $answerObj->answer(); |
@@ -102,11 +102,11 @@ discard block |
||
102 | 102 | $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME); |
103 | 103 | |
104 | 104 | $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name()))); |
105 | - $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO); |
|
105 | + $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY."<b>$name</b>, "._MD_SF_SUB_INTRO); |
|
106 | 106 | |
107 | - include_once __DIR__ . '/include/submit.inc.php'; |
|
107 | + include_once __DIR__.'/include/submit.inc.php'; |
|
108 | 108 | |
109 | - include_once XOOPS_ROOT_PATH . '/footer.php'; |
|
109 | + include_once XOOPS_ROOT_PATH.'/footer.php'; |
|
110 | 110 | |
111 | 111 | exit(); |
112 | 112 | break; |
@@ -170,14 +170,14 @@ discard block |
||
170 | 170 | $attachments_tmp = unserialize(base64_decode($_POST['attachments_tmp'])); |
171 | 171 | if (isset($_POST['delete_tmp']) && count($_POST['delete_tmp'])) { |
172 | 172 | foreach ($_POST['delete_tmp'] as $key) { |
173 | - unlink(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attachments_tmp[$key][0]); |
|
173 | + unlink(XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/'.$attachments_tmp[$key][0]); |
|
174 | 174 | unset($attachments_tmp[$key]); |
175 | 175 | } |
176 | 176 | } |
177 | 177 | } |
178 | 178 | if (count($attachments_tmp)) { |
179 | 179 | foreach ($attachments_tmp as $key => $attach) { |
180 | - if (rename(XOOPS_CACHE_PATH . '/' . $attachments_tmp[$key][0], XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attachments_tmp[$key][0])) { |
|
180 | + if (rename(XOOPS_CACHE_PATH.'/'.$attachments_tmp[$key][0], XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/'.$attachments_tmp[$key][0])) { |
|
181 | 181 | $post_obj->setAttachment($attach[0], $attach[1], $attach[2]); |
182 | 182 | } |
183 | 183 | } |
@@ -187,11 +187,11 @@ discard block |
||
187 | 187 | if (isset($_FILES['userfile']['name']) && $_FILES['userfile']['name'] != '' |
188 | 188 | && $topicHandler->getPermission($forum_obj, $topic_status, 'attach') |
189 | 189 | ) { |
190 | - require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/uploader.php'; |
|
190 | + require_once XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname', 'n').'/class/uploader.php'; |
|
191 | 191 | $maxfilesize = $forum_obj->getVar('attach_maxkb') * 1024; |
192 | 192 | $uploaddir = XOOPS_CACHE_PATH; |
193 | 193 | |
194 | - $uploader = new sfUploader($uploaddir, $newAnswerObj->getVar('attach_ext'), (int)$maxfilesize, (int)$xoopsModuleConfig['max_img_width'], (int)$xoopsModuleConfig['max_img_height']); |
|
194 | + $uploader = new sfUploader($uploaddir, $newAnswerObj->getVar('attach_ext'), (int) $maxfilesize, (int) $xoopsModuleConfig['max_img_width'], (int) $xoopsModuleConfig['max_img_height']); |
|
195 | 195 | |
196 | 196 | if ($_FILES['userfile']['error'] > 0) { |
197 | 197 | switch ($_FILES['userfile']['error']) { |
@@ -209,19 +209,19 @@ discard block |
||
209 | 209 | $uploader->setCheckMediaTypeByExt(); |
210 | 210 | |
211 | 211 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { |
212 | - $prefix = is_object($xoopsUser) ? (string)$xoopsUser->uid() . '_' : 'newbb_'; |
|
212 | + $prefix = is_object($xoopsUser) ? (string) $xoopsUser->uid().'_' : 'newbb_'; |
|
213 | 213 | $uploader->setPrefix($prefix); |
214 | 214 | if (!$uploader->upload()) { |
215 | - $error_message[] = $error_upload =& $uploader->getErrors(); |
|
215 | + $error_message[] = $error_upload = & $uploader->getErrors(); |
|
216 | 216 | } else { |
217 | 217 | if (is_file($uploader->getSavedDestination())) { |
218 | - if (rename(XOOPS_CACHE_PATH . '/' . $uploader->getSavedFileName(), XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $uploader->getSavedFileName())) { |
|
218 | + if (rename(XOOPS_CACHE_PATH.'/'.$uploader->getSavedFileName(), XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/'.$uploader->getSavedFileName())) { |
|
219 | 219 | $post_obj->setAttachment($uploader->getSavedFileName(), $uploader->getMediaName(), $uploader->getMediaType()); |
220 | 220 | } |
221 | 221 | } |
222 | 222 | } |
223 | 223 | } else { |
224 | - $error_message[] = $error_upload =& $uploader->getErrors(); |
|
224 | + $error_message[] = $error_upload = & $uploader->getErrors(); |
|
225 | 225 | } |
226 | 226 | } |
227 | 227 | } |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | } else { |
255 | 255 | // Subscribe the user to On Published notification, if requested |
256 | 256 | if ($notifypub == 1) { |
257 | - include_once XOOPS_ROOT_PATH . '/include/notification_constants.php'; |
|
257 | + include_once XOOPS_ROOT_PATH.'/include/notification_constants.php'; |
|
258 | 258 | $notificationHandler = xoops_getHandler('notification'); |
259 | 259 | $notificationHandler->subscribe('faq', $newFaqObj->faqid(), 'approved', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE); |
260 | 260 | } |
@@ -277,20 +277,20 @@ discard block |
||
277 | 277 | $categoryObj = $categoryHandler->create(); |
278 | 278 | |
279 | 279 | $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.html'; |
280 | - include_once XOOPS_ROOT_PATH . '/header.php'; |
|
281 | - include_once __DIR__ . '/footer.php'; |
|
280 | + include_once XOOPS_ROOT_PATH.'/header.php'; |
|
281 | + include_once __DIR__.'/footer.php'; |
|
282 | 282 | |
283 | 283 | $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous'; |
284 | 284 | $notifypub = 1; |
285 | - $moduleName =& $myts->displayTarea($xoopsModule->getVar('name')); |
|
285 | + $moduleName = & $myts->displayTarea($xoopsModule->getVar('name')); |
|
286 | 286 | $xoopsTpl->assign('whereInSection', $moduleName); |
287 | 287 | $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME); |
288 | 288 | |
289 | 289 | $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name()))); |
290 | - $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO); |
|
290 | + $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY."<b>$name</b>, "._MD_SF_SUB_INTRO); |
|
291 | 291 | |
292 | - include_once __DIR__ . '/include/submit.inc.php'; |
|
292 | + include_once __DIR__.'/include/submit.inc.php'; |
|
293 | 293 | |
294 | - include_once XOOPS_ROOT_PATH . '/footer.php'; |
|
294 | + include_once XOOPS_ROOT_PATH.'/footer.php'; |
|
295 | 295 | break; |
296 | 296 | } |
@@ -202,14 +202,14 @@ discard block |
||
202 | 202 | $modfootertxt = 'Module ' . $smartModule->getInfo('name') . ' - Version ' . $smartModule->getInfo('version') . ''; |
203 | 203 | |
204 | 204 | $modfooter = "<a href='" |
205 | - . $smartModule->getInfo('support_site_url') |
|
206 | - . "' target='_blank'><img src='" |
|
207 | - . XOOPS_URL |
|
208 | - . "/modules/smartfaq/assets/images/sfcssbutton.gif' title='" |
|
209 | - . $modfootertxt |
|
210 | - . "' alt='" |
|
211 | - . $modfootertxt |
|
212 | - . "'/></a>"; |
|
205 | + . $smartModule->getInfo('support_site_url') |
|
206 | + . "' target='_blank'><img src='" |
|
207 | + . XOOPS_URL |
|
208 | + . "/modules/smartfaq/assets/images/sfcssbutton.gif' title='" |
|
209 | + . $modfootertxt |
|
210 | + . "' alt='" |
|
211 | + . $modfootertxt |
|
212 | + . "'/></a>"; |
|
213 | 213 | |
214 | 214 | return $modfooter; |
215 | 215 | } |
@@ -444,70 +444,70 @@ discard block |
||
444 | 444 | if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->getVar('mid'))) { |
445 | 445 | // Edit button |
446 | 446 | $adminLinks .= "<a href='" |
447 | - . $modulePath |
|
448 | - . "admin/$page?op=mod&faqid=" |
|
449 | - . $faqid |
|
450 | - . "'><img src='" |
|
451 | - . $modulePath |
|
452 | - . "assets/images/links/edit.gif'" |
|
453 | - . " title='" |
|
454 | - . _MD_SF_EDIT |
|
455 | - . "' alt='" |
|
456 | - . _MD_SF_EDIT |
|
457 | - . "'/></a>"; |
|
447 | + . $modulePath |
|
448 | + . "admin/$page?op=mod&faqid=" |
|
449 | + . $faqid |
|
450 | + . "'><img src='" |
|
451 | + . $modulePath |
|
452 | + . "assets/images/links/edit.gif'" |
|
453 | + . " title='" |
|
454 | + . _MD_SF_EDIT |
|
455 | + . "' alt='" |
|
456 | + . _MD_SF_EDIT |
|
457 | + . "'/></a>"; |
|
458 | 458 | $adminLinks .= ' '; |
459 | 459 | // Delete button |
460 | 460 | $adminLinks .= "<a href='" |
461 | - . $modulePath |
|
462 | - . "admin/$page?op=del&faqid=" |
|
463 | - . $faqid |
|
464 | - . "'><img src='" |
|
465 | - . $modulePath |
|
466 | - . "assets/images/links/delete.gif'" |
|
467 | - . " title='" |
|
468 | - . _MD_SF_DELETE |
|
469 | - . "' alt='" |
|
470 | - . _MD_SF_DELETE |
|
471 | - . "'/></a>"; |
|
461 | + . $modulePath |
|
462 | + . "admin/$page?op=del&faqid=" |
|
463 | + . $faqid |
|
464 | + . "'><img src='" |
|
465 | + . $modulePath |
|
466 | + . "assets/images/links/delete.gif'" |
|
467 | + . " title='" |
|
468 | + . _MD_SF_DELETE |
|
469 | + . "' alt='" |
|
470 | + . _MD_SF_DELETE |
|
471 | + . "'/></a>"; |
|
472 | 472 | $adminLinks .= ' '; |
473 | 473 | } |
474 | 474 | // Print button |
475 | 475 | $adminLinks .= "<a href='" |
476 | - . $modulePath |
|
477 | - . 'print.php?faqid=' |
|
478 | - . $faqid |
|
479 | - . "'><img src='" |
|
480 | - . $modulePath |
|
481 | - . "assets/images/links/print.gif' title='" |
|
482 | - . _MD_SF_PRINT |
|
483 | - . "' alt='" |
|
484 | - . _MD_SF_PRINT |
|
485 | - . "'/></a>"; |
|
476 | + . $modulePath |
|
477 | + . 'print.php?faqid=' |
|
478 | + . $faqid |
|
479 | + . "'><img src='" |
|
480 | + . $modulePath |
|
481 | + . "assets/images/links/print.gif' title='" |
|
482 | + . _MD_SF_PRINT |
|
483 | + . "' alt='" |
|
484 | + . _MD_SF_PRINT |
|
485 | + . "'/></a>"; |
|
486 | 486 | $adminLinks .= ' '; |
487 | 487 | // Email button |
488 | 488 | $maillink = 'mailto:?subject=' |
489 | - . sprintf(_MD_SF_INTARTICLE, $xoopsConfig['sitename']) |
|
490 | - . '&body=' |
|
491 | - . sprintf(_MD_SF_INTARTFOUND, $xoopsConfig['sitename']) |
|
492 | - . ': ' |
|
493 | - . $modulePath |
|
494 | - . 'faq.php?faqid=' |
|
495 | - . $faqid; |
|
489 | + . sprintf(_MD_SF_INTARTICLE, $xoopsConfig['sitename']) |
|
490 | + . '&body=' |
|
491 | + . sprintf(_MD_SF_INTARTFOUND, $xoopsConfig['sitename']) |
|
492 | + . ': ' |
|
493 | + . $modulePath |
|
494 | + . 'faq.php?faqid=' |
|
495 | + . $faqid; |
|
496 | 496 | $adminLinks .= '<a href="' . $maillink . "\"><img src='" . $modulePath . "assets/images/links/friend.gif' title='" . _MD_SF_MAIL . "' alt='" . _MD_SF_MAIL . "'/></a>"; |
497 | 497 | $adminLinks .= ' '; |
498 | 498 | // Submit New Answer button |
499 | 499 | if ($xoopsModuleConfig['allownewanswer'] && (is_object($xoopsUser) || $xoopsModuleConfig['anonpost'])) { |
500 | 500 | $adminLinks .= "<a href='" |
501 | - . $modulePath |
|
502 | - . 'answer.php?faqid=' |
|
503 | - . $faqid |
|
504 | - . "'><img src='" |
|
505 | - . $modulePath |
|
506 | - . "assets/images/links/newanswer.gif' title='" |
|
507 | - . _MD_SF_SUBMITANSWER |
|
508 | - . "' alt='" |
|
509 | - . _MD_SF_SUBMITANSWER |
|
510 | - . "'/></a>"; |
|
501 | + . $modulePath |
|
502 | + . 'answer.php?faqid=' |
|
503 | + . $faqid |
|
504 | + . "'><img src='" |
|
505 | + . $modulePath |
|
506 | + . "assets/images/links/newanswer.gif' title='" |
|
507 | + . _MD_SF_SUBMITANSWER |
|
508 | + . "' alt='" |
|
509 | + . _MD_SF_SUBMITANSWER |
|
510 | + . "'/></a>"; |
|
511 | 511 | $adminLinks .= ' '; |
512 | 512 | } |
513 | 513 |
@@ -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'; |
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,7 +199,7 @@ 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 | 204 | $modfooter = "<a href='" |
205 | 205 | . $smartModule->getInfo('support_site_url') |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | |
306 | 306 | $gpermHandler = xoops_getHandler('groupperm'); |
307 | 307 | |
308 | - $sql = 'SELECT faqid FROM ' . $xoopsDB->prefix('smartfaq_faq') . " WHERE categoryid = '$categoryid' "; |
|
308 | + $sql = 'SELECT faqid FROM '.$xoopsDB->prefix('smartfaq_faq')." WHERE categoryid = '$categoryid' "; |
|
309 | 309 | $result = $xoopsDB->query($sql); |
310 | 310 | |
311 | 311 | if (count($result) > 0) { |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | $ret = array(); |
421 | 421 | global $xoopsDB; |
422 | 422 | |
423 | - $result = $xoopsDB->query('SELECT * FROM ' . $xoopsDB->prefix('smartfaq_faq') . " WHERE faqid = '$faqid'"); |
|
423 | + $result = $xoopsDB->query('SELECT * FROM '.$xoopsDB->prefix('smartfaq_faq')." WHERE faqid = '$faqid'"); |
|
424 | 424 | $ret = $xoopsDB->fetcharray($result); |
425 | 425 | |
426 | 426 | return $ret; |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | { |
440 | 440 | global $xoopsUser, $xoopsModule, $xoopsModuleConfig, $xoopsConfig; |
441 | 441 | $adminLinks = ''; |
442 | - $modulePath = XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/'; |
|
442 | + $modulePath = XOOPS_URL.'/modules/'.$xoopsModule->dirname().'/'; |
|
443 | 443 | $page = $open ? 'question.php' : 'faq.php'; |
444 | 444 | if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->getVar('mid'))) { |
445 | 445 | // Edit button |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | . "'/></a>"; |
486 | 486 | $adminLinks .= ' '; |
487 | 487 | // Email button |
488 | - $maillink = 'mailto:?subject=' |
|
488 | + $maillink = 'mailto:?subject=' |
|
489 | 489 | . sprintf(_MD_SF_INTARTICLE, $xoopsConfig['sitename']) |
490 | 490 | . '&body=' |
491 | 491 | . sprintf(_MD_SF_INTARTFOUND, $xoopsConfig['sitename']) |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | . $modulePath |
494 | 494 | . 'faq.php?faqid=' |
495 | 495 | . $faqid; |
496 | - $adminLinks .= '<a href="' . $maillink . "\"><img src='" . $modulePath . "assets/images/links/friend.gif' title='" . _MD_SF_MAIL . "' alt='" . _MD_SF_MAIL . "'/></a>"; |
|
496 | + $adminLinks .= '<a href="'.$maillink."\"><img src='".$modulePath."assets/images/links/friend.gif' title='"._MD_SF_MAIL."' alt='"._MD_SF_MAIL."'/></a>"; |
|
497 | 497 | $adminLinks .= ' '; |
498 | 498 | // Submit New Answer button |
499 | 499 | if ($xoopsModuleConfig['allownewanswer'] && (is_object($xoopsUser) || $xoopsModuleConfig['anonpost'])) { |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | return $userid; |
529 | 529 | } |
530 | 530 | |
531 | - $userid = (int)$userid; |
|
531 | + $userid = (int) $userid; |
|
532 | 532 | if ($userid > 0) { |
533 | 533 | if ($users == array()) { |
534 | 534 | //fetching users |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | if (!isset($users[$userid])) { |
539 | 539 | return $GLOBALS['xoopsConfig']['anonymous']; |
540 | 540 | } |
541 | - $user =& $users[$userid]; |
|
541 | + $user = & $users[$userid]; |
|
542 | 542 | } |
543 | 543 | |
544 | 544 | if (is_object($user)) { |
@@ -552,9 +552,9 @@ discard block |
||
552 | 552 | $fullname = $user->getVar('name'); |
553 | 553 | } |
554 | 554 | if (!empty($fullname)) { |
555 | - $linkeduser = "$fullname [<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . $ts->htmlSpecialChars($username) . '</a>]'; |
|
555 | + $linkeduser = "$fullname [<a href='".XOOPS_URL.'/userinfo.php?uid='.$userid."'>".$ts->htmlSpecialChars($username).'</a>]'; |
|
556 | 556 | } else { |
557 | - $linkeduser = "<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . ucwords($ts->htmlSpecialChars($username)) . '</a>'; |
|
557 | + $linkeduser = "<a href='".XOOPS_URL.'/userinfo.php?uid='.$userid."'>".ucwords($ts->htmlSpecialChars($username)).'</a>'; |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | return $linkeduser; |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | //--> |
636 | 636 | </script> |
637 | 637 | <?php |
638 | - echo "<h3 style=\"color: #2F5376; margin: 6px 0 0 0; \"><a href='#' onClick=\"toggle('" . $tablename . "'); toggleIcon('" . $iconname . "');\">"; |
|
638 | + echo "<h3 style=\"color: #2F5376; margin: 6px 0 0 0; \"><a href='#' onClick=\"toggle('".$tablename."'); toggleIcon('".$iconname."');\">"; |
|
639 | 639 | } |
640 | 640 | |
641 | 641 | /** |
@@ -648,16 +648,16 @@ discard block |
||
648 | 648 | static $handlers; |
649 | 649 | $name = strtolower(trim($name)); |
650 | 650 | if (!isset($handlers[$name])) { |
651 | - if (file_exists($hnd_file = XOOPS_ROOT_PATH . '/modules/smartfaq/class/' . $name . '.php')) { |
|
651 | + if (file_exists($hnd_file = XOOPS_ROOT_PATH.'/modules/smartfaq/class/'.$name.'.php')) { |
|
652 | 652 | require_once $hnd_file; |
653 | 653 | } |
654 | - $class = 'sf' . ucfirst($name) . 'Handler'; |
|
654 | + $class = 'sf'.ucfirst($name).'Handler'; |
|
655 | 655 | if (class_exists($class)) { |
656 | 656 | $handlers[$name] = new $class($GLOBALS['xoopsDB']); |
657 | 657 | } |
658 | 658 | } |
659 | 659 | if (!$optional && !isset($handlers[$name])) { |
660 | - trigger_error('Class <b>' . $class . '</b> does not exist<br>Handler Name: ' . $name, E_USER_ERROR); |
|
660 | + trigger_error('Class <b>'.$class.'</b> does not exist<br>Handler Name: '.$name, E_USER_ERROR); |
|
661 | 661 | } |
662 | 662 | $false = false; |
663 | 663 |
@@ -71,18 +71,18 @@ |
||
71 | 71 | $myblock->setVar('title', $myts->stripSlashesGPC($btitle)); |
72 | 72 | $myblock->setVar('content', $myts->stripSlashesGPC($bcontent)); |
73 | 73 | $dummyhtml = '<html><head><meta http-equiv="content-type" content="text/html; charset=' |
74 | - . _CHARSET |
|
75 | - . '" /><meta http-equiv="content-language" content="' |
|
76 | - . _LANGCODE |
|
77 | - . '" /><title>' |
|
78 | - . $xoopsConfig['sitename'] |
|
79 | - . '</title><link rel="stylesheet" type="text/css" media="all" href="' |
|
80 | - . getcss($xoopsConfig['theme_set']) |
|
81 | - . '" /></head><body><table><tr><th>' |
|
82 | - . $myblock->getVar('title') |
|
83 | - . '</th></tr><tr><td>' |
|
84 | - . $myblock->getContent('S', $bctype) |
|
85 | - . '</td></tr></table></body></html>'; |
|
74 | + . _CHARSET |
|
75 | + . '" /><meta http-equiv="content-language" content="' |
|
76 | + . _LANGCODE |
|
77 | + . '" /><title>' |
|
78 | + . $xoopsConfig['sitename'] |
|
79 | + . '</title><link rel="stylesheet" type="text/css" media="all" href="' |
|
80 | + . getcss($xoopsConfig['theme_set']) |
|
81 | + . '" /></head><body><table><tr><th>' |
|
82 | + . $myblock->getVar('title') |
|
83 | + . '</th></tr><tr><td>' |
|
84 | + . $myblock->getContent('S', $bctype) |
|
85 | + . '</td></tr></table></body></html>'; |
|
86 | 86 | |
87 | 87 | $dummyfile = '_dummyfile_' . time() . '.html'; |
88 | 88 | $fp = fopen(XOOPS_CACHE_PATH . '/' . $dummyfile, 'w'); |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | if (!is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid())) { |
29 | 29 | exit('Access Denied'); |
30 | 30 | } |
31 | -include_once XOOPS_ROOT_PATH . '/class/xoopsblock.php'; |
|
32 | -include XOOPS_ROOT_PATH . '/modules/system/admin/blocksadmin/blocksadmin.php'; |
|
31 | +include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php'; |
|
32 | +include XOOPS_ROOT_PATH.'/modules/system/admin/blocksadmin/blocksadmin.php'; |
|
33 | 33 | |
34 | 34 | $op = 'list'; |
35 | 35 | if (isset($HTTP_POST_VARS)) { |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | || $HTTP_GET_VARS['op'] === 'previewpopup' |
45 | 45 | ) { |
46 | 46 | $op = $HTTP_GET_VARS['op']; |
47 | - $bid = isset($HTTP_GET_VARS['bid']) ? (int)$HTTP_GET_VARS['bid'] : 0; |
|
47 | + $bid = isset($HTTP_GET_VARS['bid']) ? (int) $HTTP_GET_VARS['bid'] : 0; |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
51 | 51 | if (isset($previewblock)) { |
52 | 52 | xoops_cp_header(); |
53 | - include_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
53 | + include_once XOOPS_ROOT_PATH.'/class/template.php'; |
|
54 | 54 | $xoopsTpl = new XoopsTpl(); |
55 | 55 | $xoopsTpl->xoops_setCaching(0); |
56 | 56 | if (isset($bid)) { |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | . $myblock->getContent('S', $bctype) |
85 | 85 | . '</td></tr></table></body></html>'; |
86 | 86 | |
87 | - $dummyfile = '_dummyfile_' . time() . '.html'; |
|
88 | - $fp = fopen(XOOPS_CACHE_PATH . '/' . $dummyfile, 'w'); |
|
87 | + $dummyfile = '_dummyfile_'.time().'.html'; |
|
88 | + $fp = fopen(XOOPS_CACHE_PATH.'/'.$dummyfile, 'w'); |
|
89 | 89 | fwrite($fp, $dummyhtml); |
90 | 90 | fclose($fp); |
91 | 91 | $block['edit_form'] = false; |
@@ -96,24 +96,24 @@ discard block |
||
96 | 96 | $block['visible'] = $bvisible; |
97 | 97 | $block['title'] = $myblock->getVar('title', 'E'); |
98 | 98 | $block['content'] = $myblock->getVar('content', 'E'); |
99 | - $block['modules'] =& $bmodule; |
|
99 | + $block['modules'] = & $bmodule; |
|
100 | 100 | $block['ctype'] = isset($bctype) ? $bctype : $myblock->getVar('c_type'); |
101 | 101 | $block['is_custom'] = true; |
102 | - $block['cachetime'] = (int)$bcachetime; |
|
103 | - echo '<a href="admin.php?fct=blocksadmin">' . _AM_BADMIN . '</a> <span style="font-weight:bold;">»»</span> ' . $block['form_title'] . '<br><br>'; |
|
104 | - include XOOPS_ROOT_PATH . '/modules/system/admin/blocksadmin/blockform.php'; |
|
102 | + $block['cachetime'] = (int) $bcachetime; |
|
103 | + echo '<a href="admin.php?fct=blocksadmin">'._AM_BADMIN.'</a> <span style="font-weight:bold;">»»</span> '.$block['form_title'].'<br><br>'; |
|
104 | + include XOOPS_ROOT_PATH.'/modules/system/admin/blocksadmin/blockform.php'; |
|
105 | 105 | $form->display(); |
106 | 106 | xoops_cp_footer(); |
107 | 107 | echo '<script type="text/javascript"> |
108 | 108 | <!--// |
109 | - preview_window = openWithSelfMain("' . XOOPS_URL . '/modules/system/admin.php?fct=blocksadmin&op=previewpopup&file=' . $dummyfile . '", "popup", 250, 200); |
|
109 | + preview_window = openWithSelfMain("' . XOOPS_URL.'/modules/system/admin.php?fct=blocksadmin&op=previewpopup&file='.$dummyfile.'", "popup", 250, 200); |
|
110 | 110 | //--> |
111 | 111 | </script>'; |
112 | 112 | exit(); |
113 | 113 | } |
114 | 114 | |
115 | 115 | if ($op === 'previewpopup') { |
116 | - $file = str_replace('..', '', XOOPS_CACHE_PATH . '/' . trim($HTTP_GET_VARS['file'])); |
|
116 | + $file = str_replace('..', '', XOOPS_CACHE_PATH.'/'.trim($HTTP_GET_VARS['file'])); |
|
117 | 117 | if (file_exists($file)) { |
118 | 118 | include $file; |
119 | 119 | @unlink($file); |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | } |
152 | 152 | |
153 | 153 | if ($op === 'update') { |
154 | - $bcachetime = isset($bcachetime) ? (int)$bcachetime : 0; |
|
154 | + $bcachetime = isset($bcachetime) ? (int) $bcachetime : 0; |
|
155 | 155 | $options = isset($options) ? $options : array(); |
156 | 156 | $bcontent = isset($bcontent) ? $bcontent : ''; |
157 | 157 | $bctype = isset($bctype) ? $bctype : ''; |
@@ -252,27 +252,27 @@ discard block |
||
252 | 252 | $sql = sprintf('DELETE FROM %s WHERE block_id = %u', $db->prefix('block_module_link'), $bid); |
253 | 253 | $db->query($sql); |
254 | 254 | foreach ($bmodule as $bmid) { |
255 | - $sql = sprintf('INSERT INTO %s (block_id, module_id) VALUES (%u, %d)', $db->prefix('block_module_link'), $bid, (int)$bmid); |
|
255 | + $sql = sprintf('INSERT INTO %s (block_id, module_id) VALUES (%u, %d)', $db->prefix('block_module_link'), $bid, (int) $bmid); |
|
256 | 256 | $db->query($sql); |
257 | 257 | } |
258 | - include_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
258 | + include_once XOOPS_ROOT_PATH.'/class/template.php'; |
|
259 | 259 | $xoopsTpl = new XoopsTpl(); |
260 | 260 | $xoopsTpl->xoops_setCaching(2); |
261 | 261 | if ($myblock->getVar('template') != '') { |
262 | - if ($xoopsTpl->is_cached('db:' . $myblock->getVar('template'))) { |
|
263 | - if (!$xoopsTpl->clear_cache('db:' . $myblock->getVar('template'))) { |
|
264 | - $msg = 'Unable to clear cache for block ID' . $bid; |
|
262 | + if ($xoopsTpl->is_cached('db:'.$myblock->getVar('template'))) { |
|
263 | + if (!$xoopsTpl->clear_cache('db:'.$myblock->getVar('template'))) { |
|
264 | + $msg = 'Unable to clear cache for block ID'.$bid; |
|
265 | 265 | } |
266 | 266 | } |
267 | 267 | } else { |
268 | - if ($xoopsTpl->is_cached('db:system_dummy.tpl', 'block' . $bid)) { |
|
269 | - if (!$xoopsTpl->clear_cache('db:system_dummy.tpl', 'block' . $bid)) { |
|
270 | - $msg = 'Unable to clear cache for block ID' . $bid; |
|
268 | + if ($xoopsTpl->is_cached('db:system_dummy.tpl', 'block'.$bid)) { |
|
269 | + if (!$xoopsTpl->clear_cache('db:system_dummy.tpl', 'block'.$bid)) { |
|
270 | + $msg = 'Unable to clear cache for block ID'.$bid; |
|
271 | 271 | } |
272 | 272 | } |
273 | 273 | } |
274 | 274 | } else { |
275 | - $msg = 'Failed update of block. ID:' . $bid; |
|
275 | + $msg = 'Failed update of block. ID:'.$bid; |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | return $msg; // GIJ + |