# HG changeset patch # User Dan # Date 1241975584 14400 # Node ID 178d22e361d68f2370dc0ce9b0553b502a20612b # Parent b69d36dc637e59dbeb4a102377d4517e94ccbcf1 Now skips any of the included/localized backgrounds if they don't exist. diff -r b69d36dc637e -r 178d22e361d6 plugins/EnaniumBackgrounds.php --- a/plugins/EnaniumBackgrounds.php Sun May 10 12:53:22 2009 -0400 +++ b/plugins/EnaniumBackgrounds.php Sun May 10 13:13:04 2009 -0400 @@ -15,7 +15,8 @@ $plugins->attachHook('compile_template', 'enanium_add_headers();'); $plugins->attachHook('acl_rule_init', '$this->addAdminNode("adm_cat_appearance", "enaniumbg_acppage", "EnaniumConfig", scriptPath . "/plugins/enaniumbg/icons/garden.png");'); -$ebg_images = array('default', 'aqua', 'blinds', 'dune', 'freshflower', 'garden', 'greenmeadow', 'ladybird', 'raindrops', 'storm', 'twowings', 'wood', 'yellowflower'); +$ebg_system_images = array('default', 'aqua', 'blinds', 'dune', 'freshflower', 'garden', 'greenmeadow', 'ladybird', 'raindrops', 'storm', 'twowings', 'wood', 'yellowflower'); +$ebg_images = array(); $ebg_outsiders = array(); if ( $dr = @opendir(ENANO_ROOT . '/plugins/enaniumbg') ) @@ -30,8 +31,11 @@ $dh = preg_replace('/\.jpg$/', '', $dh); - if ( in_array($dh, $ebg_images) ) + if ( in_array($dh, $ebg_system_images) ) + { + $ebg_images[] = $dh; continue; + } if ( !file_exists(ENANO_ROOT . "/plugins/enaniumbg/icons/$dh.png") ) continue; @@ -44,7 +48,7 @@ function enanium_paint_bg_controls() { - global $ebg_images, $ebg_outsiders; + global $ebg_system_images, $ebg_images, $ebg_outsiders; global $lang; if ( !getConfig('enanium_show_switcher', 1) ) @@ -53,8 +57,11 @@ ?>
$image ) + foreach ( $ebg_system_images as $i => $image ) { + if ( !in_array($image, $ebg_images) ) + continue; + $sel = ( $image == getConfig('enanium_bg', 'default') ) ? ' class="selected"' : ''; echo ''; echo enanium_generate_sprite(scriptPath . '/plugins/enaniumbg/icons/sprite.png', 16, 16, 0, $i * 16);