2010-10-26 04:52:30 +00:00
|
|
|
<?php
|
|
|
|
|
2012-12-31 23:47:51 +00:00
|
|
|
|
2012-06-03 06:12:20 +00:00
|
|
|
require_once('include/follow.php');
|
2010-10-26 04:52:30 +00:00
|
|
|
|
2011-12-18 20:41:46 +00:00
|
|
|
function follow_init(&$a) {
|
2010-10-26 04:52:30 +00:00
|
|
|
|
2015-01-29 04:56:04 +00:00
|
|
|
if(! local_channel()) {
|
2012-12-31 23:47:51 +00:00
|
|
|
return;
|
2010-10-26 04:52:30 +00:00
|
|
|
}
|
|
|
|
|
2015-01-29 04:56:04 +00:00
|
|
|
$uid = local_channel();
|
2012-06-03 06:17:49 +00:00
|
|
|
$url = notags(trim($_REQUEST['url']));
|
2012-05-08 06:09:57 +00:00
|
|
|
$return_url = $_SESSION['return_url'];
|
2013-08-22 05:10:08 +00:00
|
|
|
$confirm = intval($_REQUEST['confirm']);
|
2012-05-08 06:09:57 +00:00
|
|
|
|
2013-08-22 05:10:08 +00:00
|
|
|
$result = new_contact($uid,$url,$a->get_channel(),true,$confirm);
|
2013-11-18 00:50:32 +00:00
|
|
|
|
2012-06-03 06:12:20 +00:00
|
|
|
if($result['success'] == false) {
|
|
|
|
if($result['message'])
|
|
|
|
notice($result['message']);
|
2012-05-08 06:09:57 +00:00
|
|
|
goaway($return_url);
|
2010-11-21 23:44:26 +00:00
|
|
|
}
|
2010-10-26 04:52:30 +00:00
|
|
|
|
2013-05-20 03:38:53 +00:00
|
|
|
info( t('Channel added.') . EOL);
|
2012-06-03 06:17:49 +00:00
|
|
|
|
2015-07-03 04:55:36 +00:00
|
|
|
$clone = array();
|
|
|
|
foreach($result['abook'] as $k => $v) {
|
|
|
|
if(strpos($k,'abook_') === 0) {
|
|
|
|
$clone[$k] = $v;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
unset($clone['abook_id']);
|
|
|
|
unset($clone['abook_account']);
|
|
|
|
unset($clone['abook_channel']);
|
|
|
|
|
|
|
|
build_sync_packet(0 /* use the current local_channel */, array('abook' => array($clone)));
|
|
|
|
|
|
|
|
|
2013-11-18 03:22:24 +00:00
|
|
|
// If we can view their stream, pull in some posts
|
|
|
|
|
2014-09-02 03:47:01 +00:00
|
|
|
if(($result['abook']['abook_their_perms'] & PERMS_R_STREAM) || ($result['abook']['xchan_network'] === 'rss'))
|
2013-11-18 03:22:24 +00:00
|
|
|
proc_run('php','include/onepoll.php',$result['abook']['abook_id']);
|
|
|
|
|
2014-03-08 07:00:27 +00:00
|
|
|
goaway(z_root() . '/connedit/' . $result['abook']['abook_id'] . '?f=&follow=1');
|
2011-12-18 20:41:46 +00:00
|
|
|
|
2010-10-26 04:52:30 +00:00
|
|
|
}
|
2013-03-05 04:58:39 +00:00
|
|
|
|
2013-03-06 00:01:07 +00:00
|
|
|
function follow_content(&$a) {
|
2013-03-05 04:58:39 +00:00
|
|
|
|
2015-01-29 04:56:04 +00:00
|
|
|
if(! local_channel()) {
|
2013-03-05 04:58:39 +00:00
|
|
|
return login();
|
|
|
|
}
|
|
|
|
}
|