Refactor deprecated App::internalRedirect() to DI::baseUrl()->redirect()

This commit is contained in:
nupplaPhil 2019-12-16 00:28:31 +01:00
parent cc9b7bb14f
commit 8e6973b774
No known key found for this signature in database
GPG Key ID: D8365C3D36B77D90
77 changed files with 263 additions and 259 deletions

View File

@ -12,6 +12,7 @@ use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Core\Session;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Item;
use Friendica\Protocol\DFRN;
use Friendica\Protocol\Feed;
@ -339,7 +340,7 @@ function drop_items(array $items)
function drop_item($id, $return = '')
{
$a = Friendica\DI::app();
$a = DI::app();
// locate item to be deleted
@ -348,7 +349,7 @@ function drop_item($id, $return = '')
if (!DBA::isResult($item)) {
notice(L10n::t('Item not found.') . EOL);
$a->internalRedirect('network');
DI::baseUrl()->redirect('network');
}
if ($item['deleted']) {
@ -389,7 +390,7 @@ function drop_item($id, $return = '')
}
// Now check how the user responded to the confirmation query
if (!empty($_REQUEST['canceled'])) {
$a->internalRedirect('display/' . $item['guid']);
DI::baseUrl()->redirect('display/' . $item['guid']);
}
$is_comment = ($item['gravity'] == GRAVITY_COMMENT) ? true : false;
@ -411,28 +412,28 @@ function drop_item($id, $return = '')
if ($is_comment) {
// Return to parent guid
if (!empty($parentitem)) {
$a->internalRedirect('display/' . $parentitem['guid']);
DI::baseUrl()->redirect('display/' . $parentitem['guid']);
//NOTREACHED
}
// In case something goes wrong
else {
$a->internalRedirect('network');
DI::baseUrl()->redirect('network');
//NOTREACHED
}
}
else {
// if unknown location or deleting top level post called from display
if (empty($return_url) || strpos($return_url, 'display') !== false) {
$a->internalRedirect('network');
DI::baseUrl()->redirect('network');
//NOTREACHED
} else {
$a->internalRedirect($return_url);
DI::baseUrl()->redirect($return_url);
//NOTREACHED
}
}
} else {
notice(L10n::t('Permission denied.') . EOL);
$a->internalRedirect('display/' . $item['guid']);
DI::baseUrl()->redirect('display/' . $item['guid']);
//NOTREACHED
}
}

View File

@ -8,6 +8,7 @@ use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Module\Security\Login;
require_once __DIR__ . '/../include/api.php';
@ -76,7 +77,7 @@ function api_content(App $a)
if (strstr($consumer->callback_url, $glue)) {
$glue = "?";
}
$a->internalRedirect($consumer->callback_url . $glue . 'oauth_token=' . OAuthUtil::urlencode_rfc3986($params['oauth_token']) . '&oauth_verifier=' . OAuthUtil::urlencode_rfc3986($verifier));
DI::baseUrl()->redirect($consumer->callback_url . $glue . 'oauth_token=' . OAuthUtil::urlencode_rfc3986($params['oauth_token']) . '&oauth_verifier=' . OAuthUtil::urlencode_rfc3986($verifier));
exit();
}

View File

@ -16,12 +16,11 @@ use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Core\Session;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Event;
use Friendica\Model\Group;
use Friendica\Model\Item;
use Friendica\Model\Profile;
use Friendica\Protocol\DFRN;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Temporal;
@ -289,7 +288,7 @@ function cal_content(App $a)
// Respect the export feature setting for all other /cal pages if it's not the own profile
if ((local_user() !== $owner_uid) && !Feature::isEnabled($owner_uid, "export_calendar")) {
notice(L10n::t('Permission denied.') . EOL);
$a->internalRedirect('cal/' . $nick);
DI::baseUrl()->redirect('cal/' . $nick);
}
// Get the export data by uid
@ -310,7 +309,7 @@ function cal_content(App $a)
$return_path = "cal/" . $nick;
}
$a->internalRedirect($return_path);
DI::baseUrl()->redirect($return_path);
}
// If nothing went wrong we can echo the export content

View File

@ -24,6 +24,7 @@ use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Group;
use Friendica\Model\User;
@ -331,7 +332,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
// Let's send our user to the contact editor in case they want to
// do anything special with this new friend.
if ($handsfree === null) {
$a->internalRedirect('contact/' . intval($contact_id));
DI::baseUrl()->redirect('contact/' . intval($contact_id));
} else {
return;
}
@ -551,6 +552,6 @@ function dfrn_confirm_post(App $a, $handsfree = null)
}
// somebody arrived here by mistake or they are fishing. Send them to the homepage.
$a->internalRedirect();
DI::baseUrl()->redirect();
// NOTREACHED
}

View File

@ -91,7 +91,7 @@ function dfrn_poll_init(App $a)
$my_id = '0:' . $dfrn_id;
break;
default:
$a->internalRedirect();
DI::baseUrl()->redirect();
break; // NOTREACHED
}
@ -138,10 +138,10 @@ function dfrn_poll_init(App $a)
if (!empty($destination_url)) {
System::externalRedirect($destination_url);
} else {
$a->internalRedirect('profile/' . $profile);
DI::baseUrl()->redirect('profile/' . $profile);
}
}
$a->internalRedirect();
DI::baseUrl()->redirect();
}
if ($type === 'profile-check' && $dfrn_version < 2.2) {
@ -325,7 +325,7 @@ function dfrn_poll_post(App $a)
$sql_extra = sprintf(" AND `dfrn-id` = '%s' AND `duplex` = 1 ", DBA::escape($dfrn_id));
break;
default:
$a->internalRedirect();
DI::baseUrl()->redirect();
break; // NOTREACHED
}
@ -445,7 +445,7 @@ function dfrn_poll_content(App $a)
$my_id = '0:' . $dfrn_id;
break;
default:
$a->internalRedirect();
DI::baseUrl()->redirect();
break; // NOTREACHED
}
@ -541,18 +541,18 @@ function dfrn_poll_content(App $a)
switch ($destination_url) {
case 'profile':
$a->internalRedirect('profile/' . $profile . '?f=&tab=profile');
DI::baseUrl()->redirect('profile/' . $profile . '?f=&tab=profile');
break;
case 'photos':
$a->internalRedirect('photos/' . $profile);
DI::baseUrl()->redirect('photos/' . $profile);
break;
case 'status':
case '':
$a->internalRedirect('profile/' . $profile);
DI::baseUrl()->redirect('profile/' . $profile);
break;
default:
$appendix = (strstr($destination_url, '?') ? '&f=&redir=1' : '?f=&redir=1');
$a->redirect($destination_url . $appendix);
DI::baseUrl()->redirect($destination_url . $appendix);
break;
}
// NOTREACHED

View File

