- $file = PATH."theme/".$_POST['theme']."/theme.php";
- if (file_exists($file))
- {
- include($file);
- $result = SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_themes (theme_path, theme_active, theme_ver)
-VALUES ('%s', 'N', '%s')",
- array($_POST['theme'], $THEME_VERSION), __FILE__, __LINE__);
+ $file = sprintf("%stheme/%s/theme.php", PATH, SQL_ESCAPE($_POST['theme']));
+ if (FILE_READABLE($file)) {
+ // Load the theme header file
+ require($file);
+
+ // Register it ith the exchange
+ SQL_QUERY_ESC("INSERT INTO `"._MYSQL_PREFIX."_themes` (`theme_path`, `theme_active`, `theme_ver`, `theme_name`)
+VALUES ('%s','N','%s','%s')",
+ array($_POST['theme'], $THEME_VERSION, $THEME_NAME), __FILE__, __LINE__);
+
+ // Destroy cache
+ REBUILD_CACHE("themes", "them");
+
+ // Prepare message