Index: trunk/kernel/include/theme.php =================================================================== diff -u -r3124 -r3330 --- trunk/kernel/include/theme.php (.../theme.php) (revision 3124) +++ trunk/kernel/include/theme.php (.../theme.php) (revision 3330) @@ -23,7 +23,9 @@ { global $objSession; - if ($this->Data[$name] != $value) { + if (!isset($this->Data[$name]) ) return false; + + if ( $this->Data[$name] != $value) { //echo "$name Modified tt ".$this->Data[$name]." tt $value
"; if (!stristr($name, 'File') && !stristr($name, 'Theme')) { if ($objSession->GetVariable("HasChanges") != 1) { @@ -683,17 +685,18 @@ } } - function GetPrimaryTheme($field="ThemeId") + function GetPrimaryTheme($field = 'ThemeId') { - $sql = "SELECT * FROM ".$this->SourceTable." WHERE PrimaryTheme=1"; - $rs = $this->adodbConnection->Execute($sql); - if($rs && !$rs->EOF) - { - $l = $rs->fields[$field]; - } - else - $l = 0; - return $l; + static $primary_theme = 0, $skip_quering = false; + if ($skip_quering) return $primary_theme; + + if (!$primary_theme) + { + $sql = 'SELECT '.$field.' FROM '.$this->SourceTable.' WHERE PrimaryTheme = 1'; + $primary_theme = $this->adodbConnection->GetOne($sql); + $skip_quering = true; + } + return $primary_theme; } function CreateMissingThemes($compile_css = false) @@ -755,19 +758,13 @@ if($compile_css) { - define('FULL_PATH', realpath(dirname(__FILE__).'/../..')); - define('APPLICATION_CLASS', 'MyApplication'); - include_once(FULL_PATH.'/kernel/kernel4/startup.php'); $application =& kApplication::Instance(); - $application->Init(); - - $application->setUnitOption('css', 'AutoLoad', false); $css_table = $application->getUnitOption('css','TableName'); $css_idfield = $application->getUnitOption('css','IDField'); foreach($css_hash as $stylesheet_id) { - $css_item =& $application->recallObject('css'); + $css_item =& $application->recallObject('css', null, Array('skip_autoload' => true) ); $css_item->Load($stylesheet_id); $css_item->Compile(); }