Ignore:
Timestamp:
Feb 22, 2015, 11:20:50 PM (9 years ago)
Author:
chronos
Message:
  • Modified: Tabs converted to spaces.
  • Modified: Remove spaces from end of lines.
  • Added: Code format script.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Import/Import.php

    r756 r816  
    77class ModuleImport extends AppModule
    88{
    9         function __construct($System)
    10         {
    11                 parent::__construct($System);
    12                 $this->Name = 'Import';
    13                 $this->Version = '1.0';
    14                 $this->Creator = 'Chronos';
    15                 $this->License = 'GNU/GPL';
    16                 $this->Description = 'Support for import of data.';
    17                 $this->Dependencies = array();
    18         }
    19 
    20         function Start()
    21         {
    22                 $this->System->RegisterPage('import', 'PageImport');           
    23         }
     9  function __construct($System)
     10  {
     11    parent::__construct($System);
     12    $this->Name = 'Import';
     13    $this->Version = '1.0';
     14    $this->Creator = 'Chronos';
     15    $this->License = 'GNU/GPL';
     16    $this->Description = 'Support for import of data.';
     17    $this->Dependencies = array();
     18  }
     19
     20  function Start()
     21  {
     22    $this->System->RegisterPage('import', 'PageImport');
     23  }
    2424}
    2525
    2626class Import
    2727{
    28   var $Version; 
     28  var $Version;
    2929  var $Group;
    3030  var $NewItemCount;
    3131  var $System;
    32  
     32
    3333  function __construct($System)
    3434  {
    3535    $this->System = &$System;
    3636  }
    37  
     37
    3838  function SetVersion($Version)
    3939  {
    4040    global $System;
    41    
     41
    4242    $DbResult = $System->Database->query('SELECT * FROM `ClientVersion` WHERE `Version` = "'.$Version.'"');
    43     $this->Version = $DbResult->fetch_assoc(); 
    44   }
    45  
     43    $this->Version = $DbResult->fetch_assoc();
     44  }
     45
    4646  function InsertItem($Value)
    47   {   
     47  {
    4848    $insert = true;
    4949    $Columns = '';
     
    5858    $Where = ' (`'.$this->Group['PrimaryKeyItem'].'` = "'.$Value[$this->Group['PrimaryKeyItem']].'")  AND (`Language`=0) ' ;
    5959    //print_r($Value);
    60    
    61     $DbResultMiddle = $this->System->Database->query('SELECT `VersionEnd`,`VersionStart`, `ID`, `Entry`, '.$Columns.' FROM `'.$this->Group['TablePrefix'].'` WHERE '.$Where.' AND `VersionStart` <= '.$this->Version['BuildNumber'].' AND `VersionEnd` >= '.$this->Version['BuildNumber'].' ORDER BY `VersionEnd` DESC LIMIT 1'); 
     60
     61    $DbResultMiddle = $this->System->Database->query('SELECT `VersionEnd`,`VersionStart`, `ID`, `Entry`, '.$Columns.' FROM `'.$this->Group['TablePrefix'].'` WHERE '.$Where.' AND `VersionStart` <= '.$this->Version['BuildNumber'].' AND `VersionEnd` >= '.$this->Version['BuildNumber'].' ORDER BY `VersionEnd` DESC LIMIT 1');
    6262    $DbResultBefore = $this->System->Database->query('SELECT `VersionEnd`,`VersionStart`, `ID`, `Entry`, '.$Columns.' FROM `'.$this->Group['TablePrefix'].'` WHERE '.$Where.' AND `VersionEnd` <= '.$this->Version['BuildNumber'].' ORDER BY `VersionEnd` DESC LIMIT 1');
    6363    $DbResultAfter  = $this->System->Database->query('SELECT `VersionEnd`,`VersionStart`, `ID`, `Entry`, '.$Columns.' FROM `'.$this->Group['TablePrefix'].'` WHERE '.$Where.' AND `VersionStart` >= '.$this->Version['BuildNumber'].' ORDER BY `VersionStart` LIMIT 1');
     
    6969      $DbRowAfter = $DbResultAfter->fetch_assoc();
    7070      $DbRowBefore = $DbResultBefore->fetch_assoc();
    71      
    72       if($this->HaveSameText($this->Group, $DbRowBefore, $Value) and ($DbResultBefore->num_rows > 0) ) 
     71
     72      if($this->HaveSameText($this->Group, $DbRowBefore, $Value) and ($DbResultBefore->num_rows > 0) )
    7373      {
    7474          $insert = false;
    7575          if ($this->Group['Id'] == 1) {
    7676             $set = ' , EndText = "'.$Value['EndText'].'" , ObjectiveText1 = "'.$Value['ObjectiveText1'].'"'.' , ObjectiveText2 = "'.$Value['ObjectiveText2'].'"'.' , ObjectiveText3 = "'.$Value['ObjectiveText3'].'"'.' , ObjectiveText4 = "'.$Value['ObjectiveText4'].'"';
    77           } else $set = ''; 
     77          } else $set = '';
    7878          $this->System->Database->query('UPDATE `'.$this->Group['TablePrefix'].'` SET `VersionEnd` = "'.$this->Version['BuildNumber'].'" '.$set.' WHERE `ID`='.$DbRowBefore['ID']);
    79           echo('b '); 
    80          
    81       } else 
    82       if($this->HaveSameText($this->Group, $DbRowAfter, $Value) and ($DbResultAfter->num_rows > 0)) 
     79          echo('b ');
     80
     81      } else
     82      if($this->HaveSameText($this->Group, $DbRowAfter, $Value) and ($DbResultAfter->num_rows > 0))
    8383      {
    8484          $insert = false;
    8585          if ($this->Group['Id'] == 1) {
    8686             $set = ' , EndText = "'.$Value['EndText'].'" , ObjectiveText1 = "'.$Value['ObjectiveText1'].'"'.' , ObjectiveText2 = "'.$Value['ObjectiveText2'].'"'.' , ObjectiveText3 = "'.$Value['ObjectiveText3'].'"'.' , ObjectiveText4 = "'.$Value['ObjectiveText4'].'"';
    87           } else $set = ''; 
     87          } else $set = '';
    8888          $this->System->Database->query('UPDATE `'.$this->Group['TablePrefix'].'` SET `VersionStart` = "'.$this->Version['BuildNumber'].'" '.$set.' WHERE `ID`='.$DbRowAfter['ID']);
    89           echo('a '); 
    90          
    91       } else 
    92       { 
    93        
    94         if (isset($DbRowAfter['VersionStart'])) { 
     89          echo('a ');
     90
     91      } else
     92      {
     93
     94        if (isset($DbRowAfter['VersionStart'])) {
    9595          if ($DbRowAfter['VersionStart'] <= $this->Version['BuildNumber']) {
    9696            echo('Allready imported '.$DbRowBefore['Entry'].' ');
     
    103103            $inserted = false;
    104104          }
    105         }       
    106        
     105        }
     106
    107107            //if [DEPRECATED] do not import
    108         foreach($this->Group['Items'] as $GroupItem) { 
     108        foreach($this->Group['Items'] as $GroupItem) {
    109109          if (false !== strpos($Value[$GroupItem['Column']],'[DEPRECATED')) {
    110110            echo('d '.$DbRowBefore['Entry'].' ');
    111111            $insert = false;
    112           }   
    113         }   
     112          }
     113        }
    114114
    115115        if ($insert) {
    116116          $insert = false;
    117117          foreach($this->Group['Items'] as $GroupItem)
    118           { 
     118          {
    119119            if ($Value[$GroupItem['Column']] <> '') $insert = true;
    120120          }
    121121        }
    122        
     122
    123123        if (isset($DbRowMiddle['Entry'])) $insert = false;
    124124        if (isset($DbRowAfter['Entry'])) $Value['Entry'] = $DbRowAfter['Entry'];
    125125        if (isset($DbRowBefore['Entry'])) $Value['Entry'] = $DbRowBefore['Entry'];
    126126
    127         if ($insert) 
    128         {     
    129          
     127        if ($insert)
     128        {
     129
    130130          $Columns = '`Entry`, `Language`, `VersionStart`, `VersionEnd`';
    131131          $Values = $Value['Entry'].', 0, '.$this->Version['BuildNumber'].', '.$this->Version['BuildNumber'];
    132           foreach($this->Group['Items'] as $GroupItem) 
    133           { 
     132          foreach($this->Group['Items'] as $GroupItem)
     133          {
    134134            $Columns .= ', `'.$GroupItem['Column'].'`';
    135135            $Values .= ', "'.$Value[$GroupItem['Column']].'"';
    136136          }
    137137          $this->System->Database->query('INSERT `'.$this->Group['TablePrefix'].'` ('.$Columns.') VALUES ('.$Values.')');
    138      
     138
    139139          echo '
    140           '.$Value['Entry'].' = '.$DbRowBefore['VersionStart'].'.'.$DbRowBefore['VersionEnd'].'< '.$this->Version['BuildNumber'].' <'.$DbRowAfter['VersionStart'].'.'.$DbRowAfter['VersionEnd'].'... '.$DbRowMiddle['VersionStart'].' '.$DbRowMiddle['VersionEnd'].' 
     140          '.$Value['Entry'].' = '.$DbRowBefore['VersionStart'].'.'.$DbRowBefore['VersionEnd'].'< '.$this->Version['BuildNumber'].' <'.$DbRowAfter['VersionStart'].'.'.$DbRowAfter['VersionEnd'].'... '.$DbRowMiddle['VersionStart'].' '.$DbRowMiddle['VersionEnd'].'
    141141          ';
    142      
    143           if (false !== strpos($Values,'[DEPRECATED'))   
     142
     143          if (false !== strpos($Values,'[DEPRECATED'))
    144144          echo $Values;
    145      
     145
    146146          echo('# ');
    147147          $InsertId = $this->System->Database->insert_id;
    148148          $this->System->ModuleManager->Modules['Log']->WriteLog('Text <a href="form.php?group='.$this->Group['Id'].'&amp;ID='.$InsertId.'">'.$InsertId.'</a> ('.$Value['Entry'].') ze skupiny '.$this->Group['Name'].' byl v nové verzi '.$this->Version['Version'].' změněn.', LOG_TYPE_IMPORT);
    149149        }
    150       }       
    151     } else 
     150      }
     151    } else
    152152    {
    153153      // Insert new text
     
    162162          $DbRow = $DbResult->fetch_row();
    163163          $Value['Entry'] += $DbRow[0];
    164         }           
     164        }
    165165      }
    166166      $Columns = '`Entry`, `Language`, `VersionStart`, `VersionEnd`';
     
    168168      $insert = false;
    169169      foreach($this->Group['Items'] as $GroupItem)
    170       { 
     170      {
    171171        $Columns .= ', `'.$GroupItem['Column'].'`';
    172172        $Values .= ', "'.$Value[$GroupItem['Column']].'"';
     
    182182    }
    183183  }
    184  
     184
    185185  function ImportLUA()
    186186  {
    187187    global $TranslationTree, $PatchVersion;
    188188    $Output = 'Načítání textů z LUA souboru...';
    189                                
     189
    190190    if(($this->Group['LuaFileName'] != '') and ($this->Group['TablePrefix'] != ''))
    191191    {
    192192
    193         $Output .= '<br />'.$this->Group['Name'].'<br />'; 
     193        $Output .= '<br />'.$this->Group['Name'].'<br />';
    194194      //  if($this->Group['LastVersion'] < $this->Version['BuildNumber'] + 1)
    195195        {
    196196          $File = new FileStream();
    197                                              
     197
    198198          $File->OpenFile(dirname(__FILE__).'/../../source/'.$this->Version['Version'].'/lua/'.$this->Group['LuaFileName'].'.lua');
    199199          $this->NewItemCount = 0;
     
    215215                $Value['Text'] = str_replace('\n', "\n", $Value['Text']);
    216216                $Value['Text'] = addslashes(stripslashes($Value['Text']));
    217                 $Line = trim(substr($Line, strpos($TempLine, '"') + 1)); // Skip closing quote and semicolon         
    218               } else 
     217                $Line = trim(substr($Line, strpos($TempLine, '"') + 1)); // Skip closing quote and semicolon
     218              } else
    219219              {
    220220                // Nonstring value
     
    224224              $Value['Comment'] = addslashes(stripslashes(substr($Line, 3))); // Skip " --"
    225225              //print_r($Value);
    226          
     226
    227227              $this->InsertItem($Value);
    228             }; 
     228            };
    229229            $Count++;
    230230          }
     
    237237    return ($Output);
    238238  }
    239  
     239
    240240  function UpdateTranslated()
    241241  {
    242242    global $TranslationTree, $PatchVersion, $Config;
    243  
     243
    244244    $Output = '<br /><br />Začínám se synchronizací VersionEnd u přeložených textů<br />';
    245     foreach($TranslationTree as $Group) 
    246     {
    247       $Output .= '<br />'.$Group['Name'].' '; 
    248       $do = true;   
    249       while($do) 
     245    foreach($TranslationTree as $Group)
     246    {
     247      $Output .= '<br />'.$Group['Name'].' ';
     248      $do = true;
     249      while($do)
    250250      {
    251251      $DbResult = $this->System->Database->query('SELECT `gs_tran`.`ID`, '.
    252         '`gs_tran`.`VersionEnd` AS `VersionEnd_tran`, '.
    253         '`gs_tran`.`VersionStart` AS `VersionStart_tran`, '.
    254         '`gs_orig`.`VersionEnd` AS `VersionEnd_orig`, '.
    255         '`gs_orig`.`VersionStart` AS `VersionStart_orig` FROM `'.
    256         $Group['TablePrefix'].'` AS `gs_tran` JOIN `'.$Group['TablePrefix'].
    257         '` AS `gs_orig` ON `gs_orig`.`ID` = `gs_tran`.`Take` WHERE '.
    258         '`gs_tran`.`VersionEnd` <> `gs_orig`.`VersionEnd` OR `gs_tran`.`VersionStart` <> `gs_orig`.`VersionStart`');
    259         $do = ($DbResult->num_rows > 0);
    260         while($DbRow = $DbResult->fetch_assoc()) 
    261         { 
     252        '`gs_tran`.`VersionEnd` AS `VersionEnd_tran`, '.
     253        '`gs_tran`.`VersionStart` AS `VersionStart_tran`, '.
     254        '`gs_orig`.`VersionEnd` AS `VersionEnd_orig`, '.
     255        '`gs_orig`.`VersionStart` AS `VersionStart_orig` FROM `'.
     256        $Group['TablePrefix'].'` AS `gs_tran` JOIN `'.$Group['TablePrefix'].
     257        '` AS `gs_orig` ON `gs_orig`.`ID` = `gs_tran`.`Take` WHERE '.
     258        '`gs_tran`.`VersionEnd` <> `gs_orig`.`VersionEnd` OR `gs_tran`.`VersionStart` <> `gs_orig`.`VersionStart`');
     259        $do = ($DbResult->num_rows > 0);
     260        while($DbRow = $DbResult->fetch_assoc())
     261        {
    262262          echo '`';
    263263          $this->System->Database->query('UPDATE `'.$Group['TablePrefix'].'` SET `VersionEnd` = '.$DbRow['VersionEnd_orig'].', `VersionStart` = '.$DbRow['VersionStart_orig'].' WHERE `ID` = '.$DbRow['ID']);
    264           $Output .= '. '; 
    265         } 
    266       } 
     264          $Output .= '. ';
     265        }
     266      }
    267267      $Output .= '<strong>Dokončeno.</strong>';
    268268    }
    269269    return($Output);
    270270  }
    271  
     271
    272272  function HaveSameText($Group, $DbRow2, $Value)
    273273  {
    274274    $result = true;
    275     foreach($Group['Items'] as $GroupItem) 
    276     { 
     275    foreach($Group['Items'] as $GroupItem)
     276    {
    277277      $old = $DbRow2[$GroupItem['Column']];
    278278      $old = str_replace(chr(10), '', $old);
     
    291291      $old = strtolower($old);
    292292      $old = str_replace('$b', '', $old);
    293      
    294       if ($this->Group['Id'] == 1) 
     293
     294      if ($this->Group['Id'] == 1)
    295295       while ($part = substr($old, strpos($old, '<'), strpos($old, '>')-strpos($old, '<')))
    296         if ($part <> '') { 
     296        if ($part <> '') {
    297297          $old = str_replace($part.'>', '', $old);
    298298        }
    299  
     299
    300300      if (($GroupItem['MangosColumn'] <> '') and ($Group['MangosDatabase'] == 'mangos'))
    301301        $new = $Value[$GroupItem['MangosColumn']];
    302302        else $new = $Value[$GroupItem['Column']];
    303        
     303
    304304      $new = str_replace(chr(10), '', $new);
    305305      $new = str_replace(chr(13), '', $new);
     
    318318      $new = str_replace('$b', '', $new);
    319319
    320       if ($this->Group['Id'] == 1) 
     320      if ($this->Group['Id'] == 1)
    321321       while ($part = substr($new, strpos($new, '<'), strpos($new, '>')-strpos($new, '<')))
    322         if ($part <> '') { 
     322        if ($part <> '') {
    323323          $new = str_replace($part.'>', '', $new);
    324324        }
    325      
     325
    326326      if(($old == 'null') or ($old == 'NULL')) $old = '';
    327327      if(($new == 'null') or ($new == 'NULL')) $new = '';
    328  
    329       if(($new <> '') and ($old <> $new) and ($GroupItem['Column'] <> 'Comment')) 
     328
     329      if(($new <> '') and ($old <> $new) and ($GroupItem['Column'] <> 'Comment'))
    330330      {
    331331        //  echo $old.'X'.$new;
    332         if ( ($GroupItem['Column'] <> 'EndText') 
    333         and ($GroupItem['Column'] <> 'ObjectiveText1') 
    334         and ($GroupItem['Column'] <> 'ObjectiveText2') 
    335         and ($GroupItem['Column'] <> 'ObjectiveText3') 
    336         and ($GroupItem['Column'] <> 'ObjectiveText4') ) 
     332        if ( ($GroupItem['Column'] <> 'EndText')
     333        and ($GroupItem['Column'] <> 'ObjectiveText1')
     334        and ($GroupItem['Column'] <> 'ObjectiveText2')
     335        and ($GroupItem['Column'] <> 'ObjectiveText3')
     336        and ($GroupItem['Column'] <> 'ObjectiveText4') )
    337337          $result = false;
    338338      }
    339339    }
    340        
     340
    341341    return($result);
    342342  }
    343  
     343
    344344  function ImportDBC()
    345345  {
    346346    global $System, $TranslationTree, $Config;
    347  
     347
    348348    $Output = 'Načítání textů z DBC souboru...';
    349349    if(($this->Group['DBCFileName'] != '') and ($this->Group['TablePrefix'] != ''))
    350350    {
    351       $Output .= '<br />'.$this->Group['Name'].'<br />'; 
     351      $Output .= '<br />'.$this->Group['Name'].'<br />';
    352352
    353353      // Load string column index list
    354       $DbResult = $System->Database->query('SELECT * FROM `GroupItem` JOIN `GroupItemDBC` ON `GroupItem`.`Id` = `GroupItemDBC`.`GroupItem` AND `GroupItemDBC`.`ClientVersion` = '.$this->Version['Id'].'  WHERE `GroupItem`.`Group` = '.$this->Group['Id']);     
    355      
     354      $DbResult = $System->Database->query('SELECT * FROM `GroupItem` JOIN `GroupItemDBC` ON `GroupItem`.`Id` = `GroupItemDBC`.`GroupItem` AND `GroupItemDBC`.`ClientVersion` = '.$this->Version['Id'].'  WHERE `GroupItem`.`Group` = '.$this->Group['Id']);
     355
    356356      $ColumnIndexes = array();
    357357      $ColumnFormat = array();
     
    361361        $ColumnIndexes[$DbRow['GroupItem']] = $DbRow['ColumnIndex'];
    362362      }
    363      
     363
    364364      $DBCFile = new DBCFile();
    365365      $DBCFile->OpenFile(dirname(__FILE__).'/../../source/'.$this->Version['Version'].'/dbc/'.$this->Group['DBCFileName'].'.dbc', $ColumnFormat);
    366366      $ItemCount = $DBCFile->GetRecordCount();
    367367      $this->NewItemCount = 0;
    368       $Count = 0;     
    369        
     368      $Count = 0;
     369
    370370      for($I = 0; $I < $ItemCount; $I++)
    371371      {
     
    373373        if(array_key_exists($GroupItem['Id'], $ColumnIndexes))
    374374        {
    375           $Value[$GroupItem['Column']] = addslashes($DBCFile->GetString($I, $ColumnIndexes[$GroupItem['Id']])); 
    376         }
    377        
     375          $Value[$GroupItem['Column']] = addslashes($DBCFile->GetString($I, $ColumnIndexes[$GroupItem['Id']]));
     376        }
     377
    378378        // Get multicolumn value
    379379        $Columns = explode(',', $this->Group['DBCIndex']);
     
    381381        foreach($Columns as $Column)
    382382          $ColumnValue .= '_'.$DBCFile->GetUint($I, $Column);
    383         $ColumnValue = substr($ColumnValue, 1);         
    384         $Value[$this->Group['PrimaryKeyItem']] = $ColumnValue;         
     383        $ColumnValue = substr($ColumnValue, 1);
     384        $Value[$this->Group['PrimaryKeyItem']] = $ColumnValue;
    385385        $this->InsertItem($Value);
    386386        $Count++;
    387       }   
     387      }
    388388      $Output .= '<br />Celkem: '.$Count.'  Nových: '.$this->NewItemCount.'<br />';
    389389      $this->UpdateLastVersion();
     
    396396  {
    397397    global $TranslationTree;
    398    
     398
    399399    $this->Group = $TranslationTree[$GroupId];
    400    
     400
    401401    if($this->Group['SourceType'] == 'dbc') $Output = $this->ImportDBC();
    402402    else if($this->Group['SourceType'] == 'sql') $Output = $this->ImportSQL();
     
    406406    return($Output);
    407407  }
    408  
     408
    409409  function ImportSQL()
    410410  {
    411411    global $TranslationTree, $PatchVersion;
    412  
     412
    413413    $Output= '';
    414414    $File = new FileStream();
     
    422422      $Line = $File->ReadLine();
    423423      // Struktura
    424       if(strpos($Line, 'CREATE TABLE `'.$this->Group['MangosTable'].'`') !== false) 
     424      if(strpos($Line, 'CREATE TABLE `'.$this->Group['MangosTable'].'`') !== false)
    425425      {
    426426        $Line = '';
     
    428428        $i = 0;
    429429      }
    430       if((strpos($Line, ';') !== false) and ($folow_structure == true)) 
     430      if((strpos($Line, ';') !== false) and ($folow_structure == true))
    431431      {
    432432        $folow_structure = false;
     
    443443        $i++;
    444444      }
    445    
     445
    446446      //data
    447447      if((strpos($Line, 'INSERT INTO `'.$this->Group['MangosTable'].'`') !== false) and (isset($structure)))
    448       { 
     448      {
    449449        while ((strpos($Line, ');') === false) or ($File->EOF()))
    450450          $Line = $Line.$File->ReadLine();
    451451        $Line = str_replace("),\n(", '),(', $Line);
    452        
     452
    453453        $Line = substr($Line, strpos($Line, '(') + 1);
    454454        $Line = substr($Line, 0, strpos($Line, ');'));
    455455        $LineParts = explode('),(', $Line);
    456        
     456
    457457        unset($Line);
    458        
     458
    459459        $value_buff = '';
    460460        $Value = '';
    461461        foreach($LineParts as $LinePart)
    462462        {
    463          
     463
    464464          unset($Value, $value_buff);
    465465          foreach($structure as $i => $column)
     
    469469              $value_buff = substr($LinePart, 0, strpos($LinePart, ','));
    470470              $LinePart = substr($LinePart, strlen($value_buff) + 1);
    471             } else 
     471            } else
    472472            {
    473473              $LinePart = substr($LinePart, 1);
    474474              $value_buff = substr($LinePart, 0, strpos($LinePart, "'"));
    475               while(substr($value_buff, strlen($value_buff) - 1, 1) == "\\") 
     475              while(substr($value_buff, strlen($value_buff) - 1, 1) == "\\")
    476476              {
    477477                $str = substr($LinePart, strlen($value_buff));
     
    479479                $value_buff = $value_buff.$str2;
    480480                $str = substr($str, strlen($str2));
    481               } 
     481              }
    482482              $LinePart = substr($LinePart, strlen($value_buff) + 2);
    483             } 
     483            }
    484484            if(($value_buff != 'null') and ($value_buff != 'NULL'))
    485485            {
    486486              $str = '';
    487               while(substr($value_buff, strlen($value_buff) - 1,1) == " ") 
     487              while(substr($value_buff, strlen($value_buff) - 1,1) == " ")
    488488              {
    489489                $value_buff = substr($value_buff, 0, strlen($value_buff) - 1);
     
    491491              }
    492492              $str2 = '';
    493               while(substr($value_buff, 0, 1) == ' ') 
     493              while(substr($value_buff, 0, 1) == ' ')
    494494              {
    495495                $value_buff = substr($value_buff, 1, strlen($value_buff) - 1);
     
    497497              }
    498498              $Value[$column] = $str2.trim($value_buff).$str;
    499             } else 
    500             { 
     499            } else
     500            {
    501501              $Value[$column] = '';
    502502            }
     
    513513              }
    514514          }
    515            
     515
    516516          // Get multicolumn value
    517517          $Columns = explode(',', $this->Group['MangosTableIndex']);
     
    519519          foreach($Columns as $Column)
    520520            $ColumnValue .= '_'.$Value[$Column];
    521           $ColumnValue = substr($ColumnValue, 1);         
     521          $ColumnValue = substr($ColumnValue, 1);
    522522          $Value[$this->Group['PrimaryKeyItem']] = $ColumnValue;
    523523          $this->InsertItem($Value);
    524524          $Count++;
    525525        }
    526       } 
     526      }
    527527    }
    528528    $Output = '<br />Celkem: '.$Count.'  Nových: '.$this->NewItemCount.'<br />';
     
    530530    return($Output);
    531531  }
    532  
     532
    533533  function UpdateLastVersion() {
    534534    $DbResult = $this->System->Database->query('SELECT * FROM `Group` WHERE `Id`='.$this->Group['Id']);
    535     $Version = $DbResult->fetch_assoc(); 
     535    $Version = $DbResult->fetch_assoc();
    536536    if ($Version['LastVersion'] < $this->Version['BuildNumber'])
    537537      $this->System->Database->query('UPDATE `Group` SET `LastVersion` = "'.$this->Version['BuildNumber'].'", `LastImport` = NOW() WHERE `Id`='.$this->Group['Id']);
Note: See TracChangeset for help on using the changeset viewer.