WordPress.org

Support

Support » Plugins and Hacks » Fast Secure Contact Form » [Plugin: Fast Secure Contact Form] Doesn't work with qTranslate

[Plugin: Fast Secure Contact Form] Doesn't work with qTranslate

Viewing 15 replies - 1 through 15 (of 15 total)
  • Dear Mike Challis,

    Could you please tell me if this can be fixed? Why don’t you want to respond?

    This is a serious issue to me and I love (and must use) both plugins. qTraslate is a very popular plugin to enable us webmasters to create website in multiple languages…

    Regards,
    Tim

    Plugin Author Mike Challis

    @mikechallis

    Sorry for the delay, I was out of town.

    This is a qTranslate caused problem, quite possibly a design shortfall in qTranslate.
    Let me explain… qTranslate changes the URL to a path that does not actually exist.
    It adds a fake folder to the URL such as /fr/ for French. Because this folder does not actually exist, this causes a problem with the server environment variables. The URL is changed by qTranslate to include /fr/, but the server environment variable $_SERVER[‘HTTP_HOST’] is not. This is what causes the Form action URL to not work properly after selecting a qTranslate language.

    qTranslate is the cause if the problem.
    I am not able to troubleshoot qTranslate because I am not familiar with it’s code or it’s inner workings.

    I have contacted the qTranslate developer for support. You are welcome to join the conversation at their support forum.
    http://www.qianqin.de/qtranslate/forum/viewtopic.php?f=3&t=2035

    Mike

    Hello Mike,

    Thank you for looking into this. Sorry, I really thought your plugin isn’t able to handle this correctly.
    Anyway, I posted in the support forum you’ve mentioned. I hope this gets fixed soon because it’s really annoying for my German visitors.

    Tim

    Plugin Author Mike Challis

    @mikechallis

    I have posted a requests for help in the qTranslate forum, they have not responded.

    Anybody you tried GTranslate?
    http://wordpress.org/extend/plugins/gtranslate/

    I use GTranslate at

    My Gift To You

    For me GTranslate isn’t an acceptable alternative. The translations are really sloppy and I can’t use my own texts for the different languages.

    Too bad the author of qTranslate doesn’t want to answer…

    I have encountered this error today and I have fixed if for my site. It’s a bit of a hack and it might not work for everybody, but there you are:

    In /wp-content/plugins/si-contact-form/si-contact-form.php near line 224 you should have

    // set the type of request (SSL or not)
    if ( getenv('HTTPS') == 'on' ) {
        $form_action_url = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    } else {
        $form_action_url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    }

    change it for

    // set the type of request (SSL or not)
    if ( getenv('HTTPS') == 'on' ) {
        $form_action_url = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REDIRECT_URL'];
    } else {
        $form_action_url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REDIRECT_URL'];
    }

    I hope it helps

    I’ve tried following code, and odd enough, it did work
    (though URLs don’t look that good after submission).
    Let’s say, you’ve got 2 langs, english and french, english being a default and french second one.
    Go to /wp-content/plugins/si-contact-form/si-contact-form.php as mentioned in previous post and find those lines mentioned.

    // set the type of request (SSL or not)
    if ( getenv('HTTPS') == 'on' ) {
        $form_action_url = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    } else {
        $form_action_url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    }

    and replace ’em with

    if(get_locale() == 'en_US') {
    	if ( getenv('HTTPS') == 'on' ) {
    		$form_action_url = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    	} else {
    		$form_action_url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    	}
    } else {
    	if ( getenv('HTTPS') == 'on' ) {
    		$form_action_url = 'https://'.$_SERVER['HTTP_HOST'].'/fr/'.$_SERVER['REQUEST_URI'];
    	} else {
    		$form_action_url = 'http://'.$_SERVER['HTTP_HOST'].'/fr/'.$_SERVER['REQUEST_URI'];
    	}
    }

    May not work but who knows…

    Hi All,

    Flavigne and Seezer, I can solve it myself with your instructions. I have a qtranslate installed with two forms. One in Spanish and other in Catalan. I put this code in si-contact-form.php.

    if(get_locale() == 'es_ES') {
    	if ( getenv('HTTPS') == 'on' ) {
    		$form_action_url = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    	} else {
    		$form_action_url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    	}
    } else {
    	if ( getenv('HTTPS') == 'on' ) {
    		 $form_action_url = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REDIRECT_URL'];
    	} else {
    		 $form_action_url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REDIRECT_URL'];
    	}
    }

    Thanks for all.

    thanks so much for the great advice,…… can you please advise, what would the php code for 3 languagesโ€‹โ€‹? I am php loser, …

    Probably something like:

    switch ( get_locale() ) {
    	case 'AAA':
    	case 'BBB':
    		if ( getenv('HTTPS') == 'on' ) {
    			$form_action_url = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REDIRECT_URL'];
    		} else {
    			$form_action_url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REDIRECT_URL'];
    		}
    		break;
    	default:
    		if ( getenv('HTTPS') == 'on' ) {
    			$form_action_url = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    		} else {
    			$form_action_url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    		}
    }

    Just replace AAA and BBB with the language codes. The third one will be your default language… Didn’t test it though!
    I’m still hoping for an internal solution from Mike Challis as I don’t really want to edit the plugin’s code.

    Thank you very much Jan van Dank, this is working mighty fine ๐Ÿ™‚

    @phdsigns
    I’m glad that I was able to help you. ๐Ÿ™‚

    Still waiting for a “official” solution from the plugin developer though…
    Maybe you can add something like a compatible mode option?
    -> “[x] Make compatible to qTranslate”

    Regards,
    Jan

    Plugin Author Mike Challis

    @mikechallis

    I cannot find an acceptable solution. $_SERVER[‘REDIRECT_URL’] is not even available on my Apache server with PHP Version 5.3.6

    I hesitate to cause other problems
    PS the current code in the plugin is:

    // set the type of request (SSL or not)
    if ( is_ssl() ) {
        $form_action_url = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    } else {
        $form_action_url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    }

    It would be nice if the qTranslate author could address this issue himself.

    @mike Challis
    Thank you for looking into this again! Well, you could call it “[x] Make compatible to qTranslate (experimental)“. ๐Ÿ˜‰

    What works for me is changing

    if ( is_ssl() ) {
        $form_action_url = 'https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    } else {
        $form_action_url = http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; //
    }

    to

    if ( is_ssl() ) {
        $form_action_url = qtrans_convertURL($_SERVER['REQUEST_URI']);
    } else {
        $form_action_url = qtrans_convertURL($_SERVER['REQUEST_URI']);
    }

    I haven’t tested if this works for SSL – for normal http it’s fine. This doesn’t solve the re-direct problem either. I guess it would need some work around line 840 similar to the changes above.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘[Plugin: Fast Secure Contact Form] Doesn't work with qTranslate’ is closed to new replies.
Skip to toolbar