Beispiel #1
0
 /**
  * copyFiles
  * 
  * @param string $d
  * @param string $dest
  * @param string $static
  * @param bool   $overwrite
  * @return string
  */
 public function copyFiles($d = '', $dest = '', $static = '', $overwrite = false)
 {
     $error = array();
     foreach (self::$_instance->iterator($d) as $file) {
         if ($file == $static) {
             continue;
         }
         if ($d == $dest) {
             break;
         }
         $ch = $this->lookChmod($d . '/' . $file);
         if (self::$_instance->is_dir($d . '/' . $file)) {
             if (self::$_instance->mkdir($dest . '/' . $file, $ch)) {
                 self::$_instance->chmod($dest . '/' . $file, $ch);
                 $this->copyFiles($d . '/' . $file, $dest . '/' . $file, $static, $overwrite);
             } else {
                 $error[] = str_replace('%title%', htmlspecialchars($d . '/' . $file, ENT_NOQUOTES), Language::get('copy_files_false')) . ' (' . Errors::get() . ')';
             }
         } else {
             if ($overwrite || !self::$_instance->file_exists($dest . '/' . $file)) {
                 if (Registry::get('sysType') != 'WIN' && self::$_instance->is_link($d . '/' . $file)) {
                     if (!self::$_instance->symlink($d . '/' . $file, $dest . '/' . $file, $ch)) {
                         $error[] = str_replace('%file%', htmlspecialchars($d . '/' . $file, ENT_NOQUOTES), Language::get('copy_file_false')) . ' (' . Errors::get() . ')';
                     }
                 } else {
                     if (!self::$_instance->copy($d . '/' . $file, $dest . '/' . $file, $ch)) {
                         $error[] = str_replace('%file%', htmlspecialchars($d . '/' . $file, ENT_NOQUOTES), Language::get('copy_file_false')) . ' (' . Errors::get() . ')';
                     }
                 }
             } else {
                 $error[] = Language::get('overwrite_false') . ' (' . htmlspecialchars($dest . '/' . $file, ENT_NOQUOTES) . ')';
             }
         }
     }
     if ($error) {
         return Helper_View::message(implode('<br/>', $error), Helper_View::MESSAGE_ERROR_EMAIL);
     } else {
         return Helper_View::message(str_replace('%title%', htmlspecialchars($dest, ENT_NOQUOTES), Language::get('copy_files_true')), Helper_View::MESSAGE_SUCCESS);
     }
 }