]> git.mxchange.org Git - friendica.git/blob - mod/follow.php
Merge pull request #927 from annando/master
[friendica.git] / mod / follow.php
1 <?php
2
3 require_once('include/Scrape.php');
4 require_once('include/follow.php');
5
6 function follow_init(&$a) {
7
8         if(! local_user()) {
9                 notice( t('Permission denied.') . EOL);
10                 goaway($_SESSION['return_url']);
11                 // NOTREACHED
12         }
13
14         $uid = local_user();
15         $url = notags(trim($_REQUEST['url']));
16         $return_url = $_SESSION['return_url'];
17
18
19         $result = new_contact($uid,$url,true);
20
21         if($result['success'] == false) {
22                 if($result['message'])
23                         notice($result['message']);
24                 goaway($return_url);
25         }
26
27         info( t('Contact added') . EOL);
28
29         if(strstr($return_url,'contacts'))
30                 goaway($a->get_baseurl() . '/contacts/' . $contact_id);
31
32         goaway($return_url);
33         // NOTREACHED
34 }