diff options
author | James Atkinson <thefinn@users.sourceforge.net> | 2001-04-20 07:30:45 +0000 |
---|---|---|
committer | James Atkinson <thefinn@users.sourceforge.net> | 2001-04-20 07:30:45 +0000 |
commit | 42039bc31a39b3c29bb1700dc5b0a3ea5b8348ed (patch) | |
tree | 1ab1298273af80ec1cd4bf1776f2e0da094173b4 /phpBB/includes/functions.php | |
parent | e150b48726535fa2639449a1bb2ad6b9e015dfe9 (diff) | |
download | forums-42039bc31a39b3c29bb1700dc5b0a3ea5b8348ed.tar forums-42039bc31a39b3c29bb1700dc5b0a3ea5b8348ed.tar.gz forums-42039bc31a39b3c29bb1700dc5b0a3ea5b8348ed.tar.bz2 forums-42039bc31a39b3c29bb1700dc5b0a3ea5b8348ed.tar.xz forums-42039bc31a39b3c29bb1700dc5b0a3ea5b8348ed.zip |
Added user selectable templates, and put the system template into the config database. Updated mysql_schema as well
git-svn-id: file:///svn/phpbb/trunk@200 89ea8834-ac86-4346-8a33-228a782c2dd0
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")) { |