瀏覽代碼

Move the is_dir and real_path inside the while

Signed-off-by: Suki <[email protected]>
Suki 10 年之前
父節點
當前提交
751fefc715
共有 1 個文件被更改,包括 11 次插入3 次删除
  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;
 }