changes by Marco

I removed the events of uid=0, thats more like the code in src/Model/Event. I also renamed some return keys.
This commit is contained in:
Tobias Diekershoff 2020-02-15 09:17:05 +01:00
parent 2801efd795
commit d38b3e5dab
1 changed files with 12 additions and 13 deletions

View File

@ -429,35 +429,34 @@ function api_error($type, $e, App\Arguments $args)
function api_events_show($type)
{
$a = \get_app();
$user_info = api_get_user($a);
if (api_user() === false || $user_info === false)
{
throw new ForbiddenException();
throw new ForbiddenException();
}
$since_id = $_REQUEST['since_id'] ?? 0;
$count = $_REQUEST['count'] ?? 20;
$condition = ["`id` > ? AND (`uid` = 0 OR (`uid` = ?))", $since_id, api_user()];
$condition = ["`id` > ? AND `uid` = ?", $since_id, api_user()];
$params = ['limit'=> $count];
$terms = DBA::select('event',[] , $condition, $params);
$terms = DBA::select('event', [], $condition, $params);
$events = [];
while ($term = DBA::fetch($terms))
{
$events[] = [
$events[]= [
'id' => intval($term['id']),
'uid' => intval($term['uid']),
'cid' => $term['cid'],
'uri' => $term['uri'],
'summary' => $term['summary'],
'name' => $term['summary'],
'desc' => BBCode::convert($term['desc']),
'start' => $term['start'],
'finish' => $term['finish'],
'startTime' => $term['start'],
'endTime' => $term['finish'],
'type' => $term['type'],
'nofinish' => $term['nofinish'],
'location' => $term['location'],
'place' => $term['location'],
'adjust' => $term['adjust'],
'ignore' => $term['ignore'],
'allow_cid' => $term['allow_cid'],
@ -470,9 +469,9 @@ function api_events_show($type)
DBA::close($terms);
return api_format_data('events', $type, ['events' => $events]);
}
api_register_func('api/friendica/events/show', 'api_events_show', true);
}
api_register_func('api/friendica/events/show', 'api_events_show', true);
/**
* Set values for RSS template