function setup_style($style) { global $db, $board_config, $template, $images, $phpbb_root_path; $sql = "SELECT * FROM " . THEMES_TABLE . " WHERE themes_id = $style"; if ( !($result = $db->sql_query($sql)) ) { message_die(CRITICAL_ERROR, 'Could not query database for theme info'); } if ( !($row = $db->sql_fetchrow($result)) ) { message_die(CRITICAL_ERROR, "Could not get theme data for themes_id [$style]"); } $template_name = $row['template_name'] ; $template = new Template(); if ( $template ) { $template->set_style_name($template_name); $cfg_file_name = get_file_path($template_name . '.cfg', '/design/phpbb/templates/' . $template_name . '/'); @include($cfg_file_name); if ( !defined('TEMPLATE_CONFIG') ) { message_die(CRITICAL_ERROR, "Could not open $template_name template config file", '', __LINE__, __FILE__); } if(file_exists(PROJECT_DIR . '/design/phpbb/templates/' . $template_name . '/images/lang_' . $board_config['default_lang'])) $img_lang = $board_config['default_lang']; elseif(file_exists(LIMB_DIR . '/design/phpbb/templates/' . $template_name . '/images/lang_' . $board_config['default_lang'])) $img_lang = $board_config['default_lang']; else message_die(CRITICAL_ERROR, 'Could not find images folder', '', __LINE__, __FILE__); while( list($key, $value) = @each($images) ) { if ( !is_array($value) ) { $images[$key] = str_replace('{LANG}', 'lang_' . $img_lang, $value); $images[$key] = get_file_path($images[$key], '/design/phpbb/templates/' . $template_name . '/images/'); } else { foreach(array_keys($images[$key]) as $sub_key) $images[$key][$sub_key] = get_file_path($images[$key][$sub_key], '/design/phpbb/templates/' . $template_name . '/images/'); } } } return $row; }