mirror of
https://github.com/friendica/friendica
synced 2025-04-27 21:10: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
|
@ -5,6 +5,7 @@
|
|||
namespace Friendica\Core;
|
||||
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Network\HTTPException\InternalServerErrorException;
|
||||
use Friendica\Util\XML;
|
||||
|
||||
/**
|
||||
|
@ -236,6 +237,23 @@ class System extends BaseObject
|
|||
return max($load_arr[0], $load_arr[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirects to an external URL (fully qualified URL)
|
||||
* If you want to route relative to the current Friendica base, use App->internalRedirect()
|
||||
*
|
||||
* @param string $url The new Location to redirect
|
||||
* @throws InternalServerErrorException If the URL is not fully qualified
|
||||
*/
|
||||
public static function externalRedirect($url)
|
||||
{
|
||||
if (!filter_var($url, FILTER_VALIDATE_URL)) {
|
||||
throw new InternalServerErrorException('URL is not a fully qualified URL, please use App->internalRedirect() instead');
|
||||
}
|
||||
|
||||
header("Location: $url");
|
||||
exit();
|
||||
}
|
||||
|
||||
/// @todo Move the following functions from boot.php
|
||||
/*
|
||||
function killme()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue