Index: branches/5.2.x/core/kernel/languages/phrases_cache.php =================================================================== diff -u -N -r14095 -r14184 --- branches/5.2.x/core/kernel/languages/phrases_cache.php (.../phrases_cache.php) (revision 14095) +++ branches/5.2.x/core/kernel/languages/phrases_cache.php (.../phrases_cache.php) (revision 14184) @@ -1,6 +1,6 @@ LanguageId = 1; } else { - if ($this->Application->isAdmin) { - $this->LanguageId = $this->Application->Session->GetField('Language'); - } - else { - $this->LanguageId = $this->Application->GetVar('m_lang'); - - if ($this->Application->GetVar('admin')) { - $admin_session =& $this->Application->recallObject('Session.admin'); - /* @var $admin_session Session */ - - $this->AdminLanguageId = $admin_session->GetField('Language'); + if ( !isset($language_id) ) { + if ($this->Application->isAdmin) { + $language_id = $this->Application->Session->GetField('Language'); } + else { + $language_id = $this->Application->GetVar('m_lang'); + } } - } - if (isset($this->Application->Caches['PhraseList'])) { - $this->LoadPhrases( $this->Application->Caches['PhraseList'] ); - } - } + $this->LanguageId = $language_id; - function GetCachedIds() - { - $cache_key = md5($this->Application->GetVar('t') . $this->Application->GetVar('m_theme') . $this->Application->GetVar('m_lang')); + if (!$this->Application->isAdmin && $this->Application->GetVar('admin')) { + $admin_session =& $this->Application->recallObject('Session.admin'); + /* @var $admin_session Session */ - $sql = 'SELECT PhraseList, ConfigVariables - FROM ' . TABLE_PREFIX . 'PhraseCache - WHERE Template = ' . $this->Conn->qstr($cache_key); - $res = $this->Conn->GetRow($sql); - - if ($res && $res['ConfigVariables']) { - $this->Application->OriginalConfigCacheIds = explode(',', $res['ConfigVariables']); - $this->Application->ConfigCacheIds = $this->Application->OriginalConfigCacheIds; + $this->AdminLanguageId = $admin_session->GetField('Language'); + } } - return ($res === false) ? Array() : explode(',', $res['PhraseList']); + $this->LoadPhrases($phrase_ids); } function LoadPhrases($ids) { if ( !is_array($ids) || !implode('', $ids) ) { - return; + return ; } $sql = 'SELECT l' . $this->LanguageId . '_Translation, PhraseKey FROM ' . TABLE_PREFIX . 'Phrase WHERE PhraseId IN (' . implode(',', $ids) . ') AND l' . $this->LanguageId . '_Translation IS NOT NULL'; $this->Phrases = $this->Conn->GetCol($sql, 'PhraseKey'); - /*foreach($phrases as $phrase => $tanslation) - { - $this->AddCachedPhrase(mb_strtoupper($phrase), $tanslation); - }*/ - - $this->Ids = $ids; - $this->OriginalIds = $ids; + $this->Ids = $this->OriginalIds = $ids; } function AddCachedPhrase($label, $value, $allow_editing = true) @@ -207,29 +188,6 @@ return is_array($this->Ids) && count($this->Ids) > 0 && $this->Ids != $this->OriginalIds; } - /** - * Copy from Application->UpdateCache method - * - * @deprecated - */ - function UpdateCache() - { - $update = false; - //something changed - $update = $update || (is_array($this->Ids) && count($this->Ids) > 0 && $this->Ids != $this->OriginalIds); - $update = $update || (count($this->Application->ConfigCacheIds) && $this->Application->ConfigCacheIds != $this->Application->OriginalConfigCacheIds); - if ($update) { - $query = sprintf("REPLACE %s (PhraseList, CacheDate, Template, ConfigVariables) - VALUES (%s, %s, %s, %s)", - TABLE_PREFIX.'PhraseCache', - $this->Conn->Qstr(join(',', $this->Ids)), - adodb_mktime(), - $this->Conn->Qstr(md5($this->Application->GetVar('t').$this->Application->GetVar('m_theme').$this->Application->GetVar('m_lang'))), - $this->Conn->qstr(implode(',', array_unique($this->Application->ConfigCacheIds)))); - $this->Conn->Query($query); - } - } - function GetPhrase($label, $allow_editing = true, $use_admin = false) { if (!isset($this->LanguageId)) {