1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463
|
<?php
require_once("initvars.inc.php");
require_once("config.inc.php");
if($image_verification)
{
require_once("captcha.cls.php");
$captcha = new captcha();
}
$msg = "";
$err = "";
?>
<?php
if (!$_GET['adid'])
{
header("Location: $script_url/?view=main&cityid=$xcityid&lang=$xlang");
exit;
}
$adtable = ($_GET['view'] == "showevent") ? $t_events : $t_ads;
$adid_prefix = (($xview == "events") ? "E" : "A");
$full_adid = ($adid_prefix . $xadid);
$reported = explode(";", $_COOKIE["reported"]);
$is_reported = in_array($full_adid, $reported);
$qsA = $_GET; $qs = "";
unset($qsA['do'], $qsA['reported'], $qsA['mailed'], $qsA['mailerr'], $qsA['msg'], $qsA['err']);
foreach ($qsA as $k=>$v) $qs .= "$k=$v&";
if ($_GET['do'] == "reportabuse")
{
if (!$is_reported) {
$sql = "UPDATE $adtable
SET abused = abused + 1
WHERE adid = $_GET[adid]
AND abused < " . ($spam_indicator - 1);
mysql_query($sql) or die($sql);
if(mysql_affected_rows())
{
echo "<div class=\"msg\">$lang[MESSAGE_ABUSE_REPORT]</div>";
if($max_abuse_reports)
{
$sql = "UPDATE $adtable
SET enabled = '0'
WHERE adid = $_GET[adid]
AND abused >= $max_abuse_reports";
mysql_query($sql);
}
header("Location: $script_url/?{$qs}reported=y");
exit;
}
}
unset($_GET['do']);
}
if ($xview == "showevent")
{
$sql = "SELECT a.*, UNIX_TIMESTAMP(a.timestamp) AS timestamp, UNIX_TIMESTAMP(a.createdon) AS createdon, UNIX_TIMESTAMP(a.expireson) AS expireson, UNIX_TIMESTAMP(feat.featuredtill) AS featuredtill,
UNIX_TIMESTAMP(a.starton) AS starton, UNIX_TIMESTAMP(a.endon) AS endon
FROM $t_events a
LEFT OUTER JOIN $t_featured feat ON a.adid = feat.adid AND feat.adtype = 'E'
WHERE a.adid = $xadid
AND $visibility_condn_admin";
$ad = mysql_fetch_array(mysql_query($sql));
$isevent = 1;
$thisurl = buildURL($xview, array($xcityid, $xdate, $xadid, $ad['adtitle']));
}
else
{
$xfieldsql = "";
if(count($xsubcatfields))
{
for($i=1; $i<=$xfields_count; $i++) $xfieldsql .= ", axf.f$i";
}
$sql = "SELECT a.*, ct.cityname as cityname, UNIX_TIMESTAMP(a.timestamp) AS timestamp, UNIX_TIMESTAMP(a.createdon) AS createdon, UNIX_TIMESTAMP(a.expireson) AS expireson, UNIX_TIMESTAMP(feat.featuredtill) AS featuredtill $xfieldsql
FROM $t_ads a
INNER JOIN $t_subcats scat ON scat.subcatid = a.subcatid
INNER JOIN $t_cities ct ON a.cityid = ct.cityid
LEFT OUTER JOIN $t_adxfields axf ON a.adid = axf.adid
LEFT OUTER JOIN $t_featured feat ON a.adid = feat.adid AND feat.adtype = 'A'
WHERE a.adid = $xadid
AND $visibility_condn_admin";
$ad = mysql_fetch_array(mysql_query($sql));
$isevent = 0;
$thisurl = buildURL($xview, array($xcityid, $xcatid, $xcatname, $xsubcatid, $xsubcatname,
$xadid, $ad['adtitle']));
}
if (!$ad)
{
header("Location: $script_url/index.php?view=post404&cityid=$xcityid&lang=$xlang");
exit;
}
if ($_POST['email'] && $_POST['mail'] && $ad['showemail'] == EMAIL_USEFORM)
{
$err = "";
if ($image_verification && !$captcha->verify($_POST['captcha']))
{
$err .= $lang['ERROR_IMAGE_VERIFICATION_FAILED'] . "<br>";
}
if (!ValidateEmail($_POST['email']))
{
$err .= $lang['ERROR_INVALID_EMAIL'] . "<br>";
}
if (preg_match("/[\\000-\\037]/", $_POST['email']))
{
handle_security_attack("@");
}
else if (!$err)
{
$thismail_header = file_get_contents("mailtemplates/contact_header.txt");
$thismail_header = str_replace("{@SITENAME}", $site_name, $thismail_header);
$thismail_header = str_replace("{@ADTITLE}", $ad['adtitle'], $thismail_header);
$thismail_header = str_replace("{@ADURL}", "{$script_url}/{$thisurl}", $thismail_header);
$thismail_header = str_replace("{@FROM}", $_POST['email'], $thismail_header);
$thismail_footer = file_get_contents("mailtemplates/contact_footer.txt");
$thismail_footer = str_replace("{@SITENAME}", $site_name, $thismail_footer);
$thismail_footer = str_replace("{@ADTITLE}", $ad['adtitle'], $thismail_footer);
$thismail_footer = str_replace("{@ADURL}", "{$script_url}/{$thisurl}", $thismail_footer);
$thismail_footer = str_replace("{@FROM}", $_POST['email'], $thismail_footer);
$msg = $thismail_header . "\n" .
stripslashes($_POST['mail']) . "\n" .
$thismail_footer;
$xtraheaders = array("Reply-To: " . $_POST['email']);
$mailerr = sendMail($ad['email'], $lang['MAILSUBJECT_CONTACT_FORM'], $msg,
$site_email, $langx['charset'], "attach", $xtraheaders);
if ($mailerr)
{
$mailresult = "n";
if ($mailerr == "FAILED") $mailerr = "";
}
else
{
$mailresult = "y";
}
header("Location: $script_url/?$qs&mailed=$mailresult&mailerr=$mailerr");
exit;
}
}
$sql = "SELECT *
FROM $t_adpics p
WHERE p.adid = $xadid
AND isevent = '$isevent'";
$pres = mysql_query($sql);
?>
<script language="javascript">
function confirmAbuseReport()
{
if (confirm('<?php echo addslashes($lang['REPORT_ABUSE_CONFIRM']); ?>'))
{
eval("location.href = '?' + '<?php echo $qs; ?>' + 'do=reportabuse'");
}
}
</script>
<?php
if ($_GET['reported']) {
$reported[] = $full_adid;
setcookie("reported", implode(";", $reported), time()+90*24*60*60, "/");
$is_reported = true;
}
?>
<?php
if(!$_POST['mail'])
{
if($_GET['mailed'] == "y") { $msg .= $lang['MESSAGE_MAIL_SENT']."<br>"; }
elseif ($_GET['mailed'] == "n") { $err .= $lang['ERROR_MAIL_NOT_SENT']."<br>".$_GET['mailerr']."<br>"; }
if($_GET['reported'] == "y") { $msg .= $lang['MESSAGE_ABUSE_REPORT']."<br>"; }
}
if($_GET['msg']) { $msg .= nl2br(htmlentities($_GET['msg']))."<br>"; }
if($_GET['err']) { $err .= nl2br(htmlentities($_GET['err']))."<br>"; }
?>
<?php
if($err) echo "<div class=\"err\">$err</div>";
if($msg) echo "<div class=\"msg\">$msg</div>";
?>
<?php include_once("inc/prev_next.inc.php");?>
<?php if($ad['featuredtill'] && $ad['featuredtill'] > time()) { ?>
<div class="msg">
<img src="images/featured.gif" align="absmiddle">
<b><?php echo $lang['THIS_AD_IS_FEATURED']; ?></b>
</div>
<?php } ?>
<table class="postheader" width="100%">
<tr>
<td>
<div align="right">
<?php if(!$is_reported) { ?><a href="javascript:confirmAbuseReport();"><?php echo $lang['REPORT_ABUSE']; ?></a> | <?php } ?>
<a href="?view=mailad&cityid=<?php echo $xcityid; ?>&adid=<?php echo $xadid; ?>&adtype=<?php echo $xadtype; ?><?php if($xdate) echo "&date={$xdate}"; ?>"><?php echo $lang['EMAIL_THIS_AD_LINK']; ?></a>
</div>
<?php echo $lang['POST_ID']; ?> <?php echo ($xview=="showevent"?"E":"A"); ?><?php echo $ad['adid']; ?><br><br>
<?php
if ($xview == "showevent")
{
?>
<b><?php echo date("d", $ad['starton'])." ".$langx['months_short'][date("n", $ad['starton'])-1] . ", " . date("y", $ad['starton']); ?>
<?php if($ad['starton'] != $ad['endon']) echo " - " . date("d", $ad['endon']) . " " . $langx['months_short'][date("n", $ad['endon'])-1] . ", " . date("y", $ad['endon']); ?></b>
<br>
<?php
}
?>
<div class="posttitle">
<?php echo $ad['adtitle']; ?>
<?php
$loc = "";
if($ad['area']) $loc = $ad['area'];
if($xcityid < 0) $loc .= ($loc ? ", " : "") . $ad['cityname'];
if($loc) echo " <span class=\"adarea\">($loc)</span>";
?>
</div><br>
<b><?php echo $lang['AD_DATE']; ?></b>:
<?php echo QuickDate($ad['createdon']); ?>
<br>
<?php if($ad['createdon'] != $ad['timestamp']) { ?>
<b><?php echo $lang['AD_LAST_UPDATE']; ?></b>:
<?php echo QuickDate($ad['timestamp']); ?>
<br>
<?php } ?>
<b><?php echo $lang['AD_EXPIRES_ON']; ?></b>:
<?php echo QuickDate($ad['expireson']); ?>
<br>
<b><?php echo $lang['REPLY_TO']; ?></b>:
<?php if ($ad['showemail'] == EMAIL_SHOW) { ?>
<a href="mailto:<?php echo $ad['email']; ?>"><?php echo $ad['email']; ?></a>
<?php } elseif ($ad['showemail'] == EMAIL_USEFORM) { ?>
<i><?php echo $lang['USE_CONTACT_FORM']; ?></i>
<?php } else { ?>
<i><?php echo $lang['EMAIL_NOT_SHOWN']; ?></i>
<?php } ?>
<br>
</td>
</tr>
</table>
<?php
if(($xsubcathasprice && $ad['price']) || count($xsubcatfields))
{
$actualfields = $xsubcathasprice ? 1 : 0;
?>
<div>
<table>
<?php if($xsubcathasprice) { ?><tr><td><b><?php echo $xsubcatpricelabel; ?></b></td><td>: <?php if(($xsubcathasprice && $ad['price'] != 0.00)) { ?><?php echo $ad['price'] .' '. $currency; ?><?php } else { echo $lang['AD_PRICE_NOT_PROVIDED']; } ?></td></tr><?php } ?>
<?php if(count($xsubcatfields)) { foreach ($xsubcatfields as $fldnum=>$fld) { if(($fld['TYPE'] == "N" && $ad["f$fldnum"] > 0) || ($fld['TYPE'] != "N" && $ad["f$fldnum"])) { $actualfields++; ?>
<tr><td><b><?php echo $fld['NAME']; ?></b></td><td>: <?php echo $ad["f$fldnum"]; ?></td></tr>
<?php }}} ?>
</table></div>
<?php if ($actualfields) { ?>
<div style="border-bottom:1px solid #E0E0E0;"> </div>
<?php } ?>
<?php
}
?>
<table class="post" width="100%"><tr><td>
<?php echo generateHtml($ad['addesc'], $ad['createdon']); ?>
</td></tr></table>
<?php
if (@mysql_num_rows($pres))
{
$i = 0;
?>
<table class="postpics" width="100%"><tr><td>
<?php
while ($row = mysql_fetch_array($pres))
{
$i++;
$imgsize = GetThumbnailSize("{$datadir[adpics]}/{$row[picfile]}", $images_max_width, $images_max_height);
?>
<img src="<?php echo "{$datadir[adpics]}/{$row[picfile]}"; ?>" id="adimg<?php echo $i; ?>" width="<?php echo $imgsize[0]; ?>" height="<?php echo $imgsize[1]; ?>"><br><br>
<?php
}
?>
</td></tr></table>
<?php
$imgcnt = $i;
}
?>
<?php
if($ad['othercontactok']) echo "<p class=\"disclosure_yes\">$lang[COMMERCIAL_CONTACT_OK]</p>";
else echo "<p class=\"disclosure_no\">$lang[COMMERCIAL_CONTACT_NOT_OK]</p>";
?>
<?php
$hits = $ad['hits'];
$already_hit = explode(";", $_COOKIE["hits"]);
if (!in_array($full_adid, $already_hit)) {
$sql = "update $adtable set hits = hits + 1, timestamp = timestamp where adid = $xadid";
mysql_query($sql);
$already_hit[] = $full_adid;
setcookie("hits", implode(";", $already_hit), 0, "/");
$hits++;
}
?>
<div class="hits">Vue <?php echo $hits; ?> fois<br><br></div>
<br style="clear:both">
<?php if ($ad['showemail'] == EMAIL_USEFORM) {
/*$qs = ""; $qsA = $_GET; unset($qsA['syndicate']);
foreach ($qsA as $k=>$v) $qs .= "$k=$v&";*/
?>
<form action="<?php echo "$script_url/?$qs"; ?>" method="post" enctype="multipart/form-data">
<table class="contactform">
<tr>
<th colspan="2"><?php echo $lang['CONTACT_USER']; ?>:<a name="contactform"> </a>
</th>
</tr>
<tr><td colspan="2"> </td></tr>
<tr>
<td><?php echo $lang['YOUR_EMAIL']; ?>: <span class="marker">*</span></td>
<td>
<input type="text" size="65" name="email">
</td>
</tr>
<tr>
<td valign="top"><?php echo $lang['YOUR_MESSAGE']; ?>: <span class="marker">*</span></td>
<td>
<textarea cols="64" rows="10" name="mail"></textarea>
</td>
</tr>
<tr>
<td valign="top"><?php echo $lang['ATTACHMENT']; ?>:</td>
<td>
<input type="file" size="55" name="attach"><br>
<span class="hint"><?php echo $lang['UNSUPPORTED_ATTACHEMNTS']; ?>: <?php echo implode(", ", $contactmail_attach_wrongfiles); ?><br>
<?php echo $lang['MAX_ATTACHMENT_SIZE']; ?>: <?php echo $contactmail_attach_maxsize; ?>KB</span>
</td>
</tr>
<?php
if($image_verification)
{
?>
<tr>
<td valign="top"><?php echo $lang['POST_VERIFY_IMAGE']; ?>: <span class="marker">*</span></td>
<td>
<img src="captcha.png.php?<?php echo rand(0,999); ?>"><br>
<span class="hint"><?php echo $lang['POST_VERIFY_IMAGE_HINT']; ?></span><br>
<input type="text" name="captcha" value="">
</td>
</tr>
<?php
}
?>
<tr>
<td> </td>
<td><button type="submit"><?php echo $lang['BUTTON_SEND_MAIL']; ?></button></td>
</tr>
</table>
</form>
<?php } ?> |
Partager