Changeset 21514 for branches/version-2_12-dev/data/class/SC_UploadFile.php
- Timestamp:
- 2012/02/15 19:56:17 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/SC_UploadFile.php
r21490 r21514 96 96 97 97 if (!($_FILES[$keyname]['size'] > 0)) { 98 $objErr->arrErr[$keyname] = "※ " . $this->disp_name[$arrKeyname[$keyname]] . "がアップロードされていません。<br />";98 $objErr->arrErr[$keyname] = '※ ' . $this->disp_name[$arrKeyname[$keyname]] . 'がアップロードされていません。<br />'; 99 99 } else { 100 100 foreach ($this->keyname as $val) { … … 122 122 } 123 123 if (move_uploaded_file($_FILES[$keyname]['tmp_name'], $this->temp_dir . $this->temp_file[$cnt])) { 124 GC_Utils_Ex::gfPrintLog($_FILES[$keyname]['name']. " -> ". $this->temp_dir . $this->temp_file[$cnt]);124 GC_Utils_Ex::gfPrintLog($_FILES[$keyname]['name'].' -> '. $this->temp_dir . $this->temp_file[$cnt]); 125 125 } else { 126 126 $objErr->arrErr[$keyname] = '※ ファイルのアップロードに失敗しました。<br />'; … … 142 142 $arrKeyname = array_flip($this->keyname); 143 143 if (!($_FILES[$keyname]['size'] > 0)) { 144 $objErr->arrErr[$keyname] = "※ " . $this->disp_name[$arrKeyname[$keyname]] . "がアップロードされていません。(ファイルがアップロードできない場合は、.htaccessファイルのphp_value upload_max_filesizeを調整してください)<br />";144 $objErr->arrErr[$keyname] = '※ ' . $this->disp_name[$arrKeyname[$keyname]] . 'がアップロードされていません。(ファイルがアップロードできない場合は、.htaccessファイルのphp_value upload_max_filesizeを調整してください)<br />'; 145 145 } else { 146 146 foreach ($this->keyname as $val) { … … 158 158 set_time_limit(0); 159 159 $result = copy($_FILES[$keyname]['tmp_name'], $this->temp_dir . $this->temp_file[$cnt]); 160 GC_Utils_Ex::gfPrintLog($result. " -> ". $this->temp_dir . $this->temp_file[$cnt]);160 GC_Utils_Ex::gfPrintLog($result.' -> '. $this->temp_dir . $this->temp_file[$cnt]); 161 161 } 162 162 } … … 174 174 if ($val == $keyname) { 175 175 // 一時ファイルの場合削除する。 176 if ($this->temp_file[$cnt] != "") {176 if ($this->temp_file[$cnt] != '') { 177 177 $objImage->deleteImage($this->temp_file[$cnt], $this->temp_dir); 178 178 } 179 $this->temp_file[$cnt] = "";180 $this->save_file[$cnt] = "";179 $this->temp_file[$cnt] = ''; 180 $this->save_file[$cnt] = ''; 181 181 } 182 182 $cnt++; … … 191 191 if ($val == $keyname) { 192 192 // 一時ファイルの場合削除する。 193 if ($this->temp_file[$cnt] != "") {193 if ($this->temp_file[$cnt] != '') { 194 194 $objImage->deleteImage($this->temp_file[$cnt], $this->temp_dir); 195 195 } 196 $this->temp_file[$cnt] = "";197 //$this->save_file[$cnt] = "";196 $this->temp_file[$cnt] = ''; 197 //$this->save_file[$cnt] = ''; 198 198 } 199 199 $cnt++; … … 204 204 function getTempFilePath($keyname) { 205 205 $cnt = 0; 206 $filepath = "";206 $filepath = ''; 207 207 foreach ($this->keyname as $val) { 208 208 if ($val == $keyname) { 209 if ($this->temp_file[$cnt] != "") {209 if ($this->temp_file[$cnt] != '') { 210 210 $filepath = $this->temp_dir . $this->temp_file[$cnt]; 211 211 } … … 222 222 223 223 foreach ($this->keyname as $val) { 224 if (isset($this->temp_file[$cnt]) && $this->temp_file[$cnt] != "") {224 if (isset($this->temp_file[$cnt]) && $this->temp_file[$cnt] != '') { 225 225 226 226 $objImage->moveTempImage($this->temp_file[$cnt], $this->save_dir); … … 228 228 // すでに保存ファイルがあった場合は削除する。 229 229 if(isset($this->save_file[$cnt]) 230 && $this->save_file[$cnt] != ""231 && !ereg( "^sub/", $this->save_file[$cnt])) {230 && $this->save_file[$cnt] != '' 231 && !ereg('^sub/', $this->save_file[$cnt])) { 232 232 233 233 $objImage->deleteImage($this->save_file[$cnt], $this->save_dir); … … 243 243 $objImage = new SC_Image_Ex($this->temp_dir); 244 244 foreach ($this->keyname as $val) { 245 if (isset($this->temp_file[$cnt]) && $this->temp_file[$cnt] != "") {245 if (isset($this->temp_file[$cnt]) && $this->temp_file[$cnt] != '') { 246 246 $objImage->moveTempImage($this->temp_file[$cnt], $this->save_dir); 247 247 // すでに保存ファイルがあった場合は削除する。 248 248 if(isset($this->save_file[$cnt]) 249 && $this->save_file[$cnt] != ""250 && !ereg( "^sub/", $this->save_file[$cnt]))249 && $this->save_file[$cnt] != '' 250 && !ereg('^sub/', $this->save_file[$cnt])) 251 251 { 252 252 $objImage->deleteImage($this->save_file[$cnt], $this->save_dir); … … 265 265 $arrRet['temp_' . $val] = $this->temp_file[$cnt]; 266 266 } 267 if (isset($this->save_file[$cnt]) && $this->save_file[$cnt] != "") {267 if (isset($this->save_file[$cnt]) && $this->save_file[$cnt] != '') { 268 268 $arrRet['save_' . $val] = $this->save_file[$cnt]; 269 269 } … … 309 309 $cnt = 0; 310 310 foreach ($this->keyname as $val) { 311 if (isset($this->temp_file[$cnt]) && $this->temp_file[$cnt] != "") {311 if (isset($this->temp_file[$cnt]) && $this->temp_file[$cnt] != '') { 312 312 // ファイルパスチェック(パスのスラッシュ/が連続しないようにする。) 313 313 if (ereg("/$", $temp_url)) { 314 314 $arrRet[$val]['filepath'] = $temp_url . $this->temp_file[$cnt]; 315 315 } else { 316 $arrRet[$val]['filepath'] = $temp_url . "/". $this->temp_file[$cnt];316 $arrRet[$val]['filepath'] = $temp_url . '/' . $this->temp_file[$cnt]; 317 317 } 318 318 $arrRet[$val]['real_filepath'] = $this->temp_dir . $this->temp_file[$cnt]; 319 } elseif (isset($this->save_file[$cnt]) && $this->save_file[$cnt] != "") {319 } elseif (isset($this->save_file[$cnt]) && $this->save_file[$cnt] != '') { 320 320 // ファイルパスチェック(パスのスラッシュ/が連続しないようにする。) 321 321 if (ereg("/$", $save_url)) { 322 322 $arrRet[$val]['filepath'] = $save_url . $this->save_file[$cnt]; 323 323 } else { 324 $arrRet[$val]['filepath'] = $save_url . "/". $this->save_file[$cnt];324 $arrRet[$val]['filepath'] = $save_url . '/' . $this->save_file[$cnt]; 325 325 } 326 326 $arrRet[$val]['real_filepath'] = $this->save_dir . $this->save_file[$cnt]; … … 351 351 // フォームに渡す用のダウンロードファイル情報を返す 352 352 function getFormDownFile() { 353 $arrRet = "";354 $cnt = 0; 355 foreach ($this->keyname as $val) { 356 if (isset($this->temp_file[$cnt]) && $this->temp_file[$cnt] != "") {353 $arrRet = ''; 354 $cnt = 0; 355 foreach ($this->keyname as $val) { 356 if (isset($this->temp_file[$cnt]) && $this->temp_file[$cnt] != '') { 357 357 $arrRet = $this->temp_file[$cnt]; 358 } elseif (isset($this->save_file[$cnt]) && $this->save_file[$cnt] != "") {358 } elseif (isset($this->save_file[$cnt]) && $this->save_file[$cnt] != '') { 359 359 $arrRet = $this->save_file[$cnt]; 360 360 } … … 369 369 if (isset($this->temp_file[$cnt])) { 370 370 $arrRet[$val] = $this->temp_file[$cnt]; 371 } elseif (isset($this->save_file[$cnt]) && $this->save_file[$cnt] != "") {371 } elseif (isset($this->save_file[$cnt]) && $this->save_file[$cnt] != '') { 372 372 $arrRet[$val] = $this->save_file[$cnt]; 373 373 } … … 381 381 $cnt = 0; 382 382 foreach ($this->keyname as $val) { 383 if (isset($this->temp_file[$cnt]) && $this->temp_file[$cnt] != "") {383 if (isset($this->temp_file[$cnt]) && $this->temp_file[$cnt] != '') { 384 384 $arrRet[$val] = $this->temp_file[$cnt]; 385 385 } else { 386 $arrRet[$val] = isset($this->save_file[$cnt]) ? $this->save_file[$cnt] : "";386 $arrRet[$val] = isset($this->save_file[$cnt]) ? $this->save_file[$cnt] : ''; 387 387 } 388 388 $cnt++; … … 395 395 $cnt = 0; 396 396 foreach ($this->keyname as $val) { 397 if (isset($arrVal[$val]) && $arrVal[$val] != "") {397 if (isset($arrVal[$val]) && $arrVal[$val] != '') { 398 398 $this->save_file[$cnt] = $arrVal[$val]; 399 399 } … … 424 424 $cnt = 0; 425 425 foreach ($this->keyname as $val) { 426 if ($arrVal[$val] != ""&& $val == 'tv_products_image') {426 if ($arrVal[$val] != '' && $val == 'tv_products_image') { 427 427 $this->save_file[$cnt] = $arrVal[$val]; 428 428 } … … 436 436 $cnt = 0; 437 437 foreach ($this->keyname as $val) { 438 if ($arrVal[$val] != "") {439 if ($this->save_file[$cnt] == "" && !ereg("^sub/", $arrVal[$val])) {438 if ($arrVal[$val] != '') { 439 if ($this->save_file[$cnt] == '' && !ereg('^sub/', $arrVal[$val])) { 440 440 $objImage->deleteImage($arrVal[$val], $this->save_dir); 441 441 } … … 449 449 $objImage = new SC_Image_Ex($this->temp_dir); 450 450 $cnt = 0; 451 if ($arrVal['down_realfilename'] != "") {452 if ($this->save_file[$cnt] == "" && !ereg("^sub/", $arrVal['down_realfilename'])) {451 if ($arrVal['down_realfilename'] != '') { 452 if ($this->save_file[$cnt] == '' && !ereg('^sub/', $arrVal['down_realfilename'])) { 453 453 $objImage->deleteImage($arrVal['down_realfilename'], $this->save_dir); 454 454 } … … 457 457 458 458 // 必須判定 459 function checkEXISTS($keyname = "") {459 function checkEXISTS($keyname = '') { 460 460 $cnt = 0; 461 461 $arrRet = array(); 462 462 foreach ($this->keyname as $val) { 463 if ($val == $keyname || $keyname == "") {463 if ($val == $keyname || $keyname == '') { 464 464 // 必須であればエラーチェック 465 465 if ($this->necessary[$cnt] == true) { 466 if (!isset($this->save_file[$cnt])) $this->save_file[$cnt] = "";467 if (!isset($this->temp_file[$cnt])) $this->temp_file[$cnt] = "";468 if($this->save_file[$cnt] == ""469 && $this->temp_file[$cnt] == "") {470 $arrRet[$val] = "※ " . $this->disp_name[$cnt] . "がアップロードされていません。<br>";466 if (!isset($this->save_file[$cnt])) $this->save_file[$cnt] = ''; 467 if (!isset($this->temp_file[$cnt])) $this->temp_file[$cnt] = ''; 468 if($this->save_file[$cnt] == '' 469 && $this->temp_file[$cnt] == '') { 470 $arrRet[$val] = '※ ' . $this->disp_name[$cnt] . 'がアップロードされていません。<br>'; 471 471 } 472 472 } … … 479 479 // 拡大率を指定して画像保存 480 480 function saveResizeImage($keyname, $to_w, $to_h) { 481 $path = "";481 $path = ''; 482 482 483 483 // keynameの添付ファイルを取得 … … 499 499 * @return string 500 500 */ 501 function lfGetTmpImageName($rename, $keyname = "", $uploadfile = "") {501 function lfGetTmpImageName($rename, $keyname = '', $uploadfile = '') { 502 502 503 503 if ($rename === true) {
Note: See TracChangeset
for help on using the changeset viewer.
