Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mantisbt/mantisbt
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2c916ddd6313
Choose a base ref
...
head repository: mantisbt/mantisbt
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 8ae62f3621d8
Choose a head ref
  • 7 commits
  • 6 files changed
  • 1 contributor

Commits on Sep 20, 2012

  1. Cloning issues with attachments fails after upload folder changed

    With attachments stored on disk, if the project's upload directory
    changes and the files are moved to the new location, it is no longer
    possible to clone issues.
    
    The file_copy_attachments() function was modified to use the same logic
    as elsewhere in MantisBT, i.e. rely on file_normalize_attachment_path()
    to determine the attachment's path.
    
    Fixes #14718
    dregad committed Sep 20, 2012

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    27aa2b8 View commit details
  2. Force validation of upload path if file_upload_method != DATABASE

    Prior to this, the upload path would not be checked if it was empty
    (ie. defaulting to $g_absolute_path_default_upload_folder),
    which could cause issues if that directory was missing or read-only.
    
    Checking this early allows catching any errors before users perform
    actual operations on file attachments.
    
    Fixes #14723
    dregad committed Sep 20, 2012
    Copy the full SHA
    27f5b4f View commit details

Commits on Sep 21, 2012

  1. Hide file upload path on project create page if storage is DB

    The logic implemented in 7aa07d8 for
    manage_proj_edit_page.php also applies to manage_proj_create_page.php.
    
    Fixes #14700
    dregad committed Sep 21, 2012
    Copy the full SHA
    714c2a1 View commit details
  2. Fix inconsistent behavior of upload path field hiding

    config_get() would return the file upload method for the current
    project, instead of the one for the project being edited.
    
    Use of $g_project_override for expected behavior.
    
    Fixes #14700
    dregad committed Sep 21, 2012
    Copy the full SHA
    33dfba5 View commit details
  3. Make Manage Project Create and Edit pages consistent

    The following changes were made:
    
     - Display the fields in the same order
     - Make the fields identical length
     - Display the "required" star next to project name
     - Use identical variable names
    
    Fixes #14725
    dregad committed Sep 21, 2012
    Copy the full SHA
    e90ef63 View commit details
  4. Fix config_get behavior with $g_project_override = ALL_PROJECTS

    Fixes #14724, affects #14700
    dregad committed Sep 21, 2012
    Copy the full SHA
    c7b1da5 View commit details
  5. Fix #14721: XML Parsing Error in print_all_bug_page_word.php

    Revised code so that generated page complies with xhtml 1.0 strict DTD.
    dregad committed Sep 21, 2012
    Copy the full SHA
    8ae62f3 View commit details
Showing with 86 additions and 57 deletions.
  1. +1 −1 core/config_api.php
  2. +16 −4 core/file_api.php
  3. +7 −2 core/project_api.php
  4. +25 −22 manage_proj_create_page.php
  5. +15 −15 manage_proj_edit_page.php
  6. +22 −13 print_all_bug_page_word.php
