Index: branches/RC/core/units/themes/themes_eh.php =================================================================== diff -u -r9324 -r9836 --- branches/RC/core/units/themes/themes_eh.php (.../themes_eh.php) (revision 9324) +++ branches/RC/core/units/themes/themes_eh.php (.../themes_eh.php) (revision 9836) @@ -1,7 +1,7 @@ Array('self' => true), 'OnChangeTheme' => Array('self' => true), ); - + $this->permMapping = array_merge($this->permMapping, $permissions); } - + /** * Allows to set selected theme as primary * @@ -33,26 +33,26 @@ $id = array_shift($ids); $this->setPrimary($id); } - + $this->clearSelectedIDs($event); } - + function setPrimary($id) { $id_field = $this->Application->getUnitOption($this->Prefix, 'IDField'); $table_name = $this->Application->getUnitOption($this->Prefix, 'TableName'); - + $sql = 'UPDATE '.$table_name.' SET PrimaryTheme = 0'; $this->Conn->Query($sql); - + $sql = 'UPDATE '.$table_name.' SET PrimaryTheme = 1, Enabled = 1 WHERE '.$id_field.' = '.$id; $this->Conn->Query($sql); } - + /** * Set correct parent path for newly created categories * @@ -62,14 +62,14 @@ { $object =& $this->Application->recallObject($event->Prefix.'.-item', null, Array('skip_autoload' => true, 'live_table' => true)); /* @var $object kDBItem */ - + $object->Load($event->getEventParam('id')); - + if ($object->GetDBField('PrimaryTheme')) { $this->setPrimary($event->getEventParam('id')); } } - + /** * Allows to change the theme * @@ -79,9 +79,16 @@ { $this->Application->SetVar('t', 'index'); $this->Application->SetVar('m_cat_id', 0); + + if (MOD_REWRITE) { + foreach ($this->Application->ModuleInfo as $module_name => $module_data) { + $this->Application->DeleteVar($module_data['Var'].'_Page'); + } + } + $this->Application->SetVar('m_theme', $this->Application->GetVar('theme')); } - + /** * Apply system filter to themes list * @@ -90,11 +97,11 @@ function SetCustomQuery(&$event) { parent::SetCustomQuery($event); - + $object =& $event->getObject(); /* @var $object kDBList */ - - $object->addFilter('enabled', '%1$s.Enabled = 1'); + + $object->addFilter('enabled', '%1$s.Enabled = 1'); } }