Ignore:
Timestamp:
Mar 13, 2010, 9:42:12 PM (15 years ago)
Author:
george
Message:
  • Opraveno: Řádky z Lua souborů se chybně načítaly, pokud obsahovaly \" nebo ; uvnitř textu.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/import/import_lua.php

    r366 r381  
    1313    {
    1414      echo('<br />'.$Group['Name'].'<br />');
     15      if($Group['LastVersion'] < $BuildNumber)
     16      {
    1517      $File = new FileStream();
    1618      $File->OpenFile('../source/'.$import_version.'/lua/'.$Group['LuaFileName'].'.lua');
     
    2224        if(strpos($Line, '=') !== false)
    2325        {
    24           $LineParts = explode(';', $Line);
    25           $LineParts2 = explode('=', $LineParts[0]);
    26           $Value['ShortCut'] = trim($LineParts2[0]);
    27           $Value['Text'] = addslashes(stripslashes(substr(trim($LineParts2[1]), 1, -1)));
    28           $Value['Comment'] = addslashes(stripslashes(substr(trim($LineParts[1]), 3)));
     26          $LineParts = explode('=', $Line, 2);
     27          $Value['ShortCut'] = trim($LineParts[0]);
     28          $Line = substr(trim($LineParts[1]), 1);
     29          $TempLine = str_replace('\"', '  ', $Line); // Temporary remove slashed quotes
     30          $Value['Text'] = addslashes(stripslashes(substr($Line, 0, strpos($TempLine, '"'))));
     31          $Line = trim(substr($Line, strpos($TempLine, '"') + 2)); // Skip closing quote and semicolon         
     32          $Value['Comment'] = addslashes(stripslashes(substr($Line, 3))); // Skip " --"
     33          print_r($Value);
    2934
    3035          $Columns = '';
     
    8893      echo('<br />Celkem: '.$Count.'  Nových: '.$NewCount.'<br />');
    8994      $Database->SQLCommand('UPDATE `Group` SET `LastVersion` = "'.$BuildNumber.'", `LastImport` = NOW() WHERE `Id`='.$Group['Id']);
     95      } else echo('Již importován pro verzi '.$import_version);
    9096    }   
    9197  }
Note: See TracChangeset for help on using the changeset viewer.