forked from extern/egroupware
"fixed redirection loop, if ented path does not exist"
This commit is contained in:
parent
587e9ba581
commit
bee370fa61
@ -67,14 +67,8 @@ class filemanager_ui
|
|||||||
'default_cols' => '!comment,ctime', // I columns to use if there's no user or default pref (! as first char uses all but the named columns), default all columns
|
'default_cols' => '!comment,ctime', // I columns to use if there's no user or default pref (! as first char uses all but the named columns), default all columns
|
||||||
'csv_fields' => false, // I false=disable csv export, true or unset=enable it with auto-detected fieldnames,
|
'csv_fields' => false, // I false=disable csv export, true or unset=enable it with auto-detected fieldnames,
|
||||||
//or array with name=>label or name=>array('label'=>label,'type'=>type) pairs (type is a eT widget-type)
|
//or array with name=>label or name=>array('label'=>label,'type'=>type) pairs (type is a eT widget-type)
|
||||||
'path' => '/home/'.$GLOBALS['egw_info']['user']['account_lid'],
|
|
||||||
);
|
);
|
||||||
// check if user specified a valid startpath in his prefs --> use it
|
$content['nm']['path'] = self::get_home_dir();
|
||||||
if (($path = $GLOBALS['egw_info']['user']['preferences']['filemanager']['startfolder']) &&
|
|
||||||
$path[0] == '/' && egw_vfs::is_dir($path) && egw_vfs::check_access($path, egw_vfs::READABLE))
|
|
||||||
{
|
|
||||||
$content['nm']['path'] = $path;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (isset($_GET['msg'])) $msg = $_GET['msg'];
|
if (isset($_GET['msg'])) $msg = $_GET['msg'];
|
||||||
if (isset($_GET['path']) && ($path = $_GET['path']))
|
if (isset($_GET['path']) && ($path = $_GET['path']))
|
||||||
@ -131,7 +125,7 @@ class filemanager_ui
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'home':
|
case 'home':
|
||||||
$content['nm']['path'] = '/home/'.$GLOBALS['egw_info']['user']['account_lid'];
|
$content['nm']['path'] = self::get_home_dir();
|
||||||
break;
|
break;
|
||||||
case 'createdir':
|
case 'createdir':
|
||||||
if ($content['nm']['path'][0] != '/')
|
if ($content['nm']['path'][0] != '/')
|
||||||
@ -200,6 +194,24 @@ class filemanager_ui
|
|||||||
$tpl->exec('filemanager.filemanager_ui.index',$content,$sel_options,$readonlys,array('nm' => $content['nm']));
|
$tpl->exec('filemanager.filemanager_ui.index',$content,$sel_options,$readonlys,array('nm' => $content['nm']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the configured start directory for the current user
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
static function get_home_dir()
|
||||||
|
{
|
||||||
|
$start = '/home/'.$GLOBALS['egw_info']['user']['account_lid'];
|
||||||
|
|
||||||
|
// check if user specified a valid startpath in his prefs --> use it
|
||||||
|
if (($path = $GLOBALS['egw_info']['user']['preferences']['filemanager']['startfolder']) &&
|
||||||
|
$path[0] == '/' && egw_vfs::is_dir($path) && egw_vfs::check_access($path, egw_vfs::READABLE))
|
||||||
|
{
|
||||||
|
$start = $path;
|
||||||
|
}
|
||||||
|
return $start;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert numbers like '32M' or '512k' to integers
|
* Convert numbers like '32M' or '512k' to integers
|
||||||
*
|
*
|
||||||
@ -373,17 +385,14 @@ class filemanager_ui
|
|||||||
{
|
{
|
||||||
$GLOBALS['egw']->session->appsession('index','filemanager',$query);
|
$GLOBALS['egw']->session->appsession('index','filemanager',$query);
|
||||||
|
|
||||||
if (!egw_vfs::is_dir($query['path'])
|
if (!egw_vfs::is_dir($query['path']) || !egw_vfs::check_access($query['path'],egw_vfs::READABLE))
|
||||||
|| !egw_vfs::check_access($query['path'],egw_vfs::READABLE))
|
|
||||||
{
|
{
|
||||||
$rows = array();
|
|
||||||
$query['total'] = 0;
|
|
||||||
// we will leave here, since we are not allowed, or the location does not exist. Index must handle that, and give
|
// we will leave here, since we are not allowed, or the location does not exist. Index must handle that, and give
|
||||||
// an appropriate message
|
// an appropriate message
|
||||||
$GLOBALS['egw']->redirect($GLOBALS['egw']->link('/index.php',array('menuaction'=>'filemanager.filemanager_ui.index',
|
egw::redirect_link('/index.php',array('menuaction'=>'filemanager.filemanager_ui.index',
|
||||||
'path'=>$query['path'],
|
'path' => self::get_home_dir(),
|
||||||
'msg' => lang('Directory not found or no permission to access it!'))));
|
'msg' => lang('The requested path %1 is not available.',$query['path']),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
$rows = $dir_is_writable = array();
|
$rows = $dir_is_writable = array();
|
||||||
if($query['searchletter'] && !empty($query['search']))
|
if($query['searchletter'] && !empty($query['search']))
|
||||||
|
Loading…
Reference in New Issue
Block a user