@ -21,6 +21,7 @@ use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Core\Session;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Group;
use Friendica\Model\Profile;
@ -68,7 +69,7 @@ function dfrn_request_post(App $a)
}
if (!empty($_POST['cancel'])) {
$a->internalRedirect();
DI::baseUrl()->redirect();
}
/*
@ -194,14 +195,14 @@ function dfrn_request_post(App $a)
}
// (ignore reply, nothing we can do it failed)
$a->internalRedirect($forward_path);
DI::baseUrl()->redirect($forward_path);
return; // NOTREACHED
}
}
// invalid/bogus request
notice(L10n::t('Unrecoverable protocol error.') . EOL);
$a->internalRedirect();
DI::baseUrl()->redirect();
return; // NOTREACHED
}
@ -334,19 +335,19 @@ function dfrn_request_post(App $a)
$url = Network::isUrlValid($url);
if (!$url) {
notice(L10n::t('Invalid profile URL.') . EOL);
$a->internalRedirect($a->cmd);
DI::baseUrl()->redirect($a->cmd);
return; // NOTREACHED
}
if (!Network::isUrlAllowed($url)) {
notice(L10n::t('Disallowed profile URL.') . EOL);
$a->internalRedirect($a->cmd);
DI::baseUrl()->redirect($a->cmd);
return; // NOTREACHED
}
if (Network::isUrlBlocked($url)) {
notice(L10n::t('Blocked domain') . EOL);
$a->internalRedirect($a->cmd);
DI::baseUrl()->redirect($a->cmd);
return; // NOTREACHED
}
@ -354,7 +355,7 @@ function dfrn_request_post(App $a)
if (!count($parms)) {
notice(L10n::t('Profile location is not valid or does not contain profile information.') . EOL);
$a->internalRedirect($a->cmd);
DI::baseUrl()->redirect($a->cmd);
} else {
if (empty($parms['fn'])) {
notice(L10n::t('Warning: profile location has no identifiable owner name.') . EOL);

View File

@ -15,6 +15,7 @@ use Friendica\Core\System;
use Friendica\Core\Theme;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Event;
use Friendica\Model\Item;
use Friendica\Model\Profile;
@ -123,7 +124,7 @@ function events_post(App $a)
echo L10n::t('Event can not end before it has started.');
exit();
}
$a->internalRedirect($onerror_path);
DI::baseUrl()->redirect($onerror_path);
}
if (!$summary || ($start === DBA::NULL_DATETIME)) {
@ -132,7 +133,7 @@ function events_post(App $a)
echo L10n::t('Event title and start time are required.');
exit();
}
$a->internalRedirect($onerror_path);
DI::baseUrl()->redirect($onerror_path);
}
$share = intval($_POST['share'] ?? 0);
@ -150,7 +151,7 @@ function events_post(App $a)
if ($share) {
$aclFormatter = \Friendica\DI::aclFormatter();
$aclFormatter = DI::aclFormatter();
$str_group_allow = $aclFormatter->toString($_POST['group_allow'] ?? '');
$str_contact_allow = $aclFormatter->toString($_POST['contact_allow'] ?? '');
@ -205,7 +206,7 @@ function events_post(App $a)
Worker::add(PRIORITY_HIGH, "Notifier", Delivery::POST, $item_id);
}
$a->internalRedirect('events');
DI::baseUrl()->redirect('events');
}
function events_content(App $a)
@ -578,6 +579,6 @@ function events_content(App $a)
info(L10n::t('Event removed') . EOL);
}
$a->internalRedirect('events');
DI::baseUrl()->redirect('events');
}
}

View File

@ -8,6 +8,7 @@ use Friendica\Core\L10n;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Profile;
use Friendica\Network\Probe;
@ -21,7 +22,7 @@ function follow_post(App $a)
}
if (isset($_REQUEST['cancel'])) {
$a->internalRedirect('contact');
DI::baseUrl()->redirect('contact');
}
$uid = local_user();
@ -38,14 +39,14 @@ function follow_post(App $a)
if ($result['message']) {
notice($result['message']);
}
$a->internalRedirect($return_path);
DI::baseUrl()->redirect($return_path);
} elseif ($result['cid']) {
$a->internalRedirect('contact/' . $result['cid']);
DI::baseUrl()->redirect('contact/' . $result['cid']);
}
info(L10n::t('The contact could not be added.'));
$a->internalRedirect($return_path);
DI::baseUrl()->redirect($return_path);
// NOTREACHED
}
@ -55,7 +56,7 @@ function follow_content(App $a)
if (!local_user()) {
notice(L10n::t('Permission denied.'));
$a->internalRedirect($return_path);
DI::baseUrl()->redirect($return_path);
// NOTREACHED
}
@ -70,7 +71,7 @@ function follow_content(App $a)
}
if (!$url) {
$a->internalRedirect($return_path);
DI::baseUrl()->redirect($return_path);
}
$submit = L10n::t('Submit Request');
@ -132,7 +133,7 @@ function follow_content(App $a)
if (!$r) {
notice(L10n::t('Permission denied.'));
$a->internalRedirect($return_path);
DI::baseUrl()->redirect($return_path);
// NOTREACHED
}

View File

@ -125,7 +125,7 @@ function item_post(App $a) {
if (!DBA::isResult($toplevel_item)) {
notice(L10n::t('Unable to locate original post.') . EOL);
if (!empty($_REQUEST['return'])) {
$a->internalRedirect($return_path);
DI::baseUrl()->redirect($return_path);
}
exit();
}
@ -173,7 +173,7 @@ function item_post(App $a) {
notice(L10n::t('Permission denied.') . EOL);
if (!empty($_REQUEST['return'])) {
$a->internalRedirect($return_path);
DI::baseUrl()->redirect($return_path);
}
exit();
@ -327,7 +327,7 @@ function item_post(App $a) {
}
info(L10n::t('Empty post discarded.') . EOL);
if (!empty($_REQUEST['return'])) {
$a->internalRedirect($return_path);
DI::baseUrl()->redirect($return_path);
}
exit();
}
@ -678,7 +678,7 @@ function item_post(App $a) {
if (!empty($datarray['cancel'])) {
Logger::log('mod_item: post cancelled by addon.');
if ($return_path) {
$a->internalRedirect($return_path);
DI::baseUrl()->redirect($return_path);
}
$json = ['cancel' => 1];
@ -713,7 +713,7 @@ function item_post(App $a) {
if (!empty($_REQUEST['return']) && strlen($return_path)) {
Logger::log('return: ' . $return_path);
$a->internalRedirect($return_path);
DI::baseUrl()->redirect($return_path);
}
exit();
}
@ -733,14 +733,14 @@ function item_post(App $a) {
if (!$post_id) {
Logger::log("Item wasn't stored.");
$a->internalRedirect($return_path);
DI::baseUrl()->redirect($return_path);
}
$datarray = Item::selectFirst(Item::ITEM_FIELDLIST, ['id' => $post_id]);
if (!DBA::isResult($datarray)) {
Logger::log("Item with id ".$post_id." couldn't be fetched.");
$a->internalRedirect($return_path);
DI::baseUrl()->redirect($return_path);
}
// update filetags in pconfig
@ -855,7 +855,7 @@ function item_post_return($baseurl, $api_source, $return_path)
}
if ($return_path) {
$a->internalRedirect($return_path);
DI::baseUrl()->redirect($return_path);
}
$json = ['success' => 1];

View File

@ -10,6 +10,7 @@ use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\User;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Strings;
@ -18,14 +19,14 @@ function lostpass_post(App $a)
{
$loginame = Strings::escapeTags(trim($_POST['login-name']));
if (!$loginame) {
$a->internalRedirect();
DI::baseUrl()->redirect();
}
$condition = ['(`email` = ? OR `nickname` = ?) AND `verified` = 1 AND `blocked` = 0', $loginame, $loginame];
$user = DBA::selectFirst('user', ['uid', 'username', 'nickname', 'email', 'language'], $condition);
if (!DBA::isResult($user)) {
notice(L10n::t('No valid account found.') . EOL);
$a->internalRedirect();
DI::baseUrl()->redirect();
}
$pwdreset_token = Strings::getRandomName(12) . random_int(1000, 9999);
@ -77,7 +78,7 @@ function lostpass_post(App $a)
'body' => $body
]);
$a->internalRedirect();
DI::baseUrl()->redirect();
}
function lostpass_content(App $a)

View File

@ -13,6 +13,7 @@ use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Mail;
use Friendica\Module\Security\Login;
@ -88,7 +89,7 @@ function message_post(App $a)
$a->argc = 2;
$a->argv[1] = 'new';
} else {
$a->internalRedirect($a->cmd . '/' . $ret);
DI::baseUrl()->redirect($a->cmd . '/' . $ret);
}
}
@ -156,7 +157,7 @@ function message_content(App $a)
// Now check how the user responded to the confirmation query
if (!empty($_REQUEST['canceled'])) {
$a->internalRedirect('message');
DI::baseUrl()->redirect('message');
}
$cmd = $a->argv[1];
@ -164,7 +165,7 @@ function message_content(App $a)
$message = DBA::selectFirst('mail', ['convid'], ['id' => $a->argv[2], 'uid' => local_user()]);
if(!DBA::isResult($message)){
info(L10n::t('Conversation not found.') . EOL);
$a->internalRedirect('message');
DI::baseUrl()->redirect('message');
}
if (DBA::delete('mail', ['id' => $a->argv[2], 'uid' => local_user()])) {
@ -174,10 +175,10 @@ function message_content(App $a)
$conversation = DBA::selectFirst('mail', ['id'], ['convid' => $message['convid'], 'uid' => local_user()]);
if(!DBA::isResult($conversation)){
info(L10n::t('Conversation removed.') . EOL);
$a->internalRedirect('message');
DI::baseUrl()->redirect('message');
}
$a->internalRedirect('message/' . $conversation['id'] );
DI::baseUrl()->redirectinternalRedirect('message/' . $conversation['id'] );
} else {
$r = q("SELECT `parent-uri`,`convid` FROM `mail` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($a->argv[2]),
@ -190,7 +191,7 @@ function message_content(App $a)
info(L10n::t('Conversation removed.') . EOL);
}
}
$a->internalRedirect('message');
DI::baseUrl()->redirect('message');
}
}

View File

@ -128,7 +128,7 @@ function network_init(App $a)
$redir_url = ($net_queries ? $net_baseurl . '?' . $net_queries : $net_baseurl);
$a->internalRedirect($redir_url);
DI::baseUrl()->redirect($redir_url);
}
}
@ -587,7 +587,7 @@ function networkThreadedView(App $a, $update, $parent)
exit();
}
notice(L10n::t('No such group') . EOL);
$a->internalRedirect('network/0');
DI::baseUrl()->redirect('network/0');
// NOTREACHED
}
@ -641,7 +641,7 @@ function networkThreadedView(App $a, $update, $parent)
}
} else {
notice(L10n::t('Invalid contact.') . EOL);
$a->internalRedirect('network');
DI::baseUrl()->redirect('network');
// NOTREACHED
}
}

View File

@ -17,12 +17,11 @@ use Friendica\DI;
use Friendica\Module\Security\Login;
use Friendica\Model\Contact;
use Friendica\Model\Introduction;
use Friendica\Model\Notify;
function notifications_post(App $a)
{
if (!local_user()) {
$a->internalRedirect();
DI::baseUrl()->redirect();
}
$request_id = (($a->argc > 1) ? $a->argv[1] : 0);
@ -45,7 +44,7 @@ function notifications_post(App $a)
break;
}
$a->internalRedirect('notifications/intros');
DI::baseUrl()->redirect('notifications/intros');
}
}
@ -113,7 +112,7 @@ function notifications_content(App $a)
$notifs = $nm->getHomeList($show, $startrec, $perpage);
// fallback - redirect to main page
} else {
$a->internalRedirect('notifications');
DI::baseUrl()->redirect('notifications');
}
// Set the pager

View File

@ -8,6 +8,7 @@ use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Network\Probe;
use Friendica\Util\Network;
@ -16,7 +17,7 @@ function ostatus_subscribe_content(App $a)
{
if (!local_user()) {
notice(L10n::t('Permission denied.') . EOL);
$a->internalRedirect('ostatus_subscribe');
DI::baseUrl()->redirect('ostatus_subscribe');
// NOTREACHED
}

View File

@ -173,12 +173,12 @@ function photos_post(App $a)
if ($a->argc > 3 && $a->argv[2] === 'album') {
if (!Strings::isHex($a->argv[3])) {
$a->internalRedirect('photos/' . $a->data['user']['nickname'] . '/album');
DI::baseUrl()->redirect('photos/' . $a->data['user']['nickname'] . '/album');
}
$album = hex2bin($a->argv[3]);
if ($album === L10n::t('Profile Photos') || $album === 'Contact Photos' || $album === L10n::t('Contact Photos')) {
$a->internalRedirect($_SESSION['photo_return']);
DI::baseUrl()->redirect($_SESSION['photo_return']);
return; // NOTREACHED
}
@ -189,13 +189,13 @@ function photos_post(App $a)
if (!DBA::isResult($r)) {
notice(L10n::t('Album not found.') . EOL);
$a->internalRedirect($_SESSION['photo_return']);
DI::baseUrl()->redirect($_SESSION['photo_return']);
return; // NOTREACHED
}
// Check if the user has responded to a delete confirmation query
if (!empty($_REQUEST['canceled'])) {
$a->internalRedirect($_SESSION['photo_return']);
DI::baseUrl()->redirect($_SESSION['photo_return']);
}
// RENAME photo album
@ -209,7 +209,7 @@ function photos_post(App $a)
// Update the photo albums cache
Photo::clearAlbumCache($page_owner_uid);
$a->internalRedirect('photos/' . $a->user['nickname'] . '/album/' . bin2hex($newalbum));
DI::baseUrl()->redirect('photos/' . $a->user['nickname'] . '/album/' . bin2hex($newalbum));
return; // NOTREACHED
}
@ -252,13 +252,13 @@ function photos_post(App $a)
}
}
$a->internalRedirect('photos/' . $a->argv[1]);
DI::baseUrl()->redirect('photos/' . $a->argv[1]);
}
if ($a->argc > 3 && $a->argv[2] === 'image') {
// Check if the user has responded to a delete confirmation query for a single photo
if (!empty($_POST['canceled'])) {
$a->internalRedirect('photos/' . $a->argv[1] . '/image/' . $a->argv[3]);
DI::baseUrl()->redirect('photos/' . $a->argv[1] . '/image/' . $a->argv[3]);
}
if (!empty($_POST['delete'])) {
@ -282,10 +282,10 @@ function photos_post(App $a)
notice('Successfully deleted the photo.');
} else {
notice('Failed to delete the photo.');
$a->internalRedirect('photos/' . $a->argv[1] . '/image/' . $a->argv[3]);
DI::baseUrl()->redirect('photos/' . $a->argv[1] . '/image/' . $a->argv[3]);
}
$a->internalRedirect('photos/' . $a->argv[1]);
DI::baseUrl()->redirect('photos/' . $a->argv[1]);
return; // NOTREACHED
}
}
@ -591,7 +591,7 @@ function photos_post(App $a)
}
}
}
$a->internalRedirect($_SESSION['photo_return']);
DI::baseUrl()->redirect($_SESSION['photo_return']);
return; // NOTREACHED
}
@ -817,7 +817,7 @@ function photos_post(App $a)
// addon uploaders should call "killme()" [e.g. exit] within the photo_post_end hook
// if they do not wish to be redirected
$a->internalRedirect($_SESSION['photo_return']);
DI::baseUrl()->redirect($_SESSION['photo_return']);
// NOTREACHED
}
@ -994,7 +994,7 @@ function photos_content(App $a)
if ($datatype === 'album') {
// if $datum is not a valid hex, redirect to the default page
if (!Strings::isHex($datum)) {
$a->internalRedirect('photos/' . $a->data['user']['nickname']. '/album');
DI::baseUrl()->redirect('photos/' . $a->data['user']['nickname']. '/album');
}
$album = hex2bin($datum);

View File

@ -11,6 +11,7 @@ use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Photo;
use Friendica\Model\Profile;
@ -134,7 +135,7 @@ function profile_photo_post(App $a)
}
}
$a->internalRedirect($path);
DI::baseUrl()->redirect($path);
return; // NOTREACHED
}
@ -167,7 +168,7 @@ function profile_photo_post(App $a)
@unlink($src);
$imagecrop = profile_photo_crop_ui_head($a, $ph);
$a->internalRedirect('profile_photo/use/' . $imagecrop['hash']);
DI::baseUrl()->redirect('profile_photo/use/' . $imagecrop['hash']);
}
function profile_photo_content(App $a)
@ -222,7 +223,7 @@ function profile_photo_content(App $a)
Worker::add(PRIORITY_LOW, "Directory", $url);
}
$a->internalRedirect('profile/' . $a->user['nickname']);
DI::baseUrl()->redirect('profile/' . $a->user['nickname']);
return; // NOTREACHED
}
$ph = Photo::getImageForPhoto($r[0]);

View File

@ -16,6 +16,7 @@ use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
use Friendica\Model\Profile;
@ -41,7 +42,7 @@ function profiles_init(App $a) {
);
if (! DBA::isResult($r)) {
notice(L10n::t('Profile not found.') . EOL);
$a->internalRedirect('profiles');
DI::baseUrl()->redirect('profiles');
return; // NOTREACHED
}
@ -62,7 +63,7 @@ function profiles_init(App $a) {
info(L10n::t('Profile deleted.').EOL);
}
$a->internalRedirect('profiles');
DI::baseUrl()->redirect('profiles');
return; // NOTREACHED
}
@ -96,10 +97,10 @@ function profiles_init(App $a) {
info(L10n::t('New profile created.') . EOL);
if (DBA::isResult($r3) && count($r3) == 1) {
$a->internalRedirect('profiles/' . $r3[0]['id']);
DI::baseUrl()->redirect('profiles/' . $r3[0]['id']);
}
$a->internalRedirect('profiles');
DI::baseUrl()->redirect('profiles');
}
if (($a->argc > 2) && ($a->argv[1] === 'clone')) {
@ -134,10 +135,10 @@ function profiles_init(App $a) {
);
info(L10n::t('New profile created.') . EOL);
if ((DBA::isResult($r3)) && (count($r3) == 1)) {
$a->internalRedirect('profiles/'.$r3[0]['id']);
DI::baseUrl()->redirect('profiles/'.$r3[0]['id']);
}
$a->internalRedirect('profiles');
DI::baseUrl()->redirect('profiles');
return; // NOTREACHED
}
@ -640,7 +641,7 @@ function profiles_content(App $a) {
);
if (DBA::isResult($r)) {
//Go to the default profile.
$a->internalRedirect('profiles/' . $r[0]['id']);
DI::baseUrl()->redirect('profiles/' . $r[0]['id']);
}
}

View File

@ -6,6 +6,7 @@ use Friendica\Core\Logger;
use Friendica\Core\Session;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Profile;
use Friendica\Util\Network;
@ -30,7 +31,7 @@ function redir_init(App $a) {
$contact = DBA::selectFirst('contact', $fields, ['id' => $cid, 'uid' => [0, local_user()]]);
if (!DBA::isResult($contact)) {
notice(L10n::t('Contact not found.'));
$a->internalRedirect();
DI::baseUrl()->redirect();
}
$contact_url = $contact['url'];
@ -120,7 +121,7 @@ function redir_init(App $a) {
}
notice(L10n::t('Contact not found.'));
$a->internalRedirect();
DI::baseUrl()->redirect();
}
function redir_magic($a, $cid, $url)

View File

@ -9,6 +9,7 @@ use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Register;
use Friendica\Model\User;
use Friendica\Module\Security\Login;
@ -98,11 +99,11 @@ function regmod_content(App $a)
if ($cmd === 'deny') {
user_deny($hash);
$a->internalRedirect('admin/users/');
DI::baseUrl()->redirect('admin/users/');
}
if ($cmd === 'allow') {
user_allow($hash);
$a->internalRedirect('admin/users/');
DI::baseUrl()->redirect('admin/users/');
}
}

View File

@ -8,6 +8,7 @@ use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\User;
use Friendica\Util\Strings;
@ -59,7 +60,7 @@ function removeme_post(App $a)
unset($_SESSION['authenticated']);
unset($_SESSION['uid']);
$a->internalRedirect();
DI::baseUrl()->redirect();
// NOTREACHED
}
}
@ -67,7 +68,7 @@ function removeme_post(App $a)
function removeme_content(App $a)
{
if (!local_user()) {
$a->internalRedirect();
DI::baseUrl()->redirect();
}
$hash = Strings::getRandomHex();

View File

@ -8,13 +8,14 @@ use Friendica\Core\L10n;
use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
function repair_ostatus_content(App $a) {
if (! local_user()) {
notice(L10n::t('Permission denied.') . EOL);
$a->internalRedirect('ostatus_repair');
DI::baseUrl()->redirect('ostatus_repair');
// NOTREACHED
}

View File

@ -173,7 +173,7 @@ function settings_post(App $a)
$key = $_POST['remove'];
DBA::delete('tokens', ['id' => $key, 'uid' => local_user()]);
$a->internalRedirect('settings/oauth/', true);
DI::baseUrl()->redirect('settings/oauth/', true);
return;
}
@ -219,7 +219,7 @@ function settings_post(App $a)
);
}
}
$a->internalRedirect('settings/oauth/', true);
DI::baseUrl()->redirect('settings/oauth/', true);
return;
}
@ -383,7 +383,7 @@ function settings_post(App $a)
}
Hook::callAll('display_settings_post', $_POST);
$a->internalRedirect('settings/display');
DI::baseUrl()->redirect('settings/display');
return; // NOTREACHED
}
@ -419,7 +419,7 @@ function settings_post(App $a)
if (!empty($_POST['resend_relocate'])) {
Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, local_user());
info(L10n::t("Relocate message has been send to your contacts"));
$a->internalRedirect('settings');
DI::baseUrl()->redirect('settings');
}
Hook::callAll('settings_post', $_POST);
@ -638,7 +638,7 @@ function settings_post(App $a)
// Update the global contact for the user
GContact::updateForUser(local_user());
$a->internalRedirect('settings');
DI::baseUrl()->redirect('settings');
return; // NOTREACHED
}
@ -705,7 +705,7 @@ function settings_content(App $a)
BaseModule::checkFormSecurityTokenRedirectOnError('/settings/oauth', 'settings_oauth', 't');
DBA::delete('clients', ['client_id' => $a->argv[3], 'uid' => local_user()]);
$a->internalRedirect('settings/oauth/', true);
DI::baseUrl()->redirect('settings/oauth/', true);
return;
}

View File

@ -10,6 +10,7 @@ use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
use Friendica\Util\Proxy as ProxyUtils;
@ -28,7 +29,7 @@ function suggest_post(App $a)
notice(L10n::t('Contact suggestion successfully ignored.'));
}
$a->internalRedirect('suggest');
DI::baseUrl()->redirect('suggest');
}
function suggest_content(App $a)

View File

@ -7,6 +7,7 @@ use Friendica\App;
use Friendica\Content\Text\BBCode;
use Friendica\Core\L10n;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Item;
use Friendica\Model\Term;
use Friendica\Util\Strings;
@ -14,11 +15,11 @@ use Friendica\Util\Strings;
function tagrm_post(App $a)
{
if (!local_user()) {
$a->internalRedirect($_SESSION['photo_return']);
DI::baseUrl()->redirect($_SESSION['photo_return']);
}
if (!empty($_POST['submit']) && ($_POST['submit'] === L10n::t('Cancel'))) {
$a->internalRedirect($_SESSION['photo_return']);
DI::baseUrl()->redirect($_SESSION['photo_return']);
}
$tags = [];
@ -30,7 +31,7 @@ function tagrm_post(App $a)
update_tags($item_id, $tags);
info(L10n::t('Tag(s) removed') . EOL);
$a->internalRedirect($_SESSION['photo_return']);
DI::baseUrl()->redirect($_SESSION['photo_return']);
// NOTREACHED
}
@ -71,31 +72,31 @@ function tagrm_content(App $a)
$o = '';
if (!local_user()) {
$a->internalRedirect($_SESSION['photo_return']);
DI::baseUrl()->redirect($_SESSION['photo_return']);
// NOTREACHED
}
if ($a->argc == 3) {
update_tags($a->argv[1], [Strings::escapeTags(trim(hex2bin($a->argv[2])))]);
$a->internalRedirect($_SESSION['photo_return']);
DI::baseUrl()->redirect($_SESSION['photo_return']);
}
$item_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
if (!$item_id) {
$a->internalRedirect($_SESSION['photo_return']);
DI::baseUrl()->redirect($_SESSION['photo_return']);
// NOTREACHED
}
$item = Item::selectFirst(['tag'], ['id' => $item_id, 'uid' => local_user()]);
if (!DBA::isResult($item)) {
$a->internalRedirect($_SESSION['photo_return']);
DI::baseUrl()->redirect($_SESSION['photo_return']);
}
$arr = explode(',', $item['tag']);
if (empty($item['tag'])) {
$a->internalRedirect($_SESSION['photo_return']);
DI::baseUrl()->redirect($_SESSION['photo_return']);
}
$o .= '<h3>' . L10n::t('Remove Item Tag') . '</h3>';

View File

@ -19,7 +19,7 @@ function uimport_post(App $a)
}
if (!empty($_FILES['accountfile'])) {
UserImport::importAccount($a, $_FILES['accountfile']);
UserImport::importAccount($_FILES['accountfile']);
return;
}
}

View File

@ -9,6 +9,7 @@ use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Profile;
use Friendica\Model\User;
@ -20,7 +21,7 @@ function unfollow_post(App $a)
if (!local_user()) {
notice(L10n::t('Permission denied.'));
$a->internalRedirect('login');
DI::baseUrl()->redirect('login');
// NOTREACHED
}
@ -34,17 +35,17 @@ function unfollow_post(App $a)
if (!DBA::isResult($contact)) {
notice(L10n::t("You aren't following this contact."));
$a->internalRedirect($base_return_path);
DI::baseUrl()->redirect($base_return_path);
// NOTREACHED
}
if (!empty($_REQUEST['cancel'])) {
$a->internalRedirect($base_return_path . '/' . $contact['id']);
DI::baseUrl()->redirect($base_return_path . '/' . $contact['id']);
}
if (!in_array($contact['network'], Protocol::NATIVE_SUPPORT)) {
notice(L10n::t('Unfollowing is currently not supported by your network.'));
$a->internalRedirect($base_return_path . '/' . $contact['id']);
DI::baseUrl()->redirect($base_return_path . '/' . $contact['id']);
// NOTREACHED
}
@ -65,7 +66,7 @@ function unfollow_post(App $a)
}
info(L10n::t('Contact unfollowed'));
$a->internalRedirect($return_path);
DI::baseUrl()->redirect($return_path);
// NOTREACHED
}
@ -75,7 +76,7 @@ function unfollow_content(App $a)
if (!local_user()) {
notice(L10n::t('Permission denied.'));
$a->internalRedirect('login');
DI::baseUrl()->redirect('login');
// NOTREACHED
}
@ -90,13 +91,13 @@ function unfollow_content(App $a)
if (!DBA::isResult($contact)) {
notice(L10n::t("You aren't following this contact."));
$a->internalRedirect($base_return_path);
DI::baseUrl()->redirect($base_return_path);
// NOTREACHED
}
if (!in_array($contact['network'], Protocol::NATIVE_SUPPORT)) {
notice(L10n::t('Unfollowing is currently not supported by your network.'));
$a->internalRedirect($base_return_path . '/' . $contact['id']);
DI::baseUrl()->redirect($base_return_path . '/' . $contact['id']);
// NOTREACHED
}
@ -107,7 +108,7 @@ function unfollow_content(App $a)
if (!DBA::isResult($self)) {
notice(L10n::t('Permission denied.'));
$a->internalRedirect($base_return_path);
DI::baseUrl()->redirect($base_return_path);
// NOTREACHED
}

View File

@ -12,6 +12,7 @@ use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Core\Session;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Attach;
use Friendica\Model\Contact;
use Friendica\Model\Group;
@ -75,7 +76,7 @@ function videos_post(App $a)
$owner_uid = $a->data['user']['uid'];
if (local_user() != $owner_uid) {
$a->internalRedirect('videos/' . $a->data['user']['nickname']);
DI::baseUrl()->redirect('videos/' . $a->data['user']['nickname']);
}
if (($a->argc == 2) && !empty($_POST['delete']) && !empty($_POST['id'])) {
@ -92,11 +93,11 @@ function videos_post(App $a)
], local_user());
}
$a->internalRedirect('videos/' . $a->data['user']['nickname']);
DI::baseUrl()->redirect('videos/' . $a->data['user']['nickname']);
return; // NOTREACHED
}
$a->internalRedirect('videos/' . $a->data['user']['nickname']);
DI::baseUrl()->redirect('videos/' . $a->data['user']['nickname']);
}
function videos_content(App $a)

View File

@ -8,6 +8,7 @@ use Friendica\Core\Logger;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Mail;
use Friendica\Model\Profile;
use Friendica\Util\Strings;
@ -72,7 +73,7 @@ function wallmessage_post(App $a) {
info(L10n::t('Message sent.') . EOL);
}
$a->internalRedirect('profile/'.$user['nickname']);
DI::baseUrl()->redirect('profile/'.$user['nickname']);
}

View File

@ -681,9 +681,9 @@ class App
// in install mode, any url loads install module
// but we need "view" module for stylesheet
if ($this->mode->isInstall() && $moduleName !== 'install') {
$this->internalRedirect('install');
$this->baseURL->redirect('install');
} elseif (!$this->mode->isInstall() && !$this->mode->has(App\Mode::MAINTENANCEDISABLED) && $moduleName !== 'maintenance') {
$this->internalRedirect('maintenance');
$this->baseURL->redirect('maintenance');
} else {
$this->checkURL();
Core\Update::check($this->getBasePath(), false, $this->mode);
@ -693,35 +693,35 @@ class App
// Compatibility with the Android Diaspora client
if ($moduleName == 'stream') {
$this->internalRedirect('network?order=post');
$this->baseURL->redirect('network?order=post');
}
if ($moduleName == 'conversations') {
$this->internalRedirect('message');
$this->baseURL->redirect('message');
}
if ($moduleName == 'commented') {
$this->internalRedirect('network?order=comment');
$this->baseURL->redirect('network?order=comment');
}
if ($moduleName == 'liked') {
$this->internalRedirect('network?order=comment');
$this->baseURL->redirect('network?order=comment');
}
if ($moduleName == 'activity') {
$this->internalRedirect('network?conv=1');
$this->baseURL->redirect('network?conv=1');
}
if (($moduleName == 'status_messages') && ($this->args->getCommand() == 'status_messages/new')) {
$this->internalRedirect('bookmarklet');
$this->baseURL->redirect('bookmarklet');
}
if (($moduleName == 'user') && ($this->args->getCommand() == 'user/edit')) {
$this->internalRedirect('settings');
$this->baseURL->redirect('settings');
}
if (($moduleName == 'tag_followings') && ($this->args->getCommand() == 'tag_followings/manage')) {
$this->internalRedirect('search');
$this->baseURL->redirect('search');
}
// Initialize module that can set the current theme in the init() method, either directly or via App->profile_uid
@ -732,7 +732,7 @@ class App
$module = $module->determineClass($this->args, $router, $this->config);
// Let the module run it's internal process (init, get, post, ...)
$module->run($this->l10n, $this, $this->logger, $_SERVER, $_POST);
$module->run($this->l10n, $this->baseURL, $this->logger, $_SERVER, $_POST);
} catch (HTTPException $e) {
ModuleHTTPException::rawContent($e);
}
@ -740,15 +740,6 @@ class App
$this->page->run($this, $this->baseURL, $this->mode, $module, $this->l10n, $this->config, $pconfig);
}
/**
* @deprecated 2019.12 use BaseUrl::redirect instead
* @see BaseURL::redirect()
*/
public function internalRedirect($toUrl = '', $ssl = false)
{
$this->baseURL->redirect($toUrl, $ssl);
}
/**
* Automatically redirects to relative or absolute URL
* Should only be used if it isn't clear if the URL is either internal or external

View File

@ -407,7 +407,7 @@ class Authentication
if ($a->isAjax()) {
throw new HTTPException\ForbiddenException();
} else {
$a->internalRedirect('2fa');
$this->baseUrl->redirect('2fa');
}
}
}

View File

@ -208,14 +208,14 @@ class Module
* Run the determined module class and calls all hooks applied to
*
* @param Core\L10n\L10n $l10n The L10n instance
* @param App $app The whole Friendica app (for method arguments)
* @param App\BaseURL $baseUrl The Friendica Base URL
* @param LoggerInterface $logger The Friendica logger
* @param array $server The $_SERVER variable
* @param array $post The $_POST variables
*
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public function run(Core\L10n\L10n $l10n, App $app, LoggerInterface $logger, array $server, array $post)
public function run(Core\L10n\L10n $l10n, App\BaseURL $baseUrl, LoggerInterface $logger, array $server, array $post)
{
if ($this->printNotAllowedAddon) {
info($l10n->t("You must be logged in to use addons. "));
@ -239,7 +239,7 @@ class Module
if (!empty($queryString) && ($queryString === 'q=internal_error.html') && isset($dreamhost_error_hack)) {
$logger->info('index.php: dreamhost_error_hack invoked.', ['Original URI' => $server['REQUEST_URI']]);
$app->internalRedirect($server['REQUEST_URI']);
$baseUrl->redirect($server['REQUEST_URI']);
}
$logger->debug('index.php: page not found.', ['request_uri' => $server['REQUEST_URI'], 'address' => $server['REMOTE_ADDR'], 'query' => $server['QUERY_STRING']]);

View File

@ -140,7 +140,7 @@ abstract class BaseModule
Logger::log('checkFormSecurityToken failed: user ' . $a->user['guid'] . ' - form element ' . $typename);
Logger::log('checkFormSecurityToken failed: _REQUEST data: ' . print_r($_REQUEST, true), Logger::DATA);
notice(self::getFormSecurityStandardErrorMessage());
$a->internalRedirect($err_redirect);
DI::baseUrl()->redirect($err_redirect);
}
}

View File

@ -7,6 +7,7 @@ namespace Friendica\Core;
use Friendica\App;
use Friendica\Database\DBA;
use Friendica\Database\DBStructure;
use Friendica\DI;
use Friendica\Model\Photo;
use Friendica\Object\Image;
use Friendica\Util\Strings;
@ -85,12 +86,11 @@ class UserImport
/**
* @brief Import account file exported from mod/uexport
*
* @param App $a Friendica App Class
* @param array $file array from $_FILES
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function importAccount(App $a, $file)
public static function importAccount($file)
{
Logger::log("Start user import from " . $file['tmp_name']);
/*
@ -282,6 +282,6 @@ class UserImport
Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, $newuid);
info(L10n::t("Done. You can now login with your username and password"));
$a->internalRedirect('login');
DI::baseUrl()->redirect('login');
}
}

View File

@ -2272,7 +2272,7 @@ class Contact
$myaddr = bin2hex($a->user['nickname'] . '@' . $a->getHostName());
}
$a->internalRedirect($ret['request'] . "&addr=$myaddr");
DI::baseUrl()->redirect($ret['request'] . "&addr=$myaddr");
// NOTREACHED
}

View File

@ -29,11 +29,11 @@ class Details extends BaseAdminModule
$func($a);
}
$a->internalRedirect('admin/addons/' . $addon);
DI::baseUrl()->redirect('admin/addons/' . $addon);
}
}
$a->internalRedirect('admin/addons');
DI::baseUrl()->redirect('admin/addons');
}
public static function content(array $parameters = [])
@ -51,7 +51,7 @@ class Details extends BaseAdminModule
if (!is_file("addon/$addon/$addon.php")) {
notice(L10n::t('Addon not found.'));
Addon::uninstall($addon);
$a->internalRedirect('admin/addons');
DI::baseUrl()->redirect('admin/addons');
}
if (($_GET['action'] ?? '') == 'toggle') {
@ -68,7 +68,7 @@ class Details extends BaseAdminModule
Addon::saveEnabledList();
$a->internalRedirect('admin/addons/' . $addon);
DI::baseUrl()->redirect('admin/addons/' . $addon);
}
// display addon details
@ -119,6 +119,6 @@ class Details extends BaseAdminModule
]);
}
$a->internalRedirect('admin/addons');
DI::baseUrl()->redirect('admin/addons');
}
}

View File

@ -41,7 +41,7 @@ class Index extends BaseAdminModule
}
$a->internalRedirect('admin/addons');
DI::baseUrl()->redirect('admin/addons');
}
$addons = Addon::getAvailableList();

View File

@ -39,7 +39,7 @@ class Contact extends BaseAdminModule
notice(L10n::tt('%s contact unblocked', '%s contacts unblocked', count($contacts)));
}
DI::app()->internalRedirect('admin/blocklist/contact');
DI::baseUrl()->redirect('admin/blocklist/contact');
}
public static function content(array $parameters = [])

View File

@ -48,7 +48,7 @@ class Server extends BaseAdminModule
info(L10n::t('Site blocklist updated.') . EOL);
}
DI::app()->internalRedirect('admin/blocklist/server');
DI::baseUrl()->redirect('admin/blocklist/server');
}
public static function content(array $parameters = [])

View File

@ -32,7 +32,7 @@ class DBSync extends BaseAdminModule
}
info(L10n::t('Update has been marked successful') . EOL);
}
$a->internalRedirect('admin/dbsync');
DI::baseUrl()->redirect('admin/dbsync');
}
if ($a->argc > 2) {

View File

@ -40,7 +40,7 @@ class Features extends BaseAdminModule
}
}
DI::app()->internalRedirect('admin/features');
DI::baseUrl()->redirect('admin/features');
}
public static function content(array $parameters = [])

View File

@ -34,7 +34,7 @@ class Delete extends BaseAdminModule
}
info(L10n::t('Item marked for deletion.') . EOL);
DI::app()->internalRedirect('admin/item/delete');
DI::baseUrl()->redirect('admin/item/delete');
}
public static function content(array $parameters = [])

View File

@ -35,7 +35,7 @@ class Settings extends BaseAdminModule
}
info(L10n::t("Log settings updated."));
DI::app()->internalRedirect('admin/logs');
DI::baseUrl()->redirect('admin/logs');
}
public static function content(array $parameters = [])

View File

@ -48,7 +48,7 @@ class Site extends BaseAdminModule
$parsed = @parse_url($new_url);
if (!is_array($parsed) || empty($parsed['host']) || empty($parsed['scheme'])) {
notice(L10n::t("Can not parse base url. Must have at least <scheme>://<domain>"));
$a->internalRedirect('admin/site');
DI::baseUrl()->redirect('admin/site');
}
/* steps:
@ -77,7 +77,7 @@ class Site extends BaseAdminModule
$r = DBA::e(sprintf("UPDATE %s SET %s;", $table_name, $upds));
if (!DBA::isResult($r)) {
notice("Failed updating '$table_name': " . DBA::errorMessage());
$a->internalRedirect('admin/site');
DI::baseUrl()->redirect('admin/site');
}
}
@ -105,7 +105,7 @@ class Site extends BaseAdminModule
info("Relocation started. Could take a while to complete.");
$a->internalRedirect('admin/site');
DI::baseUrl()->redirect('admin/site');
}
// end relocate
@ -229,7 +229,7 @@ class Site extends BaseAdminModule
foreach ($storage_form_errors as $name => $err) {
notice('Storage backend, ' . $storage_opts[$name][1] . ': ' . $err);
}
$a->internalRedirect('admin/site' . $active_panel);
DI::baseUrl()->redirect('admin/site' . $active_panel);
}
} else {
info(L10n::t('Invalid storage backend setting value.'));
@ -410,7 +410,7 @@ class Site extends BaseAdminModule
info(L10n::t('Site settings updated.') . EOL);
$a->internalRedirect('admin/site' . $active_panel);
DI::baseUrl()->redirect('admin/site' . $active_panel);
}
public static function content(array $parameters = [])

View File

@ -36,7 +36,7 @@ class Details extends BaseAdminModule
return;
}
$a->internalRedirect('admin/themes/' . $theme);
DI::baseUrl()->redirect('admin/themes/' . $theme);
}
}
@ -76,7 +76,7 @@ class Details extends BaseAdminModule
info(L10n::t('Theme %s failed to install.', $theme));
}
$a->internalRedirect('admin/themes/' . $theme);
DI::baseUrl()->redirect('admin/themes/' . $theme);
}
$readme = null;
@ -122,6 +122,6 @@ class Details extends BaseAdminModule
]);
}
$a->internalRedirect('admin/themes');
DI::baseUrl()->redirect('admin/themes');
}
}

View File

@ -50,7 +50,7 @@ class Embed extends BaseAdminModule
return;
}
$a->internalRedirect('admin/themes/' . $theme . '/embed?mode=minimal');
DI::baseUrl()->redirect('admin/themes/' . $theme . '/embed?mode=minimal');
}
}

View File

@ -59,7 +59,7 @@ class Index extends BaseAdminModule
}
$a->internalRedirect('admin/themes');
DI::baseUrl()->redirect('admin/themes');
}
$themes = [];

View File

@ -30,7 +30,7 @@ class Tos extends BaseAdminModule
info(L10n::t('The Terms of Service settings have been updated.'));
DI::app()->internalRedirect('admin/tos');
DI::baseUrl()->redirect('admin/tos');
}
public static function content(array $parameters = [])

View File

@ -129,7 +129,7 @@ class Users extends BaseAdminModule
}
}
$a->internalRedirect('admin/users');
DI::baseUrl()->redirect('admin/users');
}
public static function content(array $parameters = [])
@ -145,7 +145,7 @@ class Users extends BaseAdminModule
$user = User::getById($uid, ['username', 'blocked']);
if (!DBA::isResult($user)) {
notice('User not found' . EOL);
$a->internalRedirect('admin/users');
DI::baseUrl()->redirect('admin/users');
return ''; // NOTREACHED
}
@ -175,7 +175,7 @@ class Users extends BaseAdminModule
break;
}
$a->internalRedirect('admin/users');
DI::baseUrl()->redirect('admin/users');
}
/* get pending */

