From 7871f6cf2b9437efe8daa8b7b0d1675e0f578150 Mon Sep 17 00:00:00 2001 From: David Hicks Date: Wed, 17 Jun 2009 07:06:06 +1000 Subject: [PATCH] Show default upload path when creating project Implementation of bug #8250 When creating a project, the user has an option to specify a separate upload folder on a per-project basis. Previously this field was left blank by default. This patch shows the default value to the user - as long as they're an administrator. This helps make it a little easier to see if a new path needs to be specified that is different from the default. For security reasons the absolute upload path is only shown to administrators. --- manage_proj_create.php | 7 +++++++ manage_proj_create_page.php | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/manage_proj_create.php b/manage_proj_create.php index b7b5f29241..444b1bc1a2 100644 --- a/manage_proj_create.php +++ b/manage_proj_create.php @@ -46,6 +46,13 @@ project_ensure_exists( $f_parent_id ); } + # If the provided path is the same as the default, make the path blank. + # This means that if the default upload path is changed, you don't have + # to update the upload path for every single project. + if ( !strcmp( $f_file_path, config_get( 'absolute_path_default_upload_folder' ) ) ) { + $f_file_path = ''; + } + $t_project_id = project_create( strip_tags( $f_name ), $f_description, $f_status, $f_view_state, $f_file_path, true, $f_inherit_global ); if ( ( $f_view_state == VS_PRIVATE ) && ( false === current_user_is_administrator() ) ) { diff --git a/manage_proj_create_page.php b/manage_proj_create_page.php index 7faf78d717..00c2a71d7a 100644 --- a/manage_proj_create_page.php +++ b/manage_proj_create_page.php @@ -107,13 +107,18 @@ } if ( config_get( 'allow_file_upload' ) ) { + $t_default_upload_path = ''; + # Don't reveal the absolute path to non-administrators for security reasons + if ( current_user_is_administrator ) { + $t_default_upload_path = config_get( 'absolute_path_default_upload_folder' ); + } ?> - +