Index: trunk/core/kernel/application.php =================================================================== diff -u -N -r4529 -r4567 --- trunk/core/kernel/application.php (.../application.php) (revision 4529) +++ trunk/core/kernel/application.php (.../application.php) (revision 4567) @@ -252,15 +252,16 @@ function VerifyLanguageId() { $language_id = $this->GetVar('m_lang'); - if($language_id) - { + if ($language_id) { $table = $this->getUnitOption('lang', 'TableName'); $id_field = $this->getUnitOption('lang', 'IDField'); - $language_ids = $this->DB->GetCol('SELECT '.$id_field.' FROM '.$table); + $sql = 'SELECT '.$id_field.' + FROM '.$table.' + WHERE Enabled = 1'; + $language_ids = $this->DB->GetCol($sql); } - if ( !$language_id || !in_array($language_id, $language_ids) ) - { + if (!$language_id || !in_array($language_id, $language_ids)) { $this->SetVar('m_lang', $this->GetDefaultLanguageId() ); } $this->SetVar('lang.current_id', $this->GetVar('m_lang') ); @@ -273,15 +274,16 @@ function VerifyThemeId() { $theme_id = $this->GetVar('m_theme'); - if($theme_id) - { + if ($theme_id) { $table = $this->getUnitOption('theme', 'TableName'); $id_field = $this->getUnitOption('theme', 'IDField'); - $theme_ids = $this->DB->GetCol('SELECT '.$id_field.' FROM '.$table); + $sql = 'SELECT '.$id_field.' + FROM '.$table.' + WHERE Enabled = 1'; + $theme_ids = $this->DB->GetCol($sql); } - if ( !$theme_id || !in_array($theme_id, $theme_ids) ) - { + if (!$theme_id || !in_array($theme_id, $theme_ids)) { $this->SetVar('m_theme', $this->GetDefaultThemeId() ); } $this->SetVar('theme.current_id', $this->GetVar('m_theme') ); @@ -295,7 +297,10 @@ $table = $this->getUnitOption('lang','TableName'); $id_field = $this->getUnitOption('lang','IDField'); - $language_id = $this->DB->GetOne('SELECT '.$id_field.' FROM '.$table.' WHERE PrimaryLang = 1'); + $sql = 'SELECT '.$id_field.' + FROM '.$table.' + WHERE (PrimaryLang = 1) AND (Enabled = 1)'; + $language_id = $this->DB->GetOne($sql); return $language_id; } @@ -306,15 +311,16 @@ if($theme_id > 0) return $theme_id; - if ( constOn('DBG_FORCE_THEME') ) - { + if (constOn('DBG_FORCE_THEME')) { $theme_id = DBG_FORCE_THEME; } - else - { + else { $table = $this->getUnitOption('theme','TableName'); $id_field = $this->getUnitOption('theme','IDField'); - $theme_id = $this->DB->GetOne('SELECT '.$id_field.' FROM '.$table.' WHERE PrimaryTheme = 1'); + $sql = 'SELECT '.$id_field.' + FROM '.$table.' + WHERE (PrimaryTheme = 1) AND (Enabled = 1)'; + $theme_id = $this->DB->GetOne($sql); } return $theme_id; }