Changeset 363 for trunk


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.
Location:
trunk
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/export/export.php

    r349 r363  
    297297          $Value['ShortCut'] = trim($LineParts2[0]);
    298298          $Value['Text'] = substr(trim($LineParts2[1]), 1, -1);
    299           $Value['Comment'] = addslashes(substr(trim($LineParts[1]), 3));
    300 
    301           $Query = 'SELECT * FROM (SELECT * FROM '.$Group['TablePrefix'].' WHERE (Complete = 1) AND '.$this->WhereLang.' AND '.$this->WhereUsers.' AND (ShortCut="'.$Value['ShortCut'].'") AND (VersionStart <= '.$this->ClientVersion['BuildNumber'].') AND (VersionEnd >= '.$this->ClientVersion['BuildNumber'].')'.$this->OrderByUserList.') AS T GROUP BY T.entry';
     299          $Value['Comment'] = substr(trim($LineParts[1]), 3);
     300
     301          $Query = 'SELECT * FROM (SELECT * FROM `'.$Group['TablePrefix'].'` WHERE (`Complete` = 1) AND '.$this->WhereLang.' AND '.$this->WhereUsers.' AND (`ShortCut`="'.$Value['ShortCut'].'") AND (`VersionStart` <= '.$this->ClientVersion['BuildNumber'].') AND (`VersionEnd` >= '.$this->ClientVersion['BuildNumber'].')'.$this->OrderByUserList.') AS `T` GROUP BY `T`.`entry`';
    302302          //echo($Query);
    303303          $DbResult2 = $this->Database->query($Query);
     
    305305          {
    306306            $DbRow = $DbResult2->fetch_assoc();
    307             $Value['Text'] = $DbRow['Text'];
    308             $Value['Comment'] = $DbRow['Comment'];
     307            $Value['Text'] = addslashes($DbRow['Text']);
     308            $Value['Comment'] = addslashes($DbRow['Comment']);
    309309            //echo('.');
    310310          }
     
    315315        } else $File2->WriteLine($Line."\n");
    316316      }
    317       echo('Hotovo <br />');
     317      echo('Hotovo <br/>');
    318318    }
    319319  }
  • 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.