Index: branches/5.1.x/core/units/themes/theme_item.php =================================================================== diff -u -N -r13168 -r13559 --- branches/5.1.x/core/units/themes/theme_item.php (.../theme_item.php) (revision 13168) +++ branches/5.1.x/core/units/themes/theme_item.php (.../theme_item.php) (revision 13559) @@ -1,6 +1,6 @@ Application->siteDomainField('PrimaryThemeId'); + + if (!$id) { + $id = 1; + $id_field_name = 'PrimaryTheme'; + } + $default = true; } $res = parent::Load($id, $id_field_name, true); + if ($res) { + $available_themes = $this->Application->siteDomainField('Themes'); + + if ($available_themes) { + if (strpos($available_themes, '|' . $this->GetID() . '|') === false) { + // theme isn't allowed in site domain + return $this->Clear(); + } + } + } + if ($default) { if (!$res) { if ($this->Application->isAdmin) {