diff --git a/phpgwapi/inc/class.translation_sql.inc.php b/phpgwapi/inc/class.translation_sql.inc.php index 272254d6cc..2ca18feb34 100644 --- a/phpgwapi/inc/class.translation_sql.inc.php +++ b/phpgwapi/inc/class.translation_sql.inc.php @@ -53,13 +53,21 @@ $this->placeholders[] = '%'.$i; } $this->db = is_object($GLOBALS['phpgw']->db) ? $GLOBALS['phpgw']->db : $GLOBALS['phpgw_setup']->db; + $this->db->set_app('phpgwapi'); + $this->lang_table = 'phpgw_lang'; + $this->languages_table = 'phpgw_languages'; + $this->config_table = 'phpgw_config'; + if (!isset($GLOBALS['phpgw_setup'])) { $this->system_charset = @$GLOBALS['phpgw_info']['server']['system_charset']; } else { - $this->db->query("SELECT config_value FROM phpgw_config WHERE config_app='phpgwapi' AND config_name='system_charset'",__LINE__,__FILE__); + $this->db->select($this->config_table,'config_value',array( + 'config_app'=>'phpgwapi', + 'config_name'=>'system_charset' + ),__LINE__,__FILE__); if ($this->db->next_record()) { $this->system_charset = $this->db->f(0); @@ -99,7 +107,11 @@ { if (!isset($this->charsets[$lang])) { - $this->db->query("SELECT content FROM phpgw_lang WHERE lang='$lang' AND message_id='charset' AND app_name='common'",__LINE__,__FILE__); + $this->db->select($this->lang_table,'content',array( + 'lang' => $lang, + 'message_id'=> 'charset', + 'app_name' => 'common', + ),__LINE__,__FILE__); $this->charsets[$lang] = $this->db->next_record() ? strtolower($this->db->f(0)) : 'iso-8859-1'; } return $this->charsets[$lang]; @@ -189,8 +201,10 @@ if (!isset($this->loaded_apps[$app]) || $this->loaded_apps[$app] != $lang) { - $sql = "select message_id,content from phpgw_lang where lang='".$lang."' and app_name='".$app."'"; - $this->db->query($sql,__LINE__,__FILE__); + $this->db->select($this->lang_table,'message_id,content',array( + 'lang' => $lang, + 'app_name' => $app, + ),__LINE__,__FILE__); while ($this->db->next_record()) { $GLOBALS['lang'][strtolower ($this->db->f('message_id'))] = $this->db->f('content'); @@ -354,7 +368,10 @@ //echo "
translation_sql::install_langs(".print_r($langs,true).",'$upgrademthod','$only_app')
\n"; if (!isset($GLOBALS['phpgw_info']['server']) && $upgrademethod != 'dumpold') { - $this->db->query("SELECT * FROM phpgw_config WHERE config_app='phpgwapi' AND config_name='lang_ctimes'",__LINE__,__FILE__); + $this->db->select($this->config_table,'config_value',array( + 'config_app' => 'phpgwapi', + 'config_name' => 'lang_ctimes', + ),__LINE__,__FILE__); if ($this->db->next_record()) { $GLOBALS['phpgw_info']['server']['lang_ctimes'] = unserialize(stripslashes($this->db->f('config_value'))); @@ -370,7 +387,7 @@ if ($upgrademethod == 'dumpold') { // dont delete the custom main- & loginscreen messages every time - $this->db->query("DELETE FROM phpgw_lang WHERE app_name != 'mainscreen' AND app_name != 'loginscreen'",__LINE__,__FILE__); + $this->db->delete($this->lang_table,array("app_name!='mainscreen'","app_name!='loginscreen'"),__LINE__,__FILE__); //echo 'raw($lang)=
".print_r($raw,True)."\n"; foreach($raw as $app_name => $ids) { - $app_name = $this->db->db_addslashes($app_name); - foreach($ids as $message_id => $content) { if ($this->system_charset) { $content = $this->convert($content,$charset,$this->system_charset); } - $message_id = $this->db->db_addslashes($message_id); - $content = $this->db->db_addslashes($content); - $addit = False; //echo '