From 7c4a7bff2e6b2a5747db6f770780e643d58cd397 Mon Sep 17 00:00:00 2001 From: Philipp Date: Wed, 2 Nov 2022 08:59:46 +0100 Subject: [PATCH] Move new events routes to calendar routes --- src/Module/{Events => Calendar}/Export.php | 6 +++--- src/Module/{Events => Calendar}/Json.php | 12 ++++++------ static/routes.config.php | 6 +++--- view/templates/event_head.tpl | 2 +- view/templates/widget/events.tpl | 4 ++-- view/theme/quattro/templates/events_reminder.tpl | 2 +- view/theme/vier/templates/event_head.tpl | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) rename src/Module/{Events => Calendar}/Export.php (95%) rename src/Module/{Events => Calendar}/Json.php (94%) diff --git a/src/Module/Events/Export.php b/src/Module/Calendar/Export.php similarity index 95% rename from src/Module/Events/Export.php rename to src/Module/Calendar/Export.php index fef3ed8be..30a1bc44d 100644 --- a/src/Module/Events/Export.php +++ b/src/Module/Calendar/Export.php @@ -19,7 +19,7 @@ * */ -namespace Friendica\Module\Events; +namespace Friendica\Module\Calendar; use Friendica\App; use Friendica\BaseModule; @@ -34,7 +34,7 @@ use Friendica\Util\Profiler; use Psr\Log\LoggerInterface; /** - * Controller to export calendar + * Controller to export a calendar from a given user */ class Export extends BaseModule { @@ -88,7 +88,7 @@ class Export extends BaseModule // If nothing went wrong we can echo the export content if ($evexport["success"]) { - $this->response->setHeader(sprintf('content-disposition: attachment; filename="%s-%s.%s"', + $this->response->setHeader(sprintf('Content-Disposition: attachment; filename="%s-%s.%s"', $this->t('calendar'), $this->parameters['nickname'], $evexport["extension"] diff --git a/src/Module/Events/Json.php b/src/Module/Calendar/Json.php similarity index 94% rename from src/Module/Events/Json.php rename to src/Module/Calendar/Json.php index 2072c4f32..08481e6ac 100644 --- a/src/Module/Events/Json.php +++ b/src/Module/Calendar/Json.php @@ -19,7 +19,7 @@ * */ -namespace Friendica\Module\Events; +namespace Friendica\Module\Calendar; use Friendica\Core\System; use Friendica\Database\DBA; @@ -51,17 +51,17 @@ class Json extends \Friendica\BaseModule $start = sprintf('%d-%d-%d %d:%d:%d', $y, $m, 1, 0, 0, 0); $finish = sprintf('%d-%d-%d %d:%d:%d', $y, $m, $dim, 23, 59, 59); - if (!empty($_GET['start'])) { - $start = $_GET['start']; + if (!empty($request['start'])) { + $start = $request['start']; } - if (!empty($_GET['end'])) { - $finish = $_GET['end']; + if (!empty($request['end'])) { + $finish = $request['end']; } // put the event parametes in an array so we can better transmit them $event_params = [ - 'event_id' => intval($_GET['id'] ?? 0), + 'event_id' => intval($request['id'] ?? 0), 'start' => $start, 'finish' => $finish, 'ignore' => 0, diff --git a/static/routes.config.php b/static/routes.config.php index e344de75c..e3098c3ae 100644 --- a/static/routes.config.php +++ b/static/routes.config.php @@ -365,6 +365,9 @@ return [ '/bookmarklet' => [Module\Bookmarklet::class, [R::GET]], + '/calendar/{nickname}/export[/{format}]' => [Module\Calendar\Export::class, [R::GET]], + '/calendar/json' => [Module\Calendar\Json::class, [R::GET]], + '/community[/{content}]' => [Module\Conversation\Community::class, [R::GET]], '/compose[/{type}]' => [Module\Item\Compose::class, [R::GET, R::POST]], @@ -398,9 +401,6 @@ return [ '/dirfind' => [Module\Search\Directory::class, [R::GET]], '/directory' => [Module\Directory::class, [R::GET]], - '/events/{nickname}/export[/{format}]' => [Module\Events\Export::class, [R::GET]], - '/events/json' => [Module\Events\Json::class, [R::GET]], - '/featured/{nickname}' => [Module\ActivityPub\Featured::class, [R::GET]], '/feed' => [ diff --git a/view/templates/event_head.tpl b/view/templates/event_head.tpl index 307540806..1627bd699 100644 --- a/view/templates/event_head.tpl +++ b/view/templates/event_head.tpl @@ -81,7 +81,7 @@ week: '{{$i18n.week|escape:'quotes'}}', day: '{{$i18n.day|escape:'quotes'}}' }, - events: '{{$baseurl}}{{$module_url}}/json/', + events: '{{$baseurl}}/calendar/json', header: { left: 'prev,next today', center: 'title', diff --git a/view/templates/widget/events.tpl b/view/templates/widget/events.tpl index c83542778..10f142cb3 100644 --- a/view/templates/widget/events.tpl +++ b/view/templates/widget/events.tpl @@ -3,7 +3,7 @@

{{$etitle}}

diff --git a/view/theme/quattro/templates/events_reminder.tpl b/view/theme/quattro/templates/events_reminder.tpl index d0bc1f481..e72384f32 100644 --- a/view/theme/quattro/templates/events_reminder.tpl +++ b/view/theme/quattro/templates/events_reminder.tpl @@ -22,7 +22,7 @@ year: yesterday.getFullYear(), month: yesterday.getMonth(), date: yesterday.getDate(), - events: '{{$baseurl}}/events/json/', + events: '{{$baseurl}}/calendar/json/', header: false, timeFormat: 'H(:mm)', defaultView: 'basicWeek', diff --git a/view/theme/vier/templates/event_head.tpl b/view/theme/vier/templates/event_head.tpl index 2c7b3070a..817204a31 100644 --- a/view/theme/vier/templates/event_head.tpl +++ b/view/theme/vier/templates/event_head.tpl @@ -87,7 +87,7 @@ week: '{{$i18n.week|escape:'quotes'}}', day: '{{$i18n.day|escape:'quotes'}}' }, - events: '{{$baseurl}}{{$module_url}}/json/', + events: '{{$baseurl}}/calendar/json', header: { left: 'prev,next today', center: 'title',