/*==================================================================*\
######################################################################
# #
# 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: /order_banner.php
# ----------------------------------------------------------------------------------------------------
# ----------------------------------------------------------------------------------------------------
# LOAD CONFIG
# ----------------------------------------------------------------------------------------------------
include("./conf/loadconfig.inc.php");
# ----------------------------------------------------------------------------------------------------
# SESSION
# ----------------------------------------------------------------------------------------------------
sess_validateSessionFront();
extract($_POST);
extract($_GET);
# ----------------------------------------------------------------------------------------------------
# VALIDATE FEATURE
# ----------------------------------------------------------------------------------------------------
if (BANNER_FEATURE != "on" || CUSTOM_BANNER_FEATURE != "on") { exit; }
$banLevelObj = new BannerLevel();
$banLevelValue = $banLevelObj->getValues();
if (!in_array($type, $banLevelValue)) {
header("Location: ".DEFAULT_URL."/".ALIAS_ADVERTISE_URL_DIVISOR.".php?banner");
exit;
}
# ----------------------------------------------------------------------------------------------------
# SUBMIT
# ----------------------------------------------------------------------------------------------------
if (($_SERVER['REQUEST_METHOD'] == "POST")) {
$_POST["retype_password"] = $_POST["password"];
$validate_account = validate_addAccount($_POST, $message_account);
$validate_contact = validate_form("contact", $_POST, $message_contact);
$validate_banner = validate_form("banner", $_POST, $message_banner);
$validate_discount = is_valid_discount_code($_POST["discount_id"], "banner", $_POST["id"], $message_discount, $discount_error_num);
if ($validate_account && $validate_contact && $validate_banner && $validate_discount) {
$account = new Account($_POST);
$account->save();
$account->changeMemberStatus(true);
$contact = new Contact($_POST);
$contact->setNumber("account_id", $account->getNumber("id"));
$contact->save();
$profileObj = new Profile($account->getNumber("id"));
$profileObj->setNumber("account_id", $account->getNumber("id"));
if (!$profileObj->getString("nickname")) {
$profileObj->setString("nickname", $_POST["first_name"]." ".$_POST["last_name"]);
}
$profileObj->Save();
$accDomain = new Account_Domain($account->getNumber("id"), SELECTED_DOMAIN_ID);
$accDomain->Save();
$accDomain->saveOnDomain($account->getNumber("id"), $account, $contact, $profileObj);
if ($_POST["newsletter"]) {
$_POST["name"] = $_POST["first_name"]." ".$_POST["last_name"];
$_POST["type"] = "sponsor";
arcamailer_addSubscriber($_POST, $success, $account->getNumber("id"));
}
$banner = new Banner($_POST);
$banner->setNumber("account_id", $account->getNumber("id"));
if (!$banner->hasImpressions()) {
$banner->setNumber("unpaid_impressions", 0);
$banner->setString("unlimited_impressions", "y");
} else {
$banner->setString("unlimited_impressions", "n");
}
$banner->Save();
/**************************************************************************************************/
/* */
/* E-mail notify */
/* */
/**************************************************************************************************/
setting_get("sitemgr_send_email",$sitemgr_send_email);
setting_get("sitemgr_email",$sitemgr_email);
$sitemgr_emails = explode(",",$sitemgr_email);
if ($sitemgr_emails[0]) $sitemgr_email = $sitemgr_emails[0];
setting_get("sitemgr_account_email",$sitemgr_account_email);
$sitemgr_account_emails = explode(",",$sitemgr_account_email);
setting_get("sitemgr_banner_email",$sitemgr_banner_email);
$sitemgr_banner_emails = explode(",",$sitemgr_banner_email);
// sending e-mail to user //////////////////////////////////////////////////////////////////////////
if ($emailNotificationObj = system_checkEmail(SYSTEM_BANNER_SIGNUP)) {
$subject = $emailNotificationObj->getString("subject");
$body = $emailNotificationObj->getString("body");
$login_info = trim(system_showText(LANG_LABEL_USERNAME)).": ".$_POST["username"];
$login_info .= ($emailNotificationObj->getString("content_type") == "text/html"? "
": "\n");
$login_info .= trim(system_showText(LANG_LABEL_PASSWORD)).": ".$_POST["password"];
$body = str_replace("ACCOUNT_LOGIN_INFORMATION",$login_info,$body);
$body = system_replaceEmailVariables($body, $banner->getNumber('id'), 'banner');
$subject = system_replaceEmailVariables($subject, $banner->getNumber('id'), 'banner');
$body = html_entity_decode($body);
$subject = html_entity_decode($subject);
system_mail($contact->getString("email"), $subject, $body, EDIRECTORY_TITLE." <$sitemgr_email>", $emailNotificationObj->getString("content_type"), "", $emailNotificationObj->getString("bcc"), $error);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// site manager warning message /////////////////////////////////////
$emailSubject = "[".EDIRECTORY_TITLE."] ".system_showText(LANG_NOTIFY_SIGNUPBANNER);
$sitemgr_msg = system_showText(LANG_LABEL_SITE_MANAGER).",
".system_showText(LANG_NOTIFY_SIGNUPBANNER_1)."
".system_showText(LANG_LABEL_ACCOUNT).":
";
$sitemgr_msg .= "".system_showText(LANG_LABEL_USERNAME2).": ".system_showAccountUserName($account->getString("username"))."
";
$sitemgr_msg .= "".system_showText(LANG_LABEL_FIRST_NAME).": ".$contact->getString("first_name")."
";
$sitemgr_msg .= "".system_showText(LANG_LABEL_LAST_NAME).": ".$contact->getString("last_name")."
";
$sitemgr_msg .= "".system_showText(LANG_LABEL_COMPANY).": ".$contact->getString("company")."
";
$sitemgr_msg .= "".system_showText(LANG_LABEL_ADDRESS).": ".$contact->getString("address")." ".$contact->getString("address2")."
";
$sitemgr_msg .= "".system_showText(LANG_LABEL_CITY).": ".$contact->getString("city")."
";
$sitemgr_msg .= "".system_showText(LANG_LABEL_STATE).": ".$contact->getString("state")."
";
$sitemgr_msg .= "".ucfirst(system_showText(ZIPCODE_LABEL)).": ".$contact->getString("zip")."
";
$sitemgr_msg .= "".system_showText(LANG_LABEL_COUNTRY).": ".$contact->getString("country")."
";
$sitemgr_msg .= "".system_showText(LANG_LABEL_PHONE).": ".$contact->getString("phone")."
";
$sitemgr_msg .= "".system_showText(LANG_LABEL_EMAIL).": ".$contact->getString("email")."
";
$sitemgr_msg .= "
getNumber("id")."\" target=\"_blank\">".DEFAULT_URL."/".SITEMGR_ALIAS."/account/sponsor/sponsor.php?id=".$account->getNumber("id")."
";
$sitemgr_msg .= "".system_showText(LANG_BANNER_FEATURE_NAME).":
";
$sitemgr_msg .= "".system_showText(LANG_LABEL_CAPTION).": ".$banner->getString("caption")."
";
$sitemgr_msg .= "
getNumber("id")."\" target=\"_blank\">".((SSL_ENABLED == "on" && FORCE_SITEMGR_SSL == "on") ? SECURE_URL : NON_SECURE_URL)."/".SITEMGR_ALIAS."/content/".BANNER_FEATURE_FOLDER."/banner.php?id=".$banner->getNumber("id")."
";
setting_get("new_banner_email", $new_banner_email);
if ($new_banner_email) {
system_notifySitemgr($sitemgr_account_emails, $emailSubject, $sitemgr_msg, true, "", "", true, $sitemgr_banner_emails);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
if ($checkout) $payment_method = "checkout";
sess_registerAccountInSession($account->getString("username"));
setcookie("username_members", $account->getString("username"), time()+60*60*24*30, "".EDIRECTORY_FOLDER."/");
setcookie("automatic_login_members", "false", time()+60*60*24*30, "".EDIRECTORY_FOLDER."/");
$host = string_strtoupper(str_replace("www.", "", $_SERVER["HTTP_HOST"]));
setcookie($host."_DOMAIN_ID_MEMBERS", SELECTED_DOMAIN_ID, time()+60*60*24*30, "".EDIRECTORY_FOLDER."/");
setting_get("banner_approve_free", $banner_approve_free);
if ($payment_method == "checkout" && !$banner_approve_free){
$banner->setString("status", "A");
$banner->save();
}
if ($payment_method == "checkout") {
$redirectURL = DEFAULT_URL."/".MEMBERS_ALIAS."/".BANNER_FEATURE_FOLDER."/edit.php?id=".$banner->getNumber("id")."&process=signup";
} elseif ($payment_method == "invoice") {
$redirectURL = DEFAULT_URL."/".MEMBERS_ALIAS."/signup/invoice.php";
} else {
$redirectURL = DEFAULT_URL."/".MEMBERS_ALIAS."/signup/payment.php?payment_method=".$payment_method;
}
header("Location: ".$redirectURL);
exit;
} else {
// removing slashes added if required
$_POST = format_magicQuotes($_POST);
$_GET = format_magicQuotes($_GET);
extract($_POST);
extract($_GET);
}
}
# ----------------------------------------------------------------------------------------------------
# CODE
# ----------------------------------------------------------------------------------------------------
if (!$expiration_setting) $expiration_setting = BANNER_EXPIRATION_RENEWAL_DATE;
$bannerLevelObj = new BannerLevel();
$levelValue = $bannerLevelObj->getValues();
$formloginaction = ((SSL_ENABLED == "on" && FORCE_MEMBERS_SSL == "on") ? SECURE_URL : NON_SECURE_URL)."/".MEMBERS_ALIAS."/login.php?destiny=".EDIRECTORY_FOLDER."/".MEMBERS_ALIAS."/".BANNER_FEATURE_FOLDER."/add.php";
/*
* TAX SECTION
*/
setting_get("payment_tax_status", $payment_tax_status);
setting_get("payment_tax_value", $payment_tax_value);
customtext_get("payment_tax_label", $payment_tax_label);
unset($googleEnabled, $facebookEnabled);
setting_get("foreignaccount_google", $foreignaccount_google);
if ($foreignaccount_google == "on") {
$googleEnabled = true;
}
if (FACEBOOK_APP_ENABLED == "on") {
$facebookEnabled = true;
}
$unique_id = system_generatePassword();
$checkoutpayment_class = "isHidden";
$checkoutfree_class = "isHidden";
$labelName = str_replace("[level]", $bannerLevelObj->showLevel($type), LANG_ADVERTISE_BANNERLEVEL);
$labelPrice = "";
$labelPriceRenewal = "";
$advertiseItem = "banner";
$hasPackage = false;
# ----------------------------------------------------------------------------------------------------
# HEADER
# ----------------------------------------------------------------------------------------------------
include(system_getFrontendPath("header.php", "layout"));
# ----------------------------------------------------------------------------------------------------
# AUX
# ----------------------------------------------------------------------------------------------------
require(EDIRECTORY_ROOT."/frontend/checkregbin.php");
?>