Passed
Branch master (4e30dc)
by Michael
02:20
created
class/Common/FilesManagement.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
                     throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder));
34 34
                 }
35 35
 
36
-                file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>');
36
+                file_put_contents($folder.'/index.html', '<script>history.go(-1);</script>');
37 37
             }
38 38
         } catch (\Exception $e) {
39 39
             echo 'Caught exception: ', $e->getMessage(), "\n", '<br>';
@@ -61,10 +61,10 @@  discard block
 block discarded – undo
61 61
         if (!mkdir($dst) && !is_dir($dst)) {
62 62
             while (false !== ($file = readdir($dir))) {
63 63
                 if (('.' !== $file) && ('..' !== $file)) {
64
-                    if (is_dir($src . '/' . $file)) {
65
-                        self::recurseCopy($src . '/' . $file, $dst . '/' . $file);
64
+                    if (is_dir($src.'/'.$file)) {
65
+                        self::recurseCopy($src.'/'.$file, $dst.'/'.$file);
66 66
                     } else {
67
-                        copy($src . '/' . $file, $dst . '/' . $file);
67
+                        copy($src.'/'.$file, $dst.'/'.$file);
68 68
                     }
69 69
                 }
70 70
             }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
                 self::rrmdir($fObj->getPathname());
160 160
             }
161 161
         }
162
-        $iterator = null;   // clear iterator Obj to close file/directory
162
+        $iterator = null; // clear iterator Obj to close file/directory
163 163
         return rmdir($src); // remove the directory & return results
164 164
     }
165 165
 
@@ -192,14 +192,14 @@  discard block
 block discarded – undo
192 192
         $iterator = new \DirectoryIterator($src);
193 193
         foreach ($iterator as $fObj) {
194 194
             if ($fObj->isFile()) {
195
-                rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
195
+                rename($fObj->getPathname(), "{$dest}/".$fObj->getFilename());
196 196
             } elseif (!$fObj->isDot() && $fObj->isDir()) {
197 197
                 // Try recursively on directory
198
-                self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
198
+                self::rmove($fObj->getPathname(), "{$dest}/".$fObj->getFilename());
199 199
                 //                rmdir($fObj->getPath()); // now delete the directory
200 200
             }
201 201
         }
202
-        $iterator = null;   // clear iterator Obj to close file/directory
202
+        $iterator = null; // clear iterator Obj to close file/directory
203 203
         return rmdir($src); // remove the directory & return results
204 204
     }
205 205
 
@@ -235,9 +235,9 @@  discard block
 block discarded – undo
235 235
         $iterator = new \DirectoryIterator($src);
236 236
         foreach ($iterator as $fObj) {
237 237
             if ($fObj->isFile()) {
238
-                copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
238
+                copy($fObj->getPathname(), "{$dest}/".$fObj->getFilename());
239 239
             } elseif (!$fObj->isDot() && $fObj->isDir()) {
240
-                self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
240
+                self::rcopy($fObj->getPathname(), "{$dest}/".$fObj->getFilename());
241 241
             }
242 242
         }
243 243
         return true;
Please login to merge, or discard this patch.
class/GroupFormCheckBox.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
 
28 28
 // defined('XOOPS_ROOT_PATH') || die('Restricted access');
29 29
 
30
-require_once XOOPS_ROOT_PATH . '/class/xoopsform/formelement.php';
31
-require_once XOOPS_ROOT_PATH . '/class/xoopsform/formhidden.php';
32
-require_once XOOPS_ROOT_PATH . '/class/xoopsform/formhiddentoken.php';
33
-require_once XOOPS_ROOT_PATH . '/class/xoopsform/formbutton.php';
34
-require_once XOOPS_ROOT_PATH . '/class/xoopsform/formelementtray.php';
35
-require_once XOOPS_ROOT_PATH . '/class/xoopsform/form.php';
30
+require_once XOOPS_ROOT_PATH.'/class/xoopsform/formelement.php';
31
+require_once XOOPS_ROOT_PATH.'/class/xoopsform/formhidden.php';
32
+require_once XOOPS_ROOT_PATH.'/class/xoopsform/formhiddentoken.php';
33
+require_once XOOPS_ROOT_PATH.'/class/xoopsform/formbutton.php';
34
+require_once XOOPS_ROOT_PATH.'/class/xoopsform/formelementtray.php';
35
+require_once XOOPS_ROOT_PATH.'/class/xoopsform/form.php';
36 36
 
37 37
 /**
38 38
  * Renders checkbox options for a group permission form
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public function setOptionTree(&$optionTree)
111 111
     {
112
-        $this->_optionTree =& $optionTree;
112
+        $this->_optionTree = & $optionTree;
113 113
     }
114 114
 
115 115
     /**
@@ -134,34 +134,34 @@  discard block
 block discarded – undo
134 134
         $ret = '';
135 135
 
136 136
         if (count($this->_appendix) > 0) {
137
-            $ret  .= '<table class="outer"><tr>';
137
+            $ret .= '<table class="outer"><tr>';
138 138
             $cols = 1;
139 139
             foreach ($this->_appendix as $append) {
140 140
                 if ($cols > 4) {
141
-                    $ret  .= '</tr><tr>';
141
+                    $ret .= '</tr><tr>';
142 142
                     $cols = 1;
143 143
                 }
144 144
                 $checked = $append['selected'] ? 'checked' : '';
145
-                $name    = 'perms[' . $append['permname'] . ']';
145
+                $name    = 'perms['.$append['permname'].']';
146 146
                 $itemid  = $append['itemid'];
147 147
                 $itemid  = $append['itemid'];
148
-                $ret     .= "<td class=\"odd\"><input type=\"checkbox\" name=\"{$name}[groups][$this->_groupId][$itemid]\" id=\"{$name}[groups][$this->_groupId][$itemid]\" value=\"1\" $checked>{$append['itemname']}<input type=\"hidden\" name=\"{$name}[parents][$itemid]\" value=\"\"><input type=\"hidden\" name=\"{$name}[itemname][$itemid]\" value=\"{$append['itemname']}\"><br></td>";
148
+                $ret .= "<td class=\"odd\"><input type=\"checkbox\" name=\"{$name}[groups][$this->_groupId][$itemid]\" id=\"{$name}[groups][$this->_groupId][$itemid]\" value=\"1\" $checked>{$append['itemname']}<input type=\"hidden\" name=\"{$name}[parents][$itemid]\" value=\"\"><input type=\"hidden\" name=\"{$name}[itemname][$itemid]\" value=\"{$append['itemname']}\"><br></td>";
149 149
                 ++$cols;
150 150
             }
151 151
             $ret .= '</tr></table>';
152 152
         }
153 153
 
154
-        $ret  .= '<table class="outer"><tr>';
154
+        $ret .= '<table class="outer"><tr>';
155 155
         $cols = 1;
156 156
         foreach ($this->_optionTree[0]['children'] as $topitem) {
157 157
             if ($cols > 4) {
158
-                $ret  .= '</tr><tr>';
158
+                $ret .= '</tr><tr>';
159 159
                 $cols = 1;
160 160
             }
161 161
             $tree   = '<td class="odd">';
162 162
             $prefix = '';
163 163
             $this->renderOptionTree($tree, $this->_optionTree[$topitem], $prefix);
164
-            $ret .= $tree . '</td>';
164
+            $ret .= $tree.'</td>';
165 165
             ++$cols;
166 166
         }
167 167
         $ret .= '</tr></table>';
@@ -180,21 +180,21 @@  discard block
 block discarded – undo
180 180
      */
181 181
     private function renderOptionTree(&$tree, $option, $prefix, $parentIds = [])
