The boot.php had been cleared of most functions

This commit is contained in:
Michael 2021-11-04 20:29:59 +00:00
parent 4989d1fa99
commit 63da4a75e9
37 changed files with 279 additions and 401 deletions

View file

@ -23,6 +23,7 @@ namespace Friendica\Module\ActivityPub;
use Friendica\BaseModule;
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Protocol\ActivityPub;
@ -48,7 +49,7 @@ class Inbox extends BaseModule
} else {
$filename = 'failed-activitypub';
}
$tempfile = tempnam(get_temppath(), $filename);
$tempfile = tempnam(System::getTempPath(), $filename);
file_put_contents($tempfile, json_encode(['parameters' => $parameters, 'header' => $_SERVER, 'body' => $postdata], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
Logger::notice('Incoming message stored', ['file' => $tempfile]);
}

View file

@ -24,6 +24,7 @@ namespace Friendica\Module\Admin;
use Friendica\App;
use Friendica\Core\Renderer;
use Friendica\Core\Search;
use Friendica\Core\System;
use Friendica\Core\Theme;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
@ -138,8 +139,8 @@ class Site extends BaseAdmin
$theme = (!empty($_POST['theme']) ? Strings::escapeTags(trim($_POST['theme'])) : '');
$theme_mobile = (!empty($_POST['theme_mobile']) ? Strings::escapeTags(trim($_POST['theme_mobile'])) : '');
$maximagesize = (!empty($_POST['maximagesize']) ? intval(trim($_POST['maximagesize'])) : 0);
$maximagelength = (!empty($_POST['maximagelength']) ? intval(trim($_POST['maximagelength'])) : MAX_IMAGE_LENGTH);
$jpegimagequality = (!empty($_POST['jpegimagequality']) ? intval(trim($_POST['jpegimagequality'])) : JPEG_QUALITY);
$maximagelength = (!empty($_POST['maximagelength']) ? intval(trim($_POST['maximagelength'])) : -1);
$jpegimagequality = (!empty($_POST['jpegimagequality']) ? intval(trim($_POST['jpegimagequality'])) : 100);
$register_policy = (!empty($_POST['register_policy']) ? intval(trim($_POST['register_policy'])) : 0);
$daily_registrations = (!empty($_POST['max_daily_registrations']) ? intval(trim($_POST['max_daily_registrations'])) : 0);
@ -463,7 +464,7 @@ class Site extends BaseAdmin
$additional_info = DI::config()->get('config', 'info');
// Automatically create temporary paths
get_temppath();
System::getTempPath();
/* Register policy */
$register_choices = [
@ -609,7 +610,7 @@ class Site extends BaseAdmin
'$worker_fastlane' => ['worker_fastlane', DI::l10n()->t('Enable fastlane'), DI::config()->get('system', 'worker_fastlane'), DI::l10n()->t('When enabed, the fastlane mechanism starts an additional worker if processes with higher priority are blocked by processes of lower priority.')],
'$relay_directly' => ['relay_directly', DI::l10n()->t('Direct relay transfer'), DI::config()->get('system', 'relay_directly'), DI::l10n()->t('Enables the direct transfer to other servers without using the relay servers')],
'$relay_scope' => ['relay_scope', DI::l10n()->t('Relay scope'), DI::config()->get('system', 'relay_scope'), DI::l10n()->t('Can be "all" or "tags". "all" means that every public post should be received. "tags" means that only posts with selected tags should be received.'), [SR_SCOPE_NONE => DI::l10n()->t('Disabled'), SR_SCOPE_ALL => DI::l10n()->t('all'), SR_SCOPE_TAGS => DI::l10n()->t('tags')]],
'$relay_scope' => ['relay_scope', DI::l10n()->t('Relay scope'), DI::config()->get('system', 'relay_scope'), DI::l10n()->t('Can be "all" or "tags". "all" means that every public post should be received. "tags" means that only posts with selected tags should be received.'), [Relay::SCOPE_NONE => DI::l10n()->t('Disabled'), Relay::SCOPE_ALL => DI::l10n()->t('all'), Relay::SCOPE_TAGS => DI::l10n()->t('tags')]],
'$relay_server_tags' => ['relay_server_tags', DI::l10n()->t('Server tags'), DI::config()->get('system', 'relay_server_tags'), DI::l10n()->t('Comma separated list of tags for the "tags" subscription.')],
'$relay_deny_tags' => ['relay_deny_tags', DI::l10n()->t('Deny Server tags'), DI::config()->get('system', 'relay_deny_tags'), DI::l10n()->t('Comma separated list of tags that are rejected.')],
'$relay_user_tags' => ['relay_user_tags', DI::l10n()->t('Allow user tags'), DI::config()->get('system', 'relay_user_tags'), DI::l10n()->t('If enabled, the tags from the saved searches will used for the "tags" subscription in addition to the "relay_server_tags".')],

View file

@ -59,7 +59,7 @@ abstract class BaseAdmin extends BaseModule
}
}
if (!is_site_admin()) {
if (!DI::app()->isSiteAdmin()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('You don\'t have access to administration pages.'));
}

