diff --git a/filemanager/inc/class.filemanager_ui.inc.php b/filemanager/inc/class.filemanager_ui.inc.php index 41a5ec4a26..7802f7315e 100644 --- a/filemanager/inc/class.filemanager_ui.inc.php +++ b/filemanager/inc/class.filemanager_ui.inc.php @@ -448,7 +448,6 @@ class filemanager_ui { $content['perms']['executable'] = (int)!!($content['mode'] & 0111); $mask = 6; - $content['link'] = $GLOBALS['egw']->link(egw_vfs::download_url($path)); if (preg_match('/^text/',$content['mime']) && $content['size'] < 100000) { $content['text_content'] = file_get_contents(egw_vfs::PREFIX.$path); @@ -468,7 +467,7 @@ class filemanager_ui else { //_debug_array($content); - $path = $content['path']; + $path =& $content['path']; list($button) = @each($content['button']); unset($content['button']); if (in_array($button,array('save','apply'))) @@ -483,8 +482,13 @@ class filemanager_ui if (egw_vfs::rename($path,$to = egw_vfs::concat($content['dir'],$content['name']))) { $msg .= lang('Renamed %1 to %2.',$path,$to).' '; + $content['old']['name'] = $content[$name]; + $path = $to; + } + else + { + $msg .= lang('Rename of %1 to %2 failed!',$path,$to).' '; } - $path = $to; break; default: static $name2cmd = array('uid' => 'chown','gid' => 'chgrp','perms' => 'chmod'); @@ -531,11 +535,16 @@ class filemanager_ui } } // refresh opender and close our window - $js = "opener.location.href=opener.location.href+'&msg=".urlencode(addslashes($msg))."'; "; + $link = egw::link('/index.php',array( + 'menuaction' => 'filemanager.filemanager_ui.index', + 'msg' => $msg, + )); + $js = "opener.location.href='".addslashes($link)."'; "; if ($button == 'save') $js .= "window.close();"; echo "\n\n\n\n\n"; if ($button == 'save')$GLOBALS['egw']->common->egw_exit(); } + $content['link'] = $GLOBALS['egw']->link(egw_vfs::download_url($path)); $content['msg'] = $msg; if (($readonlys['uid'] = !egw_vfs::$is_root) && !$content['uid']) $content['ro_uid_root'] = 'root'; diff --git a/phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php b/phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php index bd66e41eaf..60f80f8af4 100644 --- a/phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php +++ b/phpgwapi/inc/class.sqlfs_stream_wrapper.inc.php @@ -500,6 +500,13 @@ class sqlfs_stream_wrapper implements iface_stream_wrapper if (self::LOG_LEVEL) error_log(__METHOD__."($url_to,$url_from) $path_to is $is_dir directory!"); return false; // no permission or file does not exist } + // if destination file already exists, delete it + if ($to_stat && !self::unlink($url_to,$operation)) + { + self::_remove_password($url_to); + if (self::LOG_LEVEL) error_log(__METHOD__."($url_to,$url_from) can't unlink existing $url_to!"); + return false; + } $stmt = self::$pdo->prepare('UPDATE '.self::TABLE.' SET fs_dir=:fs_dir,fs_name=:fs_name WHERE fs_id=:fs_id'); if (($ret = $stmt->execute(array( ':fs_dir' => $to_dir_stat['ino'],