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 | |||
| 25 | if (isset($_REQUEST['op'])) { |
||
| 26 | $op = $_REQUEST['op']; |
||
| 27 | } else { |
||
| 28 | $op = 'liste'; |
||
| 29 | } |
||
| 30 | |||
| 31 | # function Index |
||
| 32 | ##################################################### |
||
| 33 | 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...
|
|||
| 34 | { |
||
| 35 | global $hlpfile, $xoopsDB, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $myts, $desctext, $moduleDirName, $admin_lang; |
||
| 36 | |||
| 37 | // $mytree = new ClassifiedsTree($xoopsDB->prefix("adslight_categories"),"cid","pid"); |
||
|
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 | include_once __DIR__ . '/header.php'; |
||
| 40 | xoops_cp_header(); |
||
| 41 | // loadModuleAdminMenu(0, ""); |
||
|
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...
|
|||
| 42 | |||
| 43 | // photo dir setting checker |
||
| 44 | $photo_dir = $xoopsModuleConfig['adslight_path_upload']; |
||
| 45 | $photo_thumb_dir = $xoopsModuleConfig['adslight_path_upload'] . '/thumbs'; |
||
| 46 | $photo_resized_dir = $xoopsModuleConfig['adslight_path_upload'] . '/midsize'; |
||
| 47 | if (!is_dir($photo_dir)) { |
||
| 48 | mkdir($photo_dir); |
||
| 49 | } |
||
| 50 | if (!is_dir($photo_thumb_dir)) { |
||
| 51 | mkdir($photo_thumb_dir); |
||
| 52 | } |
||
| 53 | if (!is_dir($photo_resized_dir)) { |
||
| 54 | mkdir($photo_resized_dir); |
||
| 55 | } |
||
| 56 | View Code Duplication | if (!is_writable($photo_dir) || !is_readable($photo_dir)) { |
|
| 57 | echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_ADSLIGHT_CHECKER . '</legend><br>'; |
||
| 58 | echo "<font color='#FF0000'><b>" . _AM_ADSLIGHT_DIRPERMS . '' . $photo_dir . "</b></font><br><br>\n"; |
||
| 59 | echo '</fieldset><br>'; |
||
| 60 | } |
||
| 61 | |||
| 62 | View Code Duplication | if (!is_writable($photo_thumb_dir) || !is_readable($photo_thumb_dir)) { |
|
| 63 | echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_ADSLIGHT_CHECKER . '</legend><br>'; |
||
| 64 | echo "<font color='#FF0000'><b>" . _AM_ADSLIGHT_DIRPERMS . '' . $photo_thumb_dir . "</b></font><br><br>\n"; |
||
| 65 | echo '</fieldset><br>'; |
||
| 66 | } |
||
| 67 | |||
| 68 | View Code Duplication | if (!is_writable($photo_resized_dir) || !is_readable($photo_resized_dir)) { |
|
| 69 | echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_ADSLIGHT_CHECKER . '</legend><br>'; |
||
| 70 | echo "<font color='#FF0000'><b>" . _AM_ADSLIGHT_DIRPERMS . '' . $photo_resized_dir . "</b></font><br><br>\n"; |
||
| 71 | echo '</fieldset><br>'; |
||
| 72 | } |
||
| 73 | |||
| 74 | $result = |
||
| 75 | $xoopsDB->query('select lid, cid, title, status, expire, type, desctext, tel, price, typeprice, typeusure, date, email, submitter, town, country, contactby, premium, photo, usid from ' . |
||
| 76 | $xoopsDB->prefix('adslight_listing') . |
||
| 77 | " WHERE valid='yes' order by lid"); |
||
| 78 | $numrows = $xoopsDB->getRowsNum($result); |
||
| 79 | if ($numrows > 0) { |
||
| 80 | |||
| 81 | ///////// Il y a [..] Annonces en attente d'être approuvées ////// |
||
| 82 | echo "<table class='outer' border=0 cellspacing=5 cellpadding=0><tr><td width=40>"; |
||
| 83 | echo "<img src='../assets/images/admin/error_button.png' border=0 /></td><td>"; |
||
| 84 | echo "<font color=\"#00B4C4\"><b>" . _AM_ADSLIGHT_THEREIS . "</b></font> <b>$numrows</b> <b><font color=\"#00B4C4\">" . _AM_ADSLIGHT_ADSVALIDE . '</b></font>'; |
||
| 85 | echo '</td></tr></table><br>'; |
||
| 86 | |||
| 87 | ///// Liste des ID ///// Soumis par ///// Titre ///// Description ///// Date d'ajout |
||
| 88 | echo "<table width='100%' border='0' class='outer'>"; |
||
| 89 | $rank = 1; |
||
| 90 | |||
| 91 | while (list($lid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $photo, $usid) = |
||
| 92 | $xoopsDB->fetchRow($result)) { |
||
| 93 | $title = $myts->htmlSpecialChars($title); |
||
| 94 | $desctext = $myts->displayTarea($desctext, 1, 0, 1, 1, 1); |
||
| 95 | |||
| 96 | View Code Duplication | if (strlen($desctext) >= 200) { |
|
| 97 | $desctext = substr($desctext, 0, 199) . '...'; |
||
| 98 | } else { |
||
| 99 | $desctext = $myts->displayTarea($desctext, 1, 1, 1); |
||
| 100 | } |
||
| 101 | $date2 = formatTimestamp($date, 's'); |
||
| 102 | |||
| 103 | if (is_integer($rank / 2)) { |
||
| 104 | $color = '#ffffff'; |
||
| 105 | } else { |
||
| 106 | $color = 'head'; |
||
| 107 | } |
||
| 108 | |||
| 109 | $status = $myts->htmlSpecialChars($status); |
||
| 110 | $expire = $myts->htmlSpecialChars($expire); |
||
| 111 | $type = $myts->htmlSpecialChars($type); |
||
| 112 | $tel = $myts->htmlSpecialChars($tel); |
||
| 113 | // $price = number_format($price, 2, ",", " "); |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
58% 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...
|
|||
| 114 | $typeprice = $myts->htmlSpecialChars($typeprice); |
||
| 115 | $typeusure = $myts->htmlSpecialChars($typeusure); |
||
| 116 | $submitter = $myts->htmlSpecialChars($submitter); |
||
| 117 | $town = $myts->htmlSpecialChars($town); |
||
| 118 | $country = $myts->htmlSpecialChars($country); |
||
| 119 | $contactby = $myts->htmlSpecialChars($contactby); |
||
| 120 | $premium = $myts->htmlSpecialChars($premium); |
||
| 121 | |||
| 122 | $updir = $xoopsModuleConfig['adslight_link_upload']; |
||
| 123 | $sql = 'select cod_img, lid, uid_owner, url from ' . |
||
| 124 | $xoopsDB->prefix('adslight_pictures') . |
||
| 125 | ' where uid_owner=' . |
||
| 126 | $xoopsDB->escape($usid) . |
||
| 127 | ' and lid=' . |
||
| 128 | $xoopsDB->escape($lid) . |
||
| 129 | ' order by date_added ASC limit 1'; |
||
| 130 | $resultp = $xoopsDB->query($sql); |
||
| 131 | View Code Duplication | while (list($cod_img, $pic_lid, $uid_owner, $url) = $xoopsDB->fetchRow($resultp)) { |
|
| 132 | if ($photo) { |
||
| 133 | $photo3 = "<a href='" . |
||
| 134 | XOOPS_URL . |
||
| 135 | '/modules/adslight/viewads.php?lid=' . |
||
| 136 | $lid . |
||
| 137 | "'><img class=\"thumb\" src=\"$updir/thumbs/thumb_$url\" align=\"left\" width=\"100px\" alt=\"$title\"></a>"; |
||
| 138 | } |
||
| 139 | } |
||
| 140 | if ($photo > 0) { |
||
|
0 ignored issues
–
show
This
if statement is empty and can be removed.
This check looks for the bodies of These if (rand(1, 6) > 3) {
//print "Check failed";
} else {
print "Check succeeded";
}
could be turned into if (rand(1, 6) <= 3) {
print "Check succeeded";
}
This is much more concise to read. Loading history...
|
|||
| 141 | } else { |
||
| 142 | $photo3 = "<a href=\"index.php?op=IndexView&lid=$lid\"><img class=\"thumb\" src=\"" . |
||
| 143 | XOOPS_URL . |
||
| 144 | "/modules/adslight/assets/images/nophoto.jpg\" align=\"left\" width=\"100px\" alt=\"$title\"></a>"; |
||
| 145 | } |
||
| 146 | |||
| 147 | if ($photo > 0) { |
||
| 148 | $photo4 = "$photo"; |
||
| 149 | } else { |
||
| 150 | $photo4 = '0'; |
||
| 151 | } |
||
| 152 | |||
| 153 | $result7 = $xoopsDB->query('select nom_type from ' . $xoopsDB->prefix('adslight_type') . ' where id_type=' . $xoopsDB->escape($type) . ''); |
||
| 154 | list($nom_type) = $xoopsDB->fetchRow($result7); |
||
| 155 | |||
| 156 | $result8 = $xoopsDB->query('select nom_price from ' . $xoopsDB->prefix('adslight_price') . ' where id_price=' . $xoopsDB->escape($typeprice) . ''); |
||
| 157 | list($nom_price) = $xoopsDB->fetchRow($result8); |
||
| 158 | |||
| 159 | echo "<form action=\"view_ads.php\" method=\"post\">"; |
||
| 160 | echo "<tr><th align='left'>" . |
||
| 161 | _AM_ADSLIGHT_LID . |
||
| 162 | ": $lid</th><th align='left'>$photo4 " . |
||
| 163 | _AM_ADSLIGHT_NBR_PHOTO . |
||
| 164 | "</th><th align='left'>" . |
||
| 165 | _AM_ADSLIGHT_TITLE . |
||
| 166 | ":</th><th align='left'>" . |
||
| 167 | _AM_ADSLIGHT_DESC . |
||
| 168 | "</th><th align='left'><!--" . |
||
| 169 | _AM_ADSLIGHT_ACTIONS . |
||
| 170 | '--></th></tr>'; |
||
| 171 | |||
| 172 | echo "<tr><td class='even' width='3%'></td>"; |
||
| 173 | echo "<td class='odd' width='10%' >$photo3</td>"; |
||
| 174 | echo "<td class='even' width='20%'><b>$title</b><br/><br/>$nom_type<br/>$price " . $xoopsModuleConfig['adslight_money'] . " $nom_price<br/>"; |
||
| 175 | echo "$town - $country<br/>"; |
||
| 176 | echo '<b>' . _AM_ADSLIGHT_SUBMITTER . ":</b> $submitter<br/>"; |
||
| 177 | echo '<b>' . _AM_ADSLIGHT_DATE . ":</b> $date2</td>"; |
||
| 178 | echo "<td class='even' width='35%'>$desctext</td><td class='even' width='2%' align=right></td>"; |
||
| 179 | echo "</tr><tr><td width='5%'></td><td>"; |
||
| 180 | |||
| 181 | echo "<select name=\"op\"> |
||
| 182 | <option value=\"ModifyAds\"> " . _AM_ADSLIGHT_MODIF . " |
||
| 183 | <option value=\"ListingDel\"> " . _AM_ADSLIGHT_DEL . " |
||
| 184 | </select><input type=\"submit\" value=\"" . _AM_ADSLIGHT_GO . "\">"; |
||
| 185 | |||
| 186 | echo "<input type=\"hidden\" name=\"valid\" value=\"Yes\">"; |
||
| 187 | echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\">"; |
||
| 188 | echo "<input type=\"hidden\" name=\"cid\" value=\"$cid\">"; |
||
| 189 | echo "<input type=\"hidden\" name=\"title\" value=\"$title\">"; |
||
| 190 | echo "<input type=\"hidden\" name=\"status\" value=\"$status\">"; |
||
| 191 | echo "<input type=\"hidden\" name=\"expire\" value=\"$expire\">"; |
||
| 192 | echo "<input type=\"hidden\" name=\"type\" value=\"$type\">"; |
||
| 193 | echo "<input type=\"hidden\" name=\"desctext\" value=\"$desctext\">"; |
||
| 194 | echo "<input type=\"hidden\" name=\"tel\" value=\"$tel\">"; |
||
| 195 | echo "<input type=\"hidden\" name=\"price\" value=\"$price\">"; |
||
| 196 | echo "<input type=\"hidden\" name=\"typeprice\" value=\"$typeprice\">"; |
||
| 197 | echo "<input type=\"hidden\" name=\"typeusure\" value=\"$typeusure\">"; |
||
| 198 | echo "<input type=\"hidden\" name=\"date\" value=\"$date\">"; |
||
| 199 | echo "<input type=\"hidden\" name=\"email\" value=\"$email\">"; |
||
| 200 | echo "<input type=\"hidden\" name=\"submitter\" value=\"$submitter\">"; |
||
| 201 | echo "<input type=\"hidden\" name=\"town\" value=\"$town\">"; |
||
| 202 | echo "<input type=\"hidden\" name=\"country\" value=\"$country\">"; |
||
| 203 | echo "<input type=\"hidden\" name=\"contactby\" value=\"$contactby\">"; |
||
| 204 | echo "<input type=\"hidden\" name=\"premium\" value=\"$premium\">"; |
||
| 205 | echo "<input type=\"hidden\" name=\"photo\" value=\"$photo\">"; |
||
| 206 | echo '</form><br></td></tr>'; |
||
| 207 | ++$rank; |
||
| 208 | } |
||
| 209 | |||
| 210 | echo '</td></tr></table> |
||
| 211 | <br><br>'; |
||
| 212 | } else { |
||
| 213 | echo "<table class='outer' width='50%' border='0'><tr><td width=40>"; |
||
| 214 | echo "<img src='../assets/images/admin/search_button_green_32.png' border=0 /></td><td>"; |
||
| 215 | echo "<font color='#00B4C4'><b>" . _AM_ADSLIGHT_NOANNVALADS . '</b></font>'; |
||
| 216 | echo '</td></tr></table><br>'; |
||
| 217 | } |
||
| 218 | |||
| 219 | xoops_cp_footer(); |
||
| 220 | } |
||
| 221 | |||
| 222 | # function IndexView |
||
| 223 | ##################################################### |
||
| 224 | /** |
||
| 225 | * @param $lid |
||
| 226 | */ |
||
| 227 | function IndexView($lid) |
||
|
0 ignored issues
–
show
The function
IndexView() has been defined more than once; this definition is ignored, only the first definition in admin/validate_ads.php (L253-391) 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...
|
|||
| 228 | { |
||
| 229 | global $xoopsDB, $xoopsModule, $xoopsConfig, $xoopsModuleConfig, $myts, $desctext, $moduleDirName, $admin_lang; |
||
| 230 | |||
| 231 | $mytree = new ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); |
||
| 232 | |||
| 233 | include_once __DIR__ . '/header.php'; |
||
| 234 | xoops_cp_header(); |
||
| 235 | // loadModuleAdminMenu(0, ""); |
||
|
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...
|
|||
| 236 | |||
| 237 | $result = $xoopsDB->query('select lid, cid, title, status, expire, type, desctext, tel, price, typeprice, typeusure, date, email, submitter, town, country, contactby, premium, photo from ' . |
||
| 238 | $xoopsDB->prefix('adslight_listing') . |
||
| 239 | " WHERE valid='No' AND lid='$lid'"); |
||
| 240 | $numrows = $xoopsDB->getRowsNum($result); |
||
| 241 | if ($numrows > 0) { |
||
| 242 | echo "<table width='100%' border='0' cellspacing='1' cellpadding='8' style='border: 2px solid #DFE0E0;'><tr class='bg4'><td valign='top'>"; |
||
| 243 | echo '<b>' . _AM_ADSLIGHT_WAIT . '</b><br><br>'; |
||
| 244 | |||
| 245 | list($lid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $photo) = |
||
| 246 | $xoopsDB->fetchRow($result); |
||
| 247 | |||
| 248 | $date2 = formatTimestamp($date, 's'); |
||
| 249 | $title = $myts->htmlSpecialChars($title); |
||
| 250 | $status = $myts->htmlSpecialChars($status); |
||
| 251 | $expire = $myts->htmlSpecialChars($expire); |
||
| 252 | $type = $myts->htmlSpecialChars($type); |
||
| 253 | $desctext = $myts->displayTarea($desctext, 1, 1, 1); |
||
| 254 | $tel = $myts->htmlSpecialChars($tel); |
||
| 255 | // $price = number_format($price, 2, ",", " "); |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
58% 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...
|
|||
| 256 | $typeprice = $myts->htmlSpecialChars($typeprice); |
||
| 257 | $typeusure = $myts->htmlSpecialChars($typeusure); |
||
| 258 | $submitter = $myts->htmlSpecialChars($submitter); |
||
| 259 | $town = $myts->htmlSpecialChars($town); |
||
| 260 | $country = $myts->htmlSpecialChars($country); |
||
| 261 | $contactby = $myts->htmlSpecialChars($contactby); |
||
| 262 | $premium = $myts->htmlSpecialChars($premium); |
||
| 263 | |||
| 264 | echo "<form action=\"index.php\" method=\"post\"> |
||
| 265 | <table><tr class='head' border='1'> |
||
| 266 | <td>" . _AM_ADSLIGHT_NUMANN . " </td><td>$lid " . _AM_ADSLIGHT_ADDED_ON . " $date2</td> |
||
| 267 | </tr><tr class='head' border='1'> |
||
| 268 | <td>" . _AM_ADSLIGHT_SENDBY . " </td><td>$submitter</td> |
||
| 269 | </tr><tr class='head' border='1'> |
||
| 270 | <td>" . _AM_ADSLIGHT_EMAIL . " </td><td><input type=\"text\" name=\"email\" size=\"40\" value=\"$email\"></td> |
||
| 271 | </tr><tr class='head' border='1'> |
||
| 272 | <td>" . _AM_ADSLIGHT_TEL . " </td><td><input type=\"text\" name=\"tel\" size=\"50\" value=\"$tel\"></td> |
||
| 273 | </tr><tr class='head' border='1'> |
||
| 274 | <td>" . _AM_ADSLIGHT_TOWN . " </td><td><input type=\"text\" name=\"town\" size=\"40\" value=\"$town\"></td> |
||
| 275 | </tr><tr class='head' border='1'> |
||
| 276 | <td>" . _AM_ADSLIGHT_COUNTRY . " </td><td><input type=\"text\" name=\"country\" size=\"40\" value=\"$country\"></td> |
||
| 277 | </tr><tr class='head' border='1'> |
||
| 278 | <td>" . _AM_ADSLIGHT_CONTACTBY . " </td><td><input type=\"text\" name=\"contactby\" size=\"40\" value=\"$contactby\"></td> |
||
| 279 | </tr>"; |
||
| 280 | |||
| 281 | echo "<tr> |
||
| 282 | <td class='head'>" . _AM_ADSLIGHT_STATUS . "</td><td class='head'><input type=\"radio\" name=\"status\" value=\"0\""; |
||
| 283 | if ($status == '0') { |
||
| 284 | echo 'checked'; |
||
| 285 | } |
||
| 286 | echo '>' . _AM_ADSLIGHT_ACTIVE . " <input type=\"radio\" name=\"status\" value=\"1\""; |
||
| 287 | if ($status == '1') { |
||
| 288 | echo 'checked'; |
||
| 289 | } |
||
| 290 | echo '>' . _AM_ADSLIGHT_INACTIVE . " <input type=\"radio\" name=\"status\" value=\"2\""; |
||
| 291 | if ($status == '2') { |
||
| 292 | echo 'checked'; |
||
| 293 | } |
||
| 294 | echo '>' . _AM_ADSLIGHT_SOLD . '</td></tr>'; |
||
| 295 | |||
| 296 | echo "<tr class='head' border='1'> |
||
| 297 | <td>" . _AM_ADSLIGHT_TITLE2 . " </td><td><input type=\"text\" name=\"title\" size=\"40\" value=\"$title\"></td> |
||
| 298 | </tr><tr class='head' border='1'> |
||
| 299 | <td>" . _AM_ADSLIGHT_PREMIUM . " </td><td><input type=\"text\" name=\"premium\" size=\"3\" value=\"$premium\"></td> |
||
| 300 | </tr><tr class='head' border='1'> |
||
| 301 | <td>" . _AM_ADSLIGHT_EXPIRE . " </td><td><input type=\"text\" name=\"expire\" size=\"40\" value=\"$expire\"></td> |
||
| 302 | </tr><tr class='head' border='1'> |
||
| 303 | <td>" . _AM_ADSLIGHT_TYPE . " </td><td><select name=\"type\">"; |
||
| 304 | |||
| 305 | $result5 = $xoopsDB->query('select nom_type from ' . $xoopsDB->prefix('adslight_type') . ' order by nom_type'); |
||
| 306 | while (list($nom_type) = $xoopsDB->fetchRow($result5)) { |
||
| 307 | $sel = ''; |
||
| 308 | if ($nom_type == $type) { |
||
| 309 | $sel = 'selected'; |
||
| 310 | } |
||
| 311 | echo "<option value=\"$nom_type\" $sel>$nom_type</option>"; |
||
| 312 | } |
||
| 313 | |||
| 314 | echo '</select></td></tr>'; |
||
| 315 | |||
| 316 | ////// Etat d'usure |
||
| 317 | echo "<tr class='head' border='1'> |
||
| 318 | <td>" . _AM_ADSLIGHT_TYPE_USURE . " </td><td><select name=\"typeusure\">"; |
||
| 319 | |||
| 320 | $result6 = $xoopsDB->query('select nom_usure from ' . $xoopsDB->prefix('adslight_usure') . ' order by nom_usure'); |
||
| 321 | while (list($nom_usure) = $xoopsDB->fetchRow($result6)) { |
||
| 322 | $sel = ''; |
||
| 323 | if ($nom_usure == $typeusure) { |
||
| 324 | $sel = 'selected'; |
||
| 325 | } |
||
| 326 | echo "<option value=\"$nom_usure\" $sel>$nom_usure</option>"; |
||
| 327 | } |
||
| 328 | echo '</select></td></tr>'; |
||
| 329 | |||
| 330 | echo "<tr class='head' border='1'><td>" . _AM_ADSLIGHT_PRICE2 . " </td><td><input type=\"text\" name=\"price\" size=\"20\" value=\"$price\"> " . $xoopsModuleConfig['adslight_money'] . ''; |
||
| 331 | $result3 = $xoopsDB->query('select nom_price from ' . $xoopsDB->prefix('adslight_price') . ' order by id_price'); |
||
| 332 | echo " <select name=\"typeprice\"><option value=\"$typeprice\">$typeprice</option>"; |
||
| 333 | while (list($nom_price) = $xoopsDB->fetchRow($result3)) { |
||
| 334 | echo "<option value=\"$nom_price\">$nom_price</option>"; |
||
| 335 | } |
||
| 336 | echo '</select></td></tr>'; |
||
| 337 | |||
| 338 | echo "<tr class='head' border='1'> |
||
| 339 | <td>" . _AM_ADSLIGHT_PHOTO1 . " </td><td><input type=\"text\" name=\"photo\" size=\"40\" value=\"$photo\"></td> |
||
| 340 | </tr>"; |
||
| 341 | echo "<tr class='head' border='1'><td>" . _AM_ADSLIGHT_DESC . '</td><td>'; |
||
| 342 | $wysiwyg_text_area = adslight_adminEditor(_AM_ADSLIGHT_DESC, 'desctext', $desctext, '100%', '200px', 'small'); |
||
| 343 | echo $wysiwyg_text_area->render(); |
||
| 344 | echo '</td></tr>'; |
||
| 345 | echo "<tr class='head' border='1'><td>" . _AM_ADSLIGHT_CAT . ' </td><td>'; |
||
| 346 | $mytree->makeMySelBox('title', 'title', $cid); |
||
| 347 | echo "</td> |
||
| 348 | </tr><tr class='head' border='1'> |
||
| 349 | <td> </td><td><select name=\"op\"> |
||
| 350 | <option value=\"ListingValid\"> " . _AM_ADSLIGHT_OK . " |
||
| 351 | <option value=\"ListingDel\"> " . _AM_ADSLIGHT_DEL . " |
||
| 352 | </select><input type=\"submit\" value=\"" . _AM_ADSLIGHT_GO . "\"></td> |
||
| 353 | </tr></table>"; |
||
| 354 | echo "<input type=\"hidden\" name=\"valid\" value=\"Yes\">"; |
||
| 355 | echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\">"; |
||
| 356 | echo "<input type=\"hidden\" name=\"date\" value=\"$date\">"; |
||
| 357 | echo "<input type=\"hidden\" name=\"submitter\" value=\"$submitter\"> |
||
| 358 | </form>"; |
||
| 359 | |||
| 360 | echo '</td></tr></table>'; |
||
| 361 | echo '<br>'; |
||
| 362 | } |
||
| 363 | |||
| 364 | xoops_cp_footer(); |
||
| 365 | } |
||
| 366 | |||
| 367 | # function ModifyAds |
||
| 368 | ##################################################### |
||
| 369 | /** |
||
| 370 | * @param $lid |
||
| 371 | */ |
||
| 372 | function ModifyAds($lid) |
||
|
0 ignored issues
–
show
The function
ModifyAds() has been defined more than once; this definition is ignored, only the first definition in admin/modify_ads.php (L124-296) 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...
|
|||
| 373 | { |
||
| 374 | global $xoopsDB, $xoopsModule, $xoopsConfig, $xoopsModuleConfig, $myts, $desctext, $moduleDirName, $admin_lang; |
||
| 375 | |||
| 376 | $mytree = new ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); |
||
| 377 | |||
| 378 | include_once __DIR__ . '/header.php'; |
||
| 379 | xoops_cp_header(); |
||
| 380 | // loadModuleAdminMenu(0, ""); |
||
|
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...
|
|||
| 381 | $id_price = ''; |
||
| 382 | $nom_price = ''; |
||
| 383 | |||
| 384 | echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_ADSLIGHT_MODANN . '</legend>'; |
||
| 385 | |||
| 386 | $result = |
||
| 387 | $xoopsDB->query('select lid, cid, title, status, expire, type, desctext, tel, price, typeprice, typeusure, date, email, submitter, town, country, contactby, premium, valid, photo from ' . |
||
| 388 | $xoopsDB->prefix('adslight_listing') . |
||
| 389 | " where lid=$lid"); |
||
| 390 | |||
| 391 | while (list($lid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $valid, $photo) = |
||
| 392 | $xoopsDB->fetchRow($result)) { |
||
| 393 | $title = $myts->htmlSpecialChars($title); |
||
| 394 | $status = $myts->htmlSpecialChars($status); |
||
| 395 | $expire = $myts->htmlSpecialChars($expire); |
||
| 396 | $type = $myts->htmlSpecialChars($type); |
||
| 397 | $desctext = $myts->displayTarea($desctext, 1, 1, 1); |
||
| 398 | $tel = $myts->htmlSpecialChars($tel); |
||
| 399 | // $price = number_format($price, 2, ",", " "); |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
58% 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...
|
|||
| 400 | $typeprice = $myts->htmlSpecialChars($typeprice); |
||
| 401 | $typeusure = $myts->htmlSpecialChars($typeusure); |
||
| 402 | $submitter = $myts->htmlSpecialChars($submitter); |
||
| 403 | $town = $myts->htmlSpecialChars($town); |
||
| 404 | $country = $myts->htmlSpecialChars($country); |
||
| 405 | $contactby = $myts->htmlSpecialChars($contactby); |
||
| 406 | $premium = $myts->htmlSpecialChars($premium); |
||
| 407 | |||
| 408 | $date2 = formatTimestamp($date, 's'); |
||
| 409 | |||
| 410 | echo "<form action=\"view_ads.php\" method=post> |
||
| 411 | <table border=0><tr class='head' border='1'> |
||
| 412 | <td>" . _AM_ADSLIGHT_NUMANN . " </td><td>$lid " . _AM_ADSLIGHT_ADDED_ON . " $date2</td> |
||
| 413 | </tr><tr class='head' border='1'> |
||
| 414 | <td>" . _AM_ADSLIGHT_SENDBY . " </td><td>$submitter</td> |
||
| 415 | </tr><tr class='head' border='1'> |
||
| 416 | <td>" . _AM_ADSLIGHT_EMAIL . " </td><td><input type=\"text\" name=\"email\" size=\"40\" value=\"$email\"></td> |
||
| 417 | </tr><tr class='head' border='1'> |
||
| 418 | <td>" . _AM_ADSLIGHT_TEL . " </td><td><input type=\"text\" name=\"tel\" size=\"50\" value=\"$tel\"></td> |
||
| 419 | </tr><tr class='head' border='1'> |
||
| 420 | <td>" . _AM_ADSLIGHT_TOWN . " </td><td><input type=\"text\" name=\"town\" size=\"40\" value=\"$town\"></td> |
||
| 421 | </tr><tr class='head' border='1'> |
||
| 422 | <td>" . _AM_ADSLIGHT_COUNTRY . " </td><td><input type=\"text\" name=\"country\" size=\"40\" value=\"$country\"></td> |
||
| 423 | </tr> |
||
| 424 | <tr class='head' border='1'>"; |
||
| 425 | |||
| 426 | if ($contactby == 1) { |
||
| 427 | $contactselect = _AM_ADSLIGHT_CONTACT_BY_EMAIL; |
||
| 428 | } |
||
| 429 | if ($contactby == 2) { |
||
| 430 | $contactselect = _AM_ADSLIGHT_CONTACT_BY_PM; |
||
| 431 | } |
||
| 432 | if ($contactby == 3) { |
||
| 433 | $contactselect = _AM_ADSLIGHT_CONTACT_BY_BOTH; |
||
| 434 | } |
||
| 435 | if ($contactby == 4) { |
||
| 436 | $contactselect = _AM_ADSLIGHT_CONTACT_BY_PHONE; |
||
| 437 | } |
||
| 438 | |||
| 439 | echo " <td class='head'>" . _AM_ADSLIGHT_CONTACTBY . " </td><td class='head'><select name=\"contactby\"> |
||
| 440 | <option value=\"" . $contactby . "\">" . $contactselect . "</option> |
||
| 441 | <option value=\"1\">" . _AM_ADSLIGHT_CONTACT_BY_EMAIL . "</option> |
||
| 442 | <option value=\"2\">" . _AM_ADSLIGHT_CONTACT_BY_PM . "</option> |
||
| 443 | <option value=\"3\">" . _AM_ADSLIGHT_CONTACT_BY_BOTH . "</option> |
||
| 444 | <option value=\"4\">" . _AM_ADSLIGHT_CONTACT_BY_PHONE . '</option></select></td></tr>'; |
||
| 445 | |||
| 446 | echo "<tr><td class='head'>" . _AM_ADSLIGHT_STATUS . "</td><td class='head'><input type=\"radio\" name=\"status\" value=\"0\""; |
||
| 447 | if ($status == '0') { |
||
| 448 | echo 'checked'; |
||
| 449 | } |
||
| 450 | echo '>' . _AM_ADSLIGHT_ACTIVE . " <input type=\"radio\" name=\"status\" value=\"1\""; |
||
| 451 | if ($status == '1') { |
||
| 452 | echo 'checked'; |
||
| 453 | } |
||
| 454 | echo '>' . _AM_ADSLIGHT_INACTIVE . " <input type=\"radio\" name=\"status\" value=\"2\""; |
||
| 455 | if ($status == '2') { |
||
| 456 | echo 'checked'; |
||
| 457 | } |
||
| 458 | echo '>' . _AM_ADSLIGHT_SOLD . '</td></tr>'; |
||
| 459 | |||
| 460 | echo "<tr class='head' border='1'> |
||
| 461 | <td>" . _AM_ADSLIGHT_TITLE2 . " </td><td><input type=\"text\" name=\"title\" size=\"40\" value=\"$title\"></td> |
||
| 462 | </tr><tr class='head' border='1'> |
||
| 463 | <td>" . _AM_ADSLIGHT_PREMIUM . " </td><td><input type=\"text\" name=\"premium\" size=\"3\" value=\"$premium\"></td> |
||
| 464 | </tr><tr class='head' border='1'> |
||
| 465 | <td>" . _AM_ADSLIGHT_EXPIRE . " </td><td><input type=\"text\" name=\"expire\" size=\"40\" value=\"$expire\"></td> |
||
| 466 | </tr>"; |
||
| 467 | ////// Type d'annonce |
||
| 468 | echo "<tr class='head' border='1'> |
||
| 469 | <td>" . _AM_ADSLIGHT_TYPE . " </td><td><select name=\"type\">"; |
||
| 470 | |||
| 471 | $result5 = $xoopsDB->query('select nom_type, id_type from ' . $xoopsDB->prefix('adslight_type') . ' order by nom_type'); |
||
| 472 | while (list($nom_type, $id_type) = $xoopsDB->fetchRow($result5)) { |
||
| 473 | $sel = ''; |
||
| 474 | if ($id_type == $type) { |
||
| 475 | $sel = 'selected'; |
||
| 476 | } |
||
| 477 | echo "<option value=\"$id_type\" $sel>$nom_type</option>"; |
||
| 478 | } |
||
| 479 | echo '</select></td></tr>'; |
||
| 480 | |||
| 481 | ////// Etat d'usure |
||
| 482 | echo "<tr class='head' border='1'> |
||
| 483 | <td>" . _AM_ADSLIGHT_TYPE_USURE . " </td><td><select name=\"typeusure\">"; |
||
| 484 | |||
| 485 | $result6 = $xoopsDB->query('select nom_usure, id_usure from ' . $xoopsDB->prefix('adslight_usure') . ' order by nom_usure'); |
||
| 486 | while (list($nom_usure, $id_usure) = $xoopsDB->fetchRow($result6)) { |
||
| 487 | $sel = ''; |
||
| 488 | if ($id_usure == $typeusure) { |
||
| 489 | $sel = 'selected'; |
||
| 490 | } |
||
| 491 | echo "<option value=\"$id_usure\" $sel>$nom_usure</option>"; |
||
| 492 | } |
||
| 493 | echo '</select></td></tr>'; |
||
| 494 | |||
| 495 | /////// Price |
||
| 496 | echo "<tr class='head' border='1'><td>" . _AM_ADSLIGHT_PRICE2 . " </td><td><input type=\"text\" name=\"price\" size=\"20\" value=\"$price\"> " . $xoopsModuleConfig['adslight_money'] . ''; |
||
| 497 | |||
| 498 | //////// Price type |
||
| 499 | |||
| 500 | $resultx = $xoopsDB->query('select nom_price, id_price from ' . $xoopsDB->prefix('adslight_price') . ' order by nom_price'); |
||
| 501 | |||
| 502 | echo " <select name=\"typeprice\"><option value=\"$id_price\">$nom_price</option>"; |
||
| 503 | while (list($nom_price, $id_price) = $xoopsDB->fetchRow($resultx)) { |
||
| 504 | $sel = ''; |
||
| 505 | if ($id_price == $typeprice) { |
||
| 506 | $sel = 'selected'; |
||
| 507 | } |
||
| 508 | |||
| 509 | echo "<option value=\"$id_price\" $sel>$nom_price</option>"; |
||
| 510 | } |
||
| 511 | echo '</select></td>'; |
||
| 512 | |||
| 513 | /////// Category |
||
| 514 | |||
| 515 | echo "<tr class='head' border='1'> |
||
| 516 | <td>" . _AM_ADSLIGHT_CAT2 . ' </td><td>'; |
||
| 517 | $mytree->makeMySelBox('title', 'title', $cid); |
||
| 518 | echo "</td> |
||
| 519 | </tr><tr class='head' border='1'> |
||
| 520 | <td>" . _AM_ADSLIGHT_DESC . ' </td><td>'; |
||
| 521 | |||
| 522 | $wysiwyg_text_area = adslight_adminEditor('', 'desctext', $desctext, '100%', '200px', 'small'); |
||
| 523 | echo $wysiwyg_text_area->render(); |
||
| 524 | |||
| 525 | echo '</td></tr>'; |
||
| 526 | |||
| 527 | echo "<tr class='head' border='1'> |
||
| 528 | <td>" . _AM_ADSLIGHT_PHOTO1 . " </td><td><input type=\"text\" name=\"photo\" size=\"50\" value=\"$photo\"></td> |
||
| 529 | </tr><tr>"; |
||
| 530 | $time = time(); |
||
| 531 | echo "</tr><tr class='head' border='1'> |
||
| 532 | <td> </td><td><select name=\"op\"> |
||
| 533 | <option value=\"ModifyAdsS\"> " . _AM_ADSLIGHT_MODIF . " |
||
| 534 | <option value=\"ListingDel\"> " . _AM_ADSLIGHT_DEL . " |
||
| 535 | </select><input type=\"submit\" value=\"" . _AM_ADSLIGHT_GO . "\"></td> |
||
| 536 | </tr></table>"; |
||
| 537 | echo "<input type=\"hidden\" name=\"valid\" value=\"Yes\">"; |
||
| 538 | echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\">"; |
||
| 539 | echo "<input type=\"hidden\" name=\"date\" value=\"$time\">"; |
||
| 540 | echo "<input type=\"hidden\" name=\"submitter\" value=\"$submitter\"> |
||
| 541 | </form><br>"; |
||
| 542 | echo '</fieldset><br>'; |
||
| 543 | xoops_cp_footer(); |
||
| 544 | } |
||
| 545 | } |
||
| 546 | |||
| 547 | # function ModifyAdsS |
||
| 548 | ##################################################### |
||
| 549 | |||
| 550 | /** |
||
| 551 | * @param $lid |
||
| 552 | * @param $cat |
||
| 553 | * @param $title |
||
| 554 | * @param $status |
||
| 555 | * @param $expire |
||
| 556 | * @param $type |
||
| 557 | * @param $desctext |
||
| 558 | * @param $tel |
||
| 559 | * @param $price |
||
| 560 | * @param $typeprice |
||
| 561 | * @param $typeusure |
||
| 562 | * @param $date |
||
| 563 | * @param $email |
||
| 564 | * @param $submitter |
||
| 565 | * @param $town |
||
| 566 | * @param $country |
||
| 567 | * @param $contactby |
||
| 568 | * @param $premium |
||
| 569 | * @param $valid |
||
| 570 | * @param $photo |
||
| 571 | */ |
||
| 572 | View Code Duplication | function ModifyAdsS($lid, $cat, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $valid, $photo) |
|
|
0 ignored issues
–
show
The function
ModifyAdsS() has been defined more than once; this definition is ignored, only the first definition in admin/modify_ads.php (L323-347) 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...
|
|||
| 573 | { |
||
| 574 | global $xoopsDB, $xoopsConfig, $myts, $moduleDirName, $admin_lang; |
||
| 575 | |||
| 576 | $title = $myts->htmlSpecialChars($title); |
||
| 577 | $status = $myts->htmlSpecialChars($status); |
||
| 578 | $expire = $myts->htmlSpecialChars($expire); |
||
| 579 | $type = $myts->htmlSpecialChars($type); |
||
| 580 | $desctext = $myts->displayTarea($desctext, 1, 1, 1); |
||
| 581 | $tel = $myts->htmlSpecialChars($tel); |
||
| 582 | $price = str_replace(array(' '), '', $price); |
||
| 583 | $typeprice = $myts->htmlSpecialChars($typeprice); |
||
| 584 | $typeusure = $myts->htmlSpecialChars($typeusure); |
||
| 585 | $submitter = $myts->htmlSpecialChars($submitter); |
||
| 586 | $town = $myts->htmlSpecialChars($town); |
||
| 587 | $country = $myts->htmlSpecialChars($country); |
||
| 588 | $contactby = $myts->htmlSpecialChars($contactby); |
||
| 589 | $premium = $myts->htmlSpecialChars($premium); |
||
| 590 | |||
| 591 | $xoopsDB->query('update ' . |
||
| 592 | $xoopsDB->prefix('adslight_listing') . |
||
| 593 | " set cid='$cat', title='$title', status='$status', expire='$expire', type='$type', desctext='$desctext', tel='$tel', price='$price', typeprice='$typeprice', typeusure='$typeusure', date='$date', email='$email', submitter='$submitter', town='$town', country='$country', contactby='$contactby', premium='$premium', valid='$valid', photo='$photo' where lid=$lid"); |
||
| 594 | |||
| 595 | redirect_header('view_ads.php', 1, _AM_ADSLIGHT_ANNMOD); |
||
| 596 | } |
||
| 597 | |||
| 598 | # function ListingDel |
||
| 599 | ##################################################### |
||
| 600 | /** |
||
| 601 | * @param $lid |
||
| 602 | * @param $photo |
||
| 603 | */ |
||
| 604 | View Code Duplication | function ListingDel($lid, $photo) |
|
|
0 ignored issues
–
show
The function
ListingDel() has been defined more than once; this definition is ignored, only the first definition in admin/modify_ads.php (L355-388) 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...
|
|||
| 605 | { |
||
| 606 | global $xoopsDB, $moduleDirName, $admin_lang; |
||
| 607 | |||
| 608 | $result2 = $xoopsDB->query('select p.url FROM ' . |
||
| 609 | $xoopsDB->prefix('adslight_listing') . |
||
| 610 | ' l LEFT JOIN ' . |
||
| 611 | $xoopsDB->prefix('adslight_pictures') . |
||
| 612 | ' p ON l.lid=p.lid where l.lid=' . |
||
| 613 | $xoopsDB->escape($lid) . |
||
| 614 | ''); |
||
| 615 | |||
| 616 | while (list($purl) = $xoopsDB->fetchRow($result2)) { |
||
| 617 | if ($purl) { |
||
| 618 | $destination = XOOPS_ROOT_PATH . '/uploads/AdsLight'; |
||
| 619 | if (file_exists("$destination/$purl")) { |
||
| 620 | unlink("$destination/$purl"); |
||
| 621 | } |
||
| 622 | $destination2 = XOOPS_ROOT_PATH . '/uploads/AdsLight/thumbs'; |
||
| 623 | if (file_exists("$destination2/thumb_$purl")) { |
||
| 624 | unlink("$destination2/thumb_$purl"); |
||
| 625 | } |
||
| 626 | $destination3 = XOOPS_ROOT_PATH . '/uploads/AdsLight/midsize'; |
||
| 627 | if (file_exists("$destination3/resized_$purl")) { |
||
| 628 | unlink("$destination3/resized_$purl"); |
||
| 629 | } |
||
| 630 | $xoopsDB->query('delete from ' . $xoopsDB->prefix('adslight_pictures') . " where lid=$lid"); |
||
| 631 | } |
||
| 632 | } |
||
| 633 | |||
| 634 | $xoopsDB->query('delete from ' . $xoopsDB->prefix('adslight_listing') . " where lid=$lid"); |
||
| 635 | |||
| 636 | redirect_header('view_ads.php', 1, _AM_ADSLIGHT_ANNDEL); |
||
| 637 | } |
||
| 638 | |||
| 639 | # function ListingValid |
||
| 640 | ##################################################### |
||
| 641 | /** |
||
| 642 | * @param $lid |
||
| 643 | * @param $cat |
||
| 644 | * @param $title |
||
| 645 | * @param $status |
||
| 646 | * @param $expire |
||
| 647 | * @param $type |
||
| 648 | * @param $desctext |
||
| 649 | * @param $tel |
||
| 650 | * @param $price |
||
| 651 | * @param $typeprice |
||
| 652 | * @param $typeusure |
||
| 653 | * @param $date |
||
| 654 | * @param $email |
||
| 655 | * @param $submitter |
||
| 656 | * @param $town |
||
| 657 | * @param $country |
||
| 658 | * @param $contactby |
||
| 659 | * @param $premium |
||
| 660 | * @param $valid |
||
| 661 | * @param $photo |
||
| 662 | */ |
||
| 663 | View Code Duplication | function ListingValid($lid, $cat, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $valid, $photo) |
|
|
0 ignored issues
–
show
The function
ListingValid() has been defined more than once; this definition is ignored, only the first definition in admin/validate_ads.php (L691-772) 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...
|
|||
| 664 | { |
||
| 665 | global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $meta, $moduleDirName, $admin_lang; |
||
| 666 | |||
| 667 | $title = $myts->htmlSpecialChars($title); |
||
| 668 | $status = $myts->htmlSpecialChars($status); |
||
| 669 | $expire = $myts->htmlSpecialChars($expire); |
||
| 670 | $type = $myts->htmlSpecialChars($type); |
||
| 671 | $desctext = $myts->displayTarea($desctext, 1, 1, 1); |
||
| 672 | $tel = $myts->htmlSpecialChars($tel); |
||
| 673 | $price = str_replace(array(' '), '', $price); |
||
| 674 | $typeprice = $myts->htmlSpecialChars($typeprice); |
||
| 675 | $typeusure = $myts->htmlSpecialChars($typeusure); |
||
| 676 | $submitter = $myts->htmlSpecialChars($submitter); |
||
| 677 | $town = $myts->htmlSpecialChars($town); |
||
| 678 | $country = $myts->htmlSpecialChars($country); |
||
| 679 | $contactby = $myts->htmlSpecialChars($contactby); |
||
| 680 | $premium = $myts->htmlSpecialChars($premium); |
||
| 681 | $now = time(); |
||
| 682 | $xoopsDB->query('update ' . |
||
| 683 | $xoopsDB->prefix('adslight_listing') . |
||
| 684 | " set cid='$cat', title='$title', status='$status', expire='$expire', type='$type', desctext='$desctext', tel='$tel', price='$price', typeprice='$typeprice', typeusure='$typeusure', date='$now', email='$email', submitter='$submitter', town='$town', country='$country', contactby='$contactby', premium='$premium', valid='$valid', photo='$photo' where lid=$lid"); |
||
| 685 | |||
| 686 | if ($email == '') { |
||
| 687 | } else { |
||
| 688 | $tags = array(); |
||
| 689 | $tags['TITLE'] = $title; |
||
| 690 | $tags['TYPE'] = adslight_NameType($type); |
||
| 691 | $tags['SUBMITTER'] = $submitter; |
||
| 692 | $tags['DESCTEXT'] = stripslashes($desctext); |
||
| 693 | $tags['EMAIL'] = _AM_ADSLIGHT_EMAIL; |
||
| 694 | $tags['TEL'] = _AM_ADSLIGHT_TEL; |
||
| 695 | $tags['HELLO'] = _AM_ADSLIGHT_HELLO; |
||
| 696 | $tags['VEDIT_AD'] = _AM_ADSLIGHT_VEDIT_AD; |
||
| 697 | $tags['ANNACCEPT'] = _AM_ADSLIGHT_ANNACCEPT; |
||
| 698 | $tags['CONSULTTO'] = _AM_ADSLIGHT_CONSULTTO; |
||
| 699 | $tags['THANKS'] = _ADSLIGHT_THANKS; |
||
| 700 | $tags['TEAMOF'] = _AM_ADSLIGHT_TEAMOF; |
||
| 701 | $tags['META_TITLE'] = $meta['title']; |
||
| 702 | $tags['LINK_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewads.php?lid=' . $lid . ''; |
||
| 703 | $tags['YOUR_AD'] = _AM_ADSLIGHT_YOUR_AD; |
||
| 704 | $tags['WEBMASTER'] = _AM_ADSLIGHT_WEBMASTER; |
||
| 705 | $tags['YOUR_AD_ON'] = _AM_ADSLIGHT_YOUR_AD_ON; |
||
| 706 | $tags['APPROVED'] = _AM_ADSLIGHT_APPROVED; |
||
| 707 | |||
| 708 | $subject = '' . _AM_ADSLIGHT_ANNACCEPT . ''; |
||
| 709 | $mail =& getMailer(); |
||
| 710 | $mail->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/mail_template/'); |
||
| 711 | $mail->setTemplate('listing_approve.tpl'); |
||
| 712 | $mail->useMail(); |
||
| 713 | $mail->multimailer->isHTML(true); |
||
| 714 | $mail->setFromName($meta['title']); |
||
| 715 | $mail->setFromEmail($xoopsConfig['adminmail']); |
||
| 716 | $mail->setToEmails($email); |
||
| 717 | $mail->setSubject($subject); |
||
| 718 | $mail->assign($tags); |
||
| 719 | $mail->send(); |
||
| 720 | echo $mail->getErrors(); |
||
| 721 | } |
||
| 722 | |||
| 723 | $tags = array(); |
||
| 724 | $tags['TITLE'] = $title; |
||
| 725 | $tags['ADDED_TO_CAT'] = _AM_ADSLIGHT_ADDED_TO_CAT; |
||
| 726 | $tags['RECIEVING_NOTIF'] = _AM_ADSLIGHT_RECIEVING_NOTIF; |
||
| 727 | $tags['ERROR_NOTIF'] = _AM_ADSLIGHT_ERROR_NOTIF; |
||
| 728 | $tags['WEBMASTER'] = _AM_ADSLIGHT_WEBMASTER; |
||
| 729 | $tags['HELLO'] = _AM_ADSLIGHT_HELLO; |
||
| 730 | $tags['FOLLOW_LINK'] = _AM_ADSLIGHT_FOLLOW_LINK; |
||
| 731 | $tags['TYPE'] = adslight_NameType($type); |
||
| 732 | $tags['LINK_URL'] = XOOPS_URL . '/modules/adslight/viewads.php?' . '&lid=' . $lid; |
||
| 733 | $sql = 'SELECT title FROM ' . $xoopsDB->prefix('adslight_categories') . ' WHERE cid=' . addslashes($cat); |
||
| 734 | $result = $xoopsDB->query($sql); |
||
| 735 | $row = $xoopsDB->fetchArray($result); |
||
| 736 | $tags['CATEGORY_TITLE'] = $row['title']; |
||
| 737 | $tags['CATEGORY_URL'] = XOOPS_URL . '/modules/adslight/viewcats.php?cid="' . addslashes($cat); |
||
| 738 | $notification_handler = xoops_getHandler('notification'); |
||
| 739 | $notification_handler->triggerEvent('global', 0, 'new_listing', $tags); |
||
| 740 | $notification_handler->triggerEvent('category', $cat, 'new_listing', $tags); |
||
| 741 | $notification_handler->triggerEvent('listing', $lid, 'new_listing', $tags); |
||
| 742 | |||
| 743 | redirect_header('view_ads.php', 3, _AM_ADSLIGHT_ANNVALID); |
||
| 744 | } |
||
| 745 | |||
| 746 | ##################################################### |
||
| 747 | ##################################################### |
||
| 748 | |||
| 749 | foreach ($_POST as $k => $v) { |
||
| 750 | ${$k} = $v; |
||
| 751 | } |
||
| 752 | |||
| 753 | $pa = isset($_GET['pa']) ? $_GET['pa'] : ''; |
||
| 754 | |||
| 755 | if (!isset($_POST['lid']) && isset($_GET['lid'])) { |
||
| 756 | $lid = $_GET['lid']; |
||
| 757 | } |
||
| 758 | if (!isset($_POST['op']) && isset($_GET['op'])) { |
||
| 759 | $op = $_GET['op']; |
||
| 760 | } |
||
| 761 | if (!isset($op)) { |
||
| 762 | $op = ''; |
||
| 763 | } |
||
| 764 | |||
| 765 | View Code Duplication | switch ($op) { |
|
| 766 | |||
| 767 | case 'IndexView': |
||
| 768 | IndexView($lid); |
||
| 769 | break; |
||
| 770 | |||
| 771 | case 'ListingDel': |
||
| 772 | ListingDel($lid, $photo); |
||
| 773 | break; |
||
| 774 | |||
| 775 | case 'ListingValid': |
||
| 776 | ListingValid($lid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $valid, $photo); |
||
| 777 | break; |
||
| 778 | |||
| 779 | case 'ModifyAds': |
||
| 780 | ModifyAds($lid); |
||
| 781 | break; |
||
| 782 | |||
| 783 | case 'ModifyAdsS': |
||
| 784 | ModifyAdsS($lid, $cid, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $valid, $photo); |
||
| 785 | break; |
||
| 786 | |||
| 787 | default: |
||
| 788 | Index(); |
||
| 789 | break; |
||
| 790 | |||
| 791 | } |
||
| 792 |
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.