Changeset 880 for trunk/Modules/Export
- Timestamp:
- Apr 7, 2020, 10:15:48 PM (5 years ago)
- Location:
- trunk/Modules/Export
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Export/CreateAddon.php
r859 r880 17 17 $string = str_replace('$r', '"..'.$strlower.'(UnitRace("player")).."', $string); 18 18 $Gender = '$G'; 19 while (strpos($string, $Gender) !== false)19 while (strpos($string, $Gender) !== false) 20 20 { 21 21 $Before = substr($string, 0, strpos($string, $Gender)); … … 30 30 } 31 31 $Gender = '$g'; 32 while (strpos($string, $Gender) !== false)32 while (strpos($string, $Gender) !== false) 33 33 { 34 34 $Before = substr($string, 0, strpos($string, $Gender)); … … 46 46 $string = str_replace("\r", '', $string); 47 47 $string = str_replace("\n", '\r\n', $string); 48 return ($string);48 return $string; 49 49 } 50 50 … … 64 64 $string = str_replace('\\n', ' ', $string); 65 65 $string = str_replace(' ', '', $string); 66 // while (strpos($string, ' '))66 // while (strpos($string, ' ')) 67 67 // $string = str_replace(' ', ' ', $string); 68 return ($string);68 return $string; 69 69 } 70 70 … … 75 75 $string = str_replace('$b', '\r\n', $string); 76 76 $string = $this->ReplaceVarInText($string,''); 77 return ($string);77 return $string; 78 78 } 79 79 … … 81 81 { 82 82 //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; 85 85 } 86 86 … … 98 98 $string = str_replace('\\\\124', '\\124',$string); 99 99 100 return ($string);100 return $string; 101 101 } 102 102 … … 113 113 $CreatedFileListCount = array(); 114 114 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); 116 116 117 117 $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()) 119 119 { 120 120 //získání čísla verze pro export … … 126 126 else $ExportVersion = ''; 127 127 128 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column)129 if ($Column['AddonFileName'] != '')128 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) 129 if ($Column['AddonFileName'] != '') 130 130 { 131 131 $this->AddProgress(1); 132 if (!isset($CreatedFileListCount[$Column['AddonFileName']]))132 if (!isset($CreatedFileListCount[$Column['AddonFileName']])) 133 133 $CreatedFileListCount[$Column['AddonFileName']] = 0; 134 134 $CreatedFileListCount[$Column['AddonFileName']]++; … … 149 149 $ID = $this->Database->query('SELECT `BuildNumber` FROM `ClientVersion` WHERE '. 150 150 ' `Imported` = 1 AND `BuildNumber` < '.$BuildNumber.' ORDER BY `BuildNumber` DESC LIMIT 1'); 151 if ($ID->num_rows > 0) {151 if ($ID->num_rows > 0) { 152 152 $ExportVersionOld = $ID->fetch_assoc(); 153 153 $ExportVersionOld = $ExportVersionOld['BuildNumber']; 154 154 155 155 $DbResult2 = $this->Database->query($this->BuildQuery($Group,$ExportVersionOld)); 156 while ($Line = $DbResult2->fetch_assoc())156 while ($Line = $DbResult2->fetch_assoc()) 157 157 { 158 158 $en = trim($this->ReplaceEnText($Line['En'.$Column['Column']])); 159 159 $cz = $this->ReplaceCzText($Line[$Column['Column']]); 160 if (($en <> '') and ($cz <> '') and ($this->NotCancel($en)))160 if (($en <> '') and ($cz <> '') and ($this->NotCancel($en))) 161 161 { 162 162 $TableTexts[$en] = $cz; … … 167 167 168 168 $DbResult2 = $this->Database->query($this->BuildQuery($Group,$ExportVersion)); 169 while ($Line = $DbResult2->fetch_assoc())169 while ($Line = $DbResult2->fetch_assoc()) 170 170 { 171 171 $en = trim($this->ReplaceEnText($Line['En'.$Column['Column']])); 172 172 $cz = $this->ReplaceCzText($Line[$Column['Column']]); 173 if (($en <> '') and ($cz <> '') and ($this->NotCancel($en)))173 if (($en <> '') and ($cz <> '') and ($this->NotCancel($en))) 174 174 { 175 175 $TableTexts[$en] = $cz; … … 177 177 } 178 178 179 foreach ($TableTexts as $key => $value) {179 foreach ($TableTexts as $key => $value) { 180 180 $Buffer .= "\n".'["'.$key.'"]="'.$value.'",'; 181 181 $i++; … … 194 194 $CountFiles = 'CountFiles.lua'; 195 195 $Buffer = ''; 196 foreach ($CreatedFileList as $CreatedFile)196 foreach ($CreatedFileList as $CreatedFile) 197 197 $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) 200 200 if (($Column['AddonFileName'] != '') and (!in_array($Column['AddonFileName'].'_1', $CreatedFileList))) 201 201 { … … 209 209 $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"; 210 210 $Buffer .= '<script file="'.$CountFiles.'"/>'."\n"; 211 foreach ($CreatedFileList as $CreatedFile)211 foreach ($CreatedFileList as $CreatedFile) 212 212 $Buffer .= '<script file="'.$CreatedFile.'.lua"/>'."\n"; 213 213 $Buffer .= '</Ui>'; 214 214 file_put_contents($this->TempDir.'CzWoW/Translates.xml', $Buffer); 215 return ($Output);215 return $Output; 216 216 } 217 217 … … 235 235 236 236 $DbResult = $this->Database->query($this->BuildQuery($Group,$CanGenerated)); 237 while ($Line = $DbResult->fetch_array())237 while ($Line = $DbResult->fetch_array()) 238 238 { 239 239 $Original = $this->my_trim($Line['En'.$Column['Column']]); 240 240 $Translated = $this->my_trim($Line[$Column['Column']]); 241 if ($this->ClientVersion['Version'] == '2.4.3')241 if ($this->ClientVersion['Version'] == '2.4.3') 242 242 { 243 243 $Original = str_replace("|Hchannel:%d|h[%s]|h", '[%s]', $Original); … … 247 247 } 248 248 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); 250 250 file_put_contents($this->TempDir.'CzWoW/LocalizationStrings.lua', $Buffer); 251 251 } … … 253 253 function MakeAddon() 254 254 { 255 if (!file_exists($this->TempDir)) mkdir($this->TempDir, 0777, true);255 if (!file_exists($this->TempDir)) mkdir($this->TempDir, 0777, true); 256 256 $Output = $this->MakeLanguageFiles(); 257 257 $Output .= $this->MakeClientStrings(); 258 258 // $Output .= MakeMainScript($Setting); 259 return ($Output);259 return $Output; 260 260 } 261 261 … … 283 283 '; 284 284 $DbResult = $System->Database->query('SELECT * FROM `CzWoWPackageVersion` ORDER BY `Date` DESC'); 285 while ($Line = $DbResult->fetch_assoc())285 while ($Line = $DbResult->fetch_assoc()) 286 286 { 287 287 $Buffer .=' -
trunk/Modules/Export/Export.php
r879 r880 17 17 { 18 18 $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); 20 20 $this->TempDirRelative = $this->System->Config['Web']['TempFolder'].'Export/'.$this->Id.'/'; 21 21 $this->SourceDir = dirname(__FILE__).'/../../'.$this->System->Config['Web']['SourceFolder']; 22 22 $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); 24 24 } 25 25 … … 29 29 if ($Export['AllUsers']) { 30 30 $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()) 32 32 { 33 33 $Condition = ' WHERE `Export`='.$this->Id.' AND `User`='.$UserLine['ID']; 34 34 $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) 36 36 { 37 37 // $this->System->Database->query('UPDATE `ExportUser` SET `Sequence`='.$Value.$Condition); … … 50 50 { 51 51 $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'); 53 53 $this->Export = $DbResult->fetch_assoc(); 54 54 … … 58 58 'LEFT JOIN `User` ON `User`.`ID`=`ExportUser`.`User` '. 59 59 'WHERE `ExportUser`.`Export`='.$this->Id.' ORDER BY `ExportUser`.`Sequence`'); 60 while ($UserLine = $DbResult->fetch_assoc())60 while ($UserLine = $DbResult->fetch_assoc()) 61 61 { 62 62 $this->UserNames .= ', '.$UserLine['Name']; … … 64 64 $this->UserNames = substr($this->UserNames, 2); 65 65 66 if ($this->Export['ClientVersion'] != '')66 if ($this->Export['ClientVersion'] != '') 67 67 { 68 68 $DbResult = $this->Database->query('SELECT * FROM `ClientVersion` WHERE `Id`='.$this->Export['ClientVersion']); … … 82 82 83 83 $DbResultItem = $this->System->Database->query('SELECT * FROM `ExportGroupItem` WHERE `Export`='.$this->Id); 84 while ($GroupItem = $DbResultItem->fetch_assoc())84 while ($GroupItem = $DbResultItem->fetch_assoc()) 85 85 { 86 86 $GroupItems[$GroupItem['GroupItem']] = 1; … … 88 88 // Build selected columns 89 89 $Columns = ''; 90 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) {90 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) { 91 91 if (!isset($GroupItems[$Column['Id']])) $Columns .= ' `T`.`'.$Column['Column'].'` AS `'.$Column['Column'].'`, '; 92 92 } … … 104 104 // Build columns for english texts 105 105 $OriginalColumns = ''; 106 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) {106 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) { 107 107 $OriginalColumns .= ' `T3`.`'.$Column['Column'].'` AS `En'.$Column['Column'].'`, '; 108 108 if (isset($GroupItems[$Column['Id']])) … … 117 117 '(`T3`.`VersionStart` = `T4`.`VersionStart`) AND (`T3`.`VersionEnd` = `T4`.`VersionEnd`)'; 118 118 119 return ($Query);119 return $Query; 120 120 } 121 121 … … 129 129 if (file_exists($file)) 130 130 $date = date('Y-m-d H:i',(filemtime($file))); 131 else return (true);131 else return true; 132 132 // echo $file; 133 133 … … 135 135 'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id); 136 136 $result = false; 137 while ($Group = $DbResult->fetch_assoc())137 while ($Group = $DbResult->fetch_assoc()) 138 138 { 139 139 $Query = 'SELECT * FROM `'.$Group['TablePrefix'].'` AS `T`'. … … 149 149 } 150 150 } 151 return ($result);151 return $result; 152 152 } 153 153 … … 172 172 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '. 173 173 'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id); 174 while ($Group = $DbResult->fetch_assoc())174 while ($Group = $DbResult->fetch_assoc()) 175 175 { 176 176 $Buffer .= $Group['TablePrefix'].', '; … … 180 180 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '. 181 181 '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'] != '') 185 185 { 186 186 $Buffer .= "\n\n-- ".$Group['Name']."\n\n"; 187 187 $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()) 190 190 { 191 191 $Values = ''; 192 foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem)193 if ($GroupItem['Column'] != $Group['PrimaryKeyItem']) // Do not update primary key192 foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem) 193 if ($GroupItem['Column'] != $Group['PrimaryKeyItem']) // Do not update primary key 194 194 { 195 if ($GroupItem['MangosColumn'] == '') $GroupItem['MangosColumn'] = $GroupItem['Column'];195 if ($GroupItem['MangosColumn'] == '') $GroupItem['MangosColumn'] = $GroupItem['Column']; 196 196 $Values .= ', `'.$GroupItem['MangosColumn'].'`="'.addslashes($Line[$GroupItem['Column']]).'"'; 197 197 } … … 200 200 // Get multicolumn index 201 201 $ColumnItems = explode(',', $Group['MangosTableIndex']); 202 if (count($ColumnItems) > 1)202 if (count($ColumnItems) > 1) 203 203 { 204 204 $Where = 'CONCAT('; 205 foreach ($ColumnItems as $ColumnItem)205 foreach ($ColumnItems as $ColumnItem) 206 206 $Where .= '`'.$ColumnItem.'`, "_", '; 207 207 $Where = substr($Where, 0, -7).')'; … … 216 216 } 217 217 } 218 if ($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer);219 return ($Buffer);218 if ($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer); 219 return $Buffer; 220 220 } 221 221 … … 243 243 'aowow_skill' => 'skillID', 244 244 ); 245 foreach ($AoWoWTables as $AoWoWTable => $IndexColum)245 foreach ($AoWoWTables as $AoWoWTable => $IndexColum) 246 246 { 247 247 $Buffer .= '--'.$AoWoWTable.', '; … … 249 249 $Query = 'SELECT `name`,`'.$IndexColum.'` FROM `'.$AoWoWTable.'`'; 250 250 $DbResult = $Database2->query($Query); 251 while ($Line = $DbResult->fetch_assoc())251 while ($Line = $DbResult->fetch_assoc()) 252 252 { 253 253 $Ori_text = $Line['name']; … … 259 259 $Tran = $DbResult2->fetch_assoc(); 260 260 //echo ($Line['name'].'='.$Tran['tran']); 261 if ($Tran['Tran'] == '')261 if ($Tran['Tran'] == '') 262 262 { 263 263 $DbResult2 = $Database2->query('SELECT `OptionText` AS `En`, … … 270 270 } 271 271 272 if ($Tran['Tran'] <> '')272 if ($Tran['Tran'] <> '') 273 273 $Buffer .= 'UPDATE `'.$AoWoWTable.'` SET `name` = "'.addslashes($Tran['Tran']).'" WHERE '.$IndexColum.' = '.$Line[$IndexColum].' ;'."\n"; 274 274 } … … 276 276 } 277 277 */ 278 if ($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer);279 return ($Buffer);278 if ($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer); 279 return $Buffer; 280 280 } 281 281 … … 299 299 if (false === strpos($String2,$varible)) { 300 300 // echo $varible; 301 return (false);301 return false; 302 302 } 303 303 } 304 304 } 305 return (true);305 return true; 306 306 } 307 307 … … 324 324 'WHERE `ExportGroup`.`Export`='.$this->Id.' AND `Group`.`DBCFileName` != ""'); 325 325 $Output = 'Počet generovaných skupin: '.$DbResult->num_rows."\n"; 326 while ($Group = $DbResult->fetch_assoc())326 while ($Group = $DbResult->fetch_assoc()) 327 327 { 328 328 $this->AddProgress(2); 329 329 $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')) 331 331 { 332 332 // Load string column index list … … 335 335 $ColumnIndexes = array(); 336 336 $ColumnFormat = array(); 337 while ($DbRow = $DbResult2->fetch_assoc())337 while ($DbRow = $DbResult2->fetch_assoc()) 338 338 { 339 339 $ColumnFormat[$DbRow['ColumnIndex']] = FORMAT_STRING; … … 344 344 $LookupTable = array(); 345 345 $DbResult2 = $this->Database->query($this->BuildQuery($Group)); 346 while ($DbRow = $DbResult2->fetch_assoc()) {346 while ($DbRow = $DbResult2->fetch_assoc()) { 347 347 //Export only if translate have same varible % 348 348 $CanExport = true; 349 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) {349 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) { 350 350 $DbRow[$Column['Column']] = str_replace ( '$ ','$',$DbRow[$Column['Column']]); 351 351 if (!$this->HaveVarible($DbRow['En'.$Column['Column']],$DbRow[$Column['Column']])) { … … 369 369 370 370 // 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); 372 372 $NewDBCFile = new DBCFile(); 373 373 $NewDBCFile->CreateFile($this->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc', $ColumnFormat); … … 381 381 $RowCount = $SourceDBCFile->GetRecordCount(); 382 382 $FieldCount = $SourceDBCFile->GetFieldCount(); 383 for ($Row = 0; $Row < $RowCount; $Row++)383 for ($Row = 0; $Row < $RowCount; $Row++) 384 384 { 385 385 $Line = $SourceDBCFile->GetLine($Row); … … 388 388 $PrimaryKeyItem = ''; 389 389 $ColumnItems = explode(',', $Group['DBCIndex']); 390 if (count($ColumnItems) > 1)390 if (count($ColumnItems) > 1) 391 391 { 392 foreach ($ColumnItems as $ColumnItem)392 foreach ($ColumnItems as $ColumnItem) 393 393 $PrimaryKeyItem .= $Line[$ColumnItem].'_'; 394 394 $PrimaryKeyItem = substr($PrimaryKeyItem, 0, -1); 395 395 } else $PrimaryKeyItem = $Line[$Group['DBCIndex']]; 396 396 397 if (array_key_exists($PrimaryKeyItem, $LookupTable))397 if (array_key_exists($PrimaryKeyItem, $LookupTable)) 398 398 { 399 399 // Replace text columns 400 400 $LookupTableItem = $LookupTable[$PrimaryKeyItem]; 401 foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem)401 foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem) 402 402 { 403 if (array_key_exists($GroupItem['Id'], $ColumnIndexes))403 if (array_key_exists($GroupItem['Id'], $ColumnIndexes)) 404 404 $Line[$ColumnIndexes[$GroupItem['Id']]] = $LookupTableItem[$GroupItem['Column']]; 405 405 } … … 409 409 // Show completion progress 410 410 $Progress = round($Row / $RowCount * 100); 411 if ($Progress != $OldProgress)411 if ($Progress != $OldProgress) 412 412 { 413 413 if (($Group['Id'] == 13) and ($Progress <> 100)) $this->AddProgress(0.01); … … 422 422 } 423 423 $Output .= 'Hotovo <br />'; 424 return ($Output);424 return $Output; 425 425 } 426 426 … … 432 432 433 433 $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); 435 435 $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()) 437 437 { 438 438 $this->AddProgress(1); … … 448 448 $LookupTable = array(); 449 449 $DbResult2 = $this->Database->query($this->BuildQuery($Group)); 450 while ($DbRow = $DbResult2->fetch_assoc()) {450 while ($DbRow = $DbResult2->fetch_assoc()) { 451 451 $CanExport = true; 452 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) {452 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) { 453 453 // if (strpos($DbRow[$Column['Column']],'\\')) 454 454 // $CanExport = false; … … 502 502 } 503 503 504 while (!$File->EOF())504 while (!$File->EOF()) 505 505 { 506 506 $Line = $File->ReadLine(); 507 if (strpos($Line, '=') !== false)507 if (strpos($Line, '=') !== false) 508 508 { 509 509 $LineParts = explode('=', $Line, 2); … … 511 511 $Line = trim($LineParts[1]); 512 512 513 if ($Line[0] == '"')513 if ($Line[0] == '"') 514 514 { 515 515 // Quoted string value … … 532 532 $Value['Comment'] = addslashes(stripslashes(substr($Line, 3))); // Skip " --" 533 533 534 if (array_key_exists($Value['ShortCut'], $LookupTable))534 if (array_key_exists($Value['ShortCut'], $LookupTable)) 535 535 { 536 536 $DbRow = $LookupTable[$Value['ShortCut']]; … … 548 548 } 549 549 $NewLine = $Value['ShortCut'].' = "'.$Value['Text'].'";'; 550 //if ($Value['Comment'] != '') $NewLine .= ' -- '.$Value['Comment'];550 //if ($Value['Comment'] != '') $NewLine .= ' -- '.$Value['Comment']; 551 551 $NewLine .= "\r\n"; 552 552 $File2->WriteLine($NewLine); … … 555 555 $Output .= 'Hotovo <br/>'; 556 556 } 557 return ($Output);557 return $Output; 558 558 } 559 559 … … 656 656 " <author>".$this->System->User->Name."</author>\n". 657 657 " <contributors>\n"; 658 foreach (explode(',', $this->UserNames) as $UserName)658 foreach (explode(',', $this->UserNames) as $UserName) 659 659 $Buffer .= " <user>".$UserName."</user>\n"; 660 660 $Buffer .= … … 665 665 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '. 666 666 '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'] == '') 670 670 { 671 671 $Group['MangosTable'] = $Group['TablePrefix']; … … 674 674 $Buffer .= ' <group id="'.$Group['Id'].'" name="'.$Group['TablePrefix'].'">'."\n"; 675 675 $DbResult2 = $this->Database->query($this->BuildQuery($Group)); 676 while ($Line = $DbResult2->fetch_assoc())676 while ($Line = $DbResult2->fetch_assoc()) 677 677 { 678 678 $Buffer .= ' <item id="'.$Line['Entry'].'" user="'.$Line['UserName'].'">'."\n"; 679 679 $Values = ''; 680 foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem)680 foreach ($TranslationTree[$Group['Id']]['Items'] as $GroupItem) 681 681 { 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']] != '') 684 684 $Buffer .= ' <text index="'.$GroupItem['Id'].'" name="'. 685 685 $GroupItem['Column'].'">'.addslashes($Line[$GroupItem['Column']]).'</text>'."\n"; … … 689 689 $Buffer .= " </group>\n"; 690 690 } 691 if ($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer);691 if ($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer); 692 692 $Buffer .= " </translation>\n". 693 693 "</document>"; 694 return ($Buffer);694 return $Buffer; 695 695 } 696 696 } … … 732 732 '((`Export`.`OutputType` = 9) OR (`Export`.`OutputType` = 10)) AND '. 733 733 '(`TimeFinish` IS NULL) OR (`Export` ='.$TaskId.') ORDER BY `TimeQueued`'); // `Export`='.$Export->Id 734 while ($Task = $DbResult->fetch_assoc())734 while ($Task = $DbResult->fetch_assoc()) 735 735 { 736 736 $Export = '<a href="'.$this->System->Link('/export/?Action=View&ExportId='.$Task['Export']).'">'.$Task['Export'].'</a>'; … … 744 744 // Show estimated time to complete 745 745 $PrefixMultiplier = new PrefixMultiplier(); 746 if ($Task['Progress'] > 0) {746 if ($Task['Progress'] > 0) { 747 747 $ElapsedTime = time() - MysqlDateTimeToTime($Task['TimeStart']); 748 748 $Output .= T('Elapsed time').': <strong>'.$PrefixMultiplier->Add($ElapsedTime, '', 4, 'Time').'</strong> / '; … … 752 752 $Output .= '</div>'; 753 753 754 if ($Task['Progress'] > 99)754 if ($Task['Progress'] > 99) 755 755 $Output .= '<script type="text/javascript" language="JavaScript" charset="utf-8">'. 756 756 'setTimeout("parent.location.href=\''.$this->System->Link('/export/?Action=View&Tab=7&ExportId='.$TaskId).'\'", 500)'. 757 757 '</script>'; 758 758 } 759 return ($Output);759 return $Output; 760 760 } 761 761 } -
trunk/Modules/Export/ExportOutput.php
r867 r880 10 10 { 11 11 $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 != '..')) 15 15 { 16 if (is_dir($Path.$FileName)) CreateZipFromDir($Zip, $Path.$FileName.'/', $ZipPath.$FileName.'/');16 if (is_dir($Path.$FileName)) CreateZipFromDir($Zip, $Path.$FileName.'/', $ZipPath.$FileName.'/'); 17 17 else $Zip->addFile(file_get_contents($Path.$FileName), $ZipPath.$FileName); 18 18 } … … 28 28 $Export->Id = $ExportId; 29 29 $Export->Init(); 30 if (function_exists('gzcompress'))30 if (function_exists('gzcompress')) 31 31 { 32 32 $SaveFilename = $Export->TempDir.'CzAoWoW_SQL.zip'; … … 45 45 '<a href="'.$System->Link('/'.$Export->TempDirRelative.'CzAoWoW_SQL.zip').'">'.$SQLFilename.'</a><br />'. 46 46 '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; 48 48 } 49 49 … … 58 58 htmlspecialchars($Export->ExportToAoWoWSQL()). 59 59 '</pre>'; 60 return ($Output );60 return $Output ; 61 61 } 62 62 … … 69 69 $Export->Id = $ExportId; 70 70 $Export->Init(); 71 if (function_exists('gzcompress'))71 if (function_exists('gzcompress')) 72 72 { 73 73 $SaveFilename = $Export->TempDir.'CzWoW_SQL.zip'; … … 86 86 '<a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_SQL.zip').'">'.$SQLFilename.'</a><br />'. 87 87 '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; 89 89 } 90 90 … … 99 99 htmlspecialchars($Export->ExportToMangosSQL()). 100 100 '</pre>'; 101 return ($Output);101 return $Output; 102 102 } 103 103 … … 106 106 global $System; 107 107 108 if (function_exists('gzcompress'))108 if (function_exists('gzcompress')) 109 109 { 110 110 $Addon = new ExportAddon($System); … … 135 135 '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.'; 136 136 $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; 138 138 } 139 139 … … 146 146 $Export->Id = $ExportId; 147 147 $Export->Init(); 148 if (function_exists('gzcompress'))148 if (function_exists('gzcompress')) 149 149 { 150 150 $SaveFilename = $Export->TempDir.'CzWoW_XML.zip'; … … 163 163 '<a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_XML.zip').'">CzWoW_SQL.zip</a><br />'. 164 164 '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; 166 166 } 167 167 … … 176 176 htmlspecialchars($Export->ExportToXML()). 177 177 '</pre>'; 178 return ($Output);178 return $Output; 179 179 } 180 180 … … 190 190 $DbResult = $System->Database->query('SELECT `Id` FROM `ExportTask` WHERE (`Export` = '.$ExportId. 191 191 ') 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)) 195 195 { 196 196 $System->Database->query('UPDATE `ExportTask` SET `TimeQueued` = NOW(), `Progress`=0 , `TimeStart` = NULL, `TimeFinish` = NULL WHERE `Export` = '.$ExportId); … … 211 211 212 212 $DbResult = $System->Database->query('SELECT * FROM `ExportTask` WHERE `Export` = '.$ExportId); 213 if ($DbResult->num_rows == 0)213 if ($DbResult->num_rows == 0) 214 214 { 215 215 $System->Database->query('INSERT INTO `ExportTask` (`Export` ,`TimeQueued` ) VALUES ('.$ExportId.', NOW())'); … … 220 220 $DbResult = $System->Database->query('SELECT `TimeFinish` FROM `ExportTask` WHERE `Export` = '.$ExportId); 221 221 $ExportTask = $DbResult->fetch_assoc(); 222 if ($ExportTask['TimeFinish'] <> '')222 if ($ExportTask['TimeFinish'] <> '') 223 223 { 224 224 $Output .= '<strong>Souhrný balík: <a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_DBC.zip').'">CzWoW_DBC.zip</a></strong><br/>'; 225 225 $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()) 227 227 { 228 if (file_exists($Export->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc'))228 if (file_exists($Export->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc')) 229 229 $Output .= '<a href="'.$System->Link('/'.$Export->TempDirRelative.'dbc/'.$Group['DBCFileName'].'.dbc').'">'.$Group['DBCFileName'].'.dbc</a><br/>'; 230 230 } … … 233 233 234 234 } 235 return ($Output);235 return $Output; 236 236 } 237 237 … … 261 261 'WHERE ((`Export`.`OutputType` = 9) OR (`Export`.`OutputType` = 10)) AND '. 262 262 '(`TimeFinish` IS NULL) AND (`TimeQueued` < (NOW() - '.$Timeout.'))'); 263 if ($DbResult->num_rows > 0)263 if ($DbResult->num_rows > 0) 264 264 { 265 265 $System->ModuleManager->Modules['Log']->WriteLog('ProcesTask nepracuje přes 2 hodiny, pravděpodobně nepracuje!', LOG_TYPE_ERROR); 266 266 } 267 return ($Output);267 return $Output; 268 268 } 269 269 … … 281 281 $DbResult = $System->Database->query('SELECT `Id` FROM `ExportTask` WHERE (`Export` = '.$ExportId. 282 282 ') 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)) 286 286 { 287 287 $System->Database->query('UPDATE `ExportTask` SET `TimeQueued` = NOW(), `Progress`=0, `TimeStart` = NULL, `TimeFinish` = NULL WHERE `Export` = '.$ExportId); … … 298 298 // Start task for the first time if export task was not yet started 299 299 $DbResult = $System->Database->query('SELECT * FROM `ExportTask` WHERE `Export` = '.$ExportId); 300 if ($DbResult->num_rows == 0)300 if ($DbResult->num_rows == 0) 301 301 { 302 302 $System->Database->query('INSERT INTO ExportTask (`Export` ,`TimeStart` ) VALUES ('.$ExportId.', NOW())'); … … 306 306 $DbResult = $System->Database->query('SELECT `TimeFinish` FROM `ExportTask` WHERE `Export` = '.$ExportId); 307 307 $ExportTask = $DbResult->fetch_assoc(); 308 if ($ExportTask['TimeFinish'] <> '')308 if ($ExportTask['TimeFinish'] <> '') 309 309 { 310 310 $FileName = 'Instalace_CzechWoW_'.$Export->ClientVersion['Version'].'.exe'; … … 313 313 $Output .= ShowProgress($Export); 314 314 } 315 return ($Output);315 return $Output; 316 316 } 317 317 … … 324 324 $Export->Init(); 325 325 326 if (function_exists('gzcompress'))326 if (function_exists('gzcompress')) 327 327 { 328 328 $Output = 'Generování lua souborů...<br />'; … … 342 342 'Souhrný archív <a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_Lua.zip').'">CzWoW_Lua.zip</a><br />'; 343 343 $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()) 345 345 { 346 346 $Output .= '<a href="'.$System->Link('/'.$Export->TempDirRelative.'lua/'.$Group['LuaFileName'].'.lua').'">'.$Group['LuaFileName'].'.lua</a><br/>'; 347 347 } 348 348 $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; 350 350 } 351 351 352 352 function ExportOutput($ExportId, $Type) 353 353 { 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); 364 364 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 17 17 { 18 18 $Output = '<a href="?Action=ViewList">'.T('All').'</a>'; 19 if ($this->System->User->Licence(LICENCE_USER))19 if ($this->System->User->Licence(LICENCE_USER)) 20 20 { 21 21 $Output .= ' <a href="?Action=ViewList&Filter=Others">'.T('Others').'</a>'. … … 23 23 } 24 24 25 if ($this->System->User->Licence(LICENCE_USER))25 if ($this->System->User->Licence(LICENCE_USER)) 26 26 $Output .= '<br/><div style="text-align: center;"><a href="?Action=Create">'.T('Create new export').'</a></div><br/>'; 27 27 28 28 $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; 33 33 } 34 34 … … 62 62 '(SELECT COUNT(*) FROM `ExportUser` WHERE `ExportUser`.`Export`=`Export`.`Id`) AS `UserCount` FROM `Export` '. 63 63 '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()) 65 65 { 66 66 $Action = '<a href="?Action=View&ExportId='.$Export['Id'].'&Tab=0">'.T('View').'</a> '. 67 67 '<a href="?Action=View&ExportId='.$Export['Id'].'&Tab=7">'.T('Make export').'</a>'; 68 if ($Export['User'] == $this->System->User->Id) $Action .= ' <a href="?Action=Delete&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&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&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&ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy clone item?').'\');">'.T('Clone').'</a>'; 70 70 $Output .= '<tr><td>'.HumanDate($Export['TimeCreate']).'</td>'. 71 71 '<td><a href="'.$this->System->Link('/user/?user='.$Export['User']).'">'.$Export['UserName'].'</a></td>'. … … 79 79 $PageList['Output']; 80 80 81 return ($Output);81 return $Output; 82 82 } 83 83 84 84 function ExportCreate() 85 85 { 86 if ($this->System->User->Licence(LICENCE_USER))86 if ($this->System->User->Licence(LICENCE_USER)) 87 87 { 88 88 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id); 89 89 $DbRow = $DbResult->fetch_row(); 90 if ($DbRow[0] < $this->System->Config['MaxExportPerUser'])90 if ($DbRow[0] < $this->System->Config['MaxExportPerUser']) 91 91 { 92 92 $Output = '<form action="?Action=CreateFinish" method="post">'. … … 98 98 } else $Output = ShowMessage(sprintf(T('You can\'t create another export. Max for one user is %d.'), $this->System->Config['MaxExportPerUser']), MESSAGE_CRITICAL); 99 99 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 100 return ($Output);100 return $Output; 101 101 } 102 102 103 103 function ExportCreateFinish() 104 104 { 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)) 108 108 { 109 109 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id); 110 110 $DbRow = $DbResult->fetch_row(); 111 if ($DbRow[0] < $this->System->Config['MaxExportPerUser'])111 if ($DbRow[0] < $this->System->Config['MaxExportPerUser']) 112 112 { 113 113 $this->System->Database->query('INSERT INTO `Export` (`Title`, `User`, `TimeCreate`, `WithDiacritic`, `Description`) VALUES ("'.$_POST['Title'].'", '.$this->System->User->Id.', NOW(), 1, "'.$_POST['Description'].'")'); … … 120 120 } else $Output = ShowMessage(T('Missing data in form.'), MESSAGE_CRITICAL); 121 121 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 122 return ($Output);122 return $Output; 123 123 } 124 124 125 125 function ExportDelete() 126 126 { 127 if ($this->System->User->Licence(LICENCE_USER))127 if ($this->System->User->Licence(LICENCE_USER)) 128 128 { 129 129 $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) 131 131 { 132 132 $this->System->Database->query('DELETE FROM `ExportGroup` WHERE `Export`='.$_GET['ExportId']); … … 143 143 } else $Output = ShowMessage(T('Export not found.'), MESSAGE_CRITICAL); 144 144 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 145 return ($Output);145 return $Output; 146 146 } 147 147 … … 163 163 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 164 164 $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; 166 166 else $Editable = false; 167 167 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') 171 171 { 172 172 //print_r($_POST); 173 173 // Update user selection page 174 foreach ($_POST as $Index => $Value)174 foreach ($_POST as $Index => $Value) 175 175 { 176 if (substr($Index, 0, 3) == 'seq')176 if (substr($Index, 0, 3) == 'seq') 177 177 { 178 178 $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; 180 180 else $Selected = false; 181 181 $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `User`='.$UserId; 182 182 $DbResult = $this->System->Database->query('SELECT * FROM `ExportUser` '.$Condition); 183 if ($DbResult->num_rows > 0)183 if ($DbResult->num_rows > 0) 184 184 { 185 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportUser` '.$Condition);185 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportUser` '.$Condition); 186 186 else $this->System->Database->query('UPDATE `ExportUser` SET `Sequence`='.$Value.$Condition); 187 187 } else 188 188 { 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.')'); 190 190 } 191 191 } … … 221 221 ); 222 222 $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); 224 224 else $InitialOrder = ''; 225 225 … … 234 234 $Output .= '<form name="Translators" action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'. 235 235 '<h3>'.T('Translators').'</h3>'; 236 if ($Editable)236 if ($Editable) 237 237 { 238 238 $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'. … … 252 252 $this->System->Database->query('SET @I = 0'); 253 253 $DbResult = $this->System->Database->query($Query); 254 while ($UserLine = $DbResult->fetch_assoc())254 while ($UserLine = $DbResult->fetch_assoc()) 255 255 { 256 256 $XP = GetLevelMinMax($UserLine['XP']); … … 268 268 '</form>'. 269 269 $PageList['Output']; 270 return ($Output);270 return $Output; 271 271 } 272 272 … … 278 278 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 279 279 $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; 281 281 else $Editable = false; 282 282 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; 287 287 else $WithDiacritic = 0; 288 288 if (array_key_exists('Featured', $_POST)) $Export['Featured'] = 1; … … 296 296 } 297 297 298 if ($Export['WithDiacritic'] == 1) $WithDiacritic = ' checked="checked"';298 if ($Export['WithDiacritic'] == 1) $WithDiacritic = ' checked="checked"'; 299 299 else $WithDiacritic = ''; 300 300 $Output .= '<form action="?Action=View&Tab=0&ExportId='.$Export['Id'].'" method="post">'. 301 301 '<table>'; 302 if ($this->System->User->Id != null)302 if ($this->System->User->Id != null) 303 303 { 304 304 $Output .= '<input type="hidden" name="Operation" value="Save"/>'. 305 305 '<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].'/>'; 307 307 $Output .= ' <a href="?Action=Clone&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)) 309 309 $Output .= CheckBox('Featured', $Export['Featured'], '', 'CheckBox', !$Editable). ' '.T('Recommended').' '; 310 310 $Output .= '</td></tr>'; … … 314 314 '<tr><td>'.T('With diacritics').'</td><td><input type="checkbox" name="WithDiacritic" '.$WithDiacritic.''.$DisabledInput[$Editable].'/></td></tr>'. 315 315 '</table></form>'; 316 return ($Output);316 return $Output; 317 317 } 318 318 … … 325 325 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 326 326 $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; 328 328 else $Editable = false; 329 329 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') 333 333 { 334 334 //print_r($_POST); 335 335 // Update user selection page 336 foreach ($_POST as $Index => $Value)336 foreach ($_POST as $Index => $Value) 337 337 { 338 if (substr($Index, 0, 3) == 'seq')338 if (substr($Index, 0, 3) == 'seq') 339 339 { 340 340 $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; 342 342 else $Selected = false; 343 343 $Condition = ' WHERE Export='.$_GET['ExportId'].' AND `Language`='.$LanguageId; 344 344 $DbResult = $this->System->Database->query('SELECT * FROM `ExportLanguage` '.$Condition); 345 if ($DbResult->num_rows > 0)345 if ($DbResult->num_rows > 0) 346 346 { 347 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportLanguage` '.$Condition);347 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportLanguage` '.$Condition); 348 348 else $this->System->Database->query('UPDATE `ExportLanguage` SET `Sequence`='.$Value.$Condition); 349 349 } else 350 350 { 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.')'); 352 352 } 353 353 } … … 377 377 $Output .= '<form action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'. 378 378 '<h3>'.T('Languages').'</h3>'; 379 if ($Editable)379 if ($Editable) 380 380 { 381 381 $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'. … … 393 393 $this->System->Database->query('SET @I = 0'); 394 394 $DbResult = $this->System->Database->query($Query); 395 while ($Langugage = $DbResult->fetch_assoc())395 while ($Langugage = $DbResult->fetch_assoc()) 396 396 { 397 397 $Checked = $Langugage['Sequence'] != ''; … … 405 405 '</form>'. 406 406 $PageList['Output']; 407 return ($Output);407 return $Output; 408 408 } 409 409 … … 416 416 $DbRows = $this->System->Database->query('SELECT * FROM Export WHERE Id='.$_GET['ExportId']); 417 417 $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; 419 419 else $Editable = false; 420 420 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') 424 424 { 425 425 //print_r($_POST); 426 426 // Update user selection page 427 foreach ($_POST as $Index => $Value)427 foreach ($_POST as $Index => $Value) 428 428 { 429 if (substr($Index, 0, 3) == 'seq')429 if (substr($Index, 0, 3) == 'seq') 430 430 { 431 431 $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; 433 433 else $Selected = false; 434 434 $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `Group`='.$GroupId; 435 435 $DbResult = $this->System->Database->query('SELECT * FROM `ExportGroup` '.$Condition); 436 if ($DbResult->num_rows > 0)436 if ($DbResult->num_rows > 0) 437 437 { 438 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportGroup` '.$Condition);438 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportGroup` '.$Condition); 439 439 } else 440 440 { 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.')'); 442 442 } 443 443 } … … 446 446 } 447 447 //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; 452 452 else $Selected = false; 453 453 //we will save only forbitten collums and need to be visible … … 457 457 $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `GroupItem`='.$Column['Id']; 458 458 $DbResult = $this->System->Database->query('SELECT * FROM `ExportGroupItem` '.$Condition); 459 if ($DbResult->num_rows > 0)459 if ($DbResult->num_rows > 0) 460 460 { 461 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportGroupItem` '.$Condition);461 if (!$Selected) $this->System->Database->query('DELETE FROM `ExportGroupItem` '.$Condition); 462 462 } else 463 463 { 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'].')'); 465 465 } 466 466 … … 486 486 $Output .= '<form action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'. 487 487 '<h3>'.T('Translation groups').'</h3>'; 488 if ($Editable)488 if ($Editable) 489 489 { 490 490 $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'. … … 500 500 501 501 $DbResultItem = $this->System->Database->query('SELECT * FROM `ExportGroupItem` WHERE `Export`='.$_GET['ExportId']); 502 while ($GroupItem = $DbResultItem->fetch_assoc())502 while ($GroupItem = $DbResultItem->fetch_assoc()) 503 503 { 504 504 $GroupItems[$GroupItem['GroupItem']] = 1; … … 507 507 $Query = 'SELECT * FROM ('.$Query.') AS TX '.$Order['SQL'].$PageList['SQLLimit']; 508 508 $DbResult = $this->System->Database->query($Query); 509 while ($Group = $DbResult->fetch_assoc())509 while ($Group = $DbResult->fetch_assoc()) 510 510 { 511 511 $Columns = ''; 512 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) {512 foreach ($TranslationTree[$Group['Id']]['Items'] as $Column) { 513 513 if ($Column['Visible']) $Columns .= CheckBox('item'.$Column['Id'], 514 514 !isset($GroupItems[$Column['Id']]), '', 'CheckBox', !$Editable).' '.T($Column['Name']).' <br/>'; … … 533 533 '</form>'. 534 534 $PageList['Output']; 535 return ($Output);535 return $Output; 536 536 } 537 537 … … 540 540 $Output = ''; 541 541 $DisabledInput = array(false => ' disabled="disabled"', true => ''); 542 if (array_key_exists('ExportId', $_GET))542 if (array_key_exists('ExportId', $_GET)) 543 543 { 544 544 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 545 if ($DbRows->num_rows > 0)545 if ($DbRows->num_rows > 0) 546 546 { 547 547 $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; 549 549 else $Editable = false; 550 550 551 if (array_key_exists('Operation', $_POST))552 if ($_POST['Operation'] == 'Save')551 if (array_key_exists('Operation', $_POST)) 552 if ($_POST['Operation'] == 'Save') 553 553 { 554 if (array_key_exists('OutputType', $_POST) and ($_POST['OutputType'] * 1 > 0))554 if (array_key_exists('OutputType', $_POST) and ($_POST['OutputType'] * 1 > 0)) 555 555 { 556 556 $this->System->Database->query('UPDATE Export SET OutputType='.$_POST['OutputType'].' WHERE Id='.$_GET['ExportId']); … … 564 564 $Output .= '<h3>'.T('Format the generated output').'</h3>'. 565 565 '<form action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'; 566 if ($Editable)566 if ($Editable) 567 567 { 568 568 $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'. … … 571 571 } 572 572 $DbResult = $this->System->Database->query('SELECT * FROM `ExportOutputType` ORDER BY `Name`'); 573 while ($ExportFormat = $DbResult->fetch_assoc())573 while ($ExportFormat = $DbResult->fetch_assoc()) 574 574 { 575 575 $Output .= RadioButton('OutputType', $ExportFormat['Id'], $Export['OutputType'] == $ExportFormat['Id'], '', !$Editable).' '.$ExportFormat['Name'].'<br/>'; … … 578 578 } else $Output .= ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 579 579 } else $Output .= ShowMessage(T('Is isn\'t select'), MESSAGE_CRITICAL); 580 return ($Output);580 return $Output; 581 581 } 582 582 … … 587 587 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 588 588 $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; 590 590 else $Editable = false; 591 591 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))) 594 594 { 595 595 $this->System->Database->query('UPDATE `Export` SET `ClientVersion`='.$_POST['ClientVersion'].' WHERE `Id`='.$_GET['ExportId']); … … 600 600 $Export = $DbResult->fetch_assoc(); 601 601 602 if ($Export['OutputType'] == '') $Output .= ShowMessage('Nevybrán typ exportu', MESSAGE_CRITICAL);602 if ($Export['OutputType'] == '') $Output .= ShowMessage('Nevybrán typ exportu', MESSAGE_CRITICAL); 603 603 else { 604 604 $Query = 'SELECT `ClientVersion`.* FROM `ExportVersion` '. … … 620 620 '<h3>'.T('Client version').'</h3>'; 621 621 622 if ($Editable)622 if ($Editable) 623 623 { 624 624 $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'. … … 633 633 $Query = 'SELECT * FROM ('.$Query.') AS `TX` '.$Order['SQL'].$PageList['SQLLimit']; 634 634 $DbResult = $this->System->Database->query($Query); 635 while ($Version = $DbResult->fetch_assoc())635 while ($Version = $DbResult->fetch_assoc()) 636 636 { 637 637 $Output .= '<tr><td><a href="'.$this->System->Link('/client-version/?action=item&id='.$Version['Id']).'">'. … … 646 646 $PageList['Output']; 647 647 } 648 return ($Output);648 return $Output; 649 649 } 650 650 … … 654 654 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 655 655 $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); 658 658 else { 659 659 $DbResult = $this->System->Database->query('SELECT * FROM `ExportOutputType` WHERE `Id`='.$Export['OutputType']); 660 if ($DbResult->num_rows > 0)660 if ($DbResult->num_rows > 0) 661 661 { 662 662 $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) 664 664 { 665 665 if (array_key_exists('Auto', $_GET) == false) … … 669 669 } else $Output = ShowMessage(T('Format output isn\'t select').'.', MESSAGE_CRITICAL); 670 670 } 671 return ($Output);671 return $Output; 672 672 } 673 673 … … 679 679 $Export->LoadFilters(); 680 680 681 if (($Export->Export['ClientVersion'] == '') or ($Export->ClientVersion['BuildNumber'] == ''))681 if (($Export->Export['ClientVersion'] == '') or ($Export->ClientVersion['BuildNumber'] == '')) 682 682 $Output = ShowMessage(T('Export don\'t have selected version of client'), MESSAGE_CRITICAL); 683 683 else { … … 687 687 $UnionItems = array(); 688 688 $DbResult = $this->System->Database->query($GroupListQuery.$Where); 689 while ($DbRow = $DbResult->fetch_assoc())689 while ($DbRow = $DbResult->fetch_assoc()) 690 690 { 691 691 $UnionItems[] = 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('. … … 721 721 $Translated = 0; 722 722 $Total = 0; 723 if (count($UnionItems) > 0)723 if (count($UnionItems) > 0) 724 724 { 725 725 $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()) 727 727 { 728 728 $Output .= '<tr><td>'.T($Group['Name']).'</td><td>'.$Group['Translated'].'</td><td>'.$Group['Total'].'</td><td>'.ProgressBar(150, $Group['Percent']).'</td></tr>'; … … 731 731 } 732 732 } 733 if ($Total > 0) $Percent = $Translated / $Total * 100;733 if ($Total > 0) $Percent = $Translated / $Total * 100; 734 734 else $Percent = 100; 735 735 … … 737 737 $Output .= '</table>'; 738 738 } 739 return ($Output);739 return $Output; 740 740 } 741 741 … … 743 743 { 744 744 $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'])) 746 746 { 747 747 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 748 if ($DbResult->num_rows > 0)748 if ($DbResult->num_rows > 0) 749 749 { 750 750 $Export = $DbResult->fetch_assoc(); … … 759 759 T('Statistic'), T('Output'))); 760 760 $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(); 769 769 else $Output .= $this->ExportViewGeneral(); 770 770 … … 772 772 } else $Output .= ShowMessage(T('Export not found.'), MESSAGE_CRITICAL); 773 773 } else $Output .= ShowMessage(T('Is isn\'t select'), MESSAGE_CRITICAL); 774 return ($Output);774 return $Output; 775 775 } 776 776 777 777 function ExportClone() 778 778 { 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'])) 782 782 { 783 783 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id); 784 784 $DbRow = $DbResult->fetch_row(); 785 if ($DbRow[0] < $this->System->Config['MaxExportPerUser'])785 if ($DbRow[0] < $this->System->Config['MaxExportPerUser']) 786 786 { 787 787 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 788 if ($DbResult->num_rows > 0)788 if ($DbResult->num_rows > 0) 789 789 { 790 790 $DbRow = $DbResult->fetch_assoc(); … … 810 810 } else $Output = ShowMessage(T('Export not found.'), MESSAGE_CRITICAL); 811 811 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 812 return ($Output);812 return $Output; 813 813 } 814 814 … … 816 816 { 817 817 $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(); 825 825 else $Output = $this->ExportList(); 826 826 } else $Output = $this->ExportList(); 827 return ($Output);827 return $Output; 828 828 } 829 829 } … … 839 839 function Show() 840 840 { 841 if (array_key_exists('i', $_GET))841 if (array_key_exists('i', $_GET)) 842 842 $Output = $this->System->ModuleManager->Modules['Export']->GetTaskProgress($_GET['i'] * 1); 843 843 else $Output = 'Missing task id'; 844 return ($Output);844 return $Output; 845 845 } 846 846 } -
trunk/Modules/Export/ProcessAoWoWExport.php
r848 r880 14 14 $Output = ''; 15 15 16 if (defined('STDIN') == false)16 if (defined('STDIN') == false) 17 17 { 18 18 $Output = T('Access denied'); … … 20 20 } 21 21 22 foreach ($_SERVER['argv'] as $parameter)22 foreach ($_SERVER['argv'] as $parameter) 23 23 { 24 if (strpos($parameter, '=') !== false)24 if (strpos($parameter, '=') !== false) 25 25 { 26 26 $index = substr($parameter, 0, strpos($parameter, '=')); … … 33 33 echo 'Generuji Export:'; 34 34 $Export = new Export($System); 35 if (!array_key_exists('AoWoWExportId', $Config)) {35 if (!array_key_exists('AoWoWExportId', $Config)) { 36 36 $Export->Id = $Config['AoWoWExportId']; 37 37 } else $Export->Id = 37; … … 45 45 $UserSelection = array(); 46 46 $DbResult = $System->Database->query('SELECT `ID`, `XP` FROM `User`'); 47 while ($DbRow = $DbResult->fetch_assoc())47 while ($DbRow = $DbResult->fetch_assoc()) 48 48 { 49 49 $UserSelection[$DbRow['ID']] = $DbRow['XP']; … … 53 53 // Update export user selection sequence 54 54 $Sequence = 1; 55 foreach ($UserSelection as $ID => $XP)55 foreach ($UserSelection as $ID => $XP) 56 56 { 57 57 $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) 59 59 $Query = 'UPDATE `ExportUser` SET `Sequence` = '.$Sequence.' WHERE `Export` = '.$Config['AoWoWExportId'].' AND `User` = '.$ID; 60 60 else $Query = 'INSERT INTO `ExportUser` (`Export`, `User`, `Sequence`) VALUES ('.$Config['AoWoWExportId'].', '.$ID.', '.$Sequence.')'; … … 70 70 $Database2->query('SET NAMES '.$Config['Database']['Charset']); 71 71 $Database2->select_db($Config['Database']['DatabaseAoWoW']); 72 foreach ($SQL as $Line)72 foreach ($SQL as $Line) 73 73 { 74 74 //echo '.'; 75 75 //echo($Line."\n"); 76 if (trim($Line) != '') $Database2->query($Line);76 if (trim($Line) != '') $Database2->query($Line); 77 77 } 78 78 echo 'Hotovo … … 83 83 // Delete temporary cache files 84 84 $Files = scandir(dirname(__FILE__).'/../../aowow/cache/mangos'); 85 foreach ($Files as $File)85 foreach ($Files as $File) 86 86 { 87 87 $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); 89 89 } 90 90 $Files = scandir(dirname(__FILE__).'/../../aowow/cache/templates/wowhead'); 91 foreach ($Files as $File)91 foreach ($Files as $File) 92 92 { 93 93 $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); 95 95 } 96 96 echo 'Hotovo -
trunk/Modules/Export/ProcessTask.php
r869 r880 23 23 function DeleteOldFiles($deldir) 24 24 { 25 if (file_exists($deldir.'/'))25 if (file_exists($deldir.'/')) 26 26 { 27 27 $Dir = opendir($deldir.'/') ; 28 while (($File = readdir($Dir)) !== false)28 while (($File = readdir($Dir)) !== false) 29 29 { 30 if (($File != '..') and ($File != '.') and (!is_dir($File))) unlink($deldir.'/'.$File);30 if (($File != '..') and ($File != '.') and (!is_dir($File))) unlink($deldir.'/'.$File); 31 31 } 32 32 closedir($Dir); … … 56 56 function MPQPack($packdir) 57 57 { 58 if (file_exists($packdir.DIRECTORY_SEPARATOR))58 if (file_exists($packdir.DIRECTORY_SEPARATOR)) 59 59 { 60 60 $Dir = opendir($packdir.DIRECTORY_SEPARATOR); 61 while (($File = readdir($Dir)) !== false)61 while (($File = readdir($Dir)) !== false) 62 62 { 63 if (($File != '..') and ($File != '.')) {63 if (($File != '..') and ($File != '.')) { 64 64 $File = str_replace('/', DIRECTORY_SEPARATOR, $File); 65 65 $InDir = ''; … … 109 109 // Delete old files 110 110 $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'); 112 112 113 113 $this->SetProgress(20); 114 if (function_exists('gzcompress'))114 if (function_exists('gzcompress')) 115 115 { 116 116 $Export->ExportToDBC(); … … 185 185 global $Config; 186 186 187 while (1)187 while (1) 188 188 { 189 189 $DbResult = $this->Database->query('SELECT `ExportTask`.`Id`, `ExportTask`.`Export`, '. … … 191 191 'LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` WHERE '. 192 192 '(`ExportTask`.`TimeFinish` IS NULL) ORDER BY `TimeQueued`'); 193 while ($Task = $DbResult->fetch_assoc())193 while ($Task = $DbResult->fetch_assoc()) 194 194 { 195 195 $this->Id = $Task['Id']; 196 if ($Task['ExportId'] != '')196 if ($Task['ExportId'] != '') 197 197 { 198 198 try … … 201 201 $this->Database->update('ExportTask', '`Id`='.$this->Id, array('TimeStart' => 'NOW()')); 202 202 203 if ($Task['ExportOutput'] == 9)203 if ($Task['ExportOutput'] == 9) 204 204 { 205 205 $this->ExportDBC($Task); 206 206 } else 207 if ($Task['ExportOutput'] == 10)207 if ($Task['ExportOutput'] == 10) 208 208 { 209 209 $this->ExportEXE($Task); -
trunk/Modules/Export/cmdmpqexport.php
r867 r880 17 17 $Output = ''; 18 18 19 if (defined('STDIN') == false)19 if (defined('STDIN') == false) 20 20 { 21 21 $Output = T('Access denied'); … … 23 23 } 24 24 25 foreach ($_SERVER['argv'] as $parameter)25 foreach ($_SERVER['argv'] as $parameter) 26 26 { 27 if (strpos($parameter, '=') !== false)27 if (strpos($parameter, '=') !== false) 28 28 { 29 29 $index = substr($parameter, 0, strpos($parameter, '=')); … … 33 33 } else $_GET[$parameter] = ''; 34 34 } 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)) {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)) { 36 36 $Output .= 'Usage type_export=id_export -for export<br />'; 37 37 $Output .= 'Usage ExportId=id_export - for write export info<br />'; … … 43 43 } 44 44 //37 45 if (array_key_exists('lua', $_GET)) {45 if (array_key_exists('lua', $_GET)) { 46 46 $Export = new Export($System); 47 47 $Export->Id = $_GET['lua']; … … 53 53 ',$Output); 54 54 } 55 if (array_key_exists('version', $_GET)) {55 if (array_key_exists('version', $_GET)) { 56 56 $Export = new Export($System); 57 57 $Export->Id = $_GET['version']; … … 63 63 ',$Output); 64 64 } 65 if (array_key_exists('dbc', $_GET)) {65 if (array_key_exists('dbc', $_GET)) { 66 66 $Export = new Export($System); 67 67 $Export->Id = $_GET['dbc']; … … 73 73 ',$Output); 74 74 } 75 if (array_key_exists('addon', $_GET)) {75 if (array_key_exists('addon', $_GET)) { 76 76 $Addon = new ExportAddon($System); 77 77 $Addon->Id = $_GET['addon']; … … 84 84 } 85 85 86 if (array_key_exists('needgeneration', $_GET)) {86 if (array_key_exists('needgeneration', $_GET)) { 87 87 $DbRows = $System->Database->query('SELECT `ClientVersion`.`Version` AS `Version`, '. 88 88 '`Export`.`Id`,`Export`.`ClientVersion`,`Export`.`OutputType`,`Export`.`Title`,'. … … 96 96 if ($Export->NeedGeneration()) { 97 97 $DbResult = $System->Database->query('SELECT * FROM `ExportTask` WHERE `Export` = '.$Export->Id); 98 if ($DbResult->num_rows == 0)98 if ($DbResult->num_rows == 0) 99 99 { 100 100 $System->Database->query('INSERT INTO `ExportTask` (`Export` ,`TimeStart` ) VALUES ('.$Export->Id.', NOW())'); … … 114 114 } 115 115 116 if (array_key_exists('ExportId', $_GET)) {116 if (array_key_exists('ExportId', $_GET)) { 117 117 $Export = new Export($System); 118 118 $Export->Id = $_GET['ExportId'];
Note:
See TracChangeset
for help on using the changeset viewer.