View file

@ -67,7 +67,7 @@ class Invite extends BaseModule
if ($config->get('system', 'invitation_only')) {
$invitation_only = true;
$invites_remaining = DI::pConfig()->get(local_user(), 'system', 'invites_remaining');
if ((!$invites_remaining) && (!is_site_admin())) {
if ((!$invites_remaining) && (!$app->isSiteAdmin())) {
throw new HTTPException\ForbiddenException();
}
}
@ -82,11 +82,11 @@ class Invite extends BaseModule
continue;
}
if ($invitation_only && ($invites_remaining || is_site_admin())) {
if ($invitation_only && ($invites_remaining || $app->isSiteAdmin())) {
$code = Model\Register::createForInvitation();
$nmessage = str_replace('$invite_code', $code, $message);
if (!is_site_admin()) {
if (!$app->isSiteAdmin()) {
$invites_remaining--;
if ($invites_remaining >= 0) {
DI::pConfig()->set(local_user(), 'system', 'invites_remaining', $invites_remaining);
@ -138,7 +138,7 @@ class Invite extends BaseModule
if ($config->get('system', 'invitation_only')) {
$inviteOnly = true;
$x = DI::pConfig()->get(local_user(), 'system', 'invites_remaining');
if ((!$x) && (!is_site_admin())) {
if ((!$x) && (!$app->isSiteAdmin())) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('You have no more invitations available'));
}
}

View file

@ -51,7 +51,7 @@ class HTTPException
'$stack_trace' => DI::l10n()->t('Stack trace:'),
];
if (is_site_admin()) {
if (DI::app()->isSiteAdmin()) {
$vars['$thrown'] = DI::l10n()->t('Exception thrown in %s:%d', $e->getFile(), $e->getLine());
$vars['$trace'] = $e->getTraceAsString();
}

View file

@ -24,6 +24,7 @@ namespace Friendica\Module\WellKnown;
use Friendica\BaseModule;
use Friendica\DI;
use Friendica\Model\Search;
use Friendica\Protocol\Relay;
/**
* Node subscription preferences for social realy systems
@ -40,7 +41,7 @@ class XSocialRelay extends BaseModule
$systemTags = [];
$userTags = [];
if ($scope == SR_SCOPE_TAGS) {
if ($scope == Relay::SCOPE_TAGS) {
$server_tags = $config->get('system', 'relay_server_tags');
$tagitems = explode(',', $server_tags);
@ -57,7 +58,7 @@ class XSocialRelay extends BaseModule
$tagList = array_unique(array_merge($systemTags, $userTags));
$relay = [
'subscribe' => ($scope != SR_SCOPE_NONE),
'subscribe' => ($scope != Relay::SCOPE_NONE),
'scope' => $scope,
'tags' => $tagList,
'protocols' => [