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;
function drop_item($id, $return = '')
{
- $a = Friendica\DI::app();
+ $a = DI::app();
// locate item to be deleted
if (!DBA::isResult($item)) {
notice(L10n::t('Item not found.') . EOL);
- $a->internalRedirect('network');
+ DI::baseUrl()->redirect('network');
}
if ($item['deleted']) {
}
// 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;
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
}
}
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';
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();
}
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;
// 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
$return_path = "cal/" . $nick;
}
- $a->internalRedirect($return_path);
+ DI::baseUrl()->redirect($return_path);
}
// If nothing went wrong we can echo the export content
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;
// 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;
}
}
// somebody arrived here by mistake or they are fishing. Send them to the homepage.
- $a->internalRedirect();
+ DI::baseUrl()->redirect();
// NOTREACHED
}
$my_id = '0:' . $dfrn_id;
break;
default:
- $a->internalRedirect();
+ DI::baseUrl()->redirect();
break; // NOTREACHED
}
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) {
$sql_extra = sprintf(" AND `dfrn-id` = '%s' AND `duplex` = 1 ", DBA::escape($dfrn_id));
break;
default:
- $a->internalRedirect();
+ DI::baseUrl()->redirect();
break; // NOTREACHED
}
$my_id = '0:' . $dfrn_id;
break;
default:
- $a->internalRedirect();
+ DI::baseUrl()->redirect();
break; // NOTREACHED
}
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
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;
}
if (!empty($_POST['cancel'])) {
- $a->internalRedirect();
+ DI::baseUrl()->redirect();
}
/*
}
// (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
}
$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
}
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);
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;
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)) {
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);
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'] ?? '');
Worker::add(PRIORITY_HIGH, "Notifier", Delivery::POST, $item_id);
}
- $a->internalRedirect('events');
+ DI::baseUrl()->redirect('events');
}
function events_content(App $a)
info(L10n::t('Event removed') . EOL);
}
- $a->internalRedirect('events');
+ DI::baseUrl()->redirect('events');
}
}
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;
}
if (isset($_REQUEST['cancel'])) {
- $a->internalRedirect('contact');
+ DI::baseUrl()->redirect('contact');
}
$uid = local_user();
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
}
if (!local_user()) {
notice(L10n::t('Permission denied.'));
- $a->internalRedirect($return_path);
+ DI::baseUrl()->redirect($return_path);
// NOTREACHED
}
}
if (!$url) {
- $a->internalRedirect($return_path);
+ DI::baseUrl()->redirect($return_path);
}
$submit = L10n::t('Submit Request');
if (!$r) {
notice(L10n::t('Permission denied.'));
- $a->internalRedirect($return_path);
+ DI::baseUrl()->redirect($return_path);
// NOTREACHED
}
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();
}
notice(L10n::t('Permission denied.') . EOL);
if (!empty($_REQUEST['return'])) {
- $a->internalRedirect($return_path);
+ DI::baseUrl()->redirect($return_path);
}
exit();
}
info(L10n::t('Empty post discarded.') . EOL);
if (!empty($_REQUEST['return'])) {
- $a->internalRedirect($return_path);
+ DI::baseUrl()->redirect($return_path);
}
exit();
}
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];
if (!empty($_REQUEST['return']) && strlen($return_path)) {
Logger::log('return: ' . $return_path);
- $a->internalRedirect($return_path);
+ DI::baseUrl()->redirect($return_path);
}
exit();
}
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
}
if ($return_path) {
- $a->internalRedirect($return_path);
+ DI::baseUrl()->redirect($return_path);
}
$json = ['success' => 1];
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;
{
$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);
'body' => $body
]);
- $a->internalRedirect();
+ DI::baseUrl()->redirect();
}
function lostpass_content(App $a)
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;
$a->argc = 2;
$a->argv[1] = 'new';
} else {
- $a->internalRedirect($a->cmd . '/' . $ret);
+ DI::baseUrl()->redirect($a->cmd . '/' . $ret);
}
}
// 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];
$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()])) {
$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]),
info(L10n::t('Conversation removed.') . EOL);
}
}
- $a->internalRedirect('message');
+ DI::baseUrl()->redirect('message');
}
}
$redir_url = ($net_queries ? $net_baseurl . '?' . $net_queries : $net_baseurl);
- $a->internalRedirect($redir_url);
+ DI::baseUrl()->redirect($redir_url);
}
}
exit();
}
notice(L10n::t('No such group') . EOL);
- $a->internalRedirect('network/0');
+ DI::baseUrl()->redirect('network/0');
// NOTREACHED
}
}
} else {
notice(L10n::t('Invalid contact.') . EOL);
- $a->internalRedirect('network');
+ DI::baseUrl()->redirect('network');
// NOTREACHED
}
}
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);
break;
}
- $a->internalRedirect('notifications/intros');
+ DI::baseUrl()->redirect('notifications/intros');
}
}
$notifs = $nm->getHomeList($show, $startrec, $perpage);
// fallback - redirect to main page
} else {
- $a->internalRedirect('notifications');
+ DI::baseUrl()->redirect('notifications');
}
// Set the pager
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;
{
if (!local_user()) {
notice(L10n::t('Permission denied.') . EOL);
- $a->internalRedirect('ostatus_subscribe');
+ DI::baseUrl()->redirect('ostatus_subscribe');
// NOTREACHED
}
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
}
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
// 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
}
}
}
- $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'])) {
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
}
}
}
}
}
- $a->internalRedirect($_SESSION['photo_return']);
+ DI::baseUrl()->redirect($_SESSION['photo_return']);
return; // NOTREACHED
}
// 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
}
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);
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;
}
}
- $a->internalRedirect($path);
+ DI::baseUrl()->redirect($path);
return; // NOTREACHED
}
@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)
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]);
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;
);
if (! DBA::isResult($r)) {
notice(L10n::t('Profile not found.') . EOL);
- $a->internalRedirect('profiles');
+ DI::baseUrl()->redirect('profiles');
return; // NOTREACHED
}
info(L10n::t('Profile deleted.').EOL);
}
- $a->internalRedirect('profiles');
+ DI::baseUrl()->redirect('profiles');
return; // NOTREACHED
}
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')) {
);
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
}
);
if (DBA::isResult($r)) {
//Go to the default profile.
- $a->internalRedirect('profiles/' . $r[0]['id']);
+ DI::baseUrl()->redirect('profiles/' . $r[0]['id']);
}
}
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;
$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'];
}
notice(L10n::t('Contact not found.'));
- $a->internalRedirect();
+ DI::baseUrl()->redirect();
}
function redir_magic($a, $cid, $url)
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;
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/');
}
}
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Model\User;
use Friendica\Util\Strings;
unset($_SESSION['authenticated']);
unset($_SESSION['uid']);
- $a->internalRedirect();
+ DI::baseUrl()->redirect();
// NOTREACHED
}
}
function removeme_content(App $a)
{
if (!local_user()) {
- $a->internalRedirect();
+ DI::baseUrl()->redirect();
}
$hash = Strings::getRandomHex();
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
}
$key = $_POST['remove'];
DBA::delete('tokens', ['id' => $key, 'uid' => local_user()]);
- $a->internalRedirect('settings/oauth/', true);
+ DI::baseUrl()->redirect('settings/oauth/', true);
return;
}
);
}
}
- $a->internalRedirect('settings/oauth/', true);
+ DI::baseUrl()->redirect('settings/oauth/', true);
return;
}
}
Hook::callAll('display_settings_post', $_POST);
- $a->internalRedirect('settings/display');
+ DI::baseUrl()->redirect('settings/display');
return; // NOTREACHED
}
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);
// Update the global contact for the user
GContact::updateForUser(local_user());
- $a->internalRedirect('settings');
+ DI::baseUrl()->redirect('settings');
return; // NOTREACHED
}
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;
}
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;
notice(L10n::t('Contact suggestion successfully ignored.'));
}
- $a->internalRedirect('suggest');
+ DI::baseUrl()->redirect('suggest');
}
function suggest_content(App $a)
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;
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 = [];
update_tags($item_id, $tags);
info(L10n::t('Tag(s) removed') . EOL);
- $a->internalRedirect($_SESSION['photo_return']);
+ DI::baseUrl()->redirect($_SESSION['photo_return']);
// NOTREACHED
}
$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>';
}
if (!empty($_FILES['accountfile'])) {
- UserImport::importAccount($a, $_FILES['accountfile']);
+ UserImport::importAccount($_FILES['accountfile']);
return;
}
}
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;
if (!local_user()) {
notice(L10n::t('Permission denied.'));
- $a->internalRedirect('login');
+ DI::baseUrl()->redirect('login');
// NOTREACHED
}
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
}
}
info(L10n::t('Contact unfollowed'));
- $a->internalRedirect($return_path);
+ DI::baseUrl()->redirect($return_path);
// NOTREACHED
}
if (!local_user()) {
notice(L10n::t('Permission denied.'));
- $a->internalRedirect('login');
+ DI::baseUrl()->redirect('login');
// NOTREACHED
}
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
}
if (!DBA::isResult($self)) {
notice(L10n::t('Permission denied.'));
- $a->internalRedirect($base_return_path);
+ DI::baseUrl()->redirect($base_return_path);
// NOTREACHED
}
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;
$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'])) {
], 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)
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;
info(L10n::t('Message sent.') . EOL);
}
- $a->internalRedirect('profile/'.$user['nickname']);
+ DI::baseUrl()->redirect('profile/'.$user['nickname']);
}
// in install mode, any url loads install module
// but we need "view" module for stylesheet
if ($this->mode->isInstall() && $moduleName !== 'install') {
- $this->internalRedirect('install');
+ $this->baseURL->redirect('install');
} elseif (!$this->mode->isInstall() && !$this->mode->has(App\Mode::MAINTENANCEDISABLED) && $moduleName !== 'maintenance') {
- $this->internalRedirect('maintenance');
+ $this->baseURL->redirect('maintenance');
} else {
$this->checkURL();
Core\Update::check($this->getBasePath(), false, $this->mode);
// Compatibility with the Android Diaspora client
if ($moduleName == 'stream') {
- $this->internalRedirect('network?order=post');
+ $this->baseURL->redirect('network?order=post');
}
if ($moduleName == 'conversations') {
- $this->internalRedirect('message');
+ $this->baseURL->redirect('message');
}
if ($moduleName == 'commented') {
- $this->internalRedirect('network?order=comment');
+ $this->baseURL->redirect('network?order=comment');
}
if ($moduleName == 'liked') {
- $this->internalRedirect('network?order=comment');
+ $this->baseURL->redirect('network?order=comment');
}
if ($moduleName == 'activity') {
- $this->internalRedirect('network?conv=1');
+ $this->baseURL->redirect('network?conv=1');
}
if (($moduleName == 'status_messages') && ($this->args->getCommand() == 'status_messages/new')) {
- $this->internalRedirect('bookmarklet');
+ $this->baseURL->redirect('bookmarklet');
}
if (($moduleName == 'user') && ($this->args->getCommand() == 'user/edit')) {
- $this->internalRedirect('settings');
+ $this->baseURL->redirect('settings');
}
if (($moduleName == 'tag_followings') && ($this->args->getCommand() == 'tag_followings/manage')) {
- $this->internalRedirect('search');
+ $this->baseURL->redirect('search');
}
// Initialize module that can set the current theme in the init() method, either directly or via App->profile_uid
$module = $module->determineClass($this->args, $router, $this->config);
// Let the module run it's internal process (init, get, post, ...)
- $module->run($this->l10n, $this, $this->logger, $_SERVER, $_POST);
+ $module->run($this->l10n, $this->baseURL, $this->logger, $_SERVER, $_POST);
} catch (HTTPException $e) {
ModuleHTTPException::rawContent($e);
}
$this->page->run($this, $this->baseURL, $this->mode, $module, $this->l10n, $this->config, $pconfig);
}
- /**
- * @deprecated 2019.12 use BaseUrl::redirect instead
- * @see BaseURL::redirect()
- */
- public function internalRedirect($toUrl = '', $ssl = false)
- {
- $this->baseURL->redirect($toUrl, $ssl);
- }
-
/**
* Automatically redirects to relative or absolute URL
* Should only be used if it isn't clear if the URL is either internal or external
if ($a->isAjax()) {
throw new HTTPException\ForbiddenException();
} else {
- $a->internalRedirect('2fa');
+ $this->baseUrl->redirect('2fa');
}
}
}
* Run the determined module class and calls all hooks applied to
*
* @param Core\L10n\L10n $l10n The L10n instance
- * @param App $app The whole Friendica app (for method arguments)
+ * @param App\BaseURL $baseUrl The Friendica Base URL
* @param LoggerInterface $logger The Friendica logger
* @param array $server The $_SERVER variable
* @param array $post The $_POST variables
*
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public function run(Core\L10n\L10n $l10n, App $app, LoggerInterface $logger, array $server, array $post)
+ public function run(Core\L10n\L10n $l10n, App\BaseURL $baseUrl, LoggerInterface $logger, array $server, array $post)
{
if ($this->printNotAllowedAddon) {
info($l10n->t("You must be logged in to use addons. "));
if (!empty($queryString) && ($queryString === 'q=internal_error.html') && isset($dreamhost_error_hack)) {
$logger->info('index.php: dreamhost_error_hack invoked.', ['Original URI' => $server['REQUEST_URI']]);
- $app->internalRedirect($server['REQUEST_URI']);
+ $baseUrl->redirect($server['REQUEST_URI']);
}
$logger->debug('index.php: page not found.', ['request_uri' => $server['REQUEST_URI'], 'address' => $server['REMOTE_ADDR'], 'query' => $server['QUERY_STRING']]);
Logger::log('checkFormSecurityToken failed: user ' . $a->user['guid'] . ' - form element ' . $typename);
Logger::log('checkFormSecurityToken failed: _REQUEST data: ' . print_r($_REQUEST, true), Logger::DATA);
notice(self::getFormSecurityStandardErrorMessage());
- $a->internalRedirect($err_redirect);
+ DI::baseUrl()->redirect($err_redirect);
}
}
use Friendica\App;
use Friendica\Database\DBA;
use Friendica\Database\DBStructure;
+use Friendica\DI;
use Friendica\Model\Photo;
use Friendica\Object\Image;
use Friendica\Util\Strings;
/**
* @brief Import account file exported from mod/uexport
*
- * @param App $a Friendica App Class
* @param array $file array from $_FILES
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
- public static function importAccount(App $a, $file)
+ public static function importAccount($file)
{
Logger::log("Start user import from " . $file['tmp_name']);
/*
Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, $newuid);
info(L10n::t("Done. You can now login with your username and password"));
- $a->internalRedirect('login');
+ DI::baseUrl()->redirect('login');
}
}
$myaddr = bin2hex($a->user['nickname'] . '@' . $a->getHostName());
}
- $a->internalRedirect($ret['request'] . "&addr=$myaddr");
+ DI::baseUrl()->redirect($ret['request'] . "&addr=$myaddr");
// NOTREACHED
}
$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 = [])
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') {
Addon::saveEnabledList();
- $a->internalRedirect('admin/addons/' . $addon);
+ DI::baseUrl()->redirect('admin/addons/' . $addon);
}
// display addon details
]);
}
- $a->internalRedirect('admin/addons');
+ DI::baseUrl()->redirect('admin/addons');
}
}
}
- $a->internalRedirect('admin/addons');
+ DI::baseUrl()->redirect('admin/addons');
}
$addons = Addon::getAvailableList();
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 = [])
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 = [])
}
info(L10n::t('Update has been marked successful') . EOL);
}
- $a->internalRedirect('admin/dbsync');
+ DI::baseUrl()->redirect('admin/dbsync');
}
if ($a->argc > 2) {
}
}
- DI::app()->internalRedirect('admin/features');
+ DI::baseUrl()->redirect('admin/features');
}
public static function content(array $parameters = [])
}
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 = [])
}
info(L10n::t("Log settings updated."));
- DI::app()->internalRedirect('admin/logs');
+ DI::baseUrl()->redirect('admin/logs');
}
public static function content(array $parameters = [])
$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:
$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');
}
}
info("Relocation started. Could take a while to complete.");
- $a->internalRedirect('admin/site');
+ DI::baseUrl()->redirect('admin/site');
}
// end relocate
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.'));
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 = [])
return;
}
- $a->internalRedirect('admin/themes/' . $theme);
+ DI::baseUrl()->redirect('admin/themes/' . $theme);
}
}
info(L10n::t('Theme %s failed to install.', $theme));
}
- $a->internalRedirect('admin/themes/' . $theme);
+ DI::baseUrl()->redirect('admin/themes/' . $theme);
}
$readme = null;
]);
}
- $a->internalRedirect('admin/themes');
+ DI::baseUrl()->redirect('admin/themes');
}
}
return;
}
- $a->internalRedirect('admin/themes/' . $theme . '/embed?mode=minimal');
+ DI::baseUrl()->redirect('admin/themes/' . $theme . '/embed?mode=minimal');
}
}
}
- $a->internalRedirect('admin/themes');
+ DI::baseUrl()->redirect('admin/themes');
}
$themes = [];
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 = [])
}
}
- $a->internalRedirect('admin/users');
+ DI::baseUrl()->redirect('admin/users');
}
public static function content(array $parameters = [])
$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
}
break;
}
- $a->internalRedirect('admin/users');
+ DI::baseUrl()->redirect('admin/users');
}
/* get pending */
{
$privateaddons = Config::get('config', 'private_addons');
if ($privateaddons === "1" && !local_user()) {
- DI::app()->internalRedirect();
+ DI::baseUrl()->redirect();
}
}
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'])) {
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;
*/
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;
info(L10n::tt('%d contact edited.', '%d contacts edited.', $count_actions));
}
- $a->internalRedirect('contact');
+ DI::baseUrl()->redirect('contact');
}
public static function post(array $parameters = [])
// @TODO: Replace with parameter from router
if ($a->argv[1] === 'batch') {
- self::batchActions($a);
+ self::batchActions();
return;
}
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
}
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');
}
}
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
}
$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
}
$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
}
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
}
}
// 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') {
{
if (!local_user()) {
info(L10n::t('You must be logged in to use this module'));
- DI::app()->internalRedirect();
+ DI::baseUrl()->redirect();
}
}
$ret = [];
Hook::callAll('home_init', $ret);
- DI::app()->internalRedirect('profile/' . DI::app()->user['nickname']);
+ DI::baseUrl()->redirect('profile/' . DI::app()->user['nickname']);
// NOTREACHED
}
info('Item was not deleted');
}
- $app->internalRedirect('network?file=' . rawurlencode($term));
+ DI::baseUrl()->redirect('network?file=' . rawurlencode($term));
}
}
{
if (!local_user()) {
info(L10n::t('You must be logged in to use this module'));
- DI::app()->internalRedirect();
+ DI::baseUrl()->redirect();
}
}
{
public static function post(array $parameters = [])
{
- $a = DI::app();
-
$uid = local_user();
if (!$uid) {
notice(L10n::t('Permission denied.') . EOL);
$Intro->confirm($duplex, $hidden);
- $a->internalRedirect('contact/' . intval($cid));
+ DI::baseUrl()->redirect('contact/' . intval($cid));
}
}
if (!local_user()) {
notice(L10n::t('Permission denied.'));
- $a->internalRedirect();
+ DI::baseUrl()->redirect();
}
// @TODO: Replace with parameter from router
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
$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'])) {
// 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
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])) {
notice(L10n::t('Unable to remove group.'));
}
}
- $a->internalRedirect('group');
+ DI::baseUrl()->redirect('group');
}
// @TODO: Replace with parameter from router
$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']);
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 = '';
$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
$rand = "?$rand";
}
- $app->internalRedirect($returnPath . $rand);
+ DI::baseUrl()->redirect($returnPath . $rand);
}
}
}
}
}
- $a->internalRedirect();
+ DI::baseUrl()->redirect();
}
// @TODO: Replace with parameter from router
- $a->internalRedirect('notifications/system');
+ DI::baseUrl()->redirect('notifications/system');
}
}
}
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
$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
$a->redirect($link);
}
- $a->internalRedirect('profile');
+ DI::baseUrl()->redirect('profile');
}
}
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.',
}
} 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
\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']);
);
\info(L10n::t('Your registration is pending approval by the site owner.') . EOL);
- $a->internalRedirect();
+ DI::baseUrl()->redirect();
}
return;
}
}
- DI::app()->internalRedirect($return_url);
+ DI::baseUrl()->redirect($return_url);
}
}
{
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);
System::externalRedirect($visitor_home);
} else {
info(L10n::t('Logged out.'));
- DI::app()->internalRedirect();
+ DI::baseUrl()->redirect();
}
}
}
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'), [
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'), [
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']);
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
$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');
}
}
$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.'));
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;
}
}
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'));
}
}
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':
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;
}
$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');
}
}
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'));
}
}
}
$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');
}
}
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.'));
}
$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
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'));
}
}