Changeset 880 for trunk/Modules/Export


Ignore:
Timestamp:
Apr 7, 2020, 10:15:48 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Improved code formatting.
Location:
trunk/Modules/Export
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Export/CreateAddon.php

    r859 r880  
    1717    $string = str_replace('$r', '"..'.$strlower.'(UnitRace("player")).."', $string);
    1818    $Gender = '$G';
    19     while(strpos($string, $Gender) !== false)
     19    while (strpos($string, $Gender) !== false)
    2020    {
    2121      $Before = substr($string, 0, strpos($string, $Gender));
     
    3030    }
    3131    $Gender = '$g';
    32     while(strpos($string, $Gender) !== false)
     32    while (strpos($string, $Gender) !== false)
    3333    {
    3434      $Before = substr($string, 0, strpos($string, $Gender));
     
    4646    $string = str_replace("\r", '', $string);
    4747    $string = str_replace("\n", '\r\n', $string);
    48     return($string);
     48    return $string;
    4949  }
    5050
     
    6464    $string = str_replace('\\n', ' ', $string);
    6565    $string = str_replace(' ', '', $string);
    66 //    while(strpos($string, '  '))
     66//    while (strpos($string, '  '))
    6767//      $string = str_replace('  ', ' ', $string);
    68     return($string);
     68    return $string;
    6969  }
    7070
     
    7575    $string = str_replace('$b', '\r\n', $string);
    7676    $string = $this->ReplaceVarInText($string,'');
    77     return($string);
     77    return $string;
    7878  }
    7979
     
    8181  {
    8282    //echo (strpos($string,'<html>'));
    83     if (strpos($string,'<html>') > -1) return(false);
    84       else return(true);
     83    if (strpos($string,'<html>') > -1) return false;
     84      else return true;
    8585  }
    8686
     
    9898    $string = str_replace('\\\\124', '\\124',$string);
    9999
    100     return ($string);
     100    return $string;
    101101  }
    102102
     
    113113    $CreatedFileListCount = array();
    114114
    115     if(!file_exists($this->TempDir.'CzWoW/')) mkdir($this->TempDir.'CzWoW/', 0777, true);
     115    if (!file_exists($this->TempDir.'CzWoW/')) mkdir($this->TempDir.'CzWoW/', 0777, true);
    116116
    117117    $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id.' AND `Group`.`TablePrefix` != ""');
    118     while($Group = $DbResult->fetch_assoc())
     118    while ($Group = $DbResult->fetch_assoc())
    119119    {
    120120    //získání čísla verze pro export
     
    126126      else $ExportVersion = '';
    127127
    128       foreach($TranslationTree[$Group['Id']]['Items'] as $Column)
    129       if($Column['AddonFileName'] != '')
     128      foreach ($TranslationTree[$Group['Id']]['Items'] as $Column)
     129      if ($Column['AddonFileName'] != '')
    130130      {
    131131        $this->AddProgress(1);
    132         if(!isset($CreatedFileListCount[$Column['AddonFileName']]))
     132        if (!isset($CreatedFileListCount[$Column['AddonFileName']]))
    133133        $CreatedFileListCount[$Column['AddonFileName']] = 0;
    134134        $CreatedFileListCount[$Column['AddonFileName']]++;
     
    149149        $ID = $this->Database->query('SELECT `BuildNumber` FROM `ClientVersion` WHERE '.
    150150        ' `Imported` = 1 AND `BuildNumber` < '.$BuildNumber.' ORDER BY  `BuildNumber` DESC LIMIT 1');
    151         if($ID->num_rows > 0) {
     151        if ($ID->num_rows > 0) {
    152152          $ExportVersionOld = $ID->fetch_assoc();
    153153          $ExportVersionOld = $ExportVersionOld['BuildNumber'];
    154154
    155155          $DbResult2 = $this->Database->query($this->BuildQuery($Group,$ExportVersionOld));
    156           while($Line = $DbResult2->fetch_assoc())
     156          while ($Line = $DbResult2->fetch_assoc())
    157157          {
    158158            $en = trim($this->ReplaceEnText($Line['En'.$Column['Column']]));
    159159            $cz = $this->ReplaceCzText($Line[$Column['Column']]);
    160             if(($en <> '') and ($cz <> '') and ($this->NotCancel($en)))
     160            if (($en <> '') and ($cz <> '') and ($this->NotCancel($en)))
    161161            {
    162162               $TableTexts[$en] = $cz;
     
    167167
    168168        $DbResult2 = $this->Database->query($this->BuildQuery($Group,$ExportVersion));
    169         while($Line = $DbResult2->fetch_assoc())
     169        while ($Line = $DbResult2->fetch_assoc())
    170170        {
    171171          $en = trim($this->ReplaceEnText($Line['En'.$Column['Column']]));
    172172          $cz = $this->ReplaceCzText($Line[$Column['Column']]);
    173           if(($en <> '') and ($cz <> '') and ($this->NotCancel($en)))
     173          if (($en <> '') and ($cz <> '') and ($this->NotCancel($en)))
    174174          {
    175175             $TableTexts[$en] = $cz;
     
    177177        }
    178178
    179         foreach($TableTexts as $key => $value) {
     179        foreach ($TableTexts as $key => $value) {
    180180            $Buffer .= "\n".'["'.$key.'"]="'.$value.'",';
    181181            $i++;
     
    194194    $CountFiles = 'CountFiles.lua';
    195195    $Buffer = '';
    196     foreach($CreatedFileList as $CreatedFile)
     196    foreach ($CreatedFileList as $CreatedFile)
    197197      $Buffer .= 'CZWOW_'.str_replace('_','_count=',$CreatedFile).';'."\n";
    198     foreach($TranslationTree as $Group)
    199       foreach($TranslationTree[$Group['Id']]['Items'] as $Column)
     198    foreach ($TranslationTree as $Group)
     199      foreach ($TranslationTree[$Group['Id']]['Items'] as $Column)
    200200      if (($Column['AddonFileName'] != '') and (!in_array($Column['AddonFileName'].'_1', $CreatedFileList)))
    201201      {
     
    209209    $Buffer = '<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/.\FrameXML\UI.xsd">'."\n";
    210210    $Buffer .= '<script file="'.$CountFiles.'"/>'."\n";
    211     foreach($CreatedFileList as $CreatedFile)
     211    foreach ($CreatedFileList as $CreatedFile)
    212212      $Buffer .= '<script file="'.$CreatedFile.'.lua"/>'."\n";
    213213    $Buffer .= '</Ui>';
    214214    file_put_contents($this->TempDir.'CzWoW/Translates.xml', $Buffer);
    215     return($Output);
     215    return $Output;
    216216  }
    217217
     
    235235
    236236    $DbResult = $this->Database->query($this->BuildQuery($Group,$CanGenerated));
    237     while($Line = $DbResult->fetch_array())
     237    while ($Line = $DbResult->fetch_array())
    238238    {
    239239      $Original = $this->my_trim($Line['En'.$Column['Column']]);
    240240      $Translated = $this->my_trim($Line[$Column['Column']]);
    241       if($this->ClientVersion['Version'] == '2.4.3')
     241      if ($this->ClientVersion['Version'] == '2.4.3')
    242242      {
    243243        $Original = str_replace("|Hchannel:%d|h[%s]|h", '[%s]', $Original);
     
    247247    }
    248248
    249     if(!file_exists($this->TempDir.'CzWoW/')) mkdir($this->TempDir.'CzWoW/',0777, true);
     249    if (!file_exists($this->TempDir.'CzWoW/')) mkdir($this->TempDir.'CzWoW/',0777, true);
    250250    file_put_contents($this->TempDir.'CzWoW/LocalizationStrings.lua', $Buffer);
    251251  }
     
    253253  function MakeAddon()
    254254  {
    255     if(!file_exists($this->TempDir)) mkdir($this->TempDir, 0777, true);
     255    if (!file_exists($this->TempDir)) mkdir($this->TempDir, 0777, true);
    256256    $Output = $this->MakeLanguageFiles();
    257257    $Output .= $this->MakeClientStrings();
    258258    // $Output .= MakeMainScript($Setting);
    259     return($Output);
     259    return $Output;
    260260  }
    261261
     
    283283    ';
    284284    $DbResult = $System->Database->query('SELECT * FROM `CzWoWPackageVersion` ORDER BY `Date` DESC');
    285     while($Line = $DbResult->fetch_assoc())
     285    while ($Line = $DbResult->fetch_assoc())
    286286    {
    287287      $Buffer .='
  • trunk/Modules/Export/Export.php

    r879 r880  
    1717  {
    1818    $this->TempDir = dirname(__FILE__).'/../../'.$this->System->Config['Web']['TempFolder'].'Export/'.$this->Id.'/';
    19     if(!file_exists($this->TempDir)) mkdir($this->TempDir, 0777, true);
     19    if (!file_exists($this->TempDir)) mkdir($this->TempDir, 0777, true);
    2020    $this->TempDirRelative = $this->System->Config['Web']['TempFolder'].'Export/'.$this->Id.'/';
    2121    $this->SourceDir = dirname(__FILE__).'/../../'.$this->System->Config['Web']['SourceFolder'];
    2222    $this->SourceDirRelative = $this->System->Config['Web']['SourceFolder'];
    23     if(!file_exists($this->SourceDir)) mkdir($this->SourceDir, 0777, true);
     23    if (!file_exists($this->SourceDir)) mkdir($this->SourceDir, 0777, true);
    2424  }
    2525
     
    2929    if ($Export['AllUsers']) {
    3030      $DbResult2 = $this->System->Database->query('SELECT ID FROM `User` WHERE `ID` NOT IN(SELECT `User` FROM `ExportUser` WHERE `Export`='.$this->Id.')');
    31       while($UserLine = $DbResult2->fetch_assoc())
     31      while ($UserLine = $DbResult2->fetch_assoc())
    3232      {
    3333            $Condition = ' WHERE `Export`='.$this->Id.' AND `User`='.$UserLine['ID'];
    3434            $DbResult = $this->System->Database->query('SELECT * FROM `ExportUser` '.$Condition); //,MAX(`Sequence`) as MaxSequence
    35             if($DbResult->num_rows > 0)
     35            if ($DbResult->num_rows > 0)
    3636            {
    3737            //  $this->System->Database->query('UPDATE `ExportUser` SET `Sequence`='.$Value.$Condition);
     
    5050  {
    5151    $DbResult = $this->Database->query('SELECT * FROM `Export` WHERE `Id`='.$this->Id);
    52     if($DbResult->num_rows == 0) throw new Exception('Export '.$this->Id.' neexistuje');
     52    if ($DbResult->num_rows == 0) throw new Exception('Export '.$this->Id.' neexistuje');
    5353    $this->Export = $DbResult->fetch_assoc();
    5454
     
    5858      'LEFT JOIN `User` ON `User`.`ID`=`ExportUser`.`User` '.
    5959      'WHERE `ExportUser`.`Export`='.$this->Id.' ORDER BY `ExportUser`.`Sequence`');
    60     while($UserLine = $DbResult->fetch_assoc())
     60    while ($UserLine = $DbResult->fetch_assoc())
    6161    {
    6262      $this->UserNames .= ', '.$UserLine['Name'];
     
    6464    $this->UserNames = substr($this->UserNames, 2);
    6565
    66     if($this->Export['ClientVersion'] != '')
     66    if ($this->Export['ClientVersion'] != '')
    6767    {
    6868      $DbResult = $this->Database->query('SELECT * FROM `ClientVersion` WHERE `Id`='.$this->Export['ClientVersion']);
     
    8282
    8383    $DbResultItem = $this->System->Database->query('SELECT * FROM `ExportGroupItem` WHERE `Export`='.$this->Id);
    84     while($GroupItem = $DbResultItem->fetch_assoc())
     84    while ($GroupItem = $DbResultItem->fetch_assoc())
    8585    {
    8686      $GroupItems[$GroupItem['GroupItem']] = 1;
     
    8888    // Build selected columns
    8989    $Columns = '';
    90     foreach($TranslationTree[$Group['Id']]['Items'] as $Column) {
     90    foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) {
    9191      if (!isset($GroupItems[$Column['Id']])) $Columns .= ' `T`.`'.$Column['Column'].'` AS `'.$Column['Column'].'`, ';
    9292    }
     
    104104    // Build columns for english texts
    105105    $OriginalColumns = '';
    106     foreach($TranslationTree[$Group['Id']]['Items'] as $Column) {
     106    foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) {
    107107      $OriginalColumns .= ' `T3`.`'.$Column['Column'].'` AS `En'.$Column['Column'].'`, ';
    108108      if (isset($GroupItems[$Column['Id']]))
     
    117117    '(`T3`.`VersionStart` = `T4`.`VersionStart`) AND (`T3`.`VersionEnd` = `T4`.`VersionEnd`)';
    118118
    119     return($Query);
     119    return $Query;
    120120  }
    121121
     
    129129    if (file_exists($file))
    130130      $date = date('Y-m-d H:i',(filemtime($file)));
    131     else return(true);
     131    else return true;
    132132  // echo $file;
    133133
     
    135135      'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id);
    136136    $result = false;
    137     while($Group = $DbResult->fetch_assoc())
     137    while ($Group = $DbResult->fetch_assoc())
    138138    {
    139139      $Query = 'SELECT * FROM `'.$Group['TablePrefix'].'` AS `T`'.
     
    149149        }
    150150    }
    151     return($result);
     151    return $result;
    152152  }
    153153
     
    172172    $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '.
    173173      'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id);
    174     while($Group = $DbResult->fetch_assoc())
     174    while ($Group = $DbResult->fetch_assoc())
    175175    {
    176176      $Buffer .= $Group['TablePrefix'].', ';
     
    180180    $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '.
    181181      'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id);
    182     while($Group = $DbResult->fetch_assoc())
    183     {
    184       if($Group['MangosTable'] != '')
     182    while ($Group = $DbResult->fetch_assoc())
     183    {
     184      if ($Group['MangosTable'] != '')
    185185      {
    186186        $Buffer .= "\n\n-- ".$Group['Name']."\n\n";
    187187        $DbResult2 = $this->Database->query($this->BuildQuery($Group));
    188         if($DbResult2->num_rows > 0)
    189         while($Line = $DbResult2->fetch_array())
     188        if ($DbResult2->num_rows > 0)
     189        while ($Line = $DbResult2->fetch_array())
    190190        {
    191191          $Values = '';
    192           foreach($TranslationTree[$Group['Id']]['Items'] as $GroupItem)
    193           if($GroupItem['Column'] != $Group['PrimaryKeyItem']) // Do not update primary key
     192          foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem)
     193          if ($GroupItem['Column'] != $Group['PrimaryKeyItem']) // Do not update primary key
    194194          {
    195             if($GroupItem['MangosColumn'] == '') $GroupItem['MangosColumn'] = $GroupItem['Column'];
     195            if ($GroupItem['MangosColumn'] == '') $GroupItem['MangosColumn'] = $GroupItem['Column'];
    196196            $Values .= ', `'.$GroupItem['MangosColumn'].'`="'.addslashes($Line[$GroupItem['Column']]).'"';
    197197          }
     
    200200          // Get multicolumn index
    201201          $ColumnItems = explode(',', $Group['MangosTableIndex']);
    202           if(count($ColumnItems) > 1)
     202          if (count($ColumnItems) > 1)
    203203          {
    204204            $Where = 'CONCAT(';
    205             foreach($ColumnItems as $ColumnItem)
     205            foreach ($ColumnItems as $ColumnItem)
    206206              $Where .= '`'.$ColumnItem.'`, "_", ';
    207207            $Where = substr($Where, 0, -7).')';
     
    216216      }
    217217    }
    218     if($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer);
    219     return($Buffer);
     218    if ($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer);
     219    return $Buffer;
    220220  }
    221221
     
    243243      'aowow_skill' => 'skillID',
    244244    );
    245     foreach($AoWoWTables as $AoWoWTable => $IndexColum)
     245    foreach ($AoWoWTables as $AoWoWTable => $IndexColum)
    246246    {
    247247      $Buffer .= '--'.$AoWoWTable.', ';
     
    249249      $Query = 'SELECT `name`,`'.$IndexColum.'` FROM `'.$AoWoWTable.'`';
    250250      $DbResult = $Database2->query($Query);
    251       while($Line = $DbResult->fetch_assoc())
     251      while ($Line = $DbResult->fetch_assoc())
    252252      {
    253253        $Ori_text = $Line['name'];
     
    259259        $Tran = $DbResult2->fetch_assoc();
    260260        //echo ($Line['name'].'='.$Tran['tran']);
    261         if($Tran['Tran'] == '')
     261        if ($Tran['Tran'] == '')
    262262        {
    263263          $DbResult2 = $Database2->query('SELECT `OptionText` AS `En`,
     
    270270        }
    271271
    272         if($Tran['Tran'] <> '')
     272        if ($Tran['Tran'] <> '')
    273273          $Buffer .= 'UPDATE `'.$AoWoWTable.'` SET `name` = "'.addslashes($Tran['Tran']).'" WHERE '.$IndexColum.' = '.$Line[$IndexColum].' ;'."\n";
    274274      }
     
    276276    }
    277277    */
    278     if($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer);
    279     return($Buffer);
     278    if ($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer);
     279    return $Buffer;
    280280  }
    281281
     
    299299          if (false === strpos($String2,$varible)) {
    300300              //  echo $varible;
    301             return(false);
     301            return false;
    302302          }
    303303      }
    304304    }
    305     return (true);
     305    return true;
    306306  }
    307307
     
    324324      'WHERE `ExportGroup`.`Export`='.$this->Id.' AND `Group`.`DBCFileName` != ""');
    325325    $Output = 'Počet generovaných skupin: '.$DbResult->num_rows."\n";
    326     while($Group = $DbResult->fetch_assoc())
     326    while ($Group = $DbResult->fetch_assoc())
    327327    {
    328328      $this->AddProgress(2);
    329329      $Output .= $Group['Name'].', ';
    330       if(file_exists($this->SourceDir.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc'))
     330      if (file_exists($this->SourceDir.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc'))
    331331      {
    332332        // Load string column index list
     
    335335        $ColumnIndexes = array();
    336336        $ColumnFormat = array();
    337         while($DbRow = $DbResult2->fetch_assoc())
     337        while ($DbRow = $DbResult2->fetch_assoc())
    338338        {
    339339          $ColumnFormat[$DbRow['ColumnIndex']] = FORMAT_STRING;
     
    344344        $LookupTable = array();
    345345        $DbResult2 = $this->Database->query($this->BuildQuery($Group));
    346         while($DbRow = $DbResult2->fetch_assoc()) {
     346        while ($DbRow = $DbResult2->fetch_assoc()) {
    347347          //Export only if translate have same varible %
    348348          $CanExport = true;
    349           foreach($TranslationTree[$Group['Id']]['Items'] as $Column)  {
     349          foreach ($TranslationTree[$Group['Id']]['Items'] as $Column)  {
    350350            $DbRow[$Column['Column']] = str_replace ( '$ ','$',$DbRow[$Column['Column']]);
    351351            if (!$this->HaveVarible($DbRow['En'.$Column['Column']],$DbRow[$Column['Column']])) {
     
    369369
    370370        // Create new DBC file
    371         if(!file_exists($this->TempDir.'dbc/')) mkdir ($this->TempDir.'dbc/', 0777, true);
     371        if (!file_exists($this->TempDir.'dbc/')) mkdir ($this->TempDir.'dbc/', 0777, true);
    372372        $NewDBCFile = new DBCFile();
    373373        $NewDBCFile->CreateFile($this->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc', $ColumnFormat);
     
    381381        $RowCount = $SourceDBCFile->GetRecordCount();
    382382        $FieldCount = $SourceDBCFile->GetFieldCount();
    383         for($Row = 0; $Row < $RowCount; $Row++)
     383        for ($Row = 0; $Row < $RowCount; $Row++)
    384384        {
    385385          $Line = $SourceDBCFile->GetLine($Row);
     
    388388          $PrimaryKeyItem = '';
    389389          $ColumnItems = explode(',', $Group['DBCIndex']);
    390           if(count($ColumnItems) > 1)
     390          if (count($ColumnItems) > 1)
    391391          {
    392             foreach($ColumnItems as $ColumnItem)
     392            foreach ($ColumnItems as $ColumnItem)
    393393              $PrimaryKeyItem .= $Line[$ColumnItem].'_';
    394394            $PrimaryKeyItem = substr($PrimaryKeyItem, 0, -1);
    395395          } else $PrimaryKeyItem = $Line[$Group['DBCIndex']];
    396396
    397           if(array_key_exists($PrimaryKeyItem, $LookupTable))
     397          if (array_key_exists($PrimaryKeyItem, $LookupTable))
    398398          {
    399399            // Replace text columns
    400400            $LookupTableItem = $LookupTable[$PrimaryKeyItem];
    401             foreach($TranslationTree[$Group['Id']]['Items'] as $GroupItem)
     401            foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem)
    402402            {
    403               if(array_key_exists($GroupItem['Id'], $ColumnIndexes))
     403              if (array_key_exists($GroupItem['Id'], $ColumnIndexes))
    404404                $Line[$ColumnIndexes[$GroupItem['Id']]] = $LookupTableItem[$GroupItem['Column']];
    405405            }
     
    409409          // Show completion progress
    410410          $Progress = round($Row / $RowCount * 100);
    411           if($Progress != $OldProgress)
     411          if ($Progress != $OldProgress)
    412412          {
    413413            if (($Group['Id'] == 13) and ($Progress <> 100)) $this->AddProgress(0.01);
     
    422422    }
    423423    $Output .= 'Hotovo <br />';
    424     return($Output);
     424    return $Output;
    425425  }
    426426
     
    432432
    433433    $Output = '';
    434     if(!file_exists($this->TempDir.'lua/')) mkdir($this->TempDir.'lua/', 0777, true);
     434    if (!file_exists($this->TempDir.'lua/')) mkdir($this->TempDir.'lua/', 0777, true);
    435435    $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id.' AND `Group`.`LuaFileName` != ""');
    436     while($Group = $DbResult->fetch_assoc())
     436    while ($Group = $DbResult->fetch_assoc())
    437437    {
    438438      $this->AddProgress(1);
     
    448448      $LookupTable = array();
    449449      $DbResult2 = $this->Database->query($this->BuildQuery($Group));
    450       while($DbRow = $DbResult2->fetch_assoc()) {
     450      while ($DbRow = $DbResult2->fetch_assoc()) {
    451451          $CanExport = true;
    452           foreach($TranslationTree[$Group['Id']]['Items'] as $Column)  {
     452          foreach ($TranslationTree[$Group['Id']]['Items'] as $Column)  {
    453453          //  if (strpos($DbRow[$Column['Column']],'\\'))
    454454           //   $CanExport = false;
     
    502502      }
    503503
    504       while(!$File->EOF())
     504      while (!$File->EOF())
    505505      {
    506506        $Line = $File->ReadLine();
    507         if(strpos($Line, '=') !== false)
     507        if (strpos($Line, '=') !== false)
    508508        {
    509509          $LineParts = explode('=', $Line, 2);
     
    511511          $Line = trim($LineParts[1]);
    512512
    513           if($Line[0] == '"')
     513          if ($Line[0] == '"')
    514514          {
    515515            // Quoted string value
     
    532532          $Value['Comment'] = addslashes(stripslashes(substr($Line, 3))); // Skip " --"
    533533
    534           if(array_key_exists($Value['ShortCut'], $LookupTable))
     534          if (array_key_exists($Value['ShortCut'], $LookupTable))
    535535          {
    536536            $DbRow = $LookupTable[$Value['ShortCut']];
     
    548548          }
    549549          $NewLine = $Value['ShortCut'].' = "'.$Value['Text'].'";';
    550           //if($Value['Comment'] != '') $NewLine .= ' -- '.$Value['Comment'];
     550          //if ($Value['Comment'] != '') $NewLine .= ' -- '.$Value['Comment'];
    551551          $NewLine .= "\r\n";
    552552          $File2->WriteLine($NewLine);
     
    555555      $Output .= 'Hotovo <br/>';
    556556    }
    557     return($Output);
     557    return $Output;
    558558  }
    559559
     
    656656    "    <author>".$this->System->User->Name."</author>\n".
    657657    "    <contributors>\n";
    658     foreach(explode(',', $this->UserNames) as $UserName)
     658    foreach (explode(',', $this->UserNames) as $UserName)
    659659      $Buffer .= "      <user>".$UserName."</user>\n";
    660660    $Buffer .=
     
    665665    $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '.
    666666      'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id);
    667     while($Group = $DbResult->fetch_assoc())
    668     {
    669       if($Group['MangosTable'] == '')
     667    while ($Group = $DbResult->fetch_assoc())
     668    {
     669      if ($Group['MangosTable'] == '')
    670670      {
    671671        $Group['MangosTable'] = $Group['TablePrefix'];
     
    674674      $Buffer .= '    <group id="'.$Group['Id'].'" name="'.$Group['TablePrefix'].'">'."\n";
    675675      $DbResult2 = $this->Database->query($this->BuildQuery($Group));
    676       while($Line = $DbResult2->fetch_assoc())
     676      while ($Line = $DbResult2->fetch_assoc())
    677677      {
    678678        $Buffer .= '      <item id="'.$Line['Entry'].'" user="'.$Line['UserName'].'">'."\n";
    679679        $Values = '';
    680         foreach($TranslationTree[$Group['Id']]['Items'] as $GroupItem)
     680        foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem)
    681681        {
    682           if($GroupItem['MangosColumn'] == '') $GroupItem['MangosColumn'] = $GroupItem['Column'];
    683           if($Line[$GroupItem['Column']] != '')
     682          if ($GroupItem['MangosColumn'] == '') $GroupItem['MangosColumn'] = $GroupItem['Column'];
     683          if ($Line[$GroupItem['Column']] != '')
    684684          $Buffer .= '        <text index="'.$GroupItem['Id'].'" name="'.
    685685            $GroupItem['Column'].'">'.addslashes($Line[$GroupItem['Column']]).'</text>'."\n";
     
    689689      $Buffer .= "    </group>\n";
    690690    }
    691     if($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer);
     691    if ($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer);
    692692    $Buffer .= "  </translation>\n".
    693693  "</document>";
    694     return($Buffer);
     694    return $Buffer;
    695695  }
    696696}
     
    732732      '((`Export`.`OutputType` = 9) OR (`Export`.`OutputType` = 10)) AND '.
    733733      '(`TimeFinish` IS NULL) OR (`Export` ='.$TaskId.') ORDER BY `TimeQueued`'); // `Export`='.$Export->Id
    734     while($Task = $DbResult->fetch_assoc())
     734    while ($Task = $DbResult->fetch_assoc())
    735735    {
    736736      $Export = '<a href="'.$this->System->Link('/export/?Action=View&amp;ExportId='.$Task['Export']).'">'.$Task['Export'].'</a>';
     
    744744      // Show estimated time to complete
    745745      $PrefixMultiplier = new PrefixMultiplier();
    746       if($Task['Progress'] > 0) {
     746      if ($Task['Progress'] > 0) {
    747747        $ElapsedTime = time() - MysqlDateTimeToTime($Task['TimeStart']);
    748748        $Output .= T('Elapsed time').': <strong>'.$PrefixMultiplier->Add($ElapsedTime, '', 4, 'Time').'</strong> / ';
     
    752752      $Output .= '</div>';
    753753
    754       if($Task['Progress'] > 99)
     754      if ($Task['Progress'] > 99)
    755755        $Output .= '<script type="text/javascript" language="JavaScript" charset="utf-8">'.
    756756        'setTimeout("parent.location.href=\''.$this->System->Link('/export/?Action=View&Tab=7&ExportId='.$TaskId).'\'", 500)'.
    757757        '</script>';
    758758    }
    759     return($Output);
     759    return $Output;
    760760  }
    761761}
  • trunk/Modules/Export/ExportOutput.php

    r867 r880  
    1010{
    1111  $FileList = scandir($Path);
    12   foreach($FileList as $FileName)
    13   {
    14     if(file_exists($Path.$FileName) and ($FileName != '.') and ($FileName != '..'))
     12  foreach ($FileList as $FileName)
     13  {
     14    if (file_exists($Path.$FileName) and ($FileName != '.') and ($FileName != '..'))
    1515    {
    16       if(is_dir($Path.$FileName)) CreateZipFromDir($Zip, $Path.$FileName.'/', $ZipPath.$FileName.'/');
     16      if (is_dir($Path.$FileName)) CreateZipFromDir($Zip, $Path.$FileName.'/', $ZipPath.$FileName.'/');
    1717        else $Zip->addFile(file_get_contents($Path.$FileName), $ZipPath.$FileName);
    1818    }
     
    2828  $Export->Id = $ExportId;
    2929  $Export->Init();
    30   if(function_exists('gzcompress'))
     30  if (function_exists('gzcompress'))
    3131  {
    3232    $SaveFilename = $Export->TempDir.'CzAoWoW_SQL.zip';
     
    4545    '<a href="'.$System->Link('/'.$Export->TempDirRelative.'CzAoWoW_SQL.zip').'">'.$SQLFilename.'</a><br />'.
    4646    'Pokud se vám zdá, že filtr na export nefunguje, vymažte si vyrovnávací paměť prohlížeče a zkuste stáhnout soubor znovu.';
    47   return($Output);
     47  return $Output;
    4848}
    4949
     
    5858     htmlspecialchars($Export->ExportToAoWoWSQL()).
    5959    '</pre>';
    60   return($Output );
     60  return $Output ;
    6161}
    6262
     
    6969  $Export->Id = $ExportId;
    7070  $Export->Init();
    71   if(function_exists('gzcompress'))
     71  if (function_exists('gzcompress'))
    7272  {
    7373    $SaveFilename = $Export->TempDir.'CzWoW_SQL.zip';
     
    8686    '<a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_SQL.zip').'">'.$SQLFilename.'</a><br />'.
    8787    'Pokud se vám zdá, že filtr na export nefunguje, vymažte si vyrovnávací paměť prohlížeče a zkuste stáhnout soubor znovu.';
    88   return($Output);
     88  return $Output;
    8989}
    9090
     
    9999    htmlspecialchars($Export->ExportToMangosSQL()).
    100100    '</pre>';
    101   return($Output);
     101  return $Output;
    102102}
    103103
     
    106106  global $System;
    107107
    108   if(function_exists('gzcompress'))
     108  if (function_exists('gzcompress'))
    109109  {
    110110    $Addon = new ExportAddon($System);
     
    135135    'Pokud se vám zdá, že filtr na export nefunguje, vymažte si vyrovnávací paměť prohlížeče a zkuste stáhnout soubor znovu.';
    136136  $Output .= '<br /><strong>Použití ve hře</strong><br />Menu addonu ve hře vyvoláte povelem /czwow.';
    137   return($Output);
     137  return $Output;
    138138}
    139139
     
    146146  $Export->Id = $ExportId;
    147147  $Export->Init();
    148   if(function_exists('gzcompress'))
     148  if (function_exists('gzcompress'))
    149149  {
    150150    $SaveFilename = $Export->TempDir.'CzWoW_XML.zip';
     
    163163    '<a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_XML.zip').'">CzWoW_SQL.zip</a><br />'.
    164164    'Pokud se vám zdá, že filtr na export nefunguje, vymažte si vyrovnávací paměť prohlížeče a zkuste stáhnout soubor znovu.';
    165   return($Output);
     165  return $Output;
    166166}
    167167
     
    176176    htmlspecialchars($Export->ExportToXML()).
    177177    '</pre>';
    178   return($Output);
     178  return $Output;
    179179}
    180180
     
    190190  $DbResult = $System->Database->query('SELECT `Id` FROM `ExportTask` WHERE (`Export` = '.$ExportId.
    191191      ') AND ((`TimeFinish` < `TimeStart`) OR (`TimeFinish` IS NULL))');
    192   if($DbResult->num_rows == 0)
    193   {
    194     if(array_key_exists('Regenerate', $_POST))
     192  if ($DbResult->num_rows == 0)
     193  {
     194    if (array_key_exists('Regenerate', $_POST))
    195195    {
    196196      $System->Database->query('UPDATE `ExportTask` SET `TimeQueued` = NOW(), `Progress`=0 , `TimeStart` = NULL, `TimeFinish` = NULL WHERE `Export` = '.$ExportId);
     
    211211
    212212  $DbResult = $System->Database->query('SELECT * FROM `ExportTask` WHERE `Export` = '.$ExportId);
    213   if($DbResult->num_rows == 0)
     213  if ($DbResult->num_rows == 0)
    214214  {
    215215    $System->Database->query('INSERT INTO `ExportTask` (`Export` ,`TimeQueued` ) VALUES ('.$ExportId.', NOW())');
     
    220220  $DbResult = $System->Database->query('SELECT `TimeFinish` FROM `ExportTask` WHERE `Export` = '.$ExportId);
    221221  $ExportTask = $DbResult->fetch_assoc();
    222   if($ExportTask['TimeFinish'] <> '')
     222  if ($ExportTask['TimeFinish'] <> '')
    223223  {
    224224    $Output .= '<strong>Souhrný balík: <a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_DBC.zip').'">CzWoW_DBC.zip</a></strong><br/>';
    225225    $DbResult = $System->Database->query('SELECT `Group`.* FROM `ExportGroup` JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$Export->Id.' AND `Group`.`DBCFileName` != ""');
    226     while($Group = $DbResult->fetch_assoc())
     226    while ($Group = $DbResult->fetch_assoc())
    227227    {
    228       if(file_exists($Export->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc'))
     228      if (file_exists($Export->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc'))
    229229        $Output .= '<a href="'.$System->Link('/'.$Export->TempDirRelative.'dbc/'.$Group['DBCFileName'].'.dbc').'">'.$Group['DBCFileName'].'.dbc</a><br/>';
    230230    }
     
    233233
    234234  }
    235   return($Output);
     235  return $Output;
    236236}
    237237
     
    261261    'WHERE ((`Export`.`OutputType` = 9) OR (`Export`.`OutputType` = 10)) AND '.
    262262    '(`TimeFinish` IS NULL) AND (`TimeQueued` < (NOW() - '.$Timeout.'))');
    263   if($DbResult->num_rows > 0)
     263  if ($DbResult->num_rows > 0)
    264264  {
    265265    $System->ModuleManager->Modules['Log']->WriteLog('ProcesTask nepracuje přes 2 hodiny, pravděpodobně nepracuje!', LOG_TYPE_ERROR);
    266266  }
    267   return ($Output);
     267  return $Output;
    268268}
    269269
     
    281281  $DbResult = $System->Database->query('SELECT `Id` FROM `ExportTask` WHERE (`Export` = '.$ExportId.
    282282    ') AND ((`TimeFinish` < `TimeStart`) OR (`TimeFinish` IS NULL))');
    283   if($DbResult->num_rows == 0)
    284   {
    285     if(array_key_exists('Regenerate', $_POST))
     283  if ($DbResult->num_rows == 0)
     284  {
     285    if (array_key_exists('Regenerate', $_POST))
    286286    {
    287287      $System->Database->query('UPDATE `ExportTask` SET `TimeQueued` = NOW(), `Progress`=0, `TimeStart` = NULL, `TimeFinish` = NULL WHERE `Export` = '.$ExportId);
     
    298298  // Start task for the first time if export task was not yet started
    299299  $DbResult = $System->Database->query('SELECT * FROM `ExportTask` WHERE `Export` = '.$ExportId);
    300   if($DbResult->num_rows == 0)
     300  if ($DbResult->num_rows == 0)
    301301  {
    302302    $System->Database->query('INSERT INTO ExportTask (`Export` ,`TimeStart` ) VALUES ('.$ExportId.', NOW())');
     
    306306  $DbResult = $System->Database->query('SELECT `TimeFinish` FROM `ExportTask` WHERE `Export` = '.$ExportId);
    307307  $ExportTask = $DbResult->fetch_assoc();
    308   if($ExportTask['TimeFinish'] <> '')
     308  if ($ExportTask['TimeFinish'] <> '')
    309309  {
    310310    $FileName = 'Instalace_CzechWoW_'.$Export->ClientVersion['Version'].'.exe';
     
    313313    $Output .= ShowProgress($Export);
    314314  }
    315   return($Output);
     315  return $Output;
    316316}
    317317
     
    324324  $Export->Init();
    325325
    326   if(function_exists('gzcompress'))
     326  if (function_exists('gzcompress'))
    327327  {
    328328    $Output = 'Generování lua souborů...<br />';
     
    342342    'Souhrný archív <a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_Lua.zip').'">CzWoW_Lua.zip</a><br />';
    343343  $DbResult = $System->Database->query('SELECT `Group`.* FROM `ExportGroup` JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$Export->Id.' AND `Group`.`LuaFileName` != ""');
    344   while($Group = $DbResult->fetch_assoc())
     344  while ($Group = $DbResult->fetch_assoc())
    345345  {
    346346    $Output .= '<a href="'.$System->Link('/'.$Export->TempDirRelative.'lua/'.$Group['LuaFileName'].'.lua').'">'.$Group['LuaFileName'].'.lua</a><br/>';
    347347  }
    348348  $Output .= '<br /><br /><strong>Použití ve hře</strong><br />Ze souborů vytvořte MPQ archív a nahrajte ho do hry do podsložky jako Data/enUS/patch-enUS-5.MPQ nebo Data/enUS/patch-enGB-5.MPQ. Pro starší verze hry než 3.2.0 je nutné spouštět hru pomocí programu WoWMe.exe (WoW Model Editor Fix).';
    349   return($Output);
     349  return $Output;
    350350}
    351351
    352352function ExportOutput($ExportId, $Type)
    353353{
    354   if($Type == 1) $Output = OutputMangosSQLToHTML($ExportId);
    355   else if($Type == 2) $Output = OutputMangosSQLToFile($ExportId);
    356   else if($Type == 3) $Output = OutputAoWoWToHTML($ExportId);
    357   else if($Type == 4) $Output = OutputAoWoWToFile($ExportId);
    358   else if($Type == 5) $Output = OutputXMLToHTML($ExportId);
    359   else if($Type == 6) $Output = OutputXMLToFile($ExportId);
    360   else if($Type == 7) $Output = OutputAddon($ExportId);
    361   else if($Type == 8) $Output = OutputLua($ExportId);
    362   else if($Type == 9) $Output = OutputDBCToFile($ExportId);
    363   else if($Type == 10) $Output = OutputEXEToFile($ExportId);
     354  if ($Type == 1) $Output = OutputMangosSQLToHTML($ExportId);
     355  else if ($Type == 2) $Output = OutputMangosSQLToFile($ExportId);
     356  else if ($Type == 3) $Output = OutputAoWoWToHTML($ExportId);
     357  else if ($Type == 4) $Output = OutputAoWoWToFile($ExportId);
     358  else if ($Type == 5) $Output = OutputXMLToHTML($ExportId);
     359  else if ($Type == 6) $Output = OutputXMLToFile($ExportId);
     360  else if ($Type == 7) $Output = OutputAddon($ExportId);
     361  else if ($Type == 8) $Output = OutputLua($ExportId);
     362  else if ($Type == 9) $Output = OutputDBCToFile($ExportId);
     363  else if ($Type == 10) $Output = OutputEXEToFile($ExportId);
    364364  else $Output = ShowMessage('Nebyl vybrán žádný formát výstupu.', MESSAGE_CRITICAL);
    365   return($Output);
    366 }
     365  return $Output;
     366}
  • trunk/Modules/Export/Page.php

    r864 r880  
    1717  {
    1818    $Output = '<a href="?Action=ViewList">'.T('All').'</a>';
    19     if($this->System->User->Licence(LICENCE_USER))
     19    if ($this->System->User->Licence(LICENCE_USER))
    2020    {
    2121      $Output .= ' <a href="?Action=ViewList&amp;Filter=Others">'.T('Others').'</a>'.
     
    2323    }
    2424
    25     if($this->System->User->Licence(LICENCE_USER))
     25    if ($this->System->User->Licence(LICENCE_USER))
    2626      $Output .= '<br/><div style="text-align: center;"><a href="?Action=Create">'.T('Create new export').'</a></div><br/>';
    2727
    2828    $Filter = '';
    29     if(array_key_exists('Filter', $_GET))
    30     {
    31       if($_GET['Filter'] == 'My') $Filter = ' WHERE `Export`.`User` = '.$this->System->User->Id;
    32       if($_GET['Filter'] == 'Others') $Filter = ' WHERE `Export`.`User` != '.$this->System->User->Id;
     29    if (array_key_exists('Filter', $_GET))
     30    {
     31      if ($_GET['Filter'] == 'My') $Filter = ' WHERE `Export`.`User` = '.$this->System->User->Id;
     32      if ($_GET['Filter'] == 'Others') $Filter = ' WHERE `Export`.`User` != '.$this->System->User->Id;
    3333    }
    3434
     
    6262      '(SELECT COUNT(*) FROM `ExportUser` WHERE `ExportUser`.`Export`=`Export`.`Id`) AS `UserCount` FROM `Export` '.
    6363      'LEFT JOIN `User` ON `User`.`ID`=`Export`.`User` '.$Filter.$Order['SQL'].$PageList['SQLLimit']);
    64     while($Export = $DbResult->fetch_assoc())
     64    while ($Export = $DbResult->fetch_assoc())
    6565    {
    6666      $Action = '<a href="?Action=View&amp;ExportId='.$Export['Id'].'&amp;Tab=0">'.T('View').'</a> '.
    6767        '<a href="?Action=View&amp;ExportId='.$Export['Id'].'&amp;Tab=7">'.T('Make export').'</a>';
    68       if($Export['User'] == $this->System->User->Id) $Action .= ' <a href="?Action=Delete&amp;ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy delete item?').'\');">'.T('Delete').'</a>';
    69       if($this->System->User->Id != null) $Action .= ' <a href="?Action=Clone&amp;ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy clone item?').'\');">'.T('Clone').'</a>';
     68      if ($Export['User'] == $this->System->User->Id) $Action .= ' <a href="?Action=Delete&amp;ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy delete item?').'\');">'.T('Delete').'</a>';
     69      if ($this->System->User->Id != null) $Action .= ' <a href="?Action=Clone&amp;ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy clone item?').'\');">'.T('Clone').'</a>';
    7070      $Output .= '<tr><td>'.HumanDate($Export['TimeCreate']).'</td>'.
    7171          '<td><a href="'.$this->System->Link('/user/?user='.$Export['User']).'">'.$Export['UserName'].'</a></td>'.
     
    7979        $PageList['Output'];
    8080
    81     return($Output);
     81    return $Output;
    8282  }
    8383
    8484  function ExportCreate()
    8585  {
    86     if($this->System->User->Licence(LICENCE_USER))
     86    if ($this->System->User->Licence(LICENCE_USER))
    8787    {
    8888      $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id);
    8989      $DbRow = $DbResult->fetch_row();
    90       if($DbRow[0] < $this->System->Config['MaxExportPerUser'])
     90      if ($DbRow[0] < $this->System->Config['MaxExportPerUser'])
    9191      {
    9292        $Output = '<form action="?Action=CreateFinish" method="post">'.
     
    9898      } else $Output = ShowMessage(sprintf(T('You can\'t create another export. Max for one user is %d.'), $this->System->Config['MaxExportPerUser']), MESSAGE_CRITICAL);
    9999    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    100     return($Output);
     100    return $Output;
    101101  }
    102102
    103103  function ExportCreateFinish()
    104104  {
    105     if($this->System->User->Licence(LICENCE_USER))
    106     {
    107       if(array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST))
     105    if ($this->System->User->Licence(LICENCE_USER))
     106    {
     107      if (array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST))
    108108      {
    109109        $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id);
    110110        $DbRow = $DbResult->fetch_row();
    111         if($DbRow[0] < $this->System->Config['MaxExportPerUser'])
     111        if ($DbRow[0] < $this->System->Config['MaxExportPerUser'])
    112112        {
    113113          $this->System->Database->query('INSERT INTO `Export` (`Title`, `User`, `TimeCreate`, `WithDiacritic`, `Description`) VALUES ("'.$_POST['Title'].'", '.$this->System->User->Id.', NOW(), 1, "'.$_POST['Description'].'")');
     
    120120      } else $Output = ShowMessage(T('Missing data in form.'), MESSAGE_CRITICAL);
    121121    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    122     return($Output);
     122    return $Output;
    123123  }
    124124
    125125  function ExportDelete()
    126126  {
    127     if($this->System->User->Licence(LICENCE_USER))
     127    if ($this->System->User->Licence(LICENCE_USER))
    128128    {
    129129      $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE (`Id`='.($_GET['ExportId'] * 1).') AND (`User`='.$this->System->User->Id.')');
    130       if($DbResult->num_rows > 0)
     130      if ($DbResult->num_rows > 0)
    131131      {
    132132        $this->System->Database->query('DELETE FROM `ExportGroup` WHERE `Export`='.$_GET['ExportId']);
     
    143143      } else $Output = ShowMessage(T('Export not found.'), MESSAGE_CRITICAL);
    144144    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    145     return($Output);
     145    return $Output;
    146146  }
    147147
     
    163163    $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    164164    $Export = $DbResult->fetch_assoc();
    165     if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
     165    if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
    166166    else $Editable = false;
    167167
    168     if(array_key_exists('Operation', $_POST))
    169     {
    170       if($_POST['Operation'] == 'Save')
     168    if (array_key_exists('Operation', $_POST))
     169    {
     170      if ($_POST['Operation'] == 'Save')
    171171      {
    172172        //print_r($_POST);
    173173        // Update user selection page
    174         foreach($_POST as $Index => $Value)
     174        foreach ($_POST as $Index => $Value)
    175175        {
    176           if(substr($Index, 0, 3) == 'seq')
     176          if (substr($Index, 0, 3) == 'seq')
    177177          {
    178178            $UserId = substr($Index, 3) * 1;
    179             if(array_key_exists('sel'.$UserId, $_POST)) $Selected = true;
     179            if (array_key_exists('sel'.$UserId, $_POST)) $Selected = true;
    180180            else $Selected = false;
    181181            $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `User`='.$UserId;
    182182            $DbResult = $this->System->Database->query('SELECT * FROM `ExportUser` '.$Condition);
    183             if($DbResult->num_rows > 0)
     183            if ($DbResult->num_rows > 0)
    184184            {
    185               if(!$Selected) $this->System->Database->query('DELETE FROM `ExportUser` '.$Condition);
     185              if (!$Selected) $this->System->Database->query('DELETE FROM `ExportUser` '.$Condition);
    186186              else $this->System->Database->query('UPDATE `ExportUser` SET `Sequence`='.$Value.$Condition);
    187187            } else
    188188            {
    189               if($Selected) $this->System->Database->query('INSERT INTO `ExportUser` (`Export`, `User`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$UserId.', '.$Value.')');
     189              if ($Selected) $this->System->Database->query('INSERT INTO `ExportUser` (`Export`, `User`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$UserId.', '.$Value.')');
    190190            }
    191191          }
     
    221221    );
    222222    $Order = GetOrderTableHeader($TableColumns, 'TranslatedCount', 1);
    223     if($Order['Column'] != 'Sequence2') $InitialOrder = ', '.substr($Order['SQL'], 10);
     223    if ($Order['Column'] != 'Sequence2') $InitialOrder = ', '.substr($Order['SQL'], 10);
    224224    else $InitialOrder = '';
    225225
     
    234234    $Output .= '<form name="Translators" action="?Action=View&amp;ExportId='.$_GET['ExportId'].'" method="post">'.
    235235        '<h3>'.T('Translators').'</h3>';
    236     if($Editable)
     236    if ($Editable)
    237237    {
    238238      $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'.
     
    252252    $this->System->Database->query('SET @I = 0');
    253253    $DbResult = $this->System->Database->query($Query);
    254     while($UserLine = $DbResult->fetch_assoc())
     254    while ($UserLine = $DbResult->fetch_assoc())
    255255    {
    256256      $XP = GetLevelMinMax($UserLine['XP']);
     
    268268        '</form>'.
    269269        $PageList['Output'];
    270     return($Output);
     270    return $Output;
    271271  }
    272272
     
    278278    $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    279279    $Export = $DbRows->fetch_assoc();
    280     if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
     280    if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
    281281    else $Editable = false;
    282282
    283     if(array_key_exists('Operation', $_POST))
    284       if($_POST['Operation'] == 'Save')  if($Editable and array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST))
    285       {
    286         if(array_key_exists('WithDiacritic', $_POST)) $WithDiacritic = 1;
     283    if (array_key_exists('Operation', $_POST))
     284      if ($_POST['Operation'] == 'Save')  if ($Editable and array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST))
     285      {
     286        if (array_key_exists('WithDiacritic', $_POST)) $WithDiacritic = 1;
    287287        else $WithDiacritic = 0;
    288288        if (array_key_exists('Featured', $_POST)) $Export['Featured'] = 1;
     
    296296      }
    297297
    298       if($Export['WithDiacritic'] == 1) $WithDiacritic = ' checked="checked"';
     298      if ($Export['WithDiacritic'] == 1) $WithDiacritic = ' checked="checked"';
    299299      else $WithDiacritic = '';
    300300      $Output .= '<form action="?Action=View&amp;Tab=0&amp;ExportId='.$Export['Id'].'" method="post">'.
    301301          '<table>';
    302       if($this->System->User->Id != null)
     302      if ($this->System->User->Id != null)
    303303      {
    304304        $Output .= '<input type="hidden" name="Operation" value="Save"/>'.
    305305            '<tr><td colspan="2">';
    306         if($Editable) $Output .= ' <input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>';
     306        if ($Editable) $Output .= ' <input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>';
    307307        $Output .= ' <a href="?Action=Clone&amp;ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy clone item?').'\');">'.T('Clone').'</a> ';
    308         if($this->System->User->Licence(LICENCE_ADMIN))
     308        if ($this->System->User->Licence(LICENCE_ADMIN))
    309309          $Output .= CheckBox('Featured', $Export['Featured'], '', 'CheckBox', !$Editable). ' '.T('Recommended').' ';
    310310        $Output .= '</td></tr>';
     
    314314          '<tr><td>'.T('With diacritics').'</td><td><input type="checkbox" name="WithDiacritic" '.$WithDiacritic.''.$DisabledInput[$Editable].'/></td></tr>'.
    315315          '</table></form>';
    316       return($Output);
     316      return $Output;
    317317  }
    318318
     
    325325    $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    326326    $Export = $DbRows->fetch_assoc();
    327     if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
     327    if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
    328328    else $Editable = false;
    329329
    330     if(array_key_exists('Operation', $_POST))
    331     {
    332       if($_POST['Operation'] == 'Save')
     330    if (array_key_exists('Operation', $_POST))
     331    {
     332      if ($_POST['Operation'] == 'Save')
    333333      {
    334334        //print_r($_POST);
    335335        // Update user selection page
    336         foreach($_POST as $Index => $Value)
     336        foreach ($_POST as $Index => $Value)
    337337        {
    338           if(substr($Index, 0, 3) == 'seq')
     338          if (substr($Index, 0, 3) == 'seq')
    339339          {
    340340            $LanguageId = substr($Index, 3) * 1;
    341             if(array_key_exists('sel'.$LanguageId, $_POST)) $Selected = true;
     341            if (array_key_exists('sel'.$LanguageId, $_POST)) $Selected = true;
    342342            else $Selected = false;
    343343            $Condition = ' WHERE Export='.$_GET['ExportId'].' AND `Language`='.$LanguageId;
    344344            $DbResult = $this->System->Database->query('SELECT * FROM `ExportLanguage` '.$Condition);
    345             if($DbResult->num_rows > 0)
     345            if ($DbResult->num_rows > 0)
    346346            {
    347               if(!$Selected) $this->System->Database->query('DELETE FROM `ExportLanguage` '.$Condition);
     347              if (!$Selected) $this->System->Database->query('DELETE FROM `ExportLanguage` '.$Condition);
    348348              else $this->System->Database->query('UPDATE `ExportLanguage` SET `Sequence`='.$Value.$Condition);
    349349            } else
    350350            {
    351               if($Selected) $this->System->Database->query('INSERT INTO `ExportLanguage` (`Export`, `Language`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$LanguageId.', '.$Value.')');
     351              if ($Selected) $this->System->Database->query('INSERT INTO `ExportLanguage` (`Export`, `Language`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$LanguageId.', '.$Value.')');
    352352            }
    353353          }
     
    377377    $Output .= '<form action="?Action=View&amp;ExportId='.$_GET['ExportId'].'" method="post">'.
    378378        '<h3>'.T('Languages').'</h3>';
    379     if($Editable)
     379    if ($Editable)
    380380    {
    381381      $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'.
     
    393393    $this->System->Database->query('SET @I = 0');
    394394    $DbResult = $this->System->Database->query($Query);
    395     while($Langugage = $DbResult->fetch_assoc())
     395    while ($Langugage = $DbResult->fetch_assoc())
    396396    {
    397397      $Checked = $Langugage['Sequence'] != '';
     
    405405        '</form>'.
    406406        $PageList['Output'];
    407     return($Output);
     407    return $Output;
    408408  }
    409409
     
    416416    $DbRows = $this->System->Database->query('SELECT * FROM Export WHERE Id='.$_GET['ExportId']);
    417417    $Export = $DbRows->fetch_assoc();
    418     if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
     418    if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
    419419    else $Editable = false;
    420420
    421     if(array_key_exists('Operation', $_POST))
    422     {
    423       if($_POST['Operation'] == 'Save')
     421    if (array_key_exists('Operation', $_POST))
     422    {
     423      if ($_POST['Operation'] == 'Save')
    424424      {
    425425        //print_r($_POST);
    426426        // Update user selection page
    427         foreach($_POST as $Index => $Value)
     427        foreach ($_POST as $Index => $Value)
    428428        {
    429           if(substr($Index, 0, 3) == 'seq')
     429          if (substr($Index, 0, 3) == 'seq')
    430430          {
    431431            $GroupId = substr($Index, 3) * 1;
    432             if(array_key_exists('sel'.$GroupId, $_POST)) $Selected = true;
     432            if (array_key_exists('sel'.$GroupId, $_POST)) $Selected = true;
    433433            else $Selected = false;
    434434            $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `Group`='.$GroupId;
    435435            $DbResult = $this->System->Database->query('SELECT * FROM `ExportGroup` '.$Condition);
    436             if($DbResult->num_rows > 0)
     436            if ($DbResult->num_rows > 0)
    437437            {
    438               if(!$Selected) $this->System->Database->query('DELETE FROM `ExportGroup` '.$Condition);
     438              if (!$Selected) $this->System->Database->query('DELETE FROM `ExportGroup` '.$Condition);
    439439            } else
    440440            {
    441               if($Selected) $this->System->Database->query('INSERT INTO `ExportGroup` (`Export`, `Group`) VALUES ('.$_GET['ExportId'].', '.$GroupId.')');
     441              if ($Selected) $this->System->Database->query('INSERT INTO `ExportGroup` (`Export`, `Group`) VALUES ('.$_GET['ExportId'].', '.$GroupId.')');
    442442            }
    443443          }
     
    446446      }
    447447      //items
    448       foreach($TranslationTree as $Group)
    449       {
    450         foreach($TranslationTree[$Group['Id']]['Items'] as $Column) {
    451           if(array_key_exists('item'.$Column['Id'], $_POST)) $Selected = true;
     448      foreach ($TranslationTree as $Group)
     449      {
     450        foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) {
     451          if (array_key_exists('item'.$Column['Id'], $_POST)) $Selected = true;
    452452          else $Selected = false;
    453453          //we will save only forbitten collums and need to be visible
     
    457457            $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `GroupItem`='.$Column['Id'];
    458458            $DbResult = $this->System->Database->query('SELECT * FROM `ExportGroupItem` '.$Condition);
    459             if($DbResult->num_rows > 0)
     459            if ($DbResult->num_rows > 0)
    460460            {
    461               if(!$Selected) $this->System->Database->query('DELETE FROM `ExportGroupItem` '.$Condition);
     461              if (!$Selected) $this->System->Database->query('DELETE FROM `ExportGroupItem` '.$Condition);
    462462            } else
    463463            {
    464               if($Selected) $this->System->Database->query('INSERT INTO `ExportGroupItem` (`Export`, `GroupItem`) VALUES ('.$_GET['ExportId'].', '.$Column['Id'].')');
     464              if ($Selected) $this->System->Database->query('INSERT INTO `ExportGroupItem` (`Export`, `GroupItem`) VALUES ('.$_GET['ExportId'].', '.$Column['Id'].')');
    465465            }
    466466
     
    486486    $Output .= '<form action="?Action=View&amp;ExportId='.$_GET['ExportId'].'" method="post">'.
    487487        '<h3>'.T('Translation groups').'</h3>';
    488     if($Editable)
     488    if ($Editable)
    489489    {
    490490      $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'.
     
    500500
    501501    $DbResultItem = $this->System->Database->query('SELECT * FROM `ExportGroupItem` WHERE `Export`='.$_GET['ExportId']);
    502     while($GroupItem = $DbResultItem->fetch_assoc())
     502    while ($GroupItem = $DbResultItem->fetch_assoc())
    503503    {
    504504      $GroupItems[$GroupItem['GroupItem']] = 1;
     
    507507    $Query = 'SELECT * FROM ('.$Query.') AS TX '.$Order['SQL'].$PageList['SQLLimit'];
    508508    $DbResult = $this->System->Database->query($Query);
    509     while($Group = $DbResult->fetch_assoc())
     509    while ($Group = $DbResult->fetch_assoc())
    510510    {
    511511      $Columns = '';
    512       foreach($TranslationTree[$Group['Id']]['Items'] as $Column) {
     512      foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) {
    513513        if ($Column['Visible']) $Columns .= CheckBox('item'.$Column['Id'],
    514514          !isset($GroupItems[$Column['Id']]), '', 'CheckBox', !$Editable).' '.T($Column['Name']).' <br/>';
     
    533533      '</form>'.
    534534      $PageList['Output'];
    535     return($Output);
     535    return $Output;
    536536  }
    537537
     
    540540    $Output = '';
    541541    $DisabledInput = array(false => ' disabled="disabled"', true => '');
    542     if(array_key_exists('ExportId', $_GET))
     542    if (array_key_exists('ExportId', $_GET))
    543543    {
    544544      $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    545       if($DbRows->num_rows > 0)
     545      if ($DbRows->num_rows > 0)
    546546      {
    547547        $Export = $DbRows->fetch_assoc();
    548         if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
     548        if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
    549549        else $Editable = false;
    550550
    551         if(array_key_exists('Operation', $_POST))
    552           if($_POST['Operation'] == 'Save')
     551        if (array_key_exists('Operation', $_POST))
     552          if ($_POST['Operation'] == 'Save')
    553553          {
    554             if(array_key_exists('OutputType', $_POST) and ($_POST['OutputType'] * 1 > 0))
     554            if (array_key_exists('OutputType', $_POST) and ($_POST['OutputType'] * 1 > 0))
    555555            {
    556556              $this->System->Database->query('UPDATE Export SET OutputType='.$_POST['OutputType'].' WHERE Id='.$_GET['ExportId']);
     
    564564          $Output .= '<h3>'.T('Format the generated output').'</h3>'.
    565565              '<form action="?Action=View&amp;ExportId='.$_GET['ExportId'].'" method="post">';
    566           if($Editable)
     566          if ($Editable)
    567567          {
    568568            $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'.
     
    571571          }
    572572          $DbResult = $this->System->Database->query('SELECT * FROM `ExportOutputType` ORDER BY `Name`');
    573           while($ExportFormat = $DbResult->fetch_assoc())
     573          while ($ExportFormat = $DbResult->fetch_assoc())
    574574          {
    575575            $Output .= RadioButton('OutputType', $ExportFormat['Id'], $Export['OutputType'] == $ExportFormat['Id'], '', !$Editable).' '.$ExportFormat['Name'].'<br/>';
     
    578578      } else $Output .= ShowMessage(T('Item not found'), MESSAGE_CRITICAL);
    579579    } else $Output .= ShowMessage(T('Is isn\'t select'), MESSAGE_CRITICAL);
    580     return($Output);
     580    return $Output;
    581581  }
    582582
     
    587587    $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    588588    $Export = $DbRows->fetch_assoc();
    589     if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
     589    if ($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
    590590    else $Editable = false;
    591591
    592     if(array_key_exists('Operation', $_POST))
    593       if(($_POST['Operation'] == 'Save') and (array_key_exists('ClientVersion', $_POST)))
     592    if (array_key_exists('Operation', $_POST))
     593      if (($_POST['Operation'] == 'Save') and (array_key_exists('ClientVersion', $_POST)))
    594594      {
    595595        $this->System->Database->query('UPDATE `Export` SET `ClientVersion`='.$_POST['ClientVersion'].' WHERE `Id`='.$_GET['ExportId']);
     
    600600      $Export = $DbResult->fetch_assoc();
    601601
    602       if($Export['OutputType'] == '') $Output .= ShowMessage('Nevybrán typ exportu', MESSAGE_CRITICAL);
     602      if ($Export['OutputType'] == '') $Output .= ShowMessage('Nevybrán typ exportu', MESSAGE_CRITICAL);
    603603      else {
    604604        $Query = 'SELECT `ClientVersion`.* FROM `ExportVersion` '.
     
    620620            '<h3>'.T('Client version').'</h3>';
    621621
    622         if($Editable)
     622        if ($Editable)
    623623        {
    624624          $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'.
     
    633633        $Query = 'SELECT * FROM ('.$Query.') AS `TX` '.$Order['SQL'].$PageList['SQLLimit'];
    634634        $DbResult = $this->System->Database->query($Query);
    635         while($Version = $DbResult->fetch_assoc())
     635        while ($Version = $DbResult->fetch_assoc())
    636636        {
    637637          $Output .= '<tr><td><a href="'.$this->System->Link('/client-version/?action=item&amp;id='.$Version['Id']).'">'.
     
    646646            $PageList['Output'];
    647647      }
    648       return($Output);
     648      return $Output;
    649649  }
    650650
     
    654654    $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    655655    $Export = $DbResult->fetch_assoc();
    656     if($Export['OutputType'] == '') $Output .= ShowMessage('Nevybrán typ exportu', MESSAGE_CRITICAL);
    657     else if($Export['ClientVersion'] == '') $Output .= ShowMessage(T('Export don\'t have selected version of client'), MESSAGE_CRITICAL);
     656    if ($Export['OutputType'] == '') $Output .= ShowMessage('Nevybrán typ exportu', MESSAGE_CRITICAL);
     657    else if ($Export['ClientVersion'] == '') $Output .= ShowMessage(T('Export don\'t have selected version of client'), MESSAGE_CRITICAL);
    658658    else {
    659659      $DbResult = $this->System->Database->query('SELECT * FROM `ExportOutputType` WHERE `Id`='.$Export['OutputType']);
    660       if($DbResult->num_rows > 0)
     660      if ($DbResult->num_rows > 0)
    661661      {
    662662        $DbResult = $this->System->Database->query('SELECT * FROM `ExportVersion` WHERE (`ExportType`='.$Export['OutputType'].') AND (`ClientVersion`='.$Export['ClientVersion'].')');
    663         if($DbResult->num_rows > 0)
     663        if ($DbResult->num_rows > 0)
    664664        {
    665665          if (array_key_exists('Auto', $_GET) == false)
     
    669669      } else $Output = ShowMessage(T('Format output isn\'t select').'.', MESSAGE_CRITICAL);
    670670    }
    671     return($Output);
     671    return $Output;
    672672  }
    673673
     
    679679    $Export->LoadFilters();
    680680
    681     if(($Export->Export['ClientVersion'] == '') or ($Export->ClientVersion['BuildNumber'] == ''))
     681    if (($Export->Export['ClientVersion'] == '') or ($Export->ClientVersion['BuildNumber'] == ''))
    682682      $Output = ShowMessage(T('Export don\'t have selected version of client'), MESSAGE_CRITICAL);
    683683    else {
     
    687687      $UnionItems = array();
    688688      $DbResult = $this->System->Database->query($GroupListQuery.$Where);
    689       while($DbRow = $DbResult->fetch_assoc())
     689      while ($DbRow = $DbResult->fetch_assoc())
    690690      {
    691691        $UnionItems[] = 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('.
     
    721721      $Translated = 0;
    722722      $Total = 0;
    723       if(count($UnionItems) > 0)
     723      if (count($UnionItems) > 0)
    724724      {
    725725        $ID = $this->System->Database->query('SELECT *, ROUND(`Translated` / `Total` * 100, 2) AS `Percent` FROM ('.implode(' UNION ALL ', $UnionItems).') AS `C3` '.$Order['SQL'].$PageList['SQLLimit']);
    726         while($Group = $ID->fetch_assoc())
     726        while ($Group = $ID->fetch_assoc())
    727727        {
    728728          $Output .= '<tr><td>'.T($Group['Name']).'</td><td>'.$Group['Translated'].'</td><td>'.$Group['Total'].'</td><td>'.ProgressBar(150, $Group['Percent']).'</td></tr>';
     
    731731        }
    732732      }
    733       if($Total > 0) $Percent = $Translated / $Total * 100;
     733      if ($Total > 0) $Percent = $Translated / $Total * 100;
    734734      else $Percent = 100;
    735735
     
    737737      $Output .= '</table>';
    738738    }
    739     return($Output);
     739    return $Output;
    740740  }
    741741
     
    743743  {
    744744    $Output = '';
    745     if(array_key_exists('ExportId', $_GET) and is_numeric($_GET['ExportId']))
     745    if (array_key_exists('ExportId', $_GET) and is_numeric($_GET['ExportId']))
    746746    {
    747747      $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    748       if($DbResult->num_rows > 0)
     748      if ($DbResult->num_rows > 0)
    749749      {
    750750        $Export = $DbResult->fetch_assoc();
     
    759759          T('Statistic'), T('Output')));
    760760        $Output .= '<div id="content">';
    761         if($_SESSION['Tab'] == TAB_GENERAL) $Output .= $this->ExportViewGeneral();
    762         else if($_SESSION['Tab'] == TAB_TRANSLATORS) $Output .= $this->ExportViewTranslators();
    763         else if($_SESSION['Tab'] == TAB_GROUPS) $Output .= $this->ExportViewGroups();
    764         else if($_SESSION['Tab'] == TAB_LANGUAGES) $Output .= $this->ExportViewLanguages();
    765         else if($_SESSION['Tab'] == TAB_OUTPUT_FORMAT) $Output .= $this->ExportViewOutputFormat();
    766         else if($_SESSION['Tab'] == TAB_VERSION) $Output .= $this->ExportViewVersion();
    767         else if($_SESSION['Tab'] == TAB_STAT) $Output .= $this->ExportViewStat();
    768         else if($_SESSION['Tab'] == TAB_OUTPUT) $Output .= $this->ExportViewOutput();
     761        if ($_SESSION['Tab'] == TAB_GENERAL) $Output .= $this->ExportViewGeneral();
     762        else if ($_SESSION['Tab'] == TAB_TRANSLATORS) $Output .= $this->ExportViewTranslators();
     763        else if ($_SESSION['Tab'] == TAB_GROUPS) $Output .= $this->ExportViewGroups();
     764        else if ($_SESSION['Tab'] == TAB_LANGUAGES) $Output .= $this->ExportViewLanguages();
     765        else if ($_SESSION['Tab'] == TAB_OUTPUT_FORMAT) $Output .= $this->ExportViewOutputFormat();
     766        else if ($_SESSION['Tab'] == TAB_VERSION) $Output .= $this->ExportViewVersion();
     767        else if ($_SESSION['Tab'] == TAB_STAT) $Output .= $this->ExportViewStat();
     768        else if ($_SESSION['Tab'] == TAB_OUTPUT) $Output .= $this->ExportViewOutput();
    769769        else $Output .= $this->ExportViewGeneral();
    770770
     
    772772      } else $Output .= ShowMessage(T('Export not found.'), MESSAGE_CRITICAL);
    773773    } else $Output .= ShowMessage(T('Is isn\'t select'), MESSAGE_CRITICAL);
    774     return($Output);
     774    return $Output;
    775775  }
    776776
    777777  function ExportClone()
    778778  {
    779     if($this->System->User->Licence(LICENCE_USER))
    780     {
    781       if(array_key_exists('ExportId', $_GET) and is_numeric($_GET['ExportId']))
     779    if ($this->System->User->Licence(LICENCE_USER))
     780    {
     781      if (array_key_exists('ExportId', $_GET) and is_numeric($_GET['ExportId']))
    782782      {
    783783        $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id);
    784784        $DbRow = $DbResult->fetch_row();
    785         if($DbRow[0] < $this->System->Config['MaxExportPerUser'])
     785        if ($DbRow[0] < $this->System->Config['MaxExportPerUser'])
    786786        {
    787787          $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
    788           if($DbResult->num_rows > 0)
     788          if ($DbResult->num_rows > 0)
    789789          {
    790790            $DbRow = $DbResult->fetch_assoc();
     
    810810      } else $Output = ShowMessage(T('Export not found.'), MESSAGE_CRITICAL);
    811811    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    812     return($Output);
     812    return $Output;
    813813  }
    814814
     
    816816  {
    817817    $this->Title = T('Export');
    818     if(array_key_exists('Action', $_GET))
    819     {
    820       if($_GET['Action'] == 'Create') $Output = $this->ExportCreate();
    821       else if($_GET['Action'] == 'CreateFinish') $Output = $this->ExportCreateFinish();
    822       else if($_GET['Action'] == 'View') $Output = $this->ExportView();
    823       else if($_GET['Action'] == 'Delete') $Output = $this->ExportDelete();
    824       else if($_GET['Action'] == 'Clone') $Output = $this->ExportClone();
     818    if (array_key_exists('Action', $_GET))
     819    {
     820      if ($_GET['Action'] == 'Create') $Output = $this->ExportCreate();
     821      else if ($_GET['Action'] == 'CreateFinish') $Output = $this->ExportCreateFinish();
     822      else if ($_GET['Action'] == 'View') $Output = $this->ExportView();
     823      else if ($_GET['Action'] == 'Delete') $Output = $this->ExportDelete();
     824      else if ($_GET['Action'] == 'Clone') $Output = $this->ExportClone();
    825825      else $Output = $this->ExportList();
    826826    } else $Output = $this->ExportList();
    827     return($Output);
     827    return $Output;
    828828  }
    829829}
     
    839839  function Show()
    840840  {
    841     if(array_key_exists('i', $_GET))
     841    if (array_key_exists('i', $_GET))
    842842      $Output = $this->System->ModuleManager->Modules['Export']->GetTaskProgress($_GET['i'] * 1);
    843843      else $Output = 'Missing task id';
    844     return($Output);
     844    return $Output;
    845845  }
    846846}
  • trunk/Modules/Export/ProcessAoWoWExport.php

    r848 r880  
    1414$Output = '';
    1515
    16 if(defined('STDIN') == false)
     16if (defined('STDIN') == false)
    1717{
    1818  $Output = T('Access denied');
     
    2020}
    2121
    22 foreach($_SERVER['argv'] as $parameter)
     22foreach ($_SERVER['argv'] as $parameter)
    2323{
    24   if(strpos($parameter, '=') !== false)
     24  if (strpos($parameter, '=') !== false)
    2525  {
    2626    $index = substr($parameter, 0, strpos($parameter, '='));
     
    3333echo 'Generuji Export:';
    3434  $Export = new Export($System);
    35 if(!array_key_exists('AoWoWExportId', $Config)) {
     35if (!array_key_exists('AoWoWExportId', $Config)) {
    3636  $Export->Id = $Config['AoWoWExportId'];
    3737} else $Export->Id = 37;
     
    4545$UserSelection = array();
    4646$DbResult = $System->Database->query('SELECT `ID`, `XP` FROM `User`');
    47 while($DbRow = $DbResult->fetch_assoc())
     47while ($DbRow = $DbResult->fetch_assoc())
    4848{
    4949  $UserSelection[$DbRow['ID']] = $DbRow['XP'];
     
    5353// Update export user selection sequence
    5454$Sequence = 1;
    55 foreach($UserSelection as $ID => $XP)
     55foreach ($UserSelection as $ID => $XP)
    5656{
    5757  $DbResult = $System->Database->query('SELECT `Id` FROM `ExportUser` WHERE `Export` = '.$Config['AoWoWExportId'].' AND `User` = '.$ID);
    58   if($DbResult->num_rows > 0)
     58  if ($DbResult->num_rows > 0)
    5959    $Query = 'UPDATE `ExportUser` SET `Sequence` = '.$Sequence.' WHERE `Export` = '.$Config['AoWoWExportId'].' AND `User` = '.$ID;
    6060    else $Query = 'INSERT INTO `ExportUser` (`Export`, `User`, `Sequence`) VALUES ('.$Config['AoWoWExportId'].', '.$ID.', '.$Sequence.')';
     
    7070$Database2->query('SET NAMES '.$Config['Database']['Charset']);
    7171$Database2->select_db($Config['Database']['DatabaseAoWoW']);
    72 foreach($SQL as $Line)
     72foreach ($SQL as $Line)
    7373{
    7474//echo '.';
    7575  //echo($Line."\n");
    76   if(trim($Line) != '') $Database2->query($Line);
     76  if (trim($Line) != '') $Database2->query($Line);
    7777}
    7878echo 'Hotovo
     
    8383// Delete temporary cache files
    8484$Files = scandir(dirname(__FILE__).'/../../aowow/cache/mangos');
    85 foreach($Files as $File)
     85foreach ($Files as $File)
    8686{
    8787  $End = substr($File, strlen($File) - 3);
    88   if($End == 'aww') unlink(dirname(__FILE__).'/../../aowow/cache/mangos/'.$File);
     88  if ($End == 'aww') unlink(dirname(__FILE__).'/../../aowow/cache/mangos/'.$File);
    8989}
    9090$Files = scandir(dirname(__FILE__).'/../../aowow/cache/templates/wowhead');
    91 foreach($Files as $File)
     91foreach ($Files as $File)
    9292{
    9393  $End = substr($File, strlen($File) - 3);
    94   if($End == 'php') unlink(dirname(__FILE__).'/../../aowow/cache/templates/wowhead/'.$File);
     94  if ($End == 'php') unlink(dirname(__FILE__).'/../../aowow/cache/templates/wowhead/'.$File);
    9595}
    9696echo 'Hotovo
  • trunk/Modules/Export/ProcessTask.php

    r869 r880  
    2323  function DeleteOldFiles($deldir)
    2424  {
    25     if(file_exists($deldir.'/'))
     25    if (file_exists($deldir.'/'))
    2626    {
    2727      $Dir = opendir($deldir.'/') ;
    28       while(($File = readdir($Dir)) !== false)
     28      while (($File = readdir($Dir)) !== false)
    2929      {
    30         if(($File != '..') and ($File != '.') and (!is_dir($File))) unlink($deldir.'/'.$File);
     30        if (($File != '..') and ($File != '.') and (!is_dir($File))) unlink($deldir.'/'.$File);
    3131      }
    3232      closedir($Dir);
     
    5656  function MPQPack($packdir)
    5757  {
    58     if(file_exists($packdir.DIRECTORY_SEPARATOR))
     58    if (file_exists($packdir.DIRECTORY_SEPARATOR))
    5959    {
    6060      $Dir = opendir($packdir.DIRECTORY_SEPARATOR);
    61       while(($File = readdir($Dir)) !== false)
     61      while (($File = readdir($Dir)) !== false)
    6262      {
    63         if(($File != '..') and ($File != '.')) {
     63        if (($File != '..') and ($File != '.')) {
    6464          $File = str_replace('/', DIRECTORY_SEPARATOR, $File);
    6565          $InDir = '';
     
    109109    // Delete old files
    110110    $this->DeleteOldFiles($Export->TempDir.'dbc');
    111     if(file_exists($Export->TempDir.'CzWoW_DBC.zip')) unlink($Export->TempDir.'CzWoW_DBC.zip');
     111    if (file_exists($Export->TempDir.'CzWoW_DBC.zip')) unlink($Export->TempDir.'CzWoW_DBC.zip');
    112112
    113113    $this->SetProgress(20);
    114     if(function_exists('gzcompress'))
     114    if (function_exists('gzcompress'))
    115115    {
    116116      $Export->ExportToDBC();
     
    185185    global $Config;
    186186
    187     while(1)
     187    while (1)
    188188    {
    189189      $DbResult = $this->Database->query('SELECT `ExportTask`.`Id`, `ExportTask`.`Export`, '.
     
    191191        'LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` WHERE '.
    192192        '(`ExportTask`.`TimeFinish` IS NULL) ORDER BY `TimeQueued`');
    193       while($Task = $DbResult->fetch_assoc())
     193      while ($Task = $DbResult->fetch_assoc())
    194194      {
    195195        $this->Id = $Task['Id'];
    196         if($Task['ExportId'] != '')
     196        if ($Task['ExportId'] != '')
    197197        {
    198198          try
     
    201201            $this->Database->update('ExportTask', '`Id`='.$this->Id, array('TimeStart' => 'NOW()'));
    202202
    203             if($Task['ExportOutput'] == 9)
     203            if ($Task['ExportOutput'] == 9)
    204204            {
    205205              $this->ExportDBC($Task);
    206206            } else
    207             if($Task['ExportOutput'] == 10)
     207            if ($Task['ExportOutput'] == 10)
    208208            {
    209209              $this->ExportEXE($Task);
  • trunk/Modules/Export/cmdmpqexport.php

    r867 r880  
    1717$Output = '';
    1818
    19 if(defined('STDIN') == false)
     19if (defined('STDIN') == false)
    2020{
    2121  $Output = T('Access denied');
     
    2323}
    2424
    25 foreach($_SERVER['argv'] as $parameter)
     25foreach ($_SERVER['argv'] as $parameter)
    2626{
    27   if(strpos($parameter, '=') !== false)
     27  if (strpos($parameter, '=') !== false)
    2828  {
    2929    $index = substr($parameter, 0, strpos($parameter, '='));
     
    3333  } else $_GET[$parameter] = '';
    3434}
    35 if(!array_key_exists('ExportId', $_GET) and !array_key_exists('needgeneration', $_GET) and !array_key_exists('version', $_GET) and !array_key_exists('dbc', $_GET) and !array_key_exists('lua', $_GET) and !array_key_exists('addon', $_GET)) {
     35if (!array_key_exists('ExportId', $_GET) and !array_key_exists('needgeneration', $_GET) and !array_key_exists('version', $_GET) and !array_key_exists('dbc', $_GET) and !array_key_exists('lua', $_GET) and !array_key_exists('addon', $_GET)) {
    3636  $Output .= 'Usage type_export=id_export -for export<br />';
    3737  $Output .= 'Usage ExportId=id_export - for write export info<br />';
     
    4343}
    4444                     //37
    45 if(array_key_exists('lua', $_GET)) {
     45if (array_key_exists('lua', $_GET)) {
    4646  $Export = new Export($System);
    4747  $Export->Id = $_GET['lua'];
     
    5353',$Output);
    5454}
    55 if(array_key_exists('version', $_GET)) {
     55if (array_key_exists('version', $_GET)) {
    5656  $Export = new Export($System);
    5757  $Export->Id = $_GET['version'];
     
    6363',$Output);
    6464}
    65 if(array_key_exists('dbc', $_GET)) {
     65if (array_key_exists('dbc', $_GET)) {
    6666  $Export = new Export($System);
    6767  $Export->Id = $_GET['dbc'];
     
    7373',$Output);
    7474}
    75 if(array_key_exists('addon', $_GET)) {
     75if (array_key_exists('addon', $_GET)) {
    7676    $Addon = new ExportAddon($System);
    7777    $Addon->Id = $_GET['addon'];
     
    8484}
    8585
    86 if(array_key_exists('needgeneration', $_GET)) {
     86if (array_key_exists('needgeneration', $_GET)) {
    8787  $DbRows = $System->Database->query('SELECT `ClientVersion`.`Version` AS `Version`, '.
    8888    '`Export`.`Id`,`Export`.`ClientVersion`,`Export`.`OutputType`,`Export`.`Title`,'.
     
    9696  if ($Export->NeedGeneration()) {
    9797    $DbResult = $System->Database->query('SELECT * FROM `ExportTask` WHERE `Export` = '.$Export->Id);
    98     if($DbResult->num_rows == 0)
     98    if ($DbResult->num_rows == 0)
    9999    {
    100100      $System->Database->query('INSERT INTO `ExportTask` (`Export` ,`TimeStart` ) VALUES ('.$Export->Id.', NOW())');
     
    114114}
    115115
    116 if(array_key_exists('ExportId', $_GET)) {
     116if (array_key_exists('ExportId', $_GET)) {
    117117  $Export = new Export($System);
    118118  $Export->Id = $_GET['ExportId'];
Note: See TracChangeset for help on using the changeset viewer.