Redirecting from own module to an URL with unordered params

Redirecting from own module to an URL with unordered params

Friday 07 December 2007 3:14:24 am - 1 reply

Modified on Friday 07 December 2007 4:12:26 am by Piotrek Karaś

Author Message

Piotrek Karaś

Friday 07 December 2007 5:10:08 am

Not for the first time further digging brings effects ;)

I followed all the path that script takes after redirection declaration, through /index.php and back to the eZHTTPTool, and then it became clear: eZHTTPTool::redirect is to be blame for what goes wrong with the brackets. So I took from it what I felt would be essential (almost everything) and here's my solution:

I secure unknown parts of the URL myself:

if( $http->hasPostVariable( 'xParam' ) )
{
 $myURL .= '/(xparam)/'.eZURI::encodeURL( $http->postVariable( 'xParam' ) );
}

Then, instead of using traditional redirection, I use this:

$url = eZHTTPTool::createRedirectUrl( $path, array() );

if ( strlen( $Module->RedirectStatus ) > 0 )
{
	header( $_SERVER['SERVER_PROTOCOL'] .  " " . $status );
	eZHTTPTool::headerVariable( "Status", $status );
}

// I REMOVE THIS LINE!
// $url = eZURI::encodeURL( $url );
eZHTTPTool::headerVariable( 'Location', $url );

echo '<HTML><HEAD>';
echo '<META HTTP-EQUIV="Refresh" Content="0;URL='. htmlspecialchars( $url ) .'">';
echo '<META HTTP-EQUIV="Location" Content="'. htmlspecialchars( $url ) .'">';
echo '</HEAD><BODY></BODY></HTML>';

What do you think? Any other way?

<b>By the way, since brackets are used by the system, shouldn't they be left alone by the eZURI::encodeURL? Isn't that a little inconsistency?</b>

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

You must be logged in to post messages in this topic!

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.