mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #10027 from chrometoasters/pulls/director-extension-point-4.8
NEW Add extension point to Director::is_site_url
This commit is contained in:
commit
0ea36ad5d6
@ -854,6 +854,9 @@ class Director implements TemplateGlobalProvider
|
|||||||
* Useful to check before redirecting based on a URL from user submissions through $_GET or $_POST,
|
* Useful to check before redirecting based on a URL from user submissions through $_GET or $_POST,
|
||||||
* and avoid phishing attacks by redirecting to an attackers server.
|
* and avoid phishing attacks by redirecting to an attackers server.
|
||||||
*
|
*
|
||||||
|
* Provides an extension point to allow extra checks on the URL to allow some external URLs,
|
||||||
|
* e.g. links on secondary domains that point to the same CMS, or subsite domains.
|
||||||
|
*
|
||||||
* @param string $url
|
* @param string $url
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
@ -871,6 +874,13 @@ class Director implements TemplateGlobalProvider
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Allow extensions to weigh in
|
||||||
|
$isSiteUrl = false;
|
||||||
|
static::singleton()->extend('updateIsSiteUrl', $isSiteUrl, $url);
|
||||||
|
if ($isSiteUrl) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Relative urls always are site urls
|
// Relative urls always are site urls
|
||||||
return self::is_relative_url($url);
|
return self::is_relative_url($url);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user