View File

@ -18,7 +18,7 @@ class Apps extends BaseModule
{
$privateaddons = Config::get('config', 'private_addons');
if ($privateaddons === "1" && !local_user()) {
DI::app()->internalRedirect();
DI::baseUrl()->redirect();
}
}

View File

@ -56,7 +56,7 @@ abstract class BaseAdminModule extends BaseModule
if (!is_site_admin()) {
notice(L10n::t('Please login to continue.'));
Session::set('return_path', $a->query_string);
$a->internalRedirect('login');
DI::baseUrl()->redirect('login');
}
if (!empty($_SESSION['submanage'])) {

View File

@ -22,7 +22,6 @@ use Friendica\Model;
use Friendica\Module\Security\Login;
use Friendica\Network\HTTPException\BadRequestException;
use Friendica\Network\HTTPException\NotFoundException;
use Friendica\Network\Probe;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Proxy as ProxyUtils;
use Friendica\Util\Strings;
@ -34,7 +33,7 @@ use Friendica\Util\Strings;
*/
class Contact extends BaseModule
{
private static function batchActions(App $a)
private static function batchActions()
{
if (empty($_POST['contact_batch']) || !is_array($_POST['contact_batch'])) {
return;
@ -74,7 +73,7 @@ class Contact extends BaseModule
info(L10n::tt('%d contact edited.', '%d contacts edited.', $count_actions));
}
$a->internalRedirect('contact');
DI::baseUrl()->redirect('contact');
}
public static function post(array $parameters = [])
@ -87,7 +86,7 @@ class Contact extends BaseModule
// @TODO: Replace with parameter from router
if ($a->argv[1] === 'batch') {
self::batchActions($a);
self::batchActions();
return;
}
@ -99,7 +98,7 @@ class Contact extends BaseModule
if (!DBA::exists('contact', ['id' => $contact_id, 'uid' => local_user(), 'deleted' => false])) {
notice(L10n::t('Could not access contact record.') . EOL);
$a->internalRedirect('contact');
DI::baseUrl()->redirect('contact');
return; // NOTREACHED
}
@ -280,9 +279,9 @@ class Contact extends BaseModule
if ($contact['self']) {
// @TODO: Replace with parameter from router
if (($a->argc == 3) && intval($a->argv[1]) && in_array($a->argv[2], ['posts', 'conversations'])) {
$a->internalRedirect('profile/' . $contact['nick']);
DI::baseUrl()->redirect('profile/' . $contact['nick']);
} else {
$a->internalRedirect('profile/' . $contact['nick'] . '?tab=profile');
DI::baseUrl()->redirect('profile/' . $contact['nick'] . '?tab=profile');
}
}
@ -380,13 +379,13 @@ class Contact extends BaseModule
if ($cmd === 'update' && ($orig_record['uid'] != 0)) {
self::updateContactFromPoll($contact_id);
$a->internalRedirect('contact/' . $contact_id);
DI::baseUrl()->redirect('contact/' . $contact_id);
// NOTREACHED
}
if ($cmd === 'updateprofile' && ($orig_record['uid'] != 0)) {
self::updateContactFromProbe($contact_id);
$a->internalRedirect('crepair/' . $contact_id);
DI::baseUrl()->redirect('crepair/' . $contact_id);
// NOTREACHED
}
@ -396,7 +395,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);
$a->internalRedirect('contact/' . $contact_id);
DI::baseUrl()->redirect('contact/' . $contact_id);
// NOTREACHED
}
@ -406,7 +405,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);
$a->internalRedirect('contact/' . $contact_id);
DI::baseUrl()->redirect('contact/' . $contact_id);
// NOTREACHED
}
@ -417,7 +416,7 @@ class Contact extends BaseModule
info((($archived) ? L10n::t('Contact has been archived') : L10n::t('Contact has been unarchived')) . EOL);
}
$a->internalRedirect('contact/' . $contact_id);
DI::baseUrl()->redirect('contact/' . $contact_id);
// NOTREACHED
}
@ -451,13 +450,13 @@ class Contact extends BaseModule
}
// Now check how the user responded to the confirmation query
if (!empty($_REQUEST['canceled'])) {
$a->internalRedirect('contact');
DI::baseUrl()->redirect('contact');
}
self::dropContact($orig_record);
info(L10n::t('Contact has been removed.') . EOL);
$a->internalRedirect('contact');
DI::baseUrl()->redirect('contact');
// NOTREACHED
}
if ($cmd === 'posts') {

View File

@ -19,7 +19,7 @@ class Feed extends BaseModule
{
if (!local_user()) {
info(L10n::t('You must be logged in to use this module'));
DI::app()->internalRedirect();
DI::baseUrl()->redirect();
}
}

View File

@ -89,7 +89,7 @@ class Delegation extends BaseModule
$ret = [];
Hook::callAll('home_init', $ret);
DI::app()->internalRedirect('profile/' . DI::app()->user['nickname']);
DI::baseUrl()->redirect('profile/' . DI::app()->user['nickname']);
// NOTREACHED
}

