コード例 #1
0
ファイル: orders.php プロジェクト: heg-arc-ne/cscart
    if (!empty($_REQUEST['order_id'])) {
        if (empty($auth['user_id']) && !in_array($_REQUEST['order_id'], $auth['order_ids'])) {
            return array(CONTROLLER_STATUS_DENIED);
        }
        $orders_company_condition = '';
        if (fn_allowed_for('ULTIMATE')) {
            $orders_company_condition = fn_get_company_condition('?:orders.company_id');
        }
        $order = db_get_row("SELECT user_id, order_id FROM ?:orders WHERE ?:orders.order_id = ?i AND is_parent_order != 'Y' {$orders_company_condition}", $_REQUEST['order_id']);
        if (empty($order)) {
            return array(CONTROLLER_STATUS_NO_PAGE);
        }
        fn_add_breadcrumb(__('order') . ' #' . $_REQUEST['order_id'], "orders.details?order_id=" . $_REQUEST['order_id']);
        fn_add_breadcrumb(__('downloads'));
        $params = array('user_id' => $order['user_id'], 'order_ids' => $order['order_id']);
        list($products) = fn_get_user_edp($params);
        Registry::get('view')->assign('products', $products);
    } else {
        return array(CONTROLLER_STATUS_NO_PAGE);
    }
} elseif ($mode == 'get_file') {
    if (empty($_REQUEST['file_id']) || empty($_REQUEST['ekey']) && empty($_REQUEST['preview'])) {
        return array(CONTROLLER_STATUS_NO_PAGE);
    }
    $ekey = !empty($_REQUEST['ekey']) ? $_REQUEST['ekey'] : '';
    if (fn_get_product_file($_REQUEST['file_id'], !empty($_REQUEST['preview']), $ekey) == false) {
        return array(CONTROLLER_STATUS_DENIED);
    }
    exit;
    //
    // Display list of files for downloadable product
コード例 #2
0
 public static function apiGetOrderDetails($order_id)
 {
     $order_info = fn_get_order_info($order_id);
     if (empty($order_info) || empty($order_info['order_id'])) {
         return false;
     }
     if (!empty($order_info['items'])) {
         $order_info['products'] = array();
         foreach ($order_info['items'] as $product) {
             $order_info['products'][] = $product;
         }
         unset($order_info['items']);
     }
     $order_info['status'] = fn_twg_get_order_status($order_info['status'], $order_info['order_id']);
     $status_info = fn_get_status_data($order_info['status'], STATUSES_ORDER, $order_info['order_id'], CART_LANGUAGE);
     if (!empty($status_info['description'])) {
         $order_info['status'] = $status_info['description'];
     }
     if (isset($order_info['products']) && !empty($order_info['products'])) {
         $edp_order_data = fn_get_user_edp(array('user_id' => $order_info['user_id'], 'order_id' => $order_info['order_id']));
         foreach ($order_info['products'] as $k => $product) {
             $order_info['products'][$k]['extra'] = isset($product['extra']) ? $product['extra'] : array();
             if (isset($product['extra']['is_edp']) && $product['extra']['is_edp'] == 'Y') {
                 foreach ($edp_order_data as $_product) {
                     if ($_product['product_id'] == $product['product_id']) {
                         $order_info['products'][$k]['extra']['files'] = $_product['files'];
                         $order_info['products'][$k]['files'] = $_product['files'];
                     }
                 }
             }
         }
     }
     return Api::getAsApiObject('orders', $order_info);
 }
コード例 #3
0
ファイル: orders.php プロジェクト: diedsmiling/busenika
    $view->assign('products', fn_get_user_edp($auth['user_id'], empty($auth['user_id']) ? $auth['order_ids'] : 0, empty($_REQUEST['page']) ? 1 : $_REQUEST['page']));
} elseif ($mode == 'order_downloads') {
    if (empty($auth['user_id']) && empty($auth['order_ids'])) {
        return array(CONTROLLER_STATUS_REDIRECT, $index_script);
    }
    if (!empty($_REQUEST['order_id'])) {
        if (empty($auth['user_id']) && !in_array($_REQUEST['order_id'], $auth['order_ids'])) {
            return array(CONTROLLER_STATUS_DENIED);
        }
        $order = db_get_row("SELECT user_id, order_id FROM ?:orders WHERE ?:orders.order_id = ?i AND is_parent_order != 'Y'", $_REQUEST['order_id']);
        if (empty($order) && fn_is_empty($order)) {
            return array(CONTROLLER_STATUS_NO_PAGE);
        }
        fn_add_breadcrumb(fn_get_lang_var('order') . ' #' . $_REQUEST['order_id'], "orders.details?order_id=" . $_REQUEST['order_id']);
        fn_add_breadcrumb(fn_get_lang_var('downloads'));
        $view->assign('products', fn_get_user_edp($order['user_id'], $_REQUEST['order_id']));
    } else {
        return array(CONTROLLER_STATUS_NO_PAGE);
    }
} elseif ($mode == 'get_file') {
    $field = empty($_REQUEST['preview']) ? 'file_path' : 'preview_path';
    if ($field == 'file_path' && !empty($_REQUEST['ekey']) || $field == 'preview_path') {
        if (!empty($_REQUEST['ekey'])) {
            $ekey_info = fn_get_product_edp_info($_REQUEST['product_id'], $_REQUEST['ekey']);
            if (empty($ekey_info) || $ekey_info['file_id'] != @$_REQUEST['file_id']) {
                return array(CONTROLLER_STATUS_DENIED);
            }
            // Increase downloads for this file
            $max_downloads = db_get_field("SELECT max_downloads FROM ?:product_files WHERE file_id = ?i", $_REQUEST['file_id']);
            $file_downloads = db_get_field("SELECT downloads FROM ?:product_file_ekeys WHERE ekey = ?s AND file_id = ?i", $_REQUEST['ekey'], $_REQUEST['file_id']);
            if (!empty($max_downloads)) {