public static function execute(ApplicationAbstract $application) { $OSCOM_ShoppingCart = Registry::get('ShoppingCart'); $requested_product = null; if (count($_GET) > 2) { $requested_product = basename(key(array_slice($_GET, 2, 1, true))); if ($requested_product == 'Add') { unset($requested_product); if (count($_GET) > 3) { $requested_product = basename(key(array_slice($_GET, 3, 1, true))); } } } if (isset($requested_product)) { if (Product::checkEntry($requested_product)) { $OSCOM_Product = new Product($requested_product); if ($OSCOM_Product->isTypeActionAllowed('AddToShoppingCart')) { if ($OSCOM_Product->hasVariants()) { if (isset($_POST['variants']) && is_array($_POST['variants']) && !empty($_POST['variants'])) { if ($OSCOM_Product->variantExists($_POST['variants'])) { $OSCOM_ShoppingCart->add($OSCOM_Product->getProductVariantID($_POST['variants'])); } else { osc_redirect(OSCOM::getLink(null, 'Products', $OSCOM_Product->getKeyword())); } } else { osc_redirect(OSCOM::getLink(null, 'Products', $OSCOM_Product->getKeyword())); } } else { $OSCOM_ShoppingCart->add($OSCOM_Product->getID()); } } } } osc_redirect(OSCOM::getLink(null, 'Cart')); }
function _process() { global $osC_Database, $messageStack, $osC_Language; $data = array(); $data['url'] = osc_sanitize_string($_POST['url']); if (isset($_POST['title']) && !empty($_POST['title'])) { $data['title'] = osc_sanitize_string($_POST['title']); } else { $messageStack->add('guestbook', $osC_Language->get('field_guestbook_title_error')); } if (isset($_POST['email']) && !empty($_POST['email']) && osc_validate_email_address($_POST['email'])) { $data['email'] = $_POST['email']; } else { $messageStack->add('guestbook', $osC_Language->get('field_guestbook_email_error')); } if (isset($_POST['content']) && !empty($_POST['content'])) { $data['content'] = osc_sanitize_string($_POST['content']); } else { $messageStack->add('guestbook', $osC_Language->get('field_guestbook_content_error')); } if ($_POST['verify_code'] != $_SESSION['verify_code']) { $messageStack->add('guestbook', $osC_Language->get('field_guestbook_verify_code_error')); } if ($messageStack->size('guestbook') === 0) { if (toC_Guestbook::saveEntry($data)) { $messageStack->add_session('guestbook', $osC_Language->get('success_guestbook_saved'), 'success'); } osc_redirect(osc_href_link(FILENAME_INFO, 'guestbook')); } }
public static function execute(ApplicationAbstract $application) { $OSCOM_ShoppingCart = Registry::get('ShoppingCart'); $OSCOM_PaymentModule = Registry::get('PaymentModule'); $OSCOM_PaymentModule->process(); osc_redirect(OSCOM::getLink(null, null, 'Success', 'SSL')); }
public static function execute(ApplicationAbstract $application) { $OSCOM_MessageStack = Registry::get('MessageStack'); $data = array(); if (DISPLAY_PRIVACY_CONDITIONS == '1') { if (isset($_POST['privacy_conditions']) === false || isset($_POST['privacy_conditions']) && $_POST['privacy_conditions'] != '1') { $OSCOM_MessageStack->add('Create', OSCOM::getDef('error_privacy_statement_not_accepted')); } } if (ACCOUNT_GENDER >= 0) { if (isset($_POST['gender']) && ($_POST['gender'] == 'm' || $_POST['gender'] == 'f')) { $data['gender'] = $_POST['gender']; } else { $OSCOM_MessageStack->add('Create', OSCOM::getDef('field_customer_gender_error')); } } if (isset($_POST['firstname']) && strlen(trim($_POST['firstname'])) >= ACCOUNT_FIRST_NAME) { $data['firstname'] = $_POST['firstname']; } else { $OSCOM_MessageStack->add('Create', sprintf(OSCOM::getDef('field_customer_first_name_error'), ACCOUNT_FIRST_NAME)); } if (isset($_POST['lastname']) && strlen(trim($_POST['lastname'])) >= ACCOUNT_LAST_NAME) { $data['lastname'] = $_POST['lastname']; } else { $OSCOM_MessageStack->add('Create', sprintf(OSCOM::getDef('field_customer_last_name_error'), ACCOUNT_LAST_NAME)); } if (ACCOUNT_DATE_OF_BIRTH == '1') { if (isset($_POST['dob_days']) && isset($_POST['dob_months']) && isset($_POST['dob_years']) && checkdate($_POST['dob_months'], $_POST['dob_days'], $_POST['dob_years'])) { $data['dob'] = mktime(0, 0, 0, $_POST['dob_months'], $_POST['dob_days'], $_POST['dob_years']); } else { $OSCOM_MessageStack->add('Create', OSCOM::getDef('field_customer_date_of_birth_error')); } } if (isset($_POST['email_address']) && strlen(trim($_POST['email_address'])) >= ACCOUNT_EMAIL_ADDRESS) { if (osc_validate_email_address($_POST['email_address'])) { if (Account::checkEntry($_POST['email_address']) === false) { $data['email_address'] = $_POST['email_address']; } else { $OSCOM_MessageStack->add('Create', OSCOM::getDef('field_customer_email_address_exists_error')); } } else { $OSCOM_MessageStack->add('Create', OSCOM::getDef('field_customer_email_address_check_error')); } } else { $OSCOM_MessageStack->add('Create', sprintf(OSCOM::getDef('field_customer_email_address_error'), ACCOUNT_EMAIL_ADDRESS)); } if (isset($_POST['password']) === false || isset($_POST['password']) && strlen(trim($_POST['password'])) < ACCOUNT_PASSWORD) { $OSCOM_MessageStack->add('Create', sprintf(OSCOM::getDef('field_customer_password_error'), ACCOUNT_PASSWORD)); } elseif (isset($_POST['confirmation']) === false || isset($_POST['confirmation']) && trim($_POST['password']) != trim($_POST['confirmation'])) { $OSCOM_MessageStack->add('Create', OSCOM::getDef('field_customer_password_mismatch_with_confirmation')); } else { $data['password'] = $_POST['password']; } if ($OSCOM_MessageStack->size('Create') === 0) { if (Account::createEntry($data)) { $OSCOM_MessageStack->add('Create', OSCOM::getDef('success_account_updated'), 'success'); } osc_redirect(OSCOM::getLink(null, null, 'Create&Success', 'SSL')); } }
function _process() { global $osC_Language, $osC_MessageStack, $osC_Product; if (empty($_POST['from_name'])) { $osC_MessageStack->add('tell_a_friend', $osC_Language->get('error_tell_a_friend_customers_name_empty')); } if (!osc_validate_email_address($_POST['from_email_address'])) { $osC_MessageStack->add('tell_a_friend', $osC_Language->get('error_tell_a_friend_invalid_customers_email_address')); } if (empty($_POST['to_name'])) { $osC_MessageStack->add('tell_a_friend', $osC_Language->get('error_tell_a_friend_friends_name_empty')); } if (!osc_validate_email_address($_POST['to_email_address'])) { $osC_MessageStack->add('tell_a_friend', $osC_Language->get('error_tell_a_friend_invalid_friends_email_address')); } if ($osC_MessageStack->size('tell_a_friend') < 1) { $email_subject = sprintf($osC_Language->get('email_tell_a_friend_subject'), osc_sanitize_string($_POST['from_name']), STORE_NAME); $email_body = sprintf($osC_Language->get('email_tell_a_friend_intro'), osc_sanitize_string($_POST['to_name']), osc_sanitize_string($_POST['from_name']), $osC_Product->getTitle(), STORE_NAME) . "\n\n"; if (!empty($_POST['message'])) { $email_body .= osc_sanitize_string($_POST['message']) . "\n\n"; } $email_body .= sprintf($osC_Language->get('email_tell_a_friend_link'), osc_href_link(FILENAME_PRODUCTS, $osC_Product->getKeyword(), 'NONSSL', false)) . "\n\n" . sprintf($osC_Language->get('email_tell_a_friend_signature'), STORE_NAME . "\n" . HTTP_SERVER . DIR_WS_CATALOG . "\n"); osc_email(osc_sanitize_string($_POST['to_name']), osc_sanitize_string($_POST['to_email_address']), $email_subject, $email_body, osc_sanitize_string($_POST['from_name']), osc_sanitize_string($_POST['from_email_address'])); $osC_MessageStack->add('header', sprintf($osC_Language->get('success_tell_a_friend_email_sent'), $osC_Product->getTitle(), osc_output_string_protected($_POST['to_name'])), 'success'); osc_redirect(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getID())); } }
function execute() { global $osC_Database, $osC_Session, $osC_NavigationHistory, $osC_Customer; if (!$osC_Customer->isLoggedOn()) { $osC_NavigationHistory->setSnapshot(); osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'login', 'SSL')); return false; } $id = false; foreach ($_GET as $key => $value) { if ((ereg('^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$', $key) || ereg('^[a-zA-Z0-9 -_]*$', $key)) && $key != $osC_Session->getName()) { $id = $key; } break; } if ($id !== false && osC_Product::checkEntry($id)) { $osC_Product = new osC_Product($id); $Qcheck = $osC_Database->query('select products_id from :table_products_notifications where customers_id = :customers_id and products_id = :products_id limit 1'); $Qcheck->bindTable(':table_products_notifications', TABLE_PRODUCTS_NOTIFICATIONS); $Qcheck->bindInt(':customers_id', $osC_Customer->getID()); $Qcheck->bindInt(':products_id', $osC_Product->getID()); $Qcheck->execute(); if ($Qcheck->numberOfRows() > 0) { $Qn = $osC_Database->query('delete from :table_products_notifications where customers_id = :customers_id and products_id = :products_id'); $Qn->bindTable(':table_products_notifications', TABLE_PRODUCTS_NOTIFICATIONS); $Qn->bindInt(':customers_id', $osC_Customer->getID()); $Qn->bindInt(':products_id', $osC_Product->getID()); $Qn->execute(); } } osc_redirect(osc_href_link(basename($_SERVER['SCRIPT_FILENAME']), osc_get_all_get_params(array('action')))); }
function _save_orders_returns() { global $messageStack, $osC_Database, $osC_Language, $osC_Customer; $error = false; $products = array(); if (isset($_POST['return_items']) && !empty($_POST['return_items'])) { foreach ($_POST['return_items'] as $orders_products_id => $on) { if (isset($_POST['quantity'][$orders_products_id]) && $_POST['quantity'][$orders_products_id] > 0) { $products[$orders_products_id] = $_POST['quantity'][$orders_products_id]; } else { $messageStack->add($this->_module, sprintf($osC_Language->get('error_quantity_for_return_product'), $_POST['products_name'][$orders_products_id])); } } } if (sizeof($products) == 0) { $messageStack->add($this->_module, $osC_Language->get('error_return_items_empty')); } if (isset($_POST['comments']) && empty($_POST['comments'])) { $messageStack->add($this->_module, $osC_Language->get('error_return_comments_empty')); } if ($messageStack->size($this->_module) === 0) { if (toC_Order_Return::saveReturnRequest($_GET['orders_id'], $products, $_POST['comments'])) { $messageStack->add_session($this->_module, $osC_Language->get('success_account_updated'), 'success'); } osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'orders=list_return_requests', 'SSL')); } }
function _process() { global $osC_Database, $osC_Session, $osC_Language, $osC_ShoppingCart, $messageStack, $osC_Customer, $osC_NavigationHistory, $toC_Wishlist; if (osC_Account::checkEntry($_POST['email_address'])) { if (osC_Account::checkPassword($_POST['password'], $_POST['email_address'])) { if (osC_Account::checkStatus($_POST['email_address'])) { if (SERVICE_SESSION_REGENERATE_ID == '1') { $osC_Session->recreate(); } $osC_Customer->setCustomerData(osC_Account::getID($_POST['email_address'])); $Qupdate = $osC_Database->query('update :table_customers set date_last_logon = :date_last_logon, number_of_logons = number_of_logons+1 where customers_id = :customers_id'); $Qupdate->bindTable(':table_customers', TABLE_CUSTOMERS); $Qupdate->bindRaw(':date_last_logon', 'now()'); $Qupdate->bindInt(':customers_id', $osC_Customer->getID()); $Qupdate->execute(); $osC_ShoppingCart->synchronizeWithDatabase(); $toC_Wishlist->synchronizeWithDatabase(); $osC_NavigationHistory->removeCurrentPage(); if ($osC_NavigationHistory->hasSnapshot()) { $osC_NavigationHistory->redirectToSnapshot(); } else { osc_redirect(osc_href_link(FILENAME_DEFAULT, null, 'AUTO')); } } else { $messageStack->add('login', $osC_Language->get('error_login_status_disabled')); } } else { $messageStack->add('login', $osC_Language->get('error_login_no_match')); } } else { $messageStack->add('login', $osC_Language->get('error_login_no_match')); } }
function _process() { global $osC_MessageStack, $osC_Database, $osC_Language; $Qcheck = $osC_Database->query('select customers_id, customers_firstname, customers_lastname, customers_gender, customers_email_address, customers_password from :table_customers where customers_email_address = :customers_email_address limit 1'); $Qcheck->bindTable(':table_customers', TABLE_CUSTOMERS); $Qcheck->bindValue(':customers_email_address', $_POST['email_address']); $Qcheck->execute(); if ($Qcheck->numberOfRows() === 1) { $password = osc_create_random_string(ACCOUNT_PASSWORD); if (osC_Account::savePassword($password, $Qcheck->valueInt('customers_id'))) { if (ACCOUNT_GENDER > -1) { if ($data['gender'] == 'm') { $email_text = sprintf($osC_Language->get('email_addressing_gender_male'), $Qcheck->valueProtected('customers_lastname')) . "\n\n"; } else { $email_text = sprintf($osC_Language->get('email_addressing_gender_female'), $Qcheck->valueProtected('customers_lastname')) . "\n\n"; } } else { $email_text = sprintf($osC_Language->get('email_addressing_gender_unknown'), $Qcheck->valueProtected('customers_firstname') . ' ' . $Qcheck->valueProtected('customers_lastname')) . "\n\n"; } $email_text .= sprintf($osC_Language->get('email_password_reminder_body'), getenv('REMOTE_ADDR'), STORE_NAME, $password, STORE_OWNER_EMAIL_ADDRESS); osc_email($Qcheck->valueProtected('customers_firstname') . ' ' . $Qcheck->valueProtected('customers_lastname'), $Qcheck->valueProtected('customers_email_address'), sprintf($osC_Language->get('email_password_reminder_subject'), STORE_NAME), $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); $osC_MessageStack->add('login', $osC_Language->get('success_password_forgotten_sent'), 'success'); } osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'login', 'SSL')); } else { $osC_MessageStack->add('password_forgotten', $osC_Language->get('error_password_forgotten_no_email_address_found')); } }
public static function execute(ApplicationAbstract $application) { $OSCOM_Shipping = Registry::get('Shipping'); $OSCOM_ShoppingCart = Registry::get('ShoppingCart'); if (!empty($_POST['comments'])) { $_SESSION['comments'] = osc_sanitize_string($_POST['comments']); } if ($OSCOM_Shipping->hasQuotes()) { if (isset($_POST['shipping_mod_sel']) && strpos($_POST['shipping_mod_sel'], '_')) { list($module, $method) = explode('_', $_POST['shipping_mod_sel']); if (Registry::exists('Shipping_' . $module) && Registry::get('Shipping_' . $module)->isEnabled()) { $quote = $OSCOM_Shipping->getQuote($_POST['shipping_mod_sel']); if (isset($quote['error'])) { $OSCOM_ShoppingCart->resetShippingMethod(); } else { $OSCOM_ShoppingCart->setShippingMethod($quote); osc_redirect(OSCOM::getLink(null, null, null, 'SSL')); } } else { $OSCOM_ShoppingCart->resetShippingMethod(); } } } else { $OSCOM_ShoppingCart->resetShippingMethod(); osc_redirect(OSCOM::getLink(null, null, null, 'SSL')); } }
function execute() { global $osC_Session, $osC_ShoppingCart; $id = false; foreach ($_GET as $key => $value) { if ((ereg('^[0-9]+(#?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$', $key) || ereg('^[a-zA-Z0-9 -_]*$', $key)) && $key != $osC_Session->getName()) { $id = $key; } break; } if ($id !== false && osC_Product::checkEntry($id)) { $osC_Product = new osC_Product($id); $product_id = $osC_Product->getID(); //gift certificate use timestamp as variant if ($osC_Product->isGiftCertificate()) { $product_id .= '#' . $_GET['variants']; } else { if (isset($_GET['variants']) && ereg('^([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*$', $_GET['variants'])) { $product_id .= '#' . $_GET['variants']; } } $osC_ShoppingCart->remove($product_id); } osc_redirect(osc_href_link(FILENAME_CHECKOUT)); }
/** * Verify an existing session ID and create or resume the session if the existing session ID is valid * * @access public * @return boolean */ public function start() { if ($this->_life_time > 0) { ini_set('session.gc_maxlifetime', $this->_life_time); } else { $this->_life_time = ini_get('session.gc_maxlifetime'); } session_set_cookie_params(0, OSCOM::getRequestType() == 'NONSSL' ? HTTP_COOKIE_PATH : HTTPS_COOKIE_PATH, OSCOM::getRequestType() == 'NONSSL' ? HTTP_COOKIE_DOMAIN : HTTPS_COOKIE_DOMAIN); $sane_session_id = true; if (isset($_GET[$this->_name]) && (empty($_GET[$this->_name]) || !ctype_alnum($_GET[$this->_name]))) { $sane_session_id = false; } elseif (isset($_POST[$this->_name]) && (empty($_POST[$this->_name]) || !ctype_alnum($_POST[$this->_name]))) { $sane_session_id = false; } elseif (isset($_COOKIE[$this->_name]) && (empty($_COOKIE[$this->_name]) || !ctype_alnum($_COOKIE[$this->_name]))) { $sane_session_id = false; setcookie($this->_name, '', time() - 42000, $this->getCookieParameters('path'), $this->getCookieParameters('domain')); } if ($sane_session_id === false) { osc_redirect(OSCOM::getLink(null, OSCOM::getDefaultSiteApplication(), null, 'NONSSL', false)); } else { if (session_start()) { register_shutdown_function(array($this, 'close')); $this->_is_started = true; $this->_id = session_id(); return true; } } return false; }
function osC_Checkout_Process() { global $osC_Session, $osC_ShoppingCart, $osC_Customer, $osC_NavigationHistory, $osC_Payment; if ($osC_Customer->isLoggedOn() === false) { $osC_NavigationHistory->setSnapshot(); osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'login', 'SSL')); } if ($osC_ShoppingCart->hasContents() === false) { osc_redirect(osc_href_link(FILENAME_CHECKOUT, null, 'SSL')); } // if no shipping method has been selected, redirect the customer to the shipping method selection page if ($osC_ShoppingCart->hasShippingMethod() === false && $osC_ShoppingCart->getContentType() != 'virtual') { osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'shipping', 'SSL')); } // load selected payment module include 'includes/classes/payment.php'; $osC_Payment = new osC_Payment($osC_ShoppingCart->getBillingMethod('id')); if ($osC_Payment->hasActive() && $osC_ShoppingCart->hasBillingMethod() === false) { osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'payment', 'SSL')); } include 'includes/classes/order.php'; $osC_Payment->process(); $osC_ShoppingCart->reset(true); // unregister session variables used during checkout unset($_SESSION['comments']); osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'success', 'SSL')); }
function _process() { global $osC_Language, $messageStack, $osC_Product; if (empty($_POST['from_name'])) { $messageStack->add('tell_a_friend', $osC_Language->get('error_tell_a_friend_customers_name_empty')); } if (!osc_validate_email_address($_POST['from_email_address'])) { $messageStack->add('tell_a_friend', $osC_Language->get('error_tell_a_friend_invalid_customers_email_address')); } if (empty($_POST['to_name'])) { $messageStack->add('tell_a_friend', $osC_Language->get('error_tell_a_friend_friends_name_empty')); } if (!osc_validate_email_address($_POST['to_email_address'])) { $messageStack->add('tell_a_friend', $osC_Language->get('error_tell_a_friend_invalid_friends_email_address')); } if ($messageStack->size('tell_a_friend') < 1) { include 'includes/classes/email_template.php'; $email_template = toC_Email_Template::getEmailTemplate('tell_a_friend'); $email_template->setData($_POST['from_name'], $_POST['from_email_address'], $_POST['to_name'], $_POST['to_email_address'], $_POST['message'], $osC_Product->getTitle(), osc_href_link(FILENAME_PRODUCTS, $osC_Product->getID(), 'NONSSL', false, true, true)); $email_template->buildMessage(); $email_template->sendEmail(); $messageStack->add_session('header', sprintf($osC_Language->get('success_tell_a_friend_email_sent'), $osC_Product->getTitle(), osc_output_string_protected($_POST['to_name'])), 'success'); osc_redirect(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getID())); } }
function execute() { global $osC_ShoppingCart; if (isset($_POST['products']) && is_array($_POST['products']) && !empty($_POST['products'])) { foreach ($_POST['products'] as $product => $quantity) { if (!is_numeric($quantity)) { return false; } $product = explode('#', $product, 2); $variants_array = array(); if (isset($product[1])) { $variants = explode(';', $product[1]); foreach ($variants as $set) { $variant = explode(':', $set); if (is_numeric($variant[0]) && is_numeric($variant[1])) { $variants_array[$variant[0]] = $variant[1]; } } } $osC_Product = new osC_Product($product[0]); if ($osC_Product->isGiftCertificate()) { $variants_array = $product[1]; } $osC_ShoppingCart->add($product[0], $variants_array, $quantity, null, 'update'); } } osc_redirect(osc_href_link(FILENAME_CHECKOUT)); }
public static function execute(ApplicationAbstract $application) { $OSCOM_Service = Registry::get('Service'); $OSCOM_Breadcrumb = Registry::get('Breadcrumb'); $application->setPageTitle(sprintf(OSCOM::getDef('index_heading'), STORE_NAME)); $application->setPageContent('product_listing.php'); if (is_numeric($_GET['Manufacturers'])) { Registry::set('Manufacturer', new Manufacturer($_GET['Manufacturers'])); $OSCOM_Manufacturer = Registry::get('Manufacturer'); $application->setPageTitle($OSCOM_Manufacturer->getTitle()); // HPDL $application->setPageImage('manufacturers/' . $OSCOM_Manufacturer->getImage()); if ($OSCOM_Service->isStarted('Breadcrumb')) { $OSCOM_Breadcrumb->add($OSCOM_Manufacturer->getTitle(), OSCOM::getLink()); } Registry::set('Products', new Products()); $OSCOM_Products = Registry::get('Products'); $OSCOM_Products->setManufacturer($OSCOM_Manufacturer->getID()); if (isset($_GET['filter']) && is_numeric($_GET['filter']) && $_GET['filter'] > 0) { $OSCOM_Products->setCategory($_GET['filter']); } if (isset($_GET['sort']) && !empty($_GET['sort'])) { if (strpos($_GET['sort'], '|d') !== false) { $OSCOM_Products->setSortBy(substr($_GET['sort'], 0, -2), '-'); } else { $OSCOM_Products->setSortBy($_GET['sort']); } } } else { osc_redirect(OSCOM::getLink(OSCOM::getDefaultSite(), OSCOM::getDefaultSiteApplication())); } }
function execute() { global $osC_Session, $osC_ShoppingCart, $osC_Product; if (!isset($osC_Product)) { $id = false; foreach ($_GET as $key => $value) { if ((is_numeric($key) || ereg('^[a-zA-Z0-9 -_]*$', $key)) && $key != $osC_Session->getName()) { $id = $key; } break; } if ($id !== false && osC_Product::checkEntry($id)) { $osC_Product = new osC_Product($id); } } if (isset($osC_Product)) { if ($osC_Product->hasVariants()) { if (isset($_POST['variants']) && is_array($_POST['variants']) && !empty($_POST['variants'])) { if ($osC_Product->variantExists($_POST['variants'])) { $osC_ShoppingCart->add($osC_Product->getProductVariantID($_POST['variants'])); } else { osc_redirect(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getKeyword())); return false; } } else { osc_redirect(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getKeyword())); return false; } } else { $osC_ShoppingCart->add($osC_Product->getID()); } } osc_redirect(osc_href_link(FILENAME_CHECKOUT)); }
public static function execute(ApplicationAbstract $application) { $OSCOM_Database = Registry::get('Database'); $OSCOM_Customer = Registry::get('Customer'); $OSCOM_MessageStack = Registry::get('MessageStack'); if (isset($_POST['newsletter_general']) && is_numeric($_POST['newsletter_general'])) { $newsletter_general = (int) $_POST['newsletter_general']; } else { $newsletter_general = 0; } // HPDL Should be moved to the customers class! $Qnewsletter = $OSCOM_Database->query('select customers_newsletter from :table_customers where customers_id = :customers_id'); $Qnewsletter->bindInt(':customers_id', $OSCOM_Customer->getID()); $Qnewsletter->execute(); if ($newsletter_general !== $Qnewsletter->valueInt('customers_newsletter')) { $newsletter_general = $Qnewsletter->value('customers_newsletter') == '1' ? '0' : '1'; $Qupdate = $OSCOM_Database->query('update :table_customers set customers_newsletter = :customers_newsletter where customers_id = :customers_id'); $Qupdate->bindInt(':customers_newsletter', $newsletter_general); $Qupdate->bindInt(':customers_id', $OSCOM_Customer->getID()); $Qupdate->execute(); if ($Qupdate->affectedRows() === 1) { $OSCOM_MessageStack->add('Account', OSCOM::getDef('success_newsletter_updated'), 'success'); } } osc_redirect(OSCOM::getLink(null, null, null, 'SSL')); }
function osC_Checkout_Process() { global $osC_Session, $osC_ShoppingCart, $osC_Customer, $osC_NavigationHistory, $osC_Payment; if ($osC_ShoppingCart->hasContents() === false) { osc_redirect(osc_href_link(FILENAME_CHECKOUT, null, 'SSL')); } // if no shipping method has been selected, redirect the customer to the shipping method selection page if ($osC_ShoppingCart->hasShippingMethod() === false && $osC_ShoppingCart->getContentType() != 'virtual') { osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'shipping', 'SSL')); } if ($osC_ShoppingCart->hasBillingMethod()) { // load selected payment module include 'includes/classes/payment.php'; $osC_Payment = new osC_Payment($osC_ShoppingCart->getBillingMethod('id')); } include 'includes/classes/order.php'; if ($osC_ShoppingCart->hasBillingMethod()) { $osC_Payment->process(); } else { $orders_id = osC_Order::insert(); osC_Order::process($orders_id, ORDERS_STATUS_PAID); } $osC_ShoppingCart->reset(true); // unregister session variables used during checkout unset($_SESSION['comments']); osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'success', 'SSL')); }
public static function execute(ApplicationAbstract $application) { $OSCOM_Database = Registry::get('Database'); $OSCOM_MessageStack = Registry::get('MessageStack'); $Qcheck = $OSCOM_Database->query('select customers_id, customers_firstname, customers_lastname, customers_gender, customers_email_address, customers_password from :table_customers where customers_email_address = :customers_email_address limit 1'); $Qcheck->bindValue(':customers_email_address', $_POST['email_address']); $Qcheck->execute(); if ($Qcheck->numberOfRows() === 1) { $password = osc_create_random_string(ACCOUNT_PASSWORD); if (Account::savePassword($password, $Qcheck->valueInt('customers_id'))) { if (ACCOUNT_GENDER > -1) { if ($Qcheck->value('customers_gender') == 'm') { $email_text = sprintf(OSCOM::getDef('email_addressing_gender_male'), $Qcheck->valueProtected('customers_lastname')) . "\n\n"; } else { $email_text = sprintf(OSCOM::getDef('email_addressing_gender_female'), $Qcheck->valueProtected('customers_lastname')) . "\n\n"; } } else { $email_text = sprintf(OSCOM::getDef('email_addressing_gender_unknown'), $Qcheck->valueProtected('customers_firstname') . ' ' . $Qcheck->valueProtected('customers_lastname')) . "\n\n"; } $email_text .= sprintf(OSCOM::getDef('email_password_reminder_body'), osc_get_ip_address(), STORE_NAME, $password, STORE_OWNER_EMAIL_ADDRESS); osc_email($Qcheck->valueProtected('customers_firstname') . ' ' . $Qcheck->valueProtected('customers_lastname'), $Qcheck->valueProtected('customers_email_address'), sprintf(OSCOM::getDef('email_password_reminder_subject'), STORE_NAME), $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); $OSCOM_MessageStack->add('LogIn', OSCOM::getDef('success_password_forgotten_sent'), 'success'); } osc_redirect(OSCOM::getLink(null, null, 'LogIn', 'SSL')); } else { $OSCOM_MessageStack->add('PasswordForgotten', OSCOM::getDef('error_password_forgotten_no_email_address_found')); } }
function execute() { global $osC_Session, $osC_ShoppingCart, $osC_Product, $osC_Language, $messageStack, $toC_Customization_Fields; if (!isset($osC_Product)) { $id = false; foreach ($_GET as $key => $value) { if ((ereg('^[0-9]+(_?([0-9]+:?[0-9]+)+(;?([0-9]+:?[0-9]+)+)*)*$', $key) || ereg('^[a-zA-Z0-9 -_]*$', $key)) && $key != $osC_Session->getName()) { $id = $key; } break; } if (strpos($id, '_') !== false) { $id = str_replace('_', '#', $id); } if ($id !== false && osC_Product::checkEntry($id)) { $osC_Product = new osC_Product($id); } } if (isset($osC_Product)) { //customization fields check if ($osC_Product->hasRequiredCustomizationFields()) { if (!$toC_Customization_Fields->exists($osC_Product->getID())) { $osC_Language->load('products'); $messageStack->add_session('products', $osC_Language->get('error_customization_fields_missing'), 'error'); osc_redirect(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getID())); } } $variants = null; if (isset($_POST['variants']) && is_array($_POST['variants'])) { $variants = $_POST['variants']; } else { if (isset($_GET['variants']) && !empty($_GET['variants'])) { $variants = osc_parse_variants_string($_GET['variants']); } } $gift_certificate_data = null; if ($osC_Product->isGiftCertificate() && isset($_POST['senders_name']) && isset($_POST['recipients_name']) && isset($_POST['message'])) { if ($osC_Product->isEmailGiftCertificate()) { $gift_certificate_data = array('senders_name' => $_POST['senders_name'], 'senders_email' => $_POST['senders_email'], 'recipients_name' => $_POST['recipients_name'], 'recipients_email' => $_POST['recipients_email'], 'message' => $_POST['message']); } else { $gift_certificate_data = array('senders_name' => $_POST['senders_name'], 'recipients_name' => $_POST['recipients_name'], 'message' => $_POST['message']); } if ($osC_Product->isOpenAmountGiftCertificate()) { $gift_certificate_data['price'] = $_POST['gift_certificate_amount']; } $gift_certificate_data['type'] = $osC_Product->getGiftCertificateType(); } $quantity = null; if (isset($_POST['quantity']) && is_numeric($_POST['quantity'])) { $quantity = $_POST['quantity']; } if ($osC_Product->isGiftCertificate() && $gift_certificate_data == null) { osc_redirect(osc_href_link(FILENAME_PRODUCTS, $osC_Product->getID())); return false; } else { $osC_ShoppingCart->add($osC_Product->getID(), $variants, $quantity, $gift_certificate_data); } } osc_redirect(osc_href_link(FILENAME_CHECKOUT)); }
public static function execute(ApplicationAbstract $application) { $OSCOM_Customer = Registry::get('Customer'); $OSCOM_NavigationHistory = Registry::get('NavigationHistory'); $OSCOM_Language = Registry::get('Language'); $OSCOM_Service = Registry::get('Service'); $OSCOM_Breadcrumb = Registry::get('Breadcrumb'); if ($OSCOM_Customer->isLoggedOn() === false) { $OSCOM_NavigationHistory->setSnapshot(); osc_redirect(OSCOM::getLink(null, null, 'LogIn', 'SSL')); } $application->setPageTitle(OSCOM::getDef('orders_heading')); $application->setPageContent('orders.php'); $OSCOM_Language->load('order'); if ($OSCOM_Service->isStarted('Breadcrumb')) { $OSCOM_Breadcrumb->add(OSCOM::getDef('breadcrumb_my_orders'), OSCOM::getLink(null, null, 'Orders', 'SSL')); if (is_numeric($_GET['Orders'])) { $OSCOM_Breadcrumb->add(sprintf(OSCOM::getDef('breadcrumb_order_information'), $_GET['Orders']), OSCOM::getLink(null, null, 'Orders=' . $_GET['Orders'], 'SSL')); } } if (is_numeric($_GET['Orders'])) { if (Order::getCustomerID($_GET['Orders']) !== $OSCOM_Customer->getID()) { osc_redirect(OSCOM::getLink(null, null, null, 'SSL')); } $application->setPageTitle(sprintf(OSCOM::getDef('order_information_heading'), $_GET['Orders'])); $application->setPageContent('orders_info.php'); } }
function osC_Checkout_Payment() { global $osC_Database, $osC_Session, $osC_ShoppingCart, $osC_Customer, $osC_Services, $osC_Language, $osC_NavigationHistory, $osC_Breadcrumb, $osC_Payment; if ($osC_Customer->isLoggedOn() === false) { $osC_NavigationHistory->setSnapshot(); osc_redirect(osc_href_link(FILENAME_ACCOUNT, 'login', 'SSL')); } if ($osC_ShoppingCart->hasContents() === false) { osc_redirect(osc_href_link(FILENAME_CHECKOUT, null, 'SSL')); } // if no shipping method has been selected, redirect the customer to the shipping method selection page if ($osC_ShoppingCart->hasShippingMethod() === false) { osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'shipping', 'SSL')); } // Stock Check if (STOCK_CHECK == '1' && STOCK_ALLOW_CHECKOUT == '-1') { foreach ($osC_ShoppingCart->getProducts() as $products) { if ($osC_ShoppingCart->isInStock($products['item_id']) === false) { osc_redirect(osc_href_link(FILENAME_CHECKOUT, 'SSL')); break; } } } $this->_page_title = $osC_Language->get('payment_method_heading'); if ($osC_Services->isStarted('breadcrumb')) { $osC_Breadcrumb->add($osC_Language->get('breadcrumb_checkout_payment'), osc_href_link(FILENAME_CHECKOUT, $this->_module, 'SSL')); } // redirect to the billing address page when no default address exists if ($osC_Customer->hasDefaultAddress() === false) { $this->_page_title = $osC_Language->get('payment_address_heading'); $this->_page_contents = 'checkout_payment_address.php'; $this->addJavascriptFilename('templates/' . $this->getCode() . '/javascript/checkout_payment_address.js'); $this->addJavascriptPhpFilename('includes/form_check.js.php'); } else { $this->addJavascriptFilename('templates/' . $this->getCode() . '/javascript/checkout_payment.js'); // if no billing destination address was selected, use the customers own address as default if ($osC_ShoppingCart->hasBillingAddress() == false) { $osC_ShoppingCart->setBillingAddress($osC_Customer->getDefaultAddressID()); } else { // verify the selected billing address $Qcheck = $osC_Database->query('select address_book_id from :table_address_book where address_book_id = :address_book_id and customers_id = :customers_id limit 1'); $Qcheck->bindTable(':table_address_book', TABLE_ADDRESS_BOOK); $Qcheck->bindInt(':address_book_id', $osC_ShoppingCart->getBillingAddress('id')); $Qcheck->bindInt(':customers_id', $osC_Customer->getID()); $Qcheck->execute(); if ($Qcheck->numberOfRows() !== 1) { $osC_ShoppingCart->setBillingAddress($osC_Customer->getDefaultAddressID()); $osC_ShoppingCart->resetBillingMethod(); } } // load all enabled payment modules include 'includes/classes/payment.php'; $osC_Payment = new osC_Payment(); $this->addJavascriptBlock($osC_Payment->getJavascriptBlocks()); } if (isset($_GET['payment_error']) && is_object(${$_GET['payment_error']}) && ($error = ${$_GET['payment_error']}->get_error())) { $osC_MessageStack->add('checkout_payment', $error['error'], 'error'); } }
public static function execute(ApplicationAbstract $application) { $OSCOM_Customer = Registry::get('Customer'); $OSCOM_NavigationHistory = Registry::get('NavigationHistory'); $OSCOM_MessageStack = Registry::get('MessageStack'); $OSCOM_Service = Registry::get('Service'); $OSCOM_Breadcrumb = Registry::get('Breadcrumb'); if (ALLOW_GUEST_TO_TELL_A_FRIEND == '-1' && $OSCOM_Customer->isLoggedOn() === false) { $OSCOM_NavigationHistory->setSnapshot(); osc_redirect(OSCOM::getLink(null, 'Account', 'LogIn', 'SSL')); } $requested_product = null; $product_check = false; if (count($_GET) > 3) { $requested_product = basename(key(array_slice($_GET, 3, 1, true))); if ($requested_product == 'Write') { unset($requested_product); if (count($_GET) > 4) { $requested_product = basename(key(array_slice($_GET, 4, 1, true))); } } } if (isset($requested_product)) { if (Product::checkEntry($requested_product)) { $product_check = true; } } if ($product_check === false) { $application->setPageContent('not_found.php'); return false; } Registry::set('Product', new Product($requested_product)); $OSCOM_Product = Registry::get('Product'); if (empty($_POST['from_name'])) { $OSCOM_MessageStack->add('TellAFriend', OSCOM::getDef('error_tell_a_friend_customers_name_empty')); } if (!osc_validate_email_address($_POST['from_email_address'])) { $OSCOM_MessageStack->add('TellAFriend', OSCOM::getDef('error_tell_a_friend_invalid_customers_email_address')); } if (empty($_POST['to_name'])) { $OSCOM_MessageStack->add('TellAFriend', OSCOM::getDef('error_tell_a_friend_friends_name_empty')); } if (!osc_validate_email_address($_POST['to_email_address'])) { $OSCOM_MessageStack->add('TellAFriend', OSCOM::getDef('error_tell_a_friend_invalid_friends_email_address')); } if ($OSCOM_MessageStack->size('TellAFriend') < 1) { $email_subject = sprintf(OSCOM::getDef('email_tell_a_friend_subject'), osc_sanitize_string($_POST['from_name']), STORE_NAME); $email_body = sprintf(OSCOM::getDef('email_tell_a_friend_intro'), osc_sanitize_string($_POST['to_name']), osc_sanitize_string($_POST['from_name']), $OSCOM_Product->getTitle(), STORE_NAME) . "\n\n"; if (!empty($_POST['message'])) { $email_body .= osc_sanitize_string($_POST['message']) . "\n\n"; } $email_body .= sprintf(OSCOM::getDef('email_tell_a_friend_link'), OSCOM::getLink(null, null, $OSCOM_Product->getKeyword(), 'NONSSL', false)) . "\n\n" . sprintf(OSCOM::getDef('email_tell_a_friend_signature'), STORE_NAME . "\n" . HTTP_SERVER . DIR_WS_CATALOG . "\n"); osc_email(osc_sanitize_string($_POST['to_name']), osc_sanitize_string($_POST['to_email_address']), $email_subject, $email_body, osc_sanitize_string($_POST['from_name']), osc_sanitize_string($_POST['from_email_address'])); $OSCOM_MessageStack->add('header', sprintf(OSCOM::getDef('success_tell_a_friend_email_sent'), $OSCOM_Product->getTitle(), osc_output_string_protected($_POST['to_name'])), 'success'); osc_redirect(OSCOM::getLink(null, null, $OSCOM_Product->getKeyword())); } $application->setPageTitle($OSCOM_Product->getTitle()); $application->setPageContent('tell_a_friend.php'); }
function osC_Checkout_Checkout() { global $osC_ShoppingCart; if ($osC_ShoppingCart->hasContents() === false) { osc_redirect(osc_href_link(FILENAME_CHECKOUT, null, 'SSL')); } $this->addJavascriptFilename('includes/javascript/checkout.js'); }
public static function execute(ApplicationAbstract $application) { $OSCOM_ShoppingCart = Registry::get('ShoppingCart'); if (is_numeric($_GET['Delete'])) { $OSCOM_ShoppingCart->remove($_GET['Delete']); } osc_redirect(OSCOM::getLink(null, 'Cart')); }
public static function execute(ApplicationAbstract $application) { $OSCOM_MessageStack = Registry::get('MessageStack'); if (AddressBook::deleteEntry($_GET['Delete'])) { $OSCOM_MessageStack->add('AddressBook', OSCOM::getDef('success_address_book_entry_deleted'), 'success'); } osc_redirect(OSCOM::getLink(null, null, 'AddressBook', 'SSL')); }
function execute() { global $osC_Session, $osC_ShoppingCart; if (is_numeric($_GET['item'])) { $osC_ShoppingCart->remove($_GET['item']); } osc_redirect(osc_href_link(FILENAME_CHECKOUT)); }
public static function onFail(Product $OSCOM_Product) { $OSCOM_NavigationHistory = Registry::get('NavigationHistory'); if (!isset($_GET['Shipping'])) { $OSCOM_NavigationHistory->setSnapshot(); osc_redirect(OSCOM::getLink(null, 'Checkout', 'Shipping', 'SSL')); } }
public static function execute(ApplicationAbstract $application) { $OSCOM_MessageStack = Registry::get('MessageStack'); $OSCOM_Customer = Registry::get('Customer'); $data = array(); if (ACCOUNT_GENDER >= 0) { if (isset($_POST['gender']) && ($_POST['gender'] == 'm' || $_POST['gender'] == 'f')) { $data['gender'] = $_POST['gender']; } else { $OSCOM_MessageStack->add('Edit', OSCOM::getDef('field_customer_gender_error')); } } if (isset($_POST['firstname']) && strlen(trim($_POST['firstname'])) >= ACCOUNT_FIRST_NAME) { $data['firstname'] = $_POST['firstname']; } else { $OSCOM_MessageStack->add('Edit', sprintf(OSCOM::getDef('field_customer_first_name_error'), ACCOUNT_FIRST_NAME)); } if (isset($_POST['lastname']) && strlen(trim($_POST['lastname'])) >= ACCOUNT_LAST_NAME) { $data['lastname'] = $_POST['lastname']; } else { $OSCOM_MessageStack->add('Edit', sprintf(OSCOM::getDef('field_customer_last_name_error'), ACCOUNT_LAST_NAME)); } if (ACCOUNT_DATE_OF_BIRTH == '1') { if (isset($_POST['dob_days']) && isset($_POST['dob_months']) && isset($_POST['dob_years']) && checkdate($_POST['dob_months'], $_POST['dob_days'], $_POST['dob_years'])) { $data['dob'] = mktime(0, 0, 0, $_POST['dob_months'], $_POST['dob_days'], $_POST['dob_years']); } else { $OSCOM_MessageStack->add('Edit', OSCOM::getDef('field_customer_date_of_birth_error')); } } if (isset($_POST['email_address']) && strlen(trim($_POST['email_address'])) >= ACCOUNT_EMAIL_ADDRESS) { if (osc_validate_email_address($_POST['email_address'])) { if (Account::checkDuplicateEntry($_POST['email_address']) === false) { $data['email_address'] = $_POST['email_address']; } else { $OSCOM_MessageStack->add('Edit', OSCOM::getDef('field_customer_email_address_exists_error')); } } else { $OSCOM_MessageStack->add('Edit', OSCOM::getDef('field_customer_email_address_check_error')); } } else { $OSCOM_MessageStack->add('Edit', sprintf(OSCOM::getDef('field_customer_email_address_error'), ACCOUNT_EMAIL_ADDRESS)); } if ($OSCOM_MessageStack->size('Edit') === 0) { if (Account::saveEntry($data)) { // reset the session variables if (ACCOUNT_GENDER > -1) { $OSCOM_Customer->setGender($data['gender']); } $OSCOM_Customer->setFirstName(trim($data['firstname'])); $OSCOM_Customer->setLastName(trim($data['lastname'])); $OSCOM_Customer->setEmailAddress($data['email_address']); $OSCOM_MessageStack->add('Account', OSCOM::getDef('success_account_updated'), 'success'); } osc_redirect(OSCOM::getLink(null, null, null, 'SSL')); } }