]> git.mxchange.org Git - friendica.git/blob - mod/like.php
Merge remote-tracking branch 'upstream/develop' into 1612-unused-indexes
[friendica.git] / mod / like.php
1 <?php
2
3 require_once('include/security.php');
4 require_once('include/bbcode.php');
5 require_once('include/items.php');
6 require_once('include/like.php');
7
8 function like_content(&$a) {
9         if(! local_user() && ! remote_user()) {
10                 return false;
11         }
12
13
14         $verb = notags(trim($_GET['verb']));
15
16         if(! $verb)
17                 $verb = 'like';
18
19         $item_id = (($a->argc > 1) ? notags(trim($a->argv[1])) : 0);
20
21         $r = do_like($item_id, $verb);
22         if (!$r) return;
23
24         // See if we've been passed a return path to redirect to
25         $return_path = ((x($_REQUEST,'return')) ? $_REQUEST['return'] : '');
26
27         like_content_return(App::get_baseurl(), $return_path);
28         killme(); // NOTREACHED
29 //      return; // NOTREACHED
30 }
31
32
33 // Decide how to return. If we were called with a 'return' argument,
34 // then redirect back to the calling page. If not, just quietly end
35
36 function like_content_return($baseurl, $return_path) {
37
38         if($return_path) {
39                 $rand = '_=' . time();
40                 if(strpos($return_path, '?')) $rand = "&$rand";
41                 else $rand = "?$rand";
42
43                 goaway($baseurl . "/" . $return_path . $rand);
44         }
45
46         killme();
47 }
48