[geeklog-devel] Mobile Detect in Geeklog

Tom websitemaster at cogeco.net
Thu Jun 2 15:34:50 EDT 2016


Hi All,

This is in regards to the issue of replying to a forum post
(https://www.geeklog.net/forum/viewtopic.php? showtopic=96350 ) which
results in an email error. I have temporary fixed the error by skipping the
use of the function 'iconv_mime_encode'. (See
https://github.com/Geeklog-Core/geeklog/issues/684 for more information)

This function is used by COM_emailEscape to escape the email subject which
is what is causing the email error (depends on language and what the forum
title is)

E_WARNING(2) - mail() [function.mail]: Bad parameters to mail() function,
mail not sent. @ /foo/pear/Mail/mail.php line 153

Here is the temp updated function below with the use of the
'iconv_mime_encode' function commented out .  Does anyone know why the PHP
mail function doesn't like the output of iconv_mime_encode? Any idea what
the fix for this is? 

Thanks

Tom

function COM_emailEscape( $string )
{
    global $_CONF;

    if (function_exists('CUSTOM_emailEscape')) {
        return CUSTOM_emailEscape($string);
    }

    $charset = COM_getCharset();
    if(( $charset == 'utf-8' ) && ( $string != utf8_decode( $string )))
    {
        /* HACKED FOR TEMP FIX OF FORUM POSTS NOT SENDING EMAIL
NOTIFICATIONS FOR USERS IN A DIFFERENT LANGUAGE
https://github.com/Geeklog-Core/geeklog/issues/684
        if( function_exists( 'iconv_mime_encode' ))
        {
            $mime_parameters = array( 'input-charset'  => 'utf-8',
                                      'output-charset' => 'utf-8',
                                      // 'Q' encoding is more readable than
'B'
                                      'scheme'         => 'Q'
                                    );
            $string = substr( iconv_mime_encode( '', $string,
                                                 $mime_parameters ), 2 );
        }
        else
        {
            $string = '=?' . $charset . '?B?' . base64_encode( $string ) .
'?=';
        }
        */
        $string = '=?' . $charset . '?B?' . base64_encode( $string ) . '?=';
    }
    else if( preg_match( '/[^0-9a-z\-\.,:;\?! ]/i', $string ))
    {
        $string = '=?' . $charset . '?B?' . base64_encode( $string ) . '?=';
    }

    return $string;
}




More information about the geeklog-devel mailing list