Exemplo n.º 1
0
 function update(&$class, $eventID, $paramsArray)
 {
     if (FEC_EASY_SIGNUP_STATUS == 'true') {
         // redirect to ESL
         zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
     }
 }
 function update(&$class, $eventID, $paramsArray)
 {
     global $messageStack;
     if (FEC_ONE_PAGE != 'true') {
         zen_redirect(zen_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL'));
     }
 }
 public function pre_confirmation_check()
 {
     global $messageStack;
     include DIR_WS_CLASSES . 'cc_validation.php';
     $cc_validation = new cc_validation();
     $result = $cc_validation->validate($_POST['checkoutapipayment_cc_number'], $_POST['checkoutapipayment_cc_expires_month'], $_POST['checkoutapipayment_cc_expires_year']);
     $error = '';
     switch ($result) {
         case -1:
             $error = sprintf(TEXT_CCVAL_ERROR_UNKNOWN_CARD, substr($cc_validation->cc_number, 0, 4));
             break;
         case -2:
         case -3:
         case -4:
             $error = TEXT_CCVAL_ERROR_INVALID_DATE;
             break;
         case false:
             $error = TEXT_CCVAL_ERROR_INVALID_NUMBER;
             break;
     }
     if ($result == false || $result < 1) {
         $messageStack->add_session('checkout_payment', $error . '<!-- [' . $this->code . '] -->', 'error');
         zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL', true, false));
     }
     $this->cc_card_type = $cc_validation->cc_type;
     $this->cc_card_number = $cc_validation->cc_number;
     $this->cc_expiry_month = $cc_validation->cc_expiry_month;
     $this->cc_expiry_year = $cc_validation->cc_expiry_year;
 }
Exemplo n.º 4
0
 function update(&$class, $eventID, $paramsArray)
 {
     global $messageStack;
     if (isset($_SESSION['COWOA']) && $_SESSION['COWOA'] == true) {
         $messageStack->add_session('header', 'Only registered customers can access account features.  You are currently using our guest checkout option.  Please logout and sign-in with your registered account to access all account features.', 'caution');
         zen_redirect(zen_back_link(true));
     } elseif (!isset($_SESSION['customer_id'])) {
         $_SESSION['redirect_url'] = zen_href_link($_GET['main_page'], zen_get_all_get_params(array('main_page')), 'SSL');
     }
 }
/**
 * Uninstall configuration into database
 * @param none
 */
function reloaded_related_remove()
{
    global $db, $reloadedStack;
    //Auto install check
    $reloadedRelatedCheck = $db->Execute("SHOW COLUMNS FROM " . TABLE_PRODUCTS . " LIKE 'products_family'");
    if ($reloadedRelatedCheck->RecordCount() > 0) {
        $db->Execute("ALTER TABLE " . TABLE_PRODUCTS . " DROP products_family");
    }
    //Get configuration keys for mod
    $keys = reloaded_related_keys();
    $db->Execute("DELETE FROM " . TABLE_CONFIGURATION . " WHERE configuration_key IN ('" . implode("', '", $keys) . "')");
    unset($keys);
    $reloadedStack->add_session('Related Products successfully removed', 'success');
    zen_redirect(zen_href_link('index.php'));
}
Exemplo n.º 6
0
 /**
  *
  */
 public function before_process()
 {
     global $messageStack;
     $sagepay_return_data = SagepayUtil::decodeAndDecrypt($_GET['crypt'], MODULE_PAYMENT_SAGEPAY_ZC_FORM_PASSWORD);
     $this->errorLog(array(array('title' => 'Response Data', 'content' => $sagepay_return_data)));
     $this->sagepayResponse = SagepayUtil::getResponseTokens($sagepay_return_data);
     $status = $this->sagepayResponse['Status'];
     if (in_array($status, array('OK', 'REGISTERED', 'AUTHENTICATED'))) {
         return;
     }
     $error_message = $this->getResponseErrorMessage($this->sagepayResponse['Status']);
     $payment_error_return = 'ERROR ' . sprintf($error_message, $this->sagepayResponse['StatusDetail']);
     $this->errorLog(array(array('title' => 'Response Values', 'content' => implode("\n", $this->sagepayResponse))));
     $messageStack->add_session('checkout_payment', $payment_error_return, 'error');
     zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL', true, false));
 }
Exemplo n.º 7
0
 function update(&$class, $eventID, $paramsArray)
 {
     // check if free/virtual products checkout enabled
     if (FEC_FREE_VIRTUAL_CHECKOUT == 'true') {
         // check if products are virtual
         if ($_SESSION['cart']->get_content_type() == 'virtual') {
             $cart_quantity = $_SESSION['cart']->count_contents();
             // check if products are free
             if ($_SESSION['cart']->in_cart_check('product_is_free', '1') == $cart_quantity) {
                 // check if COWOA is enabled
                 if (FEC_NOACCOUNT_SWITCH == 'true') {
                     // redirect to COWOA
                     zen_redirect(zen_href_link(FILENAME_NO_ACCOUNT, 'type=free_virtual', 'SSL'));
                 }
             }
         }
     }
     if (FEC_NOACCOUNT_ONLY_SWITCH == 'true') {
         // redirect to ESL
         zen_redirect(zen_href_link(FILENAME_NO_ACCOUNT, '', 'SSL'));
     }
 }
Exemplo n.º 8
0
 function page()
 {
     global $zco_notifier;
     global $mt_pages_title;
     global $mt_pages_contents;
     if (isset($_GET['page']) && preg_match('/^([a-zA-Z0-9_-]*)$/', $_GET['page'])) {
         $page_file;
         if (is_readable(MODULE_MT_PAGES_DIR_PAGES . $_GET['page'] . '-' . $_SESSION['languages_code'] . '.php')) {
             $page_file = MODULE_MT_PAGES_DIR_PAGES . $_GET['page'] . '-' . $_SESSION['languages_code'] . '.php';
         } elseif (is_readable(MODULE_MT_PAGES_DIR_PAGES . $_GET['page'] . '.php')) {
             $page_file = MODULE_MT_PAGES_DIR_PAGES . $_GET['page'] . '.php';
         } else {
             zen_redirect(zen_href_link(FILENAME_PAGE_NOT_FOUND));
         }
         require_once $page_file;
         $mt_pages_title = htmlspecialchars_decode(mb_convert_encoding(MT_PAGES_TITLE, mb_internal_encoding(), MT_PAGES_MT_CHARSET));
         $mt_pages_contents = htmlspecialchars_decode(mb_convert_encoding(MT_PAGES_CONTENTS, mb_internal_encoding(), MT_PAGES_MT_CHARSET));
         $zco_notifier->notify('NOTIFY_MT_PAGES_BEFORE_RETURN_PAGE');
         $return = array('mt_pages_basename' => MT_PAGES_BASENAME, 'mt_pages_title' => $mt_pages_title, 'mt_pages_contents' => $mt_pages_contents);
         return $return;
     }
 }
Exemplo n.º 9
0
 function update(&$class, $eventID, $paramsArray)
 {
     global $messageStack;
     if (FEC_STATUS == 'true') {
         $error = false;
         if ($_GET['main_page'] == FILENAME_CHECKOUT_PAYMENT and sizeof($messageStack->messages) > 0) {
             $error = true;
             for ($i = 0, $n = sizeof($messageStack->messages); $i < $n; $i++) {
                 if ($messageStack->messages[$i]['class'] == 'checkout_payment') {
                     $checkout_payment_output[] = $messageStack->messages[$i];
                 }
                 if ($messageStack->messages[$i]['class'] == 'redemptions') {
                     $redemptions_output[] = $messageStack->messages[$i];
                 }
             }
             $messageStack->reset();
             if (sizeof($checkout_payment_output) > 0) {
                 for ($i = 0, $n = sizeof($checkout_payment_output); $i < $n; $i++) {
                     $messageStack->add_session('checkout_payment', strip_tags($checkout_payment_output[$i]['text']), 'error');
                 }
             }
             if (sizeof($redemptions_output) > 0) {
                 for ($i = 0, $n = sizeof($redemptions_output); $i < $n; $i++) {
                     $messageStack->add_session('redemptions', strip_tags($redemptions_output[$i]['text']), 'caution');
                 }
             }
         }
         if ($_GET['credit_class_error']) {
             $error = true;
             $messageStack->add_session('checkout_payment', htmlspecialchars(urldecode($_GET['credit_class_error'])), 'error');
         }
         if ($error) {
             zen_redirect(zen_href_link(FILENAME_CHECKOUT, "fecaction=null", 'SSL'));
         } else {
             zen_redirect(zen_href_link(FILENAME_CHECKOUT, '', 'SSL'));
         }
     }
 }
Exemplo n.º 10
0
 function pre_confirmation_check($order_total)
 {
     global $order;
     if ($this->enabled && $this->selection_test()) {
         // clean out negative values and strip common currency symbols
         $this->credit_account = preg_replace('/[^0-9.%]/', '', $this->credit_account);
         $this->credit_account = abs($this->credit_account);
         if ($this->credit_account > 0) {
             if (ereg('[^0-9/.]', trim($this->credit_account))) {
                 zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, 'credit_class_error_code=' . $this->code . '&credit_class_error=' . urlencode(TEXT_INVALID_REDEEM_AMOUNT), 'SSL', true, false));
             }
             if ($this->credit_account > $this->get_user_balance($_SESSION['customer_id'])) {
                 zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, 'credit_class_error_code=' . $this->code . '&credit_class_error=' . urlencode(TEXT_INVALID_REDEEM_AMOUNT), 'SSL', true, false));
             }
             //$this->deduction = $this->calculate_credit($order_total);
             if ($this->deduction >= $order->info['total'] && MODULE_ORDER_TOTAL_SC_ORDER_STATUS_ID != 0) {
                 $order->info['order_status'] = MODULE_ORDER_TOTAL_SC_ORDER_STATUS_ID;
             }
         }
         return $this->deduction;
     } else {
         return 0;
     }
 }
Exemplo n.º 11
0
            $cart->reset(true);
            zen_session_unregister('sendto');
            zen_session_unregister('billto');
            zen_session_unregister('shipping');
            zen_session_unregister('payment');
            zen_session_unregister('comments');
        }
        break;
    case "CANCEL":
        if ($isExchange) {
            echo "TRUE|CANCEL";
            deleteOrder($orderId);
            ob_flush();
        } else {
            deleteOrder($orderId);
            zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . urlencode($method) . '&error=Payment cancelled', 'NONSSL', true, false));
        }
        break;
}
function deleteOrder($orderId)
{
    global $db;
    $db->Execute('delete from ' . TABLE_ORDERS . ' where orders_id = "' . (int) $orderId . '"');
    $db->Execute('delete from ' . TABLE_ORDERS_TOTAL . ' where orders_id = "' . (int) $orderId . '"');
    $db->Execute('delete from ' . TABLE_ORDERS_STATUS_HISTORY . ' where orders_id = "' . (int) $orderId . '"');
    $db->Execute('delete from ' . TABLE_ORDERS_PRODUCTS . ' where orders_id = "' . (int) $orderId . '"');
    $db->Execute('delete from ' . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . ' where orders_id = "' . (int) $orderId . '"');
    $db->Execute('delete from ' . TABLE_ORDERS_PRODUCTS_DOWNLOAD . ' where orders_id = "' . (int) $orderId . '"');
}
function isAlreadyPAID($transactionId)
{
Exemplo n.º 12
0
<?php

// +----------------------------------------------------------------------+
// | bitcommerce Open Source E-commerce                                   |
// | Copyright (c) 2009 bitcommerce.org                                   |
// | http://www.bitcommerce.org/                                          |
// | This source file is subject to version 2.0 of the GPL license        |
// +----------------------------------------------------------------------+
//  $Id$
require 'includes/application_top.php';
require_once BITCOMMERCE_PKG_PATH . 'classes/CommerceOrder.php';
require BITCOMMERCE_PKG_PATH . 'classes/CommerceShipping.php';
$shipping = new CommerceShipping();
$order->calculate();
// get all available shipping quotes
if (!empty($_REQUEST['change_shipping']) && !empty($_REQUEST['shipping'])) {
    list($module, $method) = explode('_', $_REQUEST['shipping']);
    if (is_object(${$module})) {
        $quote = $shipping->quote($order->getWeight(), $method, $module);
        $order->changeShipping(current($quote), $_REQUEST);
        zen_redirect($_SERVER['HTTP_REFERER']);
    }
} else {
    $gBitSmarty->assign('quotes', $shipping->quote($order->getWeight()));
    print $gBitSmarty->fetch('bitpackage:bitcommerce/admin_shipping_change_ajax.tpl');
}
Exemplo n.º 13
0
                // endif $save_to_file
            }
            //end if $records for processing not 0
            zen_redirect(zen_href_link(FILENAME_ADMIN_ACTIVITY));
            break;
            // clean out the admin_activity_log
        // clean out the admin_activity_log
        case 'clean_admin_activity_log':
            if (isset($_POST['confirm']) && $_POST['confirm'] == 'yes') {
                $db->Execute("truncate table " . TABLE_ADMIN_ACTIVITY_LOG);
                $admname = '{' . preg_replace('/[^\\w]/', '*', zen_get_admin_name()) . '[' . (int) $_SESSION['admin_id'] . ']}';
                $sql_data_array = array('access_date' => 'now()', 'admin_id' => isset($_SESSION['admin_id']) ? (int) $_SESSION['admin_id'] : 0, 'page_accessed' => 'Log reset by ' . $admname . '.', 'page_parameters' => '', 'ip_address' => substr($_SERVER['REMOTE_ADDR'], 0, 45));
                zen_db_perform(TABLE_ADMIN_ACTIVITY_LOG, $sql_data_array);
                $messageStack->add_session(SUCCESS_CLEAN_ADMIN_ACTIVITY_LOG, 'success');
                unset($_SESSION['reset_admin_activity_log']);
                zen_redirect(zen_href_link(FILENAME_ADMIN_ACTIVITY));
            } else {
                $confirmation_needed = TRUE;
            }
            break;
    }
    //end switch / case
}
//endif $action
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php 
echo HTML_PARAMS;
?>
>
<head>
Exemplo n.º 14
0
            } else {
                $messageStack->add(ERROR_DOWNLOAD_LINK_NOT_ACCEPTABLE, 'error');
            }
            break;
        case 'deleteconfirm':
            if (strstr($_GET['file'], '..')) {
                zen_redirect(zen_href_link(FILENAME_BACKUP_MYSQL));
            }
            $zremove_error = zen_remove(DIR_FS_BACKUP . '/' . $_GET['file']);
            // backwards compatibility:
            if (isset($zen_remove_error) && $zen_remove_error == true) {
                $zremove_error = $zen_remove_error;
            }
            if (!$zremove_error) {
                $messageStack->add_session(SUCCESS_BACKUP_DELETED, 'success');
                zen_redirect(zen_href_link(FILENAME_BACKUP_MYSQL));
            }
            break;
    }
}
// check if the backup directory exists
$dir_ok = false;
if (is_dir(DIR_FS_BACKUP)) {
    if (is_writable(DIR_FS_BACKUP)) {
        $dir_ok = true;
    } else {
        $messageStack->add(ERROR_BACKUP_DIRECTORY_NOT_WRITEABLE, 'error');
    }
} else {
    $messageStack->add(ERROR_BACKUP_DIRECTORY_DOES_NOT_EXIST, 'error');
}
Exemplo n.º 15
0
                $_GET['action'] = '';
                $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
                zen_redirect(zen_href_link(FILENAME_GROUP_PRICING, 'page=' . $_GET['page']));
            }
            $delete_cust_confirmed = isset($_POST['delete_customers']) && $_POST['delete_customers'] == 'on' ? true : false;
            $group_id = zen_db_prepare_input($_GET['gID']);
            $customers_query = $db->Execute("select customers_id from " . TABLE_CUSTOMERS . " where customers_group_pricing = '" . (int) $group_id . "'");
            if ($customers_query->RecordCount() > 0 && $delete_cust_confirmed == true) {
                $db->Execute("delete from " . TABLE_GROUP_PRICING . " where group_id = '" . (int) $group_id . "'");
                $db->Execute("update " . TABLE_CUSTOMERS . " set customers_group_pricing=0 where customers_group_pricing = '" . (int) $group_id . "'");
            } elseif ($customers_query->RecordCount() > 0 && $delete_cust_confirmed == false) {
                $messageStack->add_session(ERROR_GROUP_PRICING_CUSTOMERS_EXIST, 'error');
            } elseif ($customers_query->RecordCount() == 0) {
                $db->Execute("delete from " . TABLE_GROUP_PRICING . " where group_id = '" . (int) $group_id . "'");
            }
            zen_redirect(zen_href_link(FILENAME_GROUP_PRICING, 'page=' . $_GET['page']));
            break;
    }
}
$query = $db->Execute("select count(*) as count from " . TABLE_GROUP_PRICING);
if ($query->fields['count'] > 0 && (!defined('MODULE_ORDER_TOTAL_GROUP_PRICING_STATUS') || MODULE_ORDER_TOTAL_GROUP_PRICING_STATUS != 'true')) {
    $messageStack->add(ERROR_MODULE_NOT_CONFIGURED, 'error');
}
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php 
echo HTML_PARAMS;
?>
>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php 
 function install()
 {
     global $db, $messageStack;
     if (defined('MODULE_PAYMENT_ALIPAYFOR_STATUS')) {
         $messageStack->add_session('FreeCharger module already installed.', 'error');
         zen_redirect(zen_href_link(FILENAME_MODULES, 'set=payment&module=alipay', 'NONSSL'));
         return 'failed';
     }
     $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Alipay Credit Card (forcard) Module', 'MODULE_PAYMENT_ALIPAYFOR_STATUS', 'True', 'Do you want to accept Alipay Credit Card (forcard) payment?', '6', '1', 'zen_cfg_select_option(array(\\'True\\', \\'False\\'), ', now());");
     $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_ALIPAYFOR_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
     $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_ALIPAYFOR_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())");
     $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_ALIPAYFOR_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())");
     $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Alipay Partner ID'  , 'MODULE_PAYMENT_ALIPAYFOR_PARTNER_ID', '', '16 digits Partner ID. for example: 2088101568338364', '6', '0', now())");
     $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Signature Type', 'MODULE_PAYMENT_ALIPAYFOR_SIGN_TYPE', 'MD5', 'default MD5', '6', '0', 'zen_cfg_select_option(array(\\'MD5\\', \\'RSA\\'), ', now())");
     $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Signature Key'  , 'MODULE_PAYMENT_ALIPAYFOR_PARTNER_SIGN', '', '', '6', '0', now())");
     $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Payment Methods', 'MODULE_PAYMENT_ALIPAYFOR_PAYMETHOD', 'boc', '', '6', '0', 'zen_cfg_select_option(array(\\'boc\\', \\'jvm-3d\\', \\'jvm-moto\\'), ', now())");
     $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Transaction Currency'  , 'MODULE_PAYMENT_ALIPAYFOR_CURRENCY', 'USD,EUR,GBP,AUD,HKD,RUB,CNY', 'Which currency should the order be sent to Alipay as?<br />NOTE: if an unsupported currency is sent to Alipay, it will be auto-converted to USD.', '6', '0', now())");
     $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Debug Mode', 'MODULE_PAYMENT_ALIPAYFOR_DEBUG_MODE', 'Off', 'Would you like to enable debug mode? A detailed log of transactions may be emailed to the store owner.', '6', '0', 'zen_cfg_select_option(array(\\'Off\\', \\'Log File\\'), ', now())");
 }
Exemplo n.º 17
0
            $_SESSION['login_attempt'] = 0;
        }
        $_SESSION['login_attempt']++;
    }
    // END SLAM PREVENTION
    $email_address = zen_db_prepare_input($_POST['email_address']);
    $check_customer_query = "SELECT customers_firstname, customers_lastname, customers_password, customers_id\n                           FROM " . TABLE_CUSTOMERS . "\n                           WHERE customers_email_address = :emailAddress";
    $check_customer_query = $db->bindVars($check_customer_query, ':emailAddress', $email_address, 'string');
    $check_customer = $db->Execute($check_customer_query);
    if ($check_customer->RecordCount() > 0) {
        $zco_notifier->notify('NOTIFY_PASSWORD_FORGOTTEN_VALIDATED');
        $new_password = zen_create_PADSS_password(ENTRY_PASSWORD_MIN_LENGTH > 0 ? ENTRY_PASSWORD_MIN_LENGTH : 5);
        $crypted_password = zen_encrypt_password($new_password);
        $sql = "UPDATE " . TABLE_CUSTOMERS . "\n            SET customers_password = :password\n            WHERE customers_id = :customersID";
        $sql = $db->bindVars($sql, ':password', $crypted_password, 'string');
        $sql = $db->bindVars($sql, ':customersID', $check_customer->fields['customers_id'], 'integer');
        $db->Execute($sql);
        $html_msg['EMAIL_CUSTOMERS_NAME'] = $check_customer->fields['customers_firstname'] . ' ' . $check_customer->fields['customers_lastname'];
        $html_msg['EMAIL_MESSAGE_HTML'] = sprintf(EMAIL_PASSWORD_REMINDER_BODY, $new_password);
        // send the email
        zen_mail($check_customer->fields['customers_firstname'] . ' ' . $check_customer->fields['customers_lastname'], $email_address, EMAIL_PASSWORD_REMINDER_SUBJECT, sprintf(EMAIL_PASSWORD_REMINDER_BODY, $new_password), STORE_NAME, EMAIL_FROM, $html_msg, 'password_forgotten');
        $messageStack->add_session('login', SUCCESS_PASSWORD_SENT, 'success');
        zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
    } else {
        $messageStack->add('password_forgotten', TEXT_NO_EMAIL_ADDRESS_FOUND);
    }
}
$breadcrumb->add(NAVBAR_TITLE_1, zen_href_link(FILENAME_LOGIN, '', 'SSL'));
$breadcrumb->add(NAVBAR_TITLE_2);
// This should be last line of the script:
$zco_notifier->notify('NOTIFY_HEADER_END_PASSWORD_FORGOTTEN');
Exemplo n.º 18
0
            break;
        case 'new_product':
            if (isset($_GET['product_type'])) {
                // see if this category is restricted
                $pieces = explode('_', $_GET['cPath']);
                $cat_id = $pieces[sizeof($pieces) - 1];
                //	echo $cat_id;
                $sql = "select product_type_id from " . TABLE_PRODUCT_TYPES_TO_CATEGORY . " where category_id = '" . $cat_id . "'";
                $product_type_list = $db->Execute($sql);
                $sql = "select product_type_id from " . TABLE_PRODUCT_TYPES_TO_CATEGORY . " where category_id = '" . $cat_id . "' and product_type_id = '" . $_GET['product_type'] . "'";
                $product_type_good = $db->Execute($sql);
                if ($product_type_list->RecordCount() < 1 || $product_type_good->RecordCount() > 0) {
                    $url = zen_get_all_get_params();
                    $sql = "select type_handler from " . TABLE_PRODUCT_TYPES . " where type_id = '" . $_GET['product_type'] . "'";
                    $handler = $db->Execute($sql);
                    zen_redirect(zen_href_link($handler->fields['type_handler'] . '.php', zen_get_all_get_params()));
                } else {
                    $messageStack->add(ERROR_CANNOT_ADD_PRODUCT_TYPE, 'error');
                }
            }
            break;
    }
}
// check if the catalog image directory exists
if (is_dir(DIR_FS_CATALOG_IMAGES)) {
    if (!is_writeable(DIR_FS_CATALOG_IMAGES)) {
        $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_NOT_WRITEABLE, 'error');
    }
} else {
    $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_DOES_NOT_EXIST, 'error');
}
Exemplo n.º 19
0
 */
