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