2010-09-17 12:10:19 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
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
|
|
|
|
2016-02-05 21:52:39 +01:00
|
|
|
if(! function_exists('like_content')) {
|
2010-09-17 12:10:19 +02:00
|
|
|
function like_content(&$a) {
|
|
|
|
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']));
|
|
|
|
|
|
|
|
if(! $verb)
|
|
|
|
$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);
|
|
|
|
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'] : '');
|
|
|
|
|
|
|
|
like_content_return($a->get_baseurl(), $return_path);
|
|
|
|
killme(); // NOTREACHED
|
2012-06-10 02:39:21 +02:00
|
|
|
// return; // NOTREACHED
|
|
|
|
}
|
2016-02-05 21:52:39 +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-05 21:52:39 +01:00
|
|
|
if(! function_exists('like_content_return')) {
|
2013-01-26 20:52:21 +01:00
|
|
|
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();
|
|
|
|
}
|
2016-02-05 21:52:39 +01:00
|
|
|
}
|