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

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

View File

@ -8,6 +8,7 @@ use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Module\Security\Login; use Friendica\Module\Security\Login;
require_once __DIR__ . '/../include/api.php'; require_once __DIR__ . '/../include/api.php';
@ -76,7 +77,7 @@ function api_content(App $a)
if (strstr($consumer->callback_url, $glue)) { if (strstr($consumer->callback_url, $glue)) {
$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(); exit();
} }

View File

@ -16,12 +16,11 @@ use Friendica\Core\Renderer;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Session; use Friendica\Core\Session;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\Event; use Friendica\Model\Event;
use Friendica\Model\Group;
use Friendica\Model\Item; use Friendica\Model\Item;
use Friendica\Model\Profile; use Friendica\Model\Profile;
use Friendica\Protocol\DFRN;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
use Friendica\Util\Temporal; 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 // 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")) { if ((local_user() !== $owner_uid) && !Feature::isEnabled($owner_uid, "export_calendar")) {
notice(L10n::t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
$a->internalRedirect('cal/' . $nick); DI::baseUrl()->redirect('cal/' . $nick);
} }
// Get the export data by uid // Get the export data by uid
@ -310,7 +309,7 @@ function cal_content(App $a)
$return_path = "cal/" . $nick; $return_path = "cal/" . $nick;
} }
$a->internalRedirect($return_path); DI::baseUrl()->redirect($return_path);
} }
// If nothing went wrong we can echo the export content // 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\Protocol;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\Group; use Friendica\Model\Group;
use Friendica\Model\User; 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 // Let's send our user to the contact editor in case they want to
// do anything special with this new friend. // do anything special with this new friend.
if ($handsfree === null) { if ($handsfree === null) {
$a->internalRedirect('contact/' . intval($contact_id)); DI::baseUrl()->redirect('contact/' . intval($contact_id));
} else { } else {
return; 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. // somebody arrived here by mistake or they are fishing. Send them to the homepage.
$a->internalRedirect(); DI::baseUrl()->redirect();
// NOTREACHED // NOTREACHED
} }

View File

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

View File