View File

@ -47,6 +47,6 @@ class RemoveTag extends BaseModule
info('Item was not deleted');
}
$app->internalRedirect('network?file=' . rawurlencode($term));
DI::baseUrl()->redirect('network?file=' . rawurlencode($term));
}
}

View File

@ -19,7 +19,7 @@ class SaveTag extends BaseModule
{
if (!local_user()) {
info(L10n::t('You must be logged in to use this module'));
DI::app()->internalRedirect();
DI::baseUrl()->redirect();
}
}

View File

@ -13,8 +13,6 @@ class FollowConfirm extends BaseModule
{
public static function post(array $parameters = [])
{
$a = DI::app();
$uid = local_user();
if (!$uid) {
notice(L10n::t('Permission denied.') . EOL);
@ -33,6 +31,6 @@ class FollowConfirm extends BaseModule
$Intro->confirm($duplex, $hidden);
$a->internalRedirect('contact/' . intval($cid));
DI::baseUrl()->redirect('contact/' . intval($cid));
}
}

View File

@ -30,7 +30,7 @@ class Group extends BaseModule
if (!local_user()) {
notice(L10n::t('Permission denied.'));
$a->internalRedirect();
DI::baseUrl()->redirect();
}
// @TODO: Replace with parameter from router
@ -43,12 +43,12 @@ class Group extends BaseModule
info(L10n::t('Group created.'));
$r = Model\Group::getIdByName(local_user(), $name);
if ($r) {
$a->internalRedirect('group/' . $r);
DI::baseUrl()->redirect('group/' . $r);
}
} else {
notice(L10n::t('Could not create group.'));
}
$a->internalRedirect('group');
DI::baseUrl()->redirect('group');
}
// @TODO: Replace with parameter from router
@ -58,7 +58,7 @@ class Group extends BaseModule
$group = DBA::selectFirst('group', ['id', 'name'], ['id' => $a->argv[1], 'uid' => local_user()]);
if (!DBA::isResult($group)) {
notice(L10n::t('Group not found.'));
$a->internalRedirect('contact');
DI::baseUrl()->redirect('contact');
}
$groupname = Strings::escapeTags(trim($_POST['groupname']));
if (strlen($groupname) && ($groupname != $group['name'])) {
@ -142,7 +142,7 @@ class Group extends BaseModule
// With no group number provided we jump to the unassigned contacts as a starting point
// @TODO: Replace with parameter from router
if ($a->argc == 1) {
$a->internalRedirect('group/none');
DI::baseUrl()->redirect('group/none');
}
// Switch to text mode interface if we have more than 'n' contacts or group members
@ -200,7 +200,7 @@ class Group extends BaseModule
if (intval($a->argv[2])) {
if (!Model\Group::exists($a->argv[2], local_user())) {
notice(L10n::t('Group not found.'));
$a->internalRedirect('contact');
DI::baseUrl()->redirect('contact');
}
if (Model\Group::remove($a->argv[2])) {
@ -209,7 +209,7 @@ class Group extends BaseModule
notice(L10n::t('Unable to remove group.'));
}
}
$a->internalRedirect('group');
DI::baseUrl()->redirect('group');
}
// @TODO: Replace with parameter from router
@ -226,7 +226,7 @@ class Group extends BaseModule
$group = DBA::selectFirst('group', ['id', 'name'], ['id' => $a->argv[1], 'uid' => local_user(), 'deleted' => false]);
if (!DBA::isResult($group)) {
notice(L10n::t('Group not found.'));
$a->internalRedirect('contact');
DI::baseUrl()->redirect('contact');
}
$members = Model\Contact::getByGroupId($group['id']);

