WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7
[resolved] Contact Form 7 - Submiting backslashes (5 posts)

  1. Rab
    Member
    Posted 2 years ago #

    Hi,

    I'm using contact form 7 on an internal site for an intranet call logging system (sort of).

    One of the forms is for people to sumbit a request for a file restore which includes a field for a path to the file, in the normal format G:\Folder\Another Folder\File.xls

    But in this example, the output in the email would be something like G:FolderAnother FolderFile.xls which isn't ideal.

    Is there a way to escape the backslashes so they appear in the email?

    Cheers,
    Rab

    http://wordpress.org/extend/plugins/contact-form-7/

  2. Rab
    Member
    Posted 2 years ago #

    Little more info -

    You can enter double backslashes to escape the second slash in the fields itself.

    So using the same example to get G:\Folder\Another Folder\File.xls to display in the email, you would write in the field G:\\Folder\\Another Folder\\File.xls

    Any ideas on how I can escape this so I don't need users to enter \\ or get emails which read along the lines of G:FolderAnother FolderFile.xls ? Perhaps by escaping the whole field? Or by reading the field as raw text? I'm not sure how the form does this, and not really sure where to start looking.

    Thanks,
    Rab

  3. Rab
    Member
    Posted 2 years ago #

    Little bump, anyone got any ideas? :)

    Cheers!

  4. Rab
    Member
    Posted 2 years ago #

    Still looking to get this resolved, anyone? :)

  5. Rab
    Member
    Posted 2 years ago #

    I've managed to fix it.

    For any searchers out there, I edited /wp-content/plugins/contact-form-7/includes/classes.php

    Around line 314 there is this code:

    if ( WPCF7_USE_PIPE && is_a( $pipes, 'WPCF7_Pipes' ) && ! $pipes->zero() ) {
    				if ( is_array( $value) ) {
    					$new_value = array();
    					foreach ( $value as $v ) {
    						$new_value[] = $pipes->do_pipe( stripslashes( $v ) );
    					}
    					$value = $new_value;
    				} else {
    					$value = $pipes->do_pipe( stripslashes( $value ) );
    				}

    I removed the stripslashes function so the new code looked like this:

    if ( WPCF7_USE_PIPE && is_a( $pipes, 'WPCF7_Pipes' ) && ! $pipes->zero() ) {
    				if ( is_array( $value) ) {
    					$new_value = array();
    					foreach ( $value as $v ) {
    						$new_value[] = $pipes->do_pipe(  $v  );
    					}
    					$value = $new_value;
    				} else {
    					$value = $pipes->do_pipe(  $value  );
    				}

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic