XoopsModules25x /
xoopstube
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Module: XoopsTube |
||
| 4 | * |
||
| 5 | * You may not change or alter any portion of this comment or credits |
||
| 6 | * of supporting developers from this source code or any supporting source code |
||
| 7 | * which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 8 | * |
||
| 9 | * PHP version 5 |
||
| 10 | * |
||
| 11 | * @Module XoopsTube |
||
| 12 | * @Release Date: 21 June 2005 |
||
| 13 | * @Developer John N |
||
| 14 | * @Team XOOPS Development Team |
||
| 15 | * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) |
||
| 16 | */ |
||
| 17 | |||
| 18 | include_once __DIR__ . '/admin_header.php'; |
||
| 19 | include_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php'; |
||
| 20 | |||
| 21 | $op = ''; |
||
| 22 | |||
| 23 | if (isset($_POST)) { |
||
| 24 | foreach ($_POST as $k => $v) { |
||
| 25 | ${$k} = $v; |
||
| 26 | } |
||
| 27 | } |
||
| 28 | |||
| 29 | if (isset($_GET)) { |
||
| 30 | foreach ($_GET as $k => $v) { |
||
| 31 | ${$k} = $v; |
||
| 32 | } |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @param int $cid |
||
| 37 | */ |
||
| 38 | function createCategory($cid = 0) |
||
|
0 ignored issues
–
show
|
|||
| 39 | { |
||
| 40 | include_once dirname(__DIR__) . '/class/xoopstube_lists.php'; |
||
| 41 | // include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||
| 42 | |||
| 43 | global $xtubemyts, $totalcats, $xoopsModule; |
||
|
0 ignored issues
–
show
Compatibility
Best Practice
introduced
by
Use of
global functionality is not recommended; it makes your code harder to test, and less reusable.
Instead of relying on 1. Pass all data via parametersfunction myFunction($a, $b) {
// Do something
}
2. Create a class that maintains your stateclass MyClass {
private $a;
private $b;
public function __construct($a, $b) {
$this->a = $a;
$this->b = $b;
}
public function myFunction() {
// Do something
}
}
Loading history...
|
|||
| 44 | |||
| 45 | $lid = 0; |
||
| 46 | $title = ''; |
||
| 47 | $imgurl = ''; |
||
| 48 | $description = ''; |
||
| 49 | $pid = ''; |
||
| 50 | $weight = 0; |
||
| 51 | $nohtml = 0; |
||
| 52 | $nosmiley = 0; |
||
| 53 | $noxcodes = 0; |
||
| 54 | $noimages = 0; |
||
| 55 | $nobreak = 1; |
||
| 56 | $spotlighttop = 0; |
||
| 57 | $spotlighthis = 0; |
||
| 58 | $client_id = 0; |
||
| 59 | $banner_id = 0; |
||
| 60 | $heading = _AM_XOOPSTUBE_CCATEGORY_CREATENEW; |
||
| 61 | $totalcats = XoopstubeUtilities::xtubeGetTotalCategoryCount(); |
||
| 62 | |||
| 63 | if ($cid > 0) { |
||
| 64 | $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_cat') . ' WHERE cid=' . (int)$cid; |
||
| 65 | $cat_arr = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql)); |
||
| 66 | $title = $xtubemyts->htmlSpecialChars($cat_arr['title']); |
||
| 67 | $imgurl = $xtubemyts->htmlSpecialChars($cat_arr['imgurl']); |
||
| 68 | $description = $xtubemyts->htmlSpecialChars($cat_arr['description']); |
||
| 69 | $nohtml = (int)$cat_arr['nohtml']; |
||
| 70 | $nosmiley = (int)$cat_arr['nosmiley']; |
||
| 71 | $noxcodes = (int)$cat_arr['noxcodes']; |
||
| 72 | $noimages = (int)$cat_arr['noimages']; |
||
| 73 | $nobreak = (int)$cat_arr['nobreak']; |
||
| 74 | $spotlighthis = (int)$cat_arr['spotlighthis']; |
||
| 75 | $spotlighttop = (int)$cat_arr['spotlighttop']; |
||
| 76 | $weight = $cat_arr['weight']; |
||
| 77 | $client_id = $cat_arr['client_id']; |
||
| 78 | $banner_id = $cat_arr['banner_id']; |
||
| 79 | $heading = _AM_XOOPSTUBE_CCATEGORY_MODIFY; |
||
| 80 | |||
| 81 | $memberHandler = xoops_getHandler('member'); |
||
| 82 | $group_list = $memberHandler->getGroupList(); |
||
|
0 ignored issues
–
show
$group_list is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the Loading history...
|
|||
| 83 | |||
| 84 | $gpermHandler = xoops_getHandler('groupperm'); |
||
| 85 | $groups = $gpermHandler->getGroupIds('XTubeCatPerm', $cid, $xoopsModule->getVar('mid')); |
||
| 86 | // $groups = $groups; |
||
| 87 | } else { |
||
| 88 | $groups = true; |
||
| 89 | } |
||
| 90 | echo '<br><br>'; |
||
| 91 | $sform = new XoopsThemeForm($heading, 'op', xoops_getenv('PHP_SELF')); |
||
| 92 | $sform->setExtra('enctype="multipart/form-data"'); |
||
| 93 | |||
| 94 | $sform->addElement(new XoopsFormText(_AM_XOOPSTUBE_FCATEGORY_TITLE, 'title', 50, 80, $title), true); |
||
| 95 | $sform->addElement(new XoopsFormText(_AM_XOOPSTUBE_FCATEGORY_WEIGHT, 'weight', 10, 80, $weight), false); |
||
| 96 | |||
| 97 | if ($totalcats > 0 && $cid) { |
||
| 98 | $mytreechose = new XoopstubeTree($GLOBALS['xoopsDB']->prefix('xoopstube_cat'), 'cid', 'pid'); |
||
| 99 | ob_start(); |
||
| 100 | $mytreechose->makeMySelBox('title', 'title', $cat_arr['pid'], 1, 'pid'); |
||
| 101 | $sform->addElement(new XoopsFormLabel(_AM_XOOPSTUBE_FCATEGORY_SUBCATEGORY, ob_get_contents())); |
||
| 102 | ob_end_clean(); |
||
| 103 | } else { |
||
| 104 | $mytreechose = new XoopstubeTree($GLOBALS['xoopsDB']->prefix('xoopstube_cat'), 'cid', 'pid'); |
||
| 105 | ob_start(); |
||
| 106 | $mytreechose->makeMySelBox('title', 'title', $cid, 1, 'pid'); |
||
| 107 | $sform->addElement(new XoopsFormLabel(_AM_XOOPSTUBE_FCATEGORY_SUBCATEGORY, ob_get_contents())); |
||
| 108 | ob_end_clean(); |
||
| 109 | } |
||
| 110 | |||
| 111 | $graph_array =& XoopstubeLists::getListTypeAsArray(XOOPS_ROOT_PATH . '/' . $GLOBALS['xoopsModuleConfig']['catimage'], $type = 'images'); |
||
| 112 | $indexImageSelect = new XoopsFormSelect('', 'imgurl', $imgurl); |
||
| 113 | $indexImageSelect->addOptionArray($graph_array); |
||
| 114 | $indexImageSelect->setExtra("onchange='showImgSelected(\"image\", \"imgurl\", \"" . $GLOBALS['xoopsModuleConfig']['catimage'] . "\", \"\", \"" . XOOPS_URL . "\")'"); |
||
| 115 | $indeximage_tray = new XoopsFormElementTray(_AM_XOOPSTUBE_FCATEGORY_CIMAGE, ' '); |
||
| 116 | $indeximage_tray->addElement($indexImageSelect); |
||
| 117 | if ('' !== $imgurl && 1 != $imgurl) { |
||
| 118 | $indeximage_tray->addElement(new XoopsFormLabel('', |
||
| 119 | "<br><br><img src='" . XOOPS_URL . '/' . $GLOBALS['xoopsModuleConfig']['catimage'] . '/' . $imgurl . "' name='image' id='image' alt='' />")); |
||
| 120 | } else { |
||
| 121 | $indeximage_tray->addElement(new XoopsFormLabel('', "<br><br><img src='" . XOOPS_URL . "/uploads/blank.gif' name='image' id='image' alt='' />")); |
||
| 122 | } |
||
| 123 | $sform->addElement($indeximage_tray); |
||
| 124 | |||
| 125 | // $editor = xtube_getWysiwygForm(_AM_XOOPSTUBE_FCATEGORY_DESCRIPTION, 'description', $description, 15, 60, ''); |
||
| 126 | // $sform->addElement($editor, false); |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
73% 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. Loading history...
|
|||
| 127 | |||
| 128 | $optionsTrayNote = new XoopsFormElementTray(_AM_XOOPSTUBE_FCATEGORY_DESCRIPTION, '<br>'); |
||
| 129 | View Code Duplication | if (class_exists('XoopsFormEditor')) { |
|
| 130 | $options['name'] = 'description'; |
||
| 131 | $options['value'] = $description; |
||
| 132 | $options['rows'] = 5; |
||
| 133 | $options['cols'] = '100%'; |
||
| 134 | $options['width'] = '100%'; |
||
| 135 | $options['height'] = '200px'; |
||
| 136 | $editor = new XoopsFormEditor('', $GLOBALS['xoopsModuleConfig']['form_optionsuser'], $options, $nohtml = false, $onfailure = 'textarea'); |
||
| 137 | $optionsTrayNote->addElement($editor); |
||
| 138 | } else { |
||
| 139 | $editor = new XoopsFormDhtmlTextArea('', 'description', $item->getVar('description', 'e'), '100%', '100%'); |
||
|
0 ignored issues
–
show
|
|||
| 140 | $optionsTrayNote->addElement($editor); |
||
| 141 | } |
||
| 142 | |||
| 143 | $sform->addElement($optionsTrayNote, false); |
||
| 144 | |||
| 145 | // Select Client/Sponsor |
||
| 146 | $client_select = new XoopsFormSelect(_AM_XOOPSTUBE_CATSPONSOR, 'client_id', $client_id, false); |
||
| 147 | $sql = 'SELECT cid, name FROM ' . $GLOBALS['xoopsDB']->prefix('bannerclient') . ' ORDER BY name ASC'; |
||
| 148 | $result = $GLOBALS['xoopsDB']->query($sql); |
||
| 149 | $client_array = array(); |
||
| 150 | $client_array[0] = ' '; |
||
| 151 | View Code Duplication | while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) { |
|
|
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. Loading history...
|
|||
| 152 | $client_array[$myrow['cid']] = $myrow['name']; |
||
| 153 | } |
||
| 154 | $client_select->addOptionArray($client_array); |
||
| 155 | |||
| 156 | $client_select->setDescription(_AM_XOOPSTUBE_CATSPONSORDSC); |
||
| 157 | $sform->addElement($client_select); |
||
| 158 | |||
| 159 | // Select Banner |
||
| 160 | $banner_select = new XoopsFormSelect(_AM_XOOPSTUBE_BANNERID, 'banner_id', $banner_id, false); |
||
| 161 | $sql = 'SELECT bid, cid FROM ' . $GLOBALS['xoopsDB']->prefix('banner') . ' ORDER BY bid ASC'; |
||
| 162 | $result = $GLOBALS['xoopsDB']->query($sql); |
||
| 163 | $banner_array = array(); |
||
| 164 | $banner_array[0] = ' '; |
||
| 165 | View Code Duplication | while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) { |
|
|
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. Loading history...
|
|||
| 166 | $banner_array[$myrow['bid']] = $myrow['bid']; |
||
| 167 | } |
||
| 168 | $banner_select->addOptionArray($banner_array); |
||
| 169 | $banner_select->setDescription(_AM_XOOPSTUBE_BANNERIDDSC); |
||
| 170 | $sform->addElement($banner_select); |
||
| 171 | |||
| 172 | $options_tray = new XoopsFormElementTray(_AM_XOOPSTUBE_TEXTOPTIONS, '<br>'); |
||
| 173 | |||
| 174 | $html_checkbox = new XoopsFormCheckBox('', 'nohtml', $nohtml); |
||
| 175 | $html_checkbox->addOption(1, _AM_XOOPSTUBE_DISABLEHTML); |
||
| 176 | $options_tray->addElement($html_checkbox); |
||
| 177 | |||
| 178 | $smiley_checkbox = new XoopsFormCheckBox('', 'nosmiley', $nosmiley); |
||
| 179 | $smiley_checkbox->addOption(1, _AM_XOOPSTUBE_DISABLESMILEY); |
||
| 180 | $options_tray->addElement($smiley_checkbox); |
||
| 181 | |||
| 182 | $xcodes_checkbox = new XoopsFormCheckBox('', 'noxcodes', $noxcodes); |
||
| 183 | $xcodes_checkbox->addOption(1, _AM_XOOPSTUBE_DISABLEXCODE); |
||
| 184 | $options_tray->addElement($xcodes_checkbox); |
||
| 185 | |||
| 186 | $noimages_checkbox = new XoopsFormCheckBox('', 'noimages', $noimages); |
||
| 187 | $noimages_checkbox->addOption(1, _AM_XOOPSTUBE_DISABLEIMAGES); |
||
| 188 | $options_tray->addElement($noimages_checkbox); |
||
| 189 | |||
| 190 | $breaks_checkbox = new XoopsFormCheckBox('', 'nobreak', $nobreak); |
||
| 191 | $breaks_checkbox->addOption(1, _AM_XOOPSTUBE_DISABLEBREAK); |
||
| 192 | $options_tray->addElement($breaks_checkbox); |
||
| 193 | $sform->addElement($options_tray); |
||
| 194 | |||
| 195 | // $sform -> addElement(new XoopsFormSelectGroup(_AM_XOOPSTUBE_FCATEGORY_GROUPPROMPT, "groups", true, $groups, 5, true)); |
||
| 196 | |||
| 197 | $sform->addElement(new XoopsFormHidden('cid', (int)$cid)); |
||
| 198 | |||
| 199 | $sform->addElement(new XoopsFormHidden('spotlighttop', (int)$cid)); |
||
| 200 | |||
| 201 | $button_tray = new XoopsFormElementTray('', ''); |
||
| 202 | $hidden = new XoopsFormHidden('op', 'save'); |
||
| 203 | $button_tray->addElement($hidden); |
||
| 204 | |||
| 205 | if (!$cid) { |
||
| 206 | $butt_create = new XoopsFormButton('', '', _AM_XOOPSTUBE_BSAVE, 'submit'); |
||
| 207 | $butt_create->setExtra('onclick="this.form.elements.op.value=\'addCat\'"'); |
||
| 208 | $button_tray->addElement($butt_create); |
||
| 209 | |||
| 210 | $butt_clear = new XoopsFormButton('', '', _AM_XOOPSTUBE_BRESET, 'reset'); |
||
| 211 | $button_tray->addElement($butt_clear); |
||
| 212 | |||
| 213 | $butt_cancel = new XoopsFormButton('', '', _AM_XOOPSTUBE_BCANCEL, 'button'); |
||
| 214 | $butt_cancel->setExtra('onclick="history.go(-1)"'); |
||
| 215 | $button_tray->addElement($butt_cancel); |
||
| 216 | } else { |
||
| 217 | $butt_create = new XoopsFormButton('', '', _AM_XOOPSTUBE_BMODIFY, 'submit'); |
||
| 218 | $butt_create->setExtra('onclick="this.form.elements.op.value=\'addCat\'"'); |
||
| 219 | $button_tray->addElement($butt_create); |
||
| 220 | |||
| 221 | $butt_delete = new XoopsFormButton('', '', _AM_XOOPSTUBE_BDELETE, 'submit'); |
||
| 222 | $butt_delete->setExtra('onclick="this.form.elements.op.value=\'del\'"'); |
||
| 223 | $button_tray->addElement($butt_delete); |
||
| 224 | |||
| 225 | $butt_cancel = new XoopsFormButton('', '', _AM_XOOPSTUBE_BCANCEL, 'button'); |
||
| 226 | $butt_cancel->setExtra('onclick="history.go(-1)"'); |
||
| 227 | $button_tray->addElement($butt_cancel); |
||
| 228 | } |
||
| 229 | $sform->addElement($button_tray); |
||
| 230 | $sform->display(); |
||
| 231 | |||
| 232 | $result2 = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_cat')); |
||
| 233 | list($numrows) = $GLOBALS['xoopsDB']->fetchRow($result2); |
||
| 234 | } |
||
| 235 | |||
| 236 | /* |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
68% 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. Loading history...
|
|||
| 237 | if (!isset($_POST['op'])) { |
||
| 238 | $op = isset($_GET['op']) ? $_GET['op'] : 'main'; |
||
| 239 | } else { |
||
| 240 | $op = isset($_POST['op']) ? $_POST['op'] : 'main'; |
||
| 241 | } |
||
| 242 | */ |
||
| 243 | |||
| 244 | $op = XoopsRequest::getString('op', XoopsRequest::getString('op', 'main', 'POST'), 'GET'); |
||
| 245 | |||
| 246 | switch ($op) { |
||
| 247 | case 'move': |
||
| 248 | if (!XoopsRequest::getCmd('ok', '', 'POST')) { |
||
| 249 | $cid = XoopsRequest::getInt('cid', XoopsRequest::getInt('cid', 0, 'GET'), 'POST'); //(isset($_POST['cid'])) ? $_POST['cid'] : $_GET['cid']; |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
84% 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. Loading history...
|
|||
| 250 | |||
| 251 | xoops_cp_header(); |
||
| 252 | //xtubeRenderAdminMenu(_AM_XOOPSTUBE_MCATEGORY); |
||
| 253 | |||
| 254 | include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||
| 255 | $xoopstubetree = new XoopstubeTree($GLOBALS['xoopsDB']->prefix('xoopstube_cat'), 'cid', 'pid'); |
||
| 256 | $sform = new XoopsThemeForm(_AM_XOOPSTUBE_CCATEGORY_MOVE, 'move', xoops_getenv('PHP_SELF')); |
||
| 257 | ob_start(); |
||
| 258 | $xoopstubetree->makeMySelBox('title', 'title', 0, 0, 'target'); |
||
| 259 | $sform->addElement(new XoopsFormLabel(_AM_XOOPSTUBE_BMODIFY, ob_get_contents())); |
||
| 260 | ob_end_clean(); |
||
| 261 | $create_tray = new XoopsFormElementTray('', ''); |
||
| 262 | $create_tray->addElement(new XoopsFormHidden('source', $cid)); |
||
| 263 | $create_tray->addElement(new XoopsFormHidden('ok', 1)); |
||
| 264 | $create_tray->addElement(new XoopsFormHidden('op', 'move')); |
||
| 265 | $butt_save = new XoopsFormButton('', '', _AM_XOOPSTUBE_BMOVE, 'submit'); |
||
| 266 | $butt_save->setExtra('onclick="this.form.elements.op.value=\'move\'"'); |
||
| 267 | $create_tray->addElement($butt_save); |
||
| 268 | $butt_cancel = new XoopsFormButton('', '', _AM_XOOPSTUBE_BCANCEL, 'submit'); |
||
| 269 | $butt_cancel->setExtra('onclick="this.form.elements.op.value=\'cancel\'"'); |
||
| 270 | $create_tray->addElement($butt_cancel); |
||
| 271 | $sform->addElement($create_tray); |
||
| 272 | $sform->display(); |
||
| 273 | xoops_cp_footer(); |
||
| 274 | } else { |
||
| 275 | $source = XoopsRequest::getString('source', '', 'POST'); //$_POST['source']; |
||
| 276 | $target = XoopsRequest::getString('target', '', 'POST'); //$_POST['target']; |
||
| 277 | if ($target === $source) { |
||
| 278 | redirect_header("category.php?op=move&ok=0&cid=$source", 5, _AM_XOOPSTUBE_CCATEGORY_MODIFY_FAILED); |
||
| 279 | } |
||
| 280 | if (!$target) { |
||
| 281 | redirect_header("category.php?op=move&ok=0&cid=$source", 5, _AM_XOOPSTUBE_CCATEGORY_MODIFY_FAILEDT); |
||
| 282 | } |
||
| 283 | $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' set cid = ' . $target . ' WHERE cid =' . $source; |
||
| 284 | $result = $GLOBALS['xoopsDB']->queryF($sql); |
||
| 285 | $error = _AM_XOOPSTUBE_DBERROR . ': <br><br>' . $sql; |
||
| 286 | if (!$result) { |
||
| 287 | trigger_error($error, E_USER_ERROR); |
||
| 288 | } |
||
| 289 | redirect_header('category.php?op=default', 1, _AM_XOOPSTUBE_CCATEGORY_MODIFY_MOVED); |
||
| 290 | } |
||
| 291 | break; |
||
| 292 | |||
| 293 | case 'addCat': |
||
| 294 | |||
| 295 | $groups = XoopsRequest::getArray('groups', array(), 'POST'); //isset($_REQUEST['groups']) ? $_REQUEST['groups'] : array(); |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
81% 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. Loading history...
|
|||
| 296 | $cid = XoopsRequest::getInt('cid', 0, 'POST'); //(isset($_REQUEST['cid'])) ? $_REQUEST['cid'] : 0; |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
81% 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. Loading history...
|
|||
| 297 | $pid = XoopsRequest::getInt('pid', 0, 'POST'); //(isset($_REQUEST['pid'])) ? $_REQUEST['pid'] : 0; |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
81% 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. Loading history...
|
|||
| 298 | $weight = (XoopsRequest::getInt('pid', 0, 'POST') > 0) ? XoopsRequest::getInt('pid', 0, 'POST') : 0; //(isset($_REQUEST['weight']) && $_REQUEST['weight'] > 0) ? $_REQUEST['weight'] : 0; |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
72% 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. Loading history...
|
|||
| 299 | $spotlighthis = XoopsRequest::getInt('lid', 0, 'POST'); //(isset($_REQUEST['lid'])) ? $_REQUEST['lid'] : 0; |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
81% 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. Loading history...
|
|||
| 300 | $spotlighttop = (1 == XoopsRequest::getInt('spotlighttop', 0, 'POST')) ? 1 : 0; //($_REQUEST['spotlighttop'] == 1) ? 1 : 0; |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
64% 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. Loading history...
|
|||
| 301 | $title = XoopsRequest::getString('title', '', 'POST'); //$xtubemyts->addslashes($_REQUEST['title']); |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
90% 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. Loading history...
|
|||
| 302 | $descriptionb = XoopsRequest::getString('description', '', 'POST'); //$xtubemyts->addslashes($_REQUEST['description']); |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
90% 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. Loading history...
|
|||
| 303 | $imgurl = XoopsRequest::getString('imgurl', '', 'POST'); // $_REQUEST['imgurl'] && $_REQUEST['imgurl'] != 'blank.gif') ? $xtubemyts->addslashes($_REQUEST['imgurl']) : ''; |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
69% 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. Loading history...
|
|||
| 304 | $client_id = XoopsRequest::getInt('client_id', 0, 'POST'); //(isset($_REQUEST['client_id'])) ? $_REQUEST['client_id'] : 0; |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
81% 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. Loading history...
|
|||
| 305 | if ($client_id > 0) { |
||
| 306 | $banner_id = 0; |
||
| 307 | } else { |
||
| 308 | $banner_id = XoopsRequest::getInt('banner_id', 0, 'POST'); //(isset($_REQUEST['banner_id'])) ? $_REQUEST['banner_id'] : 0; |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
81% 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. Loading history...
|
|||
| 309 | } |
||
| 310 | $nohtml = XoopsRequest::getInt('nohtml', 0, 'POST'); //isset($_REQUEST['nohtml']) ? $_REQUEST['nohtml'] : 0; |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
79% 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. Loading history...
|
|||
| 311 | $nosmiley = XoopsRequest::getInt('nosmiley', 0, 'POST'); //isset($_REQUEST['nosmiley']) ? $_REQUEST['nosmiley'] : 0; |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
79% 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. Loading history...
|
|||
| 312 | $noxcodes = XoopsRequest::getInt('noxcodes', 0, 'POST'); //isset($_REQUEST['noxcodes']) ? $_REQUEST['noxcodes'] : 0; |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
79% 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. Loading history...
|
|||
| 313 | $noimages = XoopsRequest::getInt('noimages', 0, 'POST'); //isset($_REQUEST['noimages']) ? $_REQUEST['noimages'] : 0; |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
79% 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. Loading history...
|
|||
| 314 | $nobreak = XoopsRequest::getInt('nobreak', 0, 'POST'); //isset($_REQUEST['nobreak']) ? $_REQUEST['nobreak'] : 0; |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
79% 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. Loading history...
|
|||
| 315 | |||
| 316 | if (!$cid) { |
||
| 317 | $cid = 0; |
||
| 318 | $sql = 'INSERT INTO ' . $GLOBALS['xoopsDB']->prefix('xoopstube_cat') |
||
| 319 | . " (cid, pid, title, imgurl, description, nohtml, nosmiley, noxcodes, noimages, nobreak, weight, spotlighttop, spotlighthis, client_id, banner_id ) VALUES ($cid, $pid, '$title', '$imgurl', '$descriptionb', '$nohtml', '$nosmiley', '$noxcodes', '$noimages', '$nobreak', '$weight', $spotlighttop, $spotlighthis, $client_id, $banner_id )"; |
||
| 320 | if ($cid == 0) { |
||
| 321 | $newid = $GLOBALS['xoopsDB']->getInsertId(); |
||
| 322 | } |
||
| 323 | |||
| 324 | // Notify of new category |
||
| 325 | |||
| 326 | global $xoopsModule; |
||
| 327 | $tags = array(); |
||
| 328 | $tags['CATEGORY_NAME'] = $title; |
||
| 329 | $tags['CATEGORY_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . $newid; |
||
| 330 | $notificationHandler = xoops_getHandler('notification'); |
||
| 331 | $notificationHandler->triggerEvent('global', 0, 'new_category', $tags); |
||
| 332 | $database_mess = _AM_XOOPSTUBE_CCATEGORY_CREATED; |
||
| 333 | } else { |
||
| 334 | if ($cid == $pid) { |
||
| 335 | redirect_header('category.php', 1, _AM_XOOPSTUBE_ERROR_CATISCAT); |
||
| 336 | } |
||
| 337 | $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('xoopstube_cat') |
||
| 338 | . " SET title ='$title', imgurl='$imgurl', pid =$pid, description='$descriptionb', spotlighthis='$spotlighthis' , spotlighttop='$spotlighttop', nohtml='$nohtml', nosmiley='$nosmiley', noxcodes='$noxcodes', noimages='$noimages', nobreak='$nobreak', weight='$weight', client_id='$client_id', banner_id='$banner_id' WHERE cid=" |
||
| 339 | . (int)$cid; |
||
| 340 | $database_mess = _AM_XOOPSTUBE_CCATEGORY_MODIFIED; |
||
| 341 | } |
||
| 342 | if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
||
| 343 | XoopsErrorHandler_HandleError(E_USER_WARNING, $sql, __FILE__, __LINE__); |
||
| 344 | |||
| 345 | return false; |
||
| 346 | } |
||
| 347 | redirect_header('category.php', 1, $database_mess); |
||
| 348 | break; |
||
| 349 | |||
| 350 | case 'del': |
||
| 351 | |||
| 352 | global $xoopsModule; |
||
|
0 ignored issues
–
show
Compatibility
Best Practice
introduced
by
Use of
global functionality is not recommended; it makes your code harder to test, and less reusable.
Instead of relying on 1. Pass all data via parametersfunction myFunction($a, $b) {
// Do something
}
2. Create a class that maintains your stateclass MyClass {
private $a;
private $b;
public function __construct($a, $b) {
$this->a = $a;
$this->b = $b;
}
public function myFunction() {
// Do something
}
}
Loading history...
|
|||
| 353 | |||
| 354 | // $cid = (isset($_POST['cid']) && is_numeric($_POST['cid'])) ? (int) $_POST['cid'] : (int) $_GET['cid']; |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
70% 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. Loading history...
|
|||
| 355 | $cid = XoopsRequest::getInt('cid', XoopsRequest::getInt('cid', 0, 'GET'), 'POST'); |
||
| 356 | // $ok = (isset($_POST['ok']) && $_POST['ok'] == 1) ? (int) $_POST['ok'] : 0; |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
65% 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. Loading history...
|
|||
| 357 | $ok = (1 == XoopsRequest::getInt('ok', 0, 'POST')) ? 1 : 0; |
||
| 358 | $xoopstubetree = new XoopstubeTree($GLOBALS['xoopsDB']->prefix('xoopstube_cat'), 'cid', 'pid'); |
||
| 359 | |||
| 360 | if ($ok == 1) { |
||
| 361 | // get all subcategories under the specified category |
||
| 362 | $arr = $xoopstubetree->getAllChildId($cid); |
||
| 363 | $lcount = count($arr); |
||
| 364 | |||
| 365 | for ($i = 0; $i < $lcount; ++$i) { |
||
| 366 | // get all links in each subcategory |
||
| 367 | $result = $GLOBALS['xoopsDB']->query('SELECT lid FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE cid=' . (int)$arr[$i]); |
||
| 368 | // now for each linkload, delete the text data and vote ata associated with the linkload |
||
| 369 | View Code Duplication | while (false !== (list($lid) = $GLOBALS['xoopsDB']->fetchRow($result))) { |
|
|
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. Loading history...
|
|||
| 370 | $sql = sprintf('DELETE FROM %s WHERE lid = %u', $GLOBALS['xoopsDB']->prefix('xoopstube_votedata'), (int)$lid); |
||
| 371 | $GLOBALS['xoopsDB']->query($sql); |
||
| 372 | $sql = sprintf('DELETE FROM %s WHERE lid = %u', $GLOBALS['xoopsDB']->prefix('xoopstube_videos'), (int)$lid); |
||
| 373 | $GLOBALS['xoopsDB']->query($sql); |
||
| 374 | |||
| 375 | // delete comments |
||
| 376 | xoops_comment_delete($xoopsModule->getVar('mid'), $lid); |
||
| 377 | } |
||
| 378 | // all links for each subcategory is deleted, now delete the subcategory data |
||
| 379 | $sql = sprintf('DELETE FROM %s WHERE cid = %u', $GLOBALS['xoopsDB']->prefix('xoopstube_cat'), (int)$arr[$i]); |
||
| 380 | $GLOBALS['xoopsDB']->query($sql); |
||
| 381 | // delete altcat entries |
||
| 382 | $sql = sprintf('DELETE FROM %s WHERE cid = %u', $GLOBALS['xoopsDB']->prefix('xoopstube_altcat'), $arr[$i]); |
||
| 383 | $GLOBALS['xoopsDB']->query($sql); |
||
| 384 | } |
||
| 385 | // all subcategory and associated data are deleted, now delete category data and its associated data |
||
| 386 | $result = $GLOBALS['xoopsDB']->query('SELECT lid FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE cid=' . (int)$cid); |
||
| 387 | View Code Duplication | while (false !== (list($lid) = $GLOBALS['xoopsDB']->fetchRow($result))) { |
|
|
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. Loading history...
|
|||
| 388 | $sql = sprintf('DELETE FROM %s WHERE lid = %u', $GLOBALS['xoopsDB']->prefix('xoopstube_videos'), (int)$lid); |
||
| 389 | $GLOBALS['xoopsDB']->query($sql); |
||
| 390 | // delete comments |
||
| 391 | xoops_comment_delete($xoopsModule->getVar('mid'), (int)$lid); |
||
| 392 | $sql = sprintf('DELETE FROM %s WHERE lid = %u', $GLOBALS['xoopsDB']->prefix('xoopstube_votedata'), (int)$lid); |
||
| 393 | $GLOBALS['xoopsDB']->query($sql); |
||
| 394 | } |
||
| 395 | |||
| 396 | // delete altcat entries |
||
| 397 | $sql = sprintf('DELETE FROM %s WHERE cid = %u', $GLOBALS['xoopsDB']->prefix('xoopstube_altcat'), (int)$cid); |
||
| 398 | $GLOBALS['xoopsDB']->query($sql); |
||
| 399 | |||
| 400 | // delete category |
||
| 401 | $sql = sprintf('DELETE FROM %s WHERE cid = %u', $GLOBALS['xoopsDB']->prefix('xoopstube_cat'), (int)$cid); |
||
| 402 | $error = _AM_XOOPSTUBE_DBERROR . ': <br><br>' . $sql; |
||
| 403 | xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'XTubeCatPerm', (int)$cid); |
||
| 404 | if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
||
| 405 | trigger_error($error, E_USER_ERROR); |
||
| 406 | } |
||
| 407 | |||
| 408 | // delete group permissions |
||
| 409 | xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'XTubeCatPerm', $cid); |
||
| 410 | if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
||
| 411 | trigger_error($error, E_USER_ERROR); |
||
| 412 | } |
||
| 413 | xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'XTubeSubPerm', $cid); |
||
| 414 | if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
||
| 415 | trigger_error($error, E_USER_ERROR); |
||
| 416 | } |
||
| 417 | xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'XTubeAppPerm', $cid); |
||
| 418 | if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
||
| 419 | trigger_error($error, E_USER_ERROR); |
||
| 420 | } |
||
| 421 | xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'XTubeAutoApp', $cid); |
||
| 422 | if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
||
| 423 | trigger_error($error, E_USER_ERROR); |
||
| 424 | } |
||
| 425 | xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'XTubeRatePerms', $cid); |
||
| 426 | if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
||
| 427 | trigger_error($error, E_USER_ERROR); |
||
| 428 | } |
||
| 429 | |||
| 430 | redirect_header('category.php', 1, _AM_XOOPSTUBE_CCATEGORY_DELETED); |
||
| 431 | } else { |
||
| 432 | xoops_cp_header(); |
||
| 433 | xoops_confirm(array( |
||
| 434 | 'op' => 'del', |
||
| 435 | 'cid' => (int)$cid, |
||
| 436 | 'ok' => 1 |
||
| 437 | ), 'category.php', _AM_XOOPSTUBE_CCATEGORY_AREUSURE); |
||
| 438 | xoops_cp_footer(); |
||
| 439 | } |
||
| 440 | break; |
||
| 441 | |||
| 442 | case 'modCat': |
||
| 443 | $cid = XoopsRequest::getInt('cid', 0, 'POST'); //(isset($_POST['cid'])) ? $_POST['cid'] : 0; |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
81% 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. Loading history...
|
|||
| 444 | xoops_cp_header(); |
||
| 445 | //xtubeRenderAdminMenu(_AM_XOOPSTUBE_MCATEGORY); |
||
| 446 | createCategory($cid); |
||
| 447 | include_once __DIR__ . '/admin_footer.php'; |
||
| 448 | break; |
||
| 449 | |||
| 450 | case 'main': |
||
| 451 | default: |
||
| 452 | xoops_cp_header(); |
||
| 453 | //xtubeRenderAdminMenu(_AM_XOOPSTUBE_MCATEGORY); |
||
| 454 | |||
| 455 | // include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||
| 456 | $xoopstubetree = new XoopstubeTree($GLOBALS['xoopsDB']->prefix('xoopstube_cat'), 'cid', 'pid'); |
||
| 457 | $sform = new XoopsThemeForm(_AM_XOOPSTUBE_CCATEGORY_MODIFY, 'category', xoops_getenv('PHP_SELF')); |
||
| 458 | $totalcats = XoopstubeUtilities::xtubeGetTotalCategoryCount(); |
||
| 459 | |||
| 460 | if ($totalcats > 0) { |
||
| 461 | ob_start(); |
||
| 462 | $xoopstubetree->makeMySelBox('title', 'title'); |
||
| 463 | $sform->addElement(new XoopsFormLabel(_AM_XOOPSTUBE_CCATEGORY_MODIFY_TITLE, ob_get_contents())); |
||
| 464 | ob_end_clean(); |
||
| 465 | $dup_tray = new XoopsFormElementTray('', ''); |
||
| 466 | $dup_tray->addElement(new XoopsFormHidden('op', 'modCat')); |
||
| 467 | $butt_dup = new XoopsFormButton('', '', _AM_XOOPSTUBE_BMODIFY, 'submit'); |
||
| 468 | $butt_dup->setExtra('onclick="this.form.elements.op.value=\'modCat\'"'); |
||
| 469 | $dup_tray->addElement($butt_dup); |
||
| 470 | $butt_move = new XoopsFormButton('', '', _AM_XOOPSTUBE_BMOVE, 'submit'); |
||
| 471 | $butt_move->setExtra('onclick="this.form.elements.op.value=\'move\'"'); |
||
| 472 | $dup_tray->addElement($butt_move); |
||
| 473 | $butt_dupct = new XoopsFormButton('', '', _AM_XOOPSTUBE_BDELETE, 'submit'); |
||
| 474 | $butt_dupct->setExtra('onclick="this.form.elements.op.value=\'del\'"'); |
||
| 475 | $dup_tray->addElement($butt_dupct); |
||
| 476 | $sform->addElement($dup_tray); |
||
| 477 | $sform->display(); |
||
| 478 | } |
||
| 479 | createCategory(0); |
||
| 480 | include_once __DIR__ . '/admin_footer.php'; |
||
| 481 | break; |
||
| 482 | } |
||
| 483 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: