Replace basename with Vfs::basename to avoid setlocale issue.

This commit is contained in:
Hadi Nategh 2018-08-01 10:01:34 +02:00
parent 3dd2ee24c1
commit 8a050968e8
2 changed files with 9 additions and 9 deletions

View File

@ -748,7 +748,7 @@ class StreamWrapper implements StreamWrapperIface
(!self::HIDE_UNREADABLES || $this->opened_dir_writable || (!self::HIDE_UNREADABLES || $this->opened_dir_writable ||
Vfs::check_access($mounted,Vfs::READABLE))) Vfs::check_access($mounted,Vfs::READABLE)))
{ {
$this->extra_dirs[] = basename($mounted); $this->extra_dirs[] = Vfs::basename($mounted);
} }
} }
@ -852,14 +852,14 @@ class StreamWrapper implements StreamWrapperIface
} }
// check if a failed url_stat was for a home dir, in that case silently create it // check if a failed url_stat was for a home dir, in that case silently create it
if (!$stat && $try_create_home && Vfs::dirname(Vfs::parse_url($path,PHP_URL_PATH)) == '/home' && if (!$stat && $try_create_home && Vfs::dirname(Vfs::parse_url($path,PHP_URL_PATH)) == '/home' &&
($id = $GLOBALS['egw']->accounts->name2id(basename($path))) && ($id = $GLOBALS['egw']->accounts->name2id(Vfs::basename($path))) &&
$GLOBALS['egw']->accounts->id2name($id) == basename($path)) // make sure path has the right case! $GLOBALS['egw']->accounts->id2name($id) == Vfs::basename($path)) // make sure path has the right case!
{ {
$hook_data = array( $hook_data = array(
'location' => $GLOBALS['egw']->accounts->get_type($id) == 'g' ? 'addgroup' : 'addaccount', 'location' => $GLOBALS['egw']->accounts->get_type($id) == 'g' ? 'addgroup' : 'addaccount',
'account_id' => $id, 'account_id' => $id,
'account_lid' => basename($path), 'account_lid' => Vfs::basename($path),
'account_name' => basename($path), 'account_name' => Vfs::basename($path),
); );
call_user_func(array(__NAMESPACE__.'\\Hooks',$hook_data['location']),$hook_data); call_user_func(array(__NAMESPACE__.'\\Hooks',$hook_data['location']),$hook_data);
unset($hook_data); unset($hook_data);

View File

@ -199,9 +199,9 @@ class WebDAV extends HTTP_WebDAV_Server_Filesystem
if (!$options["overwrite"]) { if (!$options["overwrite"]) {
return "412 precondition failed"; return "412 precondition failed";
} }
$dest .= basename($source); $dest .= Vfs::basename($source);
if (file_exists($dest)) { if (file_exists($dest)) {
$options["dest"] .= basename($source); $options["dest"] .= Vfs::basename($source);
} else { } else {
$new = true; $new = true;
$existing_col = true; $existing_col = true;
@ -737,11 +737,11 @@ class WebDAV extends HTTP_WebDAV_Server_Filesystem
if (substr($file['path'],-1) == '/') if (substr($file['path'],-1) == '/')
{ {
$name = basename(substr($file['path'],0,-1)).'/'; $name = Vfs::basename(substr($file['path'],0,-1)).'/';
} }
else else
{ {
$name = basename($file['path']); $name = Vfs::basename($file['path']);
} }
echo "\t<tr class='$class'>\n\t\t<td>$n</td>\n\t\t<td>". echo "\t<tr class='$class'>\n\t\t<td>$n</td>\n\t\t<td>".