[Zope] Fixed in v2.3 (PHPDocument)

Milos Prudek milos.prudek@tiscali.cz
Wed, 09 Jan 2002 19:55:22 +0100


Ioan Coman wrote:
> 
> Hello Everyone!
> 
> I'm sorry! Is my mistake!
> 
> I extracted headers from zope document only
> and I let PHP to render without headers (option -q)!!
> Double mistake!

Great response time!

Here are my results:

My source gives now the following error:

X-Powered-By: PHP/4.0.6 Content-type: text/html 
Warning: Cannot add header information - headers already sent by (output
started at /tmp/1010602169_14.txt:8) in
/tmp/1010602169_14.txt on line 79

I quote the "/tmp/1010602169_14.txt" file at the end of this message. 

Line 79 is this one:
header('Location: ' . Horde::applicationUrl('mailbox.php?actionID=' .
$actionID, true));

The "/tmp/1010602169_14.txt" file:

<html><head><title>3</title>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1250">
<link rel="stylesheet" href="normal.html" type="text/css">
</head>
<body bgcolor="#FFFFFF" text="#000000">


<?php
/*
 * $Horde: imp/redirect.php,v 1.23.2.3 2002/01/02 17:05:32 jan Exp $
 *
 * Copyright 1999-2002 Charles J. Hagenbuch <chuck@horde.org>
 * Copyright 1999-2002 Jon Parise <jon@horde.org>
 *
 * See the enclosed file COPYING for license information (GPL).  If you
 * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
 */

/* define('IMP_BASE', dirname(__FILE__)); */
define('IMP_BASE', '/home/httpd/html/horde/imp');
require_once IMP_BASE . '/lib/base.php';

$HTTP_POST_VARS['imapuser'] = 'milos';
$HTTP_POST_VARS['pass'] = 'secret';
$HTTP_POST_VARS['server'] = 'localhost';
$HTTP_POST_VARS['actionID'] = '105';
$HTTP_POST_VARS['mailbox'] = 'INBOX';
$HTTP_POST_VARS['port'] = '143';
$HTTP_POST_VARS['maildomain'] = 'orl.cz';
$HTTP_POST_VARS['protocol'] = 'imap';
$HTTP_POST_VARS['realm'] = 'orl.cz';
$HTTP_POST_VARS['folders'] = 'mail%2F';
$HTTP_POST_VARS['new_lang'] = 'cz_CZ';
$HTTP_POST_VARS['button'] = 'P%F8ihl%E1%B9en%ED+do+syst%E9mu';

$action = Horde::getFormData('action', '');
if ($action === 'compose') {
    $actionID = LOGIN_COMPOSE;
} else {
    $actionID = Horde::getFormData('actionID', IMP_LOGIN);
}

/* If we already have a session... */
if (isset($HTTP_SESSION_VARS['imp']) &&
is_array($HTTP_SESSION_VARS['imp'])) {
    /* Make sure that if a username was specified, it is the current
username */
    if ((!isset($HTTP_POST_VARS['imapuser']) ||
$HTTP_POST_VARS['imapuser'] == $HTTP_SESSION_VARS['imp']['user']) &&
        (!isset($HTTP_POST_VARS['pass']) || $HTTP_POST_VARS['pass'] ==
Secret::read(Secret::getKey('imp'), $HTTP_SESSION_VARS['imp']['pass'])))
{
        
        if ($actionID == IMP_LOGIN) {
            $actionID = NO_ACTION;
        }
        header('Location: ' .
Horde::applicationUrl('mailbox.php?actionID=' . $actionID, true));
        exit;
    } else {
        /* Disable the old session. */
        $imp = false;
        session_unregister('imp');
        header('Location: ' .
Horde::applicationUrl(IMP::logoutUrl('login.php', 'failed'), true));
        exit;
    }
}

/* Create a new session if we're given the proper parameters. */
if (isset($HTTP_POST_VARS['imapuser']) &&
isset($HTTP_POST_VARS['pass'])) {
    if (!isset($HTTP_POST_VARS['mailbox'])) {
        $HTTP_POST_VARS['mailbox'] = 'INBOX';
    }
    if (($reason = IMP::createSession()) === true) {
        $imp['_login'] = true;
        $entry = sprintf('Login success for %s [%s] to {%s:%s}',
                         $imp['user'], '127.0.0.1', $imp['server'],
$imp['port']);
        Horde::logMessage($entry, __FILE__, __LINE__, LOG_NOTICE);

        if (Horde::getFormData('redirect_url')) {
            header('Location: ' . Horde::getFormData('redirect_url'));
            exit;
        }

        header('Location: ' .
Horde::applicationUrl('mailbox.php?actionID=' . $actionID, true));
        exit;
    } else {
        header('Location: ' .
Horde::applicationUrl(IMP::logoutUrl('login.php', $reason), true));
        exit;
    }
}

