diff options
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r-- | phpBB/includes/functions.php | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 8bd31ba54e..000c51696c 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -140,6 +140,31 @@ function make_jumpbox() return($boxstring); } +// NOTE: This function should check is_dir($file), however the is_dir function seems to be buggy on my +// system so its not currently implemented that way +// - James +function template_select($default) +{ + $dir = opendir("templates"); + $template_select = "<select name=\"selected_template\">\n"; + while($file = readdir($dir)) + { + unset($selected); + + if($file != "." && $file != ".." && $file != "CVS") + { + if($file == $default) + { + $selected = " SELECTED"; + } + $template_select .= "<option value=\"$file\"$selected>$file</option>\n"; + } + } + $template_select .= "</select>"; + closedir($dir); + return($template_select); +} + function language_select($default, $name="language", $dirname="language/") { global $phpEx; @@ -163,7 +188,7 @@ function language_select($default, $name="language", $dirname="language/") function theme_select($default) { global $db; - + $sql = "SELECT theme_id, theme_name FROM ".THEMES_TABLE." ORDER BY theme_name"; if($result = $db->sql_query($sql)) { @@ -197,7 +222,7 @@ function theme_select($default) function init_userprefs($userdata) { - global $override_user_theme; + global $override_user_theme, $template, $sys_template; global $bgcolor, $table_bgcolor, $textcolor, $category_title, $table_header; global $color1, $color2, $header_image, $newtopic_image; global $reply_locked_image, $reply_image, $linkcolor, $vlinkcolor; @@ -247,6 +272,16 @@ function init_userprefs($userdata) $sys_timezone = $userdata["user_timezone"]; } + // Setup user's Template + if($userdata['user_template'] != '') + { + $template = new Template("templates/".$userdata['user_template']); + } + else + { + $template = new Template("templates/".$sys_template); + } + // Include the appropriate language file ... if it exists. if(!strstr($PHP_SELF, "admin")) { |