Question

I use joomla 3.0 in my project. And there i try to develop own module...

In module main code i have such part:

`<?php
defined('_JEXEC') or die('Direct Access to this location is not allowed.');

require_once('helper.php');

JHTML::stylesheet('styles.css','modules/mod_get_call/css/');

//require_once('recaptchalib.php');
$privatekey = "6Ldc2_ISAAAAAABrb****Gr9c_";
$resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field2"] );

$input = JFactory::getApplication()->input; // only once on each method
$form_send = $input->get('form_send', 'notsend');

    switch($form_send){
        case 'send':
            $organization = $input->get('organization', 'No organization entered');
            $phone = $input->get('phone', 'No phone entered');
            $e_mail = $input->get('e_mail', 'No e_mail entered');
            $skype = $input->get('skype', 'No skype entered');
            $comment = $input->get('comment', 'No comment entered');
            //JFactory::getApplication()->enqueueMessage(JText::_($organization), 'error');
            if ($resp->is_valid == true)
                $send = ModGetCallHelper::SendMail($organization, $phone, $e_mail, $skype, $comment);
            else{
                require(JModuleHelper::getLayoutPath('mod_get_call', 'wrong_input_tmplc'));
                break; 
            }****`

and all is ok, just then when i submit $e_mail it is without @ symbol, and when i enter russian letters - i see empty variable. When i try to write $_POST["e_mail"] - all is ok. But how to use russian symbols with JFactory::getApplication()->input ? What i do wrong?

Was it helpful?

Solution

When you do get without a type you will default to Word as the input filter. You should really never use $input->get() the way you are, use something like $input->getString() or $input->getInt() and so on. That will give you the correct input filtering. Read the JInput class docblocks for more details.

And in the meantime don't hard code your private key like that, it's not maintainable, what if you need to generate a new key?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top