require 'includes/application_top.php';
require DIR_WS_CLASSES . 'currencies.php';
$currencies = new currencies();
$languages = zen_get_languages();
$action = isset($_GET['action']) ? $_GET['action'] : '';
if (zen_not_null($action)) {
    switch ($action) {
        case 'insert':
        case 'save':
            $sql = "update " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " set products_attributes_filename=:filename:, products_attributes_maxdays=:maxdays:, products_attributes_maxcount=:maxcount: where products_attributes_id='" . (int) $_GET['padID'] . "'";
            $sql = $db->bindVars($sql, ':filename:', $_POST['products_attributes_filename'], 'string');
            $sql = $db->bindVars($sql, ':maxdays:', $_POST['products_attributes_maxdays'], 'string');
            $sql = $db->bindVars($sql, ':maxcount:', $_POST['products_attributes_maxcount'], 'string');
            $db->Execute($sql);
            zen_redirect(zen_href_link(FILENAME_DOWNLOADS_MANAGER, 'padID=' . (int) $_GET['padID'] . '&page=' . (int) $_GET['page']));
            break;
    }
}
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php 
echo HTML_PARAMS;
?>
>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php 
echo CHARSET;
?>
">
<title><?php 
Exemplo n.º 20
0
            zen_redirect(zen_href_link(FILENAME_SUPER_ORDERS, zen_get_all_get_params(array('action')) . 'action=edit', $request_type));
            break;
        case 'deleteconfirm':
            zen_remove_order($oID, $_POST['restock']);
            $so->delete_all_data();
            zen_redirect(zen_href_link(FILENAME_SUPER_ORDERS, zen_get_all_get_params(array('oID', 'action')), $request_type));
            break;
    }
}
if ($action == 'edit' && isset($_GET['oID'])) {
    $orders = $db->Execute("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . $oID . "'");
    $order_exists = true;
    if ($orders->RecordCount() <= 0) {
        $order_exists = false;
        $messageStack->add(sprintf(ERROR_ORDER_DOES_NOT_EXIST, $oID), 'error');
        zen_redirect(zen_href_link(FILENAME_SUPER_ORDERS, zen_get_all_get_params(array('oID', 'action')), $request_type));
    }
}
require DIR_WS_CLASSES . 'currencies.php';
$currencies = new currencies();
$orders_statuses = array();
$orders_status_array = array();
$orders_status = $db->Execute("select orders_status_id, orders_status_name\r\n                                 from " . TABLE_ORDERS_STATUS . "\r\n                                 where language_id = '" . (int) $_SESSION['languages_id'] . "' order by orders_status_id");
while (!$orders_status->EOF) {
    $orders_statuses[] = array('id' => $orders_status->fields['orders_status_id'], 'text' => $orders_status->fields['orders_status_name'] . ' [' . $orders_status->fields['orders_status_id'] . ']');
    $orders_status_array[$orders_status->fields['orders_status_id']] = $orders_status->fields['orders_status_name'];
    $orders_status->MoveNext();
}
require DIR_WS_CLASSES . 'order.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Exemplo n.º 21
0
 function install()
 {
     global $db, $messageStack;
     if (defined('MODULE_PAYMENT_COD_STATUS')) {
         $messageStack->add_session('COD module already installed.', 'error');
         zen_redirect(zen_href_link(FILENAME_MODULES, 'set=payment&module=cod', 'NONSSL'));
         return 'failed';
     }
     $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('打开现金付款方式', 'MODULE_PAYMENT_COD_STATUS', 'True', '您要使用现金付款方式吗? 提示: 送货上门时收取货款。', '6', '1', 'zen_cfg_select_option(array(\\'True\\', \\'False\\'), ', now())");
     $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('付款地区', 'MODULE_PAYMENT_COD_ZONE', '0', '如果选择了付款地区,仅该地区可以使用该支付模块。', '6', '2', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())");
     $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('显示顺序', 'MODULE_PAYMENT_COD_SORT_ORDER', '0', '显示顺序:小的显示在前。', '6', '0', now())");
     $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('设置订单状态', 'MODULE_PAYMENT_COD_ORDER_STATUS_ID', '0', '设置通过该支付方式付款的订单状态', '6', '0', 'zen_cfg_pull_down_order_statuses(', 'zen_get_order_status_name', now())");
 }
Exemplo n.º 22
0
 /**
  * Store transaction info to the order and process any results that come back from the payment gateway
  *
  */
 function before_process()
 {
     global $order_total_modules;
     if (isset($_GET['referer']) && $_GET['referer'] == 'paypal') {
         $this->notify('NOTIFY_PAYMENT_PAYPAL_RETURN_TO_STORE');
         if (MODULE_PAYMENT_PAYPAL_TESTING == 'Test') {
             // simulate call to ipn_handler.php here
             ipn_simulate_ipn_handler((int) $_GET['count']);
         }
         $_SESSION['cart']->reset(true);
         unset($_SESSION['sendto']);
         unset($_SESSION['billto']);
         unset($_SESSION['shipping']);
         unset($_SESSION['payment']);
         unset($_SESSION['comments']);
         unset($_SESSION['cot_gv']);
         $order_total_modules->clear_posts();
         //ICW ADDED FOR CREDIT CLASS SYSTEM
         zen_redirect(zen_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));
     } else {
         $this->notify('NOTIFY_PAYMENT_PAYPAL_CANCELLED_DURING_CHECKOUT');
         zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
     }
 }
