Skip to content

Commit

Permalink
BUG Fix encoding of JS redirection script
Browse files Browse the repository at this point in the history
  • Loading branch information
Damian Mooyman committed Mar 27, 2014
1 parent ff9d40a commit f8e3bbe
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions control/HTTPResponse.php
Expand Up @@ -213,12 +213,14 @@ public function output() {
}

if(in_array($this->statusCode, self::$redirect_codes) && headers_sent($file, $line)) {
$url = Convert::raw2htmlatt($this->headers['Location']);
$url = (string)$this->headers['Location'];
$urlATT = Convert::raw2htmlatt($url);
$urlJS = Convert::raw2js($url);
echo
"<p>Redirecting to <a href=\"$url\" title=\"Click this link if your browser does not redirect you\">"
. "$url... (output started on $file, line $line)</a></p>
<meta http-equiv=\"refresh\" content=\"1; url=$url\" />
<script type=\"text/javascript\">setTimeout('window.location.href = \"$url\"', 50);</script>";
"<p>Redirecting to <a href=\"$urlATT\" title=\"Click this link if your browser does not redirect you\">"
. "$urlATT... (output started on $file, line $line)</a></p>
<meta http-equiv=\"refresh\" content=\"1; url=$urlATT\" />
<script type=\"text/javascript\">setTimeout(function(){ window.location.href = \"$urlJS\"; }, 50);</script>";
} else {
$line = $file = null;
if(!headers_sent($file, $line)) {
Expand Down

0 comments on commit f8e3bbe

Please sign in to comment.