Esempio n. 1
0
 function payment($module = '')
 {
     global $payment, $language, $PHP_SELF, $store_id, $cart;
     if (defined('MODULE_PAYMENT_INSTALLED') && smn_not_null(MODULE_PAYMENT_INSTALLED)) {
         $this->modules = explode(';', MODULE_PAYMENT_INSTALLED);
         $include_modules = array();
         $prepare_module_string = str_replace('.php', '', MODULE_PAYMENT_INSTALLED);
         $initial_module_string = str_replace(";", "' or page_name= '", $prepare_module_string);
         $text_contents_conditions = " and page_name= '" . $initial_module_string . "'";
         $content_query = smn_db_query("select text_key, text_content from " . TABLE_WEB_SITE_CONTENT . " where store_id = '" . $store_id . "' " . $text_contents_conditions);
         while ($text_contents = smn_db_fetch_array($content_query)) {
             define($text_contents['text_key'], $text_contents['text_content']);
         }
         if (smn_not_null($module) && in_array($module . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1), $this->modules)) {
             $this->selected_module = $module;
             $include_modules[] = array('class' => $module, 'file' => $module . '.php');
             $text_contents_conditions = " and page_name= '" . $module . "'";
         } else {
             reset($this->modules);
             if (smn_get_configuration_key_value('MODULE_PAYMENT_FREECHARGER_STATUS') and ($cart->show_total() == 0 and $cart->show_weight == 0)) {
                 $this->selected_module = $module;
                 $include_modules[] = array('class' => 'freecharger', 'file' => 'freecharger.php');
             } else {
                 // All Other Payment Modules
                 while (list(, $value) = each($this->modules)) {
                     $class = substr($value, 0, strrpos($value, '.'));
                     // Don't show Free Payment Module
                     if ($class != 'freecharger') {
                         $include_modules[] = array('class' => $class, 'file' => $value);
                     }
                 }
             }
         }
         for ($i = 0, $n = sizeof($include_modules); $i < $n; $i++) {
             include DIR_WS_MODULES . 'payment/' . $include_modules[$i]['file'];
             $GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class']();
         }
         // if there is only one payment method, select it as default because in
         // checkout_confirmation.php the $payment variable is being assigned the
         // $_POST['payment'] value which will be empty (no radio button selection possible)
         if (smn_count_payment_modules() == 1 && (!isset($GLOBALS[$payment]) || isset($GLOBALS[$payment]) && !is_object($GLOBALS[$payment]))) {
             $payment = $include_modules[0]['class'];
         }
         if (smn_not_null($module) && in_array($module, $this->modules) && isset($GLOBALS[$module]->form_action_url)) {
             $this->form_action_url = $GLOBALS[$module]->form_action_url;
         }
     }
 }
Esempio n. 2
0
 function shipping($module = '')
 {
     global $language, $PHP_SELF, $store_id, $cart;
     if (defined('MODULE_SHIPPING_INSTALLED') && smn_not_null(MODULE_SHIPPING_INSTALLED)) {
         $this->modules = explode(';', MODULE_SHIPPING_INSTALLED);
         $prepare_module_string = str_replace('.php', '', MODULE_SHIPPING_INSTALLED);
         $initial_module_string = str_replace(";", "' or page_name= '", $prepare_module_string);
         $text_contents_conditions = " and page_name= '" . $initial_module_string . "'";
         $content_query = smn_db_query("select text_key, text_content from " . TABLE_WEB_SITE_CONTENT . " where store_id = '" . $store_id . "' " . $text_contents_conditions);
         while ($text_contents = smn_db_fetch_array($content_query)) {
             define($text_contents['text_key'], $text_contents['text_content']);
         }
         $include_modules = array();
         if (smn_not_null($module) && in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1), $this->modules)) {
             $include_modules[] = array('class' => substr($module['id'], 0, strpos($module['id'], '_')), 'file' => substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1));
             $text_contents_conditions = " and page_name= '" . $module . "'";
         } else {
             reset($this->modules);
             if (smn_get_configuration_key_value('MODULE_SHIPPING_FREESHIPPER_STATUS') and $cart->show_weight() == 0) {
                 $include_modules[] = array('class' => 'freeshipper', 'file' => 'freeshipper.php');
             } else {
                 // All Other Shipping Modules
                 while (list(, $value) = each($this->modules)) {
                     $class = substr($value, 0, strrpos($value, '.'));
                     // Don't show Free Shipping Module
                     if ($class != 'freeshipper') {
                         $include_modules[] = array('class' => $class, 'file' => $value);
                     }
                 }
             }
         }
         for ($i = 0, $n = sizeof($include_modules); $i < $n; $i++) {
             include DIR_WS_MODULES . 'shipping/' . $include_modules[$i]['file'];
             $GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class']();
         }
     }
 }
