Changeset 2086
- Timestamp:
- 01/22/08 04:08:10 (10 months ago)
- Files:
-
- alternc/trunk/bureau/class/m_bro.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
alternc/trunk/bureau/class/m_bro.php
r2083 r2086 453 453 454 454 /** 455 * Copy many files from point A to point B 456 */ 457 function CopyFile($d,$old,$new) { 458 global $err; 459 $old=$this->convertabsolute($old,0); 460 if (!$old) { 461 $err->raise("bro",1); 462 return false; 463 } 464 $new=$this->convertabsolute($new,0); 465 if (!$new) { 466 $err->raise("bro",1); 467 return false; 468 } 469 if ($old==$new) { 470 $err->raise("bro",2); 471 return false; 472 } 473 for ($i=0;$i<count($d);$i++) { 474 $d[$i]=ssla($d[$i]); // strip slashes if needed 475 if (!strpos($d[$i],"/") && file_exists($old."/".$d[$i]) && !file_exists($new."/".$d[$i])) { 476 $this->CopyOneFile($old."/".$d[$i],$new); 477 } 478 } 479 return true; 480 } 481 482 /** 455 483 * Copy a source to a destination by either copying recursively a 456 484 * directory or by downloading a file with a URL (only http:// is 457 485 * supported) 458 * @param string $name is the application name459 486 * @param string $src is the path or URL 460 487 * @param string $dest is the absolute path inside the users directory 461 488 * @return boolean false on error 462 */ 463 function CopyFile($name, $src, $dest) 489 * 490 * Note that we assume that the inputs have been convertabsolute()'d 491 */ 492 function CopyOneFile($src, $dest) 464 493 { 465 494 global $err; … … 521 550 522 551 // Last step // Copy -R 523 $src = $this->convertabsolute($src);524 $dest = $this->convertabsolute($dest);525 if (!$src || !$dest) {526 $err->raise("bro",1);527 return false;528 }529 552 $src = escapeshellarg($src); 530 553 $dest = escapeshellarg($dest);