View File

@ -25,11 +25,11 @@ class Home extends BaseModule
Hook::callAll('home_init', $ret);
if (local_user() && ($app->user['nickname'])) {
$app->internalRedirect('network');
DI::baseUrl()->redirect('network');
}
if (strlen($config->get('system', 'singleuser'))) {
$app->internalRedirect('/profile/' . $config->get('system', 'singleuser'));
DI::baseUrl()->redirect('/profile/' . $config->get('system', 'singleuser'));
}
$customHome = '';

View File

@ -67,7 +67,7 @@ class Ignore extends BaseModule
$rand = "?$rand";
}
DI::app()->internalRedirect($return_path . $rand);
DI::baseUrl()->redirect($return_path . $rand);
}
// the json doesn't really matter, it will either be 0 or 1

View File

@ -47,7 +47,7 @@ class Like extends BaseModule
$rand = "?$rand";
}
$app->internalRedirect($returnPath . $rand);
DI::baseUrl()->redirect($returnPath . $rand);
}
}
}

View File

@ -58,10 +58,10 @@ class Notify extends BaseModule
}
}
$a->internalRedirect();
DI::baseUrl()->redirect();
}
// @TODO: Replace with parameter from router
$a->internalRedirect('notifications/system');
DI::baseUrl()->redirect('notifications/system');
}
}

