Source for file LC_Page_Mypage_DownLoad.php
Documentation is available at LC_Page_Mypage_DownLoad.php
* This file is part of EC CUORE
* Copyright(c) 2009 CUORE CO.,LTD. All Rights Reserved.
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
require_once CLASS_EX_REALDIR . 'page_extends/LC_Page_Ex.php';
* ダウンロード商品ダウンロード のページクラス.
* @version $Id: LC_Page_Mypage_DownLoad.php 20970 2011-06-10 10:27:24Z Seasoft $
* Application/octet-streamで対応出来ないファイルタイプのみ拡張子をキーに記述する
* 拡張子が本配列に存在しない場合は $defaultContentTypeを利用する */
var $arrContentType = array('apk' => 'application/vnd.android.package-archive');
$this->allowClientCache();
$objCustomer = new SC_Customer_Ex();
if (!$objCustomer->isLoginSuccess()){
SC_Utils_Ex::sfDispSiteError(DOWNFILE_NOT_FOUND,"",true);
$objFormParam = new SC_FormParam_Ex();
// GET、SESSION['customer']値の取得
$objFormParam->setParam($_SESSION['customer']);
$objFormParam->setParam($_GET);
if (count($this->arrErr)!= 0){
SC_Utils_Ex::sfDispSiteError(DOWNFILE_NOT_FOUND,"",true);
* todo たいした処理でないのに異常に処理が重い
$this->objDisplay->noAction();
$customer_id = $_SESSION['customer']['customer_id'];
$order_id = $_GET['order_id'];
$product_id = $_GET['product_id'];
$product_class_id = $_GET['product_class_id'];
$arrForm = $this->lfGetRealFileName($customer_id, $order_id, $product_id, $product_class_id);
if ($arrForm["down_realfilename"] == "" ){
SC_Utils_Ex::sfDispSiteError(DOWNFILE_NOT_FOUND,"",true);
$realpath = DOWN_SAVE_REALDIR . $arrForm["down_realfilename"];
SC_Utils_Ex::sfDispSiteError(DOWNFILE_NOT_FOUND,"",true);
//ファイル名をエンコードする Safariの対策はUTF-8で様子を見る
if(isset ($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'],'Safari')) {
$sdown_filename = mb_convert_encoding($arrForm["down_filename"], $encoding, 'auto');
// flushなどを利用しているので、現行のSC_Displayは利用できません。
// SC_DisplayやSC_Responseに大容量ファイルレスポンスが実装されたら移行可能だと思います。
$extension = pathinfo($realpath, PATHINFO_EXTENSION);
// 拡張ContentType判定(拡張子をキーに拡張ContentType対象か判断)
// 拡張ContentType対象の場合は、ContentTypeを変更
header("Content-Type: ". $contentType);
header('Content-Disposition: attachment; filename="' . $sdown_filename . '"');
header("Content-Transfer-Encoding: binary");
header("Expires: Mon, 26 Nov 1962 00:00:00 GMT");
header("Last-Modified: " . gmdate("D,d M Y H:i:s") . " GMT");
//IE6+SSL環境下は、キャッシュ無しでダウンロードできない
header("Cache-Control: private");
header("Content-Length: " . $zv_filesize);
$handle = fopen($realpath, 'rb');
SC_Utils_Ex::sfDispSiteError(DOWNFILE_NOT_FOUND,"",true);
echo (fread($handle, DOWNLOAD_BLOCK* 1024));
* @param integer $customer_id 会員ID
* @param integer $order_id 受注ID
* @param integer $product_id 商品ID
* @param integer $product_class_id 商品規格ID
function lfGetRealFileName($customer_id, $order_id, $product_id, $product_class_id) {
$objQuery = new SC_Query_Ex();
pc.product_id AS product_id,
pc.product_class_id AS product_class_id,
pc.down_realfilename AS down_realfilename,
pc.down_filename AS down_filename,
o.customer_id AS customer_id,
o.payment_date AS payment_date,
$dbFactory = SC_DB_DBFactory_Ex::getInstance();
$where = "o.customer_id = ? AND o.order_id = ? AND pc.product_id = ? AND pc.product_class_id = ?";
$where .= " AND " . $dbFactory->getDownloadableDaysWhereSql('o');
$arrRet = $objQuery->select($col, $table, $where,
array($customer_id, $order_id, $product_id, $product_class_id));
$objFormParam->addParam("customer_id", "customer_id", INT_LEN, 'n', array("EXIST_CHECK","NUM_CHECK"));
$objFormParam->addParam("order_id", "order_id", INT_LEN, 'n', array("EXIST_CHECK", "NUM_CHECK"));
$objFormParam->addParam("product_id", "product_id", INT_LEN, 'n', array("EXIST_CHECK","NUM_CHECK"));
$objFormParam->addParam("product_class_id", "product_class_id", INT_LEN, 'n', array("EXIST_CHECK","NUM_CHECK"));
$objErr = new SC_CheckError_Ex($objFormParam->getHashArray());
$objErr->arrErr = $objFormParam->checkError();
Documentation generated on Fri, 24 Feb 2012 14:02:07 +0900 by Seasoft
|