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