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