Changeset 21586
- Timestamp:
- 2012/03/04 16:34:48 (12 years ago)
- Location:
- branches/version-2_12-dev/data/class
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/SC_CheckError.php
r21578 r21586 719 719 $this->createParam($value); 720 720 721 if ($_FILES[$value[1]]['name'] != '') { 722 $errFlag = 1; 723 $array_ext = explode('.', $_FILES[$value[1]]['name']); 724 725 $strExt = ''; 726 727 foreach ($value[2] as $checkExt) { 728 $ext = ''; 729 730 // チェック拡張子のピリオドの数を取得('tar.gz'の場合1個、'jpg'のように通常は0個) 731 $count_period = substr_count($checkExt, '.'); 732 733 if ($count_period > 0) { 734 for ($i = max(array_keys($array_ext)) - $count_period; $i < count($array_ext); $i++) { 735 $ext .= $array_ext[$i] . '.'; 736 } 737 $ext = preg_replace("/.$/", "" ,$ext); 738 } else { 739 $ext = $array_ext[ count ($array_ext) - 1 ]; 721 $match = false; 722 if (strlen($_FILES[$value[1]]['name']) >= 1) { 723 $filename = $_FILES[$value[1]]['name']; 724 725 foreach ($value[2] as $check_ext) { 726 $match = preg_match('/' . preg_quote('.' . $check_ext) . '$/i', $filename) >= 1; 727 if ($match === true) { 728 break 1; 740 729 } 741 742 $ext = strtolower($ext); 743 744 if ($ext == $checkExt) { 745 $errFlag = 0; 746 } 747 748 if ($strExt == '') { 749 $strExt.= $checkExt; 750 } else { 751 $strExt.= "・$checkExt"; 752 } 753 } 754 } 755 if ($errFlag == 1) { 756 $this->arrErr[$value[1]] = '※ ' . $value[0] . 'で許可されている形式は、' . $strExt . 'です。<br />'; 730 } 731 } 732 if ($match === false) { 733 $str_ext = implode('・', $value[2]); 734 $this->arrErr[$value[1]] = '※ ' . $value[0] . 'で許可されている形式は、' . $str_ext . 'です。<br />'; 757 735 } 758 736 } -
branches/version-2_12-dev/data/class/pages/admin/products/LC_Page_Admin_Products_ProductClass.php
r21532 r21586 572 572 $this->arrErr['down_realfilename'][$index] = '※ ダウンロード販売用ファイル名のファイルサイズは' . $size . $byte . '以下のものを使用してください。<br />'; 573 573 } else { 574 $array_ext = explode('.', $_FILES['down_realfilename']['name'][$index]); 575 $is_error = true; 576 $strExt = ''; 577 578 foreach (explode(',', DOWNLOAD_EXTENSION) as $checkExt) { 579 $ext = ''; 580 // チェック拡張子のピリオドの数を取得('tar.gz'の場合1個、'jpg'のように通常は0個) 581 $count_period = substr_count($checkExt, '.'); 582 if ($count_period > 0) { 583 for ($i = max(array_keys($array_ext)) - $count_period; $i < count($array_ext); $i++) { 584 $ext .= $array_ext[$i] . '.'; 574 // SC_CheckError::FILE_EXT_CHECK とのソース互換を強めるための配列 575 $value = array( 576 0 => 'ダウンロード販売用ファイル名', 577 1 => 'down_realfilename', 578 2 => explode(',', DOWNLOAD_EXTENSION), 579 ); 580 // ▼SC_CheckError::FILE_EXT_CHECK から移植 581 $match = false; 582 if (strlen($_FILES[$value[1]]['name'][$index]) >= 1) { 583 $filename = $_FILES[$value[1]]['name'][$index]; 584 585 foreach ($value[2] as $check_ext) { 586 $match = preg_match('/' . preg_quote('.' . $check_ext) . '$/i', $filename) >= 1; 587 if ($match === true) { 588 break 1; 585 589 } 586 $ext = preg_replace("/.$/", "" ,$ext); 587 } else { 588 $ext = $array_ext[ count ($array_ext) - 1 ]; 589 } 590 $ext = strtolower($ext); 591 592 if ($ext == $checkExt) { 593 $is_error = false; 594 } 595 if ($strExt == '') { 596 $strExt .= $checkExt; 597 } else { 598 $strExt .= "・$checkExt"; 599 } 600 } 601 if ($is_error) { 602 $this->arrErr['down_realfilename'][$index] = '※ ダウンロード販売用ファイル名で許可されている形式は、' . $strExt . 'です。<br />'; 603 } 590 } 591 } 592 if ($match === false) { 593 $str_ext = implode('・', $value[2]); 594 $this->arrErr[$value[1]][$index] = '※ ' . $value[0] . 'で許可されている形式は、' . $str_ext . 'です。<br />'; 595 } 596 // ▲SC_CheckError::FILE_EXT_CHECK から移植 604 597 605 598 $uniqname = date('mdHi') . '_' . uniqid('').'.';
Note: See TracChangeset
for help on using the changeset viewer.