mambax7 /
adslight
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
|
0 ignored issues
–
show
|
|||
| 2 | /* |
||
| 3 | ------------------------------------------------------------------------- |
||
| 4 | ADSLIGHT 2 : Module for Xoops |
||
| 5 | |||
| 6 | Redesigned and ameliorate By Luc Bizet user at www.frxoops.org |
||
| 7 | Started with the Classifieds module and made MANY changes |
||
| 8 | Website : http://www.luc-bizet.fr |
||
| 9 | Contact : [email protected] |
||
| 10 | ------------------------------------------------------------------------- |
||
| 11 | Original credits below Version History |
||
| 12 | ########################################################################## |
||
| 13 | # Classified Module for Xoops # |
||
| 14 | # By John Mordo user jlm69 at www.xoops.org and www.jlmzone.com # |
||
| 15 | # Started with the MyAds module and made MANY changes # |
||
| 16 | ########################################################################## |
||
| 17 | Original Author: Pascal Le Boustouller |
||
| 18 | Author Website : [email protected] |
||
| 19 | Licence Type : GPL |
||
| 20 | ------------------------------------------------------------------------- |
||
| 21 | */ |
||
| 22 | |||
| 23 | include_once __DIR__ . '/admin_header.php'; |
||
| 24 | xoops_cp_header(); |
||
| 25 | |||
| 26 | if (isset($_REQUEST['op'])) { |
||
| 27 | $op = $_REQUEST['op']; |
||
| 28 | } else { |
||
| 29 | $op = 'liste'; |
||
| 30 | } |
||
| 31 | |||
| 32 | # function AdsNewCat |
||
| 33 | ##################################################### |
||
| 34 | /** |
||
| 35 | * @param $cat |
||
| 36 | */ |
||
| 37 | function AdsNewCat($cat) |
||
| 38 | { |
||
| 39 | global $xoopsDB, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $myts, $moduleDirName; |
||
| 40 | |||
| 41 | $mytree = new ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); |
||
| 42 | |||
| 43 | include_once __DIR__ . '/header.php'; |
||
| 44 | |||
| 45 | // loadModuleAdminMenu(1, ""); |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
67% 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...
|
|||
| 46 | echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_ADSLIGHT_ADDSUBCAT . '</legend>'; |
||
| 47 | ShowImg(); |
||
| 48 | |||
| 49 | echo "<form method=\"post\" action=\"category.php\" name=\"imcat\"><input type=\"hidden\" name=\"op\" value=\"AdsAddCat\"></font><br><br> |
||
| 50 | <table class=\"outer\" border=0> |
||
| 51 | <tr> |
||
| 52 | <td class=\"even\">" . _AM_ADSLIGHT_CATNAME . " </td><td class=\"odd\" colspan=2><input type=\"text\" name=\"title\" size=\"50\" maxlength=\"100\"> " . _AM_ADSLIGHT_IN . ' '; |
||
| 53 | |||
| 54 | $cid = $_GET['cid']; |
||
| 55 | |||
| 56 | $result = |
||
| 57 | $xoopsDB->query('select cid, pid, title, cat_desc, cat_keywords, img, ordre, affprice, cat_moderate, moderate_subcat from ' . $xoopsDB->prefix('adslight_categories') . " where cid=$cat"); |
||
| 58 | list($cat_id, $pid, $title, $cat_desc, $cat_keywords, $imgs, $ordre, $affprice, $cat_moderate, $moderate_subcat) = $xoopsDB->fetchRow($result); |
||
| 59 | $mytree->makeMySelBox('title', 'title', $cat, 1); |
||
| 60 | echo '</td> |
||
| 61 | </tr>'; |
||
| 62 | $cat_desc = ''; |
||
| 63 | $cat_keywords = ''; |
||
| 64 | |||
| 65 | View Code Duplication | if ($xoopsModuleConfig['adslight_cat_desc'] = '1') { |
|
| 66 | echo "<tr><td class=\"even\">" . _AM_ADSLIGHT_CAT_META_DESCRIPTION . " </td><td class=\"odd\" colspan=2>"; |
||
| 67 | echo "<input type=\"text\" name=\"cat_desc\" value=\"$cat_desc\" size=\"80\" maxlength=\"200\">"; |
||
| 68 | echo '</td></tr>'; |
||
| 69 | |||
| 70 | echo "<tr><td class=\"even\">" . _AM_ADSLIGHT_CAT_META_KEYWORDS . " </td><td class=\"odd\" colspan=2>"; |
||
| 71 | echo "<input type=\"text\" name=\"cat_keywords\" value=\"$cat_keywords\" size=\"80\" maxlength=\"200\">"; |
||
| 72 | echo '</td></tr>'; |
||
| 73 | } |
||
| 74 | |||
| 75 | echo "<tr> |
||
| 76 | <td class=\"even\">" . _AM_ADSLIGHT_IMGCAT . " </td><td class=\"odd\" colspan=2><select name=\"img\" onChange=\"showimage()\">"; |
||
| 77 | |||
| 78 | $rep = XOOPS_ROOT_PATH . '/modules/adslight/assets/images/img_cat'; |
||
| 79 | $handle = opendir($rep); |
||
| 80 | while ($file = readdir($handle)) { |
||
| 81 | $filelist[] = $file; |
||
| 82 | } |
||
| 83 | asort($filelist); |
||
| 84 | View Code Duplication | while (list($key, $file) = each($filelist)) { |
|
| 85 | if (!preg_match('`gif$|jpg$|png$`i', $file)) { |
||
| 86 | if ($file === '.' || $file === '..') { |
||
| 87 | $a = 1; |
||
|
0 ignored issues
–
show
$a 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...
|
|||
| 88 | } |
||
| 89 | } else { |
||
| 90 | if ($file === 'default.png') { |
||
| 91 | echo "<option value=$file selected>$file</option>"; |
||
| 92 | } else { |
||
| 93 | echo "<option value=$file>$file</option>"; |
||
| 94 | } |
||
| 95 | } |
||
| 96 | } |
||
| 97 | echo "</select> <img src=\"" . |
||
| 98 | XOOPS_URL . |
||
| 99 | "/modules/adslight/assets/images/img_cat/default.png\" name=\"avatar\" align=\"absmiddle\"><br/><b>" . |
||
| 100 | _AM_ADSLIGHT_REPIMGCAT . |
||
| 101 | '</b><br/>../modules/adslight/assets/images/img_cat/..</td></tr>'; |
||
| 102 | |||
| 103 | echo "<tr><td class=\"even\">" . |
||
| 104 | _AM_ADSLIGHT_DISPLPRICE2 . |
||
| 105 | " </td><td class=\"odd\" colspan=2><input type=\"radio\" name=\"affprice\" value=\"1\" checked>" . |
||
| 106 | _AM_ADSLIGHT_OUI . |
||
| 107 | " <input type=\"radio\" name=\"affprice\" value=\"0\">" . |
||
| 108 | _AM_ADSLIGHT_NON . |
||
| 109 | ' (' . |
||
| 110 | _AM_ADSLIGHT_INTHISCAT . |
||
| 111 | ')</td></tr>'; |
||
| 112 | |||
| 113 | echo "<tr><td class=\"even\">" . |
||
| 114 | _AM_ADSLIGHT_MODERATE_CAT . |
||
| 115 | " </td><td class=\"odd\" colspan=2><input type=\"radio\" name=\"cat_moderate\" value=\"1\"checked>" . |
||
| 116 | _AM_ADSLIGHT_OUI . |
||
| 117 | " <input type=\"radio\" name=\"cat_moderate\" value=\"0\">" . |
||
| 118 | _AM_ADSLIGHT_NON . |
||
| 119 | '</td></tr>'; |
||
| 120 | |||
| 121 | echo "<tr><td class=\"even\">" . |
||
| 122 | _AM_ADSLIGHT_MODERATE_SUBCATS . |
||
| 123 | " </td><td class=\"odd\" colspan=2><input type=\"radio\" name=\"moderate_subcat\" value=\"1\"checked>" . |
||
| 124 | _AM_ADSLIGHT_OUI . |
||
| 125 | " <input type=\"radio\" name=\"moderate_subcat\" value=\"0\">" . |
||
| 126 | _AM_ADSLIGHT_NON . |
||
| 127 | '</td></tr>'; |
||
| 128 | |||
| 129 | if ($xoopsModuleConfig['adslight_csortorder'] !== 'title') { |
||
| 130 | echo '<tr><td>' . |
||
| 131 | _AM_ADSLIGHT_ORDRE . |
||
| 132 | " </td><td><input type=\"text\" name=\"ordre\" size=\"4\" value=\"0\" /></td><td class=\"foot\"><input type=\"submit\" value=\"" . |
||
| 133 | _AM_ADSLIGHT_ADD . |
||
| 134 | "\" /></td></tr>"; |
||
| 135 | } else { |
||
| 136 | $ordre = (int)$ordre; |
||
| 137 | echo "<input type=\"hidden\" name=\"ordre\" value=\"$ordre\">"; |
||
| 138 | echo "<tr><td class=\"foot\" colspan=3><input type=\"submit\" value=\"" . _AM_ADSLIGHT_ADD . "\" /></td></tr>"; |
||
| 139 | } |
||
| 140 | |||
| 141 | echo '</table> |
||
| 142 | </form>'; |
||
| 143 | echo '<br>'; |
||
| 144 | |||
| 145 | echo '</fieldset><br>'; |
||
| 146 | xoops_cp_footer(); |
||
| 147 | } |
||
| 148 | |||
| 149 | # function AdsModCat |
||
| 150 | ##################################################### |
||
| 151 | /** |
||
| 152 | * @param $cid |
||
| 153 | */ |
||
| 154 | function AdsModCat($cid) |
||
| 155 | { |
||
| 156 | global $xoopsDB, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $myts, $moduleDirName; |
||
| 157 | |||
| 158 | $mytree = new ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); |
||
| 159 | |||
| 160 | include_once __DIR__ . '/header.php'; |
||
| 161 | |||
| 162 | // loadModuleAdminMenu(1, ""); |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
67% 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...
|
|||
| 163 | echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_ADSLIGHT_MODIFCAT . '</legend>'; |
||
| 164 | ShowImg(); |
||
| 165 | |||
| 166 | $result = |
||
| 167 | $xoopsDB->query('select cid, pid, title, cat_desc, cat_keywords, img, ordre, affprice, cat_moderate, moderate_subcat from ' . $xoopsDB->prefix('adslight_categories') . " where cid=$cid"); |
||
| 168 | list($cat_id, $pid, $title, $cat_desc, $cat_keywords, $imgs, $ordre, $affprice, $cat_moderate, $moderate_subcat) = $xoopsDB->fetchRow($result); |
||
| 169 | |||
| 170 | $title = $myts->htmlSpecialChars($title); |
||
| 171 | $cat_desc = $myts->addSlashes($cat_desc); |
||
| 172 | echo "<form action=\"category.php\" method=\"post\" name=\"imcat\"> |
||
| 173 | <table class=\"outer\" border=\"0\"><tr> |
||
| 174 | <td class=\"even\">" . |
||
| 175 | _AM_ADSLIGHT_CATNAME . |
||
| 176 | " </td><td class=\"odd\"><input type=\"text\" name=\"title\" value=\"$title\" size=\"50\" maxlength=\"100\" /> " . |
||
| 177 | _AM_ADSLIGHT_IN . |
||
| 178 | ' '; |
||
| 179 | $mytree->makeMySelBox('title', 'title', $pid, 1); |
||
| 180 | echo '</td></tr>'; |
||
| 181 | |||
| 182 | View Code Duplication | if ($xoopsModuleConfig['adslight_cat_desc'] = '1') { |
|
|
1 ignored issue
–
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...
|
|||
| 183 | echo "<tr><td class=\"even\">" . _AM_ADSLIGHT_CAT_META_DESCRIPTION . " </td><td class=\"odd\" colspan=2>"; |
||
| 184 | echo "<input type=\"text\" name=\"cat_desc\" value=\"$cat_desc\" size=\"80\" maxlength=\"200\">"; |
||
| 185 | echo '</td></tr>'; |
||
| 186 | |||
| 187 | echo "<tr><td class=\"even\">" . _AM_ADSLIGHT_CAT_META_KEYWORDS . " </td><td class=\"odd\" colspan=2>"; |
||
| 188 | echo "<input type=\"text\" name=\"cat_keywords\" value=\"$cat_keywords\" size=\"80\" maxlength=\"200\">"; |
||
| 189 | echo '</td></tr>'; |
||
| 190 | } |
||
| 191 | |||
| 192 | echo "<tr> |
||
| 193 | <td class=\"even\">" . _AM_ADSLIGHT_IMGCAT . " </td><td class=\"odd\"><select name=\"img\" onChange=\"showimage()\">"; |
||
| 194 | |||
| 195 | $rep = XOOPS_ROOT_PATH . '/modules/adslight/assets/images/img_cat'; |
||
| 196 | $handle = opendir($rep); |
||
| 197 | while ($file = readdir($handle)) { |
||
| 198 | $filelist[] = $file; |
||
| 199 | } |
||
| 200 | asort($filelist); |
||
| 201 | View Code Duplication | while (list($key, $file) = each($filelist)) { |
|
| 202 | if (!preg_match('`gif$|jpg$|png$`i', $file)) { |
||
| 203 | if ($file === '.' || $file === '..') { |
||
| 204 | $a = 1; |
||
|
0 ignored issues
–
show
$a 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...
|
|||
| 205 | } |
||
| 206 | } else { |
||
| 207 | if ($file == $imgs) { |
||
| 208 | echo "<option value=$file selected>$file</option>"; |
||
| 209 | } else { |
||
| 210 | echo "<option value=$file>$file</option>"; |
||
| 211 | } |
||
| 212 | } |
||
| 213 | } |
||
| 214 | echo "</select> <img src=\"" . |
||
| 215 | XOOPS_URL . |
||
| 216 | "/modules/adslight/assets/images/img_cat/$imgs\" name=\"avatar\" align=\"absmiddle\"><br/><b>" . |
||
| 217 | _AM_ADSLIGHT_REPIMGCAT . |
||
| 218 | '</b><br/>../modules/adslight/assets/images/img_cat/..</td></tr>'; |
||
| 219 | |||
| 220 | echo "<tr><td class=\"even\">" . _AM_ADSLIGHT_DISPLPRICE2 . " </td><td class=\"odd\" colspan=2><input type=\"radio\" name=\"affprice\" value=\"1\""; |
||
| 221 | if ($affprice == '1') { |
||
| 222 | echo 'checked'; |
||
| 223 | } |
||
| 224 | echo '>' . _AM_ADSLIGHT_OUI . " <input type=\"radio\" name=\"affprice\" value=\"0\""; |
||
| 225 | if ($affprice == '0') { |
||
| 226 | echo 'checked'; |
||
| 227 | } |
||
| 228 | echo '>' . _AM_ADSLIGHT_NON . ' (' . _AM_ADSLIGHT_INTHISCAT . ')</td></tr>'; |
||
| 229 | |||
| 230 | echo "<tr><td class=\"even\">" . _AM_ADSLIGHT_MODERATE_CAT . " </td><td class=\"odd\" colspan=2><input type=\"radio\" name=\"cat_moderate\" value=\"1\""; |
||
| 231 | if ($cat_moderate == '1') { |
||
| 232 | echo 'checked'; |
||
| 233 | } |
||
| 234 | echo '>' . _AM_ADSLIGHT_OUI . " <input type=\"radio\" name=\"cat_moderate\" value=\"0\""; |
||
| 235 | if ($cat_moderate == '0') { |
||
| 236 | echo 'checked'; |
||
| 237 | } |
||
| 238 | echo '>' . _AM_ADSLIGHT_NON . '</td></tr>'; |
||
| 239 | |||
| 240 | echo "<tr><td class=\"even\">" . _AM_ADSLIGHT_MODERATE_SUBCATS . " </td><td class=\"odd\" colspan=2><input type=\"radio\" name=\"moderate_subcat\" value=\"1\""; |
||
| 241 | if ($moderate_subcat == '1') { |
||
| 242 | echo 'checked'; |
||
| 243 | } |
||
| 244 | echo '>' . _AM_ADSLIGHT_OUI . " <input type=\"radio\" name=\"moderate_subcat\" value=\"0\""; |
||
| 245 | if ($moderate_subcat == '0') { |
||
| 246 | echo 'checked'; |
||
| 247 | } |
||
| 248 | echo '>' . _AM_ADSLIGHT_NON . '</td></tr>'; |
||
| 249 | |||
| 250 | if ($xoopsModuleConfig['adslight_csortorder'] !== 'title') { |
||
| 251 | echo "<tr><td class=\"even\">" . _AM_ADSLIGHT_ORDRE . " </td><td class=\"odd\"><input type=\"text\" name=\"ordre\" size=\"4\" value=\"$ordre\"></td></tr>"; |
||
| 252 | } else { |
||
| 253 | $ordre = (int)$ordre; |
||
| 254 | echo "<input type=\"hidden\" name=\"ordre\" value=\"$ordre\">"; |
||
| 255 | } |
||
| 256 | |||
| 257 | echo '</table>'; |
||
| 258 | |||
| 259 | echo "<input type=\"hidden\" name=\"cidd\" value=\"$cid\">" . |
||
| 260 | "<input type=\"hidden\" name=\"op\" value=\"AdsModCatS\">" . |
||
| 261 | "<table class=\"foot\" border=\"0\"><tr><td width=\"20%\"><br>" |
||
| 262 | |||
| 263 | . |
||
| 264 | "<input type=\"submit\" value=\"" . |
||
| 265 | _AM_ADSLIGHT_SAVMOD . |
||
| 266 | "\"></form></td><td><br>" . |
||
| 267 | "<form action=\"category.php\" method=\"post\">" . |
||
| 268 | "<input type=\"hidden\" name=\"cid\" value=\"$cid\">" . |
||
| 269 | "<input type=\"hidden\" name=\"op\" value=\"AdsDelCat\">" . |
||
| 270 | "<input type=\"submit\" value=\"" . |
||
| 271 | _AM_ADSLIGHT_DEL . |
||
| 272 | "\"></form></td></tr></table>"; |
||
| 273 | echo '</fieldset><br>'; |
||
| 274 | xoops_cp_footer(); |
||
| 275 | } |
||
| 276 | |||
| 277 | # function AdsModCatS |
||
| 278 | ##################################################### |
||
| 279 | /** |
||
| 280 | * @param $cidd |
||
| 281 | * @param $cid |
||
| 282 | * @param $img |
||
| 283 | * @param $title |
||
| 284 | * @param $cat_desc |
||
| 285 | * @param $cat_keywords |
||
| 286 | * @param $ordre |
||
| 287 | * @param $affprice |
||
| 288 | * @param $cat_moderate |
||
| 289 | * @param $moderate_subcat |
||
| 290 | */ |
||
| 291 | function AdsModCatS($cidd, $cid, $img, $title, $cat_desc, $cat_keywords, $ordre, $affprice, $cat_moderate, $moderate_subcat) |
||
| 292 | { |
||
| 293 | global $xoopsDB, $xoopsConfig, $myts, $moduleDirName; |
||
| 294 | |||
| 295 | $title = $myts->htmlSpecialChars($title); |
||
| 296 | |||
| 297 | $xoopsDB->query('update ' . |
||
| 298 | $xoopsDB->prefix('adslight_categories') . |
||
| 299 | " set title='$title', cat_desc='$cat_desc', cat_keywords='$cat_keywords', pid='$cid', img='$img', ordre='$ordre', affprice='$affprice', cat_moderate='$cat_moderate', moderate_subcat='$moderate_subcat' where cid=$cidd"); |
||
| 300 | |||
| 301 | View Code Duplication | if ($moderate_subcat != 1) { |
|
| 302 | $xoopsDB->queryF('UPDATE ' . $xoopsDB->prefix('adslight_categories') . ' SET cat_moderate=0, moderate_subcat=0 WHERE pid = ' . $xoopsDB->escape($cidd) . ''); |
||
| 303 | } else { |
||
| 304 | $xoopsDB->queryF('UPDATE ' . $xoopsDB->prefix('adslight_categories') . ' SET cat_moderate=1, moderate_subcat=1 WHERE pid = ' . $xoopsDB->escape($cidd) . ''); |
||
| 305 | } |
||
| 306 | |||
| 307 | redirect_header('map.php', 10, _AM_ADSLIGHT_CATSMOD); |
||
| 308 | } |
||
| 309 | |||
| 310 | # function AdsAddCat |
||
| 311 | ##################################################### |
||
| 312 | /** |
||
| 313 | * @param $title |
||
| 314 | * @param $cat_desc |
||
| 315 | * @param $cat_keywords |
||
| 316 | * @param $cid |
||
| 317 | * @param $img |
||
| 318 | * @param $ordre |
||
| 319 | * @param $affprice |
||
| 320 | * @param $cat_moderate |
||
| 321 | * @param $moderate_subcat |
||
| 322 | */ |
||
| 323 | function AdsAddCat($title, $cat_desc, $cat_keywords, $cid, $img, $ordre, $affprice, $cat_moderate, $moderate_subcat) |
||
| 324 | { |
||
| 325 | global $xoopsDB, $xoopsConfig, $myts, $moduleDirName; |
||
| 326 | |||
| 327 | $title = $myts->htmlSpecialChars($title); |
||
| 328 | $moderate_subcat = (int)$moderate_subcat; |
||
| 329 | if ($title == '') { |
||
| 330 | $title = '! ! ? ! !'; |
||
| 331 | } |
||
| 332 | |||
| 333 | $xoopsDB->query('insert into ' . |
||
| 334 | $xoopsDB->prefix('adslight_categories') . |
||
| 335 | " values (NULL, '$cid', '$title', '$cat_desc', '$cat_keywords', '$img', '$ordre', '$affprice', '$cat_moderate', '$moderate_subcat')"); |
||
| 336 | |||
| 337 | View Code Duplication | if ($moderate_subcat = 1) { |
|
| 338 | $xoopsDB->queryF('UPDATE ' . $xoopsDB->prefix('adslight_categories') . ' SET cat_moderate=1 WHERE pid = ' . $xoopsDB->escape($cid) . ''); |
||
| 339 | } else { |
||
| 340 | $xoopsDB->queryF('UPDATE ' . $xoopsDB->prefix('adslight_categories') . ' SET cat_moderate=0 WHERE pid = ' . $xoopsDB->escape($cid) . ''); |
||
| 341 | } |
||
| 342 | |||
| 343 | redirect_header('map.php', 3, _AM_ADSLIGHT_CATADD); |
||
| 344 | } |
||
| 345 | |||
| 346 | # function AdsDelCat |
||
| 347 | ##################################################### |
||
| 348 | /** |
||
| 349 | * @param $cid |
||
| 350 | * @param int $ok |
||
| 351 | */ |
||
| 352 | function AdsDelCat($cid, $ok = 0) |
||
| 353 | { |
||
| 354 | global $xoopsDB, $xoopsConfig, $xoopsModule, $moduleDirName; |
||
| 355 | |||
| 356 | if ((int)$ok == 1) { |
||
| 357 | $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection(); |
||
| 358 | $xoopsDB->queryF('delete from ' . $xoopsDB->prefix('adslight_categories') . " where cid=$cid or pid=$cid"); |
||
| 359 | $xoopsDB->queryF('delete from ' . $xoopsDB->prefix('adslight_listing') . " where cid=$cid"); |
||
| 360 | |||
| 361 | redirect_header('map.php', 1, _AM_ADSLIGHT_CATDEL); |
||
| 362 | } else { |
||
| 363 | include_once __DIR__ . '/header.php'; |
||
| 364 | // loadModuleAdminMenu(1, ""); |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
67% 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...
|
|||
| 365 | |||
| 366 | OpenTable(); |
||
| 367 | echo '<br><center><b>' . _AM_ADSLIGHT_SURDELCAT . '</b><br><br>'; |
||
| 368 | echo "[ <a href=\"category.php?op=AdsDelCat&cid=$cid&ok=1\">" . _AM_ADSLIGHT_OUI . "</a> | <a href=\"map.php\">" . _AM_ADSLIGHT_NON . '</a> ]<br><br>'; |
||
| 369 | CloseTable(); |
||
| 370 | xoops_cp_footer(); |
||
| 371 | } |
||
| 372 | } |
||
| 373 | |||
| 374 | ##################################################### |
||
| 375 | foreach ($_POST as $k => $v) { |
||
| 376 | ${$k} = $v; |
||
| 377 | } |
||
| 378 | |||
| 379 | $ok = isset($_GET['ok']) ? $_GET['ok'] : ''; |
||
| 380 | |||
| 381 | if (!isset($_POST['cid']) && isset($_GET['cid'])) { |
||
| 382 | $cid = $_GET['cid']; |
||
| 383 | } |
||
| 384 | if (!isset($_POST['op']) && isset($_GET['op'])) { |
||
| 385 | $op = $_GET['op']; |
||
| 386 | } |
||
| 387 | |||
| 388 | switch ($op) { |
||
| 389 | |||
| 390 | case 'AdsNewCat': |
||
| 391 | AdsNewCat($cid); |
||
| 392 | break; |
||
| 393 | |||
| 394 | case 'AdsAddCat': |
||
| 395 | AdsAddCat($title, $cat_desc, $cat_keywords, $cid, $img, $ordre, $affprice, $cat_moderate, $moderate_subcat); |
||
| 396 | break; |
||
| 397 | |||
| 398 | case 'AdsDelCat': |
||
| 399 | AdsDelCat($cid, $ok); |
||
| 400 | break; |
||
| 401 | |||
| 402 | case 'AdsModCat': |
||
| 403 | AdsModCat($cid); |
||
| 404 | break; |
||
| 405 | |||
| 406 | case 'AdsModCatS': |
||
| 407 | AdsModCatS($cidd, $cid, $img, $title, $cat_desc, $cat_keywords, $ordre, $affprice, $cat_moderate, $moderate_subcat); |
||
| 408 | break; |
||
| 409 | |||
| 410 | default: |
||
| 411 | Index(); |
||
| 412 | break; |
||
| 413 | |||
| 414 | } |
||
| 415 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.