Simplify code to handle ajax popover and redirects

This commit is contained in:
Frederic Guillot
2016-01-30 22:25:16 -05:00
parent 4a52d327f7
commit bb040cfb78
27 changed files with 119 additions and 182 deletions

View File

@@ -72,7 +72,7 @@ class Response extends Base
*/
public function redirect($url, $self = false)
{
if ($this->request->getServerVariable('HTTP_X_REQUESTED_WITH') === 'XMLHttpRequest') {
if ($this->request->isAjax()) {
header('X-Ajax-Redirect: '.($self ? 'self' : $url));
} else {
header('Location: '.$url);