/**
  * Sets the global session variable
  * @static authorise
  * @access public
  * @version 1
  * @author Sam West aka Nimmit
  * @contact osc@kangaroopartners.com
  * @param $sessionVar string session variable name
  * @return void
  */
 function authorise($sessionVar)
 {
     if (!olc_session_is_registered($sessionVar)) {
         olc_session_register($sessionVar);
     }
     $_SESSION[$sessionVar] = stopdirectaccess::makeSessionId();
 }
 function check_order_status($start = false)
 {
     global $PayPal_osC, $customers_id;
     include_once PAYPAL_IPN_DIR . 'database_tables.inc.php';
     if (olc_session_is_registered('PayPal_osC')) {
         if ($start === true && PHP_VERSION < 4) {
             $PayPal_osC_backup = $PayPal_osC;
             $PayPal_osC = new PayPal_osC();
             $PayPal_osC->unserialize($PayPal_osC_backup);
         }
         $orders_session_query = olc_db_query("select payment_id from " . TABLE_ORDERS . " where orders_id = " . (int) $PayPal_osC->orders_id);
         $orders_session_check = olc_db_fetch_array($orders_session_query);
         if ($orders_session_check['payment_id'] > 0) {
             PayPal_osC::reset_checkout_cart_session();
             return true;
         }
         return false;
     }
     return false;
 }
			'options_values_price' => $attributes_values['options_values_price'],
			'price_prefix' => $attributes_values['price_prefix']);
			olc_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);
		}
	}
}
if(is_callable(array($order_total_modules, 'apply_credit')))
$order_total_modules->apply_credit();
*/
// store the session info for notification update - gsb
$sql_data_array = array('sendto' => $sendto, 'billto' => $billto, 'firstname' => $order->billing['firstname'], 'lastname' => $order->billing['lastname'], 'payment' => $payment, 'payment_title' => $this->codeTitle, 'payment_amount' => $this->grossPaymentAmount($this->currency()), 'payment_currency' => $this->currency(), 'payment_currency_val' => $currencies->get_value($this->currency()), 'language' => SESSION_LANGUAGE, 'language_id' => SESSION_LANGUAGE_ID, 'currency' => $currency, 'currency_value' => $currencies->get_value($currency), 'content_type' => $order->content_type, 'txn_signature' => $this->setTransactionID());
if (SHOW_AFFILIATE) {
    // inclusion for affiliate program
    global $affiliate_ref, $affiliate_clickthroughs_id, $affiliate_clientdate, $affiliate_clientbrowser, $affiliate_clientip;
    if (olc_not_null($affiliate_ref)) {
        if (olc_session_is_registered('affiliate_ref')) {
            $sql_data_array['affiliate_id'] = $affiliate_ref;
            $sql_data_array['affiliate_clickthroughs_id'] = $affiliate_clickthroughs_id;
            $sql_data_array['affiliate_date'] = $affiliate_clientdate;
            $sql_data_array['affiliate_browser'] = $affiliate_clientbrowser;
            $sql_data_array['affiliate_ipaddress'] = $affiliate_clientip;
        }
    }
}
if ($session_exists) {
    olc_db_perform(TABLE_ORDERS_SESSION_INFO, $sql_data_array, 'update', $orders_id_param);
    $PayPal_osC->txn_signature = $this->digest;
} else {
    $sql_data_array['orders_id'] = $orders_id;
    olc_db_perform(TABLE_ORDERS_SESSION_INFO, $sql_data_array);
    $PayPal_osC = new PayPal_osC($orders_id, $this->digest);
Example #4
0
function tep_session_is_registered($x)
{
    return olc_session_is_registered($x);
}
require_once $attributemanager_classes_dir_attributemanager . 'atomic' . $class_php;
// security class
require_once $attributemanager_classes_dir . 'stopdirectaccess' . $class_php;
// check that the file is allowed to be accessed
stopdirectaccess::checkAuthorisation(AM_SESSION_VALID_INCLUDE);
// construct the attributemanager classess and/or session variable
if (!is_numeric($_GET['products_id']) || AM_ATOMIC_PRODUCT_UPDATES) {
    // first time visiting the page - delete the session var and start again
    if ('new_product' == $_GET['pageAction'] && !isset($_GET['amAction'])) {
        if (olc_session_is_registered(AM_SESSION_VAR_NAME)) {
            olc_session_unregister(AM_SESSION_VAR_NAME);
            unset(${AM_SESSION_VAR_NAME});
        }
    }
    // register the session if its not registered
    if (!olc_session_is_registered(AM_SESSION_VAR_NAME)) {
        // declare the var (not nessessary)
        ${AM_SESSION_VAR_NAME} = array();
        // start a new session
        olc_session_register(AM_SESSION_VAR_NAME);
    }
    //$attributemanager =& new attributemanagerAtomic(${AM_SESSION_VAR_NAME});
    $attributemanager = new attributemanagerAtomic(${AM_SESSION_VAR_NAME});
} else {
    //$attributemanager =& new attributemanagerInstant($_GET['products_id']);
    $attributemanager = new attributemanagerInstant($_GET['products_id']);
}
$option_id = $_GET['option_id'];
$option_name = $_GET['option_name'];
$option_value_name = $_GET['option_value_name'];
$option_value_id = $_GET['option_value_id'];
Copyright (c) 2004 OL-Commerce , 2006 Dipl.-Ing.(TH) Winfried Kaiser (w.kaiser@fortune.de, info@seifenparadies.de)
-----------------------------------------------------------------------------------------
based on:
(c) 2000-2001 The Exchange Project (earlier name of osCommerce)
(c) 2002-2003 osCommerce (account.php,v 1.59 2003/05/19); www.oscommerce.com
(c) 2003      nextcommerce (account.php,v 1.12 2003/08/17); www.nextcommerce.org
(c) 2004      XT - Commerce; www.xt-commerce.com

Released under the GNU General Public License
---------------------------------------------------------------------------------------*/
include 'includes/application_top.php';
// include needed functions
require_once DIR_FS_INC . 'olc_count_customer_orders.inc.php';
require_once DIR_FS_INC . 'olc_date_short.inc.php';
require_once DIR_FS_INC . 'olc_image_button.inc.php';
if (!olc_session_is_registered('customer_id')) {
    olc_redirect(olc_href_link(FILENAME_LOGIN));
}
$breadcrumb->add(NAVBAR_TITLE_ACCOUNT, olc_href_link(FILENAME_ACCOUNT));
require DIR_WS_INCLUDES . 'header.php';
if (is_object($messageStack)) {
    if ($messageStack->size('account') > 0) {
        $smarty->assign('error_message', $messageStack->output('account'));
    }
}
if ($_GET['products_history']) {
    require_once DIR_FS_INC . 'olc_get_product_path.inc.php';
    require_once DIR_FS_INC . 'olc_get_products_name.inc.php';
    require_once DIR_FS_INC . 'olc_get_products_price_specials.inc.php';
    $products_id_par = 'products_id=';
    $params = olc_get_all_get_params(array('action')) . 'action=buy_now&BUY' . $products_id_par;
function olc_collect_posts()
{
    global $coupon_no, $REMOTE_ADDR, $olPrice, $cc_id;
    if (!$REMOTE_ADDR) {
        $REMOTE_ADDR = $_SERVER['REMOTE_ADDR'];
    }
    if ($_POST['gv_redeem_code']) {
        $gv_query = olc_db_query("select coupon_id, coupon_amount, coupon_type, coupon_minimum_order,uses_per_coupon, uses_per_user, restrict_to_products,restrict_to_categories from " . TABLE_COUPONS . " where coupon_code='" . $_POST['gv_redeem_code'] . "' and coupon_active='Y'");
        $gv_result = olc_db_fetch_array($gv_query);
        if (olc_db_num_rows($gv_query) != 0) {
            $redeem_query = olc_db_query("select * from " . TABLE_COUPON_REDEEM_TRACK . " where coupon_id = '" . $gv_result['coupon_id'] . APOS);
            if (olc_db_num_rows($redeem_query) != 0 && $gv_result['coupon_type'] == 'G') {
                olc_redirect(olc_href_link(FILENAME_SHOPPING_CART, 'info_message=' . urlencode(ERROR_NO_INVALID_REDEEM_GV), SSL));
            }
        } else {
            olc_redirect(olc_href_link(FILENAME_SHOPPING_CART, 'info_message=' . urlencode(ERROR_NO_INVALID_REDEEM_GV), SSL));
        }
        // GIFT CODE G START
        if ($gv_result['coupon_type'] == 'G') {
            $gv_amount = $gv_result['coupon_amount'];
            // Things to set
            // ip address of claimant
            // customer id of claimant
            // date
            // redemption flag
            // now update customer account with gv_amount
            $gv_amount_query = olc_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $_SESSION['customer_id'] . APOS);
            $customer_gv = false;
            $total_gv_amount = $gv_amount;
            if ($gv_amount_result = olc_db_fetch_array($gv_amount_query)) {
                $total_gv_amount = $gv_amount_result['amount'] + $gv_amount;
                $customer_gv = true;
            }
            $gv_update = olc_db_query(SQL_UPDATE . TABLE_COUPONS . " set coupon_active = 'N' where coupon_id = '" . $gv_result['coupon_id'] . APOS);
            $gv_redeem = olc_db_query("insert into  " . TABLE_COUPON_REDEEM_TRACK . " (coupon_id, customer_id, redeem_date, redeem_ip) values ('" . $gv_result['coupon_id'] . "', '" . $_SESSION['customer_id'] . "', now(),'" . $REMOTE_ADDR . "')");
            if ($customer_gv) {
                // already has gv_amount so update
                $gv_update = olc_db_query(SQL_UPDATE . TABLE_COUPON_GV_CUSTOMER . " set amount = '" . $total_gv_amount . "' where customer_id = '" . $_SESSION['customer_id'] . APOS);
            } else {
                // no gv_amount so insert
                $gv_insert = olc_db_query(INSERT_INTO . TABLE_COUPON_GV_CUSTOMER . " (customer_id, amount) values ('" . $_SESSION['customer_id'] . "', '" . $total_gv_amount . "')");
            }
            olc_redirect(olc_href_link(FILENAME_SHOPPING_CART, 'info_message=' . urlencode(REDEEMED_AMOUNT . $olPrice->olcFormat($gv_amount, true, 0, true)), SSL));
        } else {
            if (olc_db_num_rows($gv_query) == 0) {
                olc_redirect(olc_href_link(FILENAME_SHOPPING_CART, 'info_message=' . urlencode(ERROR_NO_INVALID_REDEEM_COUPON), SSL));
            }
            $date_query = olc_db_query("select coupon_start_date from " . TABLE_COUPONS . " where coupon_start_date <= now() and coupon_code='" . $_POST['gv_redeem_code'] . APOS);
            if (olc_db_num_rows($date_query) == 0) {
                olc_redirect(olc_href_link(FILENAME_SHOPPING_CART, 'info_message=' . urlencode(ERROR_INVALID_STARTDATE_COUPON), SSL));
            }
            $date_query = olc_db_query("select coupon_expire_date from " . TABLE_COUPONS . " where coupon_expire_date >= now() and coupon_code='" . $_POST['gv_redeem_code'] . APOS);
            if (olc_db_num_rows($date_query) == 0) {
                olc_redirect(olc_href_link(FILENAME_SHOPPING_CART, 'info_message=' . urlencode(ERROR_INVALID_FINISDATE_COUPON), SSL));
            }
            $coupon_count = olc_db_query("select coupon_id from " . TABLE_COUPON_REDEEM_TRACK . " where coupon_id = '" . $gv_result['coupon_id'] . APOS);
            $coupon_count_customer = olc_db_query("select coupon_id from " . TABLE_COUPON_REDEEM_TRACK . " where coupon_id = '" . $gv_result['coupon_id'] . "' and customer_id = '" . $_SESSION['customer_id'] . APOS);
            if (olc_db_num_rows($coupon_count) >= $gv_result['uses_per_coupon'] && $gv_result['uses_per_coupon'] > 0) {
                olc_redirect(olc_href_link(FILENAME_SHOPPING_CART, 'info_message=' . urlencode(ERROR_INVALID_USES_COUPON . $gv_result['uses_per_coupon'] . TIMES), SSL));
            }
            if (olc_db_num_rows($coupon_count_customer) >= $gv_result['uses_per_user'] && $gv_result['uses_per_user'] > 0) {
                olc_redirect(olc_href_link(FILENAME_SHOPPING_CART, 'info_message=' . urlencode(ERROR_INVALID_USES_USER_COUPON . $gv_result['uses_per_user'] . TIMES), SSL));
            }
            if ($gv_result['coupon_type'] == 'S') {
                $coupon_amount = $order->info['shipping_cost'];
            } else {
                $coupon_amount = $gv_result['coupon_amount'] . BLANK;
            }
            if ($gv_result['coupon_type'] == 'P') {
                $coupon_amount = $gv_result['coupon_amount'] . '% ';
            }
            if ($gv_result['coupon_minimum_order'] > 0) {
                $coupon_amount .= 'on orders greater than ' . $gv_result['coupon_minimum_order'];
            }
            if (!olc_session_is_registered('cc_id')) {
                olc_session_register('cc_id');
            }
            //Fred - this was commented out before
            $_SESSION['cc_id'] = $gv_result['coupon_id'];
            //Fred ADDED, set the global and session variable
            olc_redirect(olc_href_link(FILENAME_SHOPPING_CART, 'info_message=' . urlencode(REDEEMED_COUPON), SSL));
        }
    }
    if ($_POST['submit_redeem_x'] && $gv_result['coupon_type'] == 'G') {
        olc_redirect(olc_href_link(FILENAME_SHOPPING_CART, 'info_message=' . urlencode(ERROR_NO_REDEEM_CODE), SSL));
    }
}