From 3edad1591e577b03519bdf233e241cb49f485506 Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Fri, 19 Oct 2018 23:55:11 +0200 Subject: [PATCH] replaced $return_url to $return_path to make it more clear that it is a relative path to the Friendica baseurl --- include/conversation.php | 2 +- mod/events.php | 2 +- mod/follow.php | 20 ++++++++++---------- mod/manage.php | 2 +- mod/match.php | 2 +- mod/message.php | 2 +- mod/photos.php | 8 ++++---- mod/suggest.php | 2 +- mod/unfollow.php | 14 +++++++------- src/Core/Authentication.php | 6 +++--- src/Module/Contact.php | 2 +- src/Module/Login.php | 26 +++++++++++++------------- 12 files changed, 44 insertions(+), 44 deletions(-) diff --git a/include/conversation.php b/include/conversation.php index 2ccdf8fb72..4573f44a45 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -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); if (!$update) { - $_SESSION['return_url'] = $a->query_string; + $_SESSION['return_path'] = $a->query_string; } $cb = ['items' => $items, 'mode' => $mode, 'update' => $update, 'preview' => $preview]; diff --git a/mod/events.php b/mod/events.php index 9a0da74dcd..eebccee769 100644 --- a/mod/events.php +++ b/mod/events.php @@ -198,7 +198,7 @@ function events_content(App $a) } 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])) { diff --git a/mod/follow.php b/mod/follow.php index 0c91e09512..adc3fcc3bd 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -25,7 +25,7 @@ function follow_post(App $a) $uid = local_user(); $url = notags(trim($_REQUEST['url'])); - $return_url = 'contacts'; + $return_path = 'contacts'; // Makes the connection request for friendica contacts easier // 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']) { notice($result['message']); } - $a->internalRedirect($return_url); + $a->internalRedirect($return_path); } elseif ($result['cid']) { $a->internalRedirect('contact/' . $result['cid']); } info(L10n::t('The contact could not be added.')); - $a->internalRedirect($return_url); + $a->internalRedirect($return_path); // NOTREACHED } function follow_content(App $a) { - $return_url = 'contacts'; + $return_path = 'contacts'; if (!local_user()) { notice(L10n::t('Permission denied.')); - $a->internalRedirect($return_url); + $a->internalRedirect($return_path); // NOTREACHED } @@ -74,7 +74,7 @@ function follow_content(App $a) if ($r[0]['pending']) { notice(L10n::t('You already added this contact.')); $submit = ''; - //$a->internalRedirect($_SESSION['return_url']); + //$a->internalRedirect($_SESSION['return_path']); // NOTREACHED } } @@ -84,21 +84,21 @@ function follow_content(App $a) if (($ret['network'] == Protocol::DIASPORA) && !Config::get('system', 'diaspora_enabled')) { notice(L10n::t("Diaspora support isn't enabled. Contact can't be added.")); $submit = ''; - //$a->internalRedirect($_SESSION['return_url']); + //$a->internalRedirect($_SESSION['return_path']); // NOTREACHED } if (($ret['network'] == Protocol::OSTATUS) && Config::get('system', 'ostatus_disabled')) { notice(L10n::t("OStatus support is disabled. Contact can't be added.")); $submit = ''; - //$a->internalRedirect($_SESSION['return_url']); + //$a->internalRedirect($_SESSION['return_path']); // NOTREACHED } if ($ret['network'] == Protocol::PHANTOM) { notice(L10n::t("The network type couldn't be detected. Contact can't be added.")); $submit = ''; - //$a->internalRedirect($_SESSION['return_url']); + //$a->internalRedirect($_SESSION['return_path']); // NOTREACHED } @@ -118,7 +118,7 @@ function follow_content(App $a) if (!$r) { notice(L10n::t('Permission denied.')); - $a->internalRedirect($return_url); + $a->internalRedirect($return_path); // NOTREACHED } diff --git a/mod/manage.php b/mod/manage.php index b5aed6f8b3..b98fcac6f7 100644 --- a/mod/manage.php +++ b/mod/manage.php @@ -99,7 +99,7 @@ function manage_post(App $a) { unset($_SESSION['theme']); unset($_SESSION['mobile-theme']); unset($_SESSION['page_flags']); - unset($_SESSION['return_url']); + unset($_SESSION['return_path']); if (x($_SESSION, 'submanage')) { unset($_SESSION['submanage']); } diff --git a/mod/match.php b/mod/match.php index 7e805d5baf..b299619940 100644 --- a/mod/match.php +++ b/mod/match.php @@ -35,7 +35,7 @@ function match_content(App $a) $a->page['aside'] .= Widget::findPeople(); $a->page['aside'] .= Widget::follow(); - $_SESSION['return_url'] = System::baseUrl() . '/' . $a->cmd; + $_SESSION['return_path'] = $a->cmd; $r = q( "SELECT `pub_keywords`, `prv_keywords` FROM `profile` WHERE `is-default` = 1 AND `uid` = %d LIMIT 1", diff --git a/mod/message.php b/mod/message.php index 418dfc080d..8a04f9abef 100644 --- a/mod/message.php +++ b/mod/message.php @@ -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) { diff --git a/mod/photos.php b/mod/photos.php index 0c77504e1a..ef6428d7ab 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1469,7 +1469,7 @@ function photos_content(App $a) if (count($linked_items)) { $cmnt_tpl = get_markup_template('comment_item.tpl'); $tpl = get_markup_template('photo_item.tpl'); - $return_url = $a->cmd; + $return_path = $a->cmd; if ($can_post || Security::canWriteToUserWall($owner_uid)) { $like_tpl = get_markup_template('like_noshare.tpl'); @@ -1486,7 +1486,7 @@ function photos_content(App $a) if (($can_post || Security::canWriteToUserWall($owner_uid))) { $comments .= replace_macros($cmnt_tpl, [ '$return_path' => '', - '$jsreload' => $return_url, + '$jsreload' => $return_path, '$id' => $link_item['id'], '$parent' => $link_item['id'], '$profile_uid' => $owner_uid, @@ -1525,7 +1525,7 @@ function photos_content(App $a) if (($can_post || Security::canWriteToUserWall($owner_uid))) { $comments .= replace_macros($cmnt_tpl,[ '$return_path' => '', - '$jsreload' => $return_url, + '$jsreload' => $return_path, '$id' => $link_item['id'], '$parent' => $link_item['id'], '$profile_uid' => $owner_uid, @@ -1585,7 +1585,7 @@ function photos_content(App $a) if (($can_post || Security::canWriteToUserWall($owner_uid))) { $comments .= replace_macros($cmnt_tpl, [ '$return_path' => '', - '$jsreload' => $return_url, + '$jsreload' => $return_path, '$id' => $item['item_id'], '$parent' => $item['parent'], '$profile_uid' => $owner_uid, diff --git a/mod/suggest.php b/mod/suggest.php index 81030842dc..1e33cb6602 100644 --- a/mod/suggest.php +++ b/mod/suggest.php @@ -62,7 +62,7 @@ function suggest_content(App $a) return; } - $_SESSION['return_url'] = System::baseUrl() . '/' . $a->cmd; + $_SESSION['return_path'] = $a->cmd; $a->page['aside'] .= Widget::findPeople(); $a->page['aside'] .= Widget::follow(); diff --git a/mod/unfollow.php b/mod/unfollow.php index 6ec8a8fdb4..2a60322f02 100644 --- a/mod/unfollow.php +++ b/mod/unfollow.php @@ -14,7 +14,7 @@ use Friendica\Model\User; function unfollow_post(App $a) { - $return_url = 'contacts'; + $return_path = 'contacts'; if (!local_user()) { notice(L10n::t('Permission denied.')); @@ -32,17 +32,17 @@ function unfollow_post(App $a) if (!DBA::isResult($contact)) { notice(L10n::t("You aren't following this contact.")); - $a->internalRedirect($return_url); + $a->internalRedirect($return_path); // NOTREACHED } if (!empty($_REQUEST['cancel'])) { - $a->internalRedirect($return_url . '/' . $contact['id']); + $a->internalRedirect($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($return_url . '/' . $contact['id']); + $a->internalRedirect($return_path . '/' . $contact['id']); // NOTREACHED } @@ -69,7 +69,7 @@ function unfollow_post(App $a) function unfollow_content(App $a) { - $return_url = 'contacts'; + $return_path = 'contacts'; if (!local_user()) { notice(L10n::t('Permission denied.')); @@ -88,7 +88,7 @@ function unfollow_content(App $a) if (!DBA::isResult($contact)) { notice(L10n::t("You aren't following this contact.")); - $a->internalRedirect($return_url); + $a->internalRedirect($return_path); // NOTREACHED } @@ -105,7 +105,7 @@ function unfollow_content(App $a) if (!DBA::isResult($self)) { notice(L10n::t('Permission denied.')); - $a->internalRedirect($return_url); + $a->internalRedirect($return_path); // NOTREACHED } diff --git a/src/Core/Authentication.php b/src/Core/Authentication.php index 72caa9be43..76d078341f 100644 --- a/src/Core/Authentication.php +++ b/src/Core/Authentication.php @@ -82,7 +82,7 @@ class Authentication extends BaseObject if ($interactive) { if ($a->user['login_date'] <= NULL_DATE) { - $_SESSION['return_url'] = 'profile_photo/new'; + $_SESSION['return_path'] = 'profile_photo/new'; $a->module = 'profile_photo'; info(L10n::t("Welcome ") . $a->user['username'] . EOL); info(L10n::t('Please upload a profile photo.') . EOL); @@ -193,8 +193,8 @@ class Authentication extends BaseObject if ($login_initial) { Addon::callHooks('logged_in', $a->user); - if (($a->module !== 'home') && isset($_SESSION['return_url'])) { - $a->internalRedirect($_SESSION['return_url']); + if (($a->module !== 'home') && isset($_SESSION['return_path'])) { + $a->internalRedirect($_SESSION['return_path']); } } } diff --git a/src/Module/Contact.php b/src/Module/Contact.php index 1b19aaadb5..271740a4f5 100644 --- a/src/Module/Contact.php +++ b/src/Module/Contact.php @@ -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'])) { $contact_id = $a->data['contact']['id']; diff --git a/src/Module/Login.php b/src/Module/Login.php index 2e04eb83be..df918c44c8 100644 --- a/src/Module/Login.php +++ b/src/Module/Login.php @@ -43,14 +43,14 @@ class Login extends BaseModule $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() { - $return_url = $_SESSION['return_url']; + $return_path = $_SESSION['return_path']; session_unset(); - $_SESSION['return_url'] = $return_url; + $_SESSION['return_path'] = $return_path; // OpenId Login if ( @@ -160,14 +160,14 @@ class Login extends BaseModule $_SESSION['last_login_date'] = DateTimeFormat::utcNow(); Authentication::setAuthenticatedSessionForUser($record, true, true); - if (x($_SESSION, 'return_url')) { - $return_url = $_SESSION['return_url']; - unset($_SESSION['return_url']); + if (x($_SESSION, 'return_path')) { + $return_path = $_SESSION['return_path']; + unset($_SESSION['return_path']); } 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. * - * @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 * @param bool $register If $register == true provide a registration link. * 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 */ - public static function form($return_url = null, $register = false, $hiddens = []) + public static function form($return_path = null, $register = false, $hiddens = []) { $a = self::getApp(); $o = ''; @@ -293,8 +293,8 @@ class Login extends BaseModule $noid = Config::get('system', 'no_openid'); - if (is_null($return_url)) { - $return_url = $a->query_string; + if (is_null($return_path)) { + $return_path = $a->query_string; } if (local_user()) { @@ -308,7 +308,7 @@ class Login extends BaseModule ); $tpl = get_markup_template('login.tpl'); - $_SESSION['return_url'] = $return_url; + $_SESSION['return_path'] = $return_path; } $o .= replace_macros(