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 | include_once __DIR__ . '/admin_header.php'; |
||
| 23 | |||
| 24 | if (isset($_REQUEST['op'])) { |
||
| 25 | $op = $_REQUEST['op']; |
||
| 26 | } else { |
||
| 27 | $op = 'liste'; |
||
| 28 | } |
||
| 29 | |||
| 30 | # function Index |
||
| 31 | ##################################################### |
||
| 32 | function Index() |
||
|
0 ignored issues
–
show
The function
Index() has been defined more than once; this definition is ignored, only the first definition in admin/main.php (L33-293) is considered.
This check looks for functions that have already been defined in other files. Some Codebases, like WordPress, make a practice of defining functions multiple times. This
may lead to problems with the detection of function parameters and types. If you really
need to do this, you can mark the duplicate definition with the /**
* @ignore
*/
function getUser() {
}
function getUser($id, $realm) {
}
See also the PhpDoc documentation for @ignore. Loading history...
|
|||
| 33 | { |
||
| 34 | global $hlpfile, $xoopsDB, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $myts, $moduleDirName, $admin_lang; |
||
| 35 | include_once __DIR__ . '/header.php'; |
||
| 36 | xoops_cp_header(); |
||
| 37 | // loadModuleAdminMenu(2, ""); |
||
|
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...
|
|||
| 38 | |||
| 39 | // Ajouter un type |
||
| 40 | echo "<table width='100%' border='0' cellspacing='1' cellpadding='8' style='border: 2px solid #DFE0E0;'><tr class='bg4'><td valign='top'>\n"; |
||
| 41 | echo "<form method=\"post\" action=\"options.php\"> |
||
| 42 | <b>" . _AM_ADSLIGHT_ADDTYPE . '</b><br><br> |
||
| 43 | ' . _AM_ADSLIGHT_TYPE . " <input type=\"text\" name=\"type\" size=\"30\" maxlength=\"100\"> |
||
| 44 | <input type=\"hidden\" name=\"op\" value=\"ListingAddType\"> |
||
| 45 | <input type=\"submit\" value=\"" . _AM_ADSLIGHT_ADD . "\"> |
||
| 46 | </form>"; |
||
| 47 | echo '<br>'; |
||
| 48 | |||
| 49 | // Modifier un type |
||
| 50 | list($numrows) = $xoopsDB->fetchRow($xoopsDB->query('select COUNT(*) FROM ' . $xoopsDB->prefix('adslight_type') . '')); |
||
| 51 | View Code Duplication | if ($numrows > 0) { |
|
| 52 | echo "<form method=\"post\" action=\"options.php\"> |
||
| 53 | <b>" . _AM_ADSLIGHT_MODTYPE . '</b></font><br><br>'; |
||
| 54 | $result2 = $xoopsDB->query('select id_type, nom_type from ' . $xoopsDB->prefix('adslight_type') . ' order by nom_type'); |
||
| 55 | echo '' . _AM_ADSLIGHT_TYPE . " <select name=\"id_type\">"; |
||
| 56 | |||
| 57 | while (list($id_type, $nom_type) = $xoopsDB->fetchRow($result2)) { |
||
| 58 | $nom_type = $myts->htmlSpecialChars($nom_type); |
||
| 59 | echo "<option value=\"$id_type\">$nom_type</option>"; |
||
| 60 | } |
||
| 61 | echo "</select> |
||
| 62 | <input type=\"hidden\" name=\"op\" value=\"ListingModType\"> |
||
| 63 | <input type=\"submit\" value=\"" . _AM_ADSLIGHT_MODIF . "\"> |
||
| 64 | </form>"; |
||
| 65 | echo '</td></tr></table>'; |
||
| 66 | echo '<br>'; |
||
| 67 | } |
||
| 68 | |||
| 69 | // Ajouter un type de prix |
||
| 70 | echo "<table width='100%' border='0' cellspacing='1' cellpadding='8' style='border: 2px solid #DFE0E0;'><tr class='bg4'><td valign='top'>\n"; |
||
| 71 | echo "<form method=\"post\" action=\"options.php\"> |
||
| 72 | <b>" . _AM_ADSLIGHT_ADDPRICE . '</b><br><br> |
||
| 73 | ' . _AM_ADSLIGHT_TYPE . " <input type=\"text\" name=\"type\" size=\"30\" maxlength=\"100\"> |
||
| 74 | <input type=\"hidden\" name=\"op\" value=\"ListingAddPrice\"> |
||
| 75 | <input type=\"submit\" value=\"" . _AM_ADSLIGHT_ADD . "\"> |
||
| 76 | </form>"; |
||
| 77 | echo '<br>'; |
||
| 78 | |||
| 79 | // Modifier un type de prix |
||
| 80 | list($numrows) = $xoopsDB->fetchRow($xoopsDB->query('select COUNT(*) FROM ' . $xoopsDB->prefix('adslight_price') . '')); |
||
| 81 | View Code Duplication | if ($numrows > 0) { |
|
| 82 | echo "<form method=\"post\" action=\"options.php\"> |
||
| 83 | <b>" . _AM_ADSLIGHT_MODPRICE . '</b></font><br><br>'; |
||
| 84 | $result3 = $xoopsDB->query('select id_price, nom_price from ' . $xoopsDB->prefix('adslight_price') . ' order by nom_price'); |
||
| 85 | echo '' . _AM_ADSLIGHT_TYPE . " <select name=\"id_price\">"; |
||
| 86 | |||
| 87 | while (list($id_price, $nom_price) = $xoopsDB->fetchRow($result3)) { |
||
| 88 | $nom_price = $myts->htmlSpecialChars($nom_price); |
||
| 89 | echo "<option value=\"$id_price\">$nom_price</option>"; |
||
| 90 | } |
||
| 91 | echo "</select> |
||
| 92 | <input type=\"hidden\" name=\"op\" value=\"ListingModPrice\"> |
||
| 93 | <input type=\"submit\" value=\"" . _AM_ADSLIGHT_MODIF . "\"> |
||
| 94 | </form>"; |
||
| 95 | echo '</td></tr></table>'; |
||
| 96 | echo '<br>'; |
||
| 97 | } |
||
| 98 | |||
| 99 | // Ajouter un type d'usure |
||
| 100 | echo "<table width='100%' border='0' cellspacing='1' cellpadding='8' style='border: 2px solid #DFE0E0;'><tr class='bg4'><td valign='top'>\n"; |
||
| 101 | echo "<form method=\"post\" action=\"options.php\"> |
||
| 102 | <b>" . _AM_ADSLIGHT_ADDUSURE . '</b><br><br> |
||
| 103 | ' . _AM_ADSLIGHT_TYPE . " <input type=\"text\" name=\"type\" size=\"30\" maxlength=\"100\"> |
||
| 104 | <input type=\"hidden\" name=\"op\" value=\"ListingAddUsure\"> |
||
| 105 | <input type=\"submit\" value=\"" . _AM_ADSLIGHT_ADD . "\"> |
||
| 106 | </form>"; |
||
| 107 | echo '<br>'; |
||
| 108 | |||
| 109 | // Modifier un type d'usure |
||
| 110 | list($numrows) = $xoopsDB->fetchRow($xoopsDB->query('select COUNT(*) FROM ' . $xoopsDB->prefix('adslight_usure') . '')); |
||
| 111 | View Code Duplication | if ($numrows > 0) { |
|
| 112 | echo "<form method=\"post\" action=\"options.php\"> |
||
| 113 | <b>" . _AM_ADSLIGHT_MODUSURE . '</b></font><br><br>'; |
||
| 114 | $result8 = $xoopsDB->query('select id_usure, nom_usure from ' . $xoopsDB->prefix('adslight_usure') . ' order by nom_usure'); |
||
| 115 | echo '' . _AM_ADSLIGHT_TYPE . " <select name=\"id_usure\">"; |
||
| 116 | |||
| 117 | while (list($id_usure, $nom_usure) = $xoopsDB->fetchRow($result8)) { |
||
| 118 | $nom_usure = $myts->htmlSpecialChars($nom_usure); |
||
| 119 | echo "<option value=\"$id_usure\">$nom_usure</option>"; |
||
| 120 | } |
||
| 121 | echo "</select> |
||
| 122 | <input type=\"hidden\" name=\"op\" value=\"ListingModUsure\"> |
||
| 123 | <input type=\"submit\" value=\"" . _AM_ADSLIGHT_MODIF . "\"> |
||
| 124 | </form>"; |
||
| 125 | echo '</td></tr></table>'; |
||
| 126 | echo '<br>'; |
||
| 127 | } |
||
| 128 | |||
| 129 | xoops_cp_footer(); |
||
| 130 | } |
||
| 131 | |||
| 132 | # function ListingAddType |
||
| 133 | ##################################################### |
||
| 134 | /** |
||
| 135 | * @param $type |
||
| 136 | */ |
||
| 137 | View Code Duplication | function ListingAddType($type) |
|
| 138 | { |
||
| 139 | global $xoopsDB, $xoopsConfig, $myts, $moduleDirName, $admin_lang; |
||
| 140 | |||
| 141 | list($numrows) = $xoopsDB->fetchRow($xoopsDB->query('select COUNT(*) FROM ' . $xoopsDB->prefix('adslight_type') . " where nom_type='$type'")); |
||
| 142 | if ($numrows > 0) { |
||
| 143 | include_once __DIR__ . '/header.php'; |
||
| 144 | xoops_cp_header(); |
||
| 145 | // loadModuleAdminMenu(2, ""); |
||
|
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...
|
|||
| 146 | |||
| 147 | echo "<table width='100%' border='0' cellspacing='1' cellpadding='8' style='border: 2px solid #DFE0E0;'><tr class='bg4'><td valign='top'>\n"; |
||
| 148 | echo '<br><center><b>' . _AM_ADSLIGHT_ERRORTYPE . " $nom_type " . _AM_ADSLIGHT_EXIST . '</b><br><br>'; |
||
| 149 | echo "<form method=\"post\" action=\"options.php\"> |
||
| 150 | <b>" . _AM_ADSLIGHT_ADDTYPE . '</b><br><br> |
||
| 151 | ' . _AM_ADSLIGHT_TYPE . "<input type=\"text\" name=\"type\" size=\"30\" maxlength=\"100\" /> |
||
| 152 | <input type=\"hidden\" name=\"op\" value=\"ListingAddType\" /> |
||
| 153 | <input type=\"submit\" value=\"" . _AM_ADSLIGHT_ADD . "\" /> |
||
| 154 | </form>"; |
||
| 155 | echo '</td></tr></table>'; |
||
| 156 | xoops_cp_footer(); |
||
| 157 | } else { |
||
| 158 | $type = $myts->htmlSpecialChars($type); |
||
| 159 | |||
| 160 | if ($type == '') { |
||
| 161 | $type = '! ! ? ! !'; |
||
| 162 | } |
||
| 163 | $xoopsDB->query('insert into ' . $xoopsDB->prefix('adslight_type') . " values (NULL, '$type')"); |
||
| 164 | |||
| 165 | redirect_header('options.php', 1, _AM_ADSLIGHT_ADDTYPE2); |
||
| 166 | } |
||
| 167 | } |
||
| 168 | |||
| 169 | # function ListingModType |
||
| 170 | ##################################################### |
||
| 171 | /** |
||
| 172 | * @param $id_type |
||
| 173 | */ |
||
| 174 | function ListingModType($id_type) |
||
| 175 | { |
||
| 176 | global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $moduleDirName, $admin_lang; |
||
| 177 | include_once __DIR__ . '/header.php'; |
||
| 178 | xoops_cp_header(); |
||
| 179 | // loadModuleAdminMenu(2, ""); |
||
|
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...
|
|||
| 180 | echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_ADSLIGHT_MODTYPE . '</legend>'; |
||
| 181 | $result = $xoopsDB->query('select id_type, nom_type from ' . $xoopsDB->prefix('adslight_type') . " where id_type=$id_type"); |
||
| 182 | list($id_type, $nom_type) = $xoopsDB->fetchRow($result); |
||
| 183 | |||
| 184 | $nom_type = $myts->htmlSpecialChars($nom_type); |
||
| 185 | |||
| 186 | echo "<form action=\"options.php\" method=\"post\">" . |
||
| 187 | '' . |
||
| 188 | _AM_ADSLIGHT_TYPE . |
||
| 189 | " <input type=\"text\" name=\"nom_type\" value=\"$nom_type\" size=\"51\" maxlength=\"50\" /><br>" . |
||
| 190 | "<input type=\"hidden\" name=\"id_type\" value=\"$id_type\" />" . |
||
| 191 | "<input type=\"hidden\" name=\"op\" value=\"ListingModTypeS\" />" . |
||
| 192 | "<table border=\"0\"><tr><td>" . |
||
| 193 | "<input type=\"submit\" value=\"" . |
||
| 194 | _AM_ADSLIGHT_SAVMOD . |
||
| 195 | "\" /></form>" . |
||
| 196 | "<form action=\"options.php\" method=\"post\">" . |
||
| 197 | "<input type=\"hidden\" name=\"id_type\" value=\"$id_type\" />" . |
||
| 198 | "<input type=\"hidden\" name=\"op\" value=\"ListingDelType\" />" . |
||
| 199 | "<input type=\"submit\" value=\"" . |
||
| 200 | _AM_ADSLIGHT_DEL . |
||
| 201 | "\" /></form></td></tr></table>"; |
||
| 202 | |||
| 203 | echo '</td></tr></table>'; |
||
| 204 | xoops_cp_footer(); |
||
| 205 | } |
||
| 206 | |||
| 207 | # function ListingModTypeS |
||
| 208 | ##################################################### |
||
| 209 | /** |
||
| 210 | * @param $id_type |
||
| 211 | * @param $nom_type |
||
| 212 | */ |
||
| 213 | View Code Duplication | function ListingModTypeS($id_type, $nom_type) |
|
| 214 | { |
||
| 215 | global $xoopsDB, $xoopsConfig, $myts, $moduleDirName, $admin_lang; |
||
| 216 | |||
| 217 | $nom_type = $myts->htmlSpecialChars($nom_type); |
||
| 218 | |||
| 219 | $xoopsDB->query('update ' . $xoopsDB->prefix('adslight_type') . " set nom_type='$nom_type' where id_type='$id_type'"); |
||
| 220 | |||
| 221 | redirect_header('options.php', 1, _AM_ADSLIGHT_TYPEMOD); |
||
| 222 | } |
||
| 223 | |||
| 224 | # function ListingDelType |
||
| 225 | ##################################################### |
||
| 226 | /** |
||
| 227 | * @param $id_type |
||
| 228 | */ |
||
| 229 | View Code Duplication | function ListingDelType($id_type) |
|
| 230 | { |
||
| 231 | global $xoopsDB, $moduleDirName, $admin_lang; |
||
| 232 | |||
| 233 | $xoopsDB->query('delete from ' . $xoopsDB->prefix('adslight_type') . " where id_type='$id_type'"); |
||
| 234 | |||
| 235 | redirect_header('options.php', 1, _AM_ADSLIGHT_TYPEDEL); |
||
| 236 | } |
||
| 237 | |||
| 238 | # function ListingAddPrice |
||
| 239 | ##################################################### |
||
| 240 | /** |
||
| 241 | * @param $type |
||
| 242 | */ |
||
| 243 | View Code Duplication | function ListingAddPrice($type) |
|
| 244 | { |
||
| 245 | global $xoopsDB, $xoopsConfig, $myts, $moduleDirName, $admin_lang; |
||
| 246 | |||
| 247 | list($numrows) = $xoopsDB->fetchRow($xoopsDB->query('select COUNT(*) FROM ' . $xoopsDB->prefix('adslight_price') . " where nom_price='$type'")); |
||
| 248 | if ($numrows > 0) { |
||
| 249 | include_once __DIR__ . '/header.php'; |
||
| 250 | xoops_cp_header(); |
||
| 251 | // loadModuleAdminMenu(2, ""); |
||
|
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...
|
|||
| 252 | |||
| 253 | echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_ADSLIGHT_MODANN . '</legend>'; |
||
| 254 | echo '<br><center><b>' . _AM_ADSLIGHT_ERRORPRICE . " $nom_price " . _AM_ADSLIGHT_EXIST . '</b><br><br>'; |
||
| 255 | echo "<form method=\"post\" action=\"options.php\"> |
||
| 256 | <b>" . _AM_ADSLIGHT_ADDPRICE . '</b><br><br> |
||
| 257 | ' . _AM_ADSLIGHT_TYPE . " <input type=\"text\" name=\"type\" size=\"30\" maxlength=\"100\"> |
||
| 258 | <input type=\"hidden\" name=\"op\" value=\"ListingAddPrice\"> |
||
| 259 | <input type=\"submit\" value=\"" . _AM_ADSLIGHT_ADD . "\"> |
||
| 260 | </form>"; |
||
| 261 | echo '</td></tr></table>'; |
||
| 262 | xoops_cp_footer(); |
||
| 263 | } else { |
||
| 264 | $type = $myts->htmlSpecialChars($type); |
||
| 265 | if ($type == '') { |
||
| 266 | $type = '! ! ? ! !'; |
||
| 267 | } |
||
| 268 | $xoopsDB->query('insert into ' . $xoopsDB->prefix('adslight_price') . " values (NULL, '$type')"); |
||
| 269 | |||
| 270 | redirect_header('options.php', 1, _AM_ADSLIGHT_ADDPRICE2); |
||
| 271 | } |
||
| 272 | } |
||
| 273 | |||
| 274 | # function ListingModPrice |
||
| 275 | ##################################################### |
||
| 276 | /** |
||
| 277 | * @param $id_price |
||
| 278 | */ |
||
| 279 | View Code Duplication | function ListingModPrice($id_price) |
|
| 280 | { |
||
| 281 | global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $moduleDirName, $admin_lang; |
||
| 282 | |||
| 283 | include_once __DIR__ . '/header.php'; |
||
| 284 | xoops_cp_header(); |
||
| 285 | // loadModuleAdminMenu(2, ""); |
||
|
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...
|
|||
| 286 | echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_ADSLIGHT_MODPRICE . '</legend>'; |
||
| 287 | echo '<b>' . _AM_ADSLIGHT_MODPRICE . '</b><br><br>'; |
||
| 288 | $result = $xoopsDB->query('select nom_price from ' . $xoopsDB->prefix('adslight_price') . " where id_price=$id_price"); |
||
| 289 | list($nom_price) = $xoopsDB->fetchRow($result); |
||
| 290 | |||
| 291 | $nom_price = $myts->htmlSpecialChars($nom_price); |
||
| 292 | |||
| 293 | echo "<form action=\"options.php\" method=\"post\">" . |
||
| 294 | '' . |
||
| 295 | _AM_ADSLIGHT_TYPE . |
||
| 296 | " <input type=\"text\" name=\"nom_price\" value=\"$nom_price\" size=\"51\" maxlength=\"50\"><br>" . |
||
| 297 | "<input type=\"hidden\" name=\"id_price\" value=\"$id_price\">" . |
||
| 298 | "<input type=\"hidden\" name=\"op\" value=\"ListingModPriceS\">" . |
||
| 299 | "<table border=\"0\"><tr><td>" . |
||
| 300 | "<input type=\"submit\" value=\"" . |
||
| 301 | _AM_ADSLIGHT_SAVMOD . |
||
| 302 | "\"></form>" . |
||
| 303 | "<form action=\"options.php\" method=\"post\">" . |
||
| 304 | "<input type=\"hidden\" name=\"id_price\" value=\"$id_price\">" . |
||
| 305 | "<input type=\"hidden\" name=\"op\" value=\"ListingDelPrice\">" . |
||
| 306 | "<input type=\"submit\" value=\"" . |
||
| 307 | _AM_ADSLIGHT_DEL . |
||
| 308 | "\"></form></td></tr></table>"; |
||
| 309 | |||
| 310 | echo '</td></tr></table>'; |
||
| 311 | xoops_cp_footer(); |
||
| 312 | } |
||
| 313 | |||
| 314 | # function ListingModPriceS |
||
| 315 | ##################################################### |
||
| 316 | /** |
||
| 317 | * @param $id_price |
||
| 318 | * @param $nom_price |
||
| 319 | */ |
||
| 320 | View Code Duplication | function ListingModPriceS($id_price, $nom_price) |
|
| 321 | { |
||
| 322 | global $xoopsDB, $xoopsConfig, $myts, $moduleDirName, $admin_lang; |
||
| 323 | |||
| 324 | $nom_price = $myts->htmlSpecialChars($nom_price); |
||
| 325 | |||
| 326 | $xoopsDB->query('update ' . $xoopsDB->prefix('adslight_price') . " set nom_price='$nom_price' where id_price='$id_price'"); |
||
| 327 | |||
| 328 | redirect_header('options.php', 1, _AM_ADSLIGHT_PRICEMOD); |
||
| 329 | } |
||
| 330 | |||
| 331 | # function ListingDelPrice |
||
| 332 | ##################################################### |
||
| 333 | /** |
||
| 334 | * @param $id_price |
||
| 335 | */ |
||
| 336 | View Code Duplication | function ListingDelPrice($id_price) |
|
| 337 | { |
||
| 338 | global $xoopsDB, $moduleDirName, $admin_lang; |
||
| 339 | |||
| 340 | $xoopsDB->query('delete from ' . $xoopsDB->prefix('adslight_price') . " where id_price='$id_price'"); |
||
| 341 | |||
| 342 | redirect_header('options.php', 1, _AM_ADSLIGHT_PRICEDEL); |
||
| 343 | } |
||
| 344 | |||
| 345 | # function ListingAddUsure |
||
| 346 | ##################################################### |
||
| 347 | /** |
||
| 348 | * @param $type |
||
| 349 | */ |
||
| 350 | View Code Duplication | function ListingAddUsure($type) |
|
| 351 | { |
||
| 352 | global $xoopsDB, $xoopsConfig, $myts, $moduleDirName, $admin_lang; |
||
| 353 | |||
| 354 | list($numrows) = $xoopsDB->fetchRow($xoopsDB->query('select COUNT(*) FROM ' . $xoopsDB->prefix('adslight_usure') . " where nom_usure='$type'")); |
||
| 355 | if ($numrows > 0) { |
||
| 356 | include_once __DIR__ . '/header.php'; |
||
| 357 | xoops_cp_header(); |
||
| 358 | // loadModuleAdminMenu(2, ""); |
||
|
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...
|
|||
| 359 | |||
| 360 | echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_ADSLIGHT_MODANN . '</legend>'; |
||
| 361 | echo '<br><center><b>' . _AM_ADSLIGHT_ERRORUSURE . " $nom_usure " . _AM_ADSLIGHT_EXIST . '</b><br><br>'; |
||
| 362 | echo "<form method=\"post\" action=\"options.php\"> |
||
| 363 | <b>" . _AM_ADSLIGHT_ADDUSURE . '</b><br><br> |
||
| 364 | ' . _AM_ADSLIGHT_TYPE . " <input type=\"text\" name=\"type\" size=\"30\" maxlength=\"100\"> |
||
| 365 | <input type=\"hidden\" name=\"op\" value=\"ListingAddUsure\"> |
||
| 366 | <input type=\"submit\" value=\"" . _AM_ADSLIGHT_ADD . "\"> |
||
| 367 | </form>"; |
||
| 368 | echo '</td></tr></table>'; |
||
| 369 | xoops_cp_footer(); |
||
| 370 | } else { |
||
| 371 | $type = $myts->htmlSpecialChars($type); |
||
| 372 | if ($type == '') { |
||
| 373 | $type = '! ! ? ! !'; |
||
| 374 | } |
||
| 375 | $xoopsDB->query('insert into ' . $xoopsDB->prefix('adslight_usure') . " values (NULL, '$type')"); |
||
| 376 | |||
| 377 | redirect_header('options.php', 1, _AM_ADSLIGHT_ADDUSURE2); |
||
| 378 | } |
||
| 379 | } |
||
| 380 | |||
| 381 | # function ListingModUsure |
||
| 382 | ##################################################### |
||
| 383 | /** |
||
| 384 | * @param $id_usure |
||
| 385 | */ |
||
| 386 | View Code Duplication | function ListingModUsure($id_usure) |
|
| 387 | { |
||
| 388 | global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $moduleDirName, $admin_lang; |
||
| 389 | |||
| 390 | include_once __DIR__ . '/header.php'; |
||
| 391 | xoops_cp_header(); |
||
| 392 | // loadModuleAdminMenu(2, ""); |
||
|
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...
|
|||
| 393 | echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_ADSLIGHT_MODUSURE . '</legend>'; |
||
| 394 | echo '<b>' . _AM_ADSLIGHT_MODUSURE . '</b><br><br>'; |
||
| 395 | $result9 = $xoopsDB->query('select nom_usure from ' . $xoopsDB->prefix('adslight_usure') . " where id_usure=$id_usure"); |
||
| 396 | list($nom_usure) = $xoopsDB->fetchRow($result9); |
||
| 397 | |||
| 398 | $nom_usure = $myts->htmlSpecialChars($nom_usure); |
||
| 399 | |||
| 400 | echo "<form action=\"options.php\" method=\"post\">" . |
||
| 401 | '' . |
||
| 402 | _AM_ADSLIGHT_USURE . |
||
| 403 | " <input type=\"text\" name=\"nom_usure\" value=\"$nom_usure\" size=\"51\" maxlength=\"50\"><br>" . |
||
| 404 | "<input type=\"hidden\" name=\"id_usure\" value=\"$id_usure\">" . |
||
| 405 | "<input type=\"hidden\" name=\"op\" value=\"ListingModUsureS\">" . |
||
| 406 | "<table border=\"0\"><tr><td>" . |
||
| 407 | "<input type=\"submit\" value=\"" . |
||
| 408 | _AM_ADSLIGHT_SAVMOD . |
||
| 409 | "\"></form>" . |
||
| 410 | "<form action=\"options.php\" method=\"post\">" . |
||
| 411 | "<input type=\"hidden\" name=\"id_usure\" value=\"$id_usure\">" . |
||
| 412 | "<input type=\"hidden\" name=\"op\" value=\"ListingDelUsure\">" . |
||
| 413 | "<input type=\"submit\" value=\"" . |
||
| 414 | _AM_ADSLIGHT_DEL . |
||
| 415 | "\"></form></td></tr></table>"; |
||
| 416 | |||
| 417 | echo '</td></tr></table>'; |
||
| 418 | xoops_cp_footer(); |
||
| 419 | } |
||
| 420 | |||
| 421 | # function ListingModUsureS |
||
| 422 | ##################################################### |
||
| 423 | /** |
||
| 424 | * @param $id_usure |
||
| 425 | * @param $nom_usure |
||
| 426 | */ |
||
| 427 | View Code Duplication | function ListingModUsureS($id_usure, $nom_usure) |
|
| 428 | { |
||
| 429 | global $xoopsDB, $xoopsConfig, $myts, $moduleDirName, $admin_lang; |
||
| 430 | |||
| 431 | $nom_usure = $myts->htmlSpecialChars($nom_usure); |
||
| 432 | |||
| 433 | $xoopsDB->query('update ' . $xoopsDB->prefix('adslight_usure') . " set nom_usure='$nom_usure' where id_usure='$id_usure'"); |
||
| 434 | |||
| 435 | redirect_header('options.php', 1, _AM_ADSLIGHT_USUREMOD); |
||
| 436 | } |
||
| 437 | |||
| 438 | # function ListingDelUsure |
||
| 439 | ##################################################### |
||
| 440 | /** |
||
| 441 | * @param $id_usure |
||
| 442 | */ |
||
| 443 | View Code Duplication | function ListingDelUsure($id_usure) |
|
| 444 | { |
||
| 445 | global $xoopsDB, $moduleDirName, $admin_lang; |
||
| 446 | |||
| 447 | $xoopsDB->query('delete from ' . $xoopsDB->prefix('adslight_usure') . " where id_usure='$id_usure'"); |
||
| 448 | |||
| 449 | redirect_header('options.php', 1, _AM_ADSLIGHT_USUREDEL); |
||
| 450 | } |
||
| 451 | |||
| 452 | ##################################################### |
||
| 453 | ##################################################### |
||
| 454 | |||
| 455 | foreach ($_POST as $k => $v) { |
||
| 456 | ${$k} = $v; |
||
| 457 | } |
||
| 458 | |||
| 459 | $pa = isset($_GET['pa']) ? $_GET['pa'] : ''; |
||
| 460 | |||
| 461 | if (!isset($_POST['lid']) && isset($_GET['lid'])) { |
||
| 462 | $lid = $_GET['lid']; |
||
| 463 | } |
||
| 464 | if (!isset($_POST['op']) && isset($_GET['op'])) { |
||
| 465 | $op = $_GET['op']; |
||
| 466 | } |
||
| 467 | if (!isset($op)) { |
||
| 468 | $op = ''; |
||
| 469 | } |
||
| 470 | |||
| 471 | switch ($op) { |
||
| 472 | |||
| 473 | case 'ListingDelPrice': |
||
| 474 | ListingDelPrice($id_price); |
||
| 475 | break; |
||
| 476 | |||
| 477 | case 'ListingModPrice': |
||
| 478 | ListingModPrice($id_price); |
||
| 479 | break; |
||
| 480 | |||
| 481 | case 'ListingModPriceS': |
||
| 482 | ListingModPriceS($id_price, $nom_price); |
||
| 483 | break; |
||
| 484 | |||
| 485 | case 'ListingAddPrice': |
||
| 486 | ListingAddPrice($type); |
||
| 487 | break; |
||
| 488 | |||
| 489 | case 'ListingDelUsure': |
||
| 490 | ListingDelUsure($id_usure); |
||
| 491 | break; |
||
| 492 | |||
| 493 | case 'ListingModUsure': |
||
| 494 | ListingModUsure($id_usure); |
||
| 495 | break; |
||
| 496 | |||
| 497 | case 'ListingModUsureS': |
||
| 498 | ListingModUsureS($id_usure, $nom_usure); |
||
| 499 | break; |
||
| 500 | |||
| 501 | case 'ListingAddUsure': |
||
| 502 | ListingAddUsure($type); |
||
| 503 | break; |
||
| 504 | |||
| 505 | case 'ListingDelType': |
||
| 506 | ListingDelType($id_type); |
||
| 507 | break; |
||
| 508 | |||
| 509 | case 'ListingModType': |
||
| 510 | ListingModType($id_type); |
||
| 511 | break; |
||
| 512 | |||
| 513 | case 'ListingModTypeS': |
||
| 514 | ListingModTypeS($id_type, $nom_type); |
||
| 515 | break; |
||
| 516 | |||
| 517 | case 'ListingAddType': |
||
| 518 | ListingAddType($type); |
||
| 519 | break; |
||
| 520 | |||
| 521 | default: |
||
| 522 | Index(); |
||
| 523 | break; |
||
| 524 | |||
| 525 | } |
||
| 526 |
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.