Skip to content

Commit

Permalink
Show default upload path when creating project
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
davidhicks committed Jun 16, 2009
1 parent 748d601 commit 7871f6c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions manage_proj_create.php
Expand Up @@ -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() ) ) {
Expand Down
7 changes: 6 additions & 1 deletion manage_proj_create_page.php
Expand Up @@ -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' );
}
?>
<tr class="row-2">
<td class="category">
<?php echo lang_get( 'upload_file_path' ) ?>
</td>
<td>
<input type="text" name="file_path" size="70" maxlength="250" />
<input type="text" name="file_path" size="70" maxlength="250" value="<?php echo $t_default_upload_path ?>" />
</td>
</tr>
<?php
Expand Down

0 comments on commit 7871f6c

Please sign in to comment.