From c55e0bdae30cab8dd91e80a804f11174d13d494d Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Fri, 28 Apr 2017 12:40:33 +0200 Subject: [PATCH] WIP of background & logo image upload into instance dir: - Generate url for anon_images.php --- admin/inc/class.admin_config.inc.php | 14 +++++++------- admin/templates/default/config.xet | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/admin/inc/class.admin_config.inc.php b/admin/inc/class.admin_config.inc.php index 765d99f2cc..a6676515fc 100644 --- a/admin/inc/class.admin_config.inc.php +++ b/admin/inc/class.admin_config.inc.php @@ -20,28 +20,28 @@ class admin_config var $public_functions = array('index' => True); /** - * Upload function to store files into instance files_dir + * Upload function to store anonymous images into instance files_dir/anon_images * * @param type $file file info array * @param type $dir directory to store file * */ - function ajax_upload ($file, $dir = null) + function ajax_upload_anon_images ($file) { - $files_dir = $dir ? $dir : $GLOBALS['egw_info']['server']['files_dir'].'/unknown_images'; + $path = $GLOBALS['egw_info']['server']['files_dir'].'/anon-images'; $success = false; $response = Api\Json\Response::get(); - if (is_array($file) && is_writable(dirname($files_dir))) + if (is_array($file) && is_writable(dirname($path))) { - if (!is_dir($files_dir)) mkdir ($files_dir); + if (!is_dir($path)) mkdir ($path); $tmp_file = array_keys($file); - $destination = $files_dir.'/'.$file[$tmp_file[0]]['name']; + $destination = $path.'/'.$file[$tmp_file[0]]['name']; $success = rename($GLOBALS['egw_info']['server']['temp_dir'].'/'.$tmp_file[0],$destination); } if ($success) { $response->data(array( - 'path' => $destination + 'path' => $GLOBALS['egw_info']['server']['webserver_url'].'/api/anon_images.php?src='.$file[$tmp_file[0]]['name'] )); } else diff --git a/admin/templates/default/config.xet b/admin/templates/default/config.xet index dd3058d971..c1cbbf20f1 100644 --- a/admin/templates/default/config.xet +++ b/admin/templates/default/config.xet @@ -54,7 +54,7 @@ - + @@ -69,7 +69,7 @@ - +