mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 14:46:56 +02:00
multi-language problems
This commit is contained in:
@@ -2,16 +2,14 @@
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Copyright (C) 2008-2011 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
* mySQL Handler
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/mysql_class.php,v $
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $URL$
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
@@ -117,7 +115,7 @@ class e_db_mysql
|
||||
|
||||
$this->mySQLPrefix = MPREFIX; // Set the default prefix - may be overridden
|
||||
|
||||
$langid = (isset($pref['cookie_name'])) ? 'e107language_'.$pref['cookie_name'] : 'e107language_temp';
|
||||
/*$langid = (isset($pref['cookie_name'])) ? 'e107language_'.$pref['cookie_name'] : 'e107language_temp';
|
||||
if (isset($pref['user_tracking']) && ($pref['user_tracking'] == 'session'))
|
||||
{
|
||||
if (!isset($_SESSION[$langid])) { return; }
|
||||
@@ -127,7 +125,9 @@ class e_db_mysql
|
||||
{
|
||||
if (!isset($_COOKIE[$langid])) { return; }
|
||||
$this->mySQLlanguage = $_COOKIE[$langid];
|
||||
}
|
||||
}*/
|
||||
// Detect is already done in language handler, use it if not too early
|
||||
if(defined('e_LANGUAGE')) $this->mySQLlanguage = e107::getLanguage()->e_language;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -929,8 +929,9 @@ class e_db_mysql
|
||||
|
||||
if(strpos($query,'`#') !== FALSE)
|
||||
{
|
||||
$query = str_replace('`#','`'.$this->mySQLPrefix,$query); // This simple substitution should be OK when backticks used
|
||||
//$query = preg_replace_callback("/\s`#([\w]*?)`\W/", array($this, 'ml_check'), $query);
|
||||
//$query = str_replace('`#','`'.$this->mySQLPrefix,$query); // This simple substitution should be OK when backticks used
|
||||
// SecretR - reverted back - breaks multi-language
|
||||
$query = preg_replace_callback("/\s`#([\w]*?)`\W/", array($this, 'ml_check'), $query);
|
||||
}
|
||||
elseif(strpos($query,'#') !== FALSE)
|
||||
{ // Deprecated scenario - caused problems when '#' appeared in data - hence use of backticks
|
||||
@@ -1047,7 +1048,7 @@ class e_db_mysql
|
||||
if($multiple == FALSE)
|
||||
{
|
||||
$mltable = "lan_".strtolower($this->mySQLlanguage.'_'.$table);
|
||||
return ($this->db_Table_exists($table,$this->mySQLlanguage)) ? $mltable : $table;
|
||||
return ($this->db_Table_exists($table,$this->mySQLlanguage) ? $mltable : $table);
|
||||
}
|
||||
else // return an array of all matching language tables. eg [french]->e107_lan_news
|
||||
{
|
||||
@@ -1319,9 +1320,11 @@ class e_db_mysql
|
||||
{
|
||||
global $pref;
|
||||
$table = strtolower($table); // precaution for multilanguage
|
||||
|
||||
if($language && ($language != $pref['sitelanguage']))
|
||||
// it's lan table check
|
||||
if($language)
|
||||
{
|
||||
// TODO - discuss this!!! Smells like mislogic - we ignore e.g. bulgarian_news when default language is Bulgarian!
|
||||
if($language == $pref['sitelanguage']) return false;
|
||||
if(!isset($this->mySQLtableListLanguage[$language]))
|
||||
{
|
||||
$this->mySQLtableListLanguage = $this->db_mySQLtableList($language);
|
||||
@@ -1341,7 +1344,8 @@ class e_db_mysql
|
||||
|
||||
|
||||
/**
|
||||
* Populate $this->mySQLtableList;
|
||||
* Populate mySQLtableList and mySQLtableListLanguage
|
||||
* TODO - better runtime cache - use e107::getRegistry() && e107::setRegistry()
|
||||
* @return array
|
||||
*/
|
||||
private function db_mySQLtableList($language='')
|
||||
|
Reference in New Issue
Block a user