Example #1
0
 // Define trusted variables that shouldn't be stripped
 fn_trusted_vars('gift_cert_data');
 if ($mode == 'update') {
     $min = Registry::get('addons.gift_certificates.min_amount') * 1;
     $max = Registry::get('addons.gift_certificates.max_amount') * 1;
     if ($_REQUEST['gift_cert_data']['amount'] < $min || $_REQUEST['gift_cert_data']['amount'] > $max) {
         fn_set_notification('E', __('error'), __('gift_cert_error_amount', array('[min]' => $min, '[max]' => $max)));
     } else {
         $gift_cert_id = fn_update_gift_certificate($_REQUEST['gift_cert_data'], $_REQUEST['gift_cert_id'], $_REQUEST);
     }
     $suffix = ".update?gift_cert_id={$gift_cert_id}";
 }
 if ($mode == 'preview') {
     if (!empty($_REQUEST['gift_cert_data'])) {
         fn_correct_gift_certificate($_REQUEST['gift_cert_data']);
         fn_show_postal_card($_REQUEST['gift_cert_data']);
         exit;
     }
 }
 if ($mode == 'm_delete') {
     if (!empty($_REQUEST['gift_cert_ids'])) {
         foreach ($_REQUEST['gift_cert_ids'] as $v) {
             fn_delete_gift_certificate($v);
         }
     }
     $suffix = ".manage";
 }
 if ($mode == 'update_certificate_statuses' && is_array($_REQUEST['certificate_statuses'])) {
     foreach ($_REQUEST['certificate_statuses'] as $k => $v) {
         if ($_REQUEST['origin_statuses'][$k] != $v) {
             fn_change_gift_certificate_status($k, $v, $_REQUEST['origin_statuses'][$k], fn_get_notification_rules($_REQUEST));
*                                                                          *
* This  is  commercial  software,  only  users  who have purchased a valid *
* license  and  accept  to the terms of the  License Agreement can install *
* and use this program.                                                    *
*                                                                          *
****************************************************************************
* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
//
// $Id: gift_certificates.post.php 10402 2010-08-12 08:18:09Z klerik $
//
if (!defined('AREA')) {
    die('Access denied');
}
fn_define('GC_PRODUCTS_PER_PAGE', 5);
if ($mode == 'print') {
    $order_info = fn_get_order_info($_REQUEST['order_id']);
    if (isset($order_info['gift_certificates'][$_REQUEST['gift_cert_cart_id']])) {
        $stored_products = array();
        if (!empty($order_info['items'])) {
            foreach ($order_info['items'] as $id => $v) {
                if (isset($v['extra']['parent']['certificate']) && $v['extra']['parent']['certificate'] == $_REQUEST['gift_cert_cart_id']) {
                    $stored_products[$id] = $v;
                }
            }
        }
        fn_show_postal_card($order_info['gift_certificates'][$_REQUEST['gift_cert_cart_id']], $stored_products);
        exit;
    }
}