TempDir = NormalizePath(dirname(__FILE__).'/../../'.Core::Cast($this->System)->Config['Web']['TempFolder'].'Export/'.$this->Id.'/');
if (!file_exists($this->TempDir)) mkdir($this->TempDir, 0777, true);
$this->TempDirRelative = Core::Cast($this->System)->Config['Web']['TempFolder'].'Export/'.$this->Id.'/';
$this->SourceDir = NormalizePath(dirname(__FILE__).'/../../'.Core::Cast($this->System)->Config['Web']['SourceFolder']);
$this->SourceDirRelative = Core::Cast($this->System)->Config['Web']['SourceFolder'];
if (!file_exists($this->SourceDir)) mkdir($this->SourceDir, 0777, true);
}
function SaveAllUsers()
{
$DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$this->Id);
$Export = $DbResult->fetch_assoc();
if ($Export['AllUsers'])
{
$DbResult2 = $this->System->Database->query('SELECT ID FROM `User` WHERE `ID` NOT IN(SELECT `User` FROM `ExportUser` WHERE `Export`='.$this->Id.')');
while ($UserLine = $DbResult2->fetch_assoc())
{
$Condition = ' WHERE `Export`='.$this->Id.' AND `User`='.$UserLine['ID'];
$DbResult = $this->System->Database->query('SELECT * FROM `ExportUser` '.$Condition); //,MAX(`Sequence`) as MaxSequence
if ($DbResult->num_rows > 0)
{
// $this->System->Database->query('UPDATE `ExportUser` SET `Sequence`='.$Value.$Condition);
} else
{
$this->System->Database->query('INSERT INTO `ExportUser` (`Export`, `User`, `Sequence`) VALUES ('.$this->Id.', '.$UserLine['ID'].', 0)');
}
}
$this->System->Database->query('SET @I = 0');
$this->System->Database->query('UPDATE `ExportUser` SET `Sequence` = (@I := @I + 1) WHERE `Export`='.$this->Id.' ORDER BY `Sequence`;');
}
}
function LoadFilters()
{
$DbResult = $this->Database->query('SELECT * FROM `Export` WHERE `Id`='.$this->Id);
if ($DbResult->num_rows == 0) throw new Exception('Export '.$this->Id.' neexistuje');
$this->Export = $DbResult->fetch_assoc();
// Filter selected users
$this->UserNames = '';
$DbResult = $this->Database->query('SELECT `ExportUser`.*, `User`.`Name`, `User`.`ID` FROM `ExportUser` '.
'LEFT JOIN `User` ON `User`.`ID`=`ExportUser`.`User` '.
'WHERE `ExportUser`.`Export`='.$this->Id.' ORDER BY `ExportUser`.`Sequence`');
while ($UserLine = $DbResult->fetch_assoc())
{
$this->UserNames .= ', '.$UserLine['Name'];
}
$this->UserNames = substr($this->UserNames, 2);
if ($this->Export['ClientVersion'] != '')
{
$DbResult = $this->Database->query('SELECT * FROM `ClientVersion` WHERE `Id`='.$this->Export['ClientVersion']);
$this->ClientVersion = $DbResult->fetch_assoc();
} else $this->ClientVersion = array();
}
function BuildQuery($Group, $Version = '')
{
$TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
$this->SaveAllUsers();
if ($Version <> '')
$ExportVersion = $Version;
else
$ExportVersion = $this->ClientVersion['BuildNumber'];
$DbResultItem = $this->System->Database->query('SELECT * FROM `ExportGroupItem` WHERE `Export`='.$this->Id);
while ($GroupItem = $DbResultItem->fetch_assoc())
{
$GroupItems[$GroupItem['GroupItem']] = 1;
}
// Build selected columns
$Columns = '';
foreach ($TranslationTree[$Group['Id']]['Items'] as $Column)
{
if (!isset($GroupItems[$Column['Id']])) $Columns .= ' `T`.`'.$Column['Column'].'` AS `'.$Column['Column'].'`, ';
}
// $Columns = substr($Columns, 0, -2);
$Query = 'SELECT * FROM (SELECT MIN(`TT`.`ID`) AS `TTID` FROM
(SELECT '.$Columns.' T.`ID`,T.`Language`,T.`User`,T.`Entry`,T.`VersionEnd`,T.`VersionStart`, `User`.`Name` AS `UserName` FROM `'.$Group['TablePrefix'].'` AS `T`'.
' JOIN `ExportUser` ON (`ExportUser`.`User`=`T`.`User`) AND (`ExportUser`.`Export`='.$this->Id.') '.
' JOIN `User` ON `User`.`ID`=`T`.`User`'.
' JOIN `ExportLanguage` ON (`ExportLanguage`.`Export`='.$this->Id.')'.
' WHERE (`Complete` = 1) AND (`VersionStart` <= '.$ExportVersion.') AND (`VersionEnd` >= '.$ExportVersion.')'.
' ORDER BY `ExportLanguage`.`Sequence`, `ExportUser`.`Sequence`) AS `TT` GROUP BY `TT`.`Entry`) AS `TK`'.
' LEFT JOIN `'.$Group['TablePrefix'].'` AS `TJ` ON `TJ`.`ID` = `TK`.`TTID` ';
// Build columns for english texts
$OriginalColumns = '';
foreach ($TranslationTree[$Group['Id']]['Items'] as $Column)
{
$OriginalColumns .= ' `T3`.`'.$Column['Column'].'` AS `En'.$Column['Column'].'`, ';
if (isset($GroupItems[$Column['Id']]))
$OriginalColumns .= ' `T3`.`'.$Column['Column'].'` AS `'.$Column['Column'].'`, ';
}
$OriginalColumns = substr($OriginalColumns, 0, -2);
// Expand query for loading english texts
$Query = 'SELECT `T4`.*, '.$OriginalColumns.' FROM ('.$Query.') AS `T4` '.
' LEFT JOIN `'.$Group['TablePrefix'].'` AS `T3` ON (`T3`.`Entry` = `T4`.`Entry`) '.
'AND (`T3`.`Language` = '.Core::Cast($this->System)->Config['OriginalLanguage'].') AND '.
'(`T3`.`VersionStart` = `T4`.`VersionStart`) AND (`T3`.`VersionEnd` = `T4`.`VersionEnd`)';
return $Query;
}
function NeedGeneration(): bool
{
$this->LoadFilters();
$FileName = '';
if ($this->Export['OutputType'] == 10) $FileName = $this->TempDir.'Instalace_CzechWoW_'.$this->ClientVersion['Version'].'.exe';
if ($this->Export['OutputType'] == 9) $FileName = $this->TempDir.'CzWoW_DBC.zip';
if (file_exists($FileName))
{
$Date = date('Y-m-d H:i',(filemtime($FileName)));
}
else return true;
$DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '.
'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id);
$Result = false;
while ($Group = $DbResult->fetch_assoc())
{
$Query = 'SELECT * FROM `'.$Group['TablePrefix'].'` AS `T`'.
' JOIN `ExportUser` ON (`ExportUser`.`User`=`T`.`User`) AND (`ExportUser`.`Export`='.$this->Id.') '.
' JOIN `User` ON `User`.`ID`=`T`.`User`'.
' JOIN `ExportLanguage` ON (`ExportLanguage`.`Export`='.$this->Id.')'.
' WHERE ( \''.$Date.'\' < `T`.`ModifyTime`) AND (`Complete` = 1) AND (`VersionStart` <= '.$this->ClientVersion['BuildNumber'].') AND (`VersionEnd` >= '.$this->ClientVersion['BuildNumber'].')'.
' ';
$DbResult2 = $this->Database->query($Query);
if ($DbResult2->num_rows > 0)
{
$Result = true;
}
}
return $Result;
}
function ExportToMangosSQL()
{
$User = ModuleUser::Cast($this->System->GetModule('User'))->User;
$TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
$this->LoadFilters();
$Buffer =
"-- Generováno projektem wowpreklad.zdechov.net\n".
"-- ===========================================\n".
"--\n".
"-- Web projektu: ".Core::Cast($this->System)->Config['Web']['Host'].$this->System->Link('/')."\n".
"-- Datum exportu: ".date("j.n.Y H:i:s")."\n".
"-- Znaková sada: ".Core::Cast($this->System)->Config['Database']['Charset']." / ".Core::Cast($this->System)->Config['Web']['Charset']."\n".
"-- Diakritika: ".$this->AnoNe[$this->Export['WithDiacritic']]."\n".
"-- Vygeneroval uživatel: ".$User->Name."\n".
"-- Vzato od uživatelů: ".$this->UserNames."\n".
"-- Generované tabulky: ";
$DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '.
'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id);
while ($Group = $DbResult->fetch_assoc())
{
$Buffer .= $Group['TablePrefix'].', ';
}
$Buffer .= "\n\n";
$DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '.
'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id);
while ($Group = $DbResult->fetch_assoc())
{
if ($Group['MangosTable'] != '')
{
$Buffer .= "\n\n-- ".$Group['Name']."\n\n";
$DbResult2 = $this->Database->query($this->BuildQuery($Group));
if ($DbResult2->num_rows > 0)
while ($Line = $DbResult2->fetch_array())
{
$Values = '';
foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem)
if ($GroupItem['Column'] != $Group['PrimaryKeyItem']) // Do not update primary key
{
if ($GroupItem['MangosColumn'] == '') $GroupItem['MangosColumn'] = $GroupItem['Column'];
$Text = $Line[$GroupItem['Column']];
if ($Text == null) $Text = '';
$Values .= ', `'.$GroupItem['MangosColumn'].'`="'.addslashes($Text).'"';
}
$Values = substr($Values, 2);
// Get multicolumn index
$ColumnItems = explode(',', $Group['MangosTableIndex']);
if (count($ColumnItems) > 1)
{
$Where = 'CONCAT(';
foreach ($ColumnItems as $ColumnItem)
$Where .= '`'.$ColumnItem.'`, "_", ';
$Where = substr($Where, 0, -7).')';
} else $Where = '`'.$Group['MangosTableIndex'].'`';
$Where .= ' = "'.$Line[$Group['PrimaryKeyItem']].'";';
$Line = 'UPDATE `'.$Group['MangosTable'].'` SET '.$Values.' WHERE '.$Where;
$Line = str_replace("\n", '\n', $Line);
$Line = str_replace("\r", '', $Line);
$Buffer .= $Line."\n";
}
}
}
if ($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer);
return $Buffer;
}
function ExportToAoWoWSQL()
{
global $AoWoWconf;
$TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
//require_once('../aowow/configs/config.php');
$Buffer = $this->ExportToMangosSQL();
/*
// Data to aowow
$Database2 = new mysqli($this->System->Config['Database']['Host'],
$this->System->Config['Database']['User'],
$this->System->Config['Database']['Password'],
$this->System->Config['Database']['Database']);
$Database2->query('SET NAMES '.$this->System->Config['Database']['Charset']);
$Database2->select_db($AoWoWconf['mangos']['db']);
$AoWoWTables = array(
'aowow_resistances' => 'Id',
'aowow_spelldispeltype' => 'Id',
'aowow_skill' => 'skillID',
);
foreach ($AoWoWTables as $AoWoWTable => $IndexColum)
{
$Buffer .= '--'.$AoWoWTable.', ';
$Buffer .= "\n\n";
$Query = 'SELECT `name`,`'.$IndexColum.'` FROM `'.$AoWoWTable.'`';
$DbResult = $Database2->query($Query);
while ($Line = $DbResult->fetch_assoc())
{
$Ori_text = $Line['name'];
$DbResult2 = $Database2->query('SELECT `Text` AS `En`,
(SELECT `Text` FROM `'.$this->System->Config['Database']['Database'].'`.`TextGlobalString` AS `TableTran`
WHERE `TableEn`.`Entry` = `TableTran`.`Entry` AND (`Complete` = 1) AND '.$this->WhereLang.' AND '.$this->WhereUsers.$this->OrderByUserList.' LIMIT 1) AS `Tran`
FROM `'.$this->System->Config['Database']['Database'].'`.`TextGlobalString` AS `TableEn` WHERE
`Text` = "'.addslashes($Ori_text).'" LIMIT 1');
$Tran = $DbResult2->fetch_assoc();
//echo ($Line['name'].'='.$Tran['tran']);
if ($Tran['Tran'] == '')
{
$DbResult2 = $Database2->query('SELECT `OptionText` AS `En`,
(SELECT `OptionText` FROM `'.$this->System->Config['Database']['Database'].'`.`TextNPCOption` AS `TableTran`
WHERE `TableEn`.`Entry` = `TableTran`.`Entry` AND (`Complete` = 1) AND '.$this->WhereLang.'
AND '.$this->WhereUsers.$this->OrderByUserList.' LIMIT 1) AS `Tran`
FROM `'.$this->System->Config['Database']['Database'].'`.`TextNPCOption` AS `TableEn` WHERE
`OptionText` = "'.addslashes($Ori_text).'" LIMIT 1');
$Tran = $DbResult2->fetch_assoc();
}
if ($Tran['Tran'] <> '')
$Buffer .= 'UPDATE `'.$AoWoWTable.'` SET `name` = "'.addslashes($Tran['Tran']).'" WHERE '.$IndexColum.' = '.$Line[$IndexColum].' ;'."\n";
}
$Buffer .= "\n\n";
}
*/
if ($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer);
return $Buffer;
}
// Export only if translate have same variable %
function HaveVariable($String1, $String2, $StartChar = '$')
{
if (($String1 != '') and (strpos($String1, $StartChar) !== false))
{
while (strpos($String1, $StartChar) !== false)
{
$pos = strpos($String1, $StartChar);
$String1 = substr($String1, $pos + 1);
$Variable = $String1;
if (strpos($Variable, ' ')) $Variable = substr($Variable, 0, strpos($Variable, ' '));
if (strpos($Variable, '.')) $Variable = substr($Variable, 0, strpos($Variable, '.'));
if (strpos($Variable, ',')) $Variable = substr($Variable, 0, strpos($Variable, ','));
if (strpos($Variable, '%')) $Variable = substr($Variable, 0, strpos($Variable, '%'));
if (strpos($Variable, chr(10))) $Variable = substr($Variable, 0, strpos($Variable, chr(10)));
if (($Variable != '') and (($String2 == '') or (strpos($String2, $Variable) === false)))
{
return false;
}
}
}
return true;
}
function AddProgress($Add = 1)
{
$DbResult = $this->System->Database->query('SELECT `Progress` FROM `ExportTask` WHERE `Export`='.$this->Id);
if ($DbResult->num_rows > 0)
{
$Task = $DbResult->fetch_assoc();
$Progress = $Task['Progress'] + $Add;
$this->System->Database->query('UPDATE `ExportTask` SET `Progress`='.$Progress.' WHERE `Export`='.$this->Id);
}
}
function ExportToDBC(): string
{
$TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
$this->LoadFilters();
$DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '.
'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` '.
'WHERE `ExportGroup`.`Export`='.$this->Id.' AND `Group`.`DBCFileName` != ""');
$Output = 'Počet generovaných skupin: '.$DbResult->num_rows."\n";
while ($Group = $DbResult->fetch_assoc())
{
$this->AddProgress(2);
$Output .= $Group['Name'].', ';
$SourceDbcFileName = $this->SourceDir.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc';
if (file_exists($SourceDbcFileName))
{
// Load string column index list
$DbResult2 = $this->Database->query('SELECT * FROM `GroupItem` '.
'JOIN `GroupItemDBC` ON `GroupItem`.`Id` = `GroupItemDBC`.`GroupItem` AND `GroupItemDBC`.`ClientVersion` = '.$this->ClientVersion['Id'].' WHERE `GroupItem`.`Group` = '.$Group['Id']);
$ColumnIndexes = array();
$ColumnFormat = array();
while ($DbRow = $DbResult2->fetch_assoc())
{
$ColumnFormat[$DbRow['ColumnIndex']] = FORMAT_STRING;
$ColumnIndexes[$DbRow['GroupItem']] = $DbRow['ColumnIndex'];
}
// Load all data into lookup table
$LookupTable = array();
$DbResult2 = $this->Database->query($this->BuildQuery($Group));
while ($DbRow = $DbResult2->fetch_assoc())
{
// Export only if translate have same variable %
$CanExport = true;
foreach ($TranslationTree[$Group['Id']]['Items'] as $Column)
{
if ($DbRow[$Column['Column']] != null)
{
$DbRow[$Column['Column']] = str_replace('$ ', '$', $DbRow[$Column['Column']]);
}
$EnText = $DbRow['En'.$Column['Column']];
if ($EnText == null) $EnText = '';
$TargetText = $DbRow[$Column['Column']];
if ($TargetText == null) $TargetText = '';
if (!$this->HaveVariable($EnText, $TargetText))
{
$CanExport = false;
$Output .= ', NE='.$DbRow['ID'];
}
if (!$this->HaveVariable($TargetText, $EnText))
{
$CanExport = false;
$Output .= ', NE='.$DbRow['ID'];
}
}
if ($CanExport)
$LookupTable[$DbRow[$Group['PrimaryKeyItem']]] = $DbRow;
}
// Open original DBC file
$SourceDBCFile = new DBCFile();
$SourceDBCFile->OpenFile($SourceDbcFileName, $ColumnFormat);
// Create new DBC file
$DbcDir = $this->TempDir.'dbc/';
if (!file_exists($DbcDir)) mkdir($DbcDir, 0777, true);
$NewDBCFile = new DBCFile();
$NewDBCFile->CreateFile($DbcDir.$Group['DBCFileName'].'.dbc', $ColumnFormat);
$NewDBCFile->SetRecordCount($SourceDBCFile->GetRecordCount());
$NewDBCFile->SetFieldCount($SourceDBCFile->GetFieldCount());
$NewDBCFile->Commit();
// Replace translated strings
$OldProgress = -1;
$Output .= "\n\r";
$RowCount = $SourceDBCFile->GetRecordCount();
$FieldCount = $SourceDBCFile->GetFieldCount();
for ($Row = 0; $Row < $RowCount; $Row++)
{
$Line = $SourceDBCFile->GetLine($Row);
// Get multicolumn index value
$PrimaryKeyItem = '';
$ColumnItems = explode(',', $Group['DBCIndex']);
if (count($ColumnItems) > 1)
{
foreach ($ColumnItems as $ColumnItem)
$PrimaryKeyItem .= $Line[$ColumnItem].'_';
$PrimaryKeyItem = substr($PrimaryKeyItem, 0, -1);
} else $PrimaryKeyItem = $Line[$Group['DBCIndex']];
if (array_key_exists($PrimaryKeyItem, $LookupTable))
{
// Replace text columns
$LookupTableItem = $LookupTable[$PrimaryKeyItem];
foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem)
{
if (array_key_exists($GroupItem['Id'], $ColumnIndexes))
$Line[$ColumnIndexes[$GroupItem['Id']]] = $LookupTableItem[$GroupItem['Column']];
}
}
$NewDBCFile->SetLine($Row, $Line);
// Show completion progress
$Progress = round($Row / $RowCount * 100);
if ($Progress != $OldProgress)
{
if (($Group['Id'] == 13) and ($Progress <> 100)) $this->AddProgress(0.01);
$Output .= $Progress."%\r";
echo($Output);
$Output = '';
$OldProgress = $Progress;
}
}
$NewDBCFile->Commit();
} else $Output .= ShowMessage('Zdrojový soubor '.$SourceDbcFileName.' nenalezen.'."\n", MESSAGE_CRITICAL);
}
$Output .= 'Hotovo
';
return $Output;
}
function ExportToLua(): string
{
$TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
$this->LoadFilters();
$Output = '';
$LuaDir = $this->TempDir.'lua/';
if (!file_exists($LuaDir)) mkdir($LuaDir, 0777, true);
$DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id.' AND `Group`.`LuaFileName` != ""');
while ($Group = $DbResult->fetch_assoc())
{
$this->AddProgress(1);
$Output .= $Group['Name'].'... ';
$File = new FileStream();
$SourceLuaFileName = $this->SourceDir.$this->ClientVersion['Version'].'/lua/'.$Group['LuaFileName'].'.lua';
if (!file_exists($SourceLuaFileName))
{
continue;
}
$File->OpenFile($SourceLuaFileName);
$File2 = new FileStream();
$File2->CreateFile($LuaDir.$Group['LuaFileName'].'.lua');
$LookupTable = array();
$DbResult2 = $this->Database->query($this->BuildQuery($Group));
while ($DbRow = $DbResult2->fetch_assoc())
{
$CanExport = true;
foreach ($TranslationTree[$Group['Id']]['Items'] as $Column)
{
// if (strpos($DbRow[$Column['Column']],'\\'))
// $CanExport = false;
// $DbRow[$Column['Column']] = str_replace ( '$ ','$',$DbRow[$Column['Column']]);
// $DbRow[$Column['Column']] = $DbRow['En'.$Column['Column']];
if (!$this->HaveVariable($DbRow['En'.$Column['Column']], $DbRow[$Column['Column']]))
{
if ($CanExport) $Output .= ', NE='.$DbRow['ID'];
$CanExport = false;
}
if (!$this->HaveVariable($DbRow[$Column['Column']], $DbRow['En'.$Column['Column']]))
{
if ($CanExport) $Output .= ', NE='.$DbRow['ID'];
$CanExport = false;
}
if (!$this->HaveVariable($DbRow['En'.$Column['Column']], $DbRow[$Column['Column']], '%'))
{
if ($CanExport) $Output .= ', NE='.$DbRow['ID'];
$CanExport = false;
}
if (!$this->HaveVariable($DbRow[$Column['Column']], $DbRow['En'.$Column['Column']], '%'))
{
if ($CanExport) $Output .= ', NE='.$DbRow['ID'];
$CanExport = false;
}
if (!$this->HaveVariable($DbRow[$Column['Column']], $DbRow['En'.$Column['Column']], '\\'))
{
if ($CanExport) $Output .= ', NE='.$DbRow['ID'];
$CanExport = false;
}
if (!$this->HaveVariable($DbRow['En'.$Column['Column']], $DbRow[$Column['Column']], '\\'))
{
if ($CanExport) $Output .= ', NE='.$DbRow['ID'];
$CanExport = false;
}
if (!$this->HaveVariable($DbRow[$Column['Column']], $DbRow['En'.$Column['Column']], '|'))
{
if ($CanExport) $Output .= ', NE='.$DbRow['ID'];
$CanExport = false;
}
if (!$this->HaveVariable($DbRow['En'.$Column['Column']], $DbRow[$Column['Column']], '|'))
{
if ($CanExport) $Output .= ', NE='.$DbRow['ID'];
$CanExport = false;
}
if (!$this->HaveVariable($DbRow[$Column['Column']], $DbRow['En'.$Column['Column']], chr(10)))
{
if ($CanExport) $Output .= ', NE='.$DbRow['ID'];
$CanExport = false;
}
if (!$this->HaveVariable($DbRow['En'.$Column['Column']], $DbRow[$Column['Column']], chr(10)))
{
if ($CanExport) $Output .= ', NE='.$DbRow['ID'];
$CanExport = false;
}
}
if ($CanExport)
$LookupTable[$DbRow['ShortCut']] = $DbRow;
}
while (!$File->EOF())
{
$Line = $File->ReadLine();
if (strpos($Line, '=') !== false)
{
$LineParts = explode('=', $Line, 2);
$Value['ShortCut'] = trim($LineParts[0]);
$Line = trim($LineParts[1]);
if ($Line[0] == '"')
{
// Quoted string value
$Line = substr($Line, 1); // Skip start qoute
$TempLine = str_replace('\"', ' ', $Line); // Temporary remove slashed quotes
if (strpos($TempLine, '"'))
{
$Value['Text'] = substr($Line, 0, strpos($TempLine, '"'));
} else {
$Value['Text'] = substr($Line, 0, strpos($Line, '"'));
}
// $Value['Text'] = str_replace('\n', "\n", $Value['Text']);
// $Value['Text'] = addslashes(stripslashes($Value['Text']));
$Line = trim(substr($Line, strpos($TempLine, '"') + 1)); // Skip closing quote and semicolon {
} else
{
// Nonstring value
$Value['Text'] = substr($Line, 0, strpos($Line, ';'));
}
$Line = substr($Line, strpos($Line, ';') + 1);
$Value['Comment'] = addslashes(stripslashes(substr($Line, 3))); // Skip " --"
if (array_key_exists($Value['ShortCut'], $LookupTable))
{
$DbRow = $LookupTable[$Value['ShortCut']];
$Value['Text'] = $DbRow['Text'];
//addslashes
$Value['Text'] = str_replace('"', '\"', $Value['Text']);
// Escape new line control characters
$Value['Text'] = str_replace("\n", '\n', $Value['Text']);
$Value['Text'] = str_replace("\r", '', $Value['Text']);
$Value['Comment'] = $DbRow['Comment'];
// Only one line comments allowed
$Value['Comment'] = str_replace("\n", ' ', $Value['Comment']);
$Value['Comment'] = str_replace("\r", '', $Value['Comment']);
//echo('.');
}
$NewLine = $Value['ShortCut'].' = "'.$Value['Text'].'";';
//if ($Value['Comment'] != '') $NewLine .= ' -- '.$Value['Comment'];
$NewLine .= "\r\n";
$File2->WriteLine($NewLine);
} else $File2->WriteLine($Line);
}
$Output .= 'Hotovo
';
}
return $Output;
}
function GetReadme()
{
$_GET['ExportId'] = $this->Id;
$PageExport = new PageExport($this->System);
$this->LoadFilters();
$Output = '';
//generation readme
$Output .= ''.
''.
''.
'
'.
' Texty přebírány z projektu wowpreklad.zdechov.net '. ' Vlastnosti'. '
'. ' Nejčastější otázky'. 'Jak mám vyhledávat věci v aukci nebo výpravy na internetu s nainstalovanou češtinou? Po nainstalování češtiny a spouštění přes soubor WoWlua.exe mi klesl výrazně výkon Při spouštění hry přes soubor WoWLua.exe se mi neukládá žádné nastavení addonů a podobně Po spuštění souboru WoWLua.exe mi píše chybu: Po nainstalování češtiny nemám žádné výpravy (questy) česky Addon mi hlásí spoustu chyb. Ve hře se mi špatně zobrazuje diakritika (háčky, čárky) Mám nainstalovánu češtinu a nejde mi spustit Wow.exe. Jak mám hru spustit? Mohu použít tuto češtinu na oficiálních serverech? | '; $Output .= $PageExport->ExportViewStat(' WHERE `DBCFileName` !=\'\' OR `LuaFileName` !=\'\' OR `Group`.`Id` = 1 OR `Group`.`Id` = 2 OR `Group`.`Id` = 3 OR `Group`.`Id` = 16'); $Output .= ' |