mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Restricted RootURLController's REGEXP call to MySQL databases only.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@66424 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
d2d22aa2d7
commit
8eed347ca2
@ -34,10 +34,15 @@ class RootURLController extends Controller {
|
||||
* Return the URL segment for the current HTTP_HOST value
|
||||
*/
|
||||
static function get_homepage_urlsegment() {
|
||||
$host = $_SERVER['HTTP_HOST'];
|
||||
$host = str_replace('www.','',$host);
|
||||
$SQL_host = str_replace('.','\\.',Convert::raw2sql($host));
|
||||
$homePageOBJ = DataObject::get_one("SiteTree", "HomepageForDomain REGEXP '(,|^) *$SQL_host *(,|\$)'");
|
||||
// Temporarily restricted to MySQL database while testing db abstraction
|
||||
if(DB::getConn() instanceof MySQLDatabase) {
|
||||
$host = $_SERVER['HTTP_HOST'];
|
||||
$host = str_replace('www.','',$host);
|
||||
$SQL_host = str_replace('.','\\.',Convert::raw2sql($host));
|
||||
$homePageOBJ = DataObject::get_one("SiteTree", "HomepageForDomain REGEXP '(,|^) *$SQL_host *(,|\$)'");
|
||||
} else {
|
||||
$homePageOBJ = null;
|
||||
}
|
||||
|
||||
if($homePageOBJ) {
|
||||
return $homePageOBJ->URLSegment;
|
||||
|
Loading…
x
Reference in New Issue
Block a user