Esempio n. 3
0
    $orders_status_array[$orders_status['orders_status_id']] = $orders_status['orders_status_name'];
}
$action = isset($_GET['action']) ? $_GET['action'] : '';
if (smn_not_null($action)) {
    switch ($action) {
        case 'update_order':
            $oID = smn_db_prepare_input($_GET['oID']);
            $status = smn_db_prepare_input($_POST['status']);
            $comments = smn_db_prepare_input($_POST['comments']);
            $order_updated = false;
            $check_status_query = smn_db_query("select * from " . TABLE_ORDERS . " where store_id = '" . $store_id . "' and orders_id = '" . (int) $oID . "'");
            $check_status = smn_db_fetch_array($check_status_query);
            if ($check_status['orders_status'] != $status || smn_not_null($comments) || $status == DOWNLOADS_ORDERS_STATUS_UPDATED_VALUE) {
                smn_db_query("update " . TABLE_ORDERS . " set orders_status = '" . smn_db_input($status) . "', last_modified = now() where orders_id = '" . (int) $oID . "'");
                if ($check_status['orders_status'] == DOWNLOADS_ORDERS_STATUS_UPDATED_VALUE) {
                    smn_db_query("update " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " set download_maxdays = '" . smn_get_configuration_key_value('DOWNLOAD_MAX_DAYS') . "', download_count = '" . smn_get_configuration_key_value('DOWNLOAD_MAX_COUNT') . "' where store_id = '" . $store_id . "' and orders_id = '" . (int) $oID . "' ");
                }
                $customer_notified = '0';
                if (isset($_POST['notify']) && $_POST['notify'] == 'on') {
                    $notify_comments = '';
                    if (isset($_POST['notify_comments']) && $_POST['notify_comments'] == 'on') {
                        $notify_comments = sprintf(EMAIL_TEXT_COMMENTS_UPDATE, $comments) . "\n\n";
                    }
                    $email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . smn_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'NONSSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . smn_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);
                    smn_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
                    $customer_notified = '1';
                }
                smn_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . (int) $oID . "', '" . smn_db_input($status) . "', now(), '" . smn_db_input($customer_notified) . "', '" . smn_db_input($comments) . "')");
                $order_updated = true;
            }
            if ($order_updated == true) {
  SystemsManager Technologies
  oscMall System Version 4
  http://www.systemsmanager.net
  
  Portions Copyright (c) 2002 osCommerce
  
  This source file is subject to version 2.0 of the GPL license,   
  that is bundled with this package in the file LICENSE. If you
  did not receive a copy of the oscMall System license and are unable 
  to obtain it through the world-wide-web, please send a note to    
  license@systemsmanager.net so we can mail you a copy immediately.
*/
global $page_name;
require 'includes/classes/http_client.php';
if (smn_get_configuration_key_value('MODULE_SHIPPING_FREESHIPPER_STATUS') and $cart->show_weight() != 0) {
    smn_session_unregister('shipping');
    /*Unregister the shipping_store session,by Cimi*/
    smn_session_unregister('shipping_store');
}
// if the customer is not logged on, redirect them to the login page
if (!smn_session_is_registered('customer_id')) {
    $navigation->set_snapshot();
    smn_redirect(smn_href_link(FILENAME_LOGIN, '', 'NONSSL'));
}
// if there is nothing in the customers cart, redirect them to the shopping cart page
if ($cart->count_contents() < 1) {
    smn_redirect(smn_href_link(FILENAME_SHOPPING_CART));
}
// if no shipping destination address was selected, use the customers own address as default
if (!smn_session_is_registered('sendto')) {