1 | <?php |
||||
2 | /* |
||||
3 | * You may not change or alter any portion of this comment or credits |
||||
4 | * of supporting developers from this source code or any supporting source code |
||||
5 | * which is considered copyrighted (c) material of the original comment or credit authors. |
||||
6 | * |
||||
7 | * This program is distributed in the hope that it will be useful, |
||||
8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||||
10 | */ |
||||
11 | |||||
12 | /** |
||||
13 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||||
14 | * @license {@link http://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} |
||||
15 | * @package efqdirectory |
||||
16 | * @since |
||||
17 | * @author Martijn Hertog (aka wtravel) |
||||
18 | * @author XOOPS Development Team, |
||||
19 | */ |
||||
20 | |||||
21 | require_once __DIR__ . '/admin_header.php'; |
||||
22 | //include __DIR__ . '/../../../include/cp_header.php'; |
||||
0 ignored issues
–
show
|
|||||
23 | |||||
24 | include __DIR__ . '/../include/functions.php'; |
||||
25 | require_once XOOPS_ROOT_PATH . '/class/xoopstree.php'; |
||||
0 ignored issues
–
show
|
|||||
26 | require_once XOOPS_ROOT_PATH . '/include/xoopscodes.php'; |
||||
27 | require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||||
28 | require_once __DIR__ . '/../class/class.formimage.php'; |
||||
29 | require_once XOOPS_ROOT_PATH . '/class/module.errorhandler.php'; |
||||
30 | $myts = MyTextSanitizer::getInstance(); |
||||
0 ignored issues
–
show
The type
MyTextSanitizer was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
31 | $eh = new ErrorHandler; |
||||
0 ignored issues
–
show
The type
ErrorHandler was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
32 | $mytree = new XoopsTree($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat'), 'cid', 'pid'); |
||||
0 ignored issues
–
show
The type
XoopsTree was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
33 | |||||
34 | $moddir = $xoopsModule->getVar('dirname'); |
||||
35 | |||||
36 | if (isset($_GET['dirid'])) { |
||||
37 | $get_dir = (int)$_GET['dirid']; |
||||
38 | } |
||||
39 | |||||
40 | function dirConfig() |
||||
41 | { |
||||
42 | global $xoopsDB, $xoopsModule, $xoopsUser, $myts, $moddir; |
||||
43 | xoops_cp_header(); |
||||
0 ignored issues
–
show
The function
xoops_cp_header was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
44 | $adminObject = \Xmf\Module\Admin::getInstance(); |
||||
0 ignored issues
–
show
The type
Xmf\Module\Admin was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
45 | $adminObject->displayNavigation(basename(__FILE__)); |
||||
46 | //adminmenu(1, _MD_A_DIRADMIN); |
||||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
63% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||||
47 | echo '<h4>' . _MD_DIRCONF . '</h4>'; |
||||
48 | //Get a list of directories and their properties (included number of categories and items?) |
||||
49 | $result = $xoopsDB->query('SELECT dirid, postfix, open, name FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dir') . ''); |
||||
50 | $numrows = $xoopsDB->getRowsNum($result); |
||||
51 | if ($numrows > 0) { |
||||
52 | echo '<form action="directories.php?&op=changestatus" method="post" name="select_directories_form">'; |
||||
53 | echo "<table width='100%' border='0' cellspacing='1' class='outer'>"; |
||||
54 | echo '<tr><th> </th><th>' . _MD_DIRNAME . '</th><th>' . _MD_STATUS . '</th><th>' . _MD_TOTALCATS . '</th><th>' . _MD_ACTION . "</th></tr>\n"; |
||||
55 | while (list($dirid, $postfix, $open, $name) = $xoopsDB->fetchRow($result)) { |
||||
56 | $sql = 'SELECT COUNT(*) FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " WHERE dirid='" . $dirid . '\''; |
||||
57 | $result_countcats = $xoopsDB->query($sql); |
||||
58 | $numrows = $xoopsDB->getRowsNum($result_countcats); |
||||
0 ignored issues
–
show
|
|||||
59 | list($totalcats) = $xoopsDB->fetchRow($result_countcats); |
||||
60 | |||||
61 | if ($open != '0') { |
||||
62 | $openyn = '' . _MD_OPEN . ''; |
||||
63 | } else { |
||||
64 | $openyn = '' . _MD_CLOSED . ''; |
||||
65 | } |
||||
66 | |||||
67 | echo '<tr><td class="even"><input type="checkbox" name="select[]" value="' |
||||
68 | . $dirid |
||||
69 | . "\"></td><td class=\"even\">$name<a href=\"" |
||||
70 | . XOOPS_URL |
||||
0 ignored issues
–
show
|
|||||
71 | . '/modules/' |
||||
72 | . $moddir |
||||
73 | . "/admin/directories.php?op=moddir&dirid=$dirid\">" |
||||
74 | . _MD_EDIT_BRACKETS |
||||
75 | . "</a></td><td class=\"even\">$openyn</td><td class=\"even\">$totalcats</td><td class=\"even\">"; |
||||
76 | echo '<a href="' . XOOPS_URL . '/modules/' . $moddir . "/admin/categories.php?dirid=$dirid\"><img src=\"" . XOOPS_URL . '/modules/' . $moddir . '/assets/images/accessories-text-editor.png" title="' . _MD_MANAGE_CATS . '" alt="' . _MD_MANAGE_CATS . '"></a>'; |
||||
77 | echo "</td></tr>\n"; |
||||
78 | } |
||||
79 | echo '<tr><td colspan="5">' . _MD_WITH_SELECTED . ': '; |
||||
80 | echo '<select name="fct" onChange="form.submit()">'; |
||||
81 | echo '<option value="nothing">---</option>'; |
||||
82 | echo '<option value="activate">' . _MD_OPEN . '</option>'; |
||||
83 | echo '<option value="inactivate">' . _MD_CLOSE . '</option></select>'; |
||||
84 | echo '</td></tr>'; |
||||
85 | echo '</table>'; |
||||
86 | echo '</form>'; |
||||
87 | } else { |
||||
88 | echo '<p><span style="background-color: #E6E6E6; padding: 5px; border: 1px solid #000000;">' . _MD_NORESULTS_PLEASE_CREATE_DIRECTORY . '</span></p>'; |
||||
89 | } |
||||
90 | echo '<br>'; |
||||
91 | echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td>"; |
||||
92 | $form = new XoopsThemeForm(_MD_CREATE_NEWDIR, 'submitform', 'directories.php'); |
||||
0 ignored issues
–
show
The type
XoopsThemeForm was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
93 | $form->addElement(new XoopsFormText(_MD_DIRNAME, 'dirname', 100, 150, ''), true); |
||||
0 ignored issues
–
show
The type
XoopsFormText was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
94 | $form_diropen = new XoopsFormCheckBox(_MD_OPENYN, 'open', 0); |
||||
0 ignored issues
–
show
The type
XoopsFormCheckBox was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
95 | $form_diropen->addOption(1, _MD_YESNO); |
||||
96 | $form->addElement($form_diropen); |
||||
97 | $form->addElement(new XoopsFormButton('', 'submit', _MD_SUBMIT, 'submit')); |
||||
0 ignored issues
–
show
The type
XoopsFormButton was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
98 | $form->addElement(new XoopsFormHidden('op', 'newdir')); |
||||
0 ignored issues
–
show
The type
XoopsFormHidden was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
99 | $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
||||
100 | $form->display(); |
||||
101 | echo '</td></tr></table>'; |
||||
102 | xoops_cp_footer(); |
||||
0 ignored issues
–
show
The function
xoops_cp_footer was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
103 | } |
||||
104 | |||||
105 | function modDir($dirid = '0') |
||||
106 | { |
||||
107 | global $xoopsDB, $xoopsModule, $myts, $xoopsUser, $moddir; |
||||
108 | xoops_cp_header(); |
||||
0 ignored issues
–
show
The function
xoops_cp_header was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
109 | //adminmenu(1, _MD_A_DIRADMIN); |
||||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
63% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||||
110 | echo '<h4>' . _MD_EDITDIR . '</h4>'; |
||||
111 | echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td>"; |
||||
112 | $result = $xoopsDB->query('SELECT * FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dir') . " WHERE dirid='" . $dirid . '\''); |
||||
113 | $numrows = $xoopsDB->getRowsNum($result); |
||||
114 | if ($numrows > 0) { |
||||
115 | while (list($dirid, $postfix, $open, $dirname, $descr, $pic) = $xoopsDB->fetchRow($result)) { |
||||
116 | if ($pic != '') { |
||||
117 | $picture = XOOPS_URL . "/modules/$moddir/uploads/$pic"; |
||||
0 ignored issues
–
show
|
|||||
118 | } else { |
||||
119 | $picture = '/images/dummy.png'; |
||||
120 | } |
||||
121 | $form = new XoopsThemeForm(_MD_EDITDIRFORM, 'editform', 'directories.php'); |
||||
122 | $form->setExtra('enctype="multipart/form-data"'); |
||||
123 | $form->addElement(new XoopsFormText(_MD_DIRNAME, 'dirname', 100, 150, $myts->htmlSpecialChars($dirname))); |
||||
124 | $form_diropen = new XoopsFormCheckBox(_MD_OPENYN, 'open', $open); |
||||
125 | $form_diropen->addOption(1, _MD_DIROPENYN); |
||||
126 | $form->addElement($form_diropen); |
||||
127 | $form->addElement(new XoopsFormTextArea(_MD_DESCRIPTION, 'descr', "$descr", 12, 50, '')); |
||||
0 ignored issues
–
show
The type
XoopsFormTextArea was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
128 | $form->addElement(new XoopsFormFile(_MD_SELECT_PIC, 'img', 30000)); |
||||
0 ignored issues
–
show
The type
XoopsFormFile was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
129 | $form->addElement(new XoopsFormImage(_MD_CURRENT_PIC, 'current_image', null, "$picture", '', '')); |
||||
130 | $form->addElement(new XoopsFormButton('', 'submit', _MD_UPDATE, 'submit')); |
||||
131 | $form->addElement(new XoopsFormHidden('op', 'update')); |
||||
132 | $form->addElement(new XoopsFormHidden('dirid', $dirid)); |
||||
133 | $form->addElement(new XoopsFormHidden('open_current', $open)); |
||||
134 | $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
||||
135 | $form->display(); |
||||
136 | } |
||||
137 | } |
||||
138 | echo myTextForm('' . XOOPS_URL . "/modules/$moddir/admin/directories.php", _MD_CANCEL); |
||||
0 ignored issues
–
show
The function
myTextForm was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
139 | echo '</td></tr></table>'; |
||||
140 | xoops_cp_footer(); |
||||
0 ignored issues
–
show
The function
xoops_cp_footer was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
141 | } |
||||
142 | |||||
143 | function updateDir() |
||||
144 | { |
||||
145 | global $xoopsDB, $_POST, $myts, $eh, $moddir; |
||||
146 | if (isset($_POST['dirid'])) { |
||||
147 | $p_dirid = (int)$_POST['dirid']; |
||||
148 | } else { |
||||
149 | echo 'no dirid'; |
||||
150 | exit(); |
||||
151 | } |
||||
152 | $p_dirname = $myts->makeTboxData4Save($_POST['dirname']); |
||||
153 | if (isset($_POST['open'])) { |
||||
154 | $p_open = $_POST['open']; |
||||
155 | } else { |
||||
156 | $p_open = '0'; |
||||
157 | } |
||||
158 | View Code Duplication | if (isset($_POST['descr'])) { |
|||
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||||
159 | $p_descr = $myts->makeTareaData4Save($_POST['descr']); |
||||
160 | } else { |
||||
161 | $p_descr = ''; |
||||
162 | } |
||||
163 | if ($_POST['xoops_upload_file'][0] != '') { |
||||
164 | require_once __DIR__ . '/../class/class.uploader.php'; |
||||
165 | $uploader = new XoopsMediaUploader(XOOPS_ROOT_PATH . '/modules/' . $moddir . '/init_uploads', array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png', 'image/jpg'), 30000, 80, 80); |
||||
0 ignored issues
–
show
|
|||||
166 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { |
||||
167 | $filename = $uploader->getMediaName(); |
||||
0 ignored issues
–
show
|
|||||
168 | View Code Duplication | } else { |
|||
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||||
169 | $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dir') . " SET descr = '" . $p_descr . '\', open=\'' . $p_open . '\', name=\'' . $p_dirname . '\' WHERE dirid = \'' . $p_dirid . '\''; |
||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||
170 | $xoopsDB->query($sql) or $eh->show('0013'); |
||||
171 | redirect_header("directories.php?dirid=$p_dirid", 2, _MD_DIR_UPDATED); |
||||
0 ignored issues
–
show
The function
redirect_header was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
172 | exit(); |
||||
173 | } |
||||
174 | $uploader->setPrefix('efqdir'); |
||||
175 | if ($uploader->upload()) { |
||||
176 | $savedfilename = $uploader->getSavedFileName(); |
||||
177 | echo $uploader->getErrors(); |
||||
178 | $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dir') . " SET img = '" . $savedfilename . '\', descr = \'' . $p_descr . '\', open=\'' . $p_open . '\', name=\'' . $p_dirname . '\' WHERE dirid = \'' . $p_dirid . '\''; |
||||
179 | $xoopsDB->query($sql) or $eh->show('0013'); |
||||
180 | |||||
181 | //Rename the uploaded file to the same name in a different location that does not have 777 rights or 755. |
||||
182 | rename('' . XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads/" . $savedfilename . '', '' . XOOPS_ROOT_PATH . "/modules/$moddir/uploads/" . $savedfilename . ''); |
||||
183 | //Delete the uploaded file from the initial upload folder if it is still present in that folder. |
||||
184 | View Code Duplication | if (file_exists('' . XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads/" . $savedfilename . '')) { |
|||
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||||
185 | unlink('' . XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads/" . $savedfilename . ''); |
||||
186 | } |
||||
187 | redirect_header("directories.php?op=moddir&dirid=$p_dirid", 2, _MD_DIR_UPDATED); |
||||
188 | exit(); |
||||
189 | View Code Duplication | } else { |
|||
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||||
190 | echo $uploader->getErrors(); |
||||
191 | $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dir') . " SET descr = '" . $p_descr . '\', open=\'' . $p_open . '\', name=\'' . $p_dirname . '\' WHERE dirid = \'' . $p_dirid . '\''; |
||||
192 | $xoopsDB->query($sql) or $eh->show('0013'); |
||||
193 | redirect_header("directories.php?dirid=$p_dirid", 2, _MD_DIR_UPDATED); |
||||
194 | exit(); |
||||
195 | } |
||||
196 | } |
||||
197 | redirect_header("directories.php?dirid=$p_dirid", 2, _MD_DIR_NOT_UPDATED); |
||||
198 | } |
||||
199 | |||||
200 | function changeStatus($status = 0) |
||||
201 | { |
||||
202 | global $xoopsDB, $eh, $moddir, $xoopsModule; |
||||
203 | $select = $_POST['select']; |
||||
204 | $users = ''; |
||||
0 ignored issues
–
show
|
|||||
205 | $count = 0; |
||||
206 | $directories = ''; |
||||
207 | $countselect = count($select); |
||||
208 | if ($countselect > 0) { |
||||
209 | foreach ($select as $directory) { |
||||
210 | if ($count > 0) { |
||||
211 | $directories .= ',' . $directory; |
||||
212 | } else { |
||||
213 | $directories .= $directory; |
||||
214 | } |
||||
215 | ++$count; |
||||
216 | } |
||||
217 | $sql = sprintf('UPDATE %s SET OPEN=' . $status . ' WHERE dirid IN (%s)', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dir'), $directories); |
||||
218 | $xoopsDB->query($sql) or $eh->show('0013'); |
||||
219 | redirect_header('directories.php', 2, _MD_DIR_UPDATED); |
||||
0 ignored issues
–
show
The function
redirect_header was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
220 | exit(); |
||||
221 | } else { |
||||
222 | redirect_header('directories.php', 2, _MD_DIR_NOT_UPDATED); |
||||
223 | } |
||||
224 | } |
||||
225 | |||||
226 | function newDir() |
||||
227 | { |
||||
228 | global $xoopsDB, $xoopsModule, $_POST, $myts, $eh; |
||||
229 | if (isset($_POST['postfix'])) { |
||||
230 | $p_postfix = $_POST['postfix']; |
||||
231 | } else { |
||||
232 | $p_postfix = ''; |
||||
233 | } |
||||
234 | $p_dirname = $_POST['dirname']; |
||||
235 | if (isset($_POST['open'])) { |
||||
236 | $p_open = $_POST['open']; |
||||
237 | } else { |
||||
238 | $p_open = 0; |
||||
239 | } |
||||
240 | $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dir') . '_dirid_seq'); |
||||
241 | $sql = sprintf("INSERT INTO %s (dirid, postfix, OPEN, NAME) VALUES (%u, '%s', '%s', '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dir'), $newid, $p_postfix, $p_open, $p_dirname); |
||||
242 | $xoopsDB->query($sql) or $eh->show('0013'); |
||||
243 | $db_dirid = $xoopsDB->getInsertId(); |
||||
244 | redirect_header("directories.php?op=moddir&dirid=$db_dirid", 2, _MD_DIR_SAVED); |
||||
0 ignored issues
–
show
The function
redirect_header was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
245 | exit(); |
||||
246 | } |
||||
247 | |||||
248 | View Code Duplication | if (!isset($_POST['op'])) { |
|||
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||||
249 | $op = isset($_GET['op']) ? $_GET['op'] : 'dirConfig'; |
||||
250 | } else { |
||||
251 | $op = $_POST['op']; |
||||
252 | } |
||||
253 | switch ($op) { |
||||
254 | case 'edit': |
||||
255 | editDir(); |
||||
0 ignored issues
–
show
The function
editDir was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
256 | break; |
||||
257 | case 'update': |
||||
258 | updateDir(); |
||||
259 | break; |
||||
260 | case 'changestatus': |
||||
261 | if (isset($_POST['fct'])) { |
||||
262 | $fct = $_POST['fct']; |
||||
263 | if ($fct == 'activate') { |
||||
264 | $newstatus = 1; |
||||
265 | } elseif ($fct == 'inactivate') { |
||||
266 | $newstatus = 0; |
||||
267 | } |
||||
268 | } |
||||
269 | changeStatus($newstatus); |
||||
270 | break; |
||||
271 | case 'newdir': |
||||
272 | newDir(); |
||||
273 | break; |
||||
274 | case 'moddir': |
||||
275 | modDir($get_dir); |
||||
276 | break; |
||||
277 | default: |
||||
278 | dirConfig(); |
||||
279 | break; |
||||
280 | } |
||||
281 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.