- handle wrong user inputs on filemanger url and dirs
- get mimes from phpgwapi
This commit is contained in:
Cornelius Weiß 2005-11-16 10:53:38 +00:00
parent d78f9d83da
commit 2e1d4cbc59
3 changed files with 6 additions and 3 deletions

View File

@ -47,12 +47,15 @@
} }
$sessdata = $GLOBALS['egw']->session->appsession('UploadImage','phpgwapi'); $sessdata = $GLOBALS['egw']->session->appsession('UploadImage','phpgwapi');
// upload_dir needs a ending slash
$sessdata['upload_dir'] = substr($sessdata['upload_dir'],-1) == '/' ? $sessdata['upload_dir'] : $sessdata['upload_dir'] . '/';
if(is_writeable($sessdata['upload_dir'])) if(is_writeable($sessdata['upload_dir']))
{ {
$MY_DOCUMENT_ROOT = $BASE_DIR = $sessdata['upload_dir']; $MY_DOCUMENT_ROOT = $BASE_DIR = $sessdata['upload_dir'];
if (isset($sessdata['upload_url']) && !empty($sessdata['upload_url'])) if (isset($sessdata['upload_url']) && !empty($sessdata['upload_url']))
{ {
$MY_BASE_URL = $sessdata['upload_url']; // base url must not have a ending slash
$MY_BASE_URL = substr($sessdata['upload_url'],-1) == '/' ? substr($sessdata['upload_url'],0,-1) : $sessdata['upload_url'];
} }
else else
{ {

View File

@ -502,7 +502,7 @@ $view = new $classname;
$params['time'] = $time = filemtime($absolutePath); $params['time'] = $time = filemtime($absolutePath);
$params['parsed_size'] = $parsed_size = parse_size($size); $params['parsed_size'] = $parsed_size = parse_size($size);
$params['parsed_time'] = $parsed_time = parse_time($time); $params['parsed_time'] = $parsed_time = parse_time($time);
$params['parsed_icon'] = $parsed_icon = 'img/ext/'.parse_icon($ext); $params['parsed_icon'] = $parsed_icon = $GLOBALS['egw_info']['server']['webserver_url']. '/phpgwapi/templates/default/images/mime/'. parse_icon($ext);
$params['fileNb'] = $fileNb; $params['fileNb'] = $fileNb;
$files_body .= $view->files_item($params); $files_body .= $view->files_item($params);
$fileJSArray .= "['".$parsed_icon."', '".sanitize2($entry)."', '".$parsed_size."', '".$parsed_time."', '".$ext."'],\n"; $fileJSArray .= "['".$parsed_icon."', '".sanitize2($entry)."', '".$parsed_size."', '".$parsed_time."', '".$ext."'],\n";

View File

@ -93,7 +93,7 @@ function onOK() {
if(fileItems != 1) { if(fileItems != 1) {
var strId = fileItems[i].getAttribute("id").toString(); var strId = fileItems[i].getAttribute("id").toString();
var trId = parseInt(strId.substring(1, strId.length)); var trId = parseInt(strId.substring(1, strId.length));
param['f_icon'] = editor_url+plugin_url+fileManager.fileJSArray[trId][0]; param['f_icon'] = fileManager.fileJSArray[trId][0];
param['f_size'] = fileManager.fileJSArray[trId][2]; param['f_size'] = fileManager.fileJSArray[trId][2];
param['f_date'] = fileManager.fileJSArray[trId][3]; param['f_date'] = fileManager.fileJSArray[trId][3];
} }