summaryrefslogtreecommitdiff
path: root/app/Core/Http
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-01-30 20:38:20 -0500
committerFrederic Guillot <fred@kanboard.net>2016-01-30 20:38:20 -0500
commit5c92f467867b43034b9e66b46b3b465ba9db655c (patch)
treecb0855ea64d8bba3abe4dfe978c5dbabb745911d /app/Core/Http
parentec66a779c9158830fe4bb0f96a44eadfe697ef00 (diff)
Add external links for tasks with plugin api
Diffstat (limited to 'app/Core/Http')
-rw-r--r--app/Core/Http/Client.php13
-rw-r--r--app/Core/Http/Response.php5
2 files changed, 16 insertions, 2 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..a0d8137b 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);
+ header('X-Ajax-Redirect: '.($self ? 'self' : $url));
} else {
header('Location: '.$url);
}