X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Flike.php;h=77fc0aec20361373effb60997c7f8f6f283630db;hb=f70a80bbe56c87406799b66fae82b500ceae9646;hp=aaa85928c7c81059984e47bf55c9995480c1e9bf;hpb=a153621f71acf33768672b3bce312aae3a1b7059;p=friendica.git diff --git a/mod/like.php b/mod/like.php index aaa85928c7..77fc0aec20 100755 --- a/mod/like.php +++ b/mod/like.php @@ -105,6 +105,10 @@ function like_content(&$a) { } + // See if we've been passed a return path to redirect to + $return_path = ((x($_REQUEST,'return')) ? $_REQUEST['return'] : ''); + + $r = q("SELECT * FROM `item` WHERE `verb` = '%s' AND `deleted` = 0 AND `contact-id` = %d AND ( `parent` = '%s' OR `parent-uri` = '%s' OR `thr-parent` = '%s') LIMIT 1", dbesc($activity), @@ -137,7 +141,9 @@ function like_content(&$a) { // proc_run('php',"include/notifier.php","like","$post_id"); // $post_id isn't defined here! $like_item_id = $like_item['id']; proc_run('php',"include/notifier.php","like","$like_item_id"); - return; + + like_content_return($a->get_baseurl(), $return_path); + return; // NOTREACHED } $uri = item_new_uri($a->get_hostname(),$owner_uid); @@ -221,11 +227,29 @@ EOT; proc_run('php',"include/notifier.php","like","$post_id"); - killme(); + like_content_return($a->get_baseurl(), $return_path); + killme(); // NOTREACHED // return; // NOTREACHED } +// Decide how to return. If we were called with a 'return' argument, +// then redirect back to the calling page. If not, just quietly end + +function like_content_return($baseurl, $return_path) { + + if($return_path) { + $rand = '_=' . time(); + if(strpos($return_path, '?')) $rand = "&$rand"; + else $rand = "?$rand"; + + goaway($baseurl . "/" . $return_path . $rand); + } + + killme(); +} + + function store_diaspora_like_retract_sig($activity, $item, $like_item, $contact) { // Note that we can only create a signature for a user of the local server. We don't have // a key for remote users. That is ok, because if a remote user is "unlike"ing a post, it