@@ -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 | } |
@@ -45,94 +45,94 @@ |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | switch ($op) { |
48 | - case 'post': |
|
48 | + case 'post': |
|
49 | 49 | |
50 | - global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsDB; |
|
50 | + global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsDB; |
|
51 | 51 | |
52 | - $newFaqObj = $faqHandler->create(); |
|
52 | + $newFaqObj = $faqHandler->create(); |
|
53 | 53 | |
54 | - if (!$xoopsUser) { |
|
55 | - if ($xoopsModuleConfig['anonpost'] == 1) { |
|
56 | - $uid = 0; |
|
54 | + if (!$xoopsUser) { |
|
55 | + if ($xoopsModuleConfig['anonpost'] == 1) { |
|
56 | + $uid = 0; |
|
57 | + } else { |
|
58 | + redirect_header('index.php', 3, _NOPERM); |
|
59 | + } |
|
57 | 60 | } else { |
58 | - redirect_header('index.php', 3, _NOPERM); |
|
61 | + $uid = $xoopsUser->uid(); |
|
59 | 62 | } |
60 | - } else { |
|
61 | - $uid = $xoopsUser->uid(); |
|
62 | - } |
|
63 | - |
|
64 | - // Putting the values about the FAQ in the FAQ object |
|
65 | - $newFaqObj->setVar('categoryid', $_POST['categoryid']); |
|
66 | - $newFaqObj->setVar('uid', $uid); |
|
67 | - $newFaqObj->setVar('question', $_POST['question']); |
|
68 | - $notifypub = isset($_POST['notifypub']) ? $_POST['notifypub'] : 0; |
|
69 | - $newFaqObj->setVar('notifypub', $notifypub); |
|
70 | - |
|
71 | - // Setting the status of the FAQ |
|
72 | - if ($xoopsModuleConfig['autoapprove_request'] == 1) { |
|
73 | - $newFaqObj->setVar('status', _SF_STATUS_OPENED); |
|
74 | - } else { |
|
75 | - $newFaqObj->setVar('status', _SF_STATUS_ASKED); |
|
76 | - } |
|
77 | - |
|
78 | - // Storing the FAQ object in the database |
|
79 | - if (!$newFaqObj->store()) { |
|
80 | - redirect_header('javascript:history.go(-1)', 3, _MD_SF_REQUEST_ERROR . sf_formatErrors($newFaqObj->getErrors())); |
|
81 | - } |
|
82 | - |
|
83 | - // Get the cateopry object related to that FAQ |
|
84 | - // If autoapprove_requested |
|
85 | - if ($xoopsModuleConfig['autoapprove_request'] == 1) { |
|
86 | - // We do not not subscribe user to notification on publish since we publish it right away |
|
87 | - |
|
88 | - // Send notifications |
|
89 | - $newFaqObj->sendNotifications(array(_SF_NOT_QUESTION_PUBLISHED)); |
|
90 | - |
|
91 | - $redirect_msg = _MD_SF_REQUEST_RECEIVED_AND_PUBLISHED; |
|
92 | - } else { |
|
93 | - // Subscribe the user to On Published notification, if requested |
|
94 | - if ($notifypub == 1) { |
|
95 | - include_once XOOPS_ROOT_PATH . '/include/notification_constants.php'; |
|
96 | - $notificationHandler = xoops_getHandler('notification'); |
|
97 | - $notificationHandler->subscribe('question', $newFaqObj->faqid(), 'approved', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE); |
|
63 | + |
|
64 | + // Putting the values about the FAQ in the FAQ object |
|
65 | + $newFaqObj->setVar('categoryid', $_POST['categoryid']); |
|
66 | + $newFaqObj->setVar('uid', $uid); |
|
67 | + $newFaqObj->setVar('question', $_POST['question']); |
|
68 | + $notifypub = isset($_POST['notifypub']) ? $_POST['notifypub'] : 0; |
|
69 | + $newFaqObj->setVar('notifypub', $notifypub); |
|
70 | + |
|
71 | + // Setting the status of the FAQ |
|
72 | + if ($xoopsModuleConfig['autoapprove_request'] == 1) { |
|
73 | + $newFaqObj->setVar('status', _SF_STATUS_OPENED); |
|
74 | + } else { |
|
75 | + $newFaqObj->setVar('status', _SF_STATUS_ASKED); |
|
76 | + } |
|
77 | + |
|
78 | + // Storing the FAQ object in the database |
|
79 | + if (!$newFaqObj->store()) { |
|
80 | + redirect_header('javascript:history.go(-1)', 3, _MD_SF_REQUEST_ERROR . sf_formatErrors($newFaqObj->getErrors())); |
|
98 | 81 | } |
99 | - // Send notifications |
|
100 | - $newFaqObj->sendNotifications(array(_SF_NOT_QUESTION_SUBMITTED)); |
|
101 | 82 | |
102 | - $redirect_msg = _MD_SF_REQUEST_RECEIVED_NEED_APPROVAL; |
|
103 | - } |
|
83 | + // Get the cateopry object related to that FAQ |
|
84 | + // If autoapprove_requested |
|
85 | + if ($xoopsModuleConfig['autoapprove_request'] == 1) { |
|
86 | + // We do not not subscribe user to notification on publish since we publish it right away |
|
87 | + |
|
88 | + // Send notifications |
|
89 | + $newFaqObj->sendNotifications(array(_SF_NOT_QUESTION_PUBLISHED)); |
|
90 | + |
|
91 | + $redirect_msg = _MD_SF_REQUEST_RECEIVED_AND_PUBLISHED; |
|
92 | + } else { |
|
93 | + // Subscribe the user to On Published notification, if requested |
|
94 | + if ($notifypub == 1) { |
|
95 | + include_once XOOPS_ROOT_PATH . '/include/notification_constants.php'; |
|
96 | + $notificationHandler = xoops_getHandler('notification'); |
|
97 | + $notificationHandler->subscribe('question', $newFaqObj->faqid(), 'approved', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE); |
|
98 | + } |
|
99 | + // Send notifications |
|
100 | + $newFaqObj->sendNotifications(array(_SF_NOT_QUESTION_SUBMITTED)); |
|
101 | + |
|
102 | + $redirect_msg = _MD_SF_REQUEST_RECEIVED_NEED_APPROVAL; |
|
103 | + } |
|
104 | 104 | |
105 | - //redirect_header("javascript:history.go(-2)", 3, $redirect_msg); |
|
106 | - redirect_header('index.php', 2, $redirect_msg); |
|
107 | - break; |
|
105 | + //redirect_header("javascript:history.go(-2)", 3, $redirect_msg); |
|
106 | + redirect_header('index.php', 2, $redirect_msg); |
|
107 | + break; |
|
108 | 108 | |
109 | - case 'form': |
|
110 | - default: |
|
109 | + case 'form': |
|
110 | + default: |
|
111 | 111 | |
112 | - global $xoopsUser, $myts; |
|
112 | + global $xoopsUser, $myts; |
|
113 | 113 | |
114 | - $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.tpl'; |
|
115 | - include_once XOOPS_ROOT_PATH . '/header.php'; |
|
116 | - include_once __DIR__ . '/footer.php'; |
|
114 | + $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.tpl'; |
|
115 | + include_once XOOPS_ROOT_PATH . '/header.php'; |
|
116 | + include_once __DIR__ . '/footer.php'; |
|
117 | 117 | |
118 | - $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous'; |
|
118 | + $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous'; |
|
119 | 119 | |
120 | - $moduleName =& $myts->displayTarea($xoopsModule->getVar('name')); |
|
121 | - $xoopsTpl->assign('whereInSection', $moduleName); |
|
122 | - $xoopsTpl->assign('lang_submit', _MD_SF_REQUEST); |
|
120 | + $moduleName =& $myts->displayTarea($xoopsModule->getVar('name')); |
|
121 | + $xoopsTpl->assign('whereInSection', $moduleName); |
|
122 | + $xoopsTpl->assign('lang_submit', _MD_SF_REQUEST); |
|
123 | 123 | |
124 | - $xoopsTpl->assign('lang_intro_title', _MD_SF_REQUEST); |
|
125 | - $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . $myts->displayTarea($xoopsModuleConfig['requestintromsg'])); |
|
124 | + $xoopsTpl->assign('lang_intro_title', _MD_SF_REQUEST); |
|
125 | + $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . $myts->displayTarea($xoopsModuleConfig['requestintromsg'])); |
|
126 | 126 | |
127 | - include_once __DIR__ . '/include/request.inc.php'; |
|
127 | + include_once __DIR__ . '/include/request.inc.php'; |
|
128 | 128 | |
129 | - $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous'; |
|
129 | + $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous'; |
|
130 | 130 | |
131 | - $sectionname = $myts->htmlSpecialChars($xoopsModule->getVar('name')); |
|
131 | + $sectionname = $myts->htmlSpecialChars($xoopsModule->getVar('name')); |
|
132 | 132 | |
133 | - include_once __DIR__ . '/include/request.inc.php'; |
|
133 | + include_once __DIR__ . '/include/request.inc.php'; |
|
134 | 134 | |
135 | - include_once XOOPS_ROOT_PATH . '/footer.php'; |
|
135 | + include_once XOOPS_ROOT_PATH . '/footer.php'; |
|
136 | 136 | |
137 | - break; |
|
137 | + break; |
|
138 | 138 | } |
@@ -245,149 +245,149 @@ |
||
245 | 245 | } |
246 | 246 | |
247 | 247 | switch ($op) { |
248 | - case 'mod': |
|
249 | - $categoryid = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : 0; |
|
250 | - $destList = isset($_POST['destList']) ? $_POST['destList'] : ''; |
|
251 | - $adminObject = \Xmf\Module\Admin::getInstance(); |
|
252 | - xoops_cp_header(); |
|
248 | + case 'mod': |
|
249 | + $categoryid = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : 0; |
|
250 | + $destList = isset($_POST['destList']) ? $_POST['destList'] : ''; |
|
251 | + $adminObject = \Xmf\Module\Admin::getInstance(); |
|
252 | + xoops_cp_header(); |
|
253 | 253 | |
254 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
255 | - editcat(true, $categoryid); |
|
256 | - break; |
|
254 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
255 | + editcat(true, $categoryid); |
|
256 | + break; |
|
257 | 257 | |
258 | - case 'addcategory': |
|
259 | - global $_POST, $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $xoopsModule, $xoopsModuleConfig, $modify, $myts, $categoryid; |
|
258 | + case 'addcategory': |
|
259 | + global $_POST, $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $xoopsModule, $xoopsModuleConfig, $modify, $myts, $categoryid; |
|
260 | 260 | |
261 | - $categoryid = isset($_POST['categoryid']) ? (int)$_POST['categoryid'] : 0; |
|
261 | + $categoryid = isset($_POST['categoryid']) ? (int)$_POST['categoryid'] : 0; |
|
262 | 262 | |
263 | - if ($categoryid != 0) { |
|
264 | - $categoryObj = new sfCategory($categoryid); |
|
265 | - } else { |
|
266 | - $categoryObj = $categoryHandler->create(); |
|
267 | - } |
|
263 | + if ($categoryid != 0) { |
|
264 | + $categoryObj = new sfCategory($categoryid); |
|
265 | + } else { |
|
266 | + $categoryObj = $categoryHandler->create(); |
|
267 | + } |
|
268 | 268 | |
269 | - //if (isset($_POST['allmods'])) $allmods = $_POST['allmods']; |
|
270 | - //if (isset($_POST['moderators'])) $moderators = $_POST['moderators']; |
|
269 | + //if (isset($_POST['allmods'])) $allmods = $_POST['allmods']; |
|
270 | + //if (isset($_POST['moderators'])) $moderators = $_POST['moderators']; |
|
271 | 271 | |
272 | - $categoryObj->setVar('parentid', isset($_POST['parentid']) ? (int)$_POST['parentid'] : 0); |
|
273 | - $applyall = isset($_POST['applyall']) ? (int)$_POST['applyall'] : 0; |
|
274 | - $categoryObj->setVar('weight', isset($_POST['weight']) ? (int)$_POST['weight'] : 1); |
|
272 | + $categoryObj->setVar('parentid', isset($_POST['parentid']) ? (int)$_POST['parentid'] : 0); |
|
273 | + $applyall = isset($_POST['applyall']) ? (int)$_POST['applyall'] : 0; |
|
274 | + $categoryObj->setVar('weight', isset($_POST['weight']) ? (int)$_POST['weight'] : 1); |
|
275 | 275 | |
276 | - // Groups and permissions |
|
277 | - if (isset($_POST['groups_read'])) { |
|
278 | - $categoryObj->setGroups_read($_POST['groups_read']); |
|
279 | - } else { |
|
280 | - $categoryObj->setGroups_read(); |
|
281 | - } |
|
282 | - // $groups_admin = isset($_POST['groups_admin'])? $_POST['groups_admin'] : array(); |
|
283 | - // $mod_perms = isset($_POST['mod_perms'])? $_POST['mod_perms'] : array(); |
|
284 | - |
|
285 | - $categoryObj->setVar('name', $_POST['name']); |
|
286 | - |
|
287 | - $categoryObj->setVar('description', $_POST['description']); |
|
288 | - if ($categoryObj->isNew()) { |
|
289 | - $redirect_msg = _AM_SF_CATCREATED; |
|
290 | - $redirect_to = 'category.php?op=mod'; |
|
291 | - } else { |
|
292 | - $redirect_msg = _AM_SF_COLMODIFIED; |
|
293 | - $redirect_to = 'category.php'; |
|
294 | - } |
|
295 | - |
|
296 | - if (!$categoryObj->store()) { |
|
297 | - redirect_header('javascript:history.go(-1)', 3, _AM_SF_CATEGORY_SAVE_ERROR . sf_formatErrors($categoryObj->getErrors())); |
|
298 | - } |
|
299 | - // TODO : put this function in the category class |
|
300 | - sf_saveCategory_Permissions($categoryObj->getGroups_read(), $categoryObj->categoryid(), 'category_read'); |
|
301 | - //sf_saveCategory_Permissions($groups_admin, $categoriesObj->categoryid(), 'category_admin'); |
|
276 | + // Groups and permissions |
|
277 | + if (isset($_POST['groups_read'])) { |
|
278 | + $categoryObj->setGroups_read($_POST['groups_read']); |
|
279 | + } else { |
|
280 | + $categoryObj->setGroups_read(); |
|
281 | + } |
|
282 | + // $groups_admin = isset($_POST['groups_admin'])? $_POST['groups_admin'] : array(); |
|
283 | + // $mod_perms = isset($_POST['mod_perms'])? $_POST['mod_perms'] : array(); |
|
284 | + |
|
285 | + $categoryObj->setVar('name', $_POST['name']); |
|
286 | + |
|
287 | + $categoryObj->setVar('description', $_POST['description']); |
|
288 | + if ($categoryObj->isNew()) { |
|
289 | + $redirect_msg = _AM_SF_CATCREATED; |
|
290 | + $redirect_to = 'category.php?op=mod'; |
|
291 | + } else { |
|
292 | + $redirect_msg = _AM_SF_COLMODIFIED; |
|
293 | + $redirect_to = 'category.php'; |
|
294 | + } |
|
302 | 295 | |
303 | - if ($applyall) { |
|
296 | + if (!$categoryObj->store()) { |
|
297 | + redirect_header('javascript:history.go(-1)', 3, _AM_SF_CATEGORY_SAVE_ERROR . sf_formatErrors($categoryObj->getErrors())); |
|
298 | + } |
|
304 | 299 | // TODO : put this function in the category class |
305 | - sf_overrideFaqsPermissions($categoryObj->getGroups_read(), $categoryObj->categoryid()); |
|
306 | - } |
|
300 | + sf_saveCategory_Permissions($categoryObj->getGroups_read(), $categoryObj->categoryid(), 'category_read'); |
|
301 | + //sf_saveCategory_Permissions($groups_admin, $categoriesObj->categoryid(), 'category_admin'); |
|
307 | 302 | |
308 | - redirect_header($redirect_to, 2, $redirect_msg); |
|
309 | - break; |
|
303 | + if ($applyall) { |
|
304 | + // TODO : put this function in the category class |
|
305 | + sf_overrideFaqsPermissions($categoryObj->getGroups_read(), $categoryObj->categoryid()); |
|
306 | + } |
|
310 | 307 | |
311 | - case 'del': |
|
312 | - global $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $_GET; |
|
308 | + redirect_header($redirect_to, 2, $redirect_msg); |
|
309 | + break; |
|
313 | 310 | |
314 | - $module_id = $xoopsModule->getVar('mid'); |
|
315 | - $gpermHandler = xoops_getHandler('groupperm'); |
|
311 | + case 'del': |
|
312 | + global $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $_GET; |
|
316 | 313 | |
317 | - $categoryid = isset($_POST['categoryid']) ? (int)$_POST['categoryid'] : 0; |
|
318 | - $categoryid = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : $categoryid; |
|
314 | + $module_id = $xoopsModule->getVar('mid'); |
|
315 | + $gpermHandler = xoops_getHandler('groupperm'); |
|
319 | 316 | |
320 | - $categoryObj = new sfCategory($categoryid); |
|
317 | + $categoryid = isset($_POST['categoryid']) ? (int)$_POST['categoryid'] : 0; |
|
318 | + $categoryid = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : $categoryid; |
|
321 | 319 | |
322 | - $confirm = isset($_POST['confirm']) ? $_POST['confirm'] : 0; |
|
323 | - $name = isset($_POST['name']) ? $_POST['name'] : ''; |
|
320 | + $categoryObj = new sfCategory($categoryid); |
|
324 | 321 | |
325 | - if ($confirm) { |
|
326 | - if (!$categoryHandler->delete($categoryObj)) { |
|
327 | - redirect_header('category.php', 1, _AM_SF_DELETE_CAT_ERROR); |
|
322 | + $confirm = isset($_POST['confirm']) ? $_POST['confirm'] : 0; |
|
323 | + $name = isset($_POST['name']) ? $_POST['name'] : ''; |
|
324 | + |
|
325 | + if ($confirm) { |
|
326 | + if (!$categoryHandler->delete($categoryObj)) { |
|
327 | + redirect_header('category.php', 1, _AM_SF_DELETE_CAT_ERROR); |
|
328 | + } |
|
329 | + redirect_header('category.php', 1, sprintf(_AM_SF_COLISDELETED, $name)); |
|
330 | + } else { |
|
331 | + // no confirm: show deletion condition |
|
332 | + $categoryid = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : 0; |
|
333 | + xoops_cp_header(); |
|
334 | + xoops_confirm(array( |
|
335 | + 'op' => 'del', |
|
336 | + 'categoryid' => $categoryObj->categoryid(), |
|
337 | + 'confirm' => 1, |
|
338 | + 'name' => $categoryObj->name() |
|
339 | + ), 'category.php', _AM_SF_DELETECOL . " '" . $categoryObj->name() . "'. <br> <br>" . _AM_SF_DELETE_CAT_CONFIRM, _AM_SF_DELETE); |
|
340 | + xoops_cp_footer(); |
|
328 | 341 | } |
329 | - redirect_header('category.php', 1, sprintf(_AM_SF_COLISDELETED, $name)); |
|
330 | - } else { |
|
331 | - // no confirm: show deletion condition |
|
332 | - $categoryid = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : 0; |
|
342 | + exit(); |
|
343 | + break; |
|
344 | + |
|
345 | + case 'cancel': |
|
346 | + redirect_header('category.php', 1, sprintf(_AM_SF_BACK2IDX, '')); |
|
347 | + break; |
|
348 | + case 'default': |
|
349 | + default: |
|
350 | + $adminObject = \Xmf\Module\Admin::getInstance(); |
|
333 | 351 | xoops_cp_header(); |
334 | - xoops_confirm(array( |
|
335 | - 'op' => 'del', |
|
336 | - 'categoryid' => $categoryObj->categoryid(), |
|
337 | - 'confirm' => 1, |
|
338 | - 'name' => $categoryObj->name() |
|
339 | - ), 'category.php', _AM_SF_DELETECOL . " '" . $categoryObj->name() . "'. <br> <br>" . _AM_SF_DELETE_CAT_CONFIRM, _AM_SF_DELETE); |
|
340 | - xoops_cp_footer(); |
|
341 | - } |
|
342 | - exit(); |
|
343 | - break; |
|
344 | - |
|
345 | - case 'cancel': |
|
346 | - redirect_header('category.php', 1, sprintf(_AM_SF_BACK2IDX, '')); |
|
347 | - break; |
|
348 | - case 'default': |
|
349 | - default: |
|
350 | - $adminObject = \Xmf\Module\Admin::getInstance(); |
|
351 | - xoops_cp_header(); |
|
352 | - |
|
353 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
354 | - echo "<br>\n"; |
|
355 | 352 | |
356 | - // Creating the objects for top categories |
|
357 | - $categoriesObj = $categoryHandler->getCategories($xoopsModuleConfig['perpage'], $startcategory, 0); |
|
358 | - |
|
359 | - sf_collapsableBar('toptable', 'toptableicon'); |
|
360 | - echo "<img id='toptableicon' src=" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt='' /></a> " . _AM_SF_CATEGORIES_TITLE . '</h3>'; |
|
361 | - echo "<div id='toptable'>"; |
|
362 | - echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . _AM_SF_CATEGORIES_DSC . '</span>'; |
|
363 | - |
|
364 | - echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>"; |
|
365 | - echo '<tr>'; |
|
366 | - echo "<th width='35%' class='bg3' align='left'><b>" . _AM_SF_ARTCOLNAME . '</b></td>'; |
|
367 | - echo "<th class='bg3' align='left'><b>" . _AM_SF_DESCRIP . '</b></td>'; |
|
368 | - echo "<th class='bg3' width='65' align='center'><b>" . _AM_SF_WEIGHT . '</b></td>'; |
|
369 | - echo "<th width='60' class='bg3' align='center'><b>" . _AM_SF_ACTION . '</b></td>'; |
|
370 | - echo '</tr>'; |
|
371 | - $totalCategories = $categoryHandler->getCategoriesCount(0); |
|
372 | - if (count($categoriesObj) > 0) { |
|
373 | - foreach ($categoriesObj as $key => $thiscat) { |
|
374 | - displayCategory($thiscat); |
|
375 | - } |
|
376 | - } else { |
|
353 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
354 | + echo "<br>\n"; |
|
355 | + |
|
356 | + // Creating the objects for top categories |
|
357 | + $categoriesObj = $categoryHandler->getCategories($xoopsModuleConfig['perpage'], $startcategory, 0); |
|
358 | + |
|
359 | + sf_collapsableBar('toptable', 'toptableicon'); |
|
360 | + echo "<img id='toptableicon' src=" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt='' /></a> " . _AM_SF_CATEGORIES_TITLE . '</h3>'; |
|
361 | + echo "<div id='toptable'>"; |
|
362 | + echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . _AM_SF_CATEGORIES_DSC . '</span>'; |
|
363 | + |
|
364 | + echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>"; |
|
377 | 365 | echo '<tr>'; |
378 | - echo "<td class='head' align='center' colspan= '7'>" . _AM_SF_NOCAT . '</td>'; |
|
366 | + echo "<th width='35%' class='bg3' align='left'><b>" . _AM_SF_ARTCOLNAME . '</b></td>'; |
|
367 | + echo "<th class='bg3' align='left'><b>" . _AM_SF_DESCRIP . '</b></td>'; |
|
368 | + echo "<th class='bg3' width='65' align='center'><b>" . _AM_SF_WEIGHT . '</b></td>'; |
|
369 | + echo "<th width='60' class='bg3' align='center'><b>" . _AM_SF_ACTION . '</b></td>'; |
|
379 | 370 | echo '</tr>'; |
380 | - $categoryid = '0'; |
|
381 | - } |
|
382 | - echo "</table>\n"; |
|
383 | - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
384 | - $pagenav = new XoopsPageNav($totalCategories, $xoopsModuleConfig['perpage'], $startcategory, 'startcategory'); |
|
385 | - echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'; |
|
386 | - echo '</div>'; |
|
371 | + $totalCategories = $categoryHandler->getCategoriesCount(0); |
|
372 | + if (count($categoriesObj) > 0) { |
|
373 | + foreach ($categoriesObj as $key => $thiscat) { |
|
374 | + displayCategory($thiscat); |
|
375 | + } |
|
376 | + } else { |
|
377 | + echo '<tr>'; |
|
378 | + echo "<td class='head' align='center' colspan= '7'>" . _AM_SF_NOCAT . '</td>'; |
|
379 | + echo '</tr>'; |
|
380 | + $categoryid = '0'; |
|
381 | + } |
|
382 | + echo "</table>\n"; |
|
383 | + include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
384 | + $pagenav = new XoopsPageNav($totalCategories, $xoopsModuleConfig['perpage'], $startcategory, 'startcategory'); |
|
385 | + echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'; |
|
386 | + echo '</div>'; |
|
387 | 387 | |
388 | - editcat(false); |
|
388 | + editcat(false); |
|
389 | 389 | |
390 | - break; |
|
390 | + break; |
|
391 | 391 | } |
392 | 392 | |
393 | 393 | require_once __DIR__ . '/admin_footer.php'; |
@@ -24,53 +24,53 @@ |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | switch ($op) { |
27 | - case 'default': |
|
28 | - default: |
|
29 | - global $xoopsDB, $xoopsModule; |
|
27 | + case 'default': |
|
28 | + default: |
|
29 | + global $xoopsDB, $xoopsModule; |
|
30 | 30 | |
31 | - $adminObject = \Xmf\Module\Admin::getInstance(); |
|
32 | - xoops_cp_header(); |
|
33 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
34 | - // View Categories permissions |
|
35 | - $item_list_view = array(); |
|
36 | - $block_view = array(); |
|
37 | - // echo "<h3 style='color: #2F5376; '>"._AM_SF_PERMISSIONSADMIN."</h3>\n" ; |
|
38 | - sf_collapsableBar('toptable', 'toptableicon'); |
|
31 | + $adminObject = \Xmf\Module\Admin::getInstance(); |
|
32 | + xoops_cp_header(); |
|
33 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
34 | + // View Categories permissions |
|
35 | + $item_list_view = array(); |
|
36 | + $block_view = array(); |
|
37 | + // echo "<h3 style='color: #2F5376; '>"._AM_SF_PERMISSIONSADMIN."</h3>\n" ; |
|
38 | + sf_collapsableBar('toptable', 'toptableicon'); |
|
39 | 39 | |
40 | - $result_view = $xoopsDB->query('SELECT categoryid, name FROM ' . $xoopsDB->prefix('smartfaq_categories') . ' '); |
|
41 | - if ($xoopsDB->getRowsNum($result_view)) { |
|
42 | - while ($myrow_view = $xoopsDB->fetcharray($result_view)) { |
|
43 | - $item_list_view['cid'] = $myrow_view['categoryid']; |
|
44 | - $item_list_view['title'] = $myrow_view['name']; |
|
45 | - $form_view = new XoopsGroupPermForm('', $xoopsModule->getVar('mid'), 'category_read', "<img id='toptableicon' src=" |
|
46 | - . XOOPS_URL |
|
47 | - . '/modules/' |
|
48 | - . $xoopsModule->dirname() |
|
49 | - . "/assets/images/icon/close12.gif alt='' /></a> " |
|
50 | - . _AM_SF_PERMISSIONSVIEWMAN |
|
51 | - . "</h3><div id='toptable'><span style=\"color: #567; margin: 3px 0 0 0; font-size: small; display: block; \">" |
|
52 | - . _AM_SF_VIEW_CATS |
|
53 | - . '</span>', 'admin/permissions.php'); |
|
54 | - $block_view[] = $item_list_view; |
|
55 | - foreach ($block_view as $itemlists) { |
|
56 | - $form_view->addItem($itemlists['cid'], $myts->displayTarea($itemlists['title'])); |
|
40 | + $result_view = $xoopsDB->query('SELECT categoryid, name FROM ' . $xoopsDB->prefix('smartfaq_categories') . ' '); |
|
41 | + if ($xoopsDB->getRowsNum($result_view)) { |
|
42 | + while ($myrow_view = $xoopsDB->fetcharray($result_view)) { |
|
43 | + $item_list_view['cid'] = $myrow_view['categoryid']; |
|
44 | + $item_list_view['title'] = $myrow_view['name']; |
|
45 | + $form_view = new XoopsGroupPermForm('', $xoopsModule->getVar('mid'), 'category_read', "<img id='toptableicon' src=" |
|
46 | + . XOOPS_URL |
|
47 | + . '/modules/' |
|
48 | + . $xoopsModule->dirname() |
|
49 | + . "/assets/images/icon/close12.gif alt='' /></a> " |
|
50 | + . _AM_SF_PERMISSIONSVIEWMAN |
|
51 | + . "</h3><div id='toptable'><span style=\"color: #567; margin: 3px 0 0 0; font-size: small; display: block; \">" |
|
52 | + . _AM_SF_VIEW_CATS |
|
53 | + . '</span>', 'admin/permissions.php'); |
|
54 | + $block_view[] = $item_list_view; |
|
55 | + foreach ($block_view as $itemlists) { |
|
56 | + $form_view->addItem($itemlists['cid'], $myts->displayTarea($itemlists['title'])); |
|
57 | + } |
|
57 | 58 | } |
59 | + echo $form_view->render(); |
|
60 | + } else { |
|
61 | + echo "<img id='toptableicon' src=" |
|
62 | + . XOOPS_URL |
|
63 | + . '/modules/' |
|
64 | + . $xoopsModule->dirname() |
|
65 | + . "/assets/images/icon/close12.gif alt='' /></a> " |
|
66 | + . _AM_SF_PERMISSIONSVIEWMAN |
|
67 | + . "</h3><div id='toptable'><span style=\"color: #567; margin: 3px 0 0 0; font-size: small; display: block; \">" |
|
68 | + . _AM_SF_NOPERMSSET |
|
69 | + . '</span>'; |
|
58 | 70 | } |
59 | - echo $form_view->render(); |
|
60 | - } else { |
|
61 | - echo "<img id='toptableicon' src=" |
|
62 | - . XOOPS_URL |
|
63 | - . '/modules/' |
|
64 | - . $xoopsModule->dirname() |
|
65 | - . "/assets/images/icon/close12.gif alt='' /></a> " |
|
66 | - . _AM_SF_PERMISSIONSVIEWMAN |
|
67 | - . "</h3><div id='toptable'><span style=\"color: #567; margin: 3px 0 0 0; font-size: small; display: block; \">" |
|
68 | - . _AM_SF_NOPERMSSET |
|
69 | - . '</span>'; |
|
70 | - } |
|
71 | - echo '</div>'; |
|
71 | + echo '</div>'; |
|
72 | 72 | |
73 | - echo "<br>\n"; |
|
73 | + echo "<br>\n"; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | require_once __DIR__ . '/admin_footer.php'; |