/** * 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 olc_get_customer_status_value($customer_id) { if (isset($_SESSION['customer_id'])) { $customer_status_query = olc_db_query("select c.customers_status, c.member_flag, cs.customers_status_id, cs.customers_status_name, cs.customers_status_public, cs.customers_status_show_price, cs.customers_status_show_price_tax, cs.customers_status_image, cs.customers_status_discount, cs.customers_status_ot_discount_flag, cs.customers_status_ot_discount, cs.customers_status_graduated_prices, cs.customers_status_cod_permission, cs.customers_status_cc_permission, cs.customers_status_bt_permission FROM " . TABLE_CUSTOMERS . " as c left join " . TABLE_CUSTOMERS_STATUS . " as cs on customers_status = customers_status_id where c.customers_id='" . $_SESSION['customer_id'] . "' and cs.language_id = '" . SESSION_LANGUAGE_ID . APOS); } else { $customer_status_query = olc_db_query("select cs.customers_status_id, cs.customers_status_name, cs.customers_status_public, cs.customers_status_show_price, cs.customers_status_show_price_tax, cs.customers_status_image, cs.customers_status_discount, cs.customers_status_ot_discount_flag, cs.customers_status_ot_discount, cs.customers_status_graduated_prices FROM " . TABLE_CUSTOMERS_STATUS . " as cs where cs.customers_status_id='" . DEFAULT_CUSTOMERS_STATUS_ID_GUEST . "' and cs.language_id = '" . SESSION_LANGUAGE_ID . APOS); $customer_status_value['customers_status'] = DEFAULT_CUSTOMERS_STATUS_ID_GUEST; } $customer_status_value = olc_db_fetch_array($customer_status_query); olc_session_register('customer_status_value'); return $customer_status_value; }
} } } 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); olc_session_register('PayPal_osC'); } //require(PAYPAL_IPN_DIR.'catalog/checkout_splash.inc.php');
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']; $price = $_GET['price']; $prefix = $_GET['prefix']; // process the page actions switch ($_GET['amAction']) {
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)); } }