Exemplo n.º 23
0
                $db->Execute($sql);
                $_GET['tID'] = $db->Insert_ID();
            }
            $action = "";
            break;
        case 'save':
            $sql = "update " . TABLE_TEMPLATE_SELECT . " set template_dir = :tpl: where template_id = :id:";
            $sql = $db->bindVars($sql, ':tpl:', $_POST['ln'], 'string');
            $sql = $db->bindVars($sql, ':id:', $_GET['tID'], 'integer');
            $db->Execute($sql);
            break;
        case 'deleteconfirm':
            $check_query = $db->Execute("select template_language from " . TABLE_TEMPLATE_SELECT . " where template_id = '" . (int) $_POST['tID'] . "'");
            if ($check_query->fields['template_language'] != 0) {
                $db->Execute("delete from " . TABLE_TEMPLATE_SELECT . " where template_id = '" . (int) $_POST['tID'] . "'");
                zen_redirect(zen_href_link(FILENAME_TEMPLATE_SELECT, 'page=' . $_GET['page']));
            }
            $action = "";
            break;
    }
}
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php 
echo HTML_PARAMS;
?>
>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php 
echo CHARSET;
?>
Exemplo n.º 24
0
/**
 * Customer Authorization 
 *
 * @package page
 * @copyright Copyright 2003-2006 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: header_php.php 2974 2006-02-05 04:53:19Z birdbrain $
 */