182 182
     {
183
-        $tree .= $prefix . '<input type="checkbox" name="' . $this->getName() . '[groups][' . $this->_groupId . '][' . $option['id'] . ']" id="' . $this->getName() . '[groups][' . $this->_groupId . '][' . $option['id'] . ']" onclick="';
183
+        $tree .= $prefix.'<input type="checkbox" name="'.$this->getName().'[groups]['.$this->_groupId.']['.$option['id'].']" id="'.$this->getName().'[groups]['.$this->_groupId.']['.$option['id'].']" onclick="';
184 184
         // If there are parent elements, add javascript that will
185 185
         // make them selecteded when this element is checked to make
186 186
         // sure permissions to parent items are added as well.
187 187
         foreach ($parentIds as $pid) {
188
-            $parent_ele = $this->getName() . '[groups][' . $this->_groupId . '][' . $pid . ']';
189
-            $tree       .= "var ele = xoopsGetElementById('" . $parent_ele . "'); if (ele.checked !== true) {ele.checked = this.checked;}";
188
+            $parent_ele = $this->getName().'[groups]['.$this->_groupId.']['.$pid.']';
189
+            $tree .= "var ele = xoopsGetElementById('".$parent_ele."'); if (ele.checked !== true) {ele.checked = this.checked;}";
190 190
         }
191 191
         // If there are child elements, add javascript that will
192 192
         // make them unchecked when this element is unchecked to make
193 193
         // sure permissions to child items are not added when there
194 194
         // is no permission to this item.
195 195
         foreach ($option['allchild'] as $cid) {
196
-            $child_ele = $this->getName() . '[groups][' . $this->_groupId . '][' . $cid . ']';
197
-            $tree      .= "var ele = xoopsGetElementById('" . $child_ele . "'); if (this.checked !== true) {ele.checked = false;}";
196
+            $child_ele = $this->getName().'[groups]['.$this->_groupId.']['.$cid.']';
197
+            $tree .= "var ele = xoopsGetElementById('".$child_ele."'); if (this.checked !== true) {ele.checked = false;}";
198 198
         }
199 199
         $tree .= '" value="1"';
200 200
         if (null !== $this->_value && in_array($option['id'], $this->_value)) {
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
         if (isset($option['children'])) {
219 219
             foreach ($option['children'] as $child) {
220 220
                 array_push($parentIds, $option['id']);
221
-                $this->renderOptionTree($tree, $this->_optionTree[$child], $prefix . '&nbsp;-', $parentIds);
221
+                $this->renderOptionTree($tree, $this->_optionTree[$child], $prefix.'&nbsp;-', $parentIds);
222 222
             }
223 223
         }
224 224
     }
Please login to merge, or discard this patch.
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -379,20 +379,20 @@
 block discarded – undo
379 379
             $tree .= ' checked';
380 380
         }
381 381
         $tree .= '>'
382
-                 . $option['name']
383
-                 . '<input type="hidden" name="'
384
-                 . $this->getName()
385
-                 . '[parents]['
386
-                 . $option['id']
387
-                 . ']" value="'
388
-                 . implode(':', $parentIds)
389
-                 . '"><input type="hidden" name="'
390
-                 . $this->getName()
391
-                 . '[itemname]['
392
-                 . $option['id']
393
-                 . ']" value="'
394
-                 . htmlspecialchars($option['name'], ENT_QUOTES)
395
-                 . "\"><br>\n";
382
+                    . $option['name']
383
+                    . '<input type="hidden" name="'
384
+                    . $this->getName()
385
+                    . '[parents]['
386
+                    . $option['id']
387
+                    . ']" value="'
388
+                    . implode(':', $parentIds)
389
+                    . '"><input type="hidden" name="'
390
+                    . $this->getName()
391
+                    . '[itemname]['
392
+                    . $option['id']
393
+                    . ']" value="'
394
+                    . htmlspecialchars($option['name'], ENT_QUOTES)
395
+                    . "\"><br>\n";
396 396
         if (isset($option['children'])) {
397 397
             foreach ($option['children'] as $child) {
398 398
                 array_push($parentIds, $option['id']);
Please login to merge, or discard this patch.
submit.php 2 patches
Switch Indentation   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -52,153 +52,153 @@  discard block
 block discarded – undo
52 52
 }
53 53
 
54 54
 switch ($op) {
55
-    case 'preview':
55
+        case 'preview':
56 56
 
57
-        global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsDB;
57
+            global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsDB;
58 58
 
59
-        $faqObj      = $faqHandler->create();
60
-        $answerObj   = $answerHandler->create();
61
-        $categoryObj = $categoryHandler->get($_POST['categoryid']);
59
+            $faqObj      = $faqHandler->create();
60
+            $answerObj   = $answerHandler->create();
61
+            $categoryObj = $categoryHandler->get($_POST['categoryid']);
62 62
 
63
-        if (!$xoopsUser) {
64
-            if (1 == $xoopsModuleConfig['anonpost']) {
65
-                $uid = 0;
63
+            if (!$xoopsUser) {
64
+                if (1 == $xoopsModuleConfig['anonpost']) {
65
+                    $uid = 0;
66
+                } else {
67
+                    redirect_header('index.php', 3, _NOPERM);
68
+                }
66 69
             } else {
67
-                redirect_header('index.php', 3, _NOPERM);
70
+                $uid = $xoopsUser->uid();
68 71
             }
69
-        } else {
70
-            $uid = $xoopsUser->uid();
71
-        }
72 72
 
73
-        $notifypub = isset($_POST['notifypub']) ? $_POST['notifypub'] : 0;
73
+            $notifypub = isset($_POST['notifypub']) ? $_POST['notifypub'] : 0;
74 74
 
75
-        // Putting the values about the FAQ in the FAQ object
76
-        $faqObj->setVar('categoryid', $_POST['categoryid']);
77
-        $faqObj->setVar('uid', $uid);
78
-        $faqObj->setVar('question', $_POST['question']);
79
-        $faqObj->setVar('howdoi', $_POST['howdoi']);
80
-        $faqObj->setVar('diduno', $_POST['diduno']);
81
-        $faqObj->setVar('datesub', time());
75
+            // Putting the values about the FAQ in the FAQ object
76
+            $faqObj->setVar('categoryid', $_POST['categoryid']);
77
+            $faqObj->setVar('uid', $uid);
78
+            $faqObj->setVar('question', $_POST['question']);
79
+            $faqObj->setVar('howdoi', $_POST['howdoi']);
80
+            $faqObj->setVar('diduno', $_POST['diduno']);
81
+            $faqObj->setVar('datesub', time());
82 82
 
83
-        // Putting the values in the answer object
84
-        $answerObj->setVar('status', Constants::SF_AN_STATUS_APPROVED);
85
-        $answerObj->setVar('faqid', $faqObj->faqid());
86
-        $answerObj->setVar('answer', $_POST['answer']);
87
-        $answerObj->setVar('uid', $uid);
83
+            // Putting the values in the answer object
84
+            $answerObj->setVar('status', Constants::SF_AN_STATUS_APPROVED);
85
+            $answerObj->setVar('faqid', $faqObj->faqid());
86
+            $answerObj->setVar('answer', $_POST['answer']);
87
+            $answerObj->setVar('uid', $uid);
88 88
 
89
-        global $xoopsUser, $myts;
89
+            global $xoopsUser, $myts;
90 90
 
91
-        $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.tpl';
92
-        require_once XOOPS_ROOT_PATH . '/header.php';
93
-        require_once __DIR__ . '/footer.php';
91
+            $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.tpl';
92
+            require_once XOOPS_ROOT_PATH . '/header.php';
93
+            require_once __DIR__ . '/footer.php';
94 94
 
95
-        $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous';
95
+            $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous';
96 96
 
97
-        $moduleName          =& $myts->displayTarea($xoopsModule->getVar('name'));
98
-        $faq                 = $faqObj->toArray(null, $categoryObj, false);
99
-        $faq['categoryPath'] = $categoryObj->getCategoryPath(true);
100
-        $faq['answer']       = $answerObj->answer();
101
-        $faq['who_when']     = $faqObj->getWhoAndWhen();
97
+            $moduleName          =& $myts->displayTarea($xoopsModule->getVar('name'));
98
+            $faq                 = $faqObj->toArray(null, $categoryObj, false);
99
+            $faq['categoryPath'] = $categoryObj->getCategoryPath(true);
100
+            $faq['answer']       = $answerObj->answer();
101
+            $faq['who_when']     = $faqObj->getWhoAndWhen();
102 102
 
103
-        $faq['comments'] = -1;
104
-        $xoopsTpl->assign('faq', $faq);
105
-        $xoopsTpl->assign('op', 'preview');
106
-        $xoopsTpl->assign('whereInSection', $moduleName);
107
-        $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME);
103
+            $faq['comments'] = -1;
104
+            $xoopsTpl->assign('faq', $faq);
105
+            $xoopsTpl->assign('op', 'preview');
106
+            $xoopsTpl->assign('whereInSection', $moduleName);
107
+            $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME);
108 108
 
109
-        $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name())));
110
-        $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO);
109
+            $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name())));
110
+            $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO);
111 111
 