@ -21,6 +21,7 @@ use Friendica\Core\Renderer;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Session; use Friendica\Core\Session;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\Group; use Friendica\Model\Group;
use Friendica\Model\Profile; use Friendica\Model\Profile;
@ -68,7 +69,7 @@ function dfrn_request_post(App $a)
} }
if (!empty($_POST['cancel'])) { 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) // (ignore reply, nothing we can do it failed)
$a->internalRedirect($forward_path); DI::baseUrl()->redirect($forward_path);
return; // NOTREACHED return; // NOTREACHED
} }
} }
// invalid/bogus request // invalid/bogus request
notice(L10n::t('Unrecoverable protocol error.') . EOL); notice(L10n::t('Unrecoverable protocol error.') . EOL);
$a->internalRedirect(); DI::baseUrl()->redirect();
return; // NOTREACHED return; // NOTREACHED
} }
@ -334,19 +335,19 @@ function dfrn_request_post(App $a)
$url = Network::isUrlValid($url); $url = Network::isUrlValid($url);
if (!$url) { if (!$url) {
notice(L10n::t('Invalid profile URL.') . EOL); notice(L10n::t('Invalid profile URL.') . EOL);
$a->internalRedirect($a->cmd); DI::baseUrl()->redirect($a->cmd);
return; // NOTREACHED return; // NOTREACHED
} }
if (!Network::isUrlAllowed($url)) { if (!Network::isUrlAllowed($url)) {
notice(L10n::t('Disallowed profile URL.') . EOL); notice(L10n::t('Disallowed profile URL.') . EOL);
$a->internalRedirect($a->cmd); DI::baseUrl()->redirect($a->cmd);
return; // NOTREACHED return; // NOTREACHED
} }
if (Network::isUrlBlocked($url)) { if (Network::isUrlBlocked($url)) {
notice(L10n::t('Blocked domain') . EOL); notice(L10n::t('Blocked domain') . EOL);
$a->internalRedirect($a->cmd); DI::baseUrl()->redirect($a->cmd);
return; // NOTREACHED return; // NOTREACHED
} }
@ -354,7 +355,7 @@ function dfrn_request_post(App $a)
if (!count($parms)) { if (!count($parms)) {
notice(L10n::t('Profile location is not valid or does not contain profile information.') . EOL); 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 { } else {
if (empty($parms['fn'])) { if (empty($parms['fn'])) {
notice(L10n::t('Warning: profile location has no identifiable owner name.') . EOL); 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\Theme;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Event; use Friendica\Model\Event;
use Friendica\Model\Item; use Friendica\Model\Item;
use Friendica\Model\Profile; use Friendica\Model\Profile;
@ -123,7 +124,7 @@ function events_post(App $a)
echo L10n::t('Event can not end before it has started.'); echo L10n::t('Event can not end before it has started.');
exit(); exit();
} }
$a->internalRedirect($onerror_path); DI::baseUrl()->redirect($onerror_path);
} }
if (!$summary || ($start === DBA::NULL_DATETIME)) { 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.'); echo L10n::t('Event title and start time are required.');
exit(); exit();
} }
$a->internalRedirect($onerror_path); DI::baseUrl()->redirect($onerror_path);
} }
$share = intval($_POST['share'] ?? 0); $share = intval($_POST['share'] ?? 0);
@ -150,7 +151,7 @@ function events_post(App $a)
if ($share) { if ($share) {
$aclFormatter = \Friendica\DI::aclFormatter(); $aclFormatter = DI::aclFormatter();
$str_group_allow = $aclFormatter->toString($_POST['group_allow'] ?? ''); $str_group_allow = $aclFormatter->toString($_POST['group_allow'] ?? '');
$str_contact_allow = $aclFormatter->toString($_POST['contact_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); Worker::add(PRIORITY_HIGH, "Notifier", Delivery::POST, $item_id);
} }
$a->internalRedirect('events'); DI::baseUrl()->redirect('events');
} }
function events_content(App $a) function events_content(App $a)
@ -578,6 +579,6 @@ function events_content(App $a)
info(L10n::t('Event removed') . EOL); 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\Protocol;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\Profile; use Friendica\Model\Profile;
use Friendica\Network\Probe; use Friendica\Network\Probe;
@ -21,7 +22,7 @@ function follow_post(App $a)
} }
if (isset($_REQUEST['cancel'])) { if (isset($_REQUEST['cancel'])) {
$a->internalRedirect('contact'); DI::baseUrl()->redirect('contact');
} }
$uid = local_user(); $uid = local_user();
@ -38,14 +39,14 @@ function follow_post(App $a)
if ($result['message']) { if ($result['message']) {
notice($result['message']); notice($result['message']);
} }
$a->internalRedirect($return_path); DI::baseUrl()->redirect($return_path);
} elseif ($result['cid']) { } elseif ($result['cid']) {
$a->internalRedirect('contact/' . $result['cid']); DI::baseUrl()->redirect('contact/' . $result['cid']);
} }
info(L10n::t('The contact could not be added.')); info(L10n::t('The contact could not be added.'));
$a->internalRedirect($return_path); DI::baseUrl()->redirect($return_path);
// NOTREACHED // NOTREACHED
} }
@ -55,7 +56,7 @@ function follow_content(App $a)
if (!local_user()) { if (!local_user()) {
notice(L10n::t('Permission denied.')); notice(L10n::t('Permission denied.'));
$a->internalRedirect($return_path); DI::baseUrl()->redirect($return_path);
// NOTREACHED // NOTREACHED
} }
@ -70,7 +71,7 @@ function follow_content(App $a)
} }
if (!$url) { if (!$url) {
$a->internalRedirect($return_path); DI::baseUrl()->redirect($return_path);
} }
$submit = L10n::t('Submit Request'); $submit = L10n::t('Submit Request');
@ -132,7 +133,7 @@ function follow_content(App $a)
if (!$r) { if (!$r) {
notice(L10n::t('Permission denied.')); notice(L10n::t('Permission denied.'));
$a->internalRedirect($return_path); DI::baseUrl()->redirect($return_path);
// NOTREACHED // NOTREACHED
} }

View File

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

View File

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

View File