$sql = "SELECT customers_authorization \n        FROM " . TABLE_CUSTOMERS . " \n        WHERE customers_id = :customersID";
$sql = $db->bindVars($sql, ':customersID', $_SESSION['customer_id'], 'integer');
$check_customer = $db->Execute($sql);
$_SESSION['customers_authorization'] = $check_customer->fields['customers_authorization'];
if ($_SESSION['customers_authorization'] != '1') {
    zen_redirect(zen_href_link(FILENAME_DEFAULT));
}
require DIR_WS_MODULES . zen_get_module_directory('require_languages.php');
$breadcrumb->add(NAVBAR_TITLE);
if (CUSTOMERS_AUTHORIZATION_COLUMN_RIGHT_OFF == 'true') {
    $flag_disable_right = true;
}
if (CUSTOMERS_AUTHORIZATION_COLUMN_LEFT_OFF == 'true') {
    $flag_disable_left = true;
}
if (CUSTOMERS_AUTHORIZATION_FOOTER_OFF == 'true') {
    $flag_disable_footer = true;
}
if (CUSTOMERS_AUTHORIZATION_HEADER_OFF == 'true') {
    $flag_disable_header = true;
}
Exemplo n.º 25
0
            if ($result != 'failed') {
                zen_redirect(zen_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $class . '&action=edit', 'NONSSL'));
            }
            break;
        case 'removeconfirm':
            $file_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.'));
            $class = basename($_POST['module']);
            if (file_exists($module_directory . $class . $file_extension)) {
                include $module_directory . $class . $file_extension;
                $module = new $class();
                $msg = sprintf(TEXT_EMAIL_MESSAGE_ADMIN_MODULE_REMOVED, preg_replace('/[^\\d\\w]/', '*', $_POST['module']), $admname);
                zen_record_admin_activity($msg, 'warning');
                zen_mail(STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER_EMAIL_ADDRESS, TEXT_EMAIL_SUBJECT_ADMIN_SETTINGS_CHANGED, $msg, STORE_NAME, EMAIL_FROM, array('EMAIL_MESSAGE_HTML' => $msg), 'admin_settings_changed');
                $result = $module->remove();
            }
            zen_redirect(zen_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $class, 'NONSSL'));
            break;
    }
}
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php 
echo HTML_PARAMS;
?>
>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php 
echo CHARSET;
?>
">
<title><?php 
Exemplo n.º 26
0
        $db->Execute($sql);
        $where_clause = "customers_id = :customersID AND address_book_id = :customerDefaultAddressID";
        $where_clause = $db->bindVars($where_clause, ':customersID', $_SESSION['customer_id'], 'integer');
        $where_clause = $db->bindVars($where_clause, ':customerDefaultAddressID', $_SESSION['customer_default_address_id'], 'integer');
        // ->furikana
        if (FURIKANA_NESESSARY) {
            $sql_data_array = array(array('fieldName' => 'entry_firstname', 'value' => $firstname, 'type' => 'string'), array('fieldName' => 'entry_lastname', 'value' => $lastname, 'type' => 'string'), array('fieldName' => 'entry_firstname_kana', 'value' => $firstname_kana, 'type' => 'string'), array('fieldName' => 'entry_lastname_kana', 'value' => $lastname_kana, 'type' => 'string'));
        } else {
            $sql_data_array = array(array('fieldName' => 'entry_firstname', 'value' => $firstname, 'type' => 'string'), array('fieldName' => 'entry_lastname', 'value' => $lastname, 'type' => 'string'));
        }
        $db->perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', $where_clause);
        $zco_notifier->notify('NOTIFY_HEADER_ACCOUNT_EDIT_UPDATES_COMPLETE');
        // reset the session variables
        $_SESSION['customer_first_name'] = $firstname;
        $messageStack->add_session('account', SUCCESS_ACCOUNT_UPDATED, 'success');
        zen_redirect(zen_href_link(FILENAME_ACCOUNT, '', 'SSL'));
    }
}
// ->furikana
if (FURIKANA_NESESSARY) {
    $account_query = "SELECT customers_gender, customers_firstname, customers_lastname,\r\n                               customers_firstname_kana, customers_lastname_kana,\r\n                               customers_dob, customers_email_address, customers_telephone,\r\n                               customers_fax, customers_email_format, customers_referral\r\n                        FROM   " . TABLE_CUSTOMERS . "\r\n                        WHERE  customers_id = :customersID";
} else {
    $account_query = "SELECT customers_gender, customers_firstname, customers_lastname,\r\n                         customers_dob, customers_email_address, customers_telephone,\r\n                         customers_fax, customers_email_format, customers_referral\r\n                  FROM   " . TABLE_CUSTOMERS . "\r\n                  WHERE  customers_id = :customersID";
}
// <-furikana
$account_query = $db->bindVars($account_query, ':customersID', $_SESSION['customer_id'], 'integer');
$account = $db->Execute($account_query);
if (ACCOUNT_GENDER == 'true') {
    if (isset($gender)) {
        $male = $gender == 'm' ? true : false;
    } else {
Exemplo n.º 27
0
 /**
  * Error / exception handling
  */
 function _errorHandler($response, $operation = '', $ignore_codes = '')
 {
     global $messageStack, $doPayPal;
     $gateway_mode = isset($response['PNREF']) && $response['PNREF'] != '';
     $basicError = !$response || isset($response['RESULT']) && $response['RESULT'] != 0 || isset($response['ACK']) && !strstr($response['ACK'], 'Success') || !isset($response['RESULT']) && !isset($response['ACK']);
     $ignoreList = explode(',', str_replace(' ', '', $ignore_codes));
     foreach ($ignoreList as $key => $value) {
         if ($value != '' && $response['L_ERRORCODE0'] == $value) {
             $basicError = false;
         }
     }
     //echo '<br />basicError='.$basicError.'<br />' . urldecode(print_r($response,true)); die('halted');
     switch ($operation) {
         case 'SetExpressCheckout':
             if ($basicError) {
                 // if error, display error message. If debug options enabled, email dump to store owner
                 if ($this->enableDebugging) {
                     $this->_doDebug('PayPal Error Log - ec_step1()', "In function: ec_step1()\r\n\r\nValue List:\r\n" . str_replace('&', "\r\n", $doPayPal->_sanitizeLog($doPayPal->_parseNameValueList($doPayPal->lastParamList))) . "\r\n\r\nResponse:\r\n" . print_r($response, true));
                 }
                 $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_GEN_ERROR;
                 $errorNum = urldecode($response['L_ERRORCODE0'] . $response['RESULT']);
                 if ($response['RESULT'] == 25) {
                     $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_NOT_WPP_ACCOUNT_ERROR;
                 }
                 if ($response['L_ERRORCODE0'] == 10002) {
                     $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_SANDBOX_VS_LIVE_ERROR;
                 }
                 if ($response['L_ERRORCODE0'] == 10565) {
                     $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_WPP_BAD_COUNTRY_ERROR;
                     $_SESSION['payment'] = '';
                 }
                 if ($response['L_ERRORCODE0'] == 10736) {
                     $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_ADDR_ERROR;
                 }
                 if ($response['L_ERRORCODE0'] == 10752) {
                     $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_DECLINED;
                 }
                 $detailedMessage = $errorText == MODULE_PAYMENT_PAYPALWPP_TEXT_GEN_ERROR || $this->enableDebugging || $response['CURL_ERRORS'] != '' || $this->emailAlerts ? $errorNum . ' ' . urldecode(' ' . $response['L_SHORTMESSAGE0'] . ' - ' . $response['L_LONGMESSAGE0'] . (isset($response['RESPMSG']) ? ' ' . $response['RESPMSG'] : '') . ' ' . $response['CURL_ERRORS']) : '';
                 $detailedEmailMessage = $detailedMessage == '' ? '' : MODULE_PAYMENT_PAYPALWPP_TEXT_EMAIL_ERROR_MESSAGE . urldecode($response['L_ERRORCODE0'] . "\n" . $response['L_SHORTMESSAGE0'] . "\n" . $response['L_LONGMESSAGE0'] . $response['L_ERRORCODE1'] . "\n" . $response['L_SHORTMESSAGE1'] . "\n" . $response['L_LONGMESSAGE1'] . $response['L_ERRORCODE2'] . "\n" . $response['L_SHORTMESSAGE2'] . "\n" . $response['L_LONGMESSAGE2'] . ($response['CURL_ERRORS'] != '' ? "\n" . $response['CURL_ERRORS'] : '') . "\n\n" . 'Zen Cart message: ' . $errorText);
                 if ($detailedEmailMessage != '') {
                     zen_mail(STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, MODULE_PAYMENT_PAYPALWPP_TEXT_EMAIL_ERROR_SUBJECT . ' (' . $errorNum . ')', $detailedMessage, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, array('EMAIL_MESSAGE_HTML' => $detailedMessage), 'paymentalert');
                 }
                 $this->terminateEC($errorText . ' (' . $errorNum . ') ' . $detailedMessage, true);
                 return true;
             }
             break;
         case 'GetExpressCheckoutDetails':
             if ($basicError || $_SESSION['paypal_ec_token'] != urldecode($response['TOKEN'])) {
                 // if response indicates an error, send the customer back to checkout and display the error. Debug to store owner if active.
                 if ($this->enableDebugging) {
                     $this->_doDebug('PayPal Error Log - ec_step2()', "In function: ec_step2()\r\n\r\nValue List:\r\n" . str_replace('&', "\r\n", urldecode($doPayPal->_sanitizeLog($doPayPal->_parseNameValueList($doPayPal->lastParamList)))) . "\r\n\r\nResponse:\r\n" . urldecode(print_r($response, true)));
                 }
                 $this->terminateEC(MODULE_PAYMENT_PAYPALWPP_TEXT_GEN_ERROR . ' (' . $response['L_ERRORCODE0'] . ' ' . urldecode($response['L_SHORTMESSAGE0'] . $response['RESULT']) . ')', true);
                 return true;
             }
             break;
         case 'DoExpressCheckoutPayment':
             if ($basicError || $_SESSION['paypal_ec_token'] != urldecode($response['TOKEN'])) {
                 // there's an error, so alert customer, and if debug is on, notify storeowner
                 if ($this->enableDebugging) {
                     $this->_doDebug('PayPal Error Log - before_process() - EC', "In function: before_process() - Express Checkout\r\n\r\nValue List:\r\n" . str_replace('&', "\r\n", $doPayPal->_sanitizeLog($doPayPal->_parseNameValueList($doPayPal->lastParamList))) . "\r\n\r\nResponse:\r\n" . print_r($response, true));
                 }
                 // if funding source problem occurred, must send back to re-select alternate funding source
                 if ($response['L_ERRORCODE0'] == 10422) {
                     $paypal_url = $this->getPayPalLoginServer();
                     zen_redirect($paypal_url . "?cmd=_express-checkout&token=" . $_SESSION['paypal_ec_token']);
                     die;
                 }
                 // some other error condition
                 $errorText = MODULE_PAYMENT_PAYPALWPP_INVALID_RESPONSE;
                 $errorNum = urldecode($response['L_ERRORCODE0']);
                 if ($response['L_ERRORCODE0'] == 10415) {
                     $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_ORDER_ALREADY_PLACED_ERROR;
                 }
                 if ($response['L_ERRORCODE0'] == 10417) {
                     $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_INSUFFICIENT_FUNDS_ERROR;
                 }
                 if ($response['L_ERRORCODE0'] == 10474) {
                     $errorText .= urldecode($response['L_LONGMESSAGE0']);
                 }
                 $detailedMessage = $errorText == MODULE_PAYMENT_PAYPALWPP_INVALID_RESPONSE || $this->enableDebugging || $response['CURL_ERRORS'] != '' || $this->emailAlerts ? $errorNum . ' ' . urldecode(' ' . $response['L_SHORTMESSAGE0'] . ' - ' . $response['L_LONGMESSAGE0'] . $response['RESULT'] . ' ' . $response['CURL_ERRORS']) : '';
                 $detailedEmailMessage = $detailedMessage == '' ? '' : MODULE_PAYMENT_PAYPALWPP_TEXT_EMAIL_ERROR_MESSAGE . urldecode($response['L_ERRORCODE0'] . "\n" . $response['L_SHORTMESSAGE0'] . "\n" . $response['L_LONGMESSAGE0'] . $response['L_ERRORCODE1'] . "\n" . $response['L_SHORTMESSAGE1'] . "\n" . $response['L_LONGMESSAGE1'] . $response['L_ERRORCODE2'] . "\n" . $response['L_SHORTMESSAGE2'] . "\n" . $response['L_LONGMESSAGE2'] . ($response['CURL_ERRORS'] != '' ? "\n" . $response['CURL_ERRORS'] : '') . "\n\n" . 'Zen Cart message: ' . $errorText);
                 if ($detailedEmailMessage != '') {
                     zen_mail(STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, MODULE_PAYMENT_PAYPALWPP_TEXT_EMAIL_ERROR_SUBJECT . ' (' . $errorNum . ')', $detailedMessage, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, array('EMAIL_MESSAGE_HTML' => $detailedMessage), 'paymentalert');
                 }
                 $this->terminateEC($detailedEmailMessage == '' ? $errorText . ' (' . urldecode($response['L_SHORTMESSAGE0'] . $response['RESULT']) . ') ' : $detailedMessage, true);
                 return true;
             }
             break;
         case 'DoDirectPayment':
             if ($basicError || isset($_SESSION['paypal_ec_token']) && $_SESSION['paypal_ec_token'] != urldecode($response['TOKEN'])) {
                 // Error, so send the store owner a complete dump of the transaction.
                 if ($this->enableDebugging) {
                     $this->_doDebug('PayPal Error Log - before_process() - DP', "In function: before_process() - Direct Payment \r\nDid first contact attempt return error? " . ($error_occurred ? "Yes" : "No") . " \r\n\r\nValue List:\r\n" . str_replace('&', "\r\n", urldecode($doPayPal->_sanitizeLog($doPayPal->_parseNameValueList($doPayPal->lastParamList)))) . "\r\n\r\nResponse:\r\n" . urldecode(print_r($response, true)));
                 }
                 $errorText = MODULE_PAYMENT_PAYPALWPP_INVALID_RESPONSE;
                 $errorNum = urldecode($response['L_ERRORCODE0'] . $response['RESULT'] . ' ' . $response['RESPMSG']);
                 if ($response['RESULT'] == 25) {
                     $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_NOT_WPP_ACCOUNT_ERROR;
                 }
                 if ($response['L_ERRORCODE0'] == 10002) {
                     $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_SANDBOX_VS_LIVE_ERROR;
                 }
                 if ($response['L_ERRORCODE0'] == 10565) {
                     $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_WPP_BAD_COUNTRY_ERROR;
                     $_SESSION['payment'] = '';
                 }
                 if ($response['L_ERRORCODE0'] == 10736) {
                     $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_ADDR_ERROR;
                 }
                 if ($response['L_ERRORCODE0'] == 10752) {
                     $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_DECLINED;
                     $errorNum = '10752';
                 }
                 if ($response['RESPMSG'] != '') {
                     $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_DECLINED;
                 }
                 $detailedMessage = $errorText == MODULE_PAYMENT_PAYPALWPP_INVALID_RESPONSE || $errorText == MODULE_PAYMENT_PAYPALWPP_TEXT_DECLINED || $this->enableDebugging || $response['CURL_ERRORS'] != '' || $this->emailAlerts ? $errorNum . ' ' . urldecode(' ' . $response['L_SHORTMESSAGE0'] . ' - ' . $response['L_LONGMESSAGE0'] . ' ' . $response['CURL_ERRORS']) : '';
                 $detailedEmailMessage = $detailedMessage == '' ? '' : MODULE_PAYMENT_PAYPALWPP_TEXT_EMAIL_ERROR_MESSAGE . urldecode($response['L_ERRORCODE0'] . "\n" . $response['L_SHORTMESSAGE0'] . "\n" . $response['L_LONGMESSAGE0'] . $response['L_ERRORCODE1'] . "\n" . $response['L_SHORTMESSAGE1'] . "\n" . $response['L_LONGMESSAGE1'] . $response['L_ERRORCODE2'] . "\n" . $response['L_SHORTMESSAGE2'] . "\n" . $response['L_LONGMESSAGE2'] . ($response['CURL_ERRORS'] != '' ? "\n" . $response['CURL_ERRORS'] : '') . "\n\n" . 'Zen Cart message: ' . $detailedMessage . "\n\n" . 'Transaction Response Details: ' . print_r($response, true) . "\n\n" . 'Transaction Submission: ' . urldecode($doPayPal->_sanitizeLog($doPayPal->_parseNameValueList($doPayPal->lastParamList), true)));
                 if ($detailedEmailMessage != '') {
                     zen_mail(STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, MODULE_PAYMENT_PAYPALWPP_TEXT_EMAIL_ERROR_SUBJECT . ' (' . $errorNum . ')', $detailedMessage, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, array('EMAIL_MESSAGE_HTML' => nl2br($detailedEmailMessage)), 'paymentalert');
                 }
                 $this->terminateEC($detailedEmailMessage == '' ? $errorText . ' (' . $errorNum . ') ' : $detailedMessage, $gateway_mode ? true : false, FILENAME_CHECKOUT_PAYMENT);
                 return true;
             }
             break;
         case 'DoRefund':
             if ($basicError || !isset($response['RESPMSG']) && !isset($response['REFUNDTRANSACTIONID'])) {
                 // if error, display error message. If debug options enabled, email dump to store owner
                 if ($this->enableDebugging) {
                     $this->_doDebug('PayPal Error Log - ' . $operation, "Value List:\r\n" . str_replace('&', "\r\n", $doPayPal->_sanitizeLog($doPayPal->_parseNameValueList($doPayPal->lastParamList))) . "\r\n\r\nResponse:\r\n" . print_r($response, true));
                 }
                 $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_REFUND_ERROR;
                 if ($response['L_ERRORCODE0'] == 10009) {
                     $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_REFUNDFULL_ERROR;
                 }
                 if ($response['RESULT'] == 105 || isset($response['RESPMSG'])) {
                     $response['L_SHORTMESSAGE0'] = $response['RESULT'] . ' ' . $response['RESPMSG'];
                 }
                 if (urldecode($response['L_LONGMESSAGE0']) == 'This transaction has already been fully refunded') {
                     $response['L_SHORTMESSAGE0'] = urldecode($response['L_LONGMESSAGE0']);
                 }
                 if (urldecode($response['L_LONGMESSAGE0']) == 'Can not do a full refund after a partial refund') {
                     $response['L_SHORTMESSAGE0'] = urldecode($response['L_LONGMESSAGE0']);
                 }
                 if (urldecode($response['L_LONGMESSAGE0']) == 'The partial refund amount must be less than or equal to the remaining amount') {
                     $response['L_SHORTMESSAGE0'] = urldecode($response['L_LONGMESSAGE0']);
                 }
                 if (urldecode($response['L_LONGMESSAGE0']) == 'You can not refund this type of transaction') {
                     $response['L_SHORTMESSAGE0'] = urldecode($response['L_LONGMESSAGE0']);
                 }
                 $errorText .= ' (' . urldecode($response['L_SHORTMESSAGE0']) . ') ' . $response['L_ERRORCODE0'];
                 $messageStack->add_session($errorText, 'error');
                 return true;
             }
             break;
         case 'DoAuthorization':
         case 'DoReauthorization':
             if ($basicError) {
                 // if error, display error message. If debug options enabled, email dump to store owner
                 if ($this->enableDebugging) {
                     $this->_doDebug('PayPal Error Log - ' . $operation, "Value List:\r\n" . str_replace('&', "\r\n", $doPayPal->_sanitizeLog($doPayPal->_parseNameValueList($doPayPal->lastParamList))) . "\r\n\r\nResponse:\r\n" . print_r($response, true));
                 }
                 $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_AUTH_ERROR;
                 $errorText .= ' (' . urldecode($response['L_SHORTMESSAGE0']) . ') ' . $response['L_ERRORCODE0'];
                 $messageStack->add_session($errorText, 'error');
                 return true;
             }
             break;
         case 'DoCapture':
             if ($basicError) {
                 // if error, display error message. If debug options enabled, email dump to store owner
                 if ($this->enableDebugging) {
                     $this->_doDebug('PayPal Error Log - ' . $operation, "Value List:\r\n" . str_replace('&', "\r\n", $doPayPal->_sanitizeLog($doPayPal->_parseNameValueList($doPayPal->lastParamList))) . "\r\n\r\nResponse:\r\n" . print_r($response, true));
                 }
                 $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_CAPT_ERROR;
                 if ($response['RESULT'] == 111) {
                     $response['L_SHORTMESSAGE0'] = $response['RESULT'] . ' ' . $response['RESPMSG'];
                 }
                 $errorText .= ' (' . urldecode($response['L_SHORTMESSAGE0']) . ') ' . $response['L_ERRORCODE0'];
                 $messageStack->add_session($errorText, 'error');
                 return true;
             }
             break;
         case 'DoVoid':
             if ($basicError) {
                 // if error, display error message. If debug options enabled, email dump to store owner
                 if ($this->enableDebugging) {
                     $this->_doDebug('PayPal Error Log - ' . $operation, "Value List:\r\n" . str_replace('&', "\r\n", $doPayPal->_sanitizeLog($doPayPal->_parseNameValueList($doPayPal->lastParamList))) . "\r\n\r\nResponse:\r\n" . print_r($response, true));
                 }
                 $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_VOID_ERROR;
                 if ($response['RESULT'] == 12) {
                     $response['L_SHORTMESSAGE0'] = $response['RESULT'] . ' ' . $response['RESPMSG'];
                 }
                 if ($response['RESULT'] == 108) {
                     $response['L_SHORTMESSAGE0'] = $response['RESULT'] . ' ' . $response['RESPMSG'];
                 }
                 $errorText .= ' (' . urldecode($response['L_SHORTMESSAGE0']) . ') ' . $response['L_ERRORCODE0'];
                 $messageStack->add_session($errorText, 'error');
                 return true;
             }
             break;
         case 'GetTransactionDetails':
             if ($basicError) {
                 // if error, display error message. If debug options enabled, email dump to store owner
                 if ($this->enableDebugging) {
                     $this->_doDebug('PayPal Error Log - ' . $operation, "Value List:\r\n" . str_replace('&', "\r\n", $doPayPal->_sanitizeLog($doPayPal->_parseNameValueList($doPayPal->lastParamList))) . "\r\n\r\nResponse:\r\n" . print_r($response, true));
                 }
                 $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_GETDETAILS_ERROR;
                 $errorText .= ' (' . urldecode($response['L_SHORTMESSAGE0']) . ') ' . $response['L_ERRORCODE0'];
                 $messageStack->add_session($errorText, 'error');
                 return true;
             }
             break;
         case 'TransactionSearch':
             if ($basicError) {
                 // if error, display error message. If debug options enabled, email dump to store owner
                 if ($this->enableDebugging) {
                     $this->_doDebug('PayPal Error Log - ' . $operation, "Value List:\r\n" . str_replace('&', "\r\n", $doPayPal->_sanitizeLog($doPayPal->_parseNameValueList($doPayPal->lastParamList))) . "\r\n\r\nResponse:\r\n" . print_r($response, true));
                 }
                 $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_TRANSSEARCH_ERROR;
                 $errorText .= ' (' . urldecode($response['L_SHORTMESSAGE0']) . ') ' . $response['L_ERRORCODE0'];
                 $messageStack->add_session($errorText, 'error');
                 return true;
             }
             break;
         default:
             if ($basicError) {
                 // if error, display error message. If debug options enabled, email dump to store owner
                 if ($this->enableDebugging) {
                     $this->_doDebug('PayPal Error Log - ' . $operation, "Value List:\r\n" . str_replace('&', "\r\n", $doPayPal->_sanitizeLog($doPayPal->_parseNameValueList($doPayPal->lastParamList))) . "\r\n\r\nResponse:\r\n" . print_r($response, true));
                 }
                 $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_GEN_API_ERROR;
                 $errorNum .= ' (' . urldecode($response['L_SHORTMESSAGE0'] . ' ' . $response['RESPMSG']) . ') ' . $response['L_ERRORCODE0'];
                 $detailedMessage = $errorText == MODULE_PAYMENT_PAYPALWPP_TEXT_GEN_API_ERROR || $errorText == MODULE_PAYMENT_PAYPALWPP_TEXT_DECLINED || $this->enableDebugging || $response['CURL_ERRORS'] != '' || $this->emailAlerts ? urldecode(' ' . $response['L_SHORTMESSAGE0'] . ' - ' . $response['L_LONGMESSAGE0'] . ' ' . $response['CURL_ERRORS']) : '';
                 $detailedEmailMessage = $detailedMessage == '' ? '' : MODULE_PAYMENT_PAYPALWPP_TEXT_EMAIL_ERROR_MESSAGE . urldecode($response['L_ERRORCODE0'] . "\n" . $response['L_SHORTMESSAGE0'] . "\n" . $response['L_LONGMESSAGE0'] . $response['L_ERRORCODE1'] . "\n" . $response['L_SHORTMESSAGE1'] . "\n" . $response['L_LONGMESSAGE1'] . $response['L_ERRORCODE2'] . "\n" . $response['L_SHORTMESSAGE2'] . "\n" . $response['L_LONGMESSAGE2'] . ($response['CURL_ERRORS'] != '' ? "\n" . $response['CURL_ERRORS'] : '') . "\n\n" . 'Zen Cart message: ' . $detailedMessage . "\n\n" . 'Transaction Response Details: ' . print_r($response, true) . "\n\n" . 'Transaction Submission: ' . urldecode($doPayPal->_sanitizeLog($doPayPal->_parseNameValueList($doPayPal->lastParamList), true)));
                 if ($detailedEmailMessage != '') {
                     zen_mail(STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, MODULE_PAYMENT_PAYPALWPP_TEXT_EMAIL_ERROR_SUBJECT . ' (' . $errorNum . ')', $detailedMessage, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, array('EMAIL_MESSAGE_HTML' => nl2br($detailedEmailMessage)), 'paymentalert');
                 }
                 $messageStack->add_session($errorText . $errorNum . $detailedMessage, 'error');
                 return true;
             }
             break;
     }
 }
Exemplo n.º 28
0
 function collect_posts()
 {
     global $db, $currencies, $messageStack;
     if (!$_POST['cot_gv']) {
         $_SESSION['cot_gv'] = '0.00';
     }
     if ($_POST['gv_redeem_code']) {
         $gv_result = $db->Execute("select coupon_id, coupon_type, coupon_amount from " . TABLE_COUPONS . " where coupon_code = '" . $_POST['gv_redeem_code'] . "'");
         if ($gv_result->RecordCount() > 0) {
             $redeem_query = $db->Execute("select * from " . TABLE_COUPON_REDEEM_TRACK . " where coupon_id = '" . $gv_result->fields['coupon_id'] . "'");
             if ($redeem_query->RecordCount() > 0 && $gv_result->fields['coupon_type'] == 'G') {
                 $messageStack->add_session('checkout_payment', ERROR_NO_INVALID_REDEEM_GV, error);
                 zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
             }
         } else {
             $messageStack->add_session('checkout_payment', ERROR_NO_INVALID_REDEEM_GV, error);
             zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
         }
         if ($gv_result->fields['coupon_type'] == 'G') {
             $gv_amount = $gv_result->fields['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_result = $db->Execute("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $_SESSION['customer_id'] . "'");
             $customer_gv = false;
             $total_gv_amount = $gv_amount;
             if ($gv_amount_result->RecordCount() > 0) {
                 $total_gv_amount = $gv_amount_result->fields['amount'] + $gv_amount;
                 $customer_gv = true;
             }
             $db->Execute("update " . TABLE_COUPONS . " set coupon_active = 'N' where coupon_id = '" . $gv_result->fields['coupon_id'] . "'");
             $db->Execute("insert into  " . TABLE_COUPON_REDEEM_TRACK . " (coupon_id, customer_id, redeem_date, redeem_ip) values ('" . $gv_result->fields['coupon_id'] . "', '" . $_SESSION['customer_id'] . "', now(),'" . $_SERVER['REMOTE_ADDR'] . "')");
             if ($customer_gv) {
                 // already has gv_amount so update
                 $db->Execute("update " . TABLE_COUPON_GV_CUSTOMER . " set amount = '" . $total_gv_amount . "' where customer_id = '" . $_SESSION['customer_id'] . "'");
             } else {
                 // no gv_amount so insert
                 $db->Execute("insert into " . TABLE_COUPON_GV_CUSTOMER . " (customer_id, amount) values ('" . $_SESSION['customer_id'] . "', '" . $total_gv_amount . "')");
             }
             //          zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_REDEEMED_AMOUNT. $currencies->format($gv_amount)), 'SSL'));
             $messageStack->add_session('redemptions', ERROR_REDEEMED_AMOUNT . $currencies->format($gv_amount), 'success');
         }
     }
     if ($_POST['submit_redeem_x'] && $gv_result->fields['coupon_type'] == 'G') {
         zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_NO_REDEEM_CODE), 'SSL'));
     }
 }
