diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/public/appframework/controller.php | 8 | ||||
-rw-r--r-- | lib/public/util.php | 14 |
2 files changed, 21 insertions, 1 deletions
diff --git a/lib/public/appframework/controller.php b/lib/public/appframework/controller.php index b8986c0b772..5c7292cd130 100644 --- a/lib/public/appframework/controller.php +++ b/lib/public/appframework/controller.php @@ -83,7 +83,13 @@ abstract class Controller { $data->getData(), $data->getStatus() ); - $response->setHeaders(array_merge($data->getHeaders(), $response->getHeaders())); + $dataHeaders = $data->getHeaders(); + $headers = $response->getHeaders(); + // do not overwrite Content-Type if it already exists + if (isset($dataHeaders['Content-Type'])) { + unset($headers['Content-Type']); + } + $response->setHeaders(array_merge($dataHeaders, $headers)); return $response; } else { return new JSONResponse($data); diff --git a/lib/public/util.php b/lib/public/util.php index 76b61347d46..2b81b6bfc49 100644 --- a/lib/public/util.php +++ b/lib/public/util.php @@ -670,4 +670,18 @@ class Util { } return self::$needUpgradeCache; } + + /** + * Returns whether the current request is coming from a + * famous awfully old browser. + * + * @return boolean true if it's IE8, false otherwise + */ + public static function isIE8() { + preg_match('/MSIE (.*?);/', $_SERVER['HTTP_USER_AGENT'], $matches); + if (count($matches) > 0 && $matches[1] <= 9) { + return true; + } + return false; + } } |