| 1 | <?php
|
|---|
| 2 |
|
|---|
| 3 | include_once(dirname(__FILE__).'/ModuleExport.php');
|
|---|
| 4 | include_once(dirname(__FILE__).'/Page.php');
|
|---|
| 5 | include_once(dirname(__FILE__).'/ExportOutput.php');
|
|---|
| 6 |
|
|---|
| 7 | class Export extends Model
|
|---|
| 8 | {
|
|---|
| 9 | public int $Id;
|
|---|
| 10 | public array $AnoNe = array('Ne', 'Ano');
|
|---|
| 11 | public string $WhereLang;
|
|---|
| 12 | public string $WhereUsers;
|
|---|
| 13 | public string $UserNames;
|
|---|
| 14 | public array $ClientVersion;
|
|---|
| 15 | public string $OrderByUserList;
|
|---|
| 16 | public string $TempDir;
|
|---|
| 17 | public string $TempDirRelative;
|
|---|
| 18 | public string $SourceDir;
|
|---|
| 19 | public string $SourceDirRelative;
|
|---|
| 20 | public array $Export;
|
|---|
| 21 |
|
|---|
| 22 | function Init()
|
|---|
| 23 | {
|
|---|
| 24 | $this->TempDir = NormalizePath(dirname(__FILE__).'/../../'.Core::Cast($this->System)->Config['Web']['TempFolder'].'Export/'.$this->Id.'/');
|
|---|
| 25 | if (!file_exists($this->TempDir)) mkdir($this->TempDir, 0777, true);
|
|---|
| 26 | $this->TempDirRelative = Core::Cast($this->System)->Config['Web']['TempFolder'].'Export/'.$this->Id.'/';
|
|---|
| 27 | $this->SourceDir = NormalizePath(dirname(__FILE__).'/../../'.Core::Cast($this->System)->Config['Web']['SourceFolder']);
|
|---|
| 28 | $this->SourceDirRelative = Core::Cast($this->System)->Config['Web']['SourceFolder'];
|
|---|
| 29 | if (!file_exists($this->SourceDir)) mkdir($this->SourceDir, 0777, true);
|
|---|
| 30 | }
|
|---|
| 31 |
|
|---|
| 32 | function SaveAllUsers()
|
|---|
| 33 | {
|
|---|
| 34 | $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$this->Id);
|
|---|
| 35 | $Export = $DbResult->fetch_assoc();
|
|---|
| 36 | if ($Export['AllUsers'])
|
|---|
| 37 | {
|
|---|
| 38 | $DbResult2 = $this->System->Database->query('SELECT ID FROM `User` WHERE `ID` NOT IN(SELECT `User` FROM `ExportUser` WHERE `Export`='.$this->Id.')');
|
|---|
| 39 | while ($UserLine = $DbResult2->fetch_assoc())
|
|---|
| 40 | {
|
|---|
| 41 | $Condition = ' WHERE `Export`='.$this->Id.' AND `User`='.$UserLine['ID'];
|
|---|
| 42 | $DbResult = $this->System->Database->query('SELECT * FROM `ExportUser` '.$Condition); //,MAX(`Sequence`) as MaxSequence
|
|---|
| 43 | if ($DbResult->num_rows > 0)
|
|---|
| 44 | {
|
|---|
| 45 | // $this->System->Database->query('UPDATE `ExportUser` SET `Sequence`='.$Value.$Condition);
|
|---|
| 46 | } else
|
|---|
| 47 | {
|
|---|
| 48 | $this->System->Database->query('INSERT INTO `ExportUser` (`Export`, `User`, `Sequence`) VALUES ('.$this->Id.', '.$UserLine['ID'].', 0)');
|
|---|
| 49 | }
|
|---|
| 50 | }
|
|---|
| 51 |
|
|---|
| 52 | $this->System->Database->query('SET @I = 0');
|
|---|
| 53 | $this->System->Database->query('UPDATE `ExportUser` SET `Sequence` = (@I := @I + 1) WHERE `Export`='.$this->Id.' ORDER BY `Sequence`;');
|
|---|
| 54 | }
|
|---|
| 55 | }
|
|---|
| 56 |
|
|---|
| 57 | function LoadFilters()
|
|---|
| 58 | {
|
|---|
| 59 | $DbResult = $this->Database->query('SELECT * FROM `Export` WHERE `Id`='.$this->Id);
|
|---|
| 60 | if ($DbResult->num_rows == 0) throw new Exception('Export '.$this->Id.' neexistuje');
|
|---|
| 61 | $this->Export = $DbResult->fetch_assoc();
|
|---|
| 62 |
|
|---|
| 63 | // Filter selected users
|
|---|
| 64 | $this->UserNames = '';
|
|---|
| 65 | $DbResult = $this->Database->query('SELECT `ExportUser`.*, `User`.`Name`, `User`.`ID` FROM `ExportUser` '.
|
|---|
| 66 | 'LEFT JOIN `User` ON `User`.`ID`=`ExportUser`.`User` '.
|
|---|
| 67 | 'WHERE `ExportUser`.`Export`='.$this->Id.' ORDER BY `ExportUser`.`Sequence`');
|
|---|
| 68 | while ($UserLine = $DbResult->fetch_assoc())
|
|---|
| 69 | {
|
|---|
| 70 | $this->UserNames .= ', '.$UserLine['Name'];
|
|---|
| 71 | }
|
|---|
| 72 | $this->UserNames = substr($this->UserNames, 2);
|
|---|
| 73 |
|
|---|
| 74 | if ($this->Export['ClientVersion'] != '')
|
|---|
| 75 | {
|
|---|
| 76 | $DbResult = $this->Database->query('SELECT * FROM `ClientVersion` WHERE `Id`='.$this->Export['ClientVersion']);
|
|---|
| 77 | $this->ClientVersion = $DbResult->fetch_assoc();
|
|---|
| 78 | } else $this->ClientVersion = array();
|
|---|
| 79 | }
|
|---|
| 80 |
|
|---|
| 81 | function BuildQuery($Group, $Version = '')
|
|---|
| 82 | {
|
|---|
| 83 | $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
|
|---|
| 84 | $this->SaveAllUsers();
|
|---|
| 85 |
|
|---|
| 86 | if ($Version <> '')
|
|---|
| 87 | $ExportVersion = $Version;
|
|---|
| 88 | else
|
|---|
| 89 | $ExportVersion = $this->ClientVersion['BuildNumber'];
|
|---|
| 90 |
|
|---|
| 91 | $DbResultItem = $this->System->Database->query('SELECT * FROM `ExportGroupItem` WHERE `Export`='.$this->Id);
|
|---|
| 92 | while ($GroupItem = $DbResultItem->fetch_assoc())
|
|---|
| 93 | {
|
|---|
| 94 | $GroupItems[$GroupItem['GroupItem']] = 1;
|
|---|
| 95 | }
|
|---|
| 96 | // Build selected columns
|
|---|
| 97 | $Columns = '';
|
|---|
| 98 | foreach ($TranslationTree[$Group['Id']]['Items'] as $Column)
|
|---|
| 99 | {
|
|---|
| 100 | if (!isset($GroupItems[$Column['Id']])) $Columns .= ' `T`.`'.$Column['Column'].'` AS `'.$Column['Column'].'`, ';
|
|---|
| 101 | }
|
|---|
| 102 | // $Columns = substr($Columns, 0, -2);
|
|---|
| 103 |
|
|---|
| 104 | $Query = 'SELECT * FROM (SELECT MIN(`TT`.`ID`) AS `TTID` FROM
|
|---|
| 105 | (SELECT '.$Columns.' T.`ID`,T.`Language`,T.`User`,T.`Entry`,T.`VersionEnd`,T.`VersionStart`, `User`.`Name` AS `UserName` FROM `'.$Group['TablePrefix'].'` AS `T`'.
|
|---|
| 106 | ' JOIN `ExportUser` ON (`ExportUser`.`User`=`T`.`User`) AND (`ExportUser`.`Export`='.$this->Id.') '.
|
|---|
| 107 | ' JOIN `User` ON `User`.`ID`=`T`.`User`'.
|
|---|
| 108 | ' JOIN `ExportLanguage` ON (`ExportLanguage`.`Export`='.$this->Id.')'.
|
|---|
| 109 | ' WHERE (`Complete` = 1) AND (`VersionStart` <= '.$ExportVersion.') AND (`VersionEnd` >= '.$ExportVersion.')'.
|
|---|
| 110 | ' ORDER BY `ExportLanguage`.`Sequence`, `ExportUser`.`Sequence`) AS `TT` GROUP BY `TT`.`Entry`) AS `TK`'.
|
|---|
| 111 | ' LEFT JOIN `'.$Group['TablePrefix'].'` AS `TJ` ON `TJ`.`ID` = `TK`.`TTID` ';
|
|---|
| 112 |
|
|---|
| 113 | // Build columns for english texts
|
|---|
| 114 | $OriginalColumns = '';
|
|---|
| 115 | foreach ($TranslationTree[$Group['Id']]['Items'] as $Column)
|
|---|
| 116 | {
|
|---|
| 117 | $OriginalColumns .= ' `T3`.`'.$Column['Column'].'` AS `En'.$Column['Column'].'`, ';
|
|---|
| 118 | if (isset($GroupItems[$Column['Id']]))
|
|---|
| 119 | $OriginalColumns .= ' `T3`.`'.$Column['Column'].'` AS `'.$Column['Column'].'`, ';
|
|---|
| 120 | }
|
|---|
| 121 | $OriginalColumns = substr($OriginalColumns, 0, -2);
|
|---|
| 122 |
|
|---|
| 123 | // Expand query for loading english texts
|
|---|
| 124 | $Query = 'SELECT `T4`.*, '.$OriginalColumns.' FROM ('.$Query.') AS `T4` '.
|
|---|
| 125 | ' LEFT JOIN `'.$Group['TablePrefix'].'` AS `T3` ON (`T3`.`Entry` = `T4`.`Entry`) '.
|
|---|
| 126 | 'AND (`T3`.`Language` = '.Core::Cast($this->System)->Config['OriginalLanguage'].') AND '.
|
|---|
| 127 | '(`T3`.`VersionStart` = `T4`.`VersionStart`) AND (`T3`.`VersionEnd` = `T4`.`VersionEnd`)';
|
|---|
| 128 |
|
|---|
| 129 | return $Query;
|
|---|
| 130 | }
|
|---|
| 131 |
|
|---|
| 132 | function NeedGeneration(): bool
|
|---|
| 133 | {
|
|---|
| 134 | $this->LoadFilters();
|
|---|
| 135 | $FileName = '';
|
|---|
| 136 | if ($this->Export['OutputType'] == 10) $FileName = $this->TempDir.'Instalace_CzechWoW_'.$this->ClientVersion['Version'].'.exe';
|
|---|
| 137 | if ($this->Export['OutputType'] == 9) $FileName = $this->TempDir.'CzWoW_DBC.zip';
|
|---|
| 138 |
|
|---|
| 139 | if (file_exists($FileName))
|
|---|
| 140 | {
|
|---|
| 141 | $Date = date('Y-m-d H:i',(filemtime($FileName)));
|
|---|
| 142 | }
|
|---|
| 143 | else return true;
|
|---|
| 144 |
|
|---|
| 145 | $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '.
|
|---|
| 146 | 'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id);
|
|---|
| 147 | $Result = false;
|
|---|
| 148 | while ($Group = $DbResult->fetch_assoc())
|
|---|
| 149 | {
|
|---|
| 150 | $Query = 'SELECT * FROM `'.$Group['TablePrefix'].'` AS `T`'.
|
|---|
| 151 | ' JOIN `ExportUser` ON (`ExportUser`.`User`=`T`.`User`) AND (`ExportUser`.`Export`='.$this->Id.') '.
|
|---|
| 152 | ' JOIN `User` ON `User`.`ID`=`T`.`User`'.
|
|---|
| 153 | ' JOIN `ExportLanguage` ON (`ExportLanguage`.`Export`='.$this->Id.')'.
|
|---|
| 154 | ' WHERE ( \''.$Date.'\' < `T`.`ModifyTime`) AND (`Complete` = 1) AND (`VersionStart` <= '.$this->ClientVersion['BuildNumber'].') AND (`VersionEnd` >= '.$this->ClientVersion['BuildNumber'].')'.
|
|---|
| 155 | ' ';
|
|---|
| 156 |
|
|---|
| 157 | $DbResult2 = $this->Database->query($Query);
|
|---|
| 158 | if ($DbResult2->num_rows > 0)
|
|---|
| 159 | {
|
|---|
| 160 | $Result = true;
|
|---|
| 161 | }
|
|---|
| 162 | }
|
|---|
| 163 | return $Result;
|
|---|
| 164 | }
|
|---|
| 165 |
|
|---|
| 166 | function ExportToMangosSQL()
|
|---|
| 167 | {
|
|---|
| 168 | $User = ModuleUser::Cast($this->System->GetModule('User'))->User;
|
|---|
| 169 | $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
|
|---|
| 170 |
|
|---|
| 171 | $this->LoadFilters();
|
|---|
| 172 |
|
|---|
| 173 | $Buffer =
|
|---|
| 174 | "-- Generováno projektem wowpreklad.zdechov.net\n".
|
|---|
| 175 | "-- ===========================================\n".
|
|---|
| 176 | "--\n".
|
|---|
| 177 | "-- Web projektu: ".Core::Cast($this->System)->Config['Web']['Host'].$this->System->Link('/')."\n".
|
|---|
| 178 | "-- Datum exportu: ".date("j.n.Y H:i:s")."\n".
|
|---|
| 179 | "-- Znaková sada: ".Core::Cast($this->System)->Config['Database']['Charset']." / ".Core::Cast($this->System)->Config['Web']['Charset']."\n".
|
|---|
| 180 | "-- Diakritika: ".$this->AnoNe[$this->Export['WithDiacritic']]."\n".
|
|---|
| 181 | "-- Vygeneroval uživatel: ".$User->Name."\n".
|
|---|
| 182 | "-- Vzato od uživatelů: ".$this->UserNames."\n".
|
|---|
| 183 | "-- Generované tabulky: ";
|
|---|
| 184 |
|
|---|
| 185 | $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '.
|
|---|
| 186 | 'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id);
|
|---|
| 187 | while ($Group = $DbResult->fetch_assoc())
|
|---|
| 188 | {
|
|---|
| 189 | $Buffer .= $Group['TablePrefix'].', ';
|
|---|
| 190 | }
|
|---|
| 191 | $Buffer .= "\n\n";
|
|---|
| 192 |
|
|---|
| 193 | $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '.
|
|---|
| 194 | 'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id);
|
|---|
| 195 | while ($Group = $DbResult->fetch_assoc())
|
|---|
| 196 | {
|
|---|
| 197 | if ($Group['MangosTable'] != '')
|
|---|
| 198 | {
|
|---|
| 199 | $Buffer .= "\n\n-- ".$Group['Name']."\n\n";
|
|---|
| 200 | $DbResult2 = $this->Database->query($this->BuildQuery($Group));
|
|---|
| 201 | if ($DbResult2->num_rows > 0)
|
|---|
| 202 | while ($Line = $DbResult2->fetch_array())
|
|---|
| 203 | {
|
|---|
| 204 | $Values = '';
|
|---|
| 205 | foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem)
|
|---|
| 206 | if ($GroupItem['Column'] != $Group['PrimaryKeyItem']) // Do not update primary key
|
|---|
| 207 | {
|
|---|
| 208 | if ($GroupItem['MangosColumn'] == '') $GroupItem['MangosColumn'] = $GroupItem['Column'];
|
|---|
| 209 | $Text = $Line[$GroupItem['Column']];
|
|---|
| 210 | if ($Text == null) $Text = '';
|
|---|
| 211 | $Values .= ', `'.$GroupItem['MangosColumn'].'`="'.addslashes($Text).'"';
|
|---|
| 212 | }
|
|---|
| 213 | $Values = substr($Values, 2);
|
|---|
| 214 |
|
|---|
| 215 | // Get multicolumn index
|
|---|
| 216 | $ColumnItems = explode(',', $Group['MangosTableIndex']);
|
|---|
| 217 | if (count($ColumnItems) > 1)
|
|---|
| 218 | {
|
|---|
| 219 | $Where = 'CONCAT(';
|
|---|
| 220 | foreach ($ColumnItems as $ColumnItem)
|
|---|
| 221 | $Where .= '`'.$ColumnItem.'`, "_", ';
|
|---|
| 222 | $Where = substr($Where, 0, -7).')';
|
|---|
| 223 | } else $Where = '`'.$Group['MangosTableIndex'].'`';
|
|---|
| 224 | $Where .= ' = "'.$Line[$Group['PrimaryKeyItem']].'";';
|
|---|
| 225 |
|
|---|
| 226 | $Line = 'UPDATE `'.$Group['MangosTable'].'` SET '.$Values.' WHERE '.$Where;
|
|---|
| 227 | $Line = str_replace("\n", '\n', $Line);
|
|---|
| 228 | $Line = str_replace("\r", '', $Line);
|
|---|
| 229 | $Buffer .= $Line."\n";
|
|---|
| 230 | }
|
|---|
| 231 | }
|
|---|
| 232 | }
|
|---|
| 233 | if ($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer);
|
|---|
| 234 | return $Buffer;
|
|---|
| 235 | }
|
|---|
| 236 |
|
|---|
| 237 | function ExportToAoWoWSQL()
|
|---|
| 238 | {
|
|---|
| 239 | global $AoWoWconf;
|
|---|
| 240 |
|
|---|
| 241 | $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
|
|---|
| 242 |
|
|---|
| 243 | //require_once('../aowow/configs/config.php');
|
|---|
| 244 |
|
|---|
| 245 | $Buffer = $this->ExportToMangosSQL();
|
|---|
| 246 |
|
|---|
| 247 | /*
|
|---|
| 248 | // Data to aowow
|
|---|
| 249 | $Database2 = new mysqli($this->System->Config['Database']['Host'],
|
|---|
| 250 | $this->System->Config['Database']['User'],
|
|---|
| 251 | $this->System->Config['Database']['Password'],
|
|---|
| 252 | $this->System->Config['Database']['Database']);
|
|---|
| 253 | $Database2->query('SET NAMES '.$this->System->Config['Database']['Charset']);
|
|---|
| 254 | $Database2->select_db($AoWoWconf['mangos']['db']);
|
|---|
| 255 | $AoWoWTables = array(
|
|---|
| 256 | 'aowow_resistances' => 'Id',
|
|---|
| 257 | 'aowow_spelldispeltype' => 'Id',
|
|---|
| 258 | 'aowow_skill' => 'skillID',
|
|---|
| 259 | );
|
|---|
| 260 | foreach ($AoWoWTables as $AoWoWTable => $IndexColum)
|
|---|
| 261 | {
|
|---|
| 262 | $Buffer .= '--'.$AoWoWTable.', ';
|
|---|
| 263 | $Buffer .= "\n\n";
|
|---|
| 264 | $Query = 'SELECT `name`,`'.$IndexColum.'` FROM `'.$AoWoWTable.'`';
|
|---|
| 265 | $DbResult = $Database2->query($Query);
|
|---|
| 266 | while ($Line = $DbResult->fetch_assoc())
|
|---|
| 267 | {
|
|---|
| 268 | $Ori_text = $Line['name'];
|
|---|
| 269 | $DbResult2 = $Database2->query('SELECT `Text` AS `En`,
|
|---|
| 270 | (SELECT `Text` FROM `'.$this->System->Config['Database']['Database'].'`.`TextGlobalString` AS `TableTran`
|
|---|
| 271 | WHERE `TableEn`.`Entry` = `TableTran`.`Entry` AND (`Complete` = 1) AND '.$this->WhereLang.' AND '.$this->WhereUsers.$this->OrderByUserList.' LIMIT 1) AS `Tran`
|
|---|
| 272 | FROM `'.$this->System->Config['Database']['Database'].'`.`TextGlobalString` AS `TableEn` WHERE
|
|---|
| 273 | `Text` = "'.addslashes($Ori_text).'" LIMIT 1');
|
|---|
| 274 | $Tran = $DbResult2->fetch_assoc();
|
|---|
| 275 | //echo ($Line['name'].'='.$Tran['tran']);
|
|---|
| 276 | if ($Tran['Tran'] == '')
|
|---|
| 277 | {
|
|---|
| 278 | $DbResult2 = $Database2->query('SELECT `OptionText` AS `En`,
|
|---|
| 279 | (SELECT `OptionText` FROM `'.$this->System->Config['Database']['Database'].'`.`TextNPCOption` AS `TableTran`
|
|---|
| 280 | WHERE `TableEn`.`Entry` = `TableTran`.`Entry` AND (`Complete` = 1) AND '.$this->WhereLang.'
|
|---|
| 281 | AND '.$this->WhereUsers.$this->OrderByUserList.' LIMIT 1) AS `Tran`
|
|---|
| 282 | FROM `'.$this->System->Config['Database']['Database'].'`.`TextNPCOption` AS `TableEn` WHERE
|
|---|
| 283 | `OptionText` = "'.addslashes($Ori_text).'" LIMIT 1');
|
|---|
| 284 | $Tran = $DbResult2->fetch_assoc();
|
|---|
| 285 | }
|
|---|
| 286 |
|
|---|
| 287 | if ($Tran['Tran'] <> '')
|
|---|
| 288 | $Buffer .= 'UPDATE `'.$AoWoWTable.'` SET `name` = "'.addslashes($Tran['Tran']).'" WHERE '.$IndexColum.' = '.$Line[$IndexColum].' ;'."\n";
|
|---|
| 289 | }
|
|---|
| 290 | $Buffer .= "\n\n";
|
|---|
| 291 | }
|
|---|
| 292 | */
|
|---|
| 293 | if ($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer);
|
|---|
| 294 | return $Buffer;
|
|---|
| 295 | }
|
|---|
| 296 |
|
|---|
| 297 | // Export only if translate have same variable %
|
|---|
| 298 | function HaveVariable($String1, $String2, $StartChar = '$')
|
|---|
| 299 | {
|
|---|
| 300 | if (($String1 != '') and (strpos($String1, $StartChar) !== false))
|
|---|
| 301 | {
|
|---|
| 302 | while (strpos($String1, $StartChar) !== false)
|
|---|
| 303 | {
|
|---|
| 304 | $pos = strpos($String1, $StartChar);
|
|---|
| 305 | $String1 = substr($String1, $pos + 1);
|
|---|
| 306 | $Variable = $String1;
|
|---|
| 307 | if (strpos($Variable, ' ')) $Variable = substr($Variable, 0, strpos($Variable, ' '));
|
|---|
| 308 | if (strpos($Variable, '.')) $Variable = substr($Variable, 0, strpos($Variable, '.'));
|
|---|
| 309 | if (strpos($Variable, ',')) $Variable = substr($Variable, 0, strpos($Variable, ','));
|
|---|
| 310 | if (strpos($Variable, '%')) $Variable = substr($Variable, 0, strpos($Variable, '%'));
|
|---|
| 311 | if (strpos($Variable, chr(10))) $Variable = substr($Variable, 0, strpos($Variable, chr(10)));
|
|---|
| 312 |
|
|---|
| 313 | if (($Variable != '') and (($String2 == '') or (strpos($String2, $Variable) === false)))
|
|---|
| 314 | {
|
|---|
| 315 | return false;
|
|---|
| 316 | }
|
|---|
| 317 | }
|
|---|
| 318 | }
|
|---|
| 319 | return true;
|
|---|
| 320 | }
|
|---|
| 321 |
|
|---|
| 322 | function AddProgress($Add = 1)
|
|---|
| 323 | {
|
|---|
| 324 | $DbResult = $this->System->Database->query('SELECT `Progress` FROM `ExportTask` WHERE `Export`='.$this->Id);
|
|---|
| 325 | if ($DbResult->num_rows > 0)
|
|---|
| 326 | {
|
|---|
| 327 | $Task = $DbResult->fetch_assoc();
|
|---|
| 328 | $Progress = $Task['Progress'] + $Add;
|
|---|
| 329 | $this->System->Database->query('UPDATE `ExportTask` SET `Progress`='.$Progress.' WHERE `Export`='.$this->Id);
|
|---|
| 330 | }
|
|---|
| 331 | }
|
|---|
| 332 |
|
|---|
| 333 | function ExportToDBC(): string
|
|---|
| 334 | {
|
|---|
| 335 | $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
|
|---|
| 336 | $this->LoadFilters();
|
|---|
| 337 | $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '.
|
|---|
| 338 | 'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` '.
|
|---|
| 339 | 'WHERE `ExportGroup`.`Export`='.$this->Id.' AND `Group`.`DBCFileName` != ""');
|
|---|
| 340 | $Output = 'Počet generovaných skupin: '.$DbResult->num_rows."\n";
|
|---|
| 341 | while ($Group = $DbResult->fetch_assoc())
|
|---|
| 342 | {
|
|---|
| 343 | $this->AddProgress(2);
|
|---|
| 344 | $Output .= $Group['Name'].', ';
|
|---|
| 345 |
|
|---|
| 346 | $SourceDbcFileName = $this->SourceDir.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc';
|
|---|
| 347 | if (file_exists($SourceDbcFileName))
|
|---|
| 348 | {
|
|---|
| 349 | // Load string column index list
|
|---|
| 350 | $DbResult2 = $this->Database->query('SELECT * FROM `GroupItem` '.
|
|---|
| 351 | 'JOIN `GroupItemDBC` ON `GroupItem`.`Id` = `GroupItemDBC`.`GroupItem` AND `GroupItemDBC`.`ClientVersion` = '.$this->ClientVersion['Id'].' WHERE `GroupItem`.`Group` = '.$Group['Id']);
|
|---|
| 352 | $ColumnIndexes = array();
|
|---|
| 353 | $ColumnFormat = array();
|
|---|
| 354 | while ($DbRow = $DbResult2->fetch_assoc())
|
|---|
| 355 | {
|
|---|
| 356 | $ColumnFormat[$DbRow['ColumnIndex']] = FORMAT_STRING;
|
|---|
| 357 | $ColumnIndexes[$DbRow['GroupItem']] = $DbRow['ColumnIndex'];
|
|---|
| 358 | }
|
|---|
| 359 |
|
|---|
| 360 | // Load all data into lookup table
|
|---|
| 361 | $LookupTable = array();
|
|---|
| 362 | $DbResult2 = $this->Database->query($this->BuildQuery($Group));
|
|---|
| 363 | while ($DbRow = $DbResult2->fetch_assoc())
|
|---|
| 364 | {
|
|---|
| 365 | // Export only if translate have same variable %
|
|---|
| 366 | $CanExport = true;
|
|---|
| 367 | foreach ($TranslationTree[$Group['Id']]['Items'] as $Column)
|
|---|
| 368 | {
|
|---|
| 369 | if ($DbRow[$Column['Column']] != null)
|
|---|
| 370 | {
|
|---|
| 371 | $DbRow[$Column['Column']] = str_replace('$ ', '$', $DbRow[$Column['Column']]);
|
|---|
| 372 | }
|
|---|
| 373 | $EnText = $DbRow['En'.$Column['Column']];
|
|---|
| 374 | if ($EnText == null) $EnText = '';
|
|---|
| 375 | $TargetText = $DbRow[$Column['Column']];
|
|---|
| 376 | if ($TargetText == null) $TargetText = '';
|
|---|
| 377 | if (!$this->HaveVariable($EnText, $TargetText))
|
|---|
| 378 | {
|
|---|
| 379 | $CanExport = false;
|
|---|
| 380 | $Output .= ', NE='.$DbRow['ID'];
|
|---|
| 381 | }
|
|---|
| 382 | if (!$this->HaveVariable($TargetText, $EnText))
|
|---|
| 383 | {
|
|---|
| 384 | $CanExport = false;
|
|---|
| 385 | $Output .= ', NE='.$DbRow['ID'];
|
|---|
| 386 | }
|
|---|
| 387 | }
|
|---|
| 388 |
|
|---|
| 389 | if ($CanExport)
|
|---|
| 390 | $LookupTable[$DbRow[$Group['PrimaryKeyItem']]] = $DbRow;
|
|---|
| 391 | }
|
|---|
| 392 |
|
|---|
| 393 | // Open original DBC file
|
|---|
| 394 | $SourceDBCFile = new DBCFile();
|
|---|
| 395 | $SourceDBCFile->OpenFile($SourceDbcFileName, $ColumnFormat);
|
|---|
| 396 |
|
|---|
| 397 | // Create new DBC file
|
|---|
| 398 | $DbcDir = $this->TempDir.'dbc/';
|
|---|
| 399 | if (!file_exists($DbcDir)) mkdir($DbcDir, 0777, true);
|
|---|
| 400 | $NewDBCFile = new DBCFile();
|
|---|
| 401 | $NewDBCFile->CreateFile($DbcDir.$Group['DBCFileName'].'.dbc', $ColumnFormat);
|
|---|
| 402 | $NewDBCFile->SetRecordCount($SourceDBCFile->GetRecordCount());
|
|---|
| 403 | $NewDBCFile->SetFieldCount($SourceDBCFile->GetFieldCount());
|
|---|
| 404 | $NewDBCFile->Commit();
|
|---|
| 405 |
|
|---|
| 406 | // Replace translated strings
|
|---|
| 407 | $OldProgress = -1;
|
|---|
| 408 | $Output .= "\n\r";
|
|---|
| 409 | $RowCount = $SourceDBCFile->GetRecordCount();
|
|---|
| 410 | $FieldCount = $SourceDBCFile->GetFieldCount();
|
|---|
| 411 | for ($Row = 0; $Row < $RowCount; $Row++)
|
|---|
| 412 | {
|
|---|
| 413 | $Line = $SourceDBCFile->GetLine($Row);
|
|---|
| 414 |
|
|---|
| 415 | // Get multicolumn index value
|
|---|
| 416 | $PrimaryKeyItem = '';
|
|---|
| 417 | $ColumnItems = explode(',', $Group['DBCIndex']);
|
|---|
| 418 | if (count($ColumnItems) > 1)
|
|---|
| 419 | {
|
|---|
| 420 | foreach ($ColumnItems as $ColumnItem)
|
|---|
| 421 | $PrimaryKeyItem .= $Line[$ColumnItem].'_';
|
|---|
| 422 | $PrimaryKeyItem = substr($PrimaryKeyItem, 0, -1);
|
|---|
| 423 | } else $PrimaryKeyItem = $Line[$Group['DBCIndex']];
|
|---|
| 424 |
|
|---|
| 425 | if (array_key_exists($PrimaryKeyItem, $LookupTable))
|
|---|
| 426 | {
|
|---|
| 427 | // Replace text columns
|
|---|
| 428 | $LookupTableItem = $LookupTable[$PrimaryKeyItem];
|
|---|
| 429 | foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem)
|
|---|
| 430 | {
|
|---|
| 431 | if (array_key_exists($GroupItem['Id'], $ColumnIndexes))
|
|---|
| 432 | $Line[$ColumnIndexes[$GroupItem['Id']]] = $LookupTableItem[$GroupItem['Column']];
|
|---|
| 433 | }
|
|---|
| 434 | }
|
|---|
| 435 | $NewDBCFile->SetLine($Row, $Line);
|
|---|
| 436 |
|
|---|
| 437 | // Show completion progress
|
|---|
| 438 | $Progress = round($Row / $RowCount * 100);
|
|---|
| 439 | if ($Progress != $OldProgress)
|
|---|
| 440 | {
|
|---|
| 441 | if (($Group['Id'] == 13) and ($Progress <> 100)) $this->AddProgress(0.01);
|
|---|
| 442 | $Output .= $Progress."%\r";
|
|---|
| 443 | echo($Output);
|
|---|
| 444 | $Output = '';
|
|---|
| 445 | $OldProgress = $Progress;
|
|---|
| 446 | }
|
|---|
| 447 | }
|
|---|
| 448 | $NewDBCFile->Commit();
|
|---|
| 449 | } else $Output .= ShowMessage('Zdrojový soubor '.$SourceDbcFileName.' nenalezen.'."\n", MESSAGE_CRITICAL);
|
|---|
| 450 | }
|
|---|
| 451 | $Output .= 'Hotovo <br />';
|
|---|
| 452 | return $Output;
|
|---|
| 453 | }
|
|---|
| 454 |
|
|---|
| 455 | function ExportToLua(): string
|
|---|
| 456 | {
|
|---|
| 457 | $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
|
|---|
| 458 |
|
|---|
| 459 | $this->LoadFilters();
|
|---|
| 460 |
|
|---|
| 461 | $Output = '';
|
|---|
| 462 | $LuaDir = $this->TempDir.'lua/';
|
|---|
| 463 | if (!file_exists($LuaDir)) mkdir($LuaDir, 0777, true);
|
|---|
| 464 | $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id.' AND `Group`.`LuaFileName` != ""');
|
|---|
| 465 | while ($Group = $DbResult->fetch_assoc())
|
|---|
| 466 | {
|
|---|
| 467 | $this->AddProgress(1);
|
|---|
| 468 | $Output .= $Group['Name'].'... ';
|
|---|
| 469 | $File = new FileStream();
|
|---|
| 470 | $SourceLuaFileName = $this->SourceDir.$this->ClientVersion['Version'].'/lua/'.$Group['LuaFileName'].'.lua';
|
|---|
| 471 | if (!file_exists($SourceLuaFileName))
|
|---|
| 472 | {
|
|---|
| 473 | continue;
|
|---|
| 474 | }
|
|---|
| 475 | $File->OpenFile($SourceLuaFileName);
|
|---|
| 476 | $File2 = new FileStream();
|
|---|
| 477 | $File2->CreateFile($LuaDir.$Group['LuaFileName'].'.lua');
|
|---|
| 478 |
|
|---|
| 479 | $LookupTable = array();
|
|---|
| 480 | $DbResult2 = $this->Database->query($this->BuildQuery($Group));
|
|---|
| 481 | while ($DbRow = $DbResult2->fetch_assoc())
|
|---|
| 482 | {
|
|---|
| 483 | $CanExport = true;
|
|---|
| 484 | foreach ($TranslationTree[$Group['Id']]['Items'] as $Column)
|
|---|
| 485 | {
|
|---|
| 486 | // if (strpos($DbRow[$Column['Column']],'\\'))
|
|---|
| 487 | // $CanExport = false;
|
|---|
| 488 | // $DbRow[$Column['Column']] = str_replace ( '$ ','$',$DbRow[$Column['Column']]);
|
|---|
| 489 | // $DbRow[$Column['Column']] = $DbRow['En'.$Column['Column']];
|
|---|
| 490 |
|
|---|
| 491 | if (!$this->HaveVariable($DbRow['En'.$Column['Column']], $DbRow[$Column['Column']]))
|
|---|
| 492 | {
|
|---|
| 493 | if ($CanExport) $Output .= ', NE='.$DbRow['ID'];
|
|---|
| 494 | $CanExport = false;
|
|---|
| 495 | }
|
|---|
| 496 | if (!$this->HaveVariable($DbRow[$Column['Column']], $DbRow['En'.$Column['Column']]))
|
|---|
| 497 | {
|
|---|
| 498 | if ($CanExport) $Output .= ', NE='.$DbRow['ID'];
|
|---|
| 499 | $CanExport = false;
|
|---|
| 500 | }
|
|---|
| 501 | if (!$this->HaveVariable($DbRow['En'.$Column['Column']], $DbRow[$Column['Column']], '%'))
|
|---|
| 502 | {
|
|---|
| 503 | if ($CanExport) $Output .= ', NE='.$DbRow['ID'];
|
|---|
| 504 | $CanExport = false;
|
|---|
| 505 | }
|
|---|
| 506 | if (!$this->HaveVariable($DbRow[$Column['Column']], $DbRow['En'.$Column['Column']], '%'))
|
|---|
| 507 | {
|
|---|
| 508 | if ($CanExport) $Output .= ', NE='.$DbRow['ID'];
|
|---|
| 509 | $CanExport = false;
|
|---|
| 510 | }
|
|---|
| 511 | if (!$this->HaveVariable($DbRow[$Column['Column']], $DbRow['En'.$Column['Column']], '\\'))
|
|---|
| 512 | {
|
|---|
| 513 | if ($CanExport) $Output .= ', NE='.$DbRow['ID'];
|
|---|
| 514 | $CanExport = false;
|
|---|
| 515 | }
|
|---|
| 516 | if (!$this->HaveVariable($DbRow['En'.$Column['Column']], $DbRow[$Column['Column']], '\\'))
|
|---|
| 517 | {
|
|---|
| 518 | if ($CanExport) $Output .= ', NE='.$DbRow['ID'];
|
|---|
| 519 | $CanExport = false;
|
|---|
| 520 | }
|
|---|
| 521 | if (!$this->HaveVariable($DbRow[$Column['Column']], $DbRow['En'.$Column['Column']], '|'))
|
|---|
| 522 | {
|
|---|
| 523 | if ($CanExport) $Output .= ', NE='.$DbRow['ID'];
|
|---|
| 524 | $CanExport = false;
|
|---|
| 525 | }
|
|---|
| 526 | if (!$this->HaveVariable($DbRow['En'.$Column['Column']], $DbRow[$Column['Column']], '|'))
|
|---|
| 527 | {
|
|---|
| 528 | if ($CanExport) $Output .= ', NE='.$DbRow['ID'];
|
|---|
| 529 | $CanExport = false;
|
|---|
| 530 | }
|
|---|
| 531 | if (!$this->HaveVariable($DbRow[$Column['Column']], $DbRow['En'.$Column['Column']], chr(10)))
|
|---|
| 532 | {
|
|---|
| 533 | if ($CanExport) $Output .= ', NE='.$DbRow['ID'];
|
|---|
| 534 | $CanExport = false;
|
|---|
| 535 | }
|
|---|
| 536 | if (!$this->HaveVariable($DbRow['En'.$Column['Column']], $DbRow[$Column['Column']], chr(10)))
|
|---|
| 537 | {
|
|---|
| 538 | if ($CanExport) $Output .= ', NE='.$DbRow['ID'];
|
|---|
| 539 | $CanExport = false;
|
|---|
| 540 | }
|
|---|
| 541 | }
|
|---|
| 542 |
|
|---|
| 543 | if ($CanExport)
|
|---|
| 544 | $LookupTable[$DbRow['ShortCut']] = $DbRow;
|
|---|
| 545 | }
|
|---|
| 546 |
|
|---|
| 547 | while (!$File->EOF())
|
|---|
| 548 | {
|
|---|
| 549 | $Line = $File->ReadLine();
|
|---|
| 550 | if (strpos($Line, '=') !== false)
|
|---|
| 551 | {
|
|---|
| 552 | $LineParts = explode('=', $Line, 2);
|
|---|
| 553 | $Value['ShortCut'] = trim($LineParts[0]);
|
|---|
| 554 | $Line = trim($LineParts[1]);
|
|---|
| 555 |
|
|---|
| 556 | if ($Line[0] == '"')
|
|---|
| 557 | {
|
|---|
| 558 | // Quoted string value
|
|---|
| 559 | $Line = substr($Line, 1); // Skip start qoute
|
|---|
| 560 | $TempLine = str_replace('\"', ' ', $Line); // Temporary remove slashed quotes
|
|---|
| 561 | if (strpos($TempLine, '"'))
|
|---|
| 562 | {
|
|---|
| 563 | $Value['Text'] = substr($Line, 0, strpos($TempLine, '"'));
|
|---|
| 564 | } else {
|
|---|
| 565 | $Value['Text'] = substr($Line, 0, strpos($Line, '"'));
|
|---|
| 566 | }
|
|---|
| 567 | // $Value['Text'] = str_replace('\n', "\n", $Value['Text']);
|
|---|
| 568 | // $Value['Text'] = addslashes(stripslashes($Value['Text']));
|
|---|
| 569 | $Line = trim(substr($Line, strpos($TempLine, '"') + 1)); // Skip closing quote and semicolon {
|
|---|
| 570 | } else
|
|---|
| 571 | {
|
|---|
| 572 | // Nonstring value
|
|---|
| 573 | $Value['Text'] = substr($Line, 0, strpos($Line, ';'));
|
|---|
| 574 | }
|
|---|
| 575 | $Line = substr($Line, strpos($Line, ';') + 1);
|
|---|
| 576 | $Value['Comment'] = addslashes(stripslashes(substr($Line, 3))); // Skip " --"
|
|---|
| 577 |
|
|---|
| 578 | if (array_key_exists($Value['ShortCut'], $LookupTable))
|
|---|
| 579 | {
|
|---|
| 580 | $DbRow = $LookupTable[$Value['ShortCut']];
|
|---|
| 581 | $Value['Text'] = $DbRow['Text'];
|
|---|
| 582 | //addslashes
|
|---|
| 583 | $Value['Text'] = str_replace('"', '\"', $Value['Text']);
|
|---|
| 584 | // Escape new line control characters
|
|---|
| 585 | $Value['Text'] = str_replace("\n", '\n', $Value['Text']);
|
|---|
| 586 | $Value['Text'] = str_replace("\r", '', $Value['Text']);
|
|---|
| 587 | $Value['Comment'] = $DbRow['Comment'];
|
|---|
| 588 | // Only one line comments allowed
|
|---|
| 589 | $Value['Comment'] = str_replace("\n", ' ', $Value['Comment']);
|
|---|
| 590 | $Value['Comment'] = str_replace("\r", '', $Value['Comment']);
|
|---|
| 591 | //echo('.');
|
|---|
| 592 | }
|
|---|
| 593 | $NewLine = $Value['ShortCut'].' = "'.$Value['Text'].'";';
|
|---|
| 594 | //if ($Value['Comment'] != '') $NewLine .= ' -- '.$Value['Comment'];
|
|---|
| 595 | $NewLine .= "\r\n";
|
|---|
| 596 | $File2->WriteLine($NewLine);
|
|---|
| 597 | } else $File2->WriteLine($Line);
|
|---|
| 598 | }
|
|---|
| 599 | $Output .= 'Hotovo <br/>';
|
|---|
| 600 | }
|
|---|
| 601 | return $Output;
|
|---|
| 602 | }
|
|---|
| 603 |
|
|---|
| 604 | function GetReadme()
|
|---|
| 605 | {
|
|---|
| 606 | $_GET['ExportId'] = $this->Id;
|
|---|
| 607 | $PageExport = new PageExport($this->System);
|
|---|
| 608 | $this->LoadFilters();
|
|---|
| 609 | $Output = '';
|
|---|
| 610 | //generation readme
|
|---|
| 611 | $Output .= '<?xml version="1.0" encoding="utf-8"?\>'.
|
|---|
| 612 | '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'.
|
|---|
| 613 | '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs">'.
|
|---|
| 614 | '<head>'.
|
|---|
| 615 | '<STYLE type="text/css">'.
|
|---|
| 616 | '.BaseTable {margin: 2px auto 2px auto;border-width: 1px;border-color: black;border-style: solid;border-collapse: collapse;}'.
|
|---|
| 617 |
|
|---|
| 618 | '.BaseTable tr td{ border-width: 1px; border-color: black; border-style: solid; padding: 2px; text-align: center;}'.
|
|---|
| 619 |
|
|---|
| 620 | '.BaseTable tr th{ border-width: 1px; border-color: black; border-style: solid; padding: 2px; background-color: #F0F0F0; text-align: center;}'.
|
|---|
| 621 | '</STYLE>'.
|
|---|
| 622 | '<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />'.
|
|---|
| 623 | '<title>Čeština pro WoW</title>'.
|
|---|
| 624 | '</head><body>'.
|
|---|
| 625 | '<h1>České WoW - čestina pro klienta hry World of Warcraft</h1>'.
|
|---|
| 626 |
|
|---|
| 627 | '<table cellspacing="10"><tr><td valign="top">'.
|
|---|
| 628 |
|
|---|
| 629 | '<p>Texty přebírány z projektu <a href="https://wowpreklad.zdechov.net/">wowpreklad.zdechov.net</a><br>'.
|
|---|
| 630 | '<a href="https://wowpreklad.zdechov.nets/export/?Action=View&ExportId='.$this->Id.'&Tab=0">Export '.$this->Id.'</a></p><br>'.
|
|---|
| 631 |
|
|---|
| 632 |
|
|---|
| 633 | '<p><strong>Vlastnosti</strong>'.
|
|---|
| 634 | '<ul>'.
|
|---|
| 635 | '<li>Požadovaná verze klienta: '.$this->ClientVersion['Version'].'</li>'.
|
|---|
| 636 | '<li>Datum uvolnění: '.date('d.m.Y h:m',time()).'</li>'.
|
|---|
| 637 | '<li>Sestaveno automaticky překladovým systémem <a href="https://wowpreklad.zdechov.net/">WoW překlad</a></li>'.
|
|---|
| 638 | //'<li>Tento soubor se generuje každý den. Pokud se zapojíte do překladu, zítra můžete stáhnout tento soubor znovu včetně svých překladů</li>'.
|
|---|
| 639 | //'<li>Sestavil: Maron</li>'.
|
|---|
| 640 | '</ul>'.
|
|---|
| 641 | '</p>'.
|
|---|
| 642 | '<br>'.
|
|---|
| 643 |
|
|---|
| 644 | '<h2>Nejčastější otázky</h2>'.
|
|---|
| 645 | '<p><strong>Jak mám vyhledávat věci v aukci nebo výpravy na internetu s nainstalovanou češtinou?</strong><br>
|
|---|
| 646 | Pokud používáte addon, který mění názvy předmětů jenom zdánlivě pro vás, potřebujete pro vyhledávání v aukci zjistit původní anglický název. Tento název zjistíte jednoduše držením klávesy shift a kliknutím na předmět při otevřené aukci, nebo chatu. Vytvořený odkaz v chatu, nebo text v aukci je v původním znění. Stejně zjistíte i název výpravy kliknutím se shift na výpravu v "quest logu".
|
|---|
| 647 | Pokud jste na serveru s českou lokalizaci (tedy nepoužíváte addon), musíte využít český název pro vyhledávání. Server by měl mít spuštěnou vlastní obdobu databáze wowhead.</p>'.
|
|---|
| 648 |
|
|---|
| 649 | '<p><strong>Po nainstalování češtiny a spouštění přes soubor WoWlua.exe mi klesl výrazně výkon</strong><br>
|
|---|
| 650 | Problém může být spojen s použitím integrované grafiky místo herní.</p>'.
|
|---|
| 651 |
|
|---|
| 652 | '<p><strong>Při spouštění hry přes soubor WoWLua.exe se mi neukládá žádné nastavení addonů a podobně</strong><br>
|
|---|
| 653 | Problém může být způsoben špatně nastavenými právy u souboru WoWLua.exe. Můžete přenastavit práva, nebo spouštět jako správce.</p>'.
|
|---|
| 654 |
|
|---|
| 655 | '<p><strong>Po spuštění souboru WoWLua.exe mi píše chybu:</strong><br>
|
|---|
| 656 | Cannot stream required archive data. Please check the network connection.
|
|---|
| 657 | Chyba může být způsobena tím, že jste nenainstalovali češtinu do adresáře se hrou.
|
|---|
| 658 | Nebo jste nainstalovali do jiné verze hry, než je požadovaná. Může se vztahovat i na požadovanou lokalizaci (enUS, enGB)</p>'.
|
|---|
| 659 |
|
|---|
| 660 | '<p><strong>Po nainstalování češtiny nemám žádné výpravy (questy) česky</strong><br>
|
|---|
| 661 | Zkontrolujte si v přihlášení, jestli máte povolený addon CzWoW v seznamu addonů.</p>'.
|
|---|
| 662 |
|
|---|
| 663 | '<p><strong>Addon mi hlásí spoustu chyb.</strong><br>
|
|---|
| 664 | Chyba může být způsobena kolizí s jinými addony. Vyzkoušejte spuštění hry pouze s addonem CzWoW.</p>'.
|
|---|
| 665 |
|
|---|
| 666 | '<p><strong>Ve hře se mi špatně zobrazuje diakritika (háčky, čárky)</strong><br>
|
|---|
| 667 | Chyba je způsobena chybějícími fonty do hry. Potřebné fonty si stáhněte mezi soubory ke stažení.</p>'.
|
|---|
| 668 |
|
|---|
| 669 | '<p><strong>Mám nainstalovánu češtinu a nejde mi spustit Wow.exe.</strong><br>
|
|---|
| 670 | Pokud chcete opět spouštět hru přes původní Wow.exe v angličtině, musíte češtinu nejprve odinstalovat ze systému. Především se jedná o soubor Data/enGB/patch-enGB-5.MPQ či Data/enUS/patch-enUS-5.MPQ, který je nutno smazat. U novějších verzí se soubor může jmenovat wow-update-base-50000.MPQ.</p>'.
|
|---|
| 671 |
|
|---|
| 672 | '<p><strong>Jak mám hru spustit?</strong><br>
|
|---|
| 673 | Hru musíte spustit přes soubor WowLua.exe v kořenovém adresáři hry.</p>'.
|
|---|
| 674 |
|
|---|
| 675 | '<p><strong>Mohu použít tuto češtinu na oficiálních serverech?</strong><br>
|
|---|
| 676 | Ne úplně, protože se vystavujete riziku zablokování vašeho účtu z důvodu použití upravené hry. Na oficiálním serveru lze využít pouze Addon s češtinou CzWoW. Instalační soubor určený pro oficiální servery je už takto přizpůsoben.</p>'.
|
|---|
| 677 |
|
|---|
| 678 | '</td><td>';
|
|---|
| 679 |
|
|---|
| 680 | $Output .= $PageExport->ExportViewStat(' WHERE `DBCFileName` !=\'\' OR `LuaFileName` !=\'\' OR `Group`.`Id` = 1 OR `Group`.`Id` = 2 OR `Group`.`Id` = 3 OR `Group`.`Id` = 16');
|
|---|
| 681 |
|
|---|
| 682 | $Output .= '</td></tr></table>'.
|
|---|
| 683 | '</body></html>';
|
|---|
| 684 | return $Output;
|
|---|
| 685 | }
|
|---|
| 686 |
|
|---|
| 687 | function ExportToXML()
|
|---|
| 688 | {
|
|---|
| 689 | $User = ModuleUser::Cast($this->System->GetModule('User'))->User;
|
|---|
| 690 | $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
|
|---|
| 691 |
|
|---|
| 692 | $this->LoadFilters();
|
|---|
| 693 |
|
|---|
| 694 | $Buffer = '<?xml version="1.0" encoding="utf-8"?>'."\n".
|
|---|
| 695 | "<document>\n".
|
|---|
| 696 | " <meta>\n".
|
|---|
| 697 | " <projecturl>".Core::Cast($this->System)->Config['Web']['Host'].$this->System->Link('/')."</projecturl>\n".
|
|---|
| 698 | " <time>".date('r')."</time>\n".
|
|---|
| 699 | " <diacritics mode=".'"'.$this->Export['WithDiacritic'].'"'." />\n".
|
|---|
| 700 | " <author>".$User->Name."</author>\n".
|
|---|
| 701 | " <contributors>\n";
|
|---|
| 702 | foreach (explode(',', $this->UserNames) as $UserName)
|
|---|
| 703 | {
|
|---|
| 704 | $Buffer .= " <user>".trim($UserName)."</user>\n";
|
|---|
| 705 | }
|
|---|
| 706 | $Buffer .=
|
|---|
| 707 | " </contributors>\n".
|
|---|
| 708 | " </meta>\n".
|
|---|
| 709 | " <translation>\n";
|
|---|
| 710 |
|
|---|
| 711 | $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '.
|
|---|
| 712 | 'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id);
|
|---|
| 713 | while ($Group = $DbResult->fetch_assoc())
|
|---|
| 714 | {
|
|---|
| 715 | if ($Group['MangosTable'] == '')
|
|---|
| 716 | {
|
|---|
| 717 | $Group['MangosTable'] = $Group['TablePrefix'];
|
|---|
| 718 | $Group['MangosTableIndex'] = 'entry';
|
|---|
| 719 | }
|
|---|
| 720 | $Buffer .= ' <group id="'.$Group['Id'].'" name="'.$Group['TablePrefix'].'">'."\n";
|
|---|
| 721 | $DbResult2 = $this->Database->query($this->BuildQuery($Group));
|
|---|
| 722 | while ($Line = $DbResult2->fetch_assoc())
|
|---|
| 723 | {
|
|---|
| 724 | $Buffer .= ' <item id="'.$Line['Entry'].'" user="'.$Line['User'].'">'."\n";
|
|---|
| 725 | foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem)
|
|---|
| 726 | {
|
|---|
| 727 | if ($GroupItem['MangosColumn'] == '') $GroupItem['MangosColumn'] = $GroupItem['Column'];
|
|---|
| 728 | if ($Line[$GroupItem['Column']] != '')
|
|---|
| 729 | $Buffer .= ' <text index="'.$GroupItem['Id'].'" name="'.
|
|---|
| 730 | $GroupItem['Column'].'">'.addslashes($Line[$GroupItem['Column']]).'</text>'."\n";
|
|---|
| 731 | }
|
|---|
| 732 | $Buffer .= " </item>\n";
|
|---|
| 733 | }
|
|---|
| 734 | $Buffer .= " </group>\n";
|
|---|
| 735 | }
|
|---|
| 736 | if ($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer);
|
|---|
| 737 | $Buffer .= " </translation>\n".
|
|---|
| 738 | '</document>';
|
|---|
| 739 | return $Buffer;
|
|---|
| 740 | }
|
|---|
| 741 | }
|
|---|