replaced $return_url to $return_path to make it more clear that it is a relative path to the Friendica baseurl

This commit is contained in:
Philipp Holzer 2018-10-19 23:55:11 +02:00
parent a9510ffcdf
commit 3edad1591e
No known key found for this signature in database
GPG key ID: 517BE60E2CE5C8A5
12 changed files with 44 additions and 44 deletions

View file

@ -534,7 +534,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
$page_dropping = ((local_user() && local_user() == $profile_owner) ? true : false); $page_dropping = ((local_user() && local_user() == $profile_owner) ? true : false);
if (!$update) { if (!$update) {
$_SESSION['return_url'] = $a->query_string; $_SESSION['return_path'] = $a->query_string;
} }
$cb = ['items' => $items, 'mode' => $mode, 'update' => $update, 'preview' => $preview]; $cb = ['items' => $items, 'mode' => $mode, 'update' => $update, 'preview' => $preview];

View file

@ -198,7 +198,7 @@ function events_content(App $a)
} }
if ($a->argc == 1) { if ($a->argc == 1) {
$_SESSION['return_url'] = System::baseUrl() . '/' . $a->cmd; $_SESSION['return_path'] = $a->cmd;
} }
if (($a->argc > 2) && ($a->argv[1] === 'ignore') && intval($a->argv[2])) { if (($a->argc > 2) && ($a->argv[1] === 'ignore') && intval($a->argv[2])) {

View file

@ -25,7 +25,7 @@ function follow_post(App $a)
$uid = local_user(); $uid = local_user();
$url = notags(trim($_REQUEST['url'])); $url = notags(trim($_REQUEST['url']));
$return_url = 'contacts'; $return_path = 'contacts';
// Makes the connection request for friendica contacts easier // Makes the connection request for friendica contacts easier
// This is just a precaution if maybe this page is called somewhere directly via POST // This is just a precaution if maybe this page is called somewhere directly via POST
@ -37,24 +37,24 @@ function follow_post(App $a)
if ($result['message']) { if ($result['message']) {
notice($result['message']); notice($result['message']);
} }
$a->internalRedirect($return_url); $a->internalRedirect($return_path);
} elseif ($result['cid']) { } elseif ($result['cid']) {
$a->internalRedirect('contact/' . $result['cid']); $a->internalRedirect('contact/' . $result['cid']);
} }
info(L10n::t('The contact could not be added.')); info(L10n::t('The contact could not be added.'));
$a->internalRedirect($return_url); $a->internalRedirect($return_path);
// NOTREACHED // NOTREACHED
} }
function follow_content(App $a) function follow_content(App $a)
{ {
$return_url = 'contacts'; $return_path = 'contacts';
if (!local_user()) { if (!local_user()) {
notice(L10n::t('Permission denied.')); notice(L10n::t('Permission denied.'));
$a->internalRedirect($return_url); $a->internalRedirect($return_path);
// NOTREACHED // NOTREACHED
} }
@ -74,7 +74,7 @@ function follow_content(App $a)
if ($r[0]['pending']) { if ($r[0]['pending']) {
notice(L10n::t('You already added this contact.')); notice(L10n::t('You already added this contact.'));
$submit = ''; $submit = '';
//$a->internalRedirect($_SESSION['return_url']); //$a->internalRedirect($_SESSION['return_path']);
// NOTREACHED // NOTREACHED
} }
} }
@ -84,21 +84,21 @@ function follow_content(App $a)
if (($ret['network'] == Protocol::DIASPORA) && !Config::get('system', 'diaspora_enabled')) { if (($ret['network'] == Protocol::DIASPORA) && !Config::get('system', 'diaspora_enabled')) {
notice(L10n::t("Diaspora support isn't enabled. Contact can't be added.")); notice(L10n::t("Diaspora support isn't enabled. Contact can't be added."));
$submit = ''; $submit = '';
//$a->internalRedirect($_SESSION['return_url']); //$a->internalRedirect($_SESSION['return_path']);
// NOTREACHED // NOTREACHED
} }
if (($ret['network'] == Protocol::OSTATUS) && Config::get('system', 'ostatus_disabled')) { if (($ret['network'] == Protocol::OSTATUS) && Config::get('system', 'ostatus_disabled')) {
notice(L10n::t("OStatus support is disabled. Contact can't be added.")); notice(L10n::t("OStatus support is disabled. Contact can't be added."));
$submit = ''; $submit = '';
//$a->internalRedirect($_SESSION['return_url']); //$a->internalRedirect($_SESSION['return_path']);
// NOTREACHED // NOTREACHED
} }
if ($ret['network'] == Protocol::PHANTOM) { if ($ret['network'] == Protocol::PHANTOM) {
notice(L10n::t("The network type couldn't be detected. Contact can't be added.")); notice(L10n::t("The network type couldn't be detected. Contact can't be added."));
$submit = ''; $submit = '';
//$a->internalRedirect($_SESSION['return_url']); //$a->internalRedirect($_SESSION['return_path']);
// NOTREACHED // NOTREACHED
} }
@ -118,7 +118,7 @@ function follow_content(App $a)
if (!$r) { if (!$r) {
notice(L10n::t('Permission denied.')); notice(L10n::t('Permission denied.'));
$a->internalRedirect($return_url); $a->internalRedirect($return_path);
// NOTREACHED // NOTREACHED
} }