112
-        require_once __DIR__ . '/include/submit.inc.php';
112
+            require_once __DIR__ . '/include/submit.inc.php';
113 113
 
114
-        require_once XOOPS_ROOT_PATH . '/footer.php';
114
+            require_once XOOPS_ROOT_PATH . '/footer.php';
115 115
 
116
-        exit();
117
-        break;
116
+            exit();
117
+            break;
118 118
 
119
-    case 'post':
119
+        case 'post':
120 120
 
121
-        global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsDB;
121
+            global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsDB;
122 122
 
123
-        $newFaqObj    = $faqHandler->create();
124
-        $newAnswerObj = $answerHandler->create();
123
+            $newFaqObj    = $faqHandler->create();
124
+            $newAnswerObj = $answerHandler->create();
125 125
 
126
-        if (!$xoopsUser) {
127
-            if (1 == $xoopsModuleConfig['anonpost']) {
128
-                $uid = 0;
126
+            if (!$xoopsUser) {
127
+                if (1 == $xoopsModuleConfig['anonpost']) {
128
+                    $uid = 0;
129
+                } else {
130
+                    redirect_header('index.php', 3, _NOPERM);
131
+                }
129 132
             } else {
130
-                redirect_header('index.php', 3, _NOPERM);
133
+                $uid = $xoopsUser->uid();
131 134
             }
132
-        } else {
133
-            $uid = $xoopsUser->uid();
134
-        }
135
-
136
-        $notifypub = isset($_POST['notifypub']) ? $_POST['notifypub'] : 0;
137
-
138
-        // Putting the values about the FAQ in the FAQ object
139
-        $newFaqObj->setVar('categoryid', $_POST['categoryid']);
140
-        $newFaqObj->setVar('uid', $uid);
141
-        $newFaqObj->setVar('question', $_POST['question']);
142
-        $newFaqObj->setVar('howdoi', $_POST['howdoi']);
143
-        $newFaqObj->setVar('diduno', $_POST['diduno']);
144
-        $newFaqObj->setVar('notifypub', $notifypub);
145
-        //$newFaqObj->setVar('modulelink', $_POST['modulelink']);
146
-        //$newFaqObj->setVar('contextpage', $_POST['contextpage']);
147 135
 
148
-        // Setting the status of the FAQ
149
-
150
-        // if user is admin, FAQ are automatically published
151
-        $isAdmin = Smartfaq\Utility::userIsAdmin();
152
-        if ($isAdmin) {
153
-            $newFaqObj->setVar('status', Constants::SF_STATUS_PUBLISHED);
154
-        } elseif (1 == $xoopsModuleConfig['autoapprove_submitted_faq']) {
155
-            $newFaqObj->setVar('status', Constants::SF_STATUS_PUBLISHED);
156
-        } else {
157
-            $newFaqObj->setVar('status', Constants::SF_STATUS_SUBMITTED);
158
-        }
136
+            $notifypub = isset($_POST['notifypub']) ? $_POST['notifypub'] : 0;
137
+
138
+            // Putting the values about the FAQ in the FAQ object
139
+            $newFaqObj->setVar('categoryid', $_POST['categoryid']);
140
+            $newFaqObj->setVar('uid', $uid);
141
+            $newFaqObj->setVar('question', $_POST['question']);
142
+            $newFaqObj->setVar('howdoi', $_POST['howdoi']);
143
+            $newFaqObj->setVar('diduno', $_POST['diduno']);
144
+            $newFaqObj->setVar('notifypub', $notifypub);
145
+            //$newFaqObj->setVar('modulelink', $_POST['modulelink']);
146
+            //$newFaqObj->setVar('contextpage', $_POST['contextpage']);
147
+
148
+            // Setting the status of the FAQ
149
+
150
+            // if user is admin, FAQ are automatically published
151
+            $isAdmin = Smartfaq\Utility::userIsAdmin();
152
+            if ($isAdmin) {
153
+                $newFaqObj->setVar('status', Constants::SF_STATUS_PUBLISHED);
154
+            } elseif (1 == $xoopsModuleConfig['autoapprove_submitted_faq']) {
155
+                $newFaqObj->setVar('status', Constants::SF_STATUS_PUBLISHED);
156
+            } else {
157
+                $newFaqObj->setVar('status', Constants::SF_STATUS_SUBMITTED);
158
+            }
159 159
 
160
-        // Storing the FAQ object in the database
161
-        if (!$newFaqObj->store()) {
162
-            redirect_header('javascript:history.go(-1)', 2, _MD_SF_SUBMIT_ERROR);
163
-        }
160
+            // Storing the FAQ object in the database
161
+            if (!$newFaqObj->store()) {
162
+                redirect_header('javascript:history.go(-1)', 2, _MD_SF_SUBMIT_ERROR);
163
+            }
164 164
 
165
-        // Putting the values in the answer object
166
-        $newAnswerObj->setVar('status', Constants::SF_AN_STATUS_APPROVED);
167
-        $newAnswerObj->setVar('faqid', $newFaqObj->faqid());
168
-        $newAnswerObj->setVar('answer', $_POST['answer']);
169
-        $newAnswerObj->setVar('uid', $uid);
170
-
171
-        //====================================================================================
172
-        //TODO post Attachment
173
-        $attachments_tmp = [];
174
-        if (!empty($_POST['attachments_tmp'])) {
175
-            $attachments_tmp = unserialize(base64_decode($_POST['attachments_tmp']));
176
-            if (isset($_POST['delete_tmp']) && count($_POST['delete_tmp'])) {
177
-                foreach ($_POST['delete_tmp'] as $key) {
178
-                    unlink(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attachments_tmp[$key][0]);
179
-                    unset($attachments_tmp[$key]);
165
+            // Putting the values in the answer object
166
+            $newAnswerObj->setVar('status', Constants::SF_AN_STATUS_APPROVED);
167
+            $newAnswerObj->setVar('faqid', $newFaqObj->faqid());
168
+            $newAnswerObj->setVar('answer', $_POST['answer']);
169
+            $newAnswerObj->setVar('uid', $uid);
170
+
171
+            //====================================================================================
172
+            //TODO post Attachment
173
+            $attachments_tmp = [];
174
+            if (!empty($_POST['attachments_tmp'])) {
175
+                $attachments_tmp = unserialize(base64_decode($_POST['attachments_tmp']));
176
+                if (isset($_POST['delete_tmp']) && count($_POST['delete_tmp'])) {
177
+                    foreach ($_POST['delete_tmp'] as $key) {
178
+                        unlink(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attachments_tmp[$key][0]);
179
+                        unset($attachments_tmp[$key]);
180
+                    }
180 181
                 }
181 182
             }
182
-        }
183
-        if (count($attachments_tmp)) {
184
-            foreach ($attachments_tmp as $key => $attach) {
185
-                if (rename(XOOPS_CACHE_PATH . '/' . $attachments_tmp[$key][0], XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attachments_tmp[$key][0])) {
186
-                    $post_obj->setAttachment($attach[0], $attach[1], $attach[2]);
183
+            if (count($attachments_tmp)) {
184
+                foreach ($attachments_tmp as $key => $attach) {
185
+                    if (rename(XOOPS_CACHE_PATH . '/' . $attachments_tmp[$key][0], XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attachments_tmp[$key][0])) {
186
+                        $post_obj->setAttachment($attach[0], $attach[1], $attach[2]);
187
+                    }
187 188
                 }
188 189
             }
189
-        }
190
-        $error_upload = '';
190
+            $error_upload = '';
191 191
 
192
-        if (isset($_FILES['userfile']['name']) && '' != $_FILES['userfile']['name']
193
-            && $topicHandler->getPermission($forum_obj, $topic_status, 'attach')) {
194
-            require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/uploader.php';
195
-            $maxfilesize = $forum_obj->getVar('attach_maxkb') * 1024;
196
-            $uploaddir   = XOOPS_CACHE_PATH;
192
+            if (isset($_FILES['userfile']['name']) && '' != $_FILES['userfile']['name']
193
+                && $topicHandler->getPermission($forum_obj, $topic_status, 'attach')) {
194
+                require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/uploader.php';
195
+                $maxfilesize = $forum_obj->getVar('attach_maxkb') * 1024;
196
+                $uploaddir   = XOOPS_CACHE_PATH;
197 197
 
198
-            $uploader = new Smartfaq\Uploader($uploaddir, $newAnswerObj->getVar('attach_ext'), (int)$maxfilesize, (int)$xoopsModuleConfig['max_img_width'], (int)$xoopsModuleConfig['max_img_height']);
198
+                $uploader = new Smartfaq\Uploader($uploaddir, $newAnswerObj->getVar('attach_ext'), (int)$maxfilesize, (int)$xoopsModuleConfig['max_img_width'], (int)$xoopsModuleConfig['max_img_height']);
199 199
 
200
-            if ($_FILES['userfile']['error'] > 0) {
201
-                switch ($_FILES['userfile']['error']) {
200
+                if ($_FILES['userfile']['error'] > 0) {
201
+                    switch ($_FILES['userfile']['error']) {
202 202
                     case 1:
203 203
                         $error_message[] = _MD_NEWBB_MAXUPLOADFILEINI;
204 204
                         break;
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
                     default:
209 209
                         $error_message[] = _MD_NEWBB_UPLOAD_ERRNODEF;
210 210
                         break;
211
-                }
211
+                    }
212 212
             } else {
213 213
                 $uploader->setCheckMediaTypeByExt();
214 214
 
@@ -271,30 +271,30 @@  discard block
 block discarded – undo
271 271
         redirect_header('index.php', 2, $redirect_msg);
272 272
         break;
273 273
 
274
-    case 'form':
275
-    default:
274
+        case 'form':
275
+        default:
276 276
 
277
-        global $xoopsUser, $myts;
277
+            global $xoopsUser, $myts;
278 278
 
279
-        $faqObj      = $faqHandler->create();
280
-        $answerObj   = $answerHandler->create();
281
-        $categoryObj = $categoryHandler->create();
279
+            $faqObj      = $faqHandler->create();
280
+            $answerObj   = $answerHandler->create();
281
+            $categoryObj = $categoryHandler->create();
282 282
 
283
-        $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.html';
284
-        require_once XOOPS_ROOT_PATH . '/header.php';
285
-        require_once __DIR__ . '/footer.php';
283
+            $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.html';
284
+            require_once XOOPS_ROOT_PATH . '/header.php';
285
+            require_once __DIR__ . '/footer.php';
286 286
 
287
-        $name       = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous';
288
-        $notifypub  = 1;
289
-        $moduleName =& $myts->displayTarea($xoopsModule->getVar('name'));
290
-        $xoopsTpl->assign('whereInSection', $moduleName);
291
-        $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME);
287
+            $name       = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous';
288
+            $notifypub  = 1;
289
+            $moduleName =& $myts->displayTarea($xoopsModule->getVar('name'));
290
+            $xoopsTpl->assign('whereInSection', $moduleName);
291
+            $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME);
292 292
 
293
-        $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name())));
294
-        $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO);
293
+            $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name())));
294
+            $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO);
295 295
 