2 changes: 1 addition & 1 deletion core/config_api.php
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@ function config_get( $p_option, $p_default = null, $p_user = null, $p_project =
# @@ debug @@ if ($t_bypass_lookup) { echo "bp=$p_option match=$t_match_pattern <br />"; }

if( !$t_bypass_lookup ) {
if( $g_project_override != null && $p_project == null ) {
if( $g_project_override !== null && $p_project === null ) {
$p_project = $g_project_override;
}
# @@ debug @@ if ( ! db_is_connected() ) { echo "no db "; }
20 changes: 16 additions & 4 deletions core/file_api.php
Original file line number Diff line number Diff line change
@@ -1035,18 +1035,30 @@ function file_copy_attachments( $p_source_bug_id, $p_dest_bug_id ) {
$result = db_query_bound( $query, Array( $p_source_bug_id ) );
$t_count = db_num_rows( $result );

$t_project_id = bug_get_field( $p_source_bug_id, 'project_id' );

$t_bug_file = array();
for( $i = 0;$i < $t_count;$i++ ) {
$t_bug_file = db_fetch_array( $result );

# prepare the new diskfile name and then copy the file
$t_file_path = $t_bug_file['folder'];
$t_source_file = $t_bug_file['folder'] . $t_bug_file['diskfile'];
if(( config_get( 'file_upload_method' ) == DISK ) ) {
$t_source_file = file_normalize_attachment_path( $t_source_file, $t_project_id );
$t_file_path = dirname( $t_source_file ) . DIRECTORY_SEPARATOR;
} else {
$t_file_path = $t_bug_file['folder'];
}
$t_new_diskfile_name = file_generate_unique_name( 'bug-' . $t_bug_file['filename'], $t_file_path );
$t_new_diskfile_location = $t_file_path . $t_new_diskfile_name;
$t_new_file_name = file_get_display_name( $t_bug_file['filename'] );
if(( config_get( 'file_upload_method' ) == DISK ) ) {
copy( $t_file_path.$t_bug_file['diskfile'], $t_new_diskfile_location );
chmod( $t_new_diskfile_location, config_get( 'attachments_file_permissions' ) );
# Skip copy operation if file does not exist (i.e. target bug will have missing attachment)
# @todo maybe we should trigger an error instead in this case ?
if( file_exists( $t_source_file ) ) {
copy( $t_source_file, $t_new_diskfile_location );
chmod( $t_new_diskfile_location, config_get( 'attachments_file_permissions' ) );
}
}

$query = "INSERT INTO $t_mantis_bug_file_table
@@ -1061,7 +1073,7 @@ function file_copy_attachments( $p_source_bug_id, $p_dest_bug_id ) {
" . db_param() . ",
" . db_param() . ",
" . db_param() . ");";
db_query_bound( $query, Array( $p_dest_bug_id, $t_bug_file['title'], $t_bug_file['description'], $t_new_diskfile_name, $t_new_file_name, $t_bug_file['folder'], $t_bug_file['filesize'], $t_bug_file['file_type'], $t_bug_file['date_added'], $t_bug_file['content'] ) );
db_query_bound( $query, Array( $p_dest_bug_id, $t_bug_file['title'], $t_bug_file['description'], $t_new_diskfile_name, $t_new_file_name, $t_file_path, $t_bug_file['filesize'], $t_bug_file['file_type'], $t_bug_file['date_added'], $t_bug_file['content'] ) );
}
}

9 changes: 7 additions & 2 deletions core/project_api.php
Original file line number Diff line number Diff line change
@@ -308,7 +308,10 @@ function project_create( $p_name, $p_description, $p_status, $p_view_state = VS_

project_ensure_name_unique( $p_name );

$p_file_path = validate_project_file_path( $p_file_path );
# Project does not exist yet, so we get global config
if( DATABASE !== config_get( 'file_upload_method', null, null, ALL_PROJECTS ) ) {
$p_file_path = validate_project_file_path( $p_file_path );
}

$t_project_table = db_get_table( 'project' );

@@ -397,7 +400,9 @@ function project_update( $p_project_id, $p_name, $p_description, $p_status, $p_v
project_ensure_name_unique( $p_name );
}

$p_file_path = validate_project_file_path( $p_file_path );
if( DATABASE !== config_get( 'file_upload_method', null, null, $p_project_id ) ) {
$p_file_path = validate_project_file_path( $p_file_path );
}

$t_project_table = db_get_table( 'project' );

47 changes: 25 additions & 22 deletions manage_proj_create_page.php
Original file line number Diff line number Diff line change
@@ -74,9 +74,9 @@
echo lang_get( 'add_project_title' );
} ?></span></legend>

<div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
<div class="field-container <?php echo helper_alternate_class_no_attribute() ?>">
<label for="project-name" class="required"><span><?php echo lang_get( 'project_name' )?></span></label>
<span class="input"><input type="text" id="project-name" name="name" size="64" maxlength="128" /></span>
<span class="input"><input type="text" id="project-name" name="name" size="60" maxlength="128" /></span>
<span class="label-style"></span>
</div>
<div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
@@ -88,15 +88,6 @@
</span>
<span class="label-style"></span>
</div>
<div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
<label for="project-view-state"><span><?php echo lang_get( 'view_status' ) ?></span></label>
<span class="select">
<select id="project-view-state" name="view_state">
<?php print_enum_string_option_list( 'view_state' ) ?>
</select>
</span>
<span class="label-style"></span>
</div>
<div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
<label for="project-inherit-global"><span><?php echo lang_get( 'inherit_global' ) ?></span></label>
<span class="checkbox"><input type="checkbox" id="project-inherit-global" name="inherit_global" checked="checked" /></span>
@@ -108,24 +99,36 @@
<span class="checkbox"><input type="checkbox" id="project-inherit-parent" name="inherit_parent" checked="checked" /></span>
<span class="label-style"></span>
</div><?php
}
} ?>

<div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
<label for="project-view-state"><span><?php echo lang_get( 'view_status' ) ?></span></label>
<span class="select">
<select id="project-view-state" name="view_state">
<?php print_enum_string_option_list( 'view_state' ) ?>
</select>
</span>
<span class="label-style"></span>
</div>
<?php

if ( config_get( 'allow_file_upload' ) ) {
$t_default_upload_path = '';
$g_project_override = ALL_PROJECTS;
if( file_is_uploading_enabled() && DATABASE !== config_get( 'file_upload_method' ) ) {
$t_file_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' );
$t_file_path = config_get( 'absolute_path_default_upload_folder' );
}
?>
<div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
<label for="project-file-path"><span><?php echo lang_get( 'upload_file_path' ) ?></span></label>
<span class="input"><input type="text" id="project-file-path" name="file_path" size="70" maxlength="250" value="<?php echo $t_default_upload_path ?>" /></span>
<span class="label-style"></span>
</div><?php
?>
<div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
<label for="project-file-path"><span><?php echo lang_get( 'upload_file_path' ) ?></span></label>
<span class="input"><input type="text" id="project-file-path" name="file_path" size="60" maxlength="250" value="<?php echo $t_file_path ?>" /></span>
<span class="label-style"></span>
</div><?php
} ?>
<div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
<label for="project-description"><span><?php echo lang_get( 'description' ) ?></span></label>
<span class="textarea"><textarea id="project-description" name="description" cols="60" rows="5"></textarea></span>
<span class="textarea"><textarea id="project-description" name="description" cols="70" rows="5"></textarea></span>
<span class="label-style"></span>
</div>

30 changes: 15 additions & 15 deletions manage_proj_edit_page.php
Original file line number Diff line number Diff line change
@@ -98,8 +98,8 @@
<?php echo form_security_field( 'manage_proj_update' ) ?>
<input type="hidden" name="project_id" value="<?php echo $f_project_id ?>" />
<div class="field-container <?php echo helper_alternate_class_no_attribute() ?>">
<label for="project-name"><span><?php echo lang_get( 'project_name' ) ?></span></label>
<span class="input"><input type="text" id="project-name" name="name" size="50" maxlength="128" value="<?php echo string_attribute( $row['name'] ) ?>" /></span>
<label for="project-name" class="required"><span><?php echo lang_get( 'project_name' ) ?></span></label>
<span class="input"><input type="text" id="project-name" name="name" size="60" maxlength="128" value="<?php echo string_attribute( $row['name'] ) ?>" /></span>
<span class="label-style"></span>
</div>
<div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
@@ -131,23 +131,23 @@
<span class="label-style"></span>
</div>
<?php
if ( file_is_uploading_enabled() && DATABASE !== config_get( 'file_upload_method' ) ) { ?>
<div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
<label for="project-file-path"><span><?php echo lang_get( 'upload_file_path' ) ?></span></label>
<?php
$t_file_path = $row['file_path'];
# Don't reveal the absolute path to non-administrators for security reasons
if ( is_blank( $t_file_path ) && current_user_is_administrator() ) {
$t_file_path = config_get( 'absolute_path_default_upload_folder' );
}
$g_project_override = $f_project_id;
if( file_is_uploading_enabled() && DATABASE !== config_get( 'file_upload_method' ) ) {
$t_file_path = $row['file_path'];
# Don't reveal the absolute path to non-administrators for security reasons
if ( is_blank( $t_file_path ) && current_user_is_administrator() ) {
$t_file_path = config_get( 'absolute_path_default_upload_folder' );
}
?>
<span class="input"><input type="text" id="project-file-path" name="file_path" size="50" maxlength="250" value="<?php echo string_attribute( $t_file_path ) ?>" /></span>
<span class="label-style"></span>
</div><?php
<div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
<label for="project-file-path"><span><?php echo lang_get( 'upload_file_path' ) ?></span></label>
<span class="input"><input type="text" id="project-file-path" name="file_path" size="60" maxlength="250" value="<?php echo string_attribute( $t_file_path ) ?>" /></span>
<span class="label-style"></span>
</div><?php
} ?>
<div class="field-container <?php echo helper_alternate_class_no_attribute(); ?>">
<label for="project-description"><span><?php echo lang_get( 'description' ) ?></span></label>
<span class="textarea"><textarea id="project-description" name="description" cols="60" rows="5"><?php echo string_textarea( $row['description'] ) ?></textarea></span>
<span class="textarea"><textarea id="project-description" name="description" cols="70" rows="5"><?php echo string_textarea( $row['description'] ) ?></textarea></span>
<span class="label-style"></span>
</div>

35 changes: 22 additions & 13 deletions print_all_bug_page_word.php
Original file line number Diff line number Diff line change
@@ -106,16 +106,18 @@

$result = filter_get_bug_rows( $t_page_number, $t_per_page, $t_page_count, $t_bug_count );
$t_row_count = count( $result );
?>

<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">

<?php
html_page_top1();
html_head_end();
html_body_begin();
# Headers depending on intended output
if ( $f_type_page == 'html' ) {
html_page_top1();
html_head_end();
html_body_begin();
} else {
echo '<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">';
html_body_begin();
}

$f_bug_arr = explode( ',', $f_export );
$t_count_exported = 0;
@@ -170,7 +172,7 @@
# display the available and selected bugs
if ( in_array( $t_id, $f_bug_arr ) || !$f_show_flag ) {
if ( $t_count_exported > 0 ) {
echo '<br style="mso-special-character: line-break; page-break-before: always">';
echo '<br style="mso-special-character: line-break; page-break-before: always" />';
}

$t_count_exported++;
@@ -483,12 +485,15 @@
?>
</td>
</tr>

<tr><td colspan="6" class="print">&nbsp;</td></tr>

<?php
$t_user_bugnote_limit = 0;

$t_bugnotes = bugnote_get_all_visible_bugnotes( $t_id, $t_user_bugnote_order, $t_user_bugnote_limit );
?>
<br />
<tr><td class="print" colspan="6">
<table class="width100" cellspacing="1">
<?php
# no bugnotes
@@ -543,7 +548,7 @@
</tr>
</table>
</td>
<td class="nopad" width="85%">
<td class="nopad">
<table class="hide" cellspacing="1">
<tr>
<td class="print">
@@ -572,11 +577,15 @@
?>

</table>
</td></tr>
<?php # Bugnotes END ?>
</table>


<br /><br />
<?php
echo '<br /><br />';
} # end in_array
} # end main loop

html_body_end();
html_end();