aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Follow.php
diff options
context:
space:
mode:
authormrjive <mrjive@mrjive.it>2018-03-13 10:59:21 +0100
committerGitHub <noreply@github.com>2018-03-13 10:59:21 +0100
commit790660e61264ed884a8c600f407cf75893ffe977 (patch)
tree8fb3e4263cd7cdf4b34e0d7bb859c2f290c8ab39 /Zotlabs/Module/Follow.php
parent2bcfa0c12687d47c11e8c445a5a38ffe96d5c135 (diff)
parent53c1d3775cc140ecda50d837752adac851d9e0b2 (diff)
downloadvolse-hubzilla-790660e61264ed884a8c600f407cf75893ffe977.tar.gz
volse-hubzilla-790660e61264ed884a8c600f407cf75893ffe977.tar.bz2
volse-hubzilla-790660e61264ed884a8c600f407cf75893ffe977.zip
Merge pull request #18 from redmatrix/dev
Dev
Diffstat (limited to 'Zotlabs/Module/Follow.php')
-rw-r--r--Zotlabs/Module/Follow.php22
1 files changed, 16 insertions, 6 deletions
diff --git a/Zotlabs/Module/Follow.php b/Zotlabs/Module/Follow.php
index d8a86d0ce..d441f21d2 100644
--- a/Zotlabs/Module/Follow.php
+++ b/Zotlabs/Module/Follow.php
@@ -14,21 +14,26 @@ class Follow extends \Zotlabs\Web\Controller {
}
$uid = local_channel();
- $url = notags(trim($_REQUEST['url']));
+ $url = notags(trim(unpunify($_REQUEST['url'])));
$return_url = $_SESSION['return_url'];
$confirm = intval($_REQUEST['confirm']);
-
+ $interactive = (($_REQUEST['interactive']) ? intval($_REQUEST['interactive']) : 1);
$channel = \App::get_channel();
- $result = new_contact($uid,$url,$channel,true,$confirm);
+ $result = new_contact($uid,$url,$channel,$interactive,$confirm);
if($result['success'] == false) {
if($result['message'])
notice($result['message']);
- goaway($return_url);
+ if($interactive) {
+ goaway($return_url);
+ }
+ else {
+ json_return_and_die($result);
+ }
}
- info( t('Channel added.') . EOL);
+ info( t('Connection added.') . EOL);
$clone = array();
foreach($result['abook'] as $k => $v) {
@@ -53,7 +58,12 @@ class Follow extends \Zotlabs\Web\Controller {
if(($can_view_stream) || ($result['abook']['xchan_network'] === 'rss'))
\Zotlabs\Daemon\Master::Summon(array('Onepoll',$result['abook']['abook_id']));
- goaway(z_root() . '/connedit/' . $result['abook']['abook_id'] . '?f=&follow=1');
+ if($interactive) {
+ goaway(z_root() . '/connedit/' . $result['abook']['abook_id'] . '?f=&follow=1');
+ }
+ else {
+ json_return_and_die([ 'success' => true ]);
+ }
}