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