Index: trunk/kernel/include/theme.php =================================================================== diff -u -r1016 -r1054 --- trunk/kernel/include/theme.php (.../theme.php) (revision 1016) +++ trunk/kernel/include/theme.php (.../theme.php) (revision 1054) @@ -497,17 +497,29 @@ { fwrite($fp,''); fclose($fp); +// $this->Files->FindMissingFiles($this->Get('name')); + /* $theme_id = $this->Get('ThemeId'); + $db_dir = '/'.strtolower($this->Get('Name')); + $sql = 'INSERT INTO '.GetTablePrefix().'ThemeFiles + (ThemeId, FileName, FilePath, Description, FileType) VALUES + ('.$theme_id.', "index.tpl", "'.$db_dir.'", "", 0)'; + $conn = &GetADODBConnection(); + $conn->Execute($sql);*/ } - } } function Delete() { $this->Files->DeleteAll(); $dir = $this->ThemeDirectory(); - if(is_writable($dir)) + if(is_writable($dir)) { + $files = filelist($dir); + foreach ($files as $file) { + @unlink($file); + } @rmdir($dir); + } parent::Delete(); } @@ -616,7 +628,7 @@ { $sql = "UPDATE ".$this->SourceTable." SET PrimaryTheme=0 WHERE ThemeId != ".$t->Get("ThemeId"); $this->adodbConnection->Execute($sql); - } + } return $t; } @@ -645,7 +657,7 @@ function DeleteTheme($ThemeId) { $t = $this->GetItem($ThemeId); - $t->Delete(); + if (!$t->Get('PrimaryTheme')) $t->Delete(); } function SetPrimaryTheme($ThemeId) @@ -753,6 +765,7 @@ { $c->UnsetIdField(); $c->Create(); + $GLOBALS['m_var_list']['theme_id']=$c->Get('ThemeId'); $c->CreateDirectory(); } if($c->Get("PrimaryTheme"))