/*==================================================================*\
######################################################################
# #
# Copyright 2005 Arca Solutions, Inc. All Rights Reserved. #
# #
# This file may not be redistributed in whole or part. #
# eDirectory is licensed on a per-domain basis. #
# #
# ---------------- eDirectory IS NOT FREE SOFTWARE ----------------- #
# #
# http://www.edirectory.com | http://www.edirectory.com/license.html #
######################################################################
\*==================================================================*/
# ----------------------------------------------------------------------------------------------------
# * FILE: /listing/detail.php
# ----------------------------------------------------------------------------------------------------
# ----------------------------------------------------------------------------------------------------
# LOAD CONFIG
# ----------------------------------------------------------------------------------------------------
include("../conf/loadconfig.inc.php");
# ----------------------------------------------------------------------------------------------------
# SESSION
# ----------------------------------------------------------------------------------------------------
session_start();
# ----------------------------------------------------------------------------------------------------
# MOD-REWRITE
# ----------------------------------------------------------------------------------------------------
include(LISTING_EDIRECTORY_ROOT."/mod_rewrite.php");
# ----------------------------------------------------------------------------------------------------
# VALIDATION
# ----------------------------------------------------------------------------------------------------
include(EDIRECTORY_ROOT."/includes/code/validate_querystring.php");
include(EDIRECTORY_ROOT."/includes/code/validate_frontrequest.php");
# ----------------------------------------------------------------------------------------------------
# SUBMIT
# ----------------------------------------------------------------------------------------------------
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$message_style = "errorMessage";
if ($_POST["id"]) $listing = new Listing($_POST["id"]);
$to = system_denyInjections($to);
$subject = system_denyInjections($subject);
$body = system_denyInjections($body);
$error = "";
if (!validate_email($to)) $error .= system_showText(LANG_MSG_CONTACT_ENTER_VALID_EMAIL)."
";
if (!validate_email($from)) $error .= system_showText(LANG_MSG_CONTACT_ENTER_VALID_EMAIL)."
";
if (!$body) $error .= system_showText(LANG_MSG_CONTACT_TYPE_MESSAGE)."
";
if (md5($_POST["captchatext"]) != $_SESSION["captchakey"]) {
$error .= system_showText(LANG_MSG_CONTACT_TYPE_CODE)."
";
}
if (empty($error)) {
if (empty($subject)) $subject = LANG_LISTING_CONTACTSUBJECT_ISNULL_1." ".$listing->getString("title")." ".LANG_LISTING_CONTACTSUBJECT_ISNULL_2." ".EDIRECTORY_TITLE;
$subject = stripslashes($subject);
$body = stripslashes($body);
$subject = "[".system_showText(LANG_CONTACTPRESUBJECT)." ".EDIRECTORY_TITLE."] ".$subject;
$return = system_mail($to, $subject, $body, $from);
if ($return) {
$error = system_showText(LANG_CONTACTMSGSUCCESS);
$message_style = "successMessage";
} else {
$error = system_showText(LANG_CONTACTMSGFAILED)."
";
}
if ($return) {
report_newRecord("listing", $_POST["id"], LISTING_REPORT_EMAIL_SENT);
unset($from, $subject, $body);
}
} else {
$error .= system_showText(LANG_MSG_CONTACT_CORRECTIT_TRYAGAIN);
}
}
# ----------------------------------------------------------------------------------------------------
# LISTING
# ----------------------------------------------------------------------------------------------------
if (($_GET["id"]) || ($_POST["id"])) {
$id = $_GET["id"] ? $_GET["id"] : $_POST["id"];
$listing = new Listing($id);
$level = new ListingLevel();
unset($listingMsg);
if ((!$listing->getNumber("id")) || ($listing->getNumber("id") <= 0)) {
$listingMsg = ucwords(LISTING_FEATURE_NAME)." not found!";
} elseif ($listing->getString("status") != "A") {
$listingMsg = ucwords(LISTING_FEATURE_NAME)." not available!";
} elseif ($level->getDetail($listing->getNumber("level")) != "y") {
$listingMsg = ucwords(LISTING_FEATURE_NAME)." not available!";
} else {
report_newRecord("listing", $id, LISTING_REPORT_DETAIL_VIEW);
}
} else {
header("Location: ".LISTING_DEFAULT_URL."/");
exit;
}
# ----------------------------------------------------------------------------------------------------
# REVIEWS
# ----------------------------------------------------------------------------------------------------
if ($id) $sql_where[] = " listing_id = ".db_formatNumber($id)." ";
if (true) $sql_where[] = " review IS NOT NULL AND review != '' ";
if (true) $sql_where[] = " approved = '1' ";
if ($sql_where) $where .= " ".implode(" AND ", $sql_where)." ";
$pageObj = new pageBrowsing("Rating", $screen, 3, "added DESC", "", "", $where);
$ratingsArr = $pageObj->retrievePage("object");
# ----------------------------------------------------------------------------------------------------
# HEADER
# ----------------------------------------------------------------------------------------------------
if (($listing->getNumber("id")) && ($listing->getNumber("id") > 0)) {
$listCategs = $listing->getCategories();
if ($listCategs) {
foreach ($listCategs as $listCateg) {
$category_id[] = $listCateg->getNumber("id");
}
}
}
$_POST["category_id"] = $category_id;
$extrastyle = array(DEFAULT_URL."/layout/listing_detail.css", DEFAULT_URL."/layout/listing_color.css");
$banner_section = "listing";
$headertag_title = $listing->getString("title");
$headertag_description = $listing->getString("description");
$headertag_keywords = str_replace(" || ", ", ", $listing->getString("keywords"));
include(EDIRECTORY_ROOT."/layout/header.php");
?>
include(LISTING_EDIRECTORY_ROOT."/search.php"); ?>