Index: trunk/core/units/languages/import_xml.php =================================================================== diff -u -N -r7855 -r8104 --- trunk/core/units/languages/import_xml.php (.../import_xml.php) (revision 7855) +++ trunk/core/units/languages/import_xml.php (.../import_xml.php) (revision 8104) @@ -214,16 +214,14 @@ $this->current_phrase = Array( 'LanguageId' => $this->current_language['LanguageId'], 'Phrase' => $attributes['LABEL'], 'PhraseType' => $attributes['TYPE'], - 'PhraseId' => 0, 'Module' => $phrase_module, 'LastChanged' => adodb_mktime(), 'LastChangeIP' => $this->ip_address, 'Translation' => ''); break; case 'LANGUAGES LANGUAGE EVENTS EVENT': - $this->current_event = Array( 'EmailMessageId'=> 0, - 'LanguageId' => $this->current_language['LanguageId'], + $this->current_event = Array( 'LanguageId' => $this->current_language['LanguageId'], 'EventId' => $this->events_hash[ $attributes['EVENT'].'_'.$attributes['TYPE'] ], 'MessageType' => $attributes['MESSAGETYPE'], 'Template' => ''); @@ -300,7 +298,7 @@ else { $this->current_phrase['Translation'] = base64_decode($this->current_phrase['Translation']); } - $this->Conn->doInsert($this->current_phrase, $this->tables['phrases']); + $this->insertRecord($this->tables['phrases'], $this->current_phrase); } break; @@ -312,13 +310,33 @@ else { $this->current_event['Template'] = base64_decode($this->current_event['Template']); } - $this->Conn->doInsert($this->current_event, $this->tables['emailmessages']); + $this->insertRecord($this->tables['emailmessages'],$this->current_event); break; } array_pop($this->path); } + function insertRecord($table, $fields_hash) + { + $fields = ''; + $values = ''; + + foreach($fields_hash as $field_name => $field_value) + { + $fields .= '`'.$field_name.'`,'; + $values .= $this->Conn->qstr($field_value).','; + } + + $fields = preg_replace('/(.*),$/', '\\1', $fields); + $values = preg_replace('/(.*),$/', '\\1', $values); + + $sql = 'INSERT INTO `'.$table.'` ('.$fields.') VALUES ('.$values.')'; + $this->Conn->Query($sql); + +// return $this->Conn->getInsertID(); // no need because of temp table without auto_increment column at all + } + /** * Creates XML file with exported language data *