friendica-github/mod/follow.php

35 lines
652 B
PHP
Raw Normal View History

<?php
require_once('Scrape.php');
2012-06-03 06:12:20 +00:00
require_once('include/follow.php');
2011-12-18 20:41:46 +00:00
function follow_init(&$a) {
if(! local_user()) {
notice( t('Permission denied.') . EOL);
goaway($_SESSION['return_url']);
// NOTREACHED
}
$uid = local_user();
2012-06-03 06:17:49 +00:00
$url = notags(trim($_REQUEST['url']));
$return_url = $_SESSION['return_url'];
2012-06-03 06:12:20 +00:00
$result = new_contact($uid,$url,true);
2012-06-03 06:12:20 +00:00
if($result['success'] == false) {
if($result['message'])
notice($result['message']);
goaway($return_url);
}
2012-06-03 06:17:49 +00:00
info( t('Contact added') . EOL);
if(strstr($return_url,'contacts'))
2011-12-18 20:41:46 +00:00
goaway($a->get_baseurl() . '/contacts/' . $contact_id);
goaway($return_url);
// NOTREACHED
}