191
deka87
Re: Newbb 4.3
  • 2012/8/13 11:46

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


/**
 * System Preloads
 *
 * You may not change or alter any portion of this comment or credits
 * of supporting developers from this source code or any supporting source code
 * which is considered copyrighted (c) material of the original comment or credit authors.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @copyright   The XOOPS Project http://sourceforge.net/projects/xoops/
 * @license     GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
 * @author          Cointin Maxime (AKA Kraven30)
 * @author          Andricq Nicolas (AKA MusS)
 * @version         $Id:$
 */

defined('XOOPS_ROOT_PATH') or die('Restricted access');

class 
SystemCorePreload extends XoopsPreloadItem
{
    function 
eventCoreIncludeFunctionsRedirectheader($args)
    {
        global 
$xoopsConfig;
        
$url $args[0];
        if (
preg_match("/[\0-\31]|about:|script:/i"$url)) {
            if (!
preg_match('/^b(java)?script:([s]*)history.go(-[0-9]*)([s]*[;]*[s]*)$/si'$url)) {
                
$url XOOPS_URL;
            }
        }
        if (isset(
$xoopsConfig['redirect_message_ajax']) && $xoopsConfig['redirect_message_ajax']) {
            
$_SESSION['redirect_message'] = $args[2];
            
header("Location: " preg_replace("/[&]amp;/i"'&'$url));
            exit();
        }
    }

    function 
eventCoreHeaderCheckcache($args)
    {
        if (!empty(
$_SESSION['redirect_message'])) {
            
$GLOBALS['xoTheme']->contentCacheLifetime 0;
            unset(
$_SESSION['redirect_message']);
        }
    }

    function 
eventCoreHeaderAddmeta($args)
    {
        if (!empty(
$_SESSION['redirect_message'])) {
            
$GLOBALS['xoTheme']->addStylesheet('xoops.css');
            
$GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/jquery.js');
            
$GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.jgrowl.js');
            
$GLOBALS['xoTheme']->addScript('', array('type' => 'text/javascript'), '
            (function($){
                $(document).ready(function(){
                $.jGrowl("' 
$_SESSION['redirect_message'] . '", {  life:3000 , position: "center", speed: "slow" });
            });
            })(jQuery);
            '
);
        }
    }

    function 
eventSystemClassGuiHeader($args)
    {
        if (!empty(
$_SESSION['redirect_message'])) {
            
$GLOBALS['xoTheme']->addStylesheet('xoops.css');
            
$GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/jquery.js');
            
$GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.jgrowl.js');
            
$GLOBALS['xoTheme']->addScript('', array('type' => 'text/javascript'), '
            (function($){
            $(document).ready(function(){
                $.jGrowl("' 
$_SESSION['redirect_message'] . '", {  life:3000 , position: "center", speed: "slow" });
            });
            })(jQuery);
            '
);
            unset(
$_SESSION['redirect_message']);
        }
    }

}

?>

192
irmtfan
Re: Newbb 4.3
  • 2012/8/14 4:51

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


Ok deka87:
IMO you have an issue in your xoops 2.5.5 because it seems the headers are already sent before eventCoreIncludeFunctionsRedirectheader.
please change the include/functions.php like this:

function redirect_header($url$time 3$message ''$addredirect true$allowExternalLink false)
{
    global 
$xoopsConfig$xoopsLogger$xoopsUserIsAdmin;

    
$xoopsPreload =& XoopsPreload::getInstance();
// irmtfan add this
if(headers_sent($headers_file$headers_line)) {

            echo 
"n".'**Headers already sent in file "'.$headers_file.'" on line "'.$headers_line.'"';
$xoopsLogger->dump();
    exit;
}
// irmtfan add this
    
$xoopsPreload->triggerEvent('core.include.functions.redirectheader', array($url$time$message$addredirect$allowExternalLink));


I need to be sure that headers are sent before that core function.

also let me know about your mainfile.php
there should not be any new line or space in the end of that file. after ?>
then we can go ahead.

193
deka87
Re: Newbb 4.3
  • 2012/8/14 5:38

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


irtmfan,

There was a space in the very end of the mainfile.php. I have removed it but it didn't help. Then I put the hack you provided in functions.php and that's what I got then:

Quote:

n**Headers already sent in file "" on line "0"


Also, not sure if I have mentioned it in my first post, I run xoops 2.5.3. Do you think this may cause the issue?

194
irmtfan
Re: Newbb 4.3
  • 2012/8/14 6:26

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


deka87:
It shows that headers are already sent before inter into that redirect_header function.

It should not be sent at that part. It seems it didnt use redirect_header function from include/functions.php


I should download the xoops 2.5.3 package and take a look at that.

me and you should find whether another "function redirect_header" is in your website. in xoops 2.5.5 there is just one "function redirect_header"


Edit:
in xoops 2.5.3 there is no other "function redirect_header" so it is strange to me.
Also please show me the log on the page you received the "Headers already sent" error.

195
irmtfan
Re: Newbb 4.3
  • 2012/8/14 7:25

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


deka87:
We should follow the headers until we can see where they sent.
please back the original include/functions.php and modules/system/preloads/core.php files.

then add the lines to modules/newbb/post.php right after including the header.php
include_once dirname(__FILE__) . "/header.php";
// add this irmtfan
if(headers_sent($headers_file$headers_line)) {

            echo 
"n".'**Headers already sent in file "'.$headers_file.'" on line "'.$headers_line.'"';
/* What headers are going to be sent? */
var_dump(headers_list());
$xoopsLogger->dump();
    exit;
}
// add this irmtfan
foreach (array(
            
'forum',
            
'topic_id',
            
'post_id',
            
'order',
            
'pid',
            
'start',
            
'isreply',
            
'isedit'
            
) as $getint) {
    ${
$getint} = intval( @$_POST[$getint] );
}


then send a reply and let me know if you have the "Headers already sent" error.

196
deka87
Re: Newbb 4.3
  • 2012/8/14 7:59

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


No messages but "Thanks for your submission". There are also 4 error messages in debug but they are all about phpmailer.

197
irmtfan
Re: Newbb 4.3
  • 2012/8/14 8:49

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


deka87:
thank you for your reply.
sorry if it seems i playing with codes but im not a developer and should find the error in some kind of try and error.

Ok. it shows that headers was not sent until newbb/post.php so we can proceed.
Now we are sure about it.
Please again back the code to include/functions.php
this time i added headers_list to see what happens there.
Also add that right after global variables.
function redirect_header($url$time 3$message ''$addredirect true$allowExternalLink false)
{
    global 
$xoopsConfig$xoopsLogger$xoopsUserIsAdmin;
// add this irmtfan
if(headers_sent($headers_file$headers_line)) {

            echo 
"n".'**Headers already sent in file "'.$headers_file.'" on line "'.$headers_line.'"';
/* What headers are going to be sent? */
var_dump(headers_list());
$xoopsLogger->dump();
    exit();
}
// add this irmtfan 

    
$xoopsPreload =& XoopsPreload::getInstance();
    
$xoopsPreload->triggerEvent('core.include.functions.redirectheader', array($url$time$message$addredirect$allowExternalLink));


if you add that after global and still you have the "Thanks for your submission" then add it after $xoopsPreload
hopefully we can find something now.

198
deka87
Re: Newbb 4.3
  • 2012/8/14 10:30

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


irtmfan,

n**Headers already sent in file "" on line "0"array(7) { [0]=> string(23"X-Powered-By: PHP/5.3.3" [1]=> string(38"Expires: Thu, 19 Nov 1981 08:52:00 GMT" [2]=> string(77"Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0" [3]=> string(16"Pragma: no-cache" [4]=> string(80"Set-Cookie: PHPSESSID=a1ff8c1e09713cc85556f1a8e3b813ca; path=/; domain=.test1.ru" [5]=> string(79"Set-Cookie: newbb_1LV=1344940223; expires=Thu, 13-Sep-2012 10:30:23 GMT; path=/" [6]=> string(23"Content-type: text/html" }

199
irmtfan
Re: Newbb 4.3
  • 2012/8/14 11:14

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


deka87:
It definitely should be spaces/newline somewhere in mainfile.php or the lang files OR utf-8 BOM before header() is called in XOOPS.
Im familiar with this kind of BOM issues.

Try to check all your touched files (language maybe) and find any BOM in the top of the files OR spaces/newlines at the end of php files ?> and remove all of them.

do you change the language to english and test in your website?

Im out of any other solution now for this strange issue.

200
deka87
Re: Newbb 4.3
  • 2012/8/14 12:15

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


Ok, irtmfan. I will try what I can do or leave it as it is cause this is not such a big issue. Thanks for working on this!

Login

Who's Online

406 user(s) are online (291 user(s) are browsing Support Forums)


Members: 0


Guests: 406


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits