mirror of
https://github.com/friendica/friendica
synced 2025-04-26 02:30:11 +00:00
Split goaway to System::externalRedirectTo() and App->internalRedirect()
This commit is contained in:
parent
2ef81108b3
commit
d00ddc01af
61 changed files with 286 additions and 266 deletions
|
@ -82,7 +82,7 @@ function admin_post(App $a)
|
|||
if ($a->isAjax()) {
|
||||
return;
|
||||
}
|
||||
$a->redirect('admin/');
|
||||
$a->internalRedirect('admin/');
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ function admin_post(App $a)
|
|||
}
|
||||
}
|
||||
|
||||
$a->redirect($return_path);
|
||||
$a->internalRedirect($return_path);
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -340,7 +340,7 @@ function admin_page_tos_post(App $a)
|
|||
Config::set('system', 'tosprivstatement', $displayprivstatement);
|
||||
Config::set('system', 'tostext', $tostext);
|
||||
|
||||
$a->redirect('admin/tos');
|
||||
$a->internalRedirect('admin/tos');
|
||||
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
@ -429,7 +429,7 @@ function admin_page_blocklist_post(App $a)
|
|||
Config::set('system', 'blocklist', $blocklist);
|
||||
info(L10n::t('Site blocklist updated.') . EOL);
|
||||
}
|
||||
$a->redirect('admin/blocklist');
|
||||
$a->internalRedirect('admin/blocklist');
|
||||
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
@ -461,7 +461,7 @@ function admin_page_contactblock_post(App $a)
|
|||
}
|
||||
notice(L10n::tt("%s contact unblocked", "%s contacts unblocked", count($contacts)));
|
||||
}
|
||||
$a->redirect('admin/contactblock');
|
||||
$a->internalRedirect('admin/contactblock');
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -569,7 +569,7 @@ function admin_page_deleteitem_post(App $a)
|
|||
}
|
||||
|
||||
info(L10n::t('Item marked for deletion.') . EOL);
|
||||
$a->redirect('admin/deleteitem');
|
||||
$a->internalRedirect('admin/deleteitem');
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -965,7 +965,7 @@ function admin_page_site_post(App $a)
|
|||
$parsed = @parse_url($new_url);
|
||||
if (!is_array($parsed) || !x($parsed, 'host') || !x($parsed, 'scheme')) {
|
||||
notice(L10n::t("Can not parse base url. Must have at least <scheme>://<domain>"));
|
||||
$a->redirect('admin/site');
|
||||
$a->internalRedirect('admin/site');
|
||||
}
|
||||
|
||||
/* steps:
|
||||
|
@ -973,13 +973,13 @@ function admin_page_site_post(App $a)
|
|||
* send relocate for every local user
|
||||
* */
|
||||
|
||||
$old_url = System::baseUrl(true);
|
||||
$old_url = $a->getBaseURL(true);
|
||||
|
||||
// Generate host names for relocation the addresses in the format user@address.tld
|
||||
$new_host = str_replace("http://", "@", normalise_link($new_url));
|
||||
$old_host = str_replace("http://", "@", normalise_link($old_url));
|
||||
|
||||
function update_table($table_name, $fields, $old_url, $new_url)
|
||||
function update_table(App $a, $table_name, $fields, $old_url, $new_url)
|
||||
{
|
||||
$dbold = DBA::escape($old_url);
|
||||
$dbnew = DBA::escape($new_url);
|
||||
|
@ -995,20 +995,20 @@ function admin_page_site_post(App $a)
|
|||
|
||||
if (!DBA::isResult($r)) {
|
||||
notice("Failed updating '$table_name': " . DBA::errorMessage());
|
||||
$a->redirect('admin/site');
|
||||
$a->internalRedirect('admin/site');
|
||||
}
|
||||
}
|
||||
// update tables
|
||||
// update profile links in the format "http://server.tld"
|
||||
update_table("profile", ['photo', 'thumb'], $old_url, $new_url);
|
||||
update_table("term", ['url'], $old_url, $new_url);
|
||||
update_table("contact", ['photo', 'thumb', 'micro', 'url', 'nurl', 'alias', 'request', 'notify', 'poll', 'confirm', 'poco', 'avatar'], $old_url, $new_url);
|
||||
update_table("gcontact", ['url', 'nurl', 'photo', 'server_url', 'notify', 'alias'], $old_url, $new_url);
|
||||
update_table("item", ['owner-link', 'author-link', 'body', 'plink', 'tag'], $old_url, $new_url);
|
||||
update_table($a, "profile", ['photo', 'thumb'], $old_url, $new_url);
|
||||
update_table($a, "term", ['url'], $old_url, $new_url);
|
||||
update_table($a, "contact", ['photo', 'thumb', 'micro', 'url', 'nurl', 'alias', 'request', 'notify', 'poll', 'confirm', 'poco', 'avatar'], $old_url, $new_url);
|
||||
update_table($a, "gcontact", ['url', 'nurl', 'photo', 'server_url', 'notify', 'alias'], $old_url, $new_url);
|
||||
update_table($a, "item", ['owner-link', 'author-link', 'body', 'plink', 'tag'], $old_url, $new_url);
|
||||
|
||||
// update profile addresses in the format "user@server.tld"
|
||||
update_table("contact", ['addr'], $old_host, $new_host);
|
||||
update_table("gcontact", ['connect', 'addr'], $old_host, $new_host);
|
||||
update_table($a, "contact", ['addr'], $old_host, $new_host);
|
||||
update_table($a, "gcontact", ['connect', 'addr'], $old_host, $new_host);
|
||||
|
||||
// update config
|
||||
Config::set('system', 'hostname', parse_url($new_url, PHP_URL_HOST));
|
||||
|
@ -1024,7 +1024,7 @@ function admin_page_site_post(App $a)
|
|||
|
||||
info("Relocation started. Could take a while to complete.");
|
||||
|
||||
$a->redirect('admin/site');
|
||||
$a->internalRedirect('admin/site');
|
||||
}
|
||||
// end relocate
|
||||
|
||||
|
@ -1298,7 +1298,7 @@ function admin_page_site_post(App $a)
|
|||
Config::set('system', 'rino_encrypt', $rino);
|
||||
|
||||
info(L10n::t('Site settings updated.') . EOL);
|
||||
$a->redirect('admin/site');
|
||||
$a->internalRedirect('admin/site');
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -1570,7 +1570,7 @@ function admin_page_dbsync(App $a)
|
|||
Config::set('system', 'build', intval($curr) + 1);
|
||||
}
|
||||
info(L10n::t('Update has been marked successful') . EOL);
|
||||
$a->redirect('admin/dbsync');
|
||||
$a->internalRedirect('admin/dbsync');
|
||||
}
|
||||
|
||||
if (($a->argc > 2) && (intval($a->argv[2]) || ($a->argv[2] === 'check'))) {
|
||||
|
@ -1745,7 +1745,7 @@ function admin_page_users_post(App $a)
|
|||
user_deny($hash);
|
||||
}
|
||||
}
|
||||
$a->redirect('admin/users');
|
||||
$a->internalRedirect('admin/users');
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -1768,7 +1768,7 @@ function admin_page_users(App $a)
|
|||
$user = DBA::selectFirst('user', ['username', 'blocked'], ['uid' => $uid]);
|
||||
if (!DBA::isResult($user)) {
|
||||
notice('User not found' . EOL);
|
||||
$a->redirect('admin/users');
|
||||
$a->internalRedirect('admin/users');
|
||||
return ''; // NOTREACHED
|
||||
}
|
||||
switch ($a->argv[2]) {
|
||||
|
@ -1788,7 +1788,7 @@ function admin_page_users(App $a)
|
|||
notice(sprintf(($user['blocked'] ? L10n::t("User '%s' unblocked") : L10n::t("User '%s' blocked")), $user['username']) . EOL);
|
||||
break;
|
||||
}
|
||||
$a->redirect('admin/users');
|
||||
$a->internalRedirect('admin/users');
|
||||
return ''; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -1986,7 +1986,7 @@ function admin_page_addons(App $a)
|
|||
info(L10n::t("Addon %s enabled.", $addon));
|
||||
}
|
||||
Config::set("system", "addon", implode(", ", $a->addons));
|
||||
$a->redirect('admin/addons');
|
||||
$a->internalRedirect('admin/addons');
|
||||
return ''; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -2045,7 +2045,7 @@ function admin_page_addons(App $a)
|
|||
BaseModule::checkFormSecurityTokenRedirectOnError($a->getBaseURL() . '/admin/addons', 'admin_themes', 't');
|
||||
Addon::reload();
|
||||
info("Addons reloaded");
|
||||
$a->redirect('admin/addons');
|
||||
$a->internalRedirect('admin/addons');
|
||||
}
|
||||
|
||||
$addons = [];
|
||||
|
@ -2235,7 +2235,7 @@ function admin_page_themes(App $a)
|
|||
}
|
||||
|
||||
Config::set('system', 'allowed_themes', $s);
|
||||
$a->redirect('admin/themes');
|
||||
$a->internalRedirect('admin/themes');
|
||||
return ''; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -2316,7 +2316,7 @@ function admin_page_themes(App $a)
|
|||
}
|
||||
}
|
||||
info("Themes reloaded");
|
||||
$a->redirect('admin/themes');
|
||||
$a->internalRedirect('admin/themes');
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2365,7 +2365,7 @@ function admin_page_logs_post(App $a)
|
|||
}
|
||||
|
||||
info(L10n::t("Log settings updated."));
|
||||
$a->redirect('admin/logs');
|
||||
$a->internalRedirect('admin/logs');
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
@ -2513,7 +2513,7 @@ function admin_page_features_post(App $a)
|
|||
}
|
||||
}
|
||||
|
||||
$a->redirect('admin/features');
|
||||
$a->internalRedirect('admin/features');
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue