Index: branches/5.0.x/core/kernel/application.php
===================================================================
diff -u -r13249 -r13258
--- branches/5.0.x/core/kernel/application.php (.../application.php) (revision 13249)
+++ branches/5.0.x/core/kernel/application.php (.../application.php) (revision 13258)
@@ -1,6 +1,6 @@
HTML = ob_get_clean() . $this->HTML . $this->Debugger->printReport(true);
}
else {
+ // send "Set-Cookie" header before any output is made
+ $this->Session->SetSession();
+
$this->HTML = ob_get_clean().$this->HTML;
}
@@ -1947,34 +1950,39 @@
$params['__URLENCODE__'] = 1;
$location = $this->HREF($t, $prefix, $params, $index_file);
- $a_location = $location;
- $location = "Location: $location";
-
if ($this->isDebugMode() && constOn('DBG_REDIRECT')) {
$this->Debugger->appendTrace();
- echo "Debug output above!!! Proceed to redirect: $a_location
";
+ echo "Debug output above!!! Proceed to redirect: $location
";
}
else {
if ($js_redirect) {
+ // show "redirect" template instead of redirecting,
+ // because "Set-Cookie" header won't work, when "Location"
+ // header is used later
$this->SetVar('t', 'redirect');
- $this->SetVar('redirect_to_js', addslashes($a_location) );
- $this->SetVar('redirect_to', $a_location);
+ $this->SetVar('redirect_to', $location);
+
+ // make all additional parameters available on "redirect" template too
+ foreach ($params as $name => $value) {
+ $this->SetVar($name, $value);
+ }
+
return true;
}
else {
if ($this->GetVar('ajax') == 'yes' && $t != $this->GetVar('t')) {
// redirection to other then current template during ajax request
- echo '#redirect#'.$a_location;
+ echo '#redirect#' . $location;
}
elseif (headers_sent() != '') {
// some output occured -> redirect using javascript
- echo '';
+ echo '';
}
else {
// no output before -> redirect using HTTP header
// header('HTTP/1.1 302 Found');
- header("$location");
+ header('Location: ' . $location);
}
}
}