don't load custom themes without base themes

git-svn-id: file:///home/shish/svn/shimmie2/trunk@722 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
shish 2008-02-17 09:25:49 +00:00
parent c7c33a1a8d
commit 979ab9a013
2 changed files with 20 additions and 2 deletions

View file

@ -308,6 +308,15 @@ function array_add($array, $element) {
return $array;
}
function array_contains($array, $target) {
foreach($array as $element) {
if($target == $element) {
return true;
}
}
return false;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
* Event API *

View file

@ -49,12 +49,21 @@ require_once "themes/$_theme/layout.class.php";
require_once "themes/$_theme/themelet.class.php";
$themelets = glob("ext/*/theme.php");
$custom_themelets = glob("themes/$_theme/*.theme.php");
if($custom_themelets) $themelets = array_merge($themelets, $custom_themelets);
foreach($themelets as $filename) {
require_once $filename;
}
$custom_themelets = glob("themes/$_theme/*.theme.php");
if($custom_themelets) {
foreach($custom_themelets as $filename) {
$basename = str_replace($filename, "themes/$_theme/", "");
$basename = str_replace($basename, ".theme.php", "");
if(array_contains($themelets, "ext/$basename/theme.php")) {
require_once $filename;
}
}
}
// start the page generation waterfall
$page = new Page();