296
-        require_once __DIR__ . '/include/submit.inc.php';
296
+            require_once __DIR__ . '/include/submit.inc.php';
297 297
 
298
-        require_once XOOPS_ROOT_PATH . '/footer.php';
299
-        break;
298
+            require_once XOOPS_ROOT_PATH . '/footer.php';
299
+            break;
300 300
 }
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 use XoopsModules\Smartfaq;
10 10
 use XoopsModules\Smartfaq\Constants;
11 11
 
12
-require_once __DIR__ . '/header.php';
12
+require_once __DIR__.'/header.php';
13 13
 
14 14
 global $xoopsUser, $xoopsConfig, $xoopsModuleConfig, $xoopsModule;
15 15
 
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
         global $xoopsUser, $myts;
90 90
 
91 91
         $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.tpl';
92
-        require_once XOOPS_ROOT_PATH . '/header.php';
93
-        require_once __DIR__ . '/footer.php';
92
+        require_once XOOPS_ROOT_PATH.'/header.php';
93
+        require_once __DIR__.'/footer.php';
94 94
 
95 95
         $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous';
96 96
 
97
-        $moduleName          =& $myts->displayTarea($xoopsModule->getVar('name'));
97
+        $moduleName          = & $myts->displayTarea($xoopsModule->getVar('name'));
98 98
         $faq                 = $faqObj->toArray(null, $categoryObj, false);
99 99
         $faq['categoryPath'] = $categoryObj->getCategoryPath(true);
100 100
         $faq['answer']       = $answerObj->answer();
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
         $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME);
108 108
 
109 109
         $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name())));
110
-        $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO);
110
+        $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY."<b>$name</b>, "._MD_SF_SUB_INTRO);
111 111
 
112
-        require_once __DIR__ . '/include/submit.inc.php';
112
+        require_once __DIR__.'/include/submit.inc.php';
113 113
 
114
-        require_once XOOPS_ROOT_PATH . '/footer.php';
114
+        require_once XOOPS_ROOT_PATH.'/footer.php';
115 115
 
116 116
         exit();
117 117
         break;
@@ -175,14 +175,14 @@  discard block
 block discarded – undo
175 175
             $attachments_tmp = unserialize(base64_decode($_POST['attachments_tmp']));
176 176
             if (isset($_POST['delete_tmp']) && count($_POST['delete_tmp'])) {
177 177
                 foreach ($_POST['delete_tmp'] as $key) {
178
-                    unlink(XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attachments_tmp[$key][0]);
178
+                    unlink(XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/'.$attachments_tmp[$key][0]);
179 179
                     unset($attachments_tmp[$key]);
180 180
                 }
181 181
             }
182 182
         }