View File

@ -25,7 +25,7 @@ class Objects extends BaseModule
}
if (!ActivityPub::isRequest()) {
$a->internalRedirect(str_replace('objects/', 'display/', $a->query_string));
DI::baseUrl()->redirect(str_replace('objects/', 'display/', $a->query_string));
}
/// @todo Add Authentication to enable fetching of non public content

View File

@ -31,7 +31,7 @@ class Pinned extends BaseModule
$returnPath = $_REQUEST['return'] ?? '';
if (!empty($returnPath)) {
$rand = '_=' . time() . (strpos($returnPath, '?') ? '&' : '?') . 'rand';
DI::app()->internalRedirect($returnPath . $rand);
DI::baseUrl()->redirect($returnPath . $rand);
}
// the json doesn't really matter, it will either be 0 or 1

View File

@ -23,6 +23,6 @@ class RandomProfile extends BaseModule
$a->redirect($link);
}
$a->internalRedirect('profile');
DI::baseUrl()->redirect('profile');
}
}

View File

@ -238,7 +238,7 @@ class Register extends BaseModule
if ($res) {
\info(L10n::t('Registration successful. Please check your email for further instructions.') . EOL);
$a->internalRedirect();
DI::baseUrl()->redirect();
} else {
\notice(
L10n::t('Failed to send email message. Here your accout details:<br> login: %s<br> password: %s<br><br>You can change your password after login.',
@ -248,12 +248,12 @@ class Register extends BaseModule
}
} else {
\info(L10n::t('Registration successful.') . EOL);
$a->internalRedirect();
DI::baseUrl()->redirect();
}
} elseif (intval(Config::get('config', 'register_policy')) === self::APPROVE) {
if (!strlen(Config::get('config', 'admin_email'))) {
\notice(L10n::t('Your registration can not be processed.') . EOL);
$a->internalRedirect();
DI::baseUrl()->redirect();
}
// Check if the note to the admin is actually filled out
@ -261,12 +261,12 @@ class Register extends BaseModule
\notice(L10n::t('You have to leave a request note for the admin.')
. L10n::t('Your registration can not be processed.') . EOL);
$a->internalRedirect('register/');
DI::baseUrl()->redirect('register/');
}
// Is there text in the tar pit?
if (!empty($_POST['registertarpit'])) {
\notice(L10n::t('You have entered too much information.'));
$a->internalRedirect('register/');
DI::baseUrl()->redirect('register/');
}
Model\Register::createForApproval($user['uid'], Config::get('system', 'language'), $_POST['permonlybox']);
@ -312,7 +312,7 @@ class Register extends BaseModule
);
\info(L10n::t('Your registration is pending approval by the site owner.') . EOL);
$a->internalRedirect();
DI::baseUrl()->redirect();
}
return;

