Browse Source

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

pull/8019/head
nupplaPhil 2 years ago
parent
commit
8e6973b774
No known key found for this signature in database GPG Key ID: D8365C3D36B77D90
  1. 17
      include/items.php
  2. 3
      mod/api.php
  3. 7
      mod/cal.php
  4. 5
      mod/dfrn_confirm.php
  5. 18
      mod/dfrn_poll.php
  6. 15
      mod/dfrn_request.php
  7. 11
      mod/events.php
  8. 15
      mod/follow.php
  9. 16
      mod/item.php
  10. 7
      mod/lostpass.php
  11. 13
      mod/message.php
  12. 6
      mod/network.php
  13. 7
      mod/notifications.php
  14. 3
      mod/ostatus_subscribe.php
  15. 24
      mod/photos.php
  16. 7
      mod/profile_photo.php
  17. 15
      mod/profiles.php
  18. 5
      mod/redir.php
  19. 5
      mod/regmod.php
  20. 5
      mod/removeme.php
  21. 3
      mod/repair_ostatus.php
  22. 12
      mod/settings.php
  23. 3
      mod/suggest.php
  24. 17
      mod/tagrm.php
  25. 2
      mod/uimport.php
  26. 19
      mod/unfollow.php
  27. 7
      mod/videos.php
  28. 3
      mod/wallmessage.php
  29. 31
      src/App.php
  30. 2
      src/App/Authentication.php
  31. 6
      src/App/Module.php
  32. 2
      src/BaseModule.php
  33. 6
      src/Core/UserImport.php
  34. 2
      src/Model/Contact.php
  35. 10
      src/Module/Admin/Addons/Details.php
  36. 2
      src/Module/Admin/Addons/Index.php
  37. 2
      src/Module/Admin/Blocklist/Contact.php
  38. 2
      src/Module/Admin/Blocklist/Server.php
  39. 2
      src/Module/Admin/DBSync.php
  40. 2
      src/Module/Admin/Features.php
  41. 2
      src/Module/Admin/Item/Delete.php
  42. 2
      src/Module/Admin/Logs/Settings.php
  43. 10
      src/Module/Admin/Site.php
  44. 6
      src/Module/Admin/Themes/Details.php
  45. 2
      src/Module/Admin/Themes/Embed.php
  46. 2
      src/Module/Admin/Themes/Index.php
  47. 2
      src/Module/Admin/Tos.php
  48. 6
      src/Module/Admin/Users.php
  49. 2
      src/Module/Apps.php
  50. 2
      src/Module/BaseAdminModule.php
  51. 27
      src/Module/Contact.php
  52. 2
      src/Module/Debug/Feed.php
  53. 2
      src/Module/Delegation.php
  54. 2
      src/Module/Filer/RemoveTag.php
  55. 2
      src/Module/Filer/SaveTag.php
  56. 4
      src/Module/FollowConfirm.php
  57. 16
      src/Module/Group.php
  58. 4
      src/Module/Home.php
  59. 2
      src/Module/Item/Ignore.php
  60. 2
      src/Module/Like.php
  61. 4
      src/Module/Notifications/Notify.php
  62. 2
      src/Module/Objects.php
  63. 2
      src/Module/Pinned.php
  64. 2
      src/Module/RandomProfile.php
  65. 12
      src/Module/Register.php
  66. 2
      src/Module/Search/Saved.php
  67. 4
      src/Module/Security/Login.php
  68. 2
      src/Module/Security/Logout.php
  69. 4
      src/Module/Security/TwoFactor/Recovery.php
  70. 4
      src/Module/Security/TwoFactor/Verify.php
  71. 8
      src/Module/Settings/Delegation.php
  72. 12
      src/Module/Settings/TwoFactor/AppSpecific.php
  73. 10
      src/Module/Settings/TwoFactor/Index.php
  74. 6
      src/Module/Settings/TwoFactor/Recovery.php
  75. 6
      src/Module/Settings/TwoFactor/Verify.php
  76. 2
      src/Module/Starred.php
  77. 2
      src/Module/Tos.php

17
include/items.php

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

3
mod/api.php

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

7
mod/cal.php

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

5
mod/dfrn_confirm.php

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

18
mod/dfrn_poll.php

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

15
mod/dfrn_request.php

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

11
mod/events.php

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

15
mod/follow.php

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

16
mod/item.php

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

7
mod/lostpass.php

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

13
mod/message.php

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

6
mod/network.php

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

7
mod/notifications.php

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

3
mod/ostatus_subscribe.php

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

24
mod/photos.php

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

7
mod/profile_photo.php

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

15
mod/profiles.php

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

5
mod/redir.php

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

5
mod/regmod.php

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

5
mod/removeme.php

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

3
mod/repair_ostatus.php

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

12
mod/settings.php

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

3
mod/suggest.php

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

17
mod/tagrm.php

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

2
mod/uimport.php

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

19
mod/unfollow.php

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

7
mod/videos.php

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

3
mod/wallmessage.php

@ -8,6 +8,7 @@ use Friendica\Core\Logger;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Mail;
use Friendica\Model\Profile;
use Friendica\Util\Strings;