Merge pull request #8034 from MrPetovan/bug/fatal-errors
Update missing references to DI
This commit is contained in:
commit
6546e99e9e
|
@ -19,9 +19,7 @@ use Friendica\DI;
|
|||
use Friendica\Model\Event;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Module\Login;
|
||||
use Friendica\Module\Security\Login;
|
||||
use Friendica\Util\ACLFormatter;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Strings;
|
||||
use Friendica\Util\Temporal;
|
||||
|
|
|
@ -178,7 +178,7 @@ function message_content(App $a)
|
|||
DI::baseUrl()->redirect('message');
|
||||
}
|
||||
|
||||
DI::baseUrl()->redirectinternalRedirect('message/' . $conversation['id'] );
|
||||
DI::baseUrl()->redirect('message/' . $conversation['id'] );
|
||||
} else {
|
||||
$r = q("SELECT `parent-uri`,`convid` FROM `mail` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
intval($a->argv[2]),
|
||||
|
|
|
@ -4,6 +4,7 @@ use Friendica\App;
|
|||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Protocol\OStatus;
|
||||
use Friendica\Util\Strings;
|
||||
|
|
|
@ -137,9 +137,9 @@ function redir_magic($a, $cid, $url)
|
|||
// Shouldn't happen under normal conditions
|
||||
notice(L10n::t('Contact not found.'));
|
||||
if (!empty($url)) {
|
||||
$a->redirect($url);
|
||||
System::externalRedirect($url);
|
||||
} else {
|
||||
$a->internalRedirect();
|
||||
DI::baseUrl()->redirect();
|
||||
}
|
||||
} else {
|
||||
$contact_url = $contact['url'];
|
||||
|
@ -151,7 +151,7 @@ function redir_magic($a, $cid, $url)
|
|||
// We don't use magic auth when there is no visitor, we are on the same system or we visit our own stuff
|
||||
if (empty($visitor) || Strings::compareLink($basepath, System::baseUrl()) || Strings::compareLink($contact_url, $visitor)) {
|
||||
Logger::info('Redirecting without magic', ['target' => $target_url, 'visitor' => $visitor, 'contact' => $contact_url]);
|
||||
$a->redirect($target_url);
|
||||
System::externalRedirect($target_url);
|
||||
}
|
||||
|
||||
// Test for magic auth on the target system
|
||||
|
@ -161,7 +161,7 @@ function redir_magic($a, $cid, $url)
|
|||
$target_url .= $separator . 'zrl=' . urlencode($visitor) . '&addr=' . urlencode($contact_url);
|
||||
|
||||
Logger::info('Redirecting with magic', ['target' => $target_url, 'visitor' => $visitor, 'contact' => $contact_url]);
|
||||
$a->redirect($target_url);
|
||||
System::externalRedirect($target_url);
|
||||
} else {
|
||||
Logger::info('No magic for contact', ['contact' => $contact_url]);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ use Friendica\Api\Mastodon\Account;
|
|||
use Friendica\Api\Mastodon\Stats;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\APContact;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\Register;
|
||||
|
@ -53,18 +54,19 @@ class Instance
|
|||
* @return Instance
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function get(App $app) {
|
||||
public static function get()
|
||||
{
|
||||
$register_policy = intval(Config::get('config', 'register_policy'));
|
||||
|
||||
$instance = new Instance();
|
||||
$instance->uri = $app->getBaseURL();
|
||||
$instance->uri = DI::baseUrl()->get();
|
||||
$instance->title = Config::get('config', 'sitename');
|
||||
$instance->description = Config::get('config', 'info');
|
||||
$instance->email = Config::get('config', 'admin_email');
|
||||
$instance->version = FRIENDICA_VERSION;
|
||||
$instance->urls = []; // Not supported
|
||||
$instance->stats = Stats::get();
|
||||
$instance->thumbnail = $app->getBaseURL() . (Config::get('system', 'shortcut_icon') ?? 'images/friendica-32.png');
|
||||
$instance->thumbnail = DI::baseUrl()->get() . (Config::get('system', 'shortcut_icon') ?? 'images/friendica-32.png');
|
||||
$instance->languages = [Config::get('system', 'language')];
|
||||
$instance->max_toot_chars = (int)Config::get('config', 'api_import_size', Config::get('config', 'max_import_size'));
|
||||
$instance->registrations = ($register_policy != Register::CLOSED);
|
||||
|
|
|
@ -102,7 +102,7 @@ class Authentication
|
|||
$user['password'] ?? '',
|
||||
$user['prvkey'] ?? '')) {
|
||||
$this->logger->notice("Hash doesn't fit.", ['user' => $data->uid]);
|
||||
$this->session->delete();
|
||||
$this->session->clear();
|
||||
$this->baseUrl->redirect();
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ class Authentication
|
|||
'addr' => $this->session->get('addr'),
|
||||
'remote_addr' => $_SERVER['REMOTE_ADDR']]
|
||||
);
|
||||
$this->session->delete();
|
||||
$this->session->clear();
|
||||
$this->baseUrl->redirect();
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ class Authentication
|
|||
]
|
||||
);
|
||||
if (!$this->dba->isResult($user)) {
|
||||
$this->session->delete();
|
||||
$this->session->clear();
|
||||
$this->baseUrl->redirect();
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ class SessionFactory
|
|||
* @param App\Mode $mode
|
||||
* @param App\BaseURL $baseURL
|
||||
* @param IConfiguration $config
|
||||
* @param Cookie $cookie
|
||||
* @param Database $dba
|
||||
* @param ICache $cache
|
||||
* @param LoggerInterface $logger
|
||||
|
|
|
@ -12,6 +12,7 @@ use Friendica\Core\Config;
|
|||
use Friendica\Core\Protocol;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Module\Register;
|
||||
use Friendica\Network\CurlResult;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Strings;
|
||||
|
@ -448,11 +449,12 @@ class GServer
|
|||
/**
|
||||
* Detect server type by using the nodeinfo data
|
||||
*
|
||||
* @param string $url address of the server
|
||||
* @param string $url address of the server
|
||||
* @param CurlResult $curlResult
|
||||
* @return array Server data
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
private static function fetchNodeinfo(string $url, $curlResult)
|
||||
private static function fetchNodeinfo(string $url, CurlResult $curlResult)
|
||||
{
|
||||
$nodeinfo = json_decode($curlResult->getBody(), true);
|
||||
|
||||
|
|
|
@ -17,6 +17,6 @@ class Instance extends Api
|
|||
*/
|
||||
public static function rawContent(array $parameters = [])
|
||||
{
|
||||
System::jsonExit(InstanceEntity::get(self::getApp()));
|
||||
System::jsonExit(InstanceEntity::get());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class HoverCard extends BaseModule
|
|||
{
|
||||
public static function rawContent(array $parameters = [])
|
||||
{
|
||||
$a = self::getApp();
|
||||
$a = DI::app();
|
||||
|
||||
if ((local_user()) && ($parameters['action'] ?? '') === 'view') {
|
||||
// A logged in user views a profile of a user
|
||||
|
|
|
@ -52,7 +52,7 @@ class OpenID extends BaseModule
|
|||
// successful OpenID login
|
||||
$session->remove('openid');
|
||||
|
||||
DI::auth()->setForUser(self::getApp(), $user, true, true);
|
||||
DI::auth()->setForUser(DI::app(), $user, true, true);
|
||||
|
||||
// just in case there was no return url set
|
||||
// and we fell through
|
||||
|
|
Loading…
Reference in a new issue