View file

@ -99,7 +99,7 @@ function manage_post(App $a) {
unset($_SESSION['theme']); unset($_SESSION['theme']);
unset($_SESSION['mobile-theme']); unset($_SESSION['mobile-theme']);
unset($_SESSION['page_flags']); unset($_SESSION['page_flags']);
unset($_SESSION['return_url']); unset($_SESSION['return_path']);
if (x($_SESSION, 'submanage')) { if (x($_SESSION, 'submanage')) {
unset($_SESSION['submanage']); unset($_SESSION['submanage']);
} }

View file

@ -35,7 +35,7 @@ function match_content(App $a)
$a->page['aside'] .= Widget::findPeople(); $a->page['aside'] .= Widget::findPeople();
$a->page['aside'] .= Widget::follow(); $a->page['aside'] .= Widget::follow();
$_SESSION['return_url'] = System::baseUrl() . '/' . $a->cmd; $_SESSION['return_path'] = $a->cmd;
$r = q( $r = q(
"SELECT `pub_keywords`, `prv_keywords` FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1", "SELECT `pub_keywords`, `prv_keywords` FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1",

View file

@ -265,7 +265,7 @@ function message_content(App $a)
} }
$_SESSION['return_url'] = $a->query_string; $_SESSION['return_path'] = $a->query_string;
if ($a->argc == 1) { if ($a->argc == 1) {

View file

@ -1469,7 +1469,7 @@ function photos_content(App $a)
if (count($linked_items)) { if (count($linked_items)) {
$cmnt_tpl = get_markup_template('comment_item.tpl'); $cmnt_tpl = get_markup_template('comment_item.tpl');
$tpl = get_markup_template('photo_item.tpl'); $tpl = get_markup_template('photo_item.tpl');
$return_url = $a->cmd; $return_path = $a->cmd;
if ($can_post || Security::canWriteToUserWall($owner_uid)) { if ($can_post || Security::canWriteToUserWall($owner_uid)) {
$like_tpl = get_markup_template('like_noshare.tpl'); $like_tpl = get_markup_template('like_noshare.tpl');
@ -1486,7 +1486,7 @@ function photos_content(App $a)
if (($can_post || Security::canWriteToUserWall($owner_uid))) { if (($can_post || Security::canWriteToUserWall($owner_uid))) {
$comments .= replace_macros($cmnt_tpl, [ $comments .= replace_macros($cmnt_tpl, [
'$return_path' => '', '$return_path' => '',
'$jsreload' => $return_url, '$jsreload' => $return_path,
'$id' => $link_item['id'], '$id' => $link_item['id'],
'$parent' => $link_item['id'], '$parent' => $link_item['id'],
'$profile_uid' => $owner_uid, '$profile_uid' => $owner_uid,
@ -1525,7 +1525,7 @@ function photos_content(App $a)
if (($can_post || Security::canWriteToUserWall($owner_uid))) { if (($can_post || Security::canWriteToUserWall($owner_uid))) {
$comments .= replace_macros($cmnt_tpl,[ $comments .= replace_macros($cmnt_tpl,[
'$return_path' => '', '$return_path' => '',
'$jsreload' => $return_url, '$jsreload' => $return_path,
'$id' => $link_item['id'], '$id' => $link_item['id'],
'$parent' => $link_item['id'], '$parent' => $link_item['id'],
'$profile_uid' => $owner_uid, '$profile_uid' => $owner_uid,
@ -1585,7 +1585,7 @@ function photos_content(App $a)
if (($can_post || Security::canWriteToUserWall($owner_uid))) { if (($can_post || Security::canWriteToUserWall($owner_uid))) {
$comments .= replace_macros($cmnt_tpl, [ $comments .= replace_macros($cmnt_tpl, [
'$return_path' => '', '$return_path' => '',
'$jsreload' => $return_url, '$jsreload' => $return_path,
'$id' => $item['item_id'], '$id' => $item['item_id'],
'$parent' => $item['parent'], '$parent' => $item['parent'],
'$profile_uid' => $owner_uid, '$profile_uid' => $owner_uid,

View file

@ -62,7 +62,7 @@ function suggest_content(App $a)
return; return;
} }
$_SESSION['return_url'] = System::baseUrl() . '/' . $a->cmd; $_SESSION['return_path'] = $a->cmd;
$a->page['aside'] .= Widget::findPeople(); $a->page['aside'] .= Widget::findPeople();
$a->page['aside'] .= Widget::follow(); $a->page['aside'] .= Widget::follow();

View file

@ -14,7 +14,7 @@ use Friendica\Model\User;
function unfollow_post(App $a) function unfollow_post(App $a)
{ {
$return_url = 'contacts'; $return_path = 'contacts';
if (!local_user()) { if (!local_user()) {
notice(L10n::t('Permission denied.')); notice(L10n::t('Permission denied.'));
@ -32,17 +32,17 @@ function unfollow_post(App $a)
if (!DBA::isResult($contact)) { if (!DBA::isResult($contact)) {
notice(L10n::t("You aren't following this contact.")); notice(L10n::t("You aren't following this contact."));
$a->internalRedirect($return_url); $a->internalRedirect($return_path);
// NOTREACHED // NOTREACHED
} }
if (!empty($_REQUEST['cancel'])) { if (!empty($_REQUEST['cancel'])) {
$a->internalRedirect($return_url . '/' . $contact['id']); $a->internalRedirect($return_path . '/' . $contact['id']);
} }
if (!in_array($contact['network'], Protocol::NATIVE_SUPPORT)) { if (!in_array($contact['network'], Protocol::NATIVE_SUPPORT)) {
notice(L10n::t('Unfollowing is currently not supported by your network.')); notice(L10n::t('Unfollowing is currently not supported by your network.'));
$a->internalRedirect($return_url . '/' . $contact['id']); $a->internalRedirect($return_path . '/' . $contact['id']);
// NOTREACHED // NOTREACHED
} }
@ -69,7 +69,7 @@ function unfollow_post(App $a)
function unfollow_content(App $a) function unfollow_content(App $a)
{ {
$return_url = 'contacts'; $return_path = 'contacts';
if (!local_user()) { if (!local_user()) {
notice(L10n::t('Permission denied.')); notice(L10n::t('Permission denied.'));
@ -88,7 +88,7 @@ function unfollow_content(App $a)
if (!DBA::isResult($contact)) { if (!DBA::isResult($contact)) {
notice(L10n::t("You aren't following this contact.")); notice(L10n::t("You aren't following this contact."));
$a->internalRedirect($return_url); $a->internalRedirect($return_path);
// NOTREACHED // NOTREACHED
} }
@ -105,7 +105,7 @@ function unfollow_content(App $a)
if (!DBA::isResult($self)) { if (!DBA::isResult($self)) {
notice(L10n::t('Permission denied.')); notice(L10n::t('Permission denied.'));
$a->internalRedirect($return_url); $a->internalRedirect($return_path);
// NOTREACHED // NOTREACHED
} }

View file

@ -82,7 +82,7 @@ class Authentication extends BaseObject
if ($interactive) { if ($interactive) {
if ($a->user['login_date'] <= NULL_DATE) { if ($a->user['login_date'] <= NULL_DATE) {
$_SESSION['return_url'] = 'profile_photo/new'; $_SESSION['return_path'] = 'profile_photo/new';
$a->module = 'profile_photo'; $a->module = 'profile_photo';
info(L10n::t("Welcome ") . $a->user['username'] . EOL); info(L10n::t("Welcome ") . $a->user['username'] . EOL);
info(L10n::t('Please upload a profile photo.') . EOL); info(L10n::t('Please upload a profile photo.') . EOL);
@ -193,8 +193,8 @@ class Authentication extends BaseObject
if ($login_initial) { if ($login_initial) {
Addon::callHooks('logged_in', $a->user); Addon::callHooks('logged_in', $a->user);
if (($a->module !== 'home') && isset($_SESSION['return_url'])) { if (($a->module !== 'home') && isset($_SESSION['return_path'])) {
$a->internalRedirect($_SESSION['return_url']); $a->internalRedirect($_SESSION['return_path']);
} }
} }
} }

View file

@ -468,7 +468,7 @@ class Contact extends BaseModule
} }
} }
$_SESSION['return_url'] = $a->query_string; $_SESSION['return_path'] = $a->query_string;
if (!empty($a->data['contact']) && is_array($a->data['contact'])) { if (!empty($a->data['contact']) && is_array($a->data['contact'])) {
$contact_id = $a->data['contact']['id']; $contact_id = $a->data['contact']['id'];

View file

@ -43,14 +43,14 @@ class Login extends BaseModule
$a->internalRedirect(); $a->internalRedirect();
} }
return self::form($_SESSION['return_url'], intval(Config::get('config', 'register_policy')) !== REGISTER_CLOSED); return self::form($_SESSION['return_path'], intval(Config::get('config', 'register_policy')) !== REGISTER_CLOSED);
} }
public static function post() public static function post()
{ {
$return_url = $_SESSION['return_url']; $return_path = $_SESSION['return_path'];
session_unset(); session_unset();
$_SESSION['return_url'] = $return_url; $_SESSION['return_path'] = $return_path;
// OpenId Login // OpenId Login
if ( if (
@ -160,14 +160,14 @@ class Login extends BaseModule
$_SESSION['last_login_date'] = DateTimeFormat::utcNow(); $_SESSION['last_login_date'] = DateTimeFormat::utcNow();
Authentication::setAuthenticatedSessionForUser($record, true, true); Authentication::setAuthenticatedSessionForUser($record, true, true);
if (x($_SESSION, 'return_url')) { if (x($_SESSION, 'return_path')) {
$return_url = $_SESSION['return_url']; $return_path = $_SESSION['return_path'];
unset($_SESSION['return_url']); unset($_SESSION['return_path']);
} else { } else {
$return_url = ''; $return_path = '';
} }
$a->internalRedirect($return_url); $a->internalRedirect($return_path);
} }
/** /**
@ -269,7 +269,7 @@ class Login extends BaseModule
/** /**
* @brief Wrapper for adding a login box. * @brief Wrapper for adding a login box.
* *
* @param string $return_url The url relative to the base the user should be sent * @param string $return_path The path relative to the base the user should be sent
* back to after login completes * back to after login completes
* @param bool $register If $register == true provide a registration link. * @param bool $register If $register == true provide a registration link.
* This will most always depend on the value of config.register_policy. * This will most always depend on the value of config.register_policy.
@ -279,7 +279,7 @@ class Login extends BaseModule
* *
* @hooks 'login_hook' string $o * @hooks 'login_hook' string $o
*/ */
public static function form($return_url = null, $register = false, $hiddens = []) public static function form($return_path = null, $register = false, $hiddens = [])
{ {
$a = self::getApp(); $a = self::getApp();
$o = ''; $o = '';
@ -293,8 +293,8 @@ class Login extends BaseModule
$noid = Config::get('system', 'no_openid'); $noid = Config::get('system', 'no_openid');
if (is_null($return_url)) { if (is_null($return_path)) {
$return_url = $a->query_string; $return_path = $a->query_string;
} }
if (local_user()) { if (local_user()) {
@ -308,7 +308,7 @@ class Login extends BaseModule
); );
$tpl = get_markup_template('login.tpl'); $tpl = get_markup_template('login.tpl');
$_SESSION['return_url'] = $return_url; $_SESSION['return_path'] = $return_path;
} }
$o .= replace_macros( $o .= replace_macros(