@@ -227,149 +227,149 @@ |
||
227 | 227 | } |
228 | 228 | |
229 | 229 | switch ($op) { |
230 | - case 'mod': |
|
231 | - $categoryid = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : 0; |
|
232 | - $destList = isset($_POST['destList']) ? $_POST['destList'] : ''; |
|
233 | - $adminObject = \Xmf\Module\Admin::getInstance(); |
|
234 | - xoops_cp_header(); |
|
235 | - |
|
236 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
237 | - editcat(true, $categoryid); |
|
238 | - break; |
|
230 | + case 'mod': |
|
231 | + $categoryid = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : 0; |
|
232 | + $destList = isset($_POST['destList']) ? $_POST['destList'] : ''; |
|
233 | + $adminObject = \Xmf\Module\Admin::getInstance(); |
|
234 | + xoops_cp_header(); |
|
239 | 235 | |
240 | - case 'addcategory': |
|
241 | - global $_POST, $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $xoopsModule, $xoopsModuleConfig, $modify, $myts, $categoryid; |
|
236 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
237 | + editcat(true, $categoryid); |
|
238 | + break; |
|
242 | 239 | |
243 | - $categoryid = isset($_POST['categoryid']) ? (int)$_POST['categoryid'] : 0; |
|
240 | + case 'addcategory': |
|
241 | + global $_POST, $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $xoopsModule, $xoopsModuleConfig, $modify, $myts, $categoryid; |
|
244 | 242 | |
245 | - if ($categoryid != 0) { |
|
246 | - $categoryObj = new sfCategory($categoryid); |
|
247 | - } else { |
|
248 | - $categoryObj = $categoryHandler->create(); |
|
249 | - } |
|
243 | + $categoryid = isset($_POST['categoryid']) ? (int)$_POST['categoryid'] : 0; |
|
250 | 244 | |
251 | - //if (isset($_POST['allmods'])) $allmods = $_POST['allmods']; |
|
252 | - //if (isset($_POST['moderators'])) $moderators = $_POST['moderators']; |
|
245 | + if ($categoryid != 0) { |
|
246 | + $categoryObj = new sfCategory($categoryid); |
|
247 | + } else { |
|
248 | + $categoryObj = $categoryHandler->create(); |
|
249 | + } |
|
253 | 250 | |
254 | - $categoryObj->setVar('parentid', isset($_POST['parentid']) ? (int)$_POST['parentid'] : 0); |
|
255 | - $applyall = isset($_POST['applyall']) ? (int)$_POST['applyall'] : 0; |
|
256 | - $categoryObj->setVar('weight', isset($_POST['weight']) ? (int)$_POST['weight'] : 1); |
|
251 | + //if (isset($_POST['allmods'])) $allmods = $_POST['allmods']; |
|
252 | + //if (isset($_POST['moderators'])) $moderators = $_POST['moderators']; |
|
257 | 253 | |
258 | - // Groups and permissions |
|
259 | - if (isset($_POST['groups_read'])) { |
|
260 | - $categoryObj->setGroups_read($_POST['groups_read']); |
|
261 | - } else { |
|
262 | - $categoryObj->setGroups_read(); |
|
263 | - } |
|
264 | - // $groups_admin = isset($_POST['groups_admin'])? $_POST['groups_admin'] : array(); |
|
265 | - // $mod_perms = isset($_POST['mod_perms'])? $_POST['mod_perms'] : array(); |
|
266 | - |
|
267 | - $categoryObj->setVar('name', $_POST['name']); |
|
268 | - |
|
269 | - $categoryObj->setVar('description', $_POST['description']); |
|
270 | - if ($categoryObj->isNew()) { |
|
271 | - $redirect_msg = _AM_SF_CATCREATED; |
|
272 | - $redirect_to = 'category.php?op=mod'; |
|
273 | - } else { |
|
274 | - $redirect_msg = _AM_SF_COLMODIFIED; |
|
275 | - $redirect_to = 'category.php'; |
|
276 | - } |
|
254 | + $categoryObj->setVar('parentid', isset($_POST['parentid']) ? (int)$_POST['parentid'] : 0); |
|
255 | + $applyall = isset($_POST['applyall']) ? (int)$_POST['applyall'] : 0; |
|
256 | + $categoryObj->setVar('weight', isset($_POST['weight']) ? (int)$_POST['weight'] : 1); |
|
277 | 257 | |
278 | - if (!$categoryObj->store()) { |
|
279 | - redirect_header('javascript:history.go(-1)', 3, _AM_SF_CATEGORY_SAVE_ERROR . sf_formatErrors($categoryObj->getErrors())); |
|
280 | - } |
|
281 | - // TODO : put this function in the category class |
|
282 | - sf_saveCategory_Permissions($categoryObj->getGroups_read(), $categoryObj->categoryid(), 'category_read'); |
|
283 | - //sf_saveCategory_Permissions($groups_admin, $categoriesObj->categoryid(), 'category_admin'); |
|
258 | + // Groups and permissions |
|
259 | + if (isset($_POST['groups_read'])) { |
|
260 | + $categoryObj->setGroups_read($_POST['groups_read']); |
|
261 | + } else { |
|
262 | + $categoryObj->setGroups_read(); |
|
263 | + } |
|
264 | + // $groups_admin = isset($_POST['groups_admin'])? $_POST['groups_admin'] : array(); |
|
265 | + // $mod_perms = isset($_POST['mod_perms'])? $_POST['mod_perms'] : array(); |
|
266 | + |
|
267 | + $categoryObj->setVar('name', $_POST['name']); |
|
268 | + |
|
269 | + $categoryObj->setVar('description', $_POST['description']); |
|
270 | + if ($categoryObj->isNew()) { |
|
271 | + $redirect_msg = _AM_SF_CATCREATED; |
|
272 | + $redirect_to = 'category.php?op=mod'; |
|
273 | + } else { |
|
274 | + $redirect_msg = _AM_SF_COLMODIFIED; |
|
275 | + $redirect_to = 'category.php'; |
|
276 | + } |
|
284 | 277 | |
285 | - if ($applyall) { |
|
278 | + if (!$categoryObj->store()) { |
|
279 | + redirect_header('javascript:history.go(-1)', 3, _AM_SF_CATEGORY_SAVE_ERROR . sf_formatErrors($categoryObj->getErrors())); |
|
280 | + } |
|
286 | 281 | // TODO : put this function in the category class |
287 | - sf_overrideFaqsPermissions($categoryObj->getGroups_read(), $categoryObj->categoryid()); |
|
288 | - } |
|
282 | + sf_saveCategory_Permissions($categoryObj->getGroups_read(), $categoryObj->categoryid(), 'category_read'); |
|
283 | + //sf_saveCategory_Permissions($groups_admin, $categoriesObj->categoryid(), 'category_admin'); |
|
289 | 284 | |
290 | - redirect_header($redirect_to, 2, $redirect_msg); |
|
291 | - break; |
|
285 | + if ($applyall) { |
|
286 | + // TODO : put this function in the category class |
|
287 | + sf_overrideFaqsPermissions($categoryObj->getGroups_read(), $categoryObj->categoryid()); |
|
288 | + } |
|
292 | 289 | |
293 | - case 'del': |
|
294 | - global $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $_GET; |
|
290 | + redirect_header($redirect_to, 2, $redirect_msg); |
|
291 | + break; |
|
295 | 292 | |
296 | - $module_id = $xoopsModule->getVar('mid'); |
|
297 | - $gpermHandler = xoops_getHandler('groupperm'); |
|
293 | + case 'del': |
|
294 | + global $xoopsUser, $xoopsUser, $xoopsConfig, $xoopsDB, $_GET; |
|
298 | 295 | |
299 | - $categoryid = isset($_POST['categoryid']) ? (int)$_POST['categoryid'] : 0; |
|
300 | - $categoryid = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : $categoryid; |
|
296 | + $module_id = $xoopsModule->getVar('mid'); |
|
297 | + $gpermHandler = xoops_getHandler('groupperm'); |
|
301 | 298 | |
302 | - $categoryObj = new sfCategory($categoryid); |
|
299 | + $categoryid = isset($_POST['categoryid']) ? (int)$_POST['categoryid'] : 0; |
|
300 | + $categoryid = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : $categoryid; |
|
303 | 301 | |
304 | - $confirm = isset($_POST['confirm']) ? $_POST['confirm'] : 0; |
|
305 | - $name = isset($_POST['name']) ? $_POST['name'] : ''; |
|
302 | + $categoryObj = new sfCategory($categoryid); |
|
306 | 303 | |
307 | - if ($confirm) { |
|
308 | - if (!$categoryHandler->delete($categoryObj)) { |
|
309 | - redirect_header('category.php', 1, _AM_SF_DELETE_CAT_ERROR); |
|
304 | + $confirm = isset($_POST['confirm']) ? $_POST['confirm'] : 0; |
|
305 | + $name = isset($_POST['name']) ? $_POST['name'] : ''; |
|
306 | + |
|
307 | + if ($confirm) { |
|
308 | + if (!$categoryHandler->delete($categoryObj)) { |
|
309 | + redirect_header('category.php', 1, _AM_SF_DELETE_CAT_ERROR); |
|
310 | + } |
|
311 | + redirect_header('category.php', 1, sprintf(_AM_SF_COLISDELETED, $name)); |
|
312 | + } else { |
|
313 | + // no confirm: show deletion condition |
|
314 | + $categoryid = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : 0; |
|
315 | + xoops_cp_header(); |
|
316 | + xoops_confirm([ |
|
317 | + 'op' => 'del', |
|
318 | + 'categoryid' => $categoryObj->categoryid(), |
|
319 | + 'confirm' => 1, |
|
320 | + 'name' => $categoryObj->name() |
|
321 | + ], 'category.php', _AM_SF_DELETECOL . " '" . $categoryObj->name() . "'. <br> <br>" . _AM_SF_DELETE_CAT_CONFIRM, _AM_SF_DELETE); |
|
322 | + xoops_cp_footer(); |
|
310 | 323 | } |
311 | - redirect_header('category.php', 1, sprintf(_AM_SF_COLISDELETED, $name)); |
|
312 | - } else { |
|
313 | - // no confirm: show deletion condition |
|
314 | - $categoryid = isset($_GET['categoryid']) ? (int)$_GET['categoryid'] : 0; |
|
324 | + exit(); |
|
325 | + break; |
|
326 | + |
|
327 | + case 'cancel': |
|
328 | + redirect_header('category.php', 1, sprintf(_AM_SF_BACK2IDX, '')); |
|
329 | + break; |
|
330 | + case 'default': |
|
331 | + default: |
|
332 | + $adminObject = \Xmf\Module\Admin::getInstance(); |
|
315 | 333 | xoops_cp_header(); |
316 | - xoops_confirm([ |
|
317 | - 'op' => 'del', |
|
318 | - 'categoryid' => $categoryObj->categoryid(), |
|
319 | - 'confirm' => 1, |
|
320 | - 'name' => $categoryObj->name() |
|
321 | - ], 'category.php', _AM_SF_DELETECOL . " '" . $categoryObj->name() . "'. <br> <br>" . _AM_SF_DELETE_CAT_CONFIRM, _AM_SF_DELETE); |
|
322 | - xoops_cp_footer(); |
|
323 | - } |
|
324 | - exit(); |
|
325 | - break; |
|
326 | - |
|
327 | - case 'cancel': |
|
328 | - redirect_header('category.php', 1, sprintf(_AM_SF_BACK2IDX, '')); |
|
329 | - break; |
|
330 | - case 'default': |
|
331 | - default: |
|
332 | - $adminObject = \Xmf\Module\Admin::getInstance(); |
|
333 | - xoops_cp_header(); |
|
334 | - |
|
335 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
336 | - echo "<br>\n"; |
|
337 | 334 | |
338 | - // Creating the objects for top categories |
|
339 | - $categoriesObj = $categoryHandler->getCategories($xoopsModuleConfig['perpage'], $startcategory, 0); |
|
340 | - |
|
341 | - sf_collapsableBar('toptable', 'toptableicon'); |
|
342 | - echo "<img id='toptableicon' src=" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt=''></a> " . _AM_SF_CATEGORIES_TITLE . '</h3>'; |
|
343 | - echo "<div id='toptable'>"; |
|
344 | - echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . _AM_SF_CATEGORIES_DSC . '</span>'; |
|
345 | - |
|
346 | - echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>"; |
|
347 | - echo '<tr>'; |
|
348 | - echo "<th width='35%' class='bg3' align='left'><b>" . _AM_SF_ARTCOLNAME . '</b></td>'; |
|
349 | - echo "<th class='bg3' align='left'><b>" . _AM_SF_DESCRIP . '</b></td>'; |
|
350 | - echo "<th class='bg3' width='65' align='center'><b>" . _AM_SF_WEIGHT . '</b></td>'; |
|
351 | - echo "<th width='60' class='bg3' align='center'><b>" . _AM_SF_ACTION . '</b></td>'; |
|
352 | - echo '</tr>'; |
|
353 | - $totalCategories = $categoryHandler->getCategoriesCount(0); |
|
354 | - if (count($categoriesObj) > 0) { |
|
355 | - foreach ($categoriesObj as $key => $thiscat) { |
|
356 | - displayCategory($thiscat); |
|
357 | - } |
|
358 | - } else { |
|
335 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
336 | + echo "<br>\n"; |
|
337 | + |
|
338 | + // Creating the objects for top categories |
|
339 | + $categoriesObj = $categoryHandler->getCategories($xoopsModuleConfig['perpage'], $startcategory, 0); |
|
340 | + |
|
341 | + sf_collapsableBar('toptable', 'toptableicon'); |
|
342 | + echo "<img id='toptableicon' src=" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/close12.gif alt=''></a> " . _AM_SF_CATEGORIES_TITLE . '</h3>'; |
|
343 | + echo "<div id='toptable'>"; |
|
344 | + echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . _AM_SF_CATEGORIES_DSC . '</span>'; |
|
345 | + |
|
346 | + echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>"; |
|
359 | 347 | echo '<tr>'; |
360 | - echo "<td class='head' align='center' colspan= '7'>" . _AM_SF_NOCAT . '</td>'; |
|
348 | + echo "<th width='35%' class='bg3' align='left'><b>" . _AM_SF_ARTCOLNAME . '</b></td>'; |
|
349 | + echo "<th class='bg3' align='left'><b>" . _AM_SF_DESCRIP . '</b></td>'; |
|
350 | + echo "<th class='bg3' width='65' align='center'><b>" . _AM_SF_WEIGHT . '</b></td>'; |
|
351 | + echo "<th width='60' class='bg3' align='center'><b>" . _AM_SF_ACTION . '</b></td>'; |
|
361 | 352 | echo '</tr>'; |
362 | - $categoryid = '0'; |
|
363 | - } |
|
364 | - echo "</table>\n"; |
|
365 | - require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
366 | - $pagenav = new XoopsPageNav($totalCategories, $xoopsModuleConfig['perpage'], $startcategory, 'startcategory'); |
|
367 | - echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'; |
|
368 | - echo '</div>'; |
|
353 | + $totalCategories = $categoryHandler->getCategoriesCount(0); |
|
354 | + if (count($categoriesObj) > 0) { |
|
355 | + foreach ($categoriesObj as $key => $thiscat) { |
|
356 | + displayCategory($thiscat); |
|
357 | + } |
|
358 | + } else { |
|
359 | + echo '<tr>'; |
|
360 | + echo "<td class='head' align='center' colspan= '7'>" . _AM_SF_NOCAT . '</td>'; |
|
361 | + echo '</tr>'; |
|
362 | + $categoryid = '0'; |
|
363 | + } |
|
364 | + echo "</table>\n"; |
|
365 | + require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
366 | + $pagenav = new XoopsPageNav($totalCategories, $xoopsModuleConfig['perpage'], $startcategory, 'startcategory'); |
|
367 | + echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'; |
|
368 | + echo '</div>'; |
|
369 | 369 | |
370 | - editcat(false); |
|
370 | + editcat(false); |
|
371 | 371 | |
372 | - break; |
|
372 | + break; |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | 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 = []; |
|
36 | - $block_view = []; |
|
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 = []; |
|
36 | + $block_view = []; |
|
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'; |
@@ -44,94 +44,94 @@ |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | switch ($op) { |
47 | - case 'post': |
|
47 | + case 'post': |
|
48 | 48 | |
49 | - global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsDB; |
|
49 | + global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsDB; |
|
50 | 50 | |
51 | - $newFaqObj = $faqHandler->create(); |
|
51 | + $newFaqObj = $faqHandler->create(); |
|
52 | 52 | |
53 | - if (!$xoopsUser) { |
|
54 | - if ($xoopsModuleConfig['anonpost'] == 1) { |
|
55 | - $uid = 0; |
|
53 | + if (!$xoopsUser) { |
|
54 | + if ($xoopsModuleConfig['anonpost'] == 1) { |
|
55 | + $uid = 0; |
|
56 | + } else { |
|
57 | + redirect_header('index.php', 3, _NOPERM); |
|
58 | + } |
|
56 | 59 | } else { |
57 | - redirect_header('index.php', 3, _NOPERM); |
|
60 | + $uid = $xoopsUser->uid(); |
|
58 | 61 | } |
59 | - } else { |
|
60 | - $uid = $xoopsUser->uid(); |
|
61 | - } |
|
62 | - |
|
63 | - // Putting the values about the FAQ in the FAQ object |
|
64 | - $newFaqObj->setVar('categoryid', $_POST['categoryid']); |
|
65 | - $newFaqObj->setVar('uid', $uid); |
|
66 | - $newFaqObj->setVar('question', $_POST['question']); |
|
67 | - $notifypub = isset($_POST['notifypub']) ? $_POST['notifypub'] : 0; |
|
68 | - $newFaqObj->setVar('notifypub', $notifypub); |
|
69 | - |
|
70 | - // Setting the status of the FAQ |
|
71 | - if ($xoopsModuleConfig['autoapprove_request'] == 1) { |
|
72 | - $newFaqObj->setVar('status', _SF_STATUS_OPENED); |
|
73 | - } else { |
|
74 | - $newFaqObj->setVar('status', _SF_STATUS_ASKED); |
|
75 | - } |
|
76 | - |
|
77 | - // Storing the FAQ object in the database |
|
78 | - if (!$newFaqObj->store()) { |
|
79 | - redirect_header('javascript:history.go(-1)', 3, _MD_SF_REQUEST_ERROR . sf_formatErrors($newFaqObj->getErrors())); |
|
80 | - } |
|
81 | - |
|
82 | - // Get the cateopry object related to that FAQ |
|
83 | - // If autoapprove_requested |
|
84 | - if ($xoopsModuleConfig['autoapprove_request'] == 1) { |
|
85 | - // We do not not subscribe user to notification on publish since we publish it right away |
|
86 | - |
|
87 | - // Send notifications |
|
88 | - $newFaqObj->sendNotifications([_SF_NOT_QUESTION_PUBLISHED]); |
|
89 | - |
|
90 | - $redirect_msg = _MD_SF_REQUEST_RECEIVED_AND_PUBLISHED; |
|
91 | - } else { |
|
92 | - // Subscribe the user to On Published notification, if requested |
|
93 | - if ($notifypub == 1) { |
|
94 | - require_once XOOPS_ROOT_PATH . '/include/notification_constants.php'; |
|
95 | - $notificationHandler = xoops_getHandler('notification'); |
|
96 | - $notificationHandler->subscribe('question', $newFaqObj->faqid(), 'approved', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE); |
|
62 | + |
|
63 | + // Putting the values about the FAQ in the FAQ object |
|
64 | + $newFaqObj->setVar('categoryid', $_POST['categoryid']); |
|
65 | + $newFaqObj->setVar('uid', $uid); |
|
66 | + $newFaqObj->setVar('question', $_POST['question']); |
|
67 | + $notifypub = isset($_POST['notifypub']) ? $_POST['notifypub'] : 0; |
|
68 | + $newFaqObj->setVar('notifypub', $notifypub); |
|
69 | + |
|
70 | + // Setting the status of the FAQ |
|
71 | + if ($xoopsModuleConfig['autoapprove_request'] == 1) { |
|
72 | + $newFaqObj->setVar('status', _SF_STATUS_OPENED); |
|
73 | + } else { |
|
74 | + $newFaqObj->setVar('status', _SF_STATUS_ASKED); |
|
75 | + } |
|
76 | + |
|
77 | + // Storing the FAQ object in the database |
|
78 | + if (!$newFaqObj->store()) { |
|
79 | + redirect_header('javascript:history.go(-1)', 3, _MD_SF_REQUEST_ERROR . sf_formatErrors($newFaqObj->getErrors())); |
|
97 | 80 | } |
98 | - // Send notifications |
|
99 | - $newFaqObj->sendNotifications([_SF_NOT_QUESTION_SUBMITTED]); |
|
100 | 81 | |
101 | - $redirect_msg = _MD_SF_REQUEST_RECEIVED_NEED_APPROVAL; |
|
102 | - } |
|
82 | + // Get the cateopry object related to that FAQ |
|
83 | + // If autoapprove_requested |
|
84 | + if ($xoopsModuleConfig['autoapprove_request'] == 1) { |
|
85 | + // We do not not subscribe user to notification on publish since we publish it right away |
|
86 | + |
|
87 | + // Send notifications |
|
88 | + $newFaqObj->sendNotifications([_SF_NOT_QUESTION_PUBLISHED]); |
|
89 | + |
|
90 | + $redirect_msg = _MD_SF_REQUEST_RECEIVED_AND_PUBLISHED; |
|
91 | + } else { |
|
92 | + // Subscribe the user to On Published notification, if requested |
|
93 | + if ($notifypub == 1) { |
|
94 | + require_once XOOPS_ROOT_PATH . '/include/notification_constants.php'; |
|
95 | + $notificationHandler = xoops_getHandler('notification'); |
|
96 | + $notificationHandler->subscribe('question', $newFaqObj->faqid(), 'approved', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE); |
|
97 | + } |
|
98 | + // Send notifications |
|
99 | + $newFaqObj->sendNotifications([_SF_NOT_QUESTION_SUBMITTED]); |
|
100 | + |
|
101 | + $redirect_msg = _MD_SF_REQUEST_RECEIVED_NEED_APPROVAL; |
|
102 | + } |
|
103 | 103 | |
104 | - //redirect_header("javascript:history.go(-2)", 3, $redirect_msg); |
|
105 | - redirect_header('index.php', 2, $redirect_msg); |
|
106 | - break; |
|
104 | + //redirect_header("javascript:history.go(-2)", 3, $redirect_msg); |
|
105 | + redirect_header('index.php', 2, $redirect_msg); |
|
106 | + break; |
|
107 | 107 | |
108 | - case 'form': |
|
109 | - default: |
|
108 | + case 'form': |
|
109 | + default: |
|
110 | 110 | |
111 | - global $xoopsUser, $myts; |
|
111 | + global $xoopsUser, $myts; |
|
112 | 112 | |
113 | - $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.tpl'; |
|
114 | - require_once XOOPS_ROOT_PATH . '/header.php'; |
|
115 | - require_once __DIR__ . '/footer.php'; |
|
113 | + $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.tpl'; |
|
114 | + require_once XOOPS_ROOT_PATH . '/header.php'; |
|
115 | + require_once __DIR__ . '/footer.php'; |
|
116 | 116 | |
117 | - $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous'; |
|
117 | + $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous'; |
|
118 | 118 | |
119 | - $moduleName =& $myts->displayTarea($xoopsModule->getVar('name')); |
|
120 | - $xoopsTpl->assign('whereInSection', $moduleName); |
|
121 | - $xoopsTpl->assign('lang_submit', _MD_SF_REQUEST); |
|
119 | + $moduleName =& $myts->displayTarea($xoopsModule->getVar('name')); |
|
120 | + $xoopsTpl->assign('whereInSection', $moduleName); |
|
121 | + $xoopsTpl->assign('lang_submit', _MD_SF_REQUEST); |
|
122 | 122 | |
123 | - $xoopsTpl->assign('lang_intro_title', _MD_SF_REQUEST); |
|
124 | - $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . $myts->displayTarea($xoopsModuleConfig['requestintromsg'])); |
|
123 | + $xoopsTpl->assign('lang_intro_title', _MD_SF_REQUEST); |
|
124 | + $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . $myts->displayTarea($xoopsModuleConfig['requestintromsg'])); |
|
125 | 125 | |
126 | - require_once __DIR__ . '/include/request.inc.php'; |
|
126 | + require_once __DIR__ . '/include/request.inc.php'; |
|
127 | 127 | |
128 | - $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous'; |
|
128 | + $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous'; |
|
129 | 129 | |
130 | - $sectionname = $myts->htmlSpecialChars($xoopsModule->getVar('name')); |
|
130 | + $sectionname = $myts->htmlSpecialChars($xoopsModule->getVar('name')); |
|
131 | 131 | |
132 | - require_once __DIR__ . '/include/request.inc.php'; |
|
132 | + require_once __DIR__ . '/include/request.inc.php'; |
|
133 | 133 | |
134 | - require_once XOOPS_ROOT_PATH . '/footer.php'; |
|
134 | + require_once XOOPS_ROOT_PATH . '/footer.php'; |
|
135 | 135 | |
136 | - break; |
|
136 | + break; |
|
137 | 137 | } |
@@ -46,153 +46,153 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | switch ($op) { |
49 | - case 'preview': |
|
49 | + case 'preview': |
|
50 | 50 | |
51 | - global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsDB; |
|
51 | + global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsDB; |
|
52 | 52 | |
53 | - $faqObj = $faqHandler->create(); |
|
54 | - $answerObj = $answerHandler->create(); |
|
55 | - $categoryObj = $categoryHandler->get($_POST['categoryid']); |
|
53 | + $faqObj = $faqHandler->create(); |
|
54 | + $answerObj = $answerHandler->create(); |
|
55 | + $categoryObj = $categoryHandler->get($_POST['categoryid']); |
|
56 | 56 | |
57 | - if (!$xoopsUser) { |
|
58 | - if ($xoopsModuleConfig['anonpost'] == 1) { |
|
59 | - $uid = 0; |
|
57 | + if (!$xoopsUser) { |
|
58 | + if ($xoopsModuleConfig['anonpost'] == 1) { |
|
59 | + $uid = 0; |
|
60 | + } else { |
|
61 | + redirect_header('index.php', 3, _NOPERM); |
|
62 | + } |
|
60 | 63 | } else { |
61 | - redirect_header('index.php', 3, _NOPERM); |
|
64 | + $uid = $xoopsUser->uid(); |
|
62 | 65 | } |
63 | - } else { |
|
64 | - $uid = $xoopsUser->uid(); |
|
65 | - } |
|
66 | 66 | |
67 | - $notifypub = isset($_POST['notifypub']) ? $_POST['notifypub'] : 0; |
|
67 | + $notifypub = isset($_POST['notifypub']) ? $_POST['notifypub'] : 0; |
|
68 | 68 | |
69 | - // Putting the values about the FAQ in the FAQ object |
|
70 | - $faqObj->setVar('categoryid', $_POST['categoryid']); |
|
71 | - $faqObj->setVar('uid', $uid); |
|
72 | - $faqObj->setVar('question', $_POST['question']); |
|
73 | - $faqObj->setVar('howdoi', $_POST['howdoi']); |
|
74 | - $faqObj->setVar('diduno', $_POST['diduno']); |
|
75 | - $faqObj->setVar('datesub', time()); |
|
69 | + // Putting the values about the FAQ in the FAQ object |
|
70 | + $faqObj->setVar('categoryid', $_POST['categoryid']); |
|
71 | + $faqObj->setVar('uid', $uid); |
|
72 | + $faqObj->setVar('question', $_POST['question']); |
|
73 | + $faqObj->setVar('howdoi', $_POST['howdoi']); |
|
74 | + $faqObj->setVar('diduno', $_POST['diduno']); |
|
75 | + $faqObj->setVar('datesub', time()); |
|
76 | 76 | |
77 | - // Putting the values in the answer object |
|
78 | - $answerObj->setVar('status', _SF_AN_STATUS_APPROVED); |
|
79 | - $answerObj->setVar('faqid', $faqObj->faqid()); |
|
80 | - $answerObj->setVar('answer', $_POST['answer']); |
|
81 | - $answerObj->setVar('uid', $uid); |
|
77 | + // Putting the values in the answer object |
|
78 | + $answerObj->setVar('status', _SF_AN_STATUS_APPROVED); |
|
79 | + $answerObj->setVar('faqid', $faqObj->faqid()); |
|
80 | + $answerObj->setVar('answer', $_POST['answer']); |
|
81 | + $answerObj->setVar('uid', $uid); |
|
82 | 82 | |
83 | - global $xoopsUser, $myts; |
|
83 | + global $xoopsUser, $myts; |
|
84 | 84 | |
85 | - $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.tpl'; |
|
86 | - require_once XOOPS_ROOT_PATH . '/header.php'; |
|
87 | - require_once __DIR__ . '/footer.php'; |
|
85 | + $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.tpl'; |
|
86 | + require_once XOOPS_ROOT_PATH . '/header.php'; |
|
87 | + require_once __DIR__ . '/footer.php'; |
|
88 | 88 | |
89 | - $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous'; |
|
89 | + $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous'; |
|
90 | 90 | |
91 | - $moduleName =& $myts->displayTarea($xoopsModule->getVar('name')); |
|
92 | - $faq = $faqObj->toArray(null, $categoryObj, false); |
|
93 | - $faq['categoryPath'] = $categoryObj->getCategoryPath(true); |
|
94 | - $faq['answer'] = $answerObj->answer(); |
|
95 | - $faq['who_when'] = $faqObj->getWhoAndWhen(); |
|
91 | + $moduleName =& $myts->displayTarea($xoopsModule->getVar('name')); |
|
92 | + $faq = $faqObj->toArray(null, $categoryObj, false); |
|
93 | + $faq['categoryPath'] = $categoryObj->getCategoryPath(true); |
|
94 | + $faq['answer'] = $answerObj->answer(); |
|
95 | + $faq['who_when'] = $faqObj->getWhoAndWhen(); |
|
96 | 96 | |
97 | - $faq['comments'] = -1; |
|
98 | - $xoopsTpl->assign('faq', $faq); |
|
99 | - $xoopsTpl->assign('op', 'preview'); |
|
100 | - $xoopsTpl->assign('whereInSection', $moduleName); |
|
101 | - $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME); |
|
97 | + $faq['comments'] = -1; |
|
98 | + $xoopsTpl->assign('faq', $faq); |
|
99 | + $xoopsTpl->assign('op', 'preview'); |
|
100 | + $xoopsTpl->assign('whereInSection', $moduleName); |
|
101 | + $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME); |
|
102 | 102 | |
103 | - $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name()))); |
|
104 | - $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO); |
|
103 | + $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name()))); |
|
104 | + $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO); |
|
105 | 105 | |
106 | - require_once __DIR__ . '/include/submit.inc.php'; |
|
106 | + require_once __DIR__ . '/include/submit.inc.php'; |
|
107 | 107 | |
108 | - require_once XOOPS_ROOT_PATH . '/footer.php'; |
|
108 | + require_once XOOPS_ROOT_PATH . '/footer.php'; |
|
109 | 109 | |
110 | - exit(); |
|
111 | - break; |
|
110 | + exit(); |
|
111 | + break; |
|
112 | 112 | |
113 | - case 'post': |
|
113 | + case 'post': |
|
114 | 114 | |
115 | - global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsDB; |
|
115 | + global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsDB; |
|
116 | 116 | |
117 | - $newFaqObj = $faqHandler->create(); |
|
118 | - $newAnswerObj = $answerHandler->create(); |
|
117 | + $newFaqObj = $faqHandler->create(); |
|
118 | + $newAnswerObj = $answerHandler->create(); |
|
119 | 119 | |
120 | - if (!$xoopsUser) { |
|
121 | - if ($xoopsModuleConfig['anonpost'] == 1) { |
|
122 | - $uid = 0; |
|
120 | + if (!$xoopsUser) { |
|
121 | + if ($xoopsModuleConfig['anonpost'] == 1) { |
|
122 | + $uid = 0; |
|
123 | + } else { |
|
124 | + redirect_header('index.php', 3, _NOPERM); |
|
125 | + } |
|
123 | 126 | } else { |
124 | - redirect_header('index.php', 3, _NOPERM); |
|
127 | + $uid = $xoopsUser->uid(); |
|
125 | 128 | } |
126 | - } else { |
|
127 | - $uid = $xoopsUser->uid(); |
|
128 | - } |
|
129 | - |
|
130 | - $notifypub = isset($_POST['notifypub']) ? $_POST['notifypub'] : 0; |
|
131 | - |
|
132 | - // Putting the values about the FAQ in the FAQ object |
|
133 | - $newFaqObj->setVar('categoryid', $_POST['categoryid']); |
|
134 | - $newFaqObj->setVar('uid', $uid); |
|
135 | - $newFaqObj->setVar('question', $_POST['question']); |
|
136 | - $newFaqObj->setVar('howdoi', $_POST['howdoi']); |
|
137 | - $newFaqObj->setVar('diduno', $_POST['diduno']); |
|
138 | - $newFaqObj->setVar('notifypub', $notifypub); |
|
139 | - //$newFaqObj->setVar('modulelink', $_POST['modulelink']); |
|
140 | - //$newFaqObj->setVar('contextpage', $_POST['contextpage']); |
|
141 | 129 | |
142 | - // Setting the status of the FAQ |
|
143 | - |
|
144 | - // if user is admin, FAQ are automatically published |
|
145 | - $isAdmin = sf_userIsAdmin(); |
|
146 | - if ($isAdmin) { |
|
147 | - $newFaqObj->setVar('status', _SF_STATUS_PUBLISHED); |
|
148 | - } elseif ($xoopsModuleConfig['autoapprove_submitted_faq'] == 1) { |
|
149 | - $newFaqObj->setVar('status', _SF_STATUS_PUBLISHED); |
|
150 | - } else { |
|
151 | - $newFaqObj->setVar('status', _SF_STATUS_SUBMITTED); |
|
152 | - } |
|
130 | + $notifypub = isset($_POST['notifypub']) ? $_POST['notifypub'] : 0; |
|
131 | + |
|
132 | + // Putting the values about the FAQ in the FAQ object |
|
133 | + $newFaqObj->setVar('categoryid', $_POST['categoryid']); |
|
134 | + $newFaqObj->setVar('uid', $uid); |
|
135 | + $newFaqObj->setVar('question', $_POST['question']); |
|
136 | + $newFaqObj->setVar('howdoi', $_POST['howdoi']); |
|
137 | + $newFaqObj->setVar('diduno', $_POST['diduno']); |
|
138 | + $newFaqObj->setVar('notifypub', $notifypub); |
|
139 | + //$newFaqObj->setVar('modulelink', $_POST['modulelink']); |
|
140 | + //$newFaqObj->setVar('contextpage', $_POST['contextpage']); |
|
141 | + |
|
142 | + // Setting the status of the FAQ |
|
143 | + |
|
144 | + // if user is admin, FAQ are automatically published |
|
145 | + $isAdmin = sf_userIsAdmin(); |
|
146 | + if ($isAdmin) { |
|
147 | + $newFaqObj->setVar('status', _SF_STATUS_PUBLISHED); |
|
148 | + } elseif ($xoopsModuleConfig['autoapprove_submitted_faq'] == 1) { |
|
149 | + $newFaqObj->setVar('status', _SF_STATUS_PUBLISHED); |
|
150 | + } else { |
|
151 | + $newFaqObj->setVar('status', _SF_STATUS_SUBMITTED); |
|
152 | + } |
|
153 | 153 | |
154 | - // Storing the FAQ object in the database |
|
155 | - if (!$newFaqObj->store()) { |
|
156 | - redirect_header('javascript:history.go(-1)', 2, _MD_SF_SUBMIT_ERROR); |
|
157 | - } |
|
154 | + // Storing the FAQ object in the database |
|
155 | + if (!$newFaqObj->store()) { |
|
156 | + redirect_header('javascript:history.go(-1)', 2, _MD_SF_SUBMIT_ERROR); |
|
157 | + } |
|
158 | 158 | |
159 | - // Putting the values in the answer object |
|
160 | - $newAnswerObj->setVar('status', _SF_AN_STATUS_APPROVED); |
|
161 | - $newAnswerObj->setVar('faqid', $newFaqObj->faqid()); |
|
162 | - $newAnswerObj->setVar('answer', $_POST['answer']); |
|
163 | - $newAnswerObj->setVar('uid', $uid); |
|
164 | - |
|
165 | - //==================================================================================== |
|
166 | - //TODO post Attachment |
|
167 | - $attachments_tmp = []; |
|
168 | - if (!empty($_POST['attachments_tmp'])) { |
|
169 | - $attachments_tmp = unserialize(base64_decode($_POST['attachments_tmp'])); |
|
170 | - if (isset($_POST['delete_tmp']) && count($_POST['delete_tmp'])) { |
|
171 | - foreach ($_POST['delete_tmp'] as $key) { |
|
172 | - unlink(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attachments_tmp[$key][0]); |
|
173 | - unset($attachments_tmp[$key]); |
|
159 | + // Putting the values in the answer object |
|
160 | + $newAnswerObj->setVar('status', _SF_AN_STATUS_APPROVED); |
|
161 | + $newAnswerObj->setVar('faqid', $newFaqObj->faqid()); |
|
162 | + $newAnswerObj->setVar('answer', $_POST['answer']); |
|
163 | + $newAnswerObj->setVar('uid', $uid); |
|
164 | + |
|
165 | + //==================================================================================== |
|
166 | + //TODO post Attachment |
|
167 | + $attachments_tmp = []; |
|
168 | + if (!empty($_POST['attachments_tmp'])) { |
|
169 | + $attachments_tmp = unserialize(base64_decode($_POST['attachments_tmp'])); |
|
170 | + if (isset($_POST['delete_tmp']) && count($_POST['delete_tmp'])) { |
|
171 | + foreach ($_POST['delete_tmp'] as $key) { |
|
172 | + unlink(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attachments_tmp[$key][0]); |
|
173 | + unset($attachments_tmp[$key]); |
|
174 | + } |
|
174 | 175 | } |
175 | 176 | } |
176 | - } |
|
177 | - if (count($attachments_tmp)) { |
|
178 | - foreach ($attachments_tmp as $key => $attach) { |
|
179 | - if (rename(XOOPS_CACHE_PATH . '/' . $attachments_tmp[$key][0], XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attachments_tmp[$key][0])) { |
|
180 | - $post_obj->setAttachment($attach[0], $attach[1], $attach[2]); |
|
177 | + if (count($attachments_tmp)) { |
|
178 | + foreach ($attachments_tmp as $key => $attach) { |
|
179 | + if (rename(XOOPS_CACHE_PATH . '/' . $attachments_tmp[$key][0], XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attachments_tmp[$key][0])) { |
|
180 | + $post_obj->setAttachment($attach[0], $attach[1], $attach[2]); |
|
181 | + } |
|
181 | 182 | } |
182 | 183 | } |
183 | - } |
|
184 | - $error_upload = ''; |
|
184 | + $error_upload = ''; |
|
185 | 185 | |
186 | - if (isset($_FILES['userfile']['name']) && $_FILES['userfile']['name'] != '' |
|
187 | - && $topicHandler->getPermission($forum_obj, $topic_status, 'attach')) { |
|
188 | - require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/uploader.php'; |
|
189 | - $maxfilesize = $forum_obj->getVar('attach_maxkb') * 1024; |
|
190 | - $uploaddir = XOOPS_CACHE_PATH; |
|
186 | + if (isset($_FILES['userfile']['name']) && $_FILES['userfile']['name'] != '' |
|
187 | + && $topicHandler->getPermission($forum_obj, $topic_status, 'attach')) { |
|
188 | + require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/uploader.php'; |
|
189 | + $maxfilesize = $forum_obj->getVar('attach_maxkb') * 1024; |
|
190 | + $uploaddir = XOOPS_CACHE_PATH; |
|
191 | 191 | |
192 | - $uploader = new sfUploader($uploaddir, $newAnswerObj->getVar('attach_ext'), (int)$maxfilesize, (int)$xoopsModuleConfig['max_img_width'], (int)$xoopsModuleConfig['max_img_height']); |
|
192 | + $uploader = new sfUploader($uploaddir, $newAnswerObj->getVar('attach_ext'), (int)$maxfilesize, (int)$xoopsModuleConfig['max_img_width'], (int)$xoopsModuleConfig['max_img_height']); |
|
193 | 193 | |
194 | - if ($_FILES['userfile']['error'] > 0) { |
|
195 | - switch ($_FILES['userfile']['error']) { |
|
194 | + if ($_FILES['userfile']['error'] > 0) { |
|
195 | + switch ($_FILES['userfile']['error']) { |
|
196 | 196 | case 1: |
197 | 197 | $error_message[] = _MD_NEWBB_MAXUPLOADFILEINI; |
198 | 198 | break; |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | default: |
203 | 203 | $error_message[] = _MD_NEWBB_UPLOAD_ERRNODEF; |
204 | 204 | break; |
205 | - } |
|
205 | + } |
|
206 | 206 | } else { |
207 | 207 | $uploader->setCheckMediaTypeByExt(); |
208 | 208 | |
@@ -265,30 +265,30 @@ discard block |
||
265 | 265 | redirect_header('index.php', 2, $redirect_msg); |
266 | 266 | break; |
267 | 267 | |
268 | - case 'form': |
|
269 | - default: |
|
268 | + case 'form': |
|
269 | + default: |
|
270 | 270 | |
271 | - global $xoopsUser, $myts; |
|
271 | + global $xoopsUser, $myts; |
|
272 | 272 | |
273 | - $faqObj = $faqHandler->create(); |
|
274 | - $answerObj = $answerHandler->create(); |
|
275 | - $categoryObj = $categoryHandler->create(); |
|
273 | + $faqObj = $faqHandler->create(); |
|
274 | + $answerObj = $answerHandler->create(); |
|
275 | + $categoryObj = $categoryHandler->create(); |
|
276 | 276 | |
277 | - $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.html'; |
|
278 | - require_once XOOPS_ROOT_PATH . '/header.php'; |
|
279 | - require_once __DIR__ . '/footer.php'; |
|
277 | + $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.html'; |
|
278 | + require_once XOOPS_ROOT_PATH . '/header.php'; |
|
279 | + require_once __DIR__ . '/footer.php'; |
|
280 | 280 | |
281 | - $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous'; |
|
282 | - $notifypub = 1; |
|
283 | - $moduleName =& $myts->displayTarea($xoopsModule->getVar('name')); |
|
284 | - $xoopsTpl->assign('whereInSection', $moduleName); |
|
285 | - $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME); |
|
281 | + $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous'; |
|
282 | + $notifypub = 1; |
|
283 | + $moduleName =& $myts->displayTarea($xoopsModule->getVar('name')); |
|
284 | + $xoopsTpl->assign('whereInSection', $moduleName); |
|
285 | + $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME); |
|
286 | 286 | |
287 | - $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name()))); |
|
288 | - $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO); |
|
287 | + $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name()))); |
|
288 | + $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO); |
|
289 | 289 | |
290 | - require_once __DIR__ . '/include/submit.inc.php'; |
|
290 | + require_once __DIR__ . '/include/submit.inc.php'; |
|
291 | 291 | |
292 | - require_once XOOPS_ROOT_PATH . '/footer.php'; |
|
293 | - break; |
|
292 | + require_once XOOPS_ROOT_PATH . '/footer.php'; |
|
293 | + break; |
|
294 | 294 | } |