Skip to content

Commit

Permalink
[fix] refs EC-CUBE#101 SC_UploadFile::getFormFileList() 第1,2引数を省略可能とし…
Browse files Browse the repository at this point in the history
…、基本は省略する
  • Loading branch information
seasoftjapan committed Jun 19, 2019
1 parent 3ac54e0 commit f22acae
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
22 changes: 15 additions & 7 deletions data/class/SC_UploadFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,21 +330,29 @@ public function setHiddenKikakuFileList($arrPOST)
}

// フォームに渡す用のファイル情報配列を返す
public function getFormFileList($temp_url, $save_url, $real_size = false)
public function getFormFileList($temp_url = null, $save_url = null, $real_size = false)
{
$arrRet = array();
$cnt = 0;
foreach ($this->keyname as $val) {
if (isset($this->temp_file[$cnt]) && $this->temp_file[$cnt] != '') {
// パスのスラッシュ/が連続しないようにする。
$arrRet[$val]['filepath'] = rtrim($temp_url, '/') . '/' . $this->temp_file[$cnt];

$real_filepath =
$arrRet[$val]['real_filepath'] = $this->temp_dir . $this->temp_file[$cnt];
if (is_null($temp_url)) {
$arrRet[$val]['filepath'] = ROOT_URLPATH . substr($real_filepath, strlen(HTML_REALDIR));
} else {
// パスのスラッシュ/が連続しないようにする。
$arrRet[$val]['filepath'] = rtrim($temp_url, '/') . '/' . $this->temp_file[$cnt];
}
} elseif (isset($this->save_file[$cnt]) && $this->save_file[$cnt] != '') {
// パスのスラッシュ/が連続しないようにする。
$arrRet[$val]['filepath'] = rtrim($save_url, '/') . '/' . $this->save_file[$cnt];

$real_filepath =
$arrRet[$val]['real_filepath'] = $this->save_dir . $this->save_file[$cnt];
if (is_null($save_url)) {
$arrRet[$val]['filepath'] = ROOT_URLPATH . substr($real_filepath, strlen(HTML_REALDIR));
} else {
// パスのスラッシュ/が連続しないようにする。
$arrRet[$val]['filepath'] = rtrim($save_url, '/') . '/' . $this->save_file[$cnt];
}
}
if (isset($arrRet[$val]['filepath']) && !empty($arrRet[$val]['filepath'])) {
if ($real_size) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function action()
$this->arrForm = $objFormParam->getFormParamList();

// FORM表示用配列を渡す。
$this->arrFile = $this->objUpFile->getFormFileList(IMAGE_TEMP_URLPATH, IMAGE_SAVE_URLPATH);
$this->arrFile = $this->objUpFile->getFormFileList();
// HIDDEN用に配列を渡す。
$this->arrHidden = array_merge((array) $this->arrHidden, (array) $this->objUpFile->getHiddenFileList());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ public function lfSetViewParam_InputPage(&$objUpFile, &$objDownFile, &$arrForm)
$arrForm['arrHidden'] = array_merge((array) $arrHidden, (array) $objDownFile->getHiddenFileList());

// 画像ファイル表示用データ取得
$arrForm['arrFile'] = $objUpFile->getFormFileList(IMAGE_TEMP_URLPATH, IMAGE_SAVE_URLPATH);
$arrForm['arrFile'] = $objUpFile->getFormFileList();

// ダウンロード商品実ファイル名取得
$arrForm['down_realfilename'] = $objDownFile->getFormDownFile();
Expand Down Expand Up @@ -639,7 +639,7 @@ public function lfSetViewParam_ConfirmPage(&$objUpFile, &$objDownFile, &$arrForm
// hidden に渡す値は serialize する
$arrForm['category_id'] = SC_Utils_Ex::jsonEncode($arrForm['category_id']);
// 画像ファイル用データ取得
$arrForm['arrFile'] = $objUpFile->getFormFileList(IMAGE_TEMP_URLPATH, IMAGE_SAVE_URLPATH);
$arrForm['arrFile'] = $objUpFile->getFormFileList();
// ダウンロード商品実ファイル名取得
$arrForm['down_realfilename'] = $objDownFile->getFormDownFile();

Expand Down
2 changes: 1 addition & 1 deletion data/class/pages/products/LC_Page_Products_Detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ public function lfSetFile(SC_UploadFile $objUpFile, $arrProduct, &$arrFile)
// DBからのデータを引き継ぐ
$objUpFile->setDBFileList($arrProduct);
// ファイル表示用配列を渡す
$arrFile = $objUpFile->getFormFileList(IMAGE_TEMP_URLPATH, IMAGE_SAVE_URLPATH, true);
$arrFile = $objUpFile->getFormFileList(null, null, true);

// サブ画像の有無を判定
$subImageFlag = false;
Expand Down

0 comments on commit f22acae

Please sign in to comment.