View Issue Details

IDProjectCategoryView StatusLast Update
0003266mantisbtbugtrackerpublic2004-07-07 18:21
Reportergrangeway Assigned Tovboctor  
PrioritynormalSeverityfeatureReproducibilityalways
Status closedResolutionfixed 
Fixed in Version0.19.0a1 
Summary0003266: possible patches against cvs head
Description

as commented on previously on irc.

TagsNo tags attached.
Attached Files
patch1.txt (4,491 bytes)   
Index: csv_export.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/csv_export.php,v
retrieving revision 1.14
diff -r1.14 csv_export.php
25a26,31
> 	# Send headers to browser to active mime loading
> 	header( 'Content-Type: text/plain; name=' . config_get( 'page_title' ) . '.csv' );
> 	header( 'Content-Transfer-Encoding: BASE64;' );
> 	header( 'Content-Disposition: attachment; filename=' . config_get( 'page_title' ) . '.csv' );
> 
> 
57,61d62
< 
< 	# Send headers to browser to active mime loading
< 	header( 'Content-Type: text/plain; name=' . config_get( 'page_title' ) . '.csv' );
< 	header( 'Content-Transfer-Encoding: BASE64;' );
< 	header( 'Content-Disposition: attachment; filename=' . config_get( 'page_title' ) . '.csv' );
Index: proj_doc_add_page.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/proj_doc_add_page.php,v
retrieving revision 1.24
diff -r1.24 proj_doc_add_page.php
54c54
< 		<?php echo lang_get( 'select_file' ) ?>
---
> 		<span class="required">*</span><?php echo lang_get( 'select_file' ) ?>
57d56
< 		<input type="hidden" name="max_file_size" value="<?php echo $g_max_file_size ?>" />
Index: core/error_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/error_api.php,v
retrieving revision 1.25
diff -r1.25 error_api.php
98c99,102
< 			ob_end_clean();
---
> 
> 			if ( ob_get_length() ) { 
> 				ob_end_clean();
> 			}
206,208c210,219
< 			for ( $i = 0 ; $i < sizeof( $t_stack ) ; $i = $i + 1 ) {
< 				echo '<tr ' . helper_alternate_class( $i ) . '"><td>' . htmlentities( $t_stack[$i] ) . '</td></tr>';
< 			}
---
> 			foreach ( $t_stack as $t_frame ) {
> 				echo '<tr ' . helper_alternate_class() . '">';
> 				echo '<td>' . htmlentities( $t_frame['file'] ) . "</td><td>$t_frame[line]</td><td>$t_frame[function]</td>";
> 
> 				$t_args = array();
> 				if ( isset( $t_frame['params'] ) ) {
> 					foreach( $t_frame['params'] as $t_value ) {
> 						$t_args[] = error_build_parameter_string( $t_value );
> 					}
> 				}
209a221,222
> 				echo '<td>( ' . htmlentities( implode( $t_args, ', ' ) ) . ' )</td></tr>';
> 			}
Index: db_generate.sql
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/sql/db_generate.sql,v
retrieving revision 1.14
diff -r1.14 db_generate.sql
705,706c705
< INSERT INTO mantis_user_table VALUES (1,'administrator','admin','63a9f0ea7bb98050796b649e85481845','2003-02-16 02:03:48','2003-02-16 02:36:38',1,1,90,3,'MN91uSF/JIhos8bcda8acc2ead8d60749ad019e56b54fadkPGTyoBgNBQf91563');
< 
---
> INSERT INTO mantis_user_table VALUES (1,'administrator','admin','63a9f0ea7bb98050796b649e85481845','2003-02-16 02:03:48','2003-02-16 02:36:38',1,1,90,3,CONCAT(MD5(DATABASE()),MD5(NOW())));
Index: core/constant_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/constant_inc.php,v
retrieving revision 1.6
diff -r1.6 constant_inc.php
229a230,232
> 	# ERROR_EMAIL_*
> 	define( 'ERROR_EMAIL_NOT_SENT',					1602 );
> 
Index: core/email_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/email_api.php,v
retrieving revision 1.59
diff -r1.59 email_api.php
671,673c671
< 				PRINT "PROBLEMS SENDING MAIL TO: $t_recipient<br />";
< 				PRINT 'Mailer Error: '.$mail->ErrorInfo.'<br />';
< 				exit;
---
> 				trigger_error( ERROR_EMAIL_NOT_SENT, ERROR );
708c706
< 			$result = mail( $t_recipient, $t_subject, $t_message, $t_headers );
---
> 			$result = @mail( $t_recipient, $t_subject, $t_message, $t_headers );
710,715c708
< 				PRINT "PROBLEMS SENDING MAIL TO: $t_recipient<br />";
< 				PRINT htmlspecialchars($t_recipient).'<br />';
< 				PRINT htmlspecialchars($t_subject).'<br />';
< 				PRINT nl2br(htmlspecialchars($t_headers)).'<br />';
< 				PRINT nl2br(htmlspecialchars($t_message)).'<br />';
< 				exit;
---
> 				trigger_error( ERROR_EMAIL_NOT_SENT, ERROR );
Index: lang/strings_english.txt
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/lang/strings_english.txt,v
retrieving revision 1.138
diff -r1.138 strings_english.txt
201a202
> $MANTIS_ERROR[ERROR_EMAIL_NOT_SENT] = 'Unable to send mail.';

patch1.txt (4,491 bytes)   

Activities

vboctor

vboctor

2003-08-07 01:11

manager   ~0004496

Can please update the description or add a bug note to explain what does this patch achieve.

grangeway

grangeway

2003-08-07 16:46

reporter   ~0004505

how'd I know that was coming :)
pretty much what i already emailed you vboctor.

  1. fix csv_export.php to display content after header().

  2. change proj_doc_add_page.php to mark file as required + remove max_file_size post value ($g_max_file_size) which looked legacy.

  3. change error_api.php - ob_end_clean(); to check ob_get_length <> 0 to remove a notice.

  4. think change lines 206-209 to use similar code to previous lines in file.

  5. possible change for db_generate.sql (see 0003137), instead of using a static cookie, use CONCAT(MD5(DATABASE()),MD5(NOW()).

  6. possible change constant_php.inc, email_api.php, strings_english.txt. -> Instead of dumping out problems sending mail and raw message and terminating a request, trigger an error. Also instead of mail, use @mail to hide notice/warning.

vboctor

vboctor

2003-08-20 16:05

manager   ~0004550

Following parts of the patch were applied:

  • csv_export.php
  • proj_doc_add_page.php
  • error_api.php (this also include some changes to printing of stack trace)
grangeway

grangeway

2003-08-21 11:03

reporter   ~0004552

doh, hmm, i have a slightly different version at home to that patch - can you also apply:

Index: error_api.php

RCS file: /cvsroot/mantisbt/mantisbt/core/error_api.php,v
retrieving revision 1.26
diff -w -b -r1.26 error_api.php
211c211
< echo '<td>' . htmlentities( $t_frame['file'] ) . "</td><td>$t_frame['line']</td><td>$t_frame['function']</td>";

          echo '&lt;td>' . htmlentities( $t_frame['file'] ) . &quot;&lt;/td>&lt;td>&quot; . $t_frame['line'] . &quot;&lt;/td>&lt;td>&quot; . $t_frame['function'] . &quot;&lt;/td>&quot;;

234c234
< echo '<td>' . htmlentities( $t_frame['file'] ) . "</td><td>$t_frame['line']</td><td>$t_frame['function']</td>";

          echo '&lt;td>' . htmlentities( $t_frame['file'] ) . &quot;&lt;/td>&lt;td>&quot; . $t_frame['line'] . &quot;&lt;/td>&lt;td>&quot; . $t_frame['function'] . &quot;&lt;/td>&quot;;

CVS exited normally with code 1

grangeway

grangeway

2003-08-21 11:29

reporter   ~0004553

Any remove a couple of notices:

RCS file: /cvsroot/mantisbt/mantisbt/login_page.php,v
retrieving revision 1.31
diff -w -b -r1.31 login_page.php
108c108
< if ( config_get( 'login_method' ) == AUTH_PLAIN ) {

if ( config_get( 'login_method' ) == 'AUTH_PLAIN' ) {


Index: file_api.php

RCS file: /cvsroot/mantisbt/mantisbt/core/file_api.php,v
retrieving revision 1.38
diff -w -b -r1.38 file_api.php
29c29
< if ($t_array[0] == config_get( document_files_prefix )) {

  if ($t_array[0] == config_get( 'document_files_prefix' )) {

vboctor

vboctor

2003-08-21 16:33

manager   ~0004554

I just committed the following fixes:

  • The one in error_api.php
  • Replace AUTH_PLAIN with PLAIN (rather than 'AUTH_PLAIN').
  • The fix in file_api.php.

Thanks!

vboctor

vboctor

2003-08-26 09:09

manager   ~0004569

The following code should be added again to proj_doc_add_page.php. This is used by the browser/webserver to specify the max file size, it is not handled by Mantis code.
<input type="hidden" name="max_file_size" value="<?php echo $t_max_file_size ?>" />

For more details see the article below and the associated comment:
http://www.phpbuilder.com/tips/item.php?id=526

grangeway

grangeway

2003-08-27 20:02

reporter   ~0004573

ahh, it was changed from g to t :)

grangeway

grangeway

2004-07-02 14:53

reporter   ~0005874

most of this was applied already