diff options
author | Paul Arthur <flowerysong00@yahoo.com> | 2011-03-31 14:21:10 -0400 |
---|---|---|
committer | Paul Arthur <flowerysong00@yahoo.com> | 2011-03-31 14:21:10 -0400 |
commit | 91a6eb3a682667f49122fab5d807e8650c0d3959 (patch) | |
tree | 23850c1664ad342b3d9ed2c7c5cf138df2d2d144 | |
parent | d70300c284e19520dd69b63a973ce95b8408e7fc (diff) | |
download | ampache-91a6eb3a682667f49122fab5d807e8650c0d3959.tar.gz ampache-91a6eb3a682667f49122fab5d807e8650c0d3959.tar.bz2 ampache-91a6eb3a682667f49122fab5d807e8650c0d3959.zip |
Clean up theme config loading, add some debugging.
-rw-r--r-- | lib/themes.php | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/lib/themes.php b/lib/themes.php index db4fa17f..65028d19 100644 --- a/lib/themes.php +++ b/lib/themes.php @@ -40,28 +40,28 @@ function get_themes() { /* Open the themes dir and start reading it */ - $handle = @opendir(Config::get('prefix') . '/themes'); + $handle = opendir(Config::get('prefix') . '/themes'); if (!is_resource($handle)) { - debug_event('theme',"Error unable to open Themes Directory",'2'); + debug_event('theme', 'Failed to open /themes directory', 2); return array(); } $results = array(); - - while ($file = readdir($handle)) { - - $full_file = Config::get('prefix') . '/themes/' . $file; - /* See if it's a directory */ - if (is_dir($full_file) AND substr($file,0,1) != ".") { - $config_file = $full_file . '/theme.cfg.php'; - /* Open the theme.cfg.php file */ - $r = @parse_ini_file($config_file); - $r['path'] = $file; - $name = $r['name']; - $results[$name] = $r; + $theme_cfg = '/theme.cfg.php'; + + while (($f = readdir($handle)) !== false) { + debug_event('theme', "Checking $f", 5); + $file = Config::get('prefix') . '/themes/' . $f; + if (file_exists($file . $theme_cfg)) { + debug_event('theme', "Loading $theme_cfg from $f", 5); + $r = parse_ini_file($file . $theme_cfg); + $r['path'] = $f; + $results[$r['name']] = $r; + } + else { + debug_event('theme', "$theme_cfg not found in $f", 5); } - } // end while directory // Sort by the theme name |