Ignore:
Timestamp:
Apr 7, 2020, 10:15:48 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Improved code formatting.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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}
Note: See TracChangeset for help on using the changeset viewer.