diff options
| author | Paul S. Owen <psotfx@users.sourceforge.net> | 2001-04-15 14:14:56 +0000 |
|---|---|---|
| committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2001-04-15 14:14:56 +0000 |
| commit | 7791a3126090aef74a00e0b85f3d7779819e75c3 (patch) | |
| tree | 82821f4c3e9b4b7aa72a715a1c971900019cfc90 /phpBB/functions/functions.php | |
| parent | e63c33bb2c82ad59dcc1e21c08041fc7a7973ef0 (diff) | |
| download | forums-7791a3126090aef74a00e0b85f3d7779819e75c3.tar forums-7791a3126090aef74a00e0b85f3d7779819e75c3.tar.gz forums-7791a3126090aef74a00e0b85f3d7779819e75c3.tar.bz2 forums-7791a3126090aef74a00e0b85f3d7779819e75c3.tar.xz forums-7791a3126090aef74a00e0b85f3d7779819e75c3.zip | |
Session code updates
git-svn-id: file:///svn/phpbb/trunk@143 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/functions/functions.php')
| -rw-r--r-- | phpBB/functions/functions.php | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/phpBB/functions/functions.php b/phpBB/functions/functions.php index cc387ecde0..6345630813 100644 --- a/phpBB/functions/functions.php +++ b/phpBB/functions/functions.php @@ -178,6 +178,101 @@ function theme_select($default, $db) return($theme_select); } +// +// Initialise user settings on page load +// +function init_userprefs($userdata) +{ + + global $override_user_theme; + global $bgcolor, $table_bgcolor, $textcolor, $category_title, $table_header; + global $color1, $color2, $header_image, $newtopic_image; + global $reply_locked_image, $reply_image, $linkcolor, $vlinkcolor; + global $default_lang, $date_format, $sys_timezone; + + if(!$override_user_theme) + { + if($userdata['user_id'] != ANONYMOUS || $userdata['user_id'] != DELETED) + { + $theme = setuptheme($userdata["user_theme"]); + } + else + { + $theme = setuptheme($default_theme); + } + } + else + { + $theme = setuptheme($override_user_theme); + } + if($theme) + { + $bgcolor = $theme["bgcolor"]; + $table_bgcolor = $theme["table_bgcolor"]; + $textcolor = $theme["textcolor"]; + $category_title = $theme["category_title"]; + $table_header = $theme["table_header"]; + $color1 = $theme["color1"]; + $color2 = $theme["color2"]; + $header_image = $theme["header_image"]; + $newtopic_image = $theme["newtopic_image"]; + $reply_locked_image = $theme["reply_locked_image"]; + $reply_image = $theme["reply_image"]; + $linkcolor = $theme["linkcolor"]; + $vlinkcolor = $theme["vlinkcolor"]; + } + if($userdata["user_lang"] != "") + { + $default_lang = $userdata["user_lang"]; + } + if($userdata["user_dateformat"] != "") + { + $date_format = $userdata["user_dateformat"]; + } + if($userdata["user_timezone"]) + { + $sys_timezone = $userdata["user_timezone"]; + } + + // Include the appropriate language file ... if it exists. + if(!strstr($PHP_SELF, "admin")) + { + if(file_exists('language/lang_'.$default_lang.'.'.$phpEx)) + { + include('language/lang_'.$default_lang.'.'.$phpEx); + } + } + else + { + if(strstr($PHP_SELF, "topicadmin")) + { + include('language/lang_'.$default_lang.'.'.$phpEx); + } + else + { + include('../language/lang_'.$default_lang.'.'.$phpEx); + } + } + + return; + +} +function setuptheme($theme) +{ + global $db; + + $sql = "SELECT * + FROM ".THEMES_TABLE." + WHERE theme_id = '$theme'"; + if(!$result = $db->sql_query($sql)) + return(0); + + if(!$myrow = $db->sql_fetchrow($result)) + return(0); + + return($myrow); +} + function tz_select($default) { global $board_tz; |
