From 3d3a11fa46084f3a6e6e79d9000d4ca15dd1b86b Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Sat, 13 Oct 2018 20:05:05 +0200 Subject: [PATCH 1/6] Replaced goaway() with System::redirectTo() --- blackout/blackout.php | 5 +++-- notifyall/notifyall.php | 3 ++- startpage/startpage.php | 3 ++- statusnet/statusnet.php | 7 ++++--- twitter/twitter.php | 3 ++- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/blackout/blackout.php b/blackout/blackout.php index 688542001..79b3fc92a 100644 --- a/blackout/blackout.php +++ b/blackout/blackout.php @@ -54,6 +54,7 @@ use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\Renderer; +use Friendica\Core\System; function blackout_install() { Hook::register('page_header', 'addon/blackout/blackout.php', 'blackout_redirect'); @@ -86,8 +87,8 @@ function blackout_redirect ($a, $b) { $date2 = 0; } if (( $date1 <= $now ) && ( $now <= $date2 )) { - Logger::log('redirecting user to blackout page'); - System::externalRedirect($myurl); + logger('redirecting user to blackout page'); + System::redirectTo($myurl); } } diff --git a/notifyall/notifyall.php b/notifyall/notifyall.php index 51c426cc5..d739649ed 100644 --- a/notifyall/notifyall.php +++ b/notifyall/notifyall.php @@ -14,6 +14,7 @@ use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\Logger; use Friendica\Core\Renderer; +use Friendica\Core\System; use Friendica\Util\Emailer; function notifyall_install() @@ -95,7 +96,7 @@ function notifyall_post(App $a) } notice(L10n::t('Emails sent')); - $a->internalRedirect('admin'); + System::redirectTo('admin'); } function notifyall_content(&$a) diff --git a/startpage/startpage.php b/startpage/startpage.php index 82ae1eb04..b882c240d 100644 --- a/startpage/startpage.php +++ b/startpage/startpage.php @@ -9,6 +9,7 @@ use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\PConfig; +use Friendica\Core\System; function startpage_install() { Hook::register('home_init', 'addon/startpage/startpage.php', 'startpage_home_init'); @@ -31,7 +32,7 @@ function startpage_home_init($a, $b) $page = PConfig::get(local_user(), 'startpage', 'startpage'); if (strlen($page)) { - $a->internalRedirect($page); + System::redirectTo($page); } return; } diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 93fc874f3..61e76a0c1 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -48,6 +48,7 @@ use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Core\Protocol; use Friendica\Core\Renderer; +use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Model\GContact; @@ -163,7 +164,7 @@ function statusnet_settings_post(App $a, $post) } } } - $a->internalRedirect('settings/connectors'); + System::redirectTo('settings/connectors'); } else { if (isset($_POST['statusnet-consumersecret'])) { // check if we can reach the API of the GNU Social server @@ -191,7 +192,7 @@ function statusnet_settings_post(App $a, $post) notice(L10n::t('We could not contact the GNU Social API with the Path you entered.') . EOL); } } - $a->internalRedirect('settings/connectors'); + System::redirectTo('settings/connectors'); } else { if (isset($_POST['statusnet-pin'])) { // if the user supplied us with a PIN from GNU Social, let the magic of OAuth happen @@ -209,7 +210,7 @@ function statusnet_settings_post(App $a, $post) PConfig::set(local_user(), 'statusnet', 'post', 1); PConfig::set(local_user(), 'statusnet', 'post_taglinks', 1); // reload the Addon Settings page, if we don't do it see Bug #42 - $a->internalRedirect('settings/connectors'); + System::redirectTo('settings/connectors'); } else { // if no PIN is supplied in the POST variables, the user has changed the setting // to post a dent for every new __public__ posting to the wall diff --git a/twitter/twitter.php b/twitter/twitter.php index f05fc1f20..fe23ac0df 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -75,6 +75,7 @@ use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Core\Protocol; use Friendica\Core\Renderer; +use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; use Friendica\Model\Contact; @@ -260,7 +261,7 @@ function twitter_settings_post(App $a) info($e->getMessage()); } // reload the Addon Settings page, if we don't do it see Bug #42 - $a->internalRedirect('settings/connectors'); + System::redirectTo('settings/connectors'); } else { // if no PIN is supplied in the POST variables, the user has changed the setting // to post a tweet for every new __public__ posting to the wall From a1254b4c856bfe6ce2459a9ce00f6a7f7bd65ec6 Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Sat, 13 Oct 2018 20:36:09 +0200 Subject: [PATCH 2/6] wrong indent --- notifyall/notifyall.php | 2 +- startpage/startpage.php | 2 +- statusnet/statusnet.php | 6 +++--- twitter/twitter.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/notifyall/notifyall.php b/notifyall/notifyall.php index d739649ed..01cea75d7 100644 --- a/notifyall/notifyall.php +++ b/notifyall/notifyall.php @@ -96,7 +96,7 @@ function notifyall_post(App $a) } notice(L10n::t('Emails sent')); - System::redirectTo('admin'); + System::redirectTo('admin'); } function notifyall_content(&$a) diff --git a/startpage/startpage.php b/startpage/startpage.php index b882c240d..704c36f98 100644 --- a/startpage/startpage.php +++ b/startpage/startpage.php @@ -32,7 +32,7 @@ function startpage_home_init($a, $b) $page = PConfig::get(local_user(), 'startpage', 'startpage'); if (strlen($page)) { - System::redirectTo($page); + System::redirectTo($page); } return; } diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 61e76a0c1..fd7352037 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -164,7 +164,7 @@ function statusnet_settings_post(App $a, $post) } } } - System::redirectTo('settings/connectors'); + System::redirectTo('settings/connectors'); } else { if (isset($_POST['statusnet-consumersecret'])) { // check if we can reach the API of the GNU Social server @@ -192,7 +192,7 @@ function statusnet_settings_post(App $a, $post) notice(L10n::t('We could not contact the GNU Social API with the Path you entered.') . EOL); } } - System::redirectTo('settings/connectors'); + System::redirectTo('settings/connectors'); } else { if (isset($_POST['statusnet-pin'])) { // if the user supplied us with a PIN from GNU Social, let the magic of OAuth happen @@ -210,7 +210,7 @@ function statusnet_settings_post(App $a, $post) PConfig::set(local_user(), 'statusnet', 'post', 1); PConfig::set(local_user(), 'statusnet', 'post_taglinks', 1); // reload the Addon Settings page, if we don't do it see Bug #42 - System::redirectTo('settings/connectors'); + System::redirectTo('settings/connectors'); } else { // if no PIN is supplied in the POST variables, the user has changed the setting // to post a dent for every new __public__ posting to the wall diff --git a/twitter/twitter.php b/twitter/twitter.php index fe23ac0df..bb2d38abb 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -261,7 +261,7 @@ function twitter_settings_post(App $a) info($e->getMessage()); } // reload the Addon Settings page, if we don't do it see Bug #42 - System::redirectTo('settings/connectors'); + System::redirectTo('settings/connectors'); } else { // if no PIN is supplied in the POST variables, the user has changed the setting // to post a tweet for every new __public__ posting to the wall From e825cbc7a1912dd258b0fd2a061c5dd24c3cf812 Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Mon, 15 Oct 2018 08:50:33 +0200 Subject: [PATCH 3/6] renamed System::redirectTo to System::redirect --- blackout/blackout.php | 2 +- notifyall/notifyall.php | 2 +- startpage/startpage.php | 2 +- statusnet/statusnet.php | 6 +++--- twitter/twitter.php | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/blackout/blackout.php b/blackout/blackout.php index 79b3fc92a..9fba4cd1a 100644 --- a/blackout/blackout.php +++ b/blackout/blackout.php @@ -88,7 +88,7 @@ function blackout_redirect ($a, $b) { } if (( $date1 <= $now ) && ( $now <= $date2 )) { logger('redirecting user to blackout page'); - System::redirectTo($myurl); + System::redirect($myurl); } } diff --git a/notifyall/notifyall.php b/notifyall/notifyall.php index 01cea75d7..9789ccd95 100644 --- a/notifyall/notifyall.php +++ b/notifyall/notifyall.php @@ -96,7 +96,7 @@ function notifyall_post(App $a) } notice(L10n::t('Emails sent')); - System::redirectTo('admin'); + System::redirect('admin'); } function notifyall_content(&$a) diff --git a/startpage/startpage.php b/startpage/startpage.php index 704c36f98..0b4653e16 100644 --- a/startpage/startpage.php +++ b/startpage/startpage.php @@ -32,7 +32,7 @@ function startpage_home_init($a, $b) $page = PConfig::get(local_user(), 'startpage', 'startpage'); if (strlen($page)) { - System::redirectTo($page); + System::redirect($page); } return; } diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index fd7352037..274a6abd8 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -164,7 +164,7 @@ function statusnet_settings_post(App $a, $post) } } } - System::redirectTo('settings/connectors'); + System::redirect('settings/connectors'); } else { if (isset($_POST['statusnet-consumersecret'])) { // check if we can reach the API of the GNU Social server @@ -192,7 +192,7 @@ function statusnet_settings_post(App $a, $post) notice(L10n::t('We could not contact the GNU Social API with the Path you entered.') . EOL); } } - System::redirectTo('settings/connectors'); + System::redirect('settings/connectors'); } else { if (isset($_POST['statusnet-pin'])) { // if the user supplied us with a PIN from GNU Social, let the magic of OAuth happen @@ -210,7 +210,7 @@ function statusnet_settings_post(App $a, $post) PConfig::set(local_user(), 'statusnet', 'post', 1); PConfig::set(local_user(), 'statusnet', 'post_taglinks', 1); // reload the Addon Settings page, if we don't do it see Bug #42 - System::redirectTo('settings/connectors'); + System::redirect('settings/connectors'); } else { // if no PIN is supplied in the POST variables, the user has changed the setting // to post a dent for every new __public__ posting to the wall diff --git a/twitter/twitter.php b/twitter/twitter.php index bb2d38abb..90cea144c 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -261,7 +261,7 @@ function twitter_settings_post(App $a) info($e->getMessage()); } // reload the Addon Settings page, if we don't do it see Bug #42 - System::redirectTo('settings/connectors'); + System::redirect('settings/connectors'); } else { // if no PIN is supplied in the POST variables, the user has changed the setting // to post a tweet for every new __public__ posting to the wall From 0e264465ac6f38b0589509c574df2eb3b4c534ae Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Fri, 19 Oct 2018 20:14:52 +0200 Subject: [PATCH 4/6] Split goaway to System::externalRedirectTo() and App->internalRedirect() --- blackout/blackout.php | 2 +- notifyall/notifyall.php | 2 +- startpage/startpage.php | 2 +- statusnet/statusnet.php | 6 +++--- twitter/twitter.php | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/blackout/blackout.php b/blackout/blackout.php index 9fba4cd1a..a4e3eb359 100644 --- a/blackout/blackout.php +++ b/blackout/blackout.php @@ -88,7 +88,7 @@ function blackout_redirect ($a, $b) { } if (( $date1 <= $now ) && ( $now <= $date2 )) { logger('redirecting user to blackout page'); - System::redirect($myurl); + System::externalRedirectTo($myurl); } } diff --git a/notifyall/notifyall.php b/notifyall/notifyall.php index 9789ccd95..58e54908c 100644 --- a/notifyall/notifyall.php +++ b/notifyall/notifyall.php @@ -96,7 +96,7 @@ function notifyall_post(App $a) } notice(L10n::t('Emails sent')); - System::redirect('admin'); + $a->internalRedirect('admin'); } function notifyall_content(&$a) diff --git a/startpage/startpage.php b/startpage/startpage.php index 0b4653e16..0971818f3 100644 --- a/startpage/startpage.php +++ b/startpage/startpage.php @@ -32,7 +32,7 @@ function startpage_home_init($a, $b) $page = PConfig::get(local_user(), 'startpage', 'startpage'); if (strlen($page)) { - System::redirect($page); + $a->internalRedirect($page); } return; } diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 274a6abd8..aba503a42 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -164,7 +164,7 @@ function statusnet_settings_post(App $a, $post) } } } - System::redirect('settings/connectors'); + $a->internalRedirect('settings/connectors'); } else { if (isset($_POST['statusnet-consumersecret'])) { // check if we can reach the API of the GNU Social server @@ -192,7 +192,7 @@ function statusnet_settings_post(App $a, $post) notice(L10n::t('We could not contact the GNU Social API with the Path you entered.') . EOL); } } - System::redirect('settings/connectors'); + $a->internalRedirect('settings/connectors'); } else { if (isset($_POST['statusnet-pin'])) { // if the user supplied us with a PIN from GNU Social, let the magic of OAuth happen @@ -210,7 +210,7 @@ function statusnet_settings_post(App $a, $post) PConfig::set(local_user(), 'statusnet', 'post', 1); PConfig::set(local_user(), 'statusnet', 'post_taglinks', 1); // reload the Addon Settings page, if we don't do it see Bug #42 - System::redirect('settings/connectors'); + $a->internalRedirect('settings/connectors'); } else { // if no PIN is supplied in the POST variables, the user has changed the setting // to post a dent for every new __public__ posting to the wall diff --git a/twitter/twitter.php b/twitter/twitter.php index 90cea144c..b1eeb5b86 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -261,7 +261,7 @@ function twitter_settings_post(App $a) info($e->getMessage()); } // reload the Addon Settings page, if we don't do it see Bug #42 - System::redirect('settings/connectors'); + $a->internalRedirect('settings/connectors'); } else { // if no PIN is supplied in the POST variables, the user has changed the setting // to post a tweet for every new __public__ posting to the wall From 9cf3d38e76dde11a13807158c1d1b37be1574fcf Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Fri, 19 Oct 2018 23:41:36 +0200 Subject: [PATCH 5/6] Split goaway to System::externalRedirectTo() and App->internalRedirect() --- blackout/blackout.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blackout/blackout.php b/blackout/blackout.php index a4e3eb359..20369716a 100644 --- a/blackout/blackout.php +++ b/blackout/blackout.php @@ -88,7 +88,7 @@ function blackout_redirect ($a, $b) { } if (( $date1 <= $now ) && ( $now <= $date2 )) { logger('redirecting user to blackout page'); - System::externalRedirectTo($myurl); + System::externalRedirect($myurl); } } From c3d51338e0bd60e7bffe6f445fb368ae88ab84fa Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Mon, 4 Feb 2019 01:52:03 +0100 Subject: [PATCH 6/6] Bugfixing calls --- blackout/blackout.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blackout/blackout.php b/blackout/blackout.php index 20369716a..c85740028 100644 --- a/blackout/blackout.php +++ b/blackout/blackout.php @@ -87,7 +87,7 @@ function blackout_redirect ($a, $b) { $date2 = 0; } if (( $date1 <= $now ) && ( $now <= $date2 )) { - logger('redirecting user to blackout page'); + Logger::log('redirecting user to blackout page'); System::externalRedirect($myurl); } }