diff options
| author | Meik Sievertsen <acydburn@phpbb.com> | 2004-02-28 21:16:15 +0000 |
|---|---|---|
| committer | Meik Sievertsen <acydburn@phpbb.com> | 2004-02-28 21:16:15 +0000 |
| commit | 52cc21864c570170067e8d81d1af1f8d1a2a0291 (patch) | |
| tree | efcfe680c390b4f581a1758292a639b2f3da74f0 /phpBB/includes/session.php | |
| parent | 77dedf68a070197bdc4ace8809ab49b2df945847 (diff) | |
| download | forums-52cc21864c570170067e8d81d1af1f8d1a2a0291.tar forums-52cc21864c570170067e8d81d1af1f8d1a2a0291.tar.gz forums-52cc21864c570170067e8d81d1af1f8d1a2a0291.tar.bz2 forums-52cc21864c570170067e8d81d1af1f8d1a2a0291.tar.xz forums-52cc21864c570170067e8d81d1af1f8d1a2a0291.zip | |
splitted language files
git-svn-id: file:///svn/phpbb/trunk@4844 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/session.php')
| -rw-r--r-- | phpBB/includes/session.php | 99 |
1 files changed, 76 insertions, 23 deletions
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 81700c7415..55d9d6d603 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -453,6 +453,7 @@ class session class user extends session { var $lang = array(); + var $help = array(); var $theme = array(); var $date_format; var $timezone; @@ -467,7 +468,7 @@ class user extends session function setup($lang_set = false, $style = false) { - global $db, $template, $config, $auth, $phpEx, $phpbb_root_path; + global $db, $template, $config, $auth, $phpEx, $phpbb_root_path, $lang, $help; if ($this->data['user_id'] != ANONYMOUS) { @@ -514,28 +515,9 @@ class user extends session } } - include($this->lang_path . 'lang_main.' . $phpEx); - if (defined('IN_ADMIN')) - { - include($this->lang_path . 'lang_admin.' . $phpEx); - } - $this->lang = &$lang; - -/* if (is_array($lang_set)) - { - include($this->lang_path . '/common.' . $phpEx); - - foreach ($lang_set as $lang_file) - { - include($this->lang_path . '/' . $lang_file . '.' . $phpEx); - } - unset($lang_set); - } - else - { - include($this->lang_path . '/common.' . $phpEx); - include($this->lang_path . '/' . $lang_set . '.' . $phpEx); - }*/ + include($this->lang_path . '/common.' . $phpEx); + $this->add_lang($lang_set); + unset($lang_set); if (!empty($_GET['style']) && $auth->acl_get('a_styles')) { @@ -591,6 +573,77 @@ class user extends session return; } + // Internal usage + function set_lang($lang_file, $use_db = false, $use_help = false) + { + global $lang, $help, $phpEx; + + if (!$use_db) + { + include($this->lang_path . '/' . (($use_help) ? 'help_' : '') . $lang_file . '.' . $phpEx); + } + else if ($use_db) + { + // Get Database Language Strings + // Put them into $lang if nothing is prefixed, put them into $help if help: is prefixed + // For example: help:faq, posting + } + } + + // Add Language Items - use_db and use_help are assigned where needed (only use them to force inclusion) + // + // $lang_set = array('posting', 'help' => 'faq'); + // $lang_set = array('posting', 'viewtopic', 'help' => array('bbcode', 'faq')) + // $lang_set = array(array('posting', 'viewtopic'), 'help' => array('bbcode', 'faq')) + // $lang_set = 'posting' + // $lang_set = array('help' => 'faq', 'db' => array('help:faq', 'posting')) + function add_lang($lang_set, $use_db = false, $use_help = false) + { + global $lang, $help, $phpEx; + + if (is_array($lang_set)) + { + foreach ($lang_set as $key => $lang_file) + { + $key = (string) $key; + if ($key == 'db') + { + $this->add_lang($lang_file, true, $use_help); + } + else if ($key == 'help') + { + $this->add_lang($lang_file, $use_db, true); + } + else if (!is_array($lang_file)) + { + $this->set_lang($lang_file, $use_db, $use_help); + } + else + { + $this->add_lang($lang_file, $use_db, $use_help); + } + } + unset($lang_set); + } + else if ($lang_set) + { + $this->set_lang($lang_set, $use_db, $use_help); + } + + if ($use_help || sizeof($help)) + { + $this->help += $help; + unset($help); + } + + if (sizeof($lang)) + { + $this->lang += $lang; + // Yes, we unset $lang here, this variable is in use elsewhere + unset($lang); + } + } + function format_date($gmepoch, $format = false) { static $lang_dates; |