View File

@ -36,6 +36,6 @@ class Saved extends BaseModule
}
}
DI::app()->internalRedirect($return_url);
DI::baseUrl()->redirect($return_url);
}
}

View File

@ -25,10 +25,8 @@ class Login extends BaseModule
{
public static function content(array $parameters = [])
{
$a = DI::app();
if (local_user()) {
$a->internalRedirect();
DI::baseUrl()->redirect();
}
return self::form(Session::get('return_path'), intval(Config::get('config', 'register_policy')) !== \Friendica\Module\Register::CLOSED);

View File

@ -40,7 +40,7 @@ class Logout extends BaseModule
System::externalRedirect($visitor_home);
} else {
info(L10n::t('Logged out.'));
DI::app()->internalRedirect();
DI::baseUrl()->redirect();
}
}
}

View File

@ -52,12 +52,12 @@ class Recovery extends BaseModule
public static function content(array $parameters = [])
{
if (!local_user()) {
DI::app()->internalRedirect();
DI::baseUrl()->redirect();
}
// Already authenticated with 2FA token
if (Session::get('2fa')) {
DI::app()->internalRedirect();
DI::baseUrl()->redirect();
}
return Renderer::replaceMacros(Renderer::getMarkupTemplate('twofactor/recovery.tpl'), [

View File

@ -50,12 +50,12 @@ class Verify extends BaseModule
public static function content(array $parameters = [])
{
if (!local_user()) {
DI::app()->internalRedirect();
DI::baseUrl()->redirect();
}
// Already authenticated with 2FA token
if (Session::get('2fa')) {
DI::app()->internalRedirect();
DI::baseUrl()->redirect();
}
return Renderer::replaceMacros(Renderer::getMarkupTemplate('twofactor/verify.tpl'), [

View File

@ -64,7 +64,7 @@ class Delegation extends BaseSettingsModule
if ($action === 'add' && $user_id) {
if (Session::get('submanage')) {
notice(L10n::t('Delegated administrators can view but not change delegation permissions.'));
DI::app()->internalRedirect('settings/delegation');
DI::baseUrl()->redirect('settings/delegation');
}
$user = User::getById($user_id, ['nickname']);
@ -80,17 +80,17 @@ class Delegation extends BaseSettingsModule
notice(L10n::t('Delegate user not found.'));
}
DI::app()->internalRedirect('settings/delegation');
DI::baseUrl()->redirect('settings/delegation');
}
if ($action === 'remove' && $user_id) {
if (Session::get('submanage')) {
notice(L10n::t('Delegated administrators can view but not change delegation permissions.'));
DI::app()->internalRedirect('settings/delegation');
DI::baseUrl()->redirect('settings/delegation');
}
DBA::delete('manage', ['uid' => $user_id, 'mid' => local_user()]);
DI::app()->internalRedirect('settings/delegation');
DI::baseUrl()->redirect('settings/delegation');
}
// find everybody that currently has delegated management to this account/page

View File

@ -30,12 +30,12 @@ class AppSpecific extends BaseSettingsModule
$verified = PConfig::get(local_user(), '2fa', 'verified');
if (!$verified) {
DI::app()->internalRedirect('settings/2fa');
DI::baseUrl()->redirect('settings/2fa');
}
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
notice(L10n::t('Please enter your password to access this page.'));
DI::app()->internalRedirect('settings/2fa');
DI::baseUrl()->redirect('settings/2fa');
}
}
@ -53,10 +53,10 @@ class AppSpecific extends BaseSettingsModule
$description = $_POST['description'] ?? '';
if (empty($description)) {
notice(L10n::t('App-specific password generation failed: The description is empty.'));
DI::app()->internalRedirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
DI::baseUrl()->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
} elseif (AppSpecificPassword::checkDuplicateForUser(local_user(), $description)) {
notice(L10n::t('App-specific password generation failed: This description already exists.'));
DI::app()->internalRedirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
DI::baseUrl()->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
} else {
self::$appSpecificPassword = AppSpecificPassword::generateForUser(local_user(), $_POST['description'] ?? '');
notice(L10n::t('New app-specific password generated.'));
@ -66,7 +66,7 @@ class AppSpecific extends BaseSettingsModule
case 'revoke_all' :
AppSpecificPassword::deleteAllForUser(local_user());
notice(L10n::t('App-specific passwords successfully revoked.'));
DI::app()->internalRedirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
DI::baseUrl()->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
break;
}
}
@ -78,7 +78,7 @@ class AppSpecific extends BaseSettingsModule
notice(L10n::t('App-specific password successfully revoked.'));
}
DI::app()->internalRedirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
DI::baseUrl()->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
}
}

