Ignore:
Timestamp:
Mar 8, 2010, 1:54:55 PM (15 years ago)
Author:
george
Message:
  • Opraveno: Import export lua souborů. Při importu převádět lomítkovou notaci do databáze na funkční znaky \n => odřádkování, \" => uvozovky. V databázi musí být uloženo správně bez lomítek.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/import/import_lua.php

    r357 r363  
    44{
    55  global $Database, $TranslationTree, $PatchVersion, $Config;
     6 
    67  $BuildNumber = GetBuildNumber($import_version);
    78 
     
    2425          $LineParts2 = explode('=', $LineParts[0]);
    2526          $Value['ShortCut'] = trim($LineParts2[0]);
    26           $Value['Text'] = substr(trim($LineParts2[1]), 1, -1);
    27           $Value['Comment'] = addslashes(substr(trim($LineParts[1]), 3));
     27          $Value['Text'] = addslashes(stripslashes(substr(trim($LineParts2[1]), 1, -1)));
     28          $Value['Comment'] = addslashes(stripslashes(substr(trim($LineParts[1]), 3)));
    2829
    2930          $Columns = '';
    3031          foreach($Group['Items'] as $GroupItem)
    3132          {
    32             $Columns .= ', '.$GroupItem['Column'].' ';
     33            $Columns .= ', `'.$GroupItem['Column'].'` ';
    3334          }
    3435          $Columns = substr($Columns, 1);
    3536
    36           $DbResult2 = $Database->SQLCommand('SELECT VersionEnd, ID, entry, '.$Columns.' FROM '.$Group['TablePrefix'].' WHERE ShortCut="'.$Value['ShortCut'].'" AND (Language=0) ORDER BY VersionStart DESC LIMIT 1');
     37          $DbResult2 = $Database->SQLCommand('SELECT `VersionEnd`, `ID`, `entry`, '.$Columns.' FROM '.$Group['TablePrefix'].' WHERE `ShortCut`="'.$Value['ShortCut'].'" AND (`Language`=0) ORDER BY `VersionStart` DESC LIMIT 1');
    3738          if(isset($DbResult2) and (mysql_num_rows($DbResult2) > 0))
    3839          {
     
    4142            if(HaveSameText($Group, $DbRow2, $Value))
    4243            {
    43         if ($DbRow2['VersionEnd'] <> $BuildNumber) {
    44                 $Database->SQLCommand('UPDATE `'.$Group['TablePrefix'].'` SET VersionEnd = "'.$BuildNumber.'" WHERE ID='.$DbRow2['ID']);
    45           echo(', ');
    46         } else
    47           echo('. ');
     44              if($DbRow2['VersionEnd'] <> $BuildNumber)
     45              {
     46                $Database->SQLCommand('UPDATE `'.$Group['TablePrefix'].'` SET `VersionEnd` = "'.$BuildNumber.'" WHERE `ID`='.$DbRow2['ID']);
     47                echo(', ');
     48              } else
     49              echo('. ');
    4850            } else
    4951            {       
    50               $Columns = 'entry, language, VersionStart, VersionEnd';
     52              $Columns = '`entry`, `language`, `VersionStart`, `VersionEnd`';
    5153              $Values = $DbRow2['entry'].', 0, '.$BuildNumber.', '.$BuildNumber;
    5254              foreach($Group['Items'] as $GroupItem)
     
    6971              $Entry += $DbRow[0];
    7072            }           
    71             $Columns = 'entry, language, VersionStart, VersionEnd';
     73            $Columns = '`entry`, `language`, `VersionStart`, `VersionEnd`';
    7274            $Values = $Entry.', 0, '.$BuildNumber.', '.$BuildNumber;
    7375            foreach($Group['Items'] as $GroupItem)
Note: See TracChangeset for help on using the changeset viewer.