183 183
         if (count($attachments_tmp)) {
184 184
             foreach ($attachments_tmp as $key => $attach) {
185
-                if (rename(XOOPS_CACHE_PATH . '/' . $attachments_tmp[$key][0], XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $attachments_tmp[$key][0])) {
185
+                if (rename(XOOPS_CACHE_PATH.'/'.$attachments_tmp[$key][0], XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/'.$attachments_tmp[$key][0])) {
186 186
                     $post_obj->setAttachment($attach[0], $attach[1], $attach[2]);
187 187
                 }
188 188
             }
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 
192 192
         if (isset($_FILES['userfile']['name']) && '' != $_FILES['userfile']['name']
193 193
             && $topicHandler->getPermission($forum_obj, $topic_status, 'attach')) {
194
-            require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/class/uploader.php';
194
+            require_once XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname', 'n').'/class/uploader.php';
195 195
             $maxfilesize = $forum_obj->getVar('attach_maxkb') * 1024;
196 196
             $uploaddir   = XOOPS_CACHE_PATH;
197 197
 
@@ -213,19 +213,19 @@  discard block
 block discarded – undo
213 213
                 $uploader->setCheckMediaTypeByExt();
214 214
 
215 215
                 if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
216
-                    $prefix = is_object($xoopsUser) ? (string)$xoopsUser->uid() . '_' : 'newbb_';
216
+                    $prefix = is_object($xoopsUser) ? (string)$xoopsUser->uid().'_' : 'newbb_';
217 217
                     $uploader->setPrefix($prefix);
218 218
                     if (!$uploader->upload()) {
219
-                        $error_message[] = $error_upload =& $uploader->getErrors();
219
+                        $error_message[] = $error_upload = & $uploader->getErrors();
220 220
                     } else {
221 221
                         if (is_file($uploader->getSavedDestination())) {
222
-                            if (rename(XOOPS_CACHE_PATH . '/' . $uploader->getSavedFileName(), XOOPS_ROOT_PATH . '/' . $xoopsModuleConfig['dir_attachments'] . '/' . $uploader->getSavedFileName())) {
222
+                            if (rename(XOOPS_CACHE_PATH.'/'.$uploader->getSavedFileName(), XOOPS_ROOT_PATH.'/'.$xoopsModuleConfig['dir_attachments'].'/'.$uploader->getSavedFileName())) {
223 223
                                 $post_obj->setAttachment($uploader->getSavedFileName(), $uploader->getMediaName(), $uploader->getMediaType());
224 224
                             }
225 225
                         }
226 226
                     }
227 227
                 } else {
228
-                    $error_message[] = $error_upload =& $uploader->getErrors();
228
+                    $error_message[] = $error_upload = & $uploader->getErrors();
229 229
                 }
230 230
             }
231 231
         }
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
         } else {
259 259
             // Subscribe the user to On Published notification, if requested
260 260
             if (1 == $notifypub) {
261
-                require_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
261
+                require_once XOOPS_ROOT_PATH.'/include/notification_constants.php';
262 262
                 $notificationHandler = xoops_getHandler('notification');
263 263
                 $notificationHandler->subscribe('faq', $newFaqObj->faqid(), 'approved', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE);
264 264
             }
@@ -281,20 +281,20 @@  discard block
 block discarded – undo
281 281
         $categoryObj = $categoryHandler->create();
282 282
 
283 283
         $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.html';
284
-        require_once XOOPS_ROOT_PATH . '/header.php';
285
-        require_once __DIR__ . '/footer.php';
284
+        require_once XOOPS_ROOT_PATH.'/header.php';
285
+        require_once __DIR__.'/footer.php';
286 286
 
287 287
         $name       = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous';
288 288
         $notifypub  = 1;
289
-        $moduleName =& $myts->displayTarea($xoopsModule->getVar('name'));
289
+        $moduleName = & $myts->displayTarea($xoopsModule->getVar('name'));
290 290
         $xoopsTpl->assign('whereInSection', $moduleName);
291 291
         $xoopsTpl->assign('lang_submit', _MD_SF_SUB_SNEWNAME);
292 292
 
293 293
         $xoopsTpl->assign('lang_intro_title', sprintf(_MD_SF_SUB_SNEWNAME, ucwords($xoopsModule->name())));
294
-        $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . _MD_SF_SUB_INTRO);
294
+        $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY."<b>$name</b>, "._MD_SF_SUB_INTRO);
295 295
 
296
-        require_once __DIR__ . '/include/submit.inc.php';
296
+        require_once __DIR__.'/include/submit.inc.php';
297 297
 
298
-        require_once XOOPS_ROOT_PATH . '/footer.php';
298
+        require_once XOOPS_ROOT_PATH.'/footer.php';
299 299
         break;
300 300
 }
Please login to merge, or discard this patch.
preloads/autoloader.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,12 +3,12 @@  discard block
 block discarded – undo
3 3
 /**
4 4
  * @see http://www.php-fig.org/psr/psr-4/examples/
5 5
  */