Exemplo n.º 29
0
<?php

$anID = isset($_GET['anID']) ? $_GET['anID'] : '';
if (zen_not_null($anID) && is_numeric($anID)) {
    $announce_sql = 'select * from ' . TABLE_ANNOUNCEMENT . ' 
		               where id=' . (int) $anID . ' 
					   and   is_visible=1 
					   and   languages_id=' . (int) $_SESSION['languages_id'];
    $announce_db = $db->Execute($announce_sql);
    if ($announce_db->RecordCount() > 0) {
        $announce = array();
        while (!$announce_db->EOF) {
            $announce[] = array('title' => $announce_db->fields['title'], 'date_added' => $announce_db->fields['date_added'], 'ann_content' => $announce_db->fields['ann_content']);
            $announce_db->MoveNext();
        }
    } else {
        zen_redirect(FILENAME_DEFAULT);
    }
} else {
    zen_redirect(FILENAME_DEFAULT);
}
require DIR_WS_MODULES . zen_get_module_directory('require_languages.php');
                         // echo '<br>This should be deleted: ' . zen_get_products_name($all_options_values->fields['products_options_id']);
                         // change to delete
                         // should add download delete
                         $db->Execute("delete from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id='" . $all_update_products->fields['products_id'] . "' and options_id='" . $_POST['options_id'] . "'");
                     } else {
                         // skip this option_name does not exist
                     }
                     $all_options_values->MoveNext();
                 }
                 $all_update_products->MoveNext();
             }
         }
         // update_action
     }
     // no products found
     zen_redirect(zen_href_link(FILENAME_OPTIONS_NAME_MANAGER, $_SESSION['page_info'] . '&option_order_by=' . $option_order_by));
     break;
     ////////////////////////////////////
     // copy features
 ////////////////////////////////////
 // copy features
 case 'copy_options_values':
     $options_id_from = $_POST['options_id_from'];
     $options_id_to = $_POST['options_id_to'];
     if ($options_id_from == $options_id_to) {
         // cannot copy to self
         $messageStack->add(ERROR_OPTION_VALUES_COPIED . ' from: ' . zen_options_name($options_id_from) . ' to: ' . zen_options_name($options_id_to), 'warning');
     } else {
         // successful copy
         $start_id = $db->Execute("select pov.products_options_values_id from " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov order by pov.products_options_values_id DESC LIMIT 1");
         $copy_from_values = $db->Execute("select pov.* from " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov left join " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " povtpo on pov.products_options_values_id= povtpo.products_options_values_id where povtpo.products_options_id='" . $options_id_from . "' order by povtpo.products_options_values_id");