3 |
// $Id$ |
// $Id$ |
4 |
// ------------------------------------------------------------------ |
// ------------------------------------------------------------------ |
5 |
// $Log$ |
// $Log$ |
6 |
|
// Revision 1.7 2003/05/13 09:40:34 joko |
7 |
|
// check for error... |
8 |
|
// |
9 |
|
// Revision 1.6 2003/02/09 17:33:54 joko |
10 |
|
// + minor update related to new log level constants |
11 |
|
// |
12 |
// Revision 1.5 2002/12/19 10:30:06 joko |
// Revision 1.5 2002/12/19 10:30:06 joko |
13 |
// + argument 'newMode' for function getlt and function _getldsvar: let _getldsvar evaluate variable to still provide old behaviour/functionality |
// + argument 'newMode' for function getlt and function _getldsvar: let _getldsvar evaluate variable to still provide old behaviour/functionality |
14 |
// |
// |
65 |
// ---------------------------------------------------- |
// ---------------------------------------------------- |
66 |
function LocaleText() { |
function LocaleText() { |
67 |
|
|
|
/* |
|
|
// was: |
|
|
global $cfg, $slt; |
|
|
session_register_safe('slt'); |
|
|
$this->langs_avail = $cfg[GLBL_LANGSAVAIL]; |
|
|
$this->load(); |
|
|
*/ |
|
|
|
|
68 |
// look at the bottom of this file!!! |
// look at the bottom of this file!!! |
69 |
//$smarty->register_block("translate", "do_translation"); |
//$smarty->register_block("translate", "do_translation"); |
70 |
//$this->site->smarty->register_block("translate", "_do_translation"); |
//$this->site->smarty->register_block("translate", "_do_translation"); |
75 |
} |
} |
76 |
|
|
77 |
function start() { |
function start() { |
78 |
global $cfg, $slt; |
global $app, $slt; |
79 |
session_register_safe('slt'); |
session_register_safe('slt'); |
80 |
$this->langs_avail = $cfg[GLBL_LANGSAVAIL]; |
$this->langs_avail = $app->getConfig("languages.available"); |
81 |
$this->load(); |
$this->load(); |
82 |
} |
} |
83 |
|
|
111 |
return $langs_avail[0]; |
return $langs_avail[0]; |
112 |
} |
} |
113 |
} |
} |
114 |
|
|
115 |
|
// TODO: refactor this to Data::Deep |
116 |
function _dbkey2ldskey($dbkey) { |
function _dbkey2ldskey($dbkey) { |
117 |
// TODO: log this |
// TODO: log this |
118 |
//dprint("dbkey: $dbkey"); |
//dprint("dbkey: $dbkey"); |
126 |
} |
} |
127 |
} |
} |
128 |
|
|
129 |
|
// TODO: refactor this to Data::Deep |
130 |
function _getldsvar($ldskey, $tpl=array(), $newMode = 0) { |
function _getldsvar($ldskey, $tpl=array(), $newMode = 0) { |
131 |
|
|
132 |
//print "ldskey: $ldskey<br>"; |
//print "ldskey: $ldskey<br>"; |
153 |
return $var_value; |
return $var_value; |
154 |
} |
} |
155 |
|
|
156 |
|
// TODO: refactor this to Data::Deep |
157 |
function _setldsvar($ldskey, $val) { |
function _setldsvar($ldskey, $val) { |
158 |
$var_name = '$this->lds' . $ldskey; |
$var_name = '$this->lds' . $ldskey; |
159 |
$value_new = addslashes($val); |
$value_new = addslashes($val); |
164 |
} |
} |
165 |
|
|
166 |
function _loadStructure_FromDb() { |
function _loadStructure_FromDb() { |
167 |
//global $site; |
$this->site->log( get_class($this) . "->_loadStructure_FromDb: Loading language information (l10n) for '$this->langkey'.", PEAR_LOG_DEBUG); |
|
$this->site->log( get_class($this) . "->_loadStructure_FromDb loading language information", LOG_DEBUG); |
|
|
//print "- loading structure from db ($this->langkey)<br>"; |
|
|
//connectdb(); |
|
168 |
$sql = "SELECT * FROM td_res_langtext WHERE countrykey='" . $this->langkey . "'"; |
$sql = "SELECT * FROM td_res_langtext WHERE countrykey='" . $this->langkey . "'"; |
169 |
if ($result = $this->site->db->query($sql)) { |
if ($result = $this->site->db->query($sql)) { |
170 |
|
|
171 |
|
// pre-flight check: Is $result an object of class "db_error"? |
172 |
|
if (get_class($result) == 'db_error') { |
173 |
|
// FIXME: How to handle this here??? |
174 |
|
//print "Sorry.<br/>"; |
175 |
|
$this->site->log( get_class($this) . "->_loadStructure_FromDb: Error while issuing '$sql'.", PEAR_LOG_ERR); |
176 |
|
return; |
177 |
|
} |
178 |
|
|
179 |
//while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) { |
//while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) { |
180 |
|
//print Dumper($result); |
181 |
while ( $result->fetchInto($row) ) { |
while ( $result->fetchInto($row) ) { |
182 |
//print $row[tval]."<br>"; |
//print $row[tval]."<br>"; |
183 |
//print_r($row) . "<br>"; |
//print_r($row) . "<br>"; |
184 |
$this->_loadStructure_FromDb_add($row["tkey"], $row["tval"]); |
$this->_loadStructure_FromDb_add($row["tkey"], $row["tval"]); |
185 |
} |
} |
186 |
} |
} |
187 |
$this->site->log( get_class($this) . "->_loadStructure_FromDb ready", LOG_DEBUG); |
$this->site->log( get_class($this) . "->_loadStructure_FromDb ready", PEAR_LOG_DEBUG); |
188 |
} |
} |
189 |
|
|
190 |
function _loadStructure_FromDb_add($dbkey, $val) { |
function _loadStructure_FromDb_add($dbkey, $val) { |