mirror of
https://github.com/friendica/friendica
synced 2025-04-19 06:30:10 +00:00
Renamed System::redirect() to $a->redirect()
This commit is contained in:
parent
c46caeb0d3
commit
2ef81108b3
62 changed files with 269 additions and 253 deletions
|
@ -18,7 +18,7 @@ class Acctlink extends BaseModule
|
|||
$url = defaults(Probe::uri(trim($addr)), 'url', false);
|
||||
|
||||
if ($url) {
|
||||
goaway($url);
|
||||
self::getApp()->redirect($url);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,9 +66,9 @@ class Contact extends BaseModule
|
|||
if (DBA::isResult($contact)) {
|
||||
if ($contact['self']) {
|
||||
if (($a->argc == 3) && intval($a->argv[1]) && in_array($a->argv[2], ['posts', 'conversations'])) {
|
||||
goaway('profile/' . $contact['nick']);
|
||||
$a->redirect('profile/' . $contact['nick']);
|
||||
} else {
|
||||
goaway('profile/' . $contact['nick'] . '?tab=profile');
|
||||
$a->redirect('profile/' . $contact['nick'] . '?tab=profile');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ class Contact extends BaseModule
|
|||
info(L10n::tt('%d contact edited.', '%d contacts edited.', $count_actions));
|
||||
}
|
||||
|
||||
goaway('contact');
|
||||
$a->redirect('contact');
|
||||
}
|
||||
|
||||
public static function post()
|
||||
|
@ -191,7 +191,7 @@ class Contact extends BaseModule
|
|||
|
||||
if (!DBA::exists('contact', ['id' => $contact_id, 'uid' => local_user()])) {
|
||||
notice(L10n::t('Could not access contact record.') . EOL);
|
||||
goaway('contact');
|
||||
$a->redirect('contact');
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -374,19 +374,19 @@ class Contact extends BaseModule
|
|||
$orig_record = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => [0, local_user()], 'self' => false]);
|
||||
if (!DBA::isResult($orig_record)) {
|
||||
notice(L10n::t('Could not access contact record.') . EOL);
|
||||
goaway('contact');
|
||||
$a->redirect('contact');
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
if ($cmd === 'update' && ($orig_record['uid'] != 0)) {
|
||||
self::updateContactFromPoll($contact_id);
|
||||
goaway('contact/' . $contact_id);
|
||||
$a->redirect('contact/' . $contact_id);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
if ($cmd === 'updateprofile' && ($orig_record['uid'] != 0)) {
|
||||
self::updateContactFromProbe($contact_id);
|
||||
goaway('crepair/' . $contact_id);
|
||||
$a->redirect('crepair/' . $contact_id);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -396,7 +396,7 @@ class Contact extends BaseModule
|
|||
$blocked = Model\Contact::isBlockedByUser($contact_id, local_user());
|
||||
info(($blocked ? L10n::t('Contact has been blocked') : L10n::t('Contact has been unblocked')) . EOL);
|
||||
|
||||
goaway('contact/' . $contact_id);
|
||||
$a->redirect('contact/' . $contact_id);
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -406,7 +406,7 @@ class Contact extends BaseModule
|
|||
$ignored = Model\Contact::isIgnoredByUser($contact_id, local_user());
|
||||
info(($ignored ? L10n::t('Contact has been ignored') : L10n::t('Contact has been unignored')) . EOL);
|
||||
|
||||
goaway('contact/' . $contact_id);
|
||||
$a->redirect('contact/' . $contact_id);
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -417,7 +417,7 @@ class Contact extends BaseModule
|
|||
info((($archived) ? L10n::t('Contact has been archived') : L10n::t('Contact has been unarchived')) . EOL);
|
||||
}
|
||||
|
||||
goaway('contact/' . $contact_id);
|
||||
$a->redirect('contact/' . $contact_id);
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -451,13 +451,13 @@ class Contact extends BaseModule
|
|||
}
|
||||
// Now check how the user responded to the confirmation query
|
||||
if (!empty($_REQUEST['canceled'])) {
|
||||
goaway('contact');
|
||||
$a->redirect('contact');
|
||||
}
|
||||
|
||||
self::dropContact($orig_record);
|
||||
info(L10n::t('Contact has been removed.') . EOL);
|
||||
|
||||
goaway('contact');
|
||||
$a->redirect('contact');
|
||||
return; // NOTREACHED
|
||||
}
|
||||
if ($cmd === 'posts') {
|
||||
|
|
|
@ -10,6 +10,7 @@ use Friendica\Core\Addon;
|
|||
use Friendica\Core\Authentication;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
@ -39,7 +40,7 @@ class Login extends BaseModule
|
|||
}
|
||||
|
||||
if (local_user()) {
|
||||
goaway(self::getApp()->getBaseURL());
|
||||
$a->redirect();
|
||||
}
|
||||
|
||||
return self::form($_SESSION['return_url'], intval(Config::get('config', 'register_policy')) !== REGISTER_CLOSED);
|
||||
|
@ -83,10 +84,12 @@ class Login extends BaseModule
|
|||
{
|
||||
$noid = Config::get('system', 'no_openid');
|
||||
|
||||
$a = self::getApp();
|
||||
|
||||
// if it's an email address or doesn't resolve to a URL, fail.
|
||||
if ($noid || strpos($openid_url, '@') || !Network::isUrlValid($openid_url)) {
|
||||
notice(L10n::t('Login failed.') . EOL);
|
||||
goaway(self::getApp()->getBaseURL());
|
||||
$a->redirect();
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -98,7 +101,7 @@ class Login extends BaseModule
|
|||
$_SESSION['openid'] = $openid_url;
|
||||
$_SESSION['remember'] = $remember;
|
||||
$openid->returnUrl = self::getApp()->getBaseURL(true) . '/openid';
|
||||
goaway($openid->authUrl());
|
||||
$a->redirect($openid->authUrl());
|
||||
} catch (Exception $e) {
|
||||
notice(L10n::t('We encountered a problem while logging in with the OpenID you provided. Please check the correct spelling of the ID.') . '<br /><br >' . L10n::t('The error message was:') . ' ' . $e->getMessage());
|
||||
}
|
||||
|
@ -122,6 +125,8 @@ class Login extends BaseModule
|
|||
'user_record' => null
|
||||
];
|
||||
|
||||
$a = self::getApp();
|
||||
|
||||
/*
|
||||
* An addon indicates successful login by setting 'authenticated' to non-zero value and returning a user record
|
||||
* Addons should never set 'authenticated' except to indicate success - as hooks may be chained
|
||||
|
@ -144,7 +149,7 @@ class Login extends BaseModule
|
|||
} catch (Exception $e) {
|
||||
logger('authenticate: failed login attempt: ' . notags($username) . ' from IP ' . $_SERVER['REMOTE_ADDR']);
|
||||
info('Login failed. Please check your credentials.' . EOL);
|
||||
goaway('/');
|
||||
$a->redirect();
|
||||
}
|
||||
|
||||
if (!$remember) {
|
||||
|
@ -163,7 +168,7 @@ class Login extends BaseModule
|
|||
$return_url = '';
|
||||
}
|
||||
|
||||
goaway($return_url);
|
||||
$a->redirect($return_url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -173,6 +178,8 @@ class Login extends BaseModule
|
|||
*/
|
||||
public static function sessionAuth()
|
||||
{
|
||||
$a = self::getApp();
|
||||
|
||||
// When the "Friendica" cookie is set, take the value to authenticate and renew the cookie.
|
||||
if (isset($_COOKIE["Friendica"])) {
|
||||
$data = json_decode($_COOKIE["Friendica"]);
|
||||
|
@ -191,7 +198,7 @@ class Login extends BaseModule
|
|||
if ($data->hash != Authentication::getCookieHashForUser($user)) {
|
||||
logger("Hash for user " . $data->uid . " doesn't fit.");
|
||||
Authentication::deleteSession();
|
||||
goaway(self::getApp()->getBaseURL());
|
||||
$a->redirect();
|
||||
}
|
||||
|
||||
// Renew the cookie
|
||||
|
@ -228,7 +235,7 @@ class Login extends BaseModule
|
|||
logger('Session address changed. Paranoid setting in effect, blocking session. ' .
|
||||
$_SESSION['addr'] . ' != ' . $_SERVER['REMOTE_ADDR']);
|
||||
Authentication::deleteSession();
|
||||
goaway(self::getApp()->getBaseURL());
|
||||
$a->redirect();
|
||||
}
|
||||
|
||||
$user = DBA::selectFirst('user', [],
|
||||
|
@ -242,7 +249,7 @@ class Login extends BaseModule
|
|||
);
|
||||
if (!DBA::isResult($user)) {
|
||||
Authentication::deleteSession();
|
||||
goaway(self::getApp()->getBaseURL());
|
||||
$a->redirect();
|
||||
}
|
||||
|
||||
// Make sure to refresh the last login time for the user if the user
|
||||
|
|
|
@ -8,6 +8,7 @@ use Friendica\BaseModule;
|
|||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Authentication;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
|
||||
require_once 'boot.php';
|
||||
|
||||
|
@ -26,6 +27,6 @@ class Logout extends BaseModule
|
|||
Addon::callHooks("logging_out");
|
||||
Authentication::deleteSession();
|
||||
info(L10n::t('Logged out.') . EOL);
|
||||
goaway(self::getApp()->getBaseURL());
|
||||
self::getApp()->redirect();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
namespace Friendica\Module;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Util\HTTPSignature;
|
||||
|
@ -41,7 +42,7 @@ class Magic extends BaseModule
|
|||
|
||||
if (!$cid) {
|
||||
logger('No contact record found: ' . print_r($_REQUEST, true), LOGGER_DEBUG);
|
||||
goaway($dest);
|
||||
$a->redirect($dest);
|
||||
}
|
||||
|
||||
$contact = DBA::selectFirst('contact', ['id', 'nurl', 'url'], ['id' => $cid]);
|
||||
|
@ -55,7 +56,7 @@ class Magic extends BaseModule
|
|||
}
|
||||
|
||||
logger('Contact is already authenticated', LOGGER_DEBUG);
|
||||
goaway($dest);
|
||||
$a->redirect($dest);
|
||||
}
|
||||
|
||||
if (local_user()) {
|
||||
|
@ -99,10 +100,10 @@ class Magic extends BaseModule
|
|||
$x = strpbrk($dest, '?&');
|
||||
$args = (($x) ? '&owt=' . $token : '?f=&owt=' . $token);
|
||||
|
||||
goaway($dest . $args);
|
||||
$a->redirect($dest . $args);
|
||||
}
|
||||
}
|
||||
goaway($dest);
|
||||
$a->redirect($dest);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,6 +112,6 @@ class Magic extends BaseModule
|
|||
return $ret;
|
||||
}
|
||||
|
||||
goaway($dest);
|
||||
$a->redirect($dest);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ class Objects extends BaseModule
|
|||
}
|
||||
|
||||
if (!ActivityPub::isRequest()) {
|
||||
goaway(str_replace('objects/', 'display/', $a->query_string));
|
||||
$a->redirect(str_replace('objects/', 'display/', $a->query_string));
|
||||
}
|
||||
|
||||
$item = Item::selectFirst(['id'], ['guid' => $a->argv[1], 'wall' => true, 'private' => false]);
|
||||
|
|
|
@ -49,7 +49,7 @@ class Tos extends BaseModule
|
|||
public static function init()
|
||||
{
|
||||
if (strlen(Config::get('system','singleuser'))) {
|
||||
goaway(System::baseUrl()."/profile/" . Config::get('system','singleuser'));
|
||||
self::getApp()->redirect('profile/' . Config::get('system','singleuser'));
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue