From 989ac2fda800b826addbf70eff4feccde1c352ba Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 10 Apr 2022 11:03:24 +0000 Subject: [PATCH] Some more "exit" replaced --- mod/cal.php | 3 +-- mod/events.php | 14 +++++--------- mod/fbrowser.php | 4 ++-- mod/oexchange.php | 5 +++-- src/Module/ParseUrl.php | 6 ++---- view/templates/oexchange_xrd.tpl | 2 -- view/templates/poco_xml.tpl | 1 - 7 files changed, 13 insertions(+), 22 deletions(-) diff --git a/mod/cal.php b/mod/cal.php index dea1c2b9ea..3f249da0ac 100644 --- a/mod/cal.php +++ b/mod/cal.php @@ -254,8 +254,7 @@ function cal_content(App $a) ]); if (!empty($_GET['id'])) { - echo $o; - exit(); + System::httpExit($o); } return $o; diff --git a/mod/events.php b/mod/events.php index 4db595ccc0..082cdf55dd 100644 --- a/mod/events.php +++ b/mod/events.php @@ -27,6 +27,7 @@ use Friendica\Core\ACL; use Friendica\Core\Logger; use Friendica\Core\Protocol; use Friendica\Core\Renderer; +use Friendica\Core\System; use Friendica\Core\Theme; use Friendica\Core\Worker; use Friendica\Database\DBA; @@ -122,8 +123,7 @@ function events_post(App $a) if (strcmp($finish, $start) < 0 && !$nofinish) { notice(DI::l10n()->t('Event can not end before it has started.')); if (intval($_REQUEST['preview'])) { - echo DI::l10n()->t('Event can not end before it has started.'); - exit(); + System::httpExit(DI::l10n()->t('Event can not end before it has started.')); } DI::baseUrl()->redirect($onerror_path); } @@ -131,8 +131,7 @@ function events_post(App $a) if (!$summary || ($start === DBA::NULL_DATETIME)) { notice(DI::l10n()->t('Event title and start time are required.')); if (intval($_REQUEST['preview'])) { - echo DI::l10n()->t('Event title and start time are required.'); - exit(); + System::httpExit(DI::l10n()->t('Event title and start time are required.')); } DI::baseUrl()->redirect($onerror_path); } @@ -192,9 +191,7 @@ function events_post(App $a) $datarray['id'] = $event_id; if (intval($_REQUEST['preview'])) { - $html = Event::getHTML($datarray); - echo $html; - exit(); + System::httpExit(Event::getHTML($datarray)); } $event_id = Event::store($datarray); @@ -391,8 +388,7 @@ function events_content(App $a) ]); if (!empty($_GET['id'])) { - echo $o; - exit(); + System::httpExit($o); } return $o; diff --git a/mod/fbrowser.php b/mod/fbrowser.php index d918021cf2..1646b19dff 100644 --- a/mod/fbrowser.php +++ b/mod/fbrowser.php @@ -24,6 +24,7 @@ use Friendica\App; use Friendica\Core\Renderer; +use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Photo; @@ -153,7 +154,6 @@ function fbrowser_content(App $a) if (!empty($_GET['mode'])) { return $o; } else { - echo $o; - exit(); + System::httpExit($o); } } diff --git a/mod/oexchange.php b/mod/oexchange.php index 31306a608e..e279bfff29 100644 --- a/mod/oexchange.php +++ b/mod/oexchange.php @@ -21,7 +21,9 @@ use Friendica\App; use Friendica\Core\Renderer; +use Friendica\Core\System; use Friendica\DI; +use Friendica\Module\Response; use Friendica\Module\Security\Login; function oexchange_init(App $a) { @@ -30,8 +32,7 @@ function oexchange_init(App $a) { $tpl = Renderer::getMarkupTemplate('oexchange_xrd.tpl'); $o = Renderer::replaceMacros($tpl, ['$base' => DI::baseUrl()]); - echo $o; - exit(); + System::httpExit($o, Response::TYPE_XML); } } diff --git a/src/Module/ParseUrl.php b/src/Module/ParseUrl.php index afb54ea325..91d09240b7 100644 --- a/src/Module/ParseUrl.php +++ b/src/Module/ParseUrl.php @@ -88,8 +88,7 @@ class ParseUrl extends BaseModule if ($format == 'json') { System::jsonExit($arr['text']); } else { - echo $arr['text']; - exit(); + System::httpExit($arr['text']); } } @@ -122,8 +121,7 @@ class ParseUrl extends BaseModule System::jsonExit($ret); } else { - echo BBCode::embedURL($url, empty($_GET['noAttachment']), $title, $description, $_GET['tags'] ?? ''); - exit(); + System::httpExit(BBCode::embedURL($url, empty($_GET['noAttachment']), $title, $description, $_GET['tags'] ?? '')); } } } diff --git a/view/templates/oexchange_xrd.tpl b/view/templates/oexchange_xrd.tpl index aa952c0f49..7c31f2126c 100644 --- a/view/templates/oexchange_xrd.tpl +++ b/view/templates/oexchange_xrd.tpl @@ -1,4 +1,3 @@ - @@ -31,4 +30,3 @@ type="text/html" /> - diff --git a/view/templates/poco_xml.tpl b/view/templates/poco_xml.tpl index 82c67c8de5..0e38a692c4 100644 --- a/view/templates/poco_xml.tpl +++ b/view/templates/poco_xml.tpl @@ -1,4 +1,3 @@ - {{if $response.sorted}}{{$response.sorted}}{{/if}} -- 2.39.5