Browse Source

Move the is_dir and real_path inside the while

Signed-off-by: Suki <[email protected]>
Suki 11 years ago
parent
commit
751fefc715
1 changed files with 11 additions and 3 deletions
  1. 11 3
      Sources/Subs-Themes.php

+ 11 - 3
Sources/Subs-Themes.php

@@ -69,14 +69,22 @@ function get_single_theme($id)
 	);
 
 	while ($row = $smcFunc['db_fetch_assoc']($request))
+	{
 		$single[$row['variable']] = $row['value'];
 
-	// Fix the path and tell if its a valid one.
-	$single['theme_dir'] = realpath($single['theme_dir']);
-	$single['valid_path'] = file_exists($single['theme_dir']) && is_dir($single['theme_dir']);
+		// Fix the path and tell if its a valid one.
+		if ($row['variable'] == 'theme_dir')
+		{
+			$single['theme_dir'] = realpath($row['value']);
+			$single['valid_path'] = file_exists($row['value']) && is_dir($row['value']);
+		}
+	}
+
+	// Is this theme installed and enabled?
 	$single['known'] = in_array($single['id'], $knownThemes);
 	$single['enable'] = in_array($single['id'], $enableThemes);
 
+	// It should at least return if the theme is a known one or if its enable.
 	return $single;
 }