@ -13,6 +13,7 @@ use Friendica\Core\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\Mail; use Friendica\Model\Mail;
use Friendica\Module\Security\Login; use Friendica\Module\Security\Login;
@ -88,7 +89,7 @@ function message_post(App $a)
$a->argc = 2; $a->argc = 2;
$a->argv[1] = 'new'; $a->argv[1] = 'new';
} else { } 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 // Now check how the user responded to the confirmation query
if (!empty($_REQUEST['canceled'])) { if (!empty($_REQUEST['canceled'])) {
$a->internalRedirect('message'); DI::baseUrl()->redirect('message');
} }
$cmd = $a->argv[1]; $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()]); $message = DBA::selectFirst('mail', ['convid'], ['id' => $a->argv[2], 'uid' => local_user()]);
if(!DBA::isResult($message)){ if(!DBA::isResult($message)){
info(L10n::t('Conversation not found.') . EOL); 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()])) { 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()]); $conversation = DBA::selectFirst('mail', ['id'], ['convid' => $message['convid'], 'uid' => local_user()]);
if(!DBA::isResult($conversation)){ if(!DBA::isResult($conversation)){
info(L10n::t('Conversation removed.') . EOL); 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 { } else {
$r = q("SELECT `parent-uri`,`convid` FROM `mail` WHERE `id` = %d AND `uid` = %d LIMIT 1", $r = q("SELECT `parent-uri`,`convid` FROM `mail` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($a->argv[2]), intval($a->argv[2]),
@ -190,7 +191,7 @@ function message_content(App $a)
info(L10n::t('Conversation removed.') . EOL); 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); $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(); exit();
} }
notice(L10n::t('No such group') . EOL); notice(L10n::t('No such group') . EOL);
$a->internalRedirect('network/0'); DI::baseUrl()->redirect('network/0');
// NOTREACHED // NOTREACHED
} }
@ -641,7 +641,7 @@ function networkThreadedView(App $a, $update, $parent)
} }
} else { } else {
notice(L10n::t('Invalid contact.') . EOL); notice(L10n::t('Invalid contact.') . EOL);
$a->internalRedirect('network'); DI::baseUrl()->redirect('network');
// NOTREACHED // NOTREACHED
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -16,6 +16,7 @@ use Friendica\Core\Renderer;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\GContact; use Friendica\Model\GContact;
use Friendica\Model\Profile; use Friendica\Model\Profile;
@ -41,7 +42,7 @@ function profiles_init(App $a) {
); );
if (! DBA::isResult($r)) { if (! DBA::isResult($r)) {
notice(L10n::t('Profile not found.') . EOL); notice(L10n::t('Profile not found.') . EOL);
$a->internalRedirect('profiles'); DI::baseUrl()->redirect('profiles');
return; // NOTREACHED return; // NOTREACHED
} }
@ -62,7 +63,7 @@ function profiles_init(App $a) {
info(L10n::t('Profile deleted.').EOL); info(L10n::t('Profile deleted.').EOL);
} }
$a->internalRedirect('profiles'); DI::baseUrl()->redirect('profiles');
return; // NOTREACHED return; // NOTREACHED
} }
@ -96,10 +97,10 @@ function profiles_init(App $a) {
info(L10n::t('New profile created.') . EOL); info(L10n::t('New profile created.') . EOL);
if (DBA::isResult($r3) && count($r3) == 1) { 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')) { if (($a->argc > 2) && ($a->argv[1] === 'clone')) {
@ -134,10 +135,10 @@ function profiles_init(App $a) {
); );
info(L10n::t('New profile created.') . EOL); info(L10n::t('New profile created.') . EOL);
if ((DBA::isResult($r3)) && (count($r3) == 1)) { 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 return; // NOTREACHED
} }
@ -640,7 +641,7 @@ function profiles_content(App $a) {
); );
if (DBA::isResult($r)) { if (DBA::isResult($r)) {
//Go to the default profile. //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\Session;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\Profile; use Friendica\Model\Profile;
use Friendica\Util\Network; use Friendica\Util\Network;
@ -30,7 +31,7 @@ function redir_init(App $a) {
$contact = DBA::selectFirst('contact', $fields, ['id' => $cid, 'uid' => [0, local_user()]]); $contact = DBA::selectFirst('contact', $fields, ['id' => $cid, 'uid' => [0, local_user()]]);
if (!DBA::isResult($contact)) { if (!DBA::isResult($contact)) {
notice(L10n::t('Contact not found.')); notice(L10n::t('Contact not found.'));
$a->internalRedirect(); DI::baseUrl()->redirect();
} }
$contact_url = $contact['url']; $contact_url = $contact['url'];
@ -120,7 +121,7 @@ function redir_init(App $a) {
} }
notice(L10n::t('Contact not found.')); notice(L10n::t('Contact not found.'));
$a->internalRedirect(); DI::baseUrl()->redirect();
} }
function redir_magic($a, $cid, $url) function redir_magic($a, $cid, $url)

View File

@ -9,6 +9,7 @@ use Friendica\Core\L10n;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Register; use Friendica\Model\Register;
use Friendica\Model\User; use Friendica\Model\User;
use Friendica\Module\Security\Login; use Friendica\Module\Security\Login;
@ -98,11 +99,11 @@ function regmod_content(App $a)
if ($cmd === 'deny') { if ($cmd === 'deny') {
user_deny($hash); user_deny($hash);
$a->internalRedirect('admin/users/'); DI::baseUrl()->redirect('admin/users/');
} }
if ($cmd === 'allow') { if ($cmd === 'allow') {
user_allow($hash); 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\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\User; use Friendica\Model\User;
use Friendica\Util\Strings; use Friendica\Util\Strings;
@ -59,7 +60,7 @@ function removeme_post(App $a)
unset($_SESSION['authenticated']); unset($_SESSION['authenticated']);
unset($_SESSION['uid']); unset($_SESSION['uid']);
$a->internalRedirect(); DI::baseUrl()->redirect();
// NOTREACHED // NOTREACHED
} }
} }
@ -67,7 +68,7 @@ function removeme_post(App $a)
function removeme_content(App $a) function removeme_content(App $a)
{ {
if (!local_user()) { if (!local_user()) {
$a->internalRedirect(); DI::baseUrl()->redirect();
} }
$hash = Strings::getRandomHex(); $hash = Strings::getRandomHex();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,6 +8,7 @@ use Friendica\Core\Logger;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Mail; use Friendica\Model\Mail;
use Friendica\Model\Profile; use Friendica\Model\Profile;
use Friendica\Util\Strings; use Friendica\Util\Strings;
@ -72,7 +73,7 @@ function wallmessage_post(App $a) {
info(L10n::t('Message sent.') . EOL); 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 // in install mode, any url loads install module
// but we need "view" module for stylesheet // but we need "view" module for stylesheet
if ($this->mode->isInstall() && $moduleName !== 'install') { 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') { } elseif (!$this->mode->isInstall() && !$this->mode->has(App\Mode::MAINTENANCEDISABLED) && $moduleName !== 'maintenance') {
$this->internalRedirect('maintenance'); $this->baseURL->redirect('maintenance');
} else { } else {
$this->checkURL(); $this->checkURL();
Core\Update::check($this->getBasePath(), false, $this->mode); Core\Update::check($this->getBasePath(), false, $this->mode);
@ -693,35 +693,35 @@ class App
// Compatibility with the Android Diaspora client // Compatibility with the Android Diaspora client
if ($moduleName == 'stream') { if ($moduleName == 'stream') {
$this->internalRedirect('network?order=post'); $this->baseURL->redirect('network?order=post');
} }
if ($moduleName == 'conversations') { if ($moduleName == 'conversations') {
$this->internalRedirect('message'); $this->baseURL->redirect('message');
} }
if ($moduleName == 'commented') { if ($moduleName == 'commented') {
$this->internalRedirect('network?order=comment'); $this->baseURL->redirect('network?order=comment');
} }
if ($moduleName == 'liked') { if ($moduleName == 'liked') {
$this->internalRedirect('network?order=comment'); $this->baseURL->redirect('network?order=comment');
} }
if ($moduleName == 'activity') { if ($moduleName == 'activity') {
$this->internalRedirect('network?conv=1'); $this->baseURL->redirect('network?conv=1');
} }
if (($moduleName == 'status_messages') && ($this->args->getCommand() == 'status_messages/new')) { 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')) { 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')) { 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 // 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); $module = $module->determineClass($this->args, $router, $this->config);
// Let the module run it's internal process (init, get, post, ...) // 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) { } catch (HTTPException $e) {
ModuleHTTPException::rawContent($e); ModuleHTTPException::rawContent($e);
} }
@ -740,15 +740,6 @@ class App
$this->page->run($this, $this->baseURL, $this->mode, $module, $this->l10n, $this->config, $pconfig); $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 * Automatically redirects to relative or absolute URL
* Should only be used if it isn't clear if the URL is either internal or external * 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()) { if ($a->isAjax()) {
throw new HTTPException\ForbiddenException(); throw new HTTPException\ForbiddenException();
} else { } 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 * Run the determined module class and calls all hooks applied to
* *
* @param Core\L10n\L10n $l10n The L10n instance * @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 LoggerInterface $logger The Friendica logger
* @param array $server The $_SERVER variable * @param array $server The $_SERVER variable
* @param array $post The $_POST variables * @param array $post The $_POST variables
* *
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @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) { if ($this->printNotAllowedAddon) {
info($l10n->t("You must be logged in to use addons. ")); 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)) { 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']]); $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']]); $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: user ' . $a->user['guid'] . ' - form element ' . $typename);
Logger::log('checkFormSecurityToken failed: _REQUEST data: ' . print_r($_REQUEST, true), Logger::DATA); Logger::log('checkFormSecurityToken failed: _REQUEST data: ' . print_r($_REQUEST, true), Logger::DATA);
notice(self::getFormSecurityStandardErrorMessage()); 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\App;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\Database\DBStructure; use Friendica\Database\DBStructure;
use Friendica\DI;
use Friendica\Model\Photo; use Friendica\Model\Photo;
use Friendica\Object\Image; use Friendica\Object\Image;
use Friendica\Util\Strings; use Friendica\Util\Strings;
@ -85,12 +86,11 @@ class UserImport
/** /**
* @brief Import account file exported from mod/uexport * @brief Import account file exported from mod/uexport
* *
* @param App $a Friendica App Class
* @param array $file array from $_FILES * @param array $file array from $_FILES
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException * @throws \ImagickException
*/ */
public static function importAccount(App $a, $file) public static function importAccount($file)
{ {
Logger::log("Start user import from " . $file['tmp_name']); Logger::log("Start user import from " . $file['tmp_name']);
/* /*
@ -282,6 +282,6 @@ class UserImport
Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, $newuid); Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, $newuid);
info(L10n::t("Done. You can now login with your username and password")); 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()); $myaddr = bin2hex($a->user['nickname'] . '@' . $a->getHostName());
} }
$a->internalRedirect($ret['request'] . "&addr=$myaddr"); DI::baseUrl()->redirect($ret['request'] . "&addr=$myaddr");
// NOTREACHED // NOTREACHED
} }

View File

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

View File

@ -39,7 +39,7 @@ class Contact extends BaseAdminModule
notice(L10n::tt('%s contact unblocked', '%s contacts unblocked', count($contacts))); 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 = []) public static function content(array $parameters = [])

View File

@ -48,7 +48,7 @@ class Server extends BaseAdminModule
info(L10n::t('Site blocklist updated.') . EOL); 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 = []) 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); info(L10n::t('Update has been marked successful') . EOL);
} }
$a->internalRedirect('admin/dbsync'); DI::baseUrl()->redirect('admin/dbsync');
} }
if ($a->argc > 2) { 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 = []) public static function content(array $parameters = [])

View File

@ -34,7 +34,7 @@ class Delete extends BaseAdminModule
} }
info(L10n::t('Item marked for deletion.') . EOL); 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 = []) public static function content(array $parameters = [])

View File

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

View File

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

View File

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

View File

@ -30,7 +30,7 @@ class Tos extends BaseAdminModule
info(L10n::t('The Terms of Service settings have been updated.')); 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 = []) 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 = []) public static function content(array $parameters = [])
@ -145,7 +145,7 @@ class Users extends BaseAdminModule
$user = User::getById($uid, ['username', 'blocked']); $user = User::getById($uid, ['username', 'blocked']);
if (!DBA::isResult($user)) { if (!DBA::isResult($user)) {
notice('User not found' . EOL); notice('User not found' . EOL);
$a->internalRedirect('admin/users'); DI::baseUrl()->redirect('admin/users');
return ''; // NOTREACHED return ''; // NOTREACHED
} }
@ -175,7 +175,7 @@ class Users extends BaseAdminModule
break; break;
} }
$a->internalRedirect('admin/users'); DI::baseUrl()->redirect('admin/users');
} }
/* get pending */ /* get pending */

View File

@ -18,7 +18,7 @@ class Apps extends BaseModule
{ {
$privateaddons = Config::get('config', 'private_addons'); $privateaddons = Config::get('config', 'private_addons');
if ($privateaddons === "1" && !local_user()) { 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()) { if (!is_site_admin()) {
notice(L10n::t('Please login to continue.')); notice(L10n::t('Please login to continue.'));
Session::set('return_path', $a->query_string); Session::set('return_path', $a->query_string);
$a->internalRedirect('login'); DI::baseUrl()->redirect('login');
} }
if (!empty($_SESSION['submanage'])) { if (!empty($_SESSION['submanage'])) {

View File

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

View File

@ -19,7 +19,7 @@ class Feed extends BaseModule
{ {
if (!local_user()) { if (!local_user()) {
info(L10n::t('You must be logged in to use this module')); 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 = []; $ret = [];
Hook::callAll('home_init', $ret); Hook::callAll('home_init', $ret);
DI::app()->internalRedirect('profile/' . DI::app()->user['nickname']); DI::baseUrl()->redirect('profile/' . DI::app()->user['nickname']);
// NOTREACHED // NOTREACHED
} }

View File

@ -47,6 +47,6 @@ class RemoveTag extends BaseModule
info('Item was not deleted'); 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()) { if (!local_user()) {
info(L10n::t('You must be logged in to use this module')); 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 = []) public static function post(array $parameters = [])
{ {
$a = DI::app();
$uid = local_user(); $uid = local_user();
if (!$uid) { if (!$uid) {
notice(L10n::t('Permission denied.') . EOL); notice(L10n::t('Permission denied.') . EOL);
@ -33,6 +31,6 @@ class FollowConfirm extends BaseModule
$Intro->confirm($duplex, $hidden); $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()) { if (!local_user()) {
notice(L10n::t('Permission denied.')); notice(L10n::t('Permission denied.'));
$a->internalRedirect(); DI::baseUrl()->redirect();
} }
// @TODO: Replace with parameter from router // @TODO: Replace with parameter from router
@ -43,12 +43,12 @@ class Group extends BaseModule
info(L10n::t('Group created.')); info(L10n::t('Group created.'));
$r = Model\Group::getIdByName(local_user(), $name); $r = Model\Group::getIdByName(local_user(), $name);
if ($r) { if ($r) {
$a->internalRedirect('group/' . $r); DI::baseUrl()->redirect('group/' . $r);
} }
} else { } else {
notice(L10n::t('Could not create group.')); notice(L10n::t('Could not create group.'));
} }
$a->internalRedirect('group'); DI::baseUrl()->redirect('group');
} }
// @TODO: Replace with parameter from router // @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()]); $group = DBA::selectFirst('group', ['id', 'name'], ['id' => $a->argv[1], 'uid' => local_user()]);
if (!DBA::isResult($group)) { if (!DBA::isResult($group)) {
notice(L10n::t('Group not found.')); notice(L10n::t('Group not found.'));
$a->internalRedirect('contact'); DI::baseUrl()->redirect('contact');
} }
$groupname = Strings::escapeTags(trim($_POST['groupname'])); $groupname = Strings::escapeTags(trim($_POST['groupname']));
if (strlen($groupname) && ($groupname != $group['name'])) { 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 // With no group number provided we jump to the unassigned contacts as a starting point
// @TODO: Replace with parameter from router // @TODO: Replace with parameter from router
if ($a->argc == 1) { 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 // 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 (intval($a->argv[2])) {
if (!Model\Group::exists($a->argv[2], local_user())) { if (!Model\Group::exists($a->argv[2], local_user())) {
notice(L10n::t('Group not found.')); notice(L10n::t('Group not found.'));
$a->internalRedirect('contact'); DI::baseUrl()->redirect('contact');
} }
if (Model\Group::remove($a->argv[2])) { if (Model\Group::remove($a->argv[2])) {
@ -209,7 +209,7 @@ class Group extends BaseModule
notice(L10n::t('Unable to remove group.')); notice(L10n::t('Unable to remove group.'));
} }
} }
$a->internalRedirect('group'); DI::baseUrl()->redirect('group');
} }
// @TODO: Replace with parameter from router // @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]); $group = DBA::selectFirst('group', ['id', 'name'], ['id' => $a->argv[1], 'uid' => local_user(), 'deleted' => false]);
if (!DBA::isResult($group)) { if (!DBA::isResult($group)) {
notice(L10n::t('Group not found.')); notice(L10n::t('Group not found.'));
$a->internalRedirect('contact'); DI::baseUrl()->redirect('contact');
} }
$members = Model\Contact::getByGroupId($group['id']); $members = Model\Contact::getByGroupId($group['id']);

View File

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

View File

@ -67,7 +67,7 @@ class Ignore extends BaseModule
$rand = "?$rand"; $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 // 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"; $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 // @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()) { 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 /// @todo Add Authentication to enable fetching of non public content

View File

@ -31,7 +31,7 @@ class Pinned extends BaseModule
$returnPath = $_REQUEST['return'] ?? ''; $returnPath = $_REQUEST['return'] ?? '';
if (!empty($returnPath)) { if (!empty($returnPath)) {
$rand = '_=' . time() . (strpos($returnPath, '?') ? '&' : '?') . 'rand'; $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 // 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->redirect($link);
} }
$a->internalRedirect('profile'); DI::baseUrl()->redirect('profile');
} }
} }

View File

@ -238,7 +238,7 @@ class Register extends BaseModule
if ($res) { if ($res) {
\info(L10n::t('Registration successful. Please check your email for further instructions.') . EOL); \info(L10n::t('Registration successful. Please check your email for further instructions.') . EOL);
$a->internalRedirect(); DI::baseUrl()->redirect();
} else { } else {
\notice( \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.', 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 { } else {
\info(L10n::t('Registration successful.') . EOL); \info(L10n::t('Registration successful.') . EOL);
$a->internalRedirect(); DI::baseUrl()->redirect();
} }
} elseif (intval(Config::get('config', 'register_policy')) === self::APPROVE) { } elseif (intval(Config::get('config', 'register_policy')) === self::APPROVE) {
if (!strlen(Config::get('config', 'admin_email'))) { if (!strlen(Config::get('config', 'admin_email'))) {
\notice(L10n::t('Your registration can not be processed.') . EOL); \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 // 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.') \notice(L10n::t('You have to leave a request note for the admin.')
. L10n::t('Your registration can not be processed.') . EOL); . L10n::t('Your registration can not be processed.') . EOL);
$a->internalRedirect('register/'); DI::baseUrl()->redirect('register/');
} }
// Is there text in the tar pit? // Is there text in the tar pit?
if (!empty($_POST['registertarpit'])) { if (!empty($_POST['registertarpit'])) {
\notice(L10n::t('You have entered too much information.')); \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']); 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); \info(L10n::t('Your registration is pending approval by the site owner.') . EOL);
$a->internalRedirect(); DI::baseUrl()->redirect();
} }
return; 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 = []) public static function content(array $parameters = [])
{ {
$a = DI::app();
if (local_user()) { 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); 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); System::externalRedirect($visitor_home);
} else { } else {
info(L10n::t('Logged out.')); 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 = []) public static function content(array $parameters = [])
{ {
if (!local_user()) { if (!local_user()) {
DI::app()->internalRedirect(); DI::baseUrl()->redirect();
} }
// Already authenticated with 2FA token // Already authenticated with 2FA token
if (Session::get('2fa')) { if (Session::get('2fa')) {
DI::app()->internalRedirect(); DI::baseUrl()->redirect();
} }
return Renderer::replaceMacros(Renderer::getMarkupTemplate('twofactor/recovery.tpl'), [ return Renderer::replaceMacros(Renderer::getMarkupTemplate('twofactor/recovery.tpl'), [

View File

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

View File

@ -64,7 +64,7 @@ class Delegation extends BaseSettingsModule
if ($action === 'add' && $user_id) { if ($action === 'add' && $user_id) {
if (Session::get('submanage')) { if (Session::get('submanage')) {
notice(L10n::t('Delegated administrators can view but not change delegation permissions.')); 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']); $user = User::getById($user_id, ['nickname']);
@ -80,17 +80,17 @@ class Delegation extends BaseSettingsModule
notice(L10n::t('Delegate user not found.')); notice(L10n::t('Delegate user not found.'));
} }
DI::app()->internalRedirect('settings/delegation'); DI::baseUrl()->redirect('settings/delegation');
} }
if ($action === 'remove' && $user_id) { if ($action === 'remove' && $user_id) {
if (Session::get('submanage')) { if (Session::get('submanage')) {
notice(L10n::t('Delegated administrators can view but not change delegation permissions.')); 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()]); 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 // 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'); $verified = PConfig::get(local_user(), '2fa', 'verified');
if (!$verified) { if (!$verified) {
DI::app()->internalRedirect('settings/2fa'); DI::baseUrl()->redirect('settings/2fa');
} }
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) { if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
notice(L10n::t('Please enter your password to access this page.')); 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'] ?? ''; $description = $_POST['description'] ?? '';
if (empty($description)) { if (empty($description)) {
notice(L10n::t('App-specific password generation failed: The description is empty.')); 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)) { } elseif (AppSpecificPassword::checkDuplicateForUser(local_user(), $description)) {
notice(L10n::t('App-specific password generation failed: This description already exists.')); 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 { } else {
self::$appSpecificPassword = AppSpecificPassword::generateForUser(local_user(), $_POST['description'] ?? ''); self::$appSpecificPassword = AppSpecificPassword::generateForUser(local_user(), $_POST['description'] ?? '');
notice(L10n::t('New app-specific password generated.')); notice(L10n::t('New app-specific password generated.'));
@ -66,7 +66,7 @@ class AppSpecific extends BaseSettingsModule
case 'revoke_all' : case 'revoke_all' :
AppSpecificPassword::deleteAllForUser(local_user()); AppSpecificPassword::deleteAllForUser(local_user());
notice(L10n::t('App-specific passwords successfully revoked.')); 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; break;
} }
} }
@ -78,7 +78,7 @@ class AppSpecific extends BaseSettingsModule
notice(L10n::t('App-specific password successfully revoked.')); 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)); 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; break;
case 'disable': case 'disable':
@ -50,22 +50,22 @@ class Index extends BaseSettingsModule
Session::remove('2fa'); Session::remove('2fa');
notice(L10n::t('Two-factor authentication successfully disabled.')); notice(L10n::t('Two-factor authentication successfully disabled.'));
DI::app()->internalRedirect('settings/2fa'); DI::baseUrl()->redirect('settings/2fa');
} }
break; break;
case 'recovery': case 'recovery':
if ($has_secret) { 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; break;
case 'app_specific': case 'app_specific':
if ($has_secret) { 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; break;
case 'configure': case 'configure':
if (!$verified) { 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; break;
} }

View File

@ -28,12 +28,12 @@ class Recovery extends BaseSettingsModule
$secret = PConfig::get(local_user(), '2fa', 'secret'); $secret = PConfig::get(local_user(), '2fa', 'secret');
if (!$secret) { if (!$secret) {
DI::app()->internalRedirect('settings/2fa'); DI::baseUrl()->redirect('settings/2fa');
} }
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) { if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
notice(L10n::t('Please enter your password to access this page.')); 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') { if ($_POST['action'] == 'regenerate') {
RecoveryCode::regenerateForUser(local_user()); RecoveryCode::regenerateForUser(local_user());
notice(L10n::t('New recovery codes successfully generated.')); 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'); $verified = PConfig::get(local_user(), '2fa', 'verified');
if ($secret && $verified) { if ($secret && $verified) {
DI::app()->internalRedirect('settings/2fa'); DI::baseUrl()->redirect('settings/2fa');
} }
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) { if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
notice(L10n::t('Please enter your password to access this page.')); 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.')); notice(L10n::t('Two-factor authentication successfully activated.'));
DI::app()->internalRedirect('settings/2fa'); DI::baseUrl()->redirect('settings/2fa');
} else { } else {
notice(L10n::t('Invalid code, please retry.')); notice(L10n::t('Invalid code, please retry.'));
} }

View File

@ -36,7 +36,7 @@ class Starred extends BaseModule
$returnPath = $_REQUEST['return'] ?? ''; $returnPath = $_REQUEST['return'] ?? '';
if (!empty($returnPath)) { if (!empty($returnPath)) {
$rand = '_=' . time() . (strpos($returnPath, '?') ? '&' : '?') . 'rand'; $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 // 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 = []) public static function init(array $parameters = [])
{ {
if (strlen(Config::get('system','singleuser'))) { if (strlen(Config::get('system','singleuser'))) {
DI::app()->internalRedirect('profile/' . Config::get('system','singleuser')); DI::baseUrl()->redirect('profile/' . Config::get('system','singleuser'));
} }
} }