]> git.mxchange.org Git - friendica.git/blob - mod/follow.php
turn "follow" into a function
[friendica.git] / mod / follow.php
1 <?php
2
3 require_once('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 = $orig_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         if(strstr($return_url,'contacts'))
28                 goaway($a->get_baseurl() . '/contacts/' . $contact_id);
29
30         goaway($return_url);
31         // NOTREACHED
32 }