6
-spl_autoload_register(function ($class) {
6
+spl_autoload_register(function($class) {
7 7
     // project-specific namespace prefix
8
-    $prefix = 'XoopsModules\\' . ucfirst(basename(dirname(__DIR__)));
8
+    $prefix = 'XoopsModules\\'.ucfirst(basename(dirname(__DIR__)));
9 9
 
10 10
     // base directory for the namespace prefix
11
-    $base_dir = __DIR__ . '/../class/';
11
+    $base_dir = __DIR__.'/../class/';
12 12
 
13 13
     // does the class use the namespace prefix?
14 14
     $len      = strlen($prefix);
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     // replace the namespace prefix with the base directory, replace namespace
24 24
     // separators with directory separators in the relative class name, append
25 25
     // with .php
26
-    $file           = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
26
+    $file = $base_dir.str_replace('\\', '/', $relative_class).'.php';
27 27
 
28 28
     // if the file exists, require it
29 29
     if (file_exists($file)) {
Please login to merge, or discard this patch.
preloads/core.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,6 +28,6 @@
 block discarded – undo
28 28
      */
29 29
     public static function eventCoreIncludeCommonEnd($args)
30 30
     {
31
-        include __DIR__ . '/autoloader.php';
31
+        include __DIR__.'/autoloader.php';
32 32
     }
33 33
 }
Please login to merge, or discard this patch.
language/english/common.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -21,51 +21,51 @@
 block discarded – undo
21 21
 $moduleDirName      = basename(dirname(dirname(__DIR__)));
22 22
 $moduleDirNameUpper = strtoupper($moduleDirName);
23 23
 
24
-define('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS', 'GD library support: ');
25
-define('CO_' . $moduleDirNameUpper . '_GDLIBVERSION', 'GD Library version: ');
26
-define('CO_' . $moduleDirNameUpper . '_GDOFF', "<span style='font-weight: bold;'>Disabled</span> (No thumbnails available)");
27
-define('CO_' . $moduleDirNameUpper . '_GDON', "<span style='font-weight: bold;'>Enabled</span> (Thumbsnails available)");
28
-define('CO_' . $moduleDirNameUpper . '_IMAGEINFO', 'Server status');
29
-define('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE', 'Max post size permitted (post_max_size directive in php.ini): ');
30
-define('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE', 'Max upload size permitted (upload_max_filesize directive in php.ini): ');
31
-define('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT', 'Memory limit (memory_limit directive in php.ini): ');
32
-define('CO_' . $moduleDirNameUpper . '_METAVERSION', "<span style='font-weight: bold;'>Downloads meta version:</span> ");
33
-define('CO_' . $moduleDirNameUpper . '_OFF', "<span style='font-weight: bold;'>OFF</span>");
34
-define('CO_' . $moduleDirNameUpper . '_ON', "<span style='font-weight: bold;'>ON</span>");
35
-define('CO_' . $moduleDirNameUpper . '_SERVERPATH', 'Server path to XOOPS root: ');
36
-define('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS', 'Server uploads status: ');
37
-define('CO_' . $moduleDirNameUpper . '_SPHPINI', "<span style='font-weight: bold;'>Information taken from PHP ini file:</span>");
38
-define('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC', 'Note. Upload path *MUST* contain the full server path of your upload folder.');
24
+define('CO_'.$moduleDirNameUpper.'_GDLIBSTATUS', 'GD library support: ');
25
+define('CO_'.$moduleDirNameUpper.'_GDLIBVERSION', 'GD Library version: ');
26
+define('CO_'.$moduleDirNameUpper.'_GDOFF', "<span style='font-weight: bold;'>Disabled</span> (No thumbnails available)");
27
+define('CO_'.$moduleDirNameUpper.'_GDON', "<span style='font-weight: bold;'>Enabled</span> (Thumbsnails available)");
28
+define('CO_'.$moduleDirNameUpper.'_IMAGEINFO', 'Server status');
29
+define('CO_'.$moduleDirNameUpper.'_MAXPOSTSIZE', 'Max post size permitted (post_max_size directive in php.ini): ');
30
+define('CO_'.$moduleDirNameUpper.'_MAXUPLOADSIZE', 'Max upload size permitted (upload_max_filesize directive in php.ini): ');
31
+define('CO_'.$moduleDirNameUpper.'_MEMORYLIMIT', 'Memory limit (memory_limit directive in php.ini): ');
32
+define('CO_'.$moduleDirNameUpper.'_METAVERSION', "<span style='font-weight: bold;'>Downloads meta version:</span> ");
33
+define('CO_'.$moduleDirNameUpper.'_OFF', "<span style='font-weight: bold;'>OFF</span>");
34
+define('CO_'.$moduleDirNameUpper.'_ON', "<span style='font-weight: bold;'>ON</span>");
35
+define('CO_'.$moduleDirNameUpper.'_SERVERPATH', 'Server path to XOOPS root: ');
36
+define('CO_'.$moduleDirNameUpper.'_SERVERUPLOADSTATUS', 'Server uploads status: ');
37
+define('CO_'.$moduleDirNameUpper.'_SPHPINI', "<span style='font-weight: bold;'>Information taken from PHP ini file:</span>");
38
+define('CO_'.$moduleDirNameUpper.'_UPLOADPATHDSC', 'Note. Upload path *MUST* contain the full server path of your upload folder.');
39 39
 
40
-define('CO_' . $moduleDirNameUpper . '_PRINT', "<span style='font-weight: bold;'>Print</span>");
41
-define('CO_' . $moduleDirNameUpper . '_PDF', "<span style='font-weight: bold;'>Create PDF</span>");
40
+define('CO_'.$moduleDirNameUpper.'_PRINT', "<span style='font-weight: bold;'>Print</span>");
41
+define('CO_'.$moduleDirNameUpper.'_PDF', "<span style='font-weight: bold;'>Create PDF</span>");
42 42
 
43 43
 
44
-define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED0', "Update failed - couldn't rename field '%s'");
45
-define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED1', "Update failed - couldn't add new fields");
46
-define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED2', "Update failed - couldn't rename table '%s'");
47
-define('CO_' . $moduleDirNameUpper . '_ERROR_COLUMN', 'Could not create column in database : %s');
48
-define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS', 'This module requires XOOPS %s+ (%s installed)');
49
-define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP', 'This module requires PHP version %s+ (%s installed)');
50
-define('CO_' . $moduleDirNameUpper . '_ERROR_TAG_REMOVAL', 'Could not remove tags from Tag Module');
44
+define('CO_'.$moduleDirNameUpper.'_UPGRADEFAILED0', "Update failed - couldn't rename field '%s'");
45
+define('CO_'.$moduleDirNameUpper.'_UPGRADEFAILED1', "Update failed - couldn't add new fields");
46
+define('CO_'.$moduleDirNameUpper.'_UPGRADEFAILED2', "Update failed - couldn't rename table '%s'");
47
+define('CO_'.$moduleDirNameUpper.'_ERROR_COLUMN', 'Could not create column in database : %s');
48
+define('CO_'.$moduleDirNameUpper.'_ERROR_BAD_XOOPS', 'This module requires XOOPS %s+ (%s installed)');
49
+define('CO_'.$moduleDirNameUpper.'_ERROR_BAD_PHP', 'This module requires PHP version %s+ (%s installed)');
50
+define('CO_'.$moduleDirNameUpper.'_ERROR_TAG_REMOVAL', 'Could not remove tags from Tag Module');
51 51
 
52
-define('CO_' . $moduleDirNameUpper . '_FOLDERS_DELETED_OK', 'Upload Folders have been deleted');
52
+define('CO_'.$moduleDirNameUpper.'_FOLDERS_DELETED_OK', 'Upload Folders have been deleted');
53 53
 
54 54
 // Error Msgs
55
-define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH', 'Could not delete %s directory');
56
-define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_REMOVE', 'Could not delete %s');
57
-define('CO_' . $moduleDirNameUpper . '_ERROR_NO_PLUGIN', 'Could not load plugin');
55
+define('CO_'.$moduleDirNameUpper.'_ERROR_BAD_DEL_PATH', 'Could not delete %s directory');
56
+define('CO_'.$moduleDirNameUpper.'_ERROR_BAD_REMOVE', 'Could not delete %s');
57
+define('CO_'.$moduleDirNameUpper.'_ERROR_NO_PLUGIN', 'Could not load plugin');
58 58
 
59 59
 
60 60
 //Help
61
-define('CO_' . $moduleDirNameUpper . '_DIRNAME', basename(dirname(dirname(__DIR__))));
62
-define('CO_' . $moduleDirNameUpper . '_HELP_HEADER', __DIR__.'/help/helpheader.tpl');
63
-define('CO_' . $moduleDirNameUpper . '_BACK_2_ADMIN', 'Back to Administration of ');
64
-define('CO_' . $moduleDirNameUpper . '_OVERVIEW', 'Overview');
61
+define('CO_'.$moduleDirNameUpper.'_DIRNAME', basename(dirname(dirname(__DIR__))));
62
+define('CO_'.$moduleDirNameUpper.'_HELP_HEADER', __DIR__.'/help/helpheader.tpl');
63
+define('CO_'.$moduleDirNameUpper.'_BACK_2_ADMIN', 'Back to Administration of ');
64
+define('CO_'.$moduleDirNameUpper.'_OVERVIEW', 'Overview');
65 65
 
66 66
 //define('CO_' . $moduleDirNameUpper . '_HELP_DIR', __DIR__);
67 67
 
68 68
 //help multi-page
69
-define('CO_' . $moduleDirNameUpper . '_DISCLAIMER', 'Disclaimer');
70
-define('CO_' . $moduleDirNameUpper . '_LICENSE', 'License');
71
-define('CO_' . $moduleDirNameUpper . '_SUPPORT', 'Support');
69
+define('CO_'.$moduleDirNameUpper.'_DISCLAIMER', 'Disclaimer');
70
+define('CO_'.$moduleDirNameUpper.'_LICENSE', 'License');
71
+define('CO_'.$moduleDirNameUpper.'_SUPPORT', 'Support');
Please login to merge, or discard this patch.
request.php 2 patches
Switch Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -49,94 +49,94 @@
 block discarded – undo
49 49
 }
50 50
 
51 51
 switch ($op) {
52
-    case 'post':
52
+        case 'post':
53 53
 
54
-        global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsDB;
54
+            global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsDB;
55 55
 
56
-        $newFaqObj = $faqHandler->create();
56
+            $newFaqObj = $faqHandler->create();
57 57
 
58
-        if (!$xoopsUser) {
59
-            if (1 == $xoopsModuleConfig['anonpost']) {
60
-                $uid = 0;
58
+            if (!$xoopsUser) {
59
+                if (1 == $xoopsModuleConfig['anonpost']) {
60
+                    $uid = 0;
61
+                } else {
62
+                    redirect_header('index.php', 3, _NOPERM);
63
+                }
61 64
             } else {
62
-                redirect_header('index.php', 3, _NOPERM);
65
+                $uid = $xoopsUser->uid();
63 66
             }
64
-        } else {
65
-            $uid = $xoopsUser->uid();
66
-        }
67
-
68
-        // Putting the values about the FAQ in the FAQ object
69
-        $newFaqObj->setVar('categoryid', $_POST['categoryid']);
70
-        $newFaqObj->setVar('uid', $uid);
71
-        $newFaqObj->setVar('question', $_POST['question']);
72
-        $notifypub = isset($_POST['notifypub']) ? $_POST['notifypub'] : 0;
73
-        $newFaqObj->setVar('notifypub', $notifypub);
74
-
75
-        // Setting the status of the FAQ
76
-        if (1 == $xoopsModuleConfig['autoapprove_request']) {
77
-            $newFaqObj->setVar('status', Constants::SF_STATUS_OPENED);
78
-        } else {
79
-            $newFaqObj->setVar('status', Constants::SF_STATUS_ASKED);
80
-        }
81
-
82
-        // Storing the FAQ object in the database
83
-        if (!$newFaqObj->store()) {
84
-            redirect_header('javascript:history.go(-1)', 3, _MD_SF_REQUEST_ERROR . Smartfaq\Utility::formatErrors($newFaqObj->getErrors()));
85
-        }
86
-
87
-        // Get the cateopry object related to that FAQ
88
-        // If autoapprove_requested
89
-        if (1 == $xoopsModuleConfig['autoapprove_request']) {
90
-            // We do not not subscribe user to notification on publish since we publish it right away
91
-
92
-            // Send notifications
93
-            $newFaqObj->sendNotifications([Constants::SF_NOT_QUESTION_PUBLISHED]);
94
-
95
-            $redirect_msg = _MD_SF_REQUEST_RECEIVED_AND_PUBLISHED;
96
-        } else {
97
-            // Subscribe the user to On Published notification, if requested
98
-            if (1 == $notifypub) {
99
-                require_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
100
-                $notificationHandler = xoops_getHandler('notification');
101
-                $notificationHandler->subscribe('question', $newFaqObj->faqid(), 'approved', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE);
67
+
68
+            // Putting the values about the FAQ in the FAQ object
69
+            $newFaqObj->setVar('categoryid', $_POST['categoryid']);
70
+            $newFaqObj->setVar('uid', $uid);
71
+            $newFaqObj->setVar('question', $_POST['question']);
72
+            $notifypub = isset($_POST['notifypub']) ? $_POST['notifypub'] : 0;
73
+            $newFaqObj->setVar('notifypub', $notifypub);
74
+
75
+            // Setting the status of the FAQ
76
+            if (1 == $xoopsModuleConfig['autoapprove_request']) {
77
+                $newFaqObj->setVar('status', Constants::SF_STATUS_OPENED);
78
+            } else {
79
+                $newFaqObj->setVar('status', Constants::SF_STATUS_ASKED);
80
+            }
81
+
82
+            // Storing the FAQ object in the database
83
+            if (!$newFaqObj->store()) {
84
+                redirect_header('javascript:history.go(-1)', 3, _MD_SF_REQUEST_ERROR . Smartfaq\Utility::formatErrors($newFaqObj->getErrors()));
102 85
             }
103
-            // Send notifications
104
-            $newFaqObj->sendNotifications([Constants::SF_NOT_QUESTION_SUBMITTED]);
105 86
 
106
-            $redirect_msg = _MD_SF_REQUEST_RECEIVED_NEED_APPROVAL;
107
-        }
87
+            // Get the cateopry object related to that FAQ
88
+            // If autoapprove_requested
89
+            if (1 == $xoopsModuleConfig['autoapprove_request']) {
90
+                // We do not not subscribe user to notification on publish since we publish it right away
91
+
92
+                // Send notifications
93
+                $newFaqObj->sendNotifications([Constants::SF_NOT_QUESTION_PUBLISHED]);
94
+
95
+                $redirect_msg = _MD_SF_REQUEST_RECEIVED_AND_PUBLISHED;
96
+            } else {
97
+                // Subscribe the user to On Published notification, if requested
98
+                if (1 == $notifypub) {
99
+                    require_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
100
+                    $notificationHandler = xoops_getHandler('notification');
101
+                    $notificationHandler->subscribe('question', $newFaqObj->faqid(), 'approved', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE);
102
+                }
103
+                // Send notifications
104
+                $newFaqObj->sendNotifications([Constants::SF_NOT_QUESTION_SUBMITTED]);
105
+
106
+                $redirect_msg = _MD_SF_REQUEST_RECEIVED_NEED_APPROVAL;
107
+            }
108 108
 
109
-        //redirect_header("javascript:history.go(-2)", 3, $redirect_msg);
110
-        redirect_header('index.php', 2, $redirect_msg);
111
-        break;
109
+            //redirect_header("javascript:history.go(-2)", 3, $redirect_msg);
110
+            redirect_header('index.php', 2, $redirect_msg);
111
+            break;
112 112
 
113
-    case 'form':
114
-    default:
113
+        case 'form':
114
+        default:
115 115
 
116
-        global $xoopsUser, $myts;
116
+            global $xoopsUser, $myts;
117 117
 
118
-        $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.tpl';
119
-        require_once XOOPS_ROOT_PATH . '/header.php';
120
-        require_once __DIR__ . '/footer.php';
118
+            $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.tpl';
119
+            require_once XOOPS_ROOT_PATH . '/header.php';
120
+            require_once __DIR__ . '/footer.php';
121 121
 
122
-        $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous';
122
+            $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous';
123 123
 
124
-        $moduleName =& $myts->displayTarea($xoopsModule->getVar('name'));
125
-        $xoopsTpl->assign('whereInSection', $moduleName);
126
-        $xoopsTpl->assign('lang_submit', _MD_SF_REQUEST);
124
+            $moduleName =& $myts->displayTarea($xoopsModule->getVar('name'));
125
+            $xoopsTpl->assign('whereInSection', $moduleName);
126
+            $xoopsTpl->assign('lang_submit', _MD_SF_REQUEST);
127 127
 
128
-        $xoopsTpl->assign('lang_intro_title', _MD_SF_REQUEST);
129
-        $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . $myts->displayTarea($xoopsModuleConfig['requestintromsg']));
128
+            $xoopsTpl->assign('lang_intro_title', _MD_SF_REQUEST);
129
+            $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . $myts->displayTarea($xoopsModuleConfig['requestintromsg']));
130 130
 
131
-        require_once __DIR__ . '/include/request.inc.php';
131
+            require_once __DIR__ . '/include/request.inc.php';
132 132
 
133
-        $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous';
133
+            $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous';
134 134
 
135
-        $sectionname = $myts->htmlSpecialChars($xoopsModule->getVar('name'));
135
+            $sectionname = $myts->htmlSpecialChars($xoopsModule->getVar('name'));
136 136
 
137
-        require_once __DIR__ . '/include/request.inc.php';
137
+            require_once __DIR__ . '/include/request.inc.php';
138 138
 
139
-        require_once XOOPS_ROOT_PATH . '/footer.php';
139
+            require_once XOOPS_ROOT_PATH . '/footer.php';
140 140
 
141
-        break;
141
+            break;
142 142
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@  discard block
 block discarded – undo
9 9
 use XoopsModules\Smartfaq;
10 10
 use XoopsModules\Smartfaq\Constants;
11 11
 
12
-require_once __DIR__ . '/header.php';
13
-require_once XOOPS_ROOT_PATH . '/header.php';
12
+require_once __DIR__.'/header.php';
13
+require_once XOOPS_ROOT_PATH.'/header.php';
14 14
 
15 15
 global $xoopsUser, $xoopsConfig, $xoopsModuleConfig, $xoopsModule;
16 16
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
         // Storing the FAQ object in the database
83 83
         if (!$newFaqObj->store()) {
84
-            redirect_header('javascript:history.go(-1)', 3, _MD_SF_REQUEST_ERROR . Smartfaq\Utility::formatErrors($newFaqObj->getErrors()));
84
+            redirect_header('javascript:history.go(-1)', 3, _MD_SF_REQUEST_ERROR.Smartfaq\Utility::formatErrors($newFaqObj->getErrors()));
85 85
         }
86 86
 
87 87
         // Get the cateopry object related to that FAQ
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         } else {
97 97
             // Subscribe the user to On Published notification, if requested
98 98
             if (1 == $notifypub) {
99
-                require_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
99
+                require_once XOOPS_ROOT_PATH.'/include/notification_constants.php';
100 100
                 $notificationHandler = xoops_getHandler('notification');
101 101
                 $notificationHandler->subscribe('question', $newFaqObj->faqid(), 'approved', XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE);
102 102
             }
@@ -116,27 +116,27 @@  discard block
 block discarded – undo
116 116
         global $xoopsUser, $myts;
117 117
 
118 118
         $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_submit.tpl';
119
-        require_once XOOPS_ROOT_PATH . '/header.php';
120
-        require_once __DIR__ . '/footer.php';
119
+        require_once XOOPS_ROOT_PATH.'/header.php';
120
+        require_once __DIR__.'/footer.php';
121 121
 
122 122
         $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous';
123 123
 
124
-        $moduleName =& $myts->displayTarea($xoopsModule->getVar('name'));
124
+        $moduleName = & $myts->displayTarea($xoopsModule->getVar('name'));
125 125
         $xoopsTpl->assign('whereInSection', $moduleName);
126 126
         $xoopsTpl->assign('lang_submit', _MD_SF_REQUEST);
127 127
 
128 128
         $xoopsTpl->assign('lang_intro_title', _MD_SF_REQUEST);
129
-        $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY . "<b>$name</b>, " . $myts->displayTarea($xoopsModuleConfig['requestintromsg']));
129
+        $xoopsTpl->assign('lang_intro_text', _MD_SF_GOODDAY."<b>$name</b>, ".$myts->displayTarea($xoopsModuleConfig['requestintromsg']));
130 130
 
131
-        require_once __DIR__ . '/include/request.inc.php';
131
+        require_once __DIR__.'/include/request.inc.php';
132 132
 
133 133
         $name = $xoopsUser ? ucwords($xoopsUser->getVar('uname')) : 'Anonymous';
134 134
 
135 135
         $sectionname = $myts->htmlSpecialChars($xoopsModule->getVar('name'));
136 136
 
137
-        require_once __DIR__ . '/include/request.inc.php';
137
+        require_once __DIR__.'/include/request.inc.php';
138 138
 
139
-        require_once XOOPS_ROOT_PATH . '/footer.php';
139
+        require_once XOOPS_ROOT_PATH.'/footer.php';
140 140
 
141 141
         break;
142 142
 }
Please login to merge, or discard this patch.
admin/admin_header.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
 use XoopsModules\Smartfaq;
21 21
 
22
-require_once __DIR__ . '/../../../include/cp_header.php';
22
+require_once __DIR__.'/../../../include/cp_header.php';
23 23
 //require_once $GLOBALS['xoops']->path('www/class/xoopsformloader.php');
24 24
 
25 25
 // require_once __DIR__ . '/../class/Utility.php';
@@ -28,18 +28,18 @@  discard block
 block discarded – undo
28 28
 $moduleDirName = basename(dirname(__DIR__));
29 29
 
30 30
 $path = dirname(dirname(dirname(__DIR__)));
31
-require_once $path . '/kernel/module.php';
32
-require_once $path . '/class/xoopstree.php';
33
-require_once $path . '/class/xoopslists.php';
34
-require_once $path . '/class/pagenav.php';
35
-require_once $path . '/class/xoopsformloader.php';
31
+require_once $path.'/kernel/module.php';
32
+require_once $path.'/class/xoopstree.php';
33
+require_once $path.'/class/xoopslists.php';
34
+require_once $path.'/class/pagenav.php';
35
+require_once $path.'/class/xoopsformloader.php';
36 36
 
37 37
 //require_once __DIR__ . '/../include/functions.php';
38 38
 // require_once __DIR__ . '/../class/category.php';
39 39
 // require_once __DIR__ . '/../class/faq.php';
40 40
 // require_once __DIR__ . '/../class/answer.php';
41 41
 // require_once __DIR__ . '/../class/Utility.php';
42
-require_once __DIR__ . '/../include/common.php';
42
+require_once __DIR__.'/../include/common.php';
43 43
 /** @var Smartfaq\Helper $helper */
44 44
 $helper      = Smartfaq\Helper::getInstance();
45 45
 $adminObject = \Xmf\Module\Admin::getInstance();
Please login to merge, or discard this patch.
faq.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 use XoopsModules\Smartfaq;
10 10
 
11
-require_once __DIR__ . '/header.php';
11
+require_once __DIR__.'/header.php';
12 12
 
13 13
 $faqid = isset($_GET['faqid']) ? (int)$_GET['faqid'] : 0;
14 14
 
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
     $faqObj->updateCounter();
48 48
 }
49 49
 $GLOBALS['xoopsOption']['template_main'] = 'smartfaq_faq.tpl';
50
-require_once XOOPS_ROOT_PATH . '/header.php';
51
-require_once __DIR__ . '/footer.php';
50
+require_once XOOPS_ROOT_PATH.'/header.php';
51
+require_once __DIR__.'/footer.php';
52 52
 
53 53
 $faq = $faqObj->toArray(null, $categoryObj, false);
54 54
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 $xoopsTpl->assign('display_categoryname', false);
84 84
 
85 85
 $xoopsTpl->assign('xcodes', $faqObj->getVar('xcodes'));
86
-$xoopsTpl->assign('mail_link', 'mailto:?subject=' . sprintf(_MD_SF_INTARTICLE, $xoopsConfig['sitename']) . '&amp;body=' . sprintf(_MD_SF_INTARTFOUND, $xoopsConfig['sitename']) . ':  ' . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/faq.php?faqid=' . $faqObj->getVar('faqid'));
86
+$xoopsTpl->assign('mail_link', 'mailto:?subject='.sprintf(_MD_SF_INTARTICLE, $xoopsConfig['sitename']).'&amp;body='.sprintf(_MD_SF_INTARTFOUND, $xoopsConfig['sitename']).':  '.XOOPS_URL.'/modules/'.$xoopsModule->dirname().'/faq.php?faqid='.$faqObj->getVar('faqid'));
87 87
 $xoopsTpl->assign('lang_printerpage', _MD_SF_PRINTERFRIENDLY);
88 88
 $xoopsTpl->assign('lang_sendstory', _MD_SF_SENDSTORY);
89 89
 $xoopsTpl->assign('faqid', $faqObj->getVar('faqid'));
@@ -99,19 +99,19 @@  discard block
 block discarded – undo
99 99
 
100 100
 // Page Title Hack by marcan
101 101
 $module_name = $myts->htmlSpecialChars($xoopsModule->getVar('name'));
102
-$xoopsTpl->assign('xoops_pagetitle', $module_name . ' - ' . $categoryObj->name() . ' - ' . $faq['question']);
102
+$xoopsTpl->assign('xoops_pagetitle', $module_name.' - '.$categoryObj->name().' - '.$faq['question']);
103 103
 // End Page Title Hack by marcan
104 104
 
105 105
 // Include the comments if the selected FAQ supports comments
106 106
 if (1 == $faqObj->cancomment()) {
107
-    require_once XOOPS_ROOT_PATH . '/include/comment_view.php';
107
+    require_once XOOPS_ROOT_PATH.'/include/comment_view.php';
108 108
 }
109 109
 
110 110
 //code to include smartie
111
-if (file_exists(XOOPS_ROOT_PATH . '/modules/smarttie/smarttie_links.php')) {
112
-    require_once XOOPS_ROOT_PATH . '/modules/smarttie/smarttie_links.php';
111
+if (file_exists(XOOPS_ROOT_PATH.'/modules/smarttie/smarttie_links.php')) {
112
+    require_once XOOPS_ROOT_PATH.'/modules/smarttie/smarttie_links.php';
113 113
     $xoopsTpl->assign('smarttie', 1);
114 114
 }
115 115
 //end code for smarttie
116 116
 
117
-require_once XOOPS_ROOT_PATH . '/footer.php';
117
+require_once XOOPS_ROOT_PATH.'/footer.php';
Please login to merge, or discard this patch.