From 2706ce6534ea92c4d8caafeccd022ccd7479f969 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 15 Aug 2004 12:06:05 +0000 Subject: [PATCH] - fix huge memory hog. :) (how dumb i was... hmm...) git-svn-id: file:///svn/phpbb/trunk@4962 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/session.php | 39 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 2fbfa153c3..32f1a0081b 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -538,9 +538,13 @@ class user extends session } } + // We include common language file here to not load it every time a custom language file is included + $lang = &$this->lang; + require($this->lang_path . "common.$phpEx"); + $this->add_lang($lang_set); unset($lang_set); - + if (!empty($_GET['style']) && $auth->acl_get('a_styles')) { global $SID; @@ -644,11 +648,7 @@ class user extends session // $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; - - $lang = array(); - - require($this->lang_path . "common.$phpEx"); + global $phpEx; if (is_array($lang_set)) { @@ -668,7 +668,7 @@ class user extends session } else if (!is_array($lang_file)) { - $this->set_lang($lang_file, $use_db, $use_help); + $this->set_lang($this->lang, $this->help, $lang_file, $use_db, $use_help); } else { @@ -679,30 +679,21 @@ class user extends session } 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); + $this->set_lang($this->lang, $this->help, $lang_set, $use_db, $use_help); } } - function set_lang($lang_file, $use_db = false, $use_help = false) + function set_lang(&$lang, &$help, $lang_file, $use_db = false, $use_help = false) { - global $lang, $help, $phpEx; + global $phpEx; + // $lang == $this->lang + // $help == $this->help + // - add appropiate variables here, name them as they are used within the language file... + if (!$use_db) { - require ($this->lang_path . (($use_help) ? 'help_' : '') . "$lang_file.$phpEx"); + require($this->lang_path . (($use_help) ? 'help_' : '') . "$lang_file.$phpEx"); } else if ($use_db) {