summaryrefslogtreecommitdiff
path: root/app/Core/Http
diff options
context:
space:
mode:
author85pando <85pando@googlemail.com>2016-02-05 10:28:40 +0100
committer85pando <85pando@googlemail.com>2016-02-05 10:28:40 +0100
commit791d13c87bf510d913973b77a5f6d152311a1d87 (patch)
tree81412e8dbd3ac4fa0047030a6068afafd975687e /app/Core/Http
parent2074aaaa9a75455097e4e77ca09f4fba3e567052 (diff)
parent12aaec03b19a07635f59b00f532c92c37ac1df5f (diff)
Merge remote-tracking branch 'refs/remotes/upstream/master'
Conflicts: app/Locale/de_DE/translations.php
Diffstat (limited to 'app/Core/Http')
-rw-r--r--app/Core/Http/Client.php13
-rw-r--r--app/Core/Http/Response.php7
2 files changed, 17 insertions, 3 deletions
diff --git a/app/Core/Http/Client.php b/app/Core/Http/Client.php
index c6bf36a6..12b0a1cb 100644
--- a/app/Core/Http/Client.php
+++ b/app/Core/Http/Client.php
@@ -34,6 +34,19 @@ class Client extends Base
const HTTP_USER_AGENT = 'Kanboard';
/**
+ * Send a GET HTTP request
+ *
+ * @access public
+ * @param string $url
+ * @param string[] $headers
+ * @return string
+ */
+ public function get($url, array $headers = array())
+ {
+ return $this->doRequest('GET', $url, '', $headers);
+ }
+
+ /**
* Send a GET HTTP request and parse JSON response
*
* @access public
diff --git a/app/Core/Http/Response.php b/app/Core/Http/Response.php
index 7fefddeb..d098f519 100644
--- a/app/Core/Http/Response.php
+++ b/app/Core/Http/Response.php
@@ -68,11 +68,12 @@ class Response extends Base
*
* @access public
* @param string $url Redirection URL
+ * @param boolean $self If Ajax request and true: refresh the current page
*/
- public function redirect($url)
+ public function redirect($url, $self = false)
{
- if ($this->request->getServerVariable('HTTP_X_REQUESTED_WITH') === 'XMLHttpRequest') {
- header('X-Ajax-Redirect: '.$url);
+ if ($this->request->isAjax()) {
+ header('X-Ajax-Redirect: '.($self ? 'self' : $url));
} else {
header('Location: '.$url);
}