Bugfixing redirects
- Adding App->redirect if both redirects are possible
This commit is contained in:
parent
9c9ebfc7c9
commit
48535c0959
4 changed files with 25 additions and 19 deletions
18
src/App.php
18
src/App.php
|
@ -8,6 +8,7 @@ use Detection\MobileDetect;
|
|||
use DOMDocument;
|
||||
use DOMXPath;
|
||||
use Exception;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\Network\HTTPException\InternalServerErrorException;
|
||||
|
||||
|
@ -2006,4 +2007,21 @@ class App
|
|||
$redirectTo = $this->getBaseURL($ssl) . '/' . ltrim($toUrl, '/');
|
||||
Core\System::externalRedirect($redirectTo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirects to another URL in case
|
||||
* Should only be used if it isn't clear if the URL is either internal or external
|
||||
*
|
||||
* @param string $toUrl The target URL
|
||||
*
|
||||
*/
|
||||
public function redirect($toUrl)
|
||||
{
|
||||
if (filter_var($toUrl, FILTER_VALIDATE_URL))
|
||||
{
|
||||
System::externalRedirect($toUrl);
|
||||
} else {
|
||||
$this->internalRedirect($toUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue