2010-10-26 04:52:30 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once('Scrape.php');
|
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
|
|
|
|
|
|
|
if(! local_user()) {
|
|
|
|
notice( t('Permission denied.') . EOL);
|
|
|
|
goaway($_SESSION['return_url']);
|
|
|
|
// NOTREACHED
|
|
|
|
}
|
|
|
|
|
2012-05-08 06:09:57 +00:00
|
|
|
$uid = local_user();
|
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'];
|
|
|
|
|
2010-10-26 04:52:30 +00:00
|
|
|
|
2012-06-03 06:12:20 +00:00
|
|
|
$result = new_contact($uid,$url,true);
|
2011-05-22 00:13:51 +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
|
|
|
|
2012-06-03 06:17:49 +00:00
|
|
|
info( t('Contact added') . EOL);
|
|
|
|
|
2012-05-08 06:09:57 +00:00
|
|
|
if(strstr($return_url,'contacts'))
|
2011-12-18 20:41:46 +00:00
|
|
|
goaway($a->get_baseurl() . '/contacts/' . $contact_id);
|
|
|
|
|
2012-05-08 06:09:57 +00:00
|
|
|
goaway($return_url);
|
2010-10-26 04:52:30 +00:00
|
|
|
// NOTREACHED
|
|
|
|
}
|