Changeset 21755 for branches/version-2_12-dev/data/class/SC_UploadFile.php
- Timestamp:
- 2012/04/17 15:53:10 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/SC_UploadFile.php
r21684 r21755 59 59 // ファイル管理クラス 60 60 function SC_UploadFile($temp_dir, $save_dir) { 61 $this->temp_dir = (preg_match("|/$|", $temp_dir) == 0) ? $temp_dir. '/' : $temp_dir;62 $this->save_dir = (preg_match("|/$|", $save_dir) == 0) ? $save_dir. '/' : $save_dir;61 $this->temp_dir = rtrim($temp_dir, '/') . '/'; 62 $this->save_dir = rtrim($save_dir, '/') . '/'; 63 63 $this->file_max = 0; 64 64 } … … 117 117 if ($rename) { 118 118 $uniqname = date('mdHi') . '_' . uniqid('').'.'; 119 $this->temp_file[$cnt] = ereg_replace("^.*\.",$uniqname, $_FILES[$keyname]['name']);119 $this->temp_file[$cnt] = preg_replace("/^.*\./", $uniqname, $_FILES[$keyname]['name']); 120 120 } else { 121 121 $this->temp_file[$cnt] = $_FILES[$keyname]['name']; … … 155 155 // 一意なファイル名を作成する。 156 156 $uniqname = date('mdHi') . '_' . uniqid('').'.'; 157 $this->temp_file[$cnt] = ereg_replace("^.*\.",$uniqname, $_FILES[$keyname]['name']);157 $this->temp_file[$cnt] = preg_replace("/^.*\./", $uniqname, $_FILES[$keyname]['name']); 158 158 set_time_limit(0); 159 159 $result = copy($_FILES[$keyname]['tmp_name'], $this->temp_dir . $this->temp_file[$cnt]); … … 229 229 if (isset($this->save_file[$cnt]) 230 230 && $this->save_file[$cnt] != '' 231 && ! ereg('^sub/', $this->save_file[$cnt])231 && !preg_match('|^sub/|', $this->save_file[$cnt]) 232 232 ) { 233 233 … … 249 249 if (isset($this->save_file[$cnt]) 250 250 && $this->save_file[$cnt] != '' 251 && ! ereg('^sub/', $this->save_file[$cnt])251 && !preg_match('|^sub/|', $this->save_file[$cnt]) 252 252 ) { 253 253 $objImage->deleteImage($this->save_file[$cnt], $this->save_dir); … … 311 311 foreach ($this->keyname as $val) { 312 312 if (isset($this->temp_file[$cnt]) && $this->temp_file[$cnt] != '') { 313 // ファイルパスチェック(パスのスラッシュ/が連続しないようにする。) 314 if (ereg("/$", $temp_url)) { 315 $arrRet[$val]['filepath'] = $temp_url . $this->temp_file[$cnt]; 316 } else { 317 $arrRet[$val]['filepath'] = $temp_url . '/' . $this->temp_file[$cnt]; 318 } 313 // パスのスラッシュ/が連続しないようにする。 314 $arrRet[$val]['filepath'] = rtrim($temp_url, '/') . '/' . $this->temp_file[$cnt]; 315 319 316 $arrRet[$val]['real_filepath'] = $this->temp_dir . $this->temp_file[$cnt]; 320 317 } elseif (isset($this->save_file[$cnt]) && $this->save_file[$cnt] != '') { 321 // ファイルパスチェック(パスのスラッシュ/が連続しないようにする。) 322 if (ereg("/$", $save_url)) { 323 $arrRet[$val]['filepath'] = $save_url . $this->save_file[$cnt]; 324 } else { 325 $arrRet[$val]['filepath'] = $save_url . '/' . $this->save_file[$cnt]; 326 } 318 // パスのスラッシュ/が連続しないようにする。 319 $arrRet[$val]['filepath'] = rtrim($save_url, '/') . '/' . $this->save_file[$cnt]; 320 327 321 $arrRet[$val]['real_filepath'] = $this->save_dir . $this->save_file[$cnt]; 328 322 } … … 438 432 foreach ($this->keyname as $val) { 439 433 if ($arrVal[$val] != '') { 440 if ($this->save_file[$cnt] == '' && ! ereg('^sub/', $arrVal[$val])) {434 if ($this->save_file[$cnt] == '' && !preg_match('|^sub/|', $arrVal[$val])) { 441 435 $objImage->deleteImage($arrVal[$val], $this->save_dir); 442 436 } … … 451 445 $cnt = 0; 452 446 if ($arrVal['down_realfilename'] != '') { 453 if ($this->save_file[$cnt] == '' && ! ereg('^sub/', $arrVal['down_realfilename'])) {447 if ($this->save_file[$cnt] == '' && !preg_match('|^sub/|', $arrVal['down_realfilename'])) { 454 448 $objImage->deleteImage($arrVal['down_realfilename'], $this->save_dir); 455 449 }
Note: See TracChangeset
for help on using the changeset viewer.