New function to exit the program

This commit is contained in:
Michael 2022-05-18 02:13:54 +00:00
commit f6167b4cfd
27 changed files with 73 additions and 94 deletions

View file

@ -39,13 +39,11 @@ use Friendica\Util\Strings;
function fbrowser_content(App $a)
{
if (!local_user()) {
DI::page()->logRuntime();
exit();
System::exit();
}
if (DI::args()->getArgc() == 1) {
DI::page()->logRuntime();
exit();
System::exit();
}
// Needed to match the correct template in a module that uses a different theme than the user/site/default

View file

@ -158,8 +158,7 @@ function photos_post(App $a)
if (!$can_post) {
notice(DI::l10n()->t('Permission denied.'));
DI::page()->logRuntime();
exit();
System::exit();
}
$owner_record = User::getOwnerDataById($page_owner_uid);
@ -167,8 +166,7 @@ function photos_post(App $a)
if (!$owner_record) {
notice(DI::l10n()->t('Contact information unavailable'));
DI::logger()->info('photos_post: unable to locate contact record for page owner. uid=' . $page_owner_uid);
DI::page()->logRuntime();
exit();
System::exit();
}
$aclFormatter = DI::aclFormatter();

View file

@ -22,6 +22,7 @@
use Friendica\App;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
@ -38,8 +39,7 @@ function hub_return($valid, $body)
} else {
throw new \Friendica\Network\HTTPException\NotFoundException();
}
DI::page()->logRuntime();
exit();
System::exit();
}
// when receiving an XML feed, always return OK

View file

@ -21,6 +21,7 @@
use Friendica\App;
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\PushSubscriber;
@ -142,6 +143,5 @@ function pubsubhubbub_init(App $a) {
throw new \Friendica\Network\HTTPException\AcceptedException();
}
DI::page()->logRuntime();
exit();
System::exit();
}

View file

@ -21,6 +21,7 @@
use Friendica\App;
use Friendica\Content\Text\BBCode;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Item;
@ -30,8 +31,7 @@ function share_init(App $a) {
$post_id = ((DI::args()->getArgc() > 1) ? intval(DI::args()->getArgv()[1]) : 0);
if (!$post_id || !local_user()) {
DI::page()->logRuntime();
exit();
System::exit();
}
$fields = ['private', 'body', 'author-name', 'author-link', 'author-avatar',
@ -39,8 +39,7 @@ function share_init(App $a) {
$item = Post::selectFirst($fields, ['id' => $post_id]);
if (!DBA::isResult($item) || $item['private'] == Item::PRIVATE) {
DI::page()->logRuntime();
exit();
System::exit();
}
if (strpos($item['body'], "[/share]") !== false) {
@ -58,6 +57,5 @@ function share_init(App $a) {
}
echo $o;
DI::page()->logRuntime();
exit();
System::exit();
}

View file

@ -167,6 +167,5 @@ EOT;
$post = Post::selectFirst(['uri-id', 'uid'], ['id' => $post_id]);
Worker::add(PRIORITY_HIGH, "Notifier", Delivery::POST, $post['uri-id'], $post['uid']);
DI::page()->logRuntime();
exit();
System::exit();
}

View file

@ -67,16 +67,14 @@ function wall_attach_post(App $a) {
System::jsonExit(['error' => DI::l10n()->t('Permission denied.')]);
}
notice(DI::l10n()->t('Permission denied.') . EOL );
DI::page()->logRuntime();
exit();
System::exit();
}
if (empty($_FILES['userfile'])) {
if ($r_json) {
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
}
DI::page()->logRuntime();
exit();
System::exit();
}
$src = $_FILES['userfile']['tmp_name'];
@ -99,8 +97,7 @@ function wall_attach_post(App $a) {
} else {
notice($msg);
}
DI::page()->logRuntime();
exit();
System::exit();
}
if ($maxfilesize && $filesize > $maxfilesize) {
@ -111,8 +108,7 @@ function wall_attach_post(App $a) {
} else {
echo $msg . EOL;
}
DI::page()->logRuntime();
exit();
System::exit();
}
$newid = Attach::storeFile($src, $page_owner_uid, $filename, '<' . $page_owner_cid . '>');
@ -126,8 +122,7 @@ function wall_attach_post(App $a) {
} else {
echo $msg . EOL;
}
DI::page()->logRuntime();
exit();
System::exit();
}
if ($r_json) {
@ -137,7 +132,6 @@ function wall_attach_post(App $a) {
$lf = "\n";
echo $lf . $lf . '[attachment]' . $newid . '[/attachment]' . $lf;
DI::page()->logRuntime();
exit();
System::exit();
// NOTREACHED
}

View file

@ -89,16 +89,14 @@ function wall_upload_post(App $a, $desktopmode = true)
System::jsonExit(['error' => DI::l10n()->t('Permission denied.')]);
}
notice(DI::l10n()->t('Permission denied.'));
DI::page()->logRuntime();
exit();
System::exit();
}
if (empty($_FILES['userfile']) && empty($_FILES['media'])) {
if ($r_json) {
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
}
DI::page()->logRuntime();
exit();
System::exit();
}
$src = '';
@ -150,8 +148,7 @@ function wall_upload_post(App $a, $desktopmode = true)
System::jsonExit(['error' => DI::l10n()->t('Invalid request.')]);
}
notice(DI::l10n()->t('Invalid request.'));
DI::page()->logRuntime();
exit();
System::exit();
}
$filetype = Images::getMimeTypeBySource($src, $filename, $filetype);
@ -170,8 +167,7 @@ function wall_upload_post(App $a, $desktopmode = true)
} else {
echo $msg. EOL;
}
DI::page()->logRuntime();
exit();
System::exit();
}
$Image->orient($src);
@ -209,8 +205,7 @@ function wall_upload_post(App $a, $desktopmode = true)
} else {
echo $msg. EOL;
}
DI::page()->logRuntime();
exit();
System::exit();
}
}
@ -234,8 +229,7 @@ function wall_upload_post(App $a, $desktopmode = true)
} else {
echo $msg. EOL;
}
DI::page()->logRuntime();
exit();
System::exit();
}
if ($width > 640 || $height > 640) {
@ -287,7 +281,6 @@ function wall_upload_post(App $a, $desktopmode = true)
}
echo "\n\n" . '[url=' . DI::baseUrl() . '/photos/' . $page_owner_nick . '/image/' . $resource_id . '][img]' . DI::baseUrl() . "/photo/{$resource_id}-{$smallest}.".$Image->getExt()."[/img][/url]\n\n";
DI::page()->logRuntime();
exit();
System::exit();
// NOTREACHED
}