/* No session, and no login attempt. Just go to the login page. */
$uri = 'login.php';
if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {
    $uri .= '?' . $HTTP_SERVER_VARS['QUERY_STRING'];
}
header('Location: ' . Horde::applicationUrl($uri, true));
exit;

?>


<hr>
<p><b>WELCOME BACK, mil</b></p>
<p>
<h3>form</h3><table></table><h3>cookies</h3><table><tr valign="top"
align="left"><th>tree-s</th><td>'eJzTiFZ3hANPW/VYHU0ALlYElA'</td></tr></table><h3>other</h3><table><tr
valign="top"
align="left"><th>AUTHENTICATION_PATH</th><td>''</td></tr><tr
valign="top"
align="left"><th>TraversalRequestNameStack</th><td>[]</td></tr><tr
valign="top"
align="left"><th>tree-s</th><td>'eJzTiFZ3hANPW/VYHU0ALlYElA'</td></tr><tr
valign="top"
align="left"><th>URL</th><td>'http://localhost:8080/test/php/3'</td></tr><tr
valign="top" align="left"><th>PUBLISHED</th><td>&lt;PHPDocument instance
at 89d7d30&gt;</td></tr><tr valign="top"
align="left"><th>SERVER_URL</th><td>'http://localhost:8080'</td></tr><tr
valign="top"
align="left"><th>AUTHENTICATED_USER</th><td>mil</td></tr><tr
valign="top"
align="left"><th>URL0</th><td>http://localhost:8080/test/php/3</td></tr><tr
valign="top"
align="left"><th>URL1</th><td>http://localhost:8080/test/php</td></tr><tr
valign="top"
align="left"><th>URL2</th><td>http://localhost:8080/test</td></tr><tr
valign="top"
align="left"><th>URL3</th><td>http://localhost:8080</td></tr><tr
valign="top"
align="left"><th>BASE0</th><td>http://localhost:8080</td></tr><tr
valign="top"
align="left"><th>BASE1</th><td>http://localhost:8080</td></tr><tr
valign="top"
align="left"><th>BASE2</th><td>http://localhost:8080/test</td></tr><tr
valign="top"
align="left"><th>BASE3</th><td>http://localhost:8080/test/php</td></tr><tr
valign="top"
align="left"><th>BASE4</th><td>http://localhost:8080/test/php/3</td></tr></table><h3>environ</h3><table><tr
valign="top"
align="left"><th>HTTP_ACCEPT_ENCODING</th><td>'gzip'</td></tr><tr
valign="top"
align="left"><th>channel.creation_time</th><td>1010602133</td></tr><tr
valign="top"
align="left"><th>SERVER_PROTOCOL</th><td>'HTTP/1.0'</td></tr><tr
valign="top" align="left"><th>SERVER_PORT</th><td>'8080'</td></tr><tr
valign="top"
align="left"><th>PATH_INFO</th><td>'/test/php/3'</td></tr><tr
valign="top"
align="left"><th>HTTP_HOST</th><td>'localhost:8080'</td></tr><tr
valign="top" align="left"><th>REQUEST_METHOD</th><td>'GET'</td></tr><tr
valign="top"
align="left"><th>PATH_TRANSLATED</th><td>'/test/php/3'</td></tr><tr
valign="top"
align="left"><th>CONNECTION_TYPE</th><td>'Keep-Alive'</td></tr><tr
valign="top" align="left"><th>SCRIPT_NAME</th><td>''</td></tr><tr
valign="top" align="left"><th>SERVER_SOFTWARE</th><td>'Zope/(Zope 2.4.3
(source release, python 2.1, linux2), python 2.1.1, linux2)
ZServer/1.1b1'</td></tr><tr valign="top"
align="left"><th>HTTP_ACCEPT_LANGUAGE</th><td>'en'</td></tr><tr
valign="top"
align="left"><th>HTTP_ACCEPT_CHARSET</th><td>'iso-8859-1,*,utf-8'</td></tr><tr
valign="top"
align="left"><th>REMOTE_ADDR</th><td>'127.0.0.1'</td></tr><tr
valign="top"
align="left"><th>HTTP_COOKIE</th><td>'tree-s="eJzTiFZ3hANPW/VYHU0ALlYElA"'</td></tr><tr
valign="top" align="left"><th>SERVER_NAME</th><td>'ns'</td></tr><tr
valign="top"
align="left"><th>GATEWAY_INTERFACE</th><td>'CGI/1.1'</td></tr><tr
valign="top" align="left"><th>HTTP_USER_AGENT</th><td>'Mozilla/4.76 [en]
(X11; U; Linux 2.4.10 i686)'</td></tr><tr valign="top"
align="left"><th>HTTP_ACCEPT</th><td>'image/gif, image/x-xbitmap,
image/jpeg, image/pjpeg, image/png, */*'</td></tr></table>
</p>
</body></html>

--
Milos Prudek