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