code/SiteConfigSubsites.php
/**
	 * Update any requests to limit the results to the current site
	 */
Update any requests to limit the results to the current site
Update any requests to limit the results to the current site
function augmentSQL(SQLQuery &$query) {
		if(Subsite::$disable_subsite_filter) return;
		if (!$query->where || (!preg_match('/\.(\'|"|`|)ID(\'|"|`|)( ?)=/', $query->where[0]) && !preg_match('/\.?(\'|"|`|)SubsiteID(\'|"|`|)( ?)=/', $query->where[0]))) {
			if($context = DataObject::context_obj()) $subsiteID = (int)$context->SubsiteID;
			else $subsiteID = (int)Subsite::currentSubsiteID();
			$tableName = array_shift(array_keys($query->from));
			if($tableName != 'SiteConfig') return;
			$query->where[] = "\"$tableName\".\"SubsiteID\" IN ($subsiteID)";
		}
	}
function augmentSQL ( SQLQuery & $ query ) { if ( Subsite :: $ disable_subsite_filter ) return ; if ( ! $ query -> where || ( ! preg_match ( '/\.(\'|"|`|)ID(\'|"|`|)( ?)=/' , $ query -> where [ 0 ] ) && ! preg_match ( '/\.?(\'|"|`|)SubsiteID(\'|"|`|)( ?)=/' , $ query -> where [ 0 ] ) ) ) { if ( $ context = DataObject :: context_obj ( ) ) $ subsiteID = ( int ) $ context -> SubsiteID ; else $ subsiteID = ( int ) Subsite :: currentSubsiteID ( ) ; $ tableName = array_shift ( array_keys ( $ query -> from ) ) ; if ( $ tableName != 'SiteConfig' ) return ; $ query -> where [ ] = " \" $ tableName \" . \" SubsiteID \"  IN ( $ subsiteID ) " ; } }
Update any requests to limit the results to the current site
Update any requests to limit the results to the current site
// If you're querying by ID, ignore the sub-site - this is a bit ugly...