Browse Source

Theme's name should be taken from the xml file

Signed-off-by: Suki <[email protected]>
Suki 11 years ago
parent
commit
843d282eef
2 changed files with 10 additions and 5 deletions
  1. 0 1
      Sources/Subs-Themes.php
  2. 10 4
      Sources/Themes.php

+ 0 - 1
Sources/Subs-Themes.php

@@ -124,7 +124,6 @@ function theme_install($to_install = array())
 	// Defaults.
 	$context['to_install'] = array(
 		'theme_url' => $boardurl . '/Themes/' . basename($context['to_install']['dir']),
-		'name' => $theme_name
 	);
 
 	// This vars could have been set, it all depends from where are we coming.

+ 10 - 4
Sources/Themes.php

@@ -1341,7 +1341,6 @@ function InstallFile()
 
 	// Start setting some vars.
 	$context['to_install'] = array(
-		'name' => $theme_name,
 		'dir' => $themedir . '/' . $theme_name,
 	);
 
@@ -1350,7 +1349,6 @@ function InstallFile()
 
 	if ($extracted)
 	{
-
 		// Read its info form the XML file.
 		$context['to_install'] += get_theme_info($context['to_install']['dir']);
 
@@ -1379,9 +1377,17 @@ function InstallDir()
 
 	// All good! set some needed vars.
 		$context['to_install'] = array(
-		'name' => $theme_name,
-		'dir' => $themedir . '/' . $theme_name,
+		'dir' => $_REQUEST['theme_dir'],
 	);
+
+	// Read its info form the XML file.
+	$context['to_install'] += get_theme_info($context['to_install']['dir']);
+
+	// Install the theme. theme_install() will take care of possible errors.
+	$id = theme_install($context['to_install']);
+
+	// return the ID.
+	return $id;
 }
 
 /**