View File

@ -39,7 +39,7 @@ class Index extends BaseSettingsModule
PConfig::set(local_user(), '2fa', 'secret', $Google2FA->generateSecretKey(32));
DI::app()->internalRedirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
DI::baseUrl()->redirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
}
break;
case 'disable':
@ -50,22 +50,22 @@ class Index extends BaseSettingsModule
Session::remove('2fa');
notice(L10n::t('Two-factor authentication successfully disabled.'));
DI::app()->internalRedirect('settings/2fa');
DI::baseUrl()->redirect('settings/2fa');
}
break;
case 'recovery':
if ($has_secret) {
DI::app()->internalRedirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
DI::baseUrl()->redirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
}
break;
case 'app_specific':
if ($has_secret) {
DI::app()->internalRedirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
DI::baseUrl()->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
}
break;
case 'configure':
if (!$verified) {
DI::app()->internalRedirect('settings/2fa/verify?t=' . self::getFormSecurityToken('settings_2fa_password'));
DI::baseUrl()->redirect('settings/2fa/verify?t=' . self::getFormSecurityToken('settings_2fa_password'));
}
break;
}

View File

@ -28,12 +28,12 @@ class Recovery extends BaseSettingsModule
$secret = PConfig::get(local_user(), '2fa', 'secret');
if (!$secret) {
DI::app()->internalRedirect('settings/2fa');
DI::baseUrl()->redirect('settings/2fa');
}
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
notice(L10n::t('Please enter your password to access this page.'));
DI::app()->internalRedirect('settings/2fa');
DI::baseUrl()->redirect('settings/2fa');
}
}
@ -49,7 +49,7 @@ class Recovery extends BaseSettingsModule
if ($_POST['action'] == 'regenerate') {
RecoveryCode::regenerateForUser(local_user());
notice(L10n::t('New recovery codes successfully generated.'));
DI::app()->internalRedirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
DI::baseUrl()->redirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
}
}
}

View File

@ -35,12 +35,12 @@ class Verify extends BaseSettingsModule
$verified = PConfig::get(local_user(), '2fa', 'verified');
if ($secret && $verified) {
DI::app()->internalRedirect('settings/2fa');
DI::baseUrl()->redirect('settings/2fa');
}
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
notice(L10n::t('Please enter your password to access this page.'));
DI::app()->internalRedirect('settings/2fa');
DI::baseUrl()->redirect('settings/2fa');
}
}
@ -63,7 +63,7 @@ class Verify extends BaseSettingsModule
notice(L10n::t('Two-factor authentication successfully activated.'));
DI::app()->internalRedirect('settings/2fa');
DI::baseUrl()->redirect('settings/2fa');
} else {
notice(L10n::t('Invalid code, please retry.'));
}

View File

@ -36,7 +36,7 @@ class Starred extends BaseModule
$returnPath = $_REQUEST['return'] ?? '';
if (!empty($returnPath)) {
$rand = '_=' . time() . (strpos($returnPath, '?') ? '&' : '?') . 'rand';
DI::app()->internalRedirect($returnPath . $rand);
DI::baseUrl()->redirect($returnPath . $rand);
}
// the json doesn't really matter, it will either be 0 or 1

View File

@ -51,7 +51,7 @@ class Tos extends BaseModule
public static function init(array $parameters = [])
{
if (strlen(Config::get('system','singleuser'))) {
DI::app()->internalRedirect('profile/' . Config::get('system','singleuser'));
DI::baseUrl()->redirect('profile/' . Config::get('system','singleuser'));
}
}