2010-10-26 06:52:30 +02:00
|
|
|
<?php
|
|
|
|
|
2012-12-28 22:51:50 +01:00
|
|
|
require_once('include/Scrape.php');
|
2012-06-03 08:12:20 +02:00
|
|
|
require_once('include/follow.php');
|
2010-10-26 06:52:30 +02:00
|
|
|
|
2011-12-18 21:41:46 +01:00
|
|
|
function follow_init(&$a) {
|
2010-10-26 06:52:30 +02:00
|
|
|
|
|
|
|
if(! local_user()) {
|
|
|
|
notice( t('Permission denied.') . EOL);
|
|
|
|
goaway($_SESSION['return_url']);
|
|
|
|
// NOTREACHED
|
|
|
|
}
|
|
|
|
|
2012-05-08 08:09:57 +02:00
|
|
|
$uid = local_user();
|
2012-06-03 08:17:49 +02:00
|
|
|
$url = notags(trim($_REQUEST['url']));
|
2012-05-08 08:09:57 +02:00
|
|
|
$return_url = $_SESSION['return_url'];
|
|
|
|
|
2010-10-26 06:52:30 +02:00
|
|
|
|
2012-06-03 08:12:20 +02:00
|
|
|
$result = new_contact($uid,$url,true);
|
2011-05-22 02:13:51 +02:00
|
|
|
|
2012-06-03 08:12:20 +02:00
|
|
|
if($result['success'] == false) {
|
|
|
|
if($result['message'])
|
|
|
|
notice($result['message']);
|
2012-05-08 08:09:57 +02:00
|
|
|
goaway($return_url);
|
2010-11-22 00:44:26 +01:00
|
|
|
}
|
2010-10-26 06:52:30 +02:00
|
|
|
|
2012-06-03 08:17:49 +02:00
|
|
|
info( t('Contact added') . EOL);
|
|
|
|
|
2012-05-08 08:09:57 +02:00
|
|
|
if(strstr($return_url,'contacts'))
|
2011-12-18 21:41:46 +01:00
|
|
|
goaway($a->get_baseurl() . '/contacts/' . $contact_id);
|
|
|
|
|
2012-05-08 08:09:57 +02:00
|
|
|
goaway($return_url);
|
2010-10-26 06:52:30 +02:00
|
|
|
// NOTREACHED
|
|
|
|
}
|