2010-09-17 12:10:19 +02:00
|
|
|
<?php
|
|
|
|
|
2017-04-30 06:07:00 +02:00
|
|
|
use Friendica\App;
|
|
|
|
|
2010-09-17 12:10:19 +02:00
|
|
|
require_once('include/security.php');
|
|
|
|
require_once('include/bbcode.php');
|
|
|
|
require_once('include/items.php');
|
2015-12-27 13:52:46 +01:00
|
|
|
require_once('include/like.php');
|
2010-09-17 12:10:19 +02:00
|
|
|
|
2017-01-09 13:14:25 +01:00
|
|
|
function like_content(App $a) {
|
2017-03-21 17:02:59 +01:00
|
|
|
if(! local_user() && ! remote_user()) {
|
2015-12-27 13:52:46 +01:00
|
|
|
return false;
|
2010-09-17 12:10:19 +02:00
|
|
|
}
|
|
|
|
|
2015-12-27 13:52:46 +01:00
|
|
|
|
2010-09-17 12:10:19 +02:00
|
|
|
$verb = notags(trim($_GET['verb']));
|
|
|
|
|
2017-03-21 17:02:59 +01:00
|
|
|
if(! $verb)
|
2010-09-17 12:10:19 +02:00
|
|
|
$verb = 'like';
|
|
|
|
|
|
|
|
$item_id = (($a->argc > 1) ? notags(trim($a->argv[1])) : 0);
|
|
|
|
|
2015-12-27 13:52:46 +01:00
|
|
|
$r = do_like($item_id, $verb);
|
2017-03-21 17:02:59 +01:00
|
|
|
if (!$r) return;
|
2012-06-03 07:56:42 +02:00
|
|
|
|
2013-01-26 20:52:21 +01:00
|
|
|
// See if we've been passed a return path to redirect to
|
|
|
|
$return_path = ((x($_REQUEST,'return')) ? $_REQUEST['return'] : '');
|
|
|
|
|
2016-12-19 14:26:13 +01:00
|
|
|
like_content_return(App::get_baseurl(), $return_path);
|
2013-01-26 20:52:21 +01:00
|
|
|
killme(); // NOTREACHED
|
2012-06-10 02:39:21 +02:00
|
|
|
// return; // NOTREACHED
|
|
|
|
}
|
2016-02-07 15:11:34 +01:00
|
|
|
|
2012-06-10 02:39:21 +02:00
|
|
|
|
2013-01-26 20:52:21 +01:00
|
|
|
// Decide how to return. If we were called with a 'return' argument,
|
|
|
|
// then redirect back to the calling page. If not, just quietly end
|
2016-02-07 15:11:34 +01:00
|
|
|
|
2013-01-26 20:52:21 +01:00
|
|
|
function like_content_return($baseurl, $return_path) {
|
|
|
|
|
2017-03-21 17:02:59 +01:00
|
|
|
if($return_path) {
|
2013-01-26 20:52:21 +01:00
|
|
|
$rand = '_=' . time();
|
2017-03-21 17:02:59 +01:00
|
|
|
if(strpos($return_path, '?')) $rand = "&$rand";
|
|
|
|
else $rand = "?$rand";
|
2013-01-26 20:52:21 +01:00
|
|
|
|
|
|
|
goaway($baseurl . "/" . $return_path . $rand);
|
|
|
|
}
|
|
|
|
|
|
|
|
killme();
|
|
|
|
}
|
2016-02-07 15:11:34 +01:00
|
|
|
|