mirror of
https://github.com/friendica/friendica
synced 2025-04-23 23:10:10 +00:00
Refactor deprecated App::internalRedirect() to DI::baseUrl()->redirect()
This commit is contained in:
parent
cc9b7bb14f
commit
8e6973b774
77 changed files with 263 additions and 259 deletions
|
@ -29,11 +29,11 @@ class Details extends BaseAdminModule
|
|||
$func($a);
|
||||
}
|
||||
|
||||
$a->internalRedirect('admin/addons/' . $addon);
|
||||
DI::baseUrl()->redirect('admin/addons/' . $addon);
|
||||
}
|
||||
}
|
||||
|
||||
$a->internalRedirect('admin/addons');
|
||||
DI::baseUrl()->redirect('admin/addons');
|
||||
}
|
||||
|
||||
public static function content(array $parameters = [])
|
||||
|
@ -51,7 +51,7 @@ class Details extends BaseAdminModule
|
|||
if (!is_file("addon/$addon/$addon.php")) {
|
||||
notice(L10n::t('Addon not found.'));
|
||||
Addon::uninstall($addon);
|
||||
$a->internalRedirect('admin/addons');
|
||||
DI::baseUrl()->redirect('admin/addons');
|
||||
}
|
||||
|
||||
if (($_GET['action'] ?? '') == 'toggle') {
|
||||
|
@ -68,7 +68,7 @@ class Details extends BaseAdminModule
|
|||
|
||||
Addon::saveEnabledList();
|
||||
|
||||
$a->internalRedirect('admin/addons/' . $addon);
|
||||
DI::baseUrl()->redirect('admin/addons/' . $addon);
|
||||
}
|
||||
|
||||
// display addon details
|
||||
|
@ -119,6 +119,6 @@ class Details extends BaseAdminModule
|
|||
]);
|
||||
}
|
||||
|
||||
$a->internalRedirect('admin/addons');
|
||||
DI::baseUrl()->redirect('admin/addons');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ class Index extends BaseAdminModule
|
|||
|
||||
}
|
||||
|
||||
$a->internalRedirect('admin/addons');
|
||||
DI::baseUrl()->redirect('admin/addons');
|
||||
}
|
||||
|
||||
$addons = Addon::getAvailableList();
|
||||
|
|
|
@ -39,7 +39,7 @@ class Contact extends BaseAdminModule
|
|||
notice(L10n::tt('%s contact unblocked', '%s contacts unblocked', count($contacts)));
|
||||
}
|
||||
|
||||
DI::app()->internalRedirect('admin/blocklist/contact');
|
||||
DI::baseUrl()->redirect('admin/blocklist/contact');
|
||||
}
|
||||
|
||||
public static function content(array $parameters = [])
|
||||
|
|
|
@ -48,7 +48,7 @@ class Server extends BaseAdminModule
|
|||
info(L10n::t('Site blocklist updated.') . EOL);
|
||||
}
|
||||
|
||||
DI::app()->internalRedirect('admin/blocklist/server');
|
||||
DI::baseUrl()->redirect('admin/blocklist/server');
|
||||
}
|
||||
|
||||
public static function content(array $parameters = [])
|
||||
|
|
|
@ -32,7 +32,7 @@ class DBSync extends BaseAdminModule
|
|||
}
|
||||
info(L10n::t('Update has been marked successful') . EOL);
|
||||
}
|
||||
$a->internalRedirect('admin/dbsync');
|
||||
DI::baseUrl()->redirect('admin/dbsync');
|
||||
}
|
||||
|
||||
if ($a->argc > 2) {
|
||||
|
|
|
@ -40,7 +40,7 @@ class Features extends BaseAdminModule
|
|||
}
|
||||
}
|
||||
|
||||
DI::app()->internalRedirect('admin/features');
|
||||
DI::baseUrl()->redirect('admin/features');
|
||||
}
|
||||
|
||||
public static function content(array $parameters = [])
|
||||
|
|
|
@ -34,7 +34,7 @@ class Delete extends BaseAdminModule
|
|||
}
|
||||
|
||||
info(L10n::t('Item marked for deletion.') . EOL);
|
||||
DI::app()->internalRedirect('admin/item/delete');
|
||||
DI::baseUrl()->redirect('admin/item/delete');
|
||||
}
|
||||
|
||||
public static function content(array $parameters = [])
|
||||
|
|
|
@ -35,7 +35,7 @@ class Settings extends BaseAdminModule
|
|||
}
|
||||
|
||||
info(L10n::t("Log settings updated."));
|
||||
DI::app()->internalRedirect('admin/logs');
|
||||
DI::baseUrl()->redirect('admin/logs');
|
||||
}
|
||||
|
||||
public static function content(array $parameters = [])
|
||||
|
|
|
@ -48,7 +48,7 @@ class Site extends BaseAdminModule
|
|||
$parsed = @parse_url($new_url);
|
||||
if (!is_array($parsed) || empty($parsed['host']) || empty($parsed['scheme'])) {
|
||||
notice(L10n::t("Can not parse base url. Must have at least <scheme>://<domain>"));
|
||||
$a->internalRedirect('admin/site');
|
||||
DI::baseUrl()->redirect('admin/site');
|
||||
}
|
||||
|
||||
/* steps:
|
||||
|
@ -77,7 +77,7 @@ class Site extends BaseAdminModule
|
|||
$r = DBA::e(sprintf("UPDATE %s SET %s;", $table_name, $upds));
|
||||
if (!DBA::isResult($r)) {
|
||||
notice("Failed updating '$table_name': " . DBA::errorMessage());
|
||||
$a->internalRedirect('admin/site');
|
||||
DI::baseUrl()->redirect('admin/site');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ class Site extends BaseAdminModule
|
|||
|
||||
info("Relocation started. Could take a while to complete.");
|
||||
|
||||
$a->internalRedirect('admin/site');
|
||||
DI::baseUrl()->redirect('admin/site');
|
||||
}
|
||||
// end relocate
|
||||
|
||||
|
@ -229,7 +229,7 @@ class Site extends BaseAdminModule
|
|||
foreach ($storage_form_errors as $name => $err) {
|
||||
notice('Storage backend, ' . $storage_opts[$name][1] . ': ' . $err);
|
||||
}
|
||||
$a->internalRedirect('admin/site' . $active_panel);
|
||||
DI::baseUrl()->redirect('admin/site' . $active_panel);
|
||||
}
|
||||
} else {
|
||||
info(L10n::t('Invalid storage backend setting value.'));
|
||||
|
@ -410,7 +410,7 @@ class Site extends BaseAdminModule
|
|||
|
||||
info(L10n::t('Site settings updated.') . EOL);
|
||||
|
||||
$a->internalRedirect('admin/site' . $active_panel);
|
||||
DI::baseUrl()->redirect('admin/site' . $active_panel);
|
||||
}
|
||||
|
||||
public static function content(array $parameters = [])
|
||||
|
|
|
@ -36,7 +36,7 @@ class Details extends BaseAdminModule
|
|||
return;
|
||||
}
|
||||
|
||||
$a->internalRedirect('admin/themes/' . $theme);
|
||||
DI::baseUrl()->redirect('admin/themes/' . $theme);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ class Details extends BaseAdminModule
|
|||
info(L10n::t('Theme %s failed to install.', $theme));
|
||||
}
|
||||
|
||||
$a->internalRedirect('admin/themes/' . $theme);
|
||||
DI::baseUrl()->redirect('admin/themes/' . $theme);
|
||||
}
|
||||
|
||||
$readme = null;
|
||||
|
@ -122,6 +122,6 @@ class Details extends BaseAdminModule
|
|||
]);
|
||||
}
|
||||
|
||||
$a->internalRedirect('admin/themes');
|
||||
DI::baseUrl()->redirect('admin/themes');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ class Embed extends BaseAdminModule
|
|||
return;
|
||||
}
|
||||
|
||||
$a->internalRedirect('admin/themes/' . $theme . '/embed?mode=minimal');
|
||||
DI::baseUrl()->redirect('admin/themes/' . $theme . '/embed?mode=minimal');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ class Index extends BaseAdminModule
|
|||
|
||||
}
|
||||
|
||||
$a->internalRedirect('admin/themes');
|
||||
DI::baseUrl()->redirect('admin/themes');
|
||||
}
|
||||
|
||||
$themes = [];
|
||||
|
|
|
@ -30,7 +30,7 @@ class Tos extends BaseAdminModule
|
|||
|
||||
info(L10n::t('The Terms of Service settings have been updated.'));
|
||||
|
||||
DI::app()->internalRedirect('admin/tos');
|
||||
DI::baseUrl()->redirect('admin/tos');
|
||||
}
|
||||
|
||||
public static function content(array $parameters = [])
|
||||
|
|
|
@ -129,7 +129,7 @@ class Users extends BaseAdminModule
|
|||
}
|
||||
}
|
||||
|
||||
$a->internalRedirect('admin/users');
|
||||
DI::baseUrl()->redirect('admin/users');
|
||||
}
|
||||
|
||||
public static function content(array $parameters = [])
|
||||
|
@ -145,7 +145,7 @@ class Users extends BaseAdminModule
|
|||
$user = User::getById($uid, ['username', 'blocked']);
|
||||
if (!DBA::isResult($user)) {
|
||||
notice('User not found' . EOL);
|
||||
$a->internalRedirect('admin/users');
|
||||
DI::baseUrl()->redirect('admin/users');
|
||||
return ''; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ class Users extends BaseAdminModule
|
|||
break;
|
||||
}
|
||||
|
||||
$a->internalRedirect('admin/users');
|
||||
DI::baseUrl()->redirect('admin/users');
|
||||
}
|
||||
|
||||
/* get pending */
|
||||
|
|
|
@ -18,7 +18,7 @@ class Apps extends BaseModule
|
|||
{
|
||||
$privateaddons = Config::get('config', 'private_addons');
|
||||
if ($privateaddons === "1" && !local_user()) {
|
||||
DI::app()->internalRedirect();
|
||||
DI::baseUrl()->redirect();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ abstract class BaseAdminModule extends BaseModule
|
|||
if (!is_site_admin()) {
|
||||
notice(L10n::t('Please login to continue.'));
|
||||
Session::set('return_path', $a->query_string);
|
||||
$a->internalRedirect('login');
|
||||
DI::baseUrl()->redirect('login');
|
||||
}
|
||||
|
||||
if (!empty($_SESSION['submanage'])) {
|
||||
|
|
|
@ -22,7 +22,6 @@ use Friendica\Model;
|
|||
use Friendica\Module\Security\Login;
|
||||
use Friendica\Network\HTTPException\BadRequestException;
|
||||
use Friendica\Network\HTTPException\NotFoundException;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Proxy as ProxyUtils;
|
||||
use Friendica\Util\Strings;
|
||||
|
@ -34,7 +33,7 @@ use Friendica\Util\Strings;
|
|||
*/
|
||||
class Contact extends BaseModule
|
||||
{
|
||||
private static function batchActions(App $a)
|
||||
private static function batchActions()
|
||||
{
|
||||
if (empty($_POST['contact_batch']) || !is_array($_POST['contact_batch'])) {
|
||||
return;
|
||||
|
@ -74,7 +73,7 @@ class Contact extends BaseModule
|
|||
info(L10n::tt('%d contact edited.', '%d contacts edited.', $count_actions));
|
||||
}
|
||||
|
||||
$a->internalRedirect('contact');
|
||||
DI::baseUrl()->redirect('contact');
|
||||
}
|
||||
|
||||
public static function post(array $parameters = [])
|
||||
|
@ -87,7 +86,7 @@ class Contact extends BaseModule
|
|||
|
||||
// @TODO: Replace with parameter from router
|
||||
if ($a->argv[1] === 'batch') {
|
||||
self::batchActions($a);
|
||||
self::batchActions();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -99,7 +98,7 @@ class Contact extends BaseModule
|
|||
|
||||
if (!DBA::exists('contact', ['id' => $contact_id, 'uid' => local_user(), 'deleted' => false])) {
|
||||
notice(L10n::t('Could not access contact record.') . EOL);
|
||||
$a->internalRedirect('contact');
|
||||
DI::baseUrl()->redirect('contact');
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -280,9 +279,9 @@ class Contact extends BaseModule
|
|||
if ($contact['self']) {
|
||||
// @TODO: Replace with parameter from router
|
||||
if (($a->argc == 3) && intval($a->argv[1]) && in_array($a->argv[2], ['posts', 'conversations'])) {
|
||||
$a->internalRedirect('profile/' . $contact['nick']);
|
||||
DI::baseUrl()->redirect('profile/' . $contact['nick']);
|
||||
} else {
|
||||
$a->internalRedirect('profile/' . $contact['nick'] . '?tab=profile');
|
||||
DI::baseUrl()->redirect('profile/' . $contact['nick'] . '?tab=profile');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -380,13 +379,13 @@ class Contact extends BaseModule
|
|||
|
||||
if ($cmd === 'update' && ($orig_record['uid'] != 0)) {
|
||||
self::updateContactFromPoll($contact_id);
|
||||
$a->internalRedirect('contact/' . $contact_id);
|
||||
DI::baseUrl()->redirect('contact/' . $contact_id);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
if ($cmd === 'updateprofile' && ($orig_record['uid'] != 0)) {
|
||||
self::updateContactFromProbe($contact_id);
|
||||
$a->internalRedirect('crepair/' . $contact_id);
|
||||
DI::baseUrl()->redirect('crepair/' . $contact_id);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -396,7 +395,7 @@ class Contact extends BaseModule
|
|||
$blocked = Model\Contact::isBlockedByUser($contact_id, local_user());
|
||||
info(($blocked ? L10n::t('Contact has been blocked') : L10n::t('Contact has been unblocked')) . EOL);
|
||||
|
||||
$a->internalRedirect('contact/' . $contact_id);
|
||||
DI::baseUrl()->redirect('contact/' . $contact_id);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -406,7 +405,7 @@ class Contact extends BaseModule
|
|||
$ignored = Model\Contact::isIgnoredByUser($contact_id, local_user());
|
||||
info(($ignored ? L10n::t('Contact has been ignored') : L10n::t('Contact has been unignored')) . EOL);
|
||||
|
||||
$a->internalRedirect('contact/' . $contact_id);
|
||||
DI::baseUrl()->redirect('contact/' . $contact_id);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -417,7 +416,7 @@ class Contact extends BaseModule
|
|||
info((($archived) ? L10n::t('Contact has been archived') : L10n::t('Contact has been unarchived')) . EOL);
|
||||
}
|
||||
|
||||
$a->internalRedirect('contact/' . $contact_id);
|
||||
DI::baseUrl()->redirect('contact/' . $contact_id);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -451,13 +450,13 @@ class Contact extends BaseModule
|
|||
}
|
||||
// Now check how the user responded to the confirmation query
|
||||
if (!empty($_REQUEST['canceled'])) {
|
||||
$a->internalRedirect('contact');
|
||||
DI::baseUrl()->redirect('contact');
|
||||
}
|
||||
|
||||
self::dropContact($orig_record);
|
||||
info(L10n::t('Contact has been removed.') . EOL);
|
||||
|
||||
$a->internalRedirect('contact');
|
||||
DI::baseUrl()->redirect('contact');
|
||||
// NOTREACHED
|
||||
}
|
||||
if ($cmd === 'posts') {
|
||||
|
|
|
@ -19,7 +19,7 @@ class Feed extends BaseModule
|
|||
{
|
||||
if (!local_user()) {
|
||||
info(L10n::t('You must be logged in to use this module'));
|
||||
DI::app()->internalRedirect();
|
||||
DI::baseUrl()->redirect();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ class Delegation extends BaseModule
|
|||
$ret = [];
|
||||
Hook::callAll('home_init', $ret);
|
||||
|
||||
DI::app()->internalRedirect('profile/' . DI::app()->user['nickname']);
|
||||
DI::baseUrl()->redirect('profile/' . DI::app()->user['nickname']);
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,6 @@ class RemoveTag extends BaseModule
|
|||
info('Item was not deleted');
|
||||
}
|
||||
|
||||
$app->internalRedirect('network?file=' . rawurlencode($term));
|
||||
DI::baseUrl()->redirect('network?file=' . rawurlencode($term));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ class SaveTag extends BaseModule
|
|||
{
|
||||
if (!local_user()) {
|
||||
info(L10n::t('You must be logged in to use this module'));
|
||||
DI::app()->internalRedirect();
|
||||
DI::baseUrl()->redirect();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,8 +13,6 @@ class FollowConfirm extends BaseModule
|
|||
{
|
||||
public static function post(array $parameters = [])
|
||||
{
|
||||
$a = DI::app();
|
||||
|
||||
$uid = local_user();
|
||||
if (!$uid) {
|
||||
notice(L10n::t('Permission denied.') . EOL);
|
||||
|
@ -33,6 +31,6 @@ class FollowConfirm extends BaseModule
|
|||
|
||||
$Intro->confirm($duplex, $hidden);
|
||||
|
||||
$a->internalRedirect('contact/' . intval($cid));
|
||||
DI::baseUrl()->redirect('contact/' . intval($cid));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ class Group extends BaseModule
|
|||
|
||||
if (!local_user()) {
|
||||
notice(L10n::t('Permission denied.'));
|
||||
$a->internalRedirect();
|
||||
DI::baseUrl()->redirect();
|
||||
}
|
||||
|
||||
// @TODO: Replace with parameter from router
|
||||
|
@ -43,12 +43,12 @@ class Group extends BaseModule
|
|||
info(L10n::t('Group created.'));
|
||||
$r = Model\Group::getIdByName(local_user(), $name);
|
||||
if ($r) {
|
||||
$a->internalRedirect('group/' . $r);
|
||||
DI::baseUrl()->redirect('group/' . $r);
|
||||
}
|
||||
} else {
|
||||
notice(L10n::t('Could not create group.'));
|
||||
}
|
||||
$a->internalRedirect('group');
|
||||
DI::baseUrl()->redirect('group');
|
||||
}
|
||||
|
||||
// @TODO: Replace with parameter from router
|
||||
|
@ -58,7 +58,7 @@ class Group extends BaseModule
|
|||
$group = DBA::selectFirst('group', ['id', 'name'], ['id' => $a->argv[1], 'uid' => local_user()]);
|
||||
if (!DBA::isResult($group)) {
|
||||
notice(L10n::t('Group not found.'));
|
||||
$a->internalRedirect('contact');
|
||||
DI::baseUrl()->redirect('contact');
|
||||
}
|
||||
$groupname = Strings::escapeTags(trim($_POST['groupname']));
|
||||
if (strlen($groupname) && ($groupname != $group['name'])) {
|
||||
|
@ -142,7 +142,7 @@ class Group extends BaseModule
|
|||
// With no group number provided we jump to the unassigned contacts as a starting point
|
||||
// @TODO: Replace with parameter from router
|
||||
if ($a->argc == 1) {
|
||||
$a->internalRedirect('group/none');
|
||||
DI::baseUrl()->redirect('group/none');
|
||||
}
|
||||
|
||||
// Switch to text mode interface if we have more than 'n' contacts or group members
|
||||
|
@ -200,7 +200,7 @@ class Group extends BaseModule
|
|||
if (intval($a->argv[2])) {
|
||||
if (!Model\Group::exists($a->argv[2], local_user())) {
|
||||
notice(L10n::t('Group not found.'));
|
||||
$a->internalRedirect('contact');
|
||||
DI::baseUrl()->redirect('contact');
|
||||
}
|
||||
|
||||
if (Model\Group::remove($a->argv[2])) {
|
||||
|
@ -209,7 +209,7 @@ class Group extends BaseModule
|
|||
notice(L10n::t('Unable to remove group.'));
|
||||
}
|
||||
}
|
||||
$a->internalRedirect('group');
|
||||
DI::baseUrl()->redirect('group');
|
||||
}
|
||||
|
||||
// @TODO: Replace with parameter from router
|
||||
|
@ -226,7 +226,7 @@ class Group extends BaseModule
|
|||
$group = DBA::selectFirst('group', ['id', 'name'], ['id' => $a->argv[1], 'uid' => local_user(), 'deleted' => false]);
|
||||
if (!DBA::isResult($group)) {
|
||||
notice(L10n::t('Group not found.'));
|
||||
$a->internalRedirect('contact');
|
||||
DI::baseUrl()->redirect('contact');
|
||||
}
|
||||
|
||||
$members = Model\Contact::getByGroupId($group['id']);
|
||||
|
|
|
@ -25,11 +25,11 @@ class Home extends BaseModule
|
|||
Hook::callAll('home_init', $ret);
|
||||
|
||||
if (local_user() && ($app->user['nickname'])) {
|
||||
$app->internalRedirect('network');
|
||||
DI::baseUrl()->redirect('network');
|
||||
}
|
||||
|
||||
if (strlen($config->get('system', 'singleuser'))) {
|
||||
$app->internalRedirect('/profile/' . $config->get('system', 'singleuser'));
|
||||
DI::baseUrl()->redirect('/profile/' . $config->get('system', 'singleuser'));
|
||||
}
|
||||
|
||||
$customHome = '';
|
||||
|
|
|
@ -67,7 +67,7 @@ class Ignore extends BaseModule
|
|||
$rand = "?$rand";
|
||||
}
|
||||
|
||||
DI::app()->internalRedirect($return_path . $rand);
|
||||
DI::baseUrl()->redirect($return_path . $rand);
|
||||
}
|
||||
|
||||
// the json doesn't really matter, it will either be 0 or 1
|
||||
|
|
|
@ -47,7 +47,7 @@ class Like extends BaseModule
|
|||
$rand = "?$rand";
|
||||
}
|
||||
|
||||
$app->internalRedirect($returnPath . $rand);
|
||||
DI::baseUrl()->redirect($returnPath . $rand);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,10 +58,10 @@ class Notify extends BaseModule
|
|||
}
|
||||
}
|
||||
|
||||
$a->internalRedirect();
|
||||
DI::baseUrl()->redirect();
|
||||
}
|
||||
|
||||
// @TODO: Replace with parameter from router
|
||||
$a->internalRedirect('notifications/system');
|
||||
DI::baseUrl()->redirect('notifications/system');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ class Objects extends BaseModule
|
|||
}
|
||||
|
||||
if (!ActivityPub::isRequest()) {
|
||||
$a->internalRedirect(str_replace('objects/', 'display/', $a->query_string));
|
||||
DI::baseUrl()->redirect(str_replace('objects/', 'display/', $a->query_string));
|
||||
}
|
||||
|
||||
/// @todo Add Authentication to enable fetching of non public content
|
||||
|
|
|
@ -31,7 +31,7 @@ class Pinned extends BaseModule
|
|||
$returnPath = $_REQUEST['return'] ?? '';
|
||||
if (!empty($returnPath)) {
|
||||
$rand = '_=' . time() . (strpos($returnPath, '?') ? '&' : '?') . 'rand';
|
||||
DI::app()->internalRedirect($returnPath . $rand);
|
||||
DI::baseUrl()->redirect($returnPath . $rand);
|
||||
}
|
||||
|
||||
// the json doesn't really matter, it will either be 0 or 1
|
||||
|
|
|
@ -23,6 +23,6 @@ class RandomProfile extends BaseModule
|
|||
$a->redirect($link);
|
||||
}
|
||||
|
||||
$a->internalRedirect('profile');
|
||||
DI::baseUrl()->redirect('profile');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -238,7 +238,7 @@ class Register extends BaseModule
|
|||
|
||||
if ($res) {
|
||||
\info(L10n::t('Registration successful. Please check your email for further instructions.') . EOL);
|
||||
$a->internalRedirect();
|
||||
DI::baseUrl()->redirect();
|
||||
} else {
|
||||
\notice(
|
||||
L10n::t('Failed to send email message. Here your accout details:<br> login: %s<br> password: %s<br><br>You can change your password after login.',
|
||||
|
@ -248,12 +248,12 @@ class Register extends BaseModule
|
|||
}
|
||||
} else {
|
||||
\info(L10n::t('Registration successful.') . EOL);
|
||||
$a->internalRedirect();
|
||||
DI::baseUrl()->redirect();
|
||||
}
|
||||
} elseif (intval(Config::get('config', 'register_policy')) === self::APPROVE) {
|
||||
if (!strlen(Config::get('config', 'admin_email'))) {
|
||||
\notice(L10n::t('Your registration can not be processed.') . EOL);
|
||||
$a->internalRedirect();
|
||||
DI::baseUrl()->redirect();
|
||||
}
|
||||
|
||||
// Check if the note to the admin is actually filled out
|
||||
|
@ -261,12 +261,12 @@ class Register extends BaseModule
|
|||
\notice(L10n::t('You have to leave a request note for the admin.')
|
||||
. L10n::t('Your registration can not be processed.') . EOL);
|
||||
|
||||
$a->internalRedirect('register/');
|
||||
DI::baseUrl()->redirect('register/');
|
||||
}
|
||||
// Is there text in the tar pit?
|
||||
if (!empty($_POST['registertarpit'])) {
|
||||
\notice(L10n::t('You have entered too much information.'));
|
||||
$a->internalRedirect('register/');
|
||||
DI::baseUrl()->redirect('register/');
|
||||
}
|
||||
|
||||
Model\Register::createForApproval($user['uid'], Config::get('system', 'language'), $_POST['permonlybox']);
|
||||
|
@ -312,7 +312,7 @@ class Register extends BaseModule
|
|||
);
|
||||
|
||||
\info(L10n::t('Your registration is pending approval by the site owner.') . EOL);
|
||||
$a->internalRedirect();
|
||||
DI::baseUrl()->redirect();
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
|
@ -36,6 +36,6 @@ class Saved extends BaseModule
|
|||
}
|
||||
}
|
||||
|
||||
DI::app()->internalRedirect($return_url);
|
||||
DI::baseUrl()->redirect($return_url);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,10 +25,8 @@ class Login extends BaseModule
|
|||
{
|
||||
public static function content(array $parameters = [])
|
||||
{
|
||||
$a = DI::app();
|
||||
|
||||
if (local_user()) {
|
||||
$a->internalRedirect();
|
||||
DI::baseUrl()->redirect();
|
||||
}
|
||||
|
||||
return self::form(Session::get('return_path'), intval(Config::get('config', 'register_policy')) !== \Friendica\Module\Register::CLOSED);
|
||||
|
|
|
@ -40,7 +40,7 @@ class Logout extends BaseModule
|
|||
System::externalRedirect($visitor_home);
|
||||
} else {
|
||||
info(L10n::t('Logged out.'));
|
||||
DI::app()->internalRedirect();
|
||||
DI::baseUrl()->redirect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,12 +52,12 @@ class Recovery extends BaseModule
|
|||
public static function content(array $parameters = [])
|
||||
{
|
||||
if (!local_user()) {
|
||||
DI::app()->internalRedirect();
|
||||
DI::baseUrl()->redirect();
|
||||
}
|
||||
|
||||
// Already authenticated with 2FA token
|
||||
if (Session::get('2fa')) {
|
||||
DI::app()->internalRedirect();
|
||||
DI::baseUrl()->redirect();
|
||||
}
|
||||
|
||||
return Renderer::replaceMacros(Renderer::getMarkupTemplate('twofactor/recovery.tpl'), [
|
||||
|
|
|
@ -50,12 +50,12 @@ class Verify extends BaseModule
|
|||
public static function content(array $parameters = [])
|
||||
{
|
||||
if (!local_user()) {
|
||||
DI::app()->internalRedirect();
|
||||
DI::baseUrl()->redirect();
|
||||
}
|
||||
|
||||
// Already authenticated with 2FA token
|
||||
if (Session::get('2fa')) {
|
||||
DI::app()->internalRedirect();
|
||||
DI::baseUrl()->redirect();
|
||||
}
|
||||
|
||||
return Renderer::replaceMacros(Renderer::getMarkupTemplate('twofactor/verify.tpl'), [
|
||||
|
|
|
@ -64,7 +64,7 @@ class Delegation extends BaseSettingsModule
|
|||
if ($action === 'add' && $user_id) {
|
||||
if (Session::get('submanage')) {
|
||||
notice(L10n::t('Delegated administrators can view but not change delegation permissions.'));
|
||||
DI::app()->internalRedirect('settings/delegation');
|
||||
DI::baseUrl()->redirect('settings/delegation');
|
||||
}
|
||||
|
||||
$user = User::getById($user_id, ['nickname']);
|
||||
|
@ -80,17 +80,17 @@ class Delegation extends BaseSettingsModule
|
|||
notice(L10n::t('Delegate user not found.'));
|
||||
}
|
||||
|
||||
DI::app()->internalRedirect('settings/delegation');
|
||||
DI::baseUrl()->redirect('settings/delegation');
|
||||
}
|
||||
|
||||
if ($action === 'remove' && $user_id) {
|
||||
if (Session::get('submanage')) {
|
||||
notice(L10n::t('Delegated administrators can view but not change delegation permissions.'));
|
||||
DI::app()->internalRedirect('settings/delegation');
|
||||
DI::baseUrl()->redirect('settings/delegation');
|
||||
}
|
||||
|
||||
DBA::delete('manage', ['uid' => $user_id, 'mid' => local_user()]);
|
||||
DI::app()->internalRedirect('settings/delegation');
|
||||
DI::baseUrl()->redirect('settings/delegation');
|
||||
}
|
||||
|
||||
// find everybody that currently has delegated management to this account/page
|
||||
|
|
|
@ -30,12 +30,12 @@ class AppSpecific extends BaseSettingsModule
|
|||
$verified = PConfig::get(local_user(), '2fa', 'verified');
|
||||
|
||||
if (!$verified) {
|
||||
DI::app()->internalRedirect('settings/2fa');
|
||||
DI::baseUrl()->redirect('settings/2fa');
|
||||
}
|
||||
|
||||
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
|
||||
notice(L10n::t('Please enter your password to access this page.'));
|
||||
DI::app()->internalRedirect('settings/2fa');
|
||||
DI::baseUrl()->redirect('settings/2fa');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,10 +53,10 @@ class AppSpecific extends BaseSettingsModule
|
|||
$description = $_POST['description'] ?? '';
|
||||
if (empty($description)) {
|
||||
notice(L10n::t('App-specific password generation failed: The description is empty.'));
|
||||
DI::app()->internalRedirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
DI::baseUrl()->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
} elseif (AppSpecificPassword::checkDuplicateForUser(local_user(), $description)) {
|
||||
notice(L10n::t('App-specific password generation failed: This description already exists.'));
|
||||
DI::app()->internalRedirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
DI::baseUrl()->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
} else {
|
||||
self::$appSpecificPassword = AppSpecificPassword::generateForUser(local_user(), $_POST['description'] ?? '');
|
||||
notice(L10n::t('New app-specific password generated.'));
|
||||
|
@ -66,7 +66,7 @@ class AppSpecific extends BaseSettingsModule
|
|||
case 'revoke_all' :
|
||||
AppSpecificPassword::deleteAllForUser(local_user());
|
||||
notice(L10n::t('App-specific passwords successfully revoked.'));
|
||||
DI::app()->internalRedirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
DI::baseUrl()->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ class AppSpecific extends BaseSettingsModule
|
|||
notice(L10n::t('App-specific password successfully revoked.'));
|
||||
}
|
||||
|
||||
DI::app()->internalRedirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
DI::baseUrl()->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ class Index extends BaseSettingsModule
|
|||
|
||||
PConfig::set(local_user(), '2fa', 'secret', $Google2FA->generateSecretKey(32));
|
||||
|
||||
DI::app()->internalRedirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
DI::baseUrl()->redirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
}
|
||||
break;
|
||||
case 'disable':
|
||||
|
@ -50,22 +50,22 @@ class Index extends BaseSettingsModule
|
|||
Session::remove('2fa');
|
||||
|
||||
notice(L10n::t('Two-factor authentication successfully disabled.'));
|
||||
DI::app()->internalRedirect('settings/2fa');
|
||||
DI::baseUrl()->redirect('settings/2fa');
|
||||
}
|
||||
break;
|
||||
case 'recovery':
|
||||
if ($has_secret) {
|
||||
DI::app()->internalRedirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
DI::baseUrl()->redirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
}
|
||||
break;
|
||||
case 'app_specific':
|
||||
if ($has_secret) {
|
||||
DI::app()->internalRedirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
DI::baseUrl()->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
}
|
||||
break;
|
||||
case 'configure':
|
||||
if (!$verified) {
|
||||
DI::app()->internalRedirect('settings/2fa/verify?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
DI::baseUrl()->redirect('settings/2fa/verify?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -28,12 +28,12 @@ class Recovery extends BaseSettingsModule
|
|||
$secret = PConfig::get(local_user(), '2fa', 'secret');
|
||||
|
||||
if (!$secret) {
|
||||
DI::app()->internalRedirect('settings/2fa');
|
||||
DI::baseUrl()->redirect('settings/2fa');
|
||||
}
|
||||
|
||||
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
|
||||
notice(L10n::t('Please enter your password to access this page.'));
|
||||
DI::app()->internalRedirect('settings/2fa');
|
||||
DI::baseUrl()->redirect('settings/2fa');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ class Recovery extends BaseSettingsModule
|
|||
if ($_POST['action'] == 'regenerate') {
|
||||
RecoveryCode::regenerateForUser(local_user());
|
||||
notice(L10n::t('New recovery codes successfully generated.'));
|
||||
DI::app()->internalRedirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
DI::baseUrl()->redirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,12 +35,12 @@ class Verify extends BaseSettingsModule
|
|||
$verified = PConfig::get(local_user(), '2fa', 'verified');
|
||||
|
||||
if ($secret && $verified) {
|
||||
DI::app()->internalRedirect('settings/2fa');
|
||||
DI::baseUrl()->redirect('settings/2fa');
|
||||
}
|
||||
|
||||
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
|
||||
notice(L10n::t('Please enter your password to access this page.'));
|
||||
DI::app()->internalRedirect('settings/2fa');
|
||||
DI::baseUrl()->redirect('settings/2fa');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ class Verify extends BaseSettingsModule
|
|||
|
||||
notice(L10n::t('Two-factor authentication successfully activated.'));
|
||||
|
||||
DI::app()->internalRedirect('settings/2fa');
|
||||
DI::baseUrl()->redirect('settings/2fa');
|
||||
} else {
|
||||
notice(L10n::t('Invalid code, please retry.'));
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ class Starred extends BaseModule
|
|||
$returnPath = $_REQUEST['return'] ?? '';
|
||||
if (!empty($returnPath)) {
|
||||
$rand = '_=' . time() . (strpos($returnPath, '?') ? '&' : '?') . 'rand';
|
||||
DI::app()->internalRedirect($returnPath . $rand);
|
||||
DI::baseUrl()->redirect($returnPath . $rand);
|
||||
}
|
||||
|
||||
// the json doesn't really matter, it will either be 0 or 1
|
||||
|
|
|
@ -51,7 +51,7 @@ class Tos extends BaseModule
|
|||
public static function init(array $parameters = [])
|
||||
{
|
||||
if (strlen(Config::get('system','singleuser'))) {
|
||||
DI::app()->internalRedirect('profile/' . Config::get('system','singleuser'));
|
||||
DI::baseUrl()->redirect('profile/' . Config::get('system','singleuser'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue