- <?php
- if ( $attatchme != '' && $attatchme != 'none' ) {
- $new_fname =
- $default->temp_dir . '/' .
- $session_id . '-' . basename($attatchme);
- $attatched_files[ $attatchme_name ] = $new_fname;
- $attatched_files_sizes[ $attatchme_name ] = $attatchme_size;
- /*
- Let's copy away the temp file jic we want to have it after
- the upload (gawd i hated debugging it, reread the man page,
- seems somewhere in between 3.0.2 -> 3.0.12 the temp file is
- automagically deleted at end of run.
- */
- copy( $attatchme, $new_fname );
- /* Be a good boy and delete the previous copy of the file */
- unlink( $attatchme );
- }
- $remove_filename = '';
- if ( count( $attatched_files ) > 0 ) {
- $r = 0;
- while( list( $file, $file_val ) = each( $attatched_files ) ) {
- $var_name = 'mail_remove_attatch_' . $r;
- eval( 'global $' . $var_name );
- if ( $$var_name != '' ) {
- $remove_filename = $file;
- }
- $r++;
- }
- }
- if ( $remove_filename != '' ) {
- $t_attatched_files = Array();
- $t_attatched_files_sizes = Array();
- reset( $attatched_files );
- while( list( $file, $file_val ) = each( $attatched_files ) ) {
- if ( $file == $remove_filename ) {
- unlink( $attatched_files[ $remove_filename ] );
- } else {
- $t_attatched_files[ $file ] = $file_val;
- $t_attatched_files_sizes[ $file ] =
- $attatched_files_sizes[ $file ];
- }
- }
- $attatched_files = $t_attatched_files;
- $attatched_files_sizes = $t_attatched_files_sizes;
- }
- if ( count( $attatched_files ) > 0 ) {
- $template_obj->ParseTemplate(
- './pimp/templates/compose/attatch/attatched_files_top.inc'
- );
- reset( $attatched_files );
- $q = 0;
- reset( $attatched_files );
- while( list( $user_filename, $tmp_filename ) = each( $attatched_files ) ) {
- $filesize_obj = new FileSizeObject();
- $user_file_size = $filesize_obj->FormatFileSize(
- $attatched_files_sizes[ $user_filename ]
- );
- $remove_attatchment_button =
- '<input type="submit" name="mail_remove_attatch_' . $q . '" value="Remove">'
- ;
- include(
- './pimp/templates/compose/attatch/attatched_files_item.inc'
- );
- $q++;
- }
- $template_obj->ParseTemplate(
- './pimp/templates/compose/attatch/attatched_files_bottom.inc'
- );
- } /* End if attatched files */
- $name = 'MAX_FILE_SIZE';
- $value = 99999999999999;
- include( './templates/form/form_hidden_elem.inc' );
- $name = 'attatchme';
- ?>
- <?php echo $template_obj->GetValue( 'default_row_start' ); ?>
- <td><?php echo $template_obj->GetValue( 'default_font' ); ?>
- <b> </b></td>
- <td valign="center"><?php echo $template_obj->GetValue( 'default_font' ); ?>
- <input type="file" name="<?php echo $name; ?>"> <input type="submit" name="mail_attatch_file" value="Attach File"></td>
- </tr>