From 40ff605fbfdd822edd031e3e7ac008b1f58cfb53 Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Mon, 1 Mar 2010 02:56:01 +0000 Subject: [PATCH] BUGFIX allow Subsite Virtual Pages to share a URL Segment (from r82346) --- code/SiteTreeSubsites.php | 3 +-- code/SubsitesVirtualPage.php | 12 ------------ 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/code/SiteTreeSubsites.php b/code/SiteTreeSubsites.php index bdffb2d..80be618 100644 --- a/code/SiteTreeSubsites.php +++ b/code/SiteTreeSubsites.php @@ -59,8 +59,7 @@ class SiteTreeSubsites extends DataObjectDecorator { else $q='`'; // If you're querying by ID, ignore the sub-site - this is a bit ugly... - if(!$query->where || (strpos($query->where[0], ".{$q}ID{$q} = ") === false && strpos($query->where[0], ".{$q}ID{$q} = ") === false && strpos($query->where[0], ".{$q}ID{$q} = ") === false && strpos($query->where[0], "{$q}ID{$q} = ") !== 0)) { - + if (!$query->where || (!preg_match('/\.(\'|"|`|)ID(\'|"|`|)( ?)=/', $query->where[0]))) { $context = DataObject::context_obj(); if($context && is_numeric($context->SubsiteID)) $subsiteID = (int) $context->SubsiteID; else $subsiteID = (int) Subsite::currentSubsiteID(); diff --git a/code/SubsitesVirtualPage.php b/code/SubsitesVirtualPage.php index 62f7cac..d43b39c 100644 --- a/code/SubsitesVirtualPage.php +++ b/code/SubsitesVirtualPage.php @@ -65,18 +65,6 @@ class SubsitesVirtualPage extends VirtualPage { return $fields; } - - function onBeforeWrite() { - Subsite::$disable_subsite_filter = true; - - parent::onBeforeWrite(); - } - - function onAfterWrite() { - Subsite::$disable_subsite_filter = false; - - parent::onAfterWrite(); - } } class SubsitesVirtualPage_Controller extends VirtualPage_Controller {