Changeset 816 for trunk/Modules/Export
- Timestamp:
- Feb 22, 2015, 11:20:50 PM (10 years ago)
- Location:
- trunk/Modules/Export
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Export/CreateAddon.php
r788 r816 5 5 class ExportAddon extends Export 6 6 { 7 7 8 8 // Replace special codes by lua functions 9 9 function ReplaceVarInText($string, $strlower = 'strlower') 10 10 { 11 11 12 12 $string = str_replace('$N', '"..'.$strlower.'(UnitName("player")).."', $string); 13 13 $string = str_replace('$n', '"..'.$strlower.'(UnitName("player")).."', $string); … … 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)); … … 28 28 $Woman = str_replace(' ', '', $Woman); 29 29 $string = $Before.'"..gsub(gsub(UnitSex("player"), "^2$", "'.$Man.'"), "^3$", "'.$Woman.'").."'.$After; 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)); … … 41 41 $Woman = str_replace(' ', '', $Woman); 42 42 $string = $Before.'"..gsub(gsub(UnitSex("player"), "^2$", "'.$Man.'"),"^3$", "'.$Woman.'").."'.$After; 43 } 43 } 44 44 45 45 $string = str_replace('$', '', $string); 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 … … 53 53 // $string = mysql_escape_string($string); 54 54 $string = strtolower($string); 55 55 56 56 $string = str_replace('"', '\"', $string); 57 $string = str_replace('$b$b', ' ', $string); 58 $string = str_replace('$b $b', ' ', $string); 59 $string = str_replace('$b', ' ', $string); 60 $string = $this->ReplaceVarInText($string); 57 $string = str_replace('$b$b', ' ', $string); 58 $string = str_replace('$b $b', ' ', $string); 59 $string = str_replace('$b', ' ', $string); 60 $string = $this->ReplaceVarInText($string); 61 61 $string = str_replace("\r", ' ', $string); 62 62 $string = str_replace("\n", ' ', $string); … … 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 68 return($string); … … 73 73 $string = $this->Database->real_escape_string($string); 74 74 $string = str_replace('$B', '\r\n', $string); 75 $string = str_replace('$b', '\r\n', $string); 75 $string = str_replace('$b', '\r\n', $string); 76 76 $string = $this->ReplaceVarInText($string,''); 77 77 return($string); … … 104 104 { 105 105 global $TranslationTree, $CreatedFileList; 106 106 107 107 $Output = ''; 108 108 $this->LoadFilters(); 109 109 110 110 $CreatedFileList = array(); 111 111 $CreatedFileListCount = array(); 112 112 113 113 if(!file_exists($this->TempDir.'CzWoW/')) mkdir($this->TempDir.'CzWoW/', 0777, true); 114 114 115 115 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id.' AND `Group`.`TablePrefix` != ""'); 116 116 while($Group = $DbResult->fetch_assoc()) 117 117 { 118 118 //získání čísla verze pro export 119 $ID = $this->Database->query('SELECT LastVersion FROM `Group` WHERE Id = '.$Group['Id']); 119 $ID = $this->Database->query('SELECT LastVersion FROM `Group` WHERE Id = '.$Group['Id']); 120 120 $LastVersion = $ID->fetch_assoc(); 121 121 122 122 if ($LastVersion['LastVersion'] < $this->ClientVersion['BuildNumber']) 123 123 $ExportVersion = $LastVersion['LastVersion']; … … 125 125 126 126 foreach($TranslationTree[$Group['Id']]['Items'] as $Column) 127 if($Column['AddonFileName'] != '') 127 if($Column['AddonFileName'] != '') 128 128 { 129 129 $this->AddProgress(1); 130 if(!isset($CreatedFileListCount[$Column['AddonFileName']])) 130 if(!isset($CreatedFileListCount[$Column['AddonFileName']])) 131 131 $CreatedFileListCount[$Column['AddonFileName']] = 0; 132 132 $CreatedFileListCount[$Column['AddonFileName']]++; 133 133 $FileIndex = $CreatedFileListCount[$Column['AddonFileName']]; 134 134 135 135 $CreatedFileList[] = $Column['AddonFileName'].'_'.$FileIndex; 136 $FileName = $this->TempDir.'CzWoW/'.$Column['AddonFileName'].'_'.$FileIndex.'.lua'; 136 $FileName = $this->TempDir.'CzWoW/'.$Column['AddonFileName'].'_'.$FileIndex.'.lua'; 137 137 $Output .= $Column['AddonFileName'].': '; 138 138 $i = 0; … … 140 140 $Buffer = 'CZWOW_'.$Column['AddonFileName'].'_count='.$FileIndex.';CZWOW_'.$Column['AddonFileName'].'_'.$FileIndex.'={'; 141 141 $TableTexts = array(); 142 142 143 143 //old version 144 144 //get version before … … 146 146 if ($ExportVersion == '') $BuildNumber = $this->ClientVersion['BuildNumber']; 147 147 $ID = $this->Database->query('SELECT `BuildNumber` FROM `ClientVersion` WHERE '. 148 ' `Imported` = 1 AND `BuildNumber` < '.$BuildNumber.' ORDER BY `BuildNumber` DESC LIMIT 1'); 149 if($ID->num_rows > 0) { 148 ' `Imported` = 1 AND `BuildNumber` < '.$BuildNumber.' ORDER BY `BuildNumber` DESC LIMIT 1'); 149 if($ID->num_rows > 0) { 150 150 $ExportVersionOld = $ID->fetch_assoc(); 151 151 $ExportVersionOld = $ExportVersionOld['BuildNumber']; 152 153 $DbResult2 = $this->Database->query($this->BuildQuery($Group,$ExportVersionOld)); 154 while($Line = $DbResult2->fetch_assoc()) 152 153 $DbResult2 = $this->Database->query($this->BuildQuery($Group,$ExportVersionOld)); 154 while($Line = $DbResult2->fetch_assoc()) 155 155 { 156 $en = trim($this->ReplaceEnText($Line['En'.$Column['Column']])); 156 $en = trim($this->ReplaceEnText($Line['En'.$Column['Column']])); 157 157 $cz = $this->ReplaceCzText($Line[$Column['Column']]); 158 if(($en <> '') and ($cz <> '') and ($this->NotCancel($en))) 158 if(($en <> '') and ($cz <> '') and ($this->NotCancel($en))) 159 159 { 160 $TableTexts[$en] = $cz; 160 $TableTexts[$en] = $cz; 161 161 } 162 162 } 163 163 } 164 164 //last version 165 166 $DbResult2 = $this->Database->query($this->BuildQuery($Group,$ExportVersion)); 167 while($Line = $DbResult2->fetch_assoc()) 165 166 $DbResult2 = $this->Database->query($this->BuildQuery($Group,$ExportVersion)); 167 while($Line = $DbResult2->fetch_assoc()) 168 168 { 169 $en = trim($this->ReplaceEnText($Line['En'.$Column['Column']])); 169 $en = trim($this->ReplaceEnText($Line['En'.$Column['Column']])); 170 170 $cz = $this->ReplaceCzText($Line[$Column['Column']]); 171 if(($en <> '') and ($cz <> '') and ($this->NotCancel($en))) 171 if(($en <> '') and ($cz <> '') and ($this->NotCancel($en))) 172 172 { 173 $TableTexts[$en] = $cz; 173 $TableTexts[$en] = $cz; 174 174 } 175 175 } 176 176 177 177 foreach($TableTexts as $key => $value) { 178 178 $Buffer .= "\n".'["'.$key.'"]="'.$value.'",'; 179 179 $i++; 180 180 } 181 182 181 182 183 183 $Buffer = $Buffer."\n};if not CZWOW_".$Column['AddonFileName']." then CZWOW_".$Column['AddonFileName']."=0; end; CZWOW_".$Column['AddonFileName']."=CZWOW_".$Column['AddonFileName']."+".$i.";\n"; 184 184 … … 193 193 $Buffer = ''; 194 194 foreach($CreatedFileList as $CreatedFile) 195 $Buffer .= 'CZWOW_'.str_replace('_','_count=',$CreatedFile).';'."\n"; 195 $Buffer .= 'CZWOW_'.str_replace('_','_count=',$CreatedFile).';'."\n"; 196 196 foreach($TranslationTree as $Group) 197 197 foreach($TranslationTree[$Group['Id']]['Items'] as $Column) 198 if (($Column['AddonFileName'] != '') and (!in_array($Column['AddonFileName'].'_1', $CreatedFileList))) 198 if (($Column['AddonFileName'] != '') and (!in_array($Column['AddonFileName'].'_1', $CreatedFileList))) 199 199 { 200 $Buffer .= 'CZWOW_'.$Column['AddonFileName'].'_count=0;'."\n"; 201 } 202 200 $Buffer .= 'CZWOW_'.$Column['AddonFileName'].'_count=0;'."\n"; 201 } 202 203 203 file_put_contents($this->TempDir.'CzWoW/'.$CountFiles, $Buffer); 204 205 204 205 206 206 // Generate file Translates.xml 207 207 $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"; … … 218 218 { 219 219 global $TranslationTree; 220 220 221 221 $this->LoadFilters(); 222 222 223 223 $Buffer = "local f=function(name, en, cz) CzWoW_interface[name]=cz;CzWoW_interface_entoname[en]=name; end; CzWoW_interface={};CzWoW_interface_entoname={ };\n"; 224 224 $Group = $TranslationTree[14]; // client table 225 225 $Column['Column'] = 'Text'; 226 226 227 227 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id.' AND `Group`.`TablePrefix` != "" AND `Group`.`Id` = 14'); 228 228 //$Group = $DbResult->fetch_assoc(); … … 231 231 else 232 232 $CanGenerated = ''; 233 233 234 234 $DbResult = $this->Database->query($this->BuildQuery($Group,$CanGenerated)); 235 while($Line = $DbResult->fetch_array()) 235 while($Line = $DbResult->fetch_array()) 236 236 { 237 237 $Original = $this->my_trim($Line['En'.$Column['Column']]); 238 238 $Translated = $this->my_trim($Line[$Column['Column']]); 239 if($this->ClientVersion['Version'] == '2.4.3') 239 if($this->ClientVersion['Version'] == '2.4.3') 240 240 { 241 241 $Original = str_replace("|Hchannel:%d|h[%s]|h", '[%s]', $Original); … … 265 265 $Buffer = ' 266 266 Čeština pro klienty: 267 Vytvořeno v projektu http://wowpreklad.zdechov.net/ 267 Vytvořeno v projektu http://wowpreklad.zdechov.net/ 268 268 Obsahuje Fonty pro správné zobrazování českých znaků, WoW addon překládající 269 269 texty 270 270 271 271 Instalace: 272 272 Soubory rozbalte/zkopírujte do kořenové složky s hrou. Obvikle bývá 273 273 "C:/Program Files/World of Warcraft/". 274 274 275 275 Verze: 276 Verze Addonu: '.$Line['Version'].' 276 Verze Addonu: '.$Line['Version'].' 277 277 Tato verze je pro verzi hry '.$this->ClientVersion['Version'].' 278 278 279 279 Změny ve verzích: 280 280 281 281 '; 282 282 $DbResult = $System->Database->query('SELECT * FROM `CzWoWPackageVersion` ORDER BY `Date` DESC'); 283 while($Line = $DbResult->fetch_assoc()) 283 while($Line = $DbResult->fetch_assoc()) 284 284 { 285 285 $Buffer .=' 286 Verze: '.$Line['Version'].' 286 Verze: '.$Line['Version'].' 287 287 ============= 288 288 '.$Line['text'].' 289 289 290 290 '; 291 291 } -
trunk/Modules/Export/Export.php
r799 r816 13 13 var $TempDir; 14 14 var $SourceDir; 15 15 16 16 function Init() 17 17 { … … 23 23 if(!file_exists($this->SourceDir)) mkdir($this->SourceDir, 0777, true); 24 24 } 25 25 26 26 function SaveAllUsers() { 27 28 29 30 31 32 33 34 35 36 37 //$this->System->Database->query('UPDATE `ExportUser` SET `Sequence`='.$Value.$Condition);38 39 27 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$this->Id); 28 $Export = $DbResult->fetch_assoc(); 29 if ($Export['AllUsers']) { 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()) 32 { 33 $Condition = ' WHERE `Export`='.$this->Id.' AND `User`='.$UserLine['ID']; 34 $DbResult = $this->System->Database->query('SELECT * FROM `ExportUser` '.$Condition); //,MAX(`Sequence`) as MaxSequence 35 if($DbResult->num_rows > 0) 36 { 37 // $this->System->Database->query('UPDATE `ExportUser` SET `Sequence`='.$Value.$Condition); 38 } else 39 { 40 40 $this->System->Database->query('INSERT INTO `ExportUser` (`Export`, `User`, `Sequence`) VALUES ('.$this->Id.', '.$UserLine['ID'].', 0)'); 41 42 43 41 } 42 } 43 44 44 $this->System->Database->query('SET @I = 0'); 45 46 47 } 48 45 $this->System->Database->query('UPDATE `ExportUser` SET `Sequence` = (@I := @I + 1) WHERE `Export`='.$this->Id.' ORDER BY `Sequence`;'); 46 } 47 } 48 49 49 function LoadFilters() 50 { 50 { 51 51 $DbResult = $this->Database->query('SELECT * FROM `Export` WHERE `Id`='.$this->Id); 52 52 if($DbResult->num_rows == 0) throw new Exception('Export '.$this->Id.' neexistuje'); 53 $this->Export = $DbResult->fetch_assoc(); 53 $this->Export = $DbResult->fetch_assoc(); 54 54 55 55 // Filter selected users 56 56 $this->UserNames = ''; 57 57 $DbResult = $this->Database->query('SELECT `ExportUser`.*, `User`.`Name`, `User`.`ID` FROM `ExportUser` '. 58 59 58 'LEFT JOIN `User` ON `User`.`ID`=`ExportUser`.`User` '. 59 'WHERE `ExportUser`.`Export`='.$this->Id.' ORDER BY `ExportUser`.`Sequence`'); 60 60 while($UserLine = $DbResult->fetch_assoc()) 61 61 { 62 62 $this->UserNames .= ', '.$UserLine['Name']; 63 63 } 64 $this->UserNames = substr($this->UserNames, 2); 65 64 $this->UserNames = substr($this->UserNames, 2); 65 66 66 if($this->Export['ClientVersion'] != '') 67 67 { 68 68 $DbResult = $this->Database->query('SELECT * FROM `ClientVersion` WHERE `Id`='.$this->Export['ClientVersion']); 69 69 $this->ClientVersion = $DbResult->fetch_assoc(); 70 } else $this->ClientVersion = ''; 71 } 72 70 } else $this->ClientVersion = ''; 71 } 72 73 73 function BuildQuery($Group, $Version = '') 74 74 { 75 75 global $TranslationTree; 76 76 $this->SaveAllUsers(); 77 78 if ($Version <> '') 77 78 if ($Version <> '') 79 79 $ExportVersion = $Version; 80 80 else 81 81 $ExportVersion = $this->ClientVersion['BuildNumber']; 82 82 83 84 85 86 83 $DbResultItem = $this->System->Database->query('SELECT * FROM `ExportGroupItem` WHERE `Export`='.$this->Id); 84 while($GroupItem = $DbResultItem->fetch_assoc()) 85 { 86 $GroupItems[$GroupItem['GroupItem']] = 1; 87 87 } 88 88 // Build selected columns … … 93 93 // $Columns = substr($Columns, 0, -2); 94 94 95 95 96 96 $Query = 'SELECT * FROM (SELECT '.$Columns.' T.`ID`,T.`Language`,T.`User`,T.`Entry`,T.`VersionEnd`,T.`VersionStart`, `User`.`Name` AS `UserName` FROM `'.$Group['TablePrefix'].'` AS `T`'. 97 97 ' JOIN `ExportUser` ON (`ExportUser`.`User`=`T`.`User`) AND (`ExportUser`.`Export`='.$this->Id.') '. … … 105 105 foreach($TranslationTree[$Group['Id']]['Items'] as $Column) { 106 106 $OriginalColumns .= ' `T3`.`'.$Column['Column'].'` AS `En'.$Column['Column'].'`, '; 107 if (isset($GroupItems[$Column['Id']])) 107 if (isset($GroupItems[$Column['Id']])) 108 108 $OriginalColumns .= ' `T3`.`'.$Column['Column'].'` AS `'.$Column['Column'].'`, '; 109 109 } 110 110 $OriginalColumns = substr($OriginalColumns, 0, -2); 111 111 112 112 // Expand query for loading english texts 113 113 $Query = 'SELECT `T4`.*, '.$OriginalColumns.' FROM ('.$Query.') AS `T4` '. 114 114 ' LEFT JOIN `'.$Group['TablePrefix'].'` AS `T3` ON (`T3`.`Entry` = `T4`.`Entry`) '. 115 115 'AND (`T3`.`Language` = '.$this->System->Config['OriginalLanguage'].') AND '. 116 '(`T3`.`VersionStart` = `T4`.`VersionStart`) AND (`T3`.`VersionEnd` = `T4`.`VersionEnd`)'; 116 '(`T3`.`VersionStart` = `T4`.`VersionStart`) AND (`T3`.`VersionEnd` = `T4`.`VersionEnd`)'; 117 117 118 118 return($Query); 119 119 } 120 120 121 121 function NeedGeneration() 122 122 { … … 130 130 else return(true); 131 131 // echo $file; 132 132 133 133 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '. 134 135 $result = false; 134 'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id); 135 $result = false; 136 136 while($Group = $DbResult->fetch_assoc()) 137 137 { … … 146 146 if ($DbResult2->num_rows > 0) { 147 147 $result = true; 148 } 149 } 148 } 149 } 150 150 return($result); 151 151 } 152 152 153 153 function ExportToMangosSQL() 154 154 { 155 155 global $TranslationTree; 156 156 157 157 $this->LoadFilters(); 158 159 $Buffer = 160 "-- Generováno projektem wowpreklad.zdechov.net\n". 158 159 $Buffer = 160 "-- Generováno projektem wowpreklad.zdechov.net\n". 161 161 "-- ===========================================\n". 162 162 "--\n". … … 168 168 "-- Vzato od uživatelů: ".$this->UserNames."\n". 169 169 "-- Generované tabulky: "; 170 170 171 171 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '. 172 172 'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id); 173 173 while($Group = $DbResult->fetch_assoc()) 174 174 { 175 175 $Buffer .= $Group['TablePrefix'].', '; 176 176 } 177 $Buffer .= "\n\n"; 177 $Buffer .= "\n\n"; 178 178 179 179 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '. 180 180 'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id); 181 181 while($Group = $DbResult->fetch_assoc()) 182 182 { … … 186 186 $DbResult2 = $this->Database->query($this->BuildQuery($Group)); 187 187 if($DbResult2->num_rows > 0) 188 while($Line = $DbResult2->fetch_array()) 188 while($Line = $DbResult2->fetch_array()) 189 189 { 190 190 $Values = ''; … … 199 199 // Get multicolumn index 200 200 $ColumnItems = explode(',', $Group['MangosTableIndex']); 201 if(count($ColumnItems) > 1) 201 if(count($ColumnItems) > 1) 202 202 { 203 203 $Where = 'CONCAT('; … … 206 206 $Where = substr($Where, 0, -7).')'; 207 207 } else $Where = '`'.$Group['MangosTableIndex'].'`'; 208 $Where .= ' = "'.$Line[$Group['PrimaryKeyItem']].'";'; 209 208 $Where .= ' = "'.$Line[$Group['PrimaryKeyItem']].'";'; 209 210 210 $Line = 'UPDATE `'.$Group['MangosTable'].'` SET '.$Values.' WHERE '.$Where; 211 211 $Line = str_replace("\n", '\n', $Line); 212 212 $Line = str_replace("\r", '', $Line); 213 213 $Buffer .= $Line."\n"; 214 } 214 } 215 215 } 216 216 } … … 218 218 return($Buffer); 219 219 } 220 221 function ExportToAoWoWSQL() 220 221 function ExportToAoWoWSQL() 222 222 { 223 223 global $TranslationTree, $AoWoWconf; 224 224 225 225 //require_once('../aowow/configs/config.php'); 226 226 227 227 $Buffer = $this->ExportToMangosSQL(); 228 228 229 229 /* 230 230 // Data to aowow 231 231 $Database2 = new mysqli($this->Config['Database']['Host'], $this->Config['Database']['User'], $this->Config['Database']['Password'], $this->Config['Database']['Database']); 232 232 $Database2->query('SET NAMES '.$this->Config['Database']['Charset']); 233 $Database2->select_db($AoWoWconf['mangos']['db']); 233 $Database2->select_db($AoWoWconf['mangos']['db']); 234 234 $AoWoWTables = array( 235 'aowow_resistances' => 'Id', 236 'aowow_spelldispeltype' => 'Id', 235 'aowow_resistances' => 'Id', 236 'aowow_spelldispeltype' => 'Id', 237 237 'aowow_skill' => 'skillID', 238 238 ); 239 foreach($AoWoWTables as $AoWoWTable => $IndexColum) 239 foreach($AoWoWTables as $AoWoWTable => $IndexColum) 240 240 { 241 241 $Buffer .= '--'.$AoWoWTable.', '; 242 $Buffer .= "\n\n"; 242 $Buffer .= "\n\n"; 243 243 $Query = 'SELECT `name`,`'.$IndexColum.'` FROM `'.$AoWoWTable.'`'; 244 244 $DbResult = $Database2->query($Query); 245 while($Line = $DbResult->fetch_assoc()) 245 while($Line = $DbResult->fetch_assoc()) 246 246 { 247 247 $Ori_text = $Line['name']; … … 253 253 $Tran = $DbResult2->fetch_assoc(); 254 254 //echo ($Line['name'].'='.$Tran['tran']); 255 if($Tran['Tran'] == '') 255 if($Tran['Tran'] == '') 256 256 { 257 257 $DbResult2 = $Database2->query('SELECT `OptionText` AS `En`, … … 263 263 $Tran = $DbResult2->fetch_assoc(); 264 264 } 265 265 266 266 if($Tran['Tran'] <> '') 267 267 $Buffer .= 'UPDATE `'.$AoWoWTable.'` SET `name` = "'.addslashes($Tran['Tran']).'" WHERE '.$IndexColum.' = '.$Line[$IndexColum].' ;'."\n"; 268 268 } 269 $Buffer .= "\n\n"; 269 $Buffer .= "\n\n"; 270 270 } 271 271 */ 272 272 if($this->Export['WithDiacritic'] != 1) $Buffer = utf2ascii($Buffer); 273 273 return($Buffer); 274 } 275 276 function HaveVarible($String1, $String2, $StartChar = '$') 274 } 275 276 function HaveVarible($String1, $String2, $StartChar = '$') 277 277 { 278 278 //Export only if translate have same varible % 279 279 280 280 if (strpos($String1,$StartChar) !== false) { 281 281 282 282 while ( strpos($String1,$StartChar) !== false) { 283 283 $pos = strpos($String1,$StartChar); … … 291 291 // echo $pos.'-'.$varible.'-'.$String1.'-' .$String2.' 292 292 // '; 293 293 294 294 if (false === strpos($String2,$varible)) { 295 // echo $varible; 295 // echo $varible; 296 296 return(false); 297 297 } … … 299 299 } 300 300 return (true); 301 } 301 } 302 302 303 303 function AddProgress($add = 1) { … … 312 312 { 313 313 global $TranslationTree; 314 314 315 315 $this->LoadFilters(); 316 316 317 317 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '. 318 319 318 'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` '. 319 'WHERE `ExportGroup`.`Export`='.$this->Id.' AND `Group`.`DBCFileName` != ""'); 320 320 $Output = 'Počet generovaných skupin: '.$DbResult->num_rows."\n"; 321 321 while($Group = $DbResult->fetch_assoc()) … … 323 323 $this->AddProgress(2); 324 324 $Output .= $Group['Name'].', '; 325 if(file_exists($this->SourceDir.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc')) 325 if(file_exists($this->SourceDir.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc')) 326 326 { 327 327 // Load string column index list 328 328 $DbResult2 = $this->Database->query('SELECT * FROM `GroupItem` '. 329 'JOIN `GroupItemDBC` ON `GroupItem`.`Id` = `GroupItemDBC`.`GroupItem` AND `GroupItemDBC`.`ClientVersion` = '.$this->ClientVersion['Id'].' WHERE `GroupItem`.`Group` = '.$Group['Id']);329 'JOIN `GroupItemDBC` ON `GroupItem`.`Id` = `GroupItemDBC`.`GroupItem` AND `GroupItemDBC`.`ClientVersion` = '.$this->ClientVersion['Id'].' WHERE `GroupItem`.`Group` = '.$Group['Id']); 330 330 $ColumnIndexes = array(); 331 331 $ColumnFormat = array(); … … 347 347 $CanExport = false; 348 348 $Output .= ', NE='.$DbRow['ID']; 349 } 349 } 350 350 if (!$this->HaveVarible($DbRow[$Column['Column']],$DbRow['En'.$Column['Column']])) { 351 351 $CanExport = false; 352 352 $Output .= ', NE='.$DbRow['ID']; 353 } 353 } 354 354 } 355 355 356 356 if ($CanExport) 357 357 $LookupTable[$DbRow[$Group['PrimaryKeyItem']]] = $DbRow; 358 358 359 359 } 360 360 361 361 // Open original DBC file 362 362 $SourceDBCFile = new DBCFile(); 363 363 $SourceDBCFile->OpenFile($this->SourceDir.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc', $ColumnFormat); 364 364 365 365 // Create new DBC file 366 366 if(!file_exists($this->TempDir.'dbc/')) mkdir ($this->TempDir.'dbc/', 0777, true); … … 375 375 $Output .= "\n\r"; 376 376 $RowCount = $SourceDBCFile->GetRecordCount(); 377 $FieldCount = $SourceDBCFile->GetFieldCount(); 377 $FieldCount = $SourceDBCFile->GetFieldCount(); 378 378 for($Row = 0; $Row < $RowCount; $Row++) 379 379 { 380 380 $Line = $SourceDBCFile->GetLine($Row); 381 381 382 382 // Get multicolumn index value 383 383 $PrimaryKeyItem = ''; 384 384 $ColumnItems = explode(',', $Group['DBCIndex']); 385 if(count($ColumnItems) > 1) 385 if(count($ColumnItems) > 1) 386 386 { 387 387 foreach($ColumnItems as $ColumnItem) … … 391 391 392 392 if(array_key_exists($PrimaryKeyItem, $LookupTable)) 393 { 393 { 394 394 // Replace text columns 395 $LookupTableItem = $LookupTable[$PrimaryKeyItem]; 395 $LookupTableItem = $LookupTable[$PrimaryKeyItem]; 396 396 foreach($TranslationTree[$Group['Id']]['Items'] as $GroupItem) 397 { 397 { 398 398 if(array_key_exists($GroupItem['Id'], $ColumnIndexes)) 399 399 $Line[$ColumnIndexes[$GroupItem['Id']]] = $LookupTableItem[$GroupItem['Column']]; … … 401 401 } 402 402 $NewDBCFile->SetLine($Row, $Line); 403 403 404 404 // Show completion progress 405 405 $Progress = round($Row / $RowCount * 100); … … 412 412 $OldProgress = $Progress; 413 413 } 414 } 415 $NewDBCFile->Commit(); 414 } 415 $NewDBCFile->Commit(); 416 416 } else $Output .= ShowMessage('Zdrojový soubor '.$this->SourceDirRelative.$this->ClientVersion['Version'].'/dbc/'.$Group['DBCFileName'].'.dbc'.' nenalezen.'."\n", MESSAGE_CRITICAL); 417 417 } … … 423 423 { 424 424 global $TranslationTree; 425 425 426 426 $this->LoadFilters(); 427 427 … … 440 440 $File2 = new FileStream(); 441 441 $File2->CreateFile($this->TempDir.'lua/'.$Group['LuaFileName'].'.lua'); 442 442 443 443 $LookupTable = array(); 444 444 $DbResult2 = $this->Database->query($this->BuildQuery($Group)); … … 454 454 if ($CanExport) $Output .= ', NE='.$DbRow['ID']; 455 455 $CanExport = false; 456 } 456 } 457 457 if (!$this->HaveVarible($DbRow[$Column['Column']],$DbRow['En'.$Column['Column']])) { 458 458 if ($CanExport) $Output .= ', NE='.$DbRow['ID']; 459 459 $CanExport = false; 460 } 460 } 461 461 if (!$this->HaveVarible($DbRow['En'.$Column['Column']],$DbRow[$Column['Column']],'%')) { 462 462 if ($CanExport) $Output .= ', NE='.$DbRow['ID']; 463 463 $CanExport = false; 464 } 464 } 465 465 if (!$this->HaveVarible($DbRow[$Column['Column']],$DbRow['En'.$Column['Column']],'%')) { 466 466 if ($CanExport) $Output .= ', NE='.$DbRow['ID']; 467 467 $CanExport = false; 468 } 468 } 469 469 if (!$this->HaveVarible($DbRow[$Column['Column']],$DbRow['En'.$Column['Column']],'\\')) { 470 470 if ($CanExport) $Output .= ', NE='.$DbRow['ID']; 471 471 $CanExport = false; 472 } 472 } 473 473 if (!$this->HaveVarible($DbRow['En'.$Column['Column']],$DbRow[$Column['Column']],'\\')) { 474 474 if ($CanExport) $Output .= ', NE='.$DbRow['ID']; … … 478 478 if ($CanExport) $Output .= ', NE='.$DbRow['ID']; 479 479 $CanExport = false; 480 } 480 } 481 481 if (!$this->HaveVarible($DbRow['En'.$Column['Column']],$DbRow[$Column['Column']],'|')) { 482 482 if ($CanExport) $Output .= ', NE='.$DbRow['ID']; … … 486 486 if ($CanExport) $Output .= ', NE='.$DbRow['ID']; 487 487 $CanExport = false; 488 } 488 } 489 489 if (!$this->HaveVarible($DbRow['En'.$Column['Column']],$DbRow[$Column['Column']],chr(10))) { 490 490 if ($CanExport) $Output .= ', NE='.$DbRow['ID']; … … 492 492 } 493 493 } 494 494 495 495 if ($CanExport) 496 496 $LookupTable[$DbRow['ShortCut']] = $DbRow; 497 497 } 498 498 499 499 while(!$File->EOF()) 500 500 { … … 505 505 $Value['ShortCut'] = trim($LineParts[0]); 506 506 $Line = trim($LineParts[1]); 507 507 508 508 if($Line[0] == '"') 509 509 { … … 519 519 // $Value['Text'] = addslashes(stripslashes($Value['Text'])); 520 520 $Line = trim(substr($Line, strpos($TempLine, '"') + 1)); // Skip closing quote and semicolon { 521 } else 521 } else 522 522 { 523 523 // Nonstring value … … 552 552 return($Output); 553 553 } 554 554 555 555 function GetReadme() { 556 556 $_GET['ExportId'] = $this->Id; 557 557 $PageExport = new PageExport($this->System); 558 $this->LoadFilters(); 558 $this->LoadFilters(); 559 559 $Output = ''; 560 560 //generation readme … … 572 572 '<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />'. 573 573 '<title>Čeština pro WoW</title>'. 574 '</head><body>'. 574 '</head><body>'. 575 575 '<h1>České WoW - čestina pro klienta hry World of Warcraft</h1>'. 576 576 577 577 '<table cellspacing="10"><tr><td valign="top">'. 578 578 579 579 '<p>Texty přebírány z projektu <a href="http://wowpreklad.zdechov.net/">wowpreklad.zdechov.net</a><br>'. 580 580 '<a href="http://wowpreklad.zdechov.net/export/?Action=View&ExportId='.$this->Id.'&Tab=0">Export '.$this->Id.'</a></p><br>'. 581 582 581 582 583 583 '<p><strong>Vlastnosti</strong>'. 584 584 '<ul>'. … … 591 591 '</p>'. 592 592 '<br>'. 593 593 594 594 '<h2>Nejčastější otázky</h2>'. 595 '<p><strong>Jak mám vyhledávat věci v aukci nebo výpravy na internetu s nainstalovanou češtinou?</strong><br> 596 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". 595 '<p><strong>Jak mám vyhledávat věci v aukci nebo výpravy na internetu s nainstalovanou češtinou?</strong><br> 596 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". 597 597 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>'. 598 598 599 '<p><strong>Po nainstalování češtiny a spouštění přes soubor WoWlua.exe mi klesl výrazně výkon</strong><br> 600 Problém může být spojen s použitím integrované grafiky místo herní.</p>'. 601 602 '<p><strong>Při spouštění hry přes soubor WoWLua.exe se mi neukládá žádné nastavení addonů a podobně</strong><br> 603 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>'. 604 605 '<p><strong>Po spuštění souboru WoWLua.exe mi píše chybu:</strong><br> 606 Cannot stream required archive data. Please check the network connection. 607 Chyba může být způsobena tím, že jste nenainstalovali češtinu do adresáře se hrou. 608 Nebo jste nainstalovali do jiné verze hry, než je požadovaná. Může se vztahovat i na požadovanou lokalizaci (enUS, enGB)</p>'. 609 610 '<p><strong>Po nainstalování češtiny nemám žádné výpravy (questy) česky</strong><br> 611 Zkontrolujte si v přihlášení, jestli máte povolený addon CzWoW v seznamu addonů.</p>'. 612 613 '<p><strong>Addon mi hlásí spoustu chyb.</strong><br> 614 Chyba může být způsobena kolizí s jinými addony. Vyzkoušejte spuštění hry pouze s addonem CzWoW.</p>'. 615 616 '<p><strong>Ve hře se mi špatně zobrazuje diakritika (háčky, čárky)</strong><br> 617 Chyba je způsobena chybějícími fonty do hry. Potřebné fonty si stáhněte mezi soubory ke stažení.</p>'. 618 619 '<p><strong>Mám nainstalovánu češtinu a nejde mi spustit Wow.exe.</strong><br> 620 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>'. 621 622 '<p><strong>Jak mám hru spustit?</strong><br> 623 Hru musíte spustit přes soubor WowLua.exe v kořenovém adresáři hry.</p>'. 624 625 '<p><strong>Mohu použít tuto češtinu na oficiálních serverech?</strong><br> 599 '<p><strong>Po nainstalování češtiny a spouštění přes soubor WoWlua.exe mi klesl výrazně výkon</strong><br> 600 Problém může být spojen s použitím integrované grafiky místo herní.</p>'. 601 602 '<p><strong>Při spouštění hry přes soubor WoWLua.exe se mi neukládá žádné nastavení addonů a podobně</strong><br> 603 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>'. 604 605 '<p><strong>Po spuštění souboru WoWLua.exe mi píše chybu:</strong><br> 606 Cannot stream required archive data. Please check the network connection. 607 Chyba může být způsobena tím, že jste nenainstalovali češtinu do adresáře se hrou. 608 Nebo jste nainstalovali do jiné verze hry, než je požadovaná. Může se vztahovat i na požadovanou lokalizaci (enUS, enGB)</p>'. 609 610 '<p><strong>Po nainstalování češtiny nemám žádné výpravy (questy) česky</strong><br> 611 Zkontrolujte si v přihlášení, jestli máte povolený addon CzWoW v seznamu addonů.</p>'. 612 613 '<p><strong>Addon mi hlásí spoustu chyb.</strong><br> 614 Chyba může být způsobena kolizí s jinými addony. Vyzkoušejte spuštění hry pouze s addonem CzWoW.</p>'. 615 616 '<p><strong>Ve hře se mi špatně zobrazuje diakritika (háčky, čárky)</strong><br> 617 Chyba je způsobena chybějícími fonty do hry. Potřebné fonty si stáhněte mezi soubory ke stažení.</p>'. 618 619 '<p><strong>Mám nainstalovánu češtinu a nejde mi spustit Wow.exe.</strong><br> 620 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>'. 621 622 '<p><strong>Jak mám hru spustit?</strong><br> 623 Hru musíte spustit přes soubor WowLua.exe v kořenovém adresáři hry.</p>'. 624 625 '<p><strong>Mohu použít tuto češtinu na oficiálních serverech?</strong><br> 626 626 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>'. 627 627 628 628 '</td><td>'; 629 629 … … 631 631 632 632 $Output .= '</td></tr></table>'. 633 634 633 634 635 635 '</body></html>'; 636 636 return $Output; 637 } 638 637 } 638 639 639 function ExportToXML() 640 640 { 641 641 global $TranslationTree; 642 642 643 643 $this->LoadFilters(); 644 644 … … 653 653 foreach(explode(',', $this->UserNames) as $UserName) 654 654 $Buffer .= " <user>".$UserName."</user>\n"; 655 $Buffer .= 655 $Buffer .= 656 656 " </contributors>\n". 657 657 " </meta>\n". … … 659 659 660 660 $DbResult = $this->Database->query('SELECT `Group`.* FROM `ExportGroup` '. 661 661 'JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$this->Id); 662 662 while($Group = $DbResult->fetch_assoc()) 663 663 { … … 669 669 $Buffer .= ' <group id="'.$Group['Id'].'" name="'.$Group['TablePrefix'].'">'."\n"; 670 670 $DbResult2 = $this->Database->query($this->BuildQuery($Group)); 671 while($Line = $DbResult2->fetch_assoc()) 671 while($Line = $DbResult2->fetch_assoc()) 672 672 { 673 673 $Buffer .= ' <item id="'.$Line['Entry'].'" user="'.$Line['UserName'].'">'."\n"; … … 681 681 } 682 682 $Buffer .= " </item>\n"; 683 } 683 } 684 684 $Buffer .= " </group>\n"; 685 685 } … … 688 688 "</document>"; 689 689 return($Buffer); 690 } 690 } 691 691 } 692 692 … … 706 706 $this->Dependencies = array(); 707 707 } 708 708 709 709 function Start() 710 710 { 711 712 713 714 715 716 717 711 $this->System->RegisterPage('export', 'PageExport'); 712 $this->System->RegisterMenuItem(array( 713 'Title' => 'Exporty', 714 'Hint' => 'Zde si můžete stáhnout přeložené texty', 715 'Link' => $this->System->Link('/export/'), 716 'Permission' => LICENCE_ANONYMOUS, 717 'Icon' => '', 718 718 ), 2); 719 719 } -
trunk/Modules/Export/ExportOutput.php
r743 r816 17 17 //echo($Path.$FileName.'<br />'); 18 18 if(is_dir($Path.$FileName)) CreateZipFromDir($Zip, $Path.$FileName.'/', $ZipPath.$FileName.'/'); 19 else $Zip->addFile(file_get_contents($Path.$FileName), $ZipPath.$FileName); 20 } 19 else $Zip->addFile(file_get_contents($Path.$FileName), $ZipPath.$FileName); 20 } 21 21 } 22 22 } … … 25 25 { 26 26 global $System, $Config; 27 28 $Output = ''; 29 $Export = new Export($System); 30 $Export->Id = $ExportId; 31 $Export->Init(); 32 if(function_exists('gzcompress')) 27 28 $Output = ''; 29 $Export = new Export($System); 30 $Export->Id = $ExportId; 31 $Export->Init(); 32 if(function_exists('gzcompress')) 33 33 { 34 34 $SaveFilename = $Export->TempDir.'CzAoWoW_SQL.zip'; 35 $SQLFilename = 'CzAoWoW_SQL.sql'; 35 $SQLFilename = 'CzAoWoW_SQL.sql'; 36 36 $BufferZip = $Export->ExportToAoWoWSQL(); 37 37 $ZipFile = new zipfile(); … … 43 43 // 'setTimeout("parent.location.href=\''.$SaveFilename.'\'", 3000)'. 44 44 // '</script>'; 45 46 $Output .= 'Pokud nezačalo stahování, soubor by mělo jít stáhnout pomocí tohoto odkazu: '. 45 46 $Output .= 'Pokud nezačalo stahování, soubor by mělo jít stáhnout pomocí tohoto odkazu: '. 47 47 '<a href="'.$System->Link('/'.$Export->TempDirRelative.'CzAoWoW_SQL.zip').'">'.$SQLFilename.'</a><br />'. 48 48 '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.'; … … 53 53 { 54 54 global $System, $Config; 55 56 $Export = new Export($System); 57 $Export->Id = $ExportId; 58 55 56 $Export = new Export($System); 57 $Export->Id = $ExportId; 58 59 59 $Output = 'Vygenerovaný SQL kód: <br /><pre class="SQLCode">'. 60 60 htmlspecialchars($Export->ExportToAoWoWSQL()). … … 66 66 { 67 67 global $System, $Config; 68 69 $Output = ''; 70 $Export = new Export($System); 71 $Export->Id = $ExportId; 72 $Export->Init(); 73 if(function_exists('gzcompress')) 68 69 $Output = ''; 70 $Export = new Export($System); 71 $Export->Id = $ExportId; 72 $Export->Init(); 73 if(function_exists('gzcompress')) 74 74 { 75 75 $SaveFilename = $Export->TempDir.'CzWoW_SQL.zip'; 76 $SQLFilename = 'CzWoW_SQL.sql'; 76 $SQLFilename = 'CzWoW_SQL.sql'; 77 77 $BufferZip = $Export->ExportToMangosSQL(); 78 78 $ZipFile = new zipfile(); … … 84 84 // 'setTimeout("parent.location.href=\''.$SaveFilename.'\'", 3000)'. 85 85 // '</script>'; 86 87 $Output .= 'Pokud nezačalo stahování, soubor by mělo jít stáhnout pomocí tohoto odkazu: '. 86 87 $Output .= 'Pokud nezačalo stahování, soubor by mělo jít stáhnout pomocí tohoto odkazu: '. 88 88 '<a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_SQL.zip').'">'.$SQLFilename.'</a><br />'. 89 89 '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.'; 90 return($Output); 90 return($Output); 91 91 } 92 92 … … 94 94 { 95 95 global $System; 96 96 97 97 $Export = new Export($System); 98 98 $Export->Id = $ExportId; … … 107 107 { 108 108 global $System; 109 110 if(function_exists('gzcompress')) 109 110 if(function_exists('gzcompress')) 111 111 { 112 112 $Addon = new ExportAddon($System); … … 114 114 $Addon->Init(); 115 115 $Output = $Addon->MakeAddon(); 116 116 117 117 $Output .= 'Generování addonu...<br />'; 118 $SaveFilename = $Addon->TempDir.'CzWoW_Addon-'.$Addon->ClientVersion['Version'].'.zip'; 118 $SaveFilename = $Addon->TempDir.'CzWoW_Addon-'.$Addon->ClientVersion['Version'].'.zip'; 119 119 $Zip = new zipfile(); 120 120 CreateZipFromDir($Zip, $Addon->TempDir.'CzWoW/', 'CzWoW/'); 121 $Zip->addFile(file_get_contents(dirname(__FILE__).'/files/'.$Addon->ClientVersion['Version'].'/CzWoW/OptionsFrame.xml'), 'CzWoW/OptionsFrame.xml'); 122 $Zip->addFile(file_get_contents(dirname(__FILE__).'/files/'.$Addon->ClientVersion['Version'].'/CzWoW/CzWoW.xml'), 'CzWoW/CzWoW.xml'); 123 $Zip->addFile(file_get_contents(dirname(__FILE__).'/files/'.$Addon->ClientVersion['Version'].'/CzWoW/CzWoW.toc'), 'CzWoW/CzWoW.toc'); 124 $Zip->addFile(file_get_contents(dirname(__FILE__).'/files/'.$Addon->ClientVersion['Version'].'/CzWoW/CzWoW.lua'), 'CzWoW/CzWoW.lua'); 125 $Zip->addFile(file_get_contents(dirname(__FILE__).'/files/'.$Addon->ClientVersion['Version'].'/CzWoW/GameMenuFrame.xml'), 'CzWoW/GameMenuFrame.xml'); 126 $Zip->addFile(file_get_contents(dirname(__FILE__).'/files/'.$Addon->ClientVersion['Version'].'/CzWoW/Localization.lua'), 'CzWoW/Localization.lua'); 121 $Zip->addFile(file_get_contents(dirname(__FILE__).'/files/'.$Addon->ClientVersion['Version'].'/CzWoW/OptionsFrame.xml'), 'CzWoW/OptionsFrame.xml'); 122 $Zip->addFile(file_get_contents(dirname(__FILE__).'/files/'.$Addon->ClientVersion['Version'].'/CzWoW/CzWoW.xml'), 'CzWoW/CzWoW.xml'); 123 $Zip->addFile(file_get_contents(dirname(__FILE__).'/files/'.$Addon->ClientVersion['Version'].'/CzWoW/CzWoW.toc'), 'CzWoW/CzWoW.toc'); 124 $Zip->addFile(file_get_contents(dirname(__FILE__).'/files/'.$Addon->ClientVersion['Version'].'/CzWoW/CzWoW.lua'), 'CzWoW/CzWoW.lua'); 125 $Zip->addFile(file_get_contents(dirname(__FILE__).'/files/'.$Addon->ClientVersion['Version'].'/CzWoW/GameMenuFrame.xml'), 'CzWoW/GameMenuFrame.xml'); 126 $Zip->addFile(file_get_contents(dirname(__FILE__).'/files/'.$Addon->ClientVersion['Version'].'/CzWoW/Localization.lua'), 'CzWoW/Localization.lua'); 127 127 $Buffer = $Zip->file(); 128 128 file_put_contents($SaveFilename, $Buffer); … … 132 132 // 'setTimeout("parent.location.href=\''.$SaveFilename.'\'", 3000)'. 133 133 // '</script>'; 134 135 $Output .= 'Soubor ke stažení: '. 134 135 $Output .= 'Soubor ke stažení: '. 136 136 '<a href="'.$System->Link('/'.$Addon->TempDirRelative.'CzWoW_Addon-'.$Addon->ClientVersion['Version'].'.zip').'">CzWoW_Addon-'.$Addon->ClientVersion['Version'].'.zip</a><br />'. 137 137 '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.'; … … 143 143 { 144 144 global $Config, $System; 145 146 $Output = ''; 147 $Export = new Export($System); 148 $Export->Id = $ExportId; 149 $Export->Init(); 150 if(function_exists('gzcompress')) 145 146 $Output = ''; 147 $Export = new Export($System); 148 $Export->Id = $ExportId; 149 $Export->Init(); 150 if(function_exists('gzcompress')) 151 151 { 152 152 $SaveFilename = $Export->TempDir.'CzWoW_XML.zip'; 153 $SQLFilename = 'CzWoW_XML.sql'; 153 $SQLFilename = 'CzWoW_XML.sql'; 154 154 $BufferZip = $Export->ExportToXML(); 155 155 $ZipFile = new zipfile(); … … 161 161 // 'setTimeout("parent.location.href=\''.$SaveFilename.'\'", 3000)'. 162 162 // '</script>'; 163 164 $Output .= 'Pokud nezačalo stahování, soubor by mělo jít stáhnout pomocí tohoto odkazu: '. 163 164 $Output .= 'Pokud nezačalo stahování, soubor by mělo jít stáhnout pomocí tohoto odkazu: '. 165 165 '<a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_XML.zip').'">CzWoW_SQL.zip</a><br />'. 166 166 '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.'; … … 171 171 { 172 172 global $System; 173 173 174 174 $Export = new Export($System); 175 175 $Export->Id = $ExportId; … … 188 188 $Export->Id = $ExportId; 189 189 $Export->Init(); 190 190 191 191 $Output = ''; 192 192 if(array_key_exists('Regenerate', $_POST)) … … 199 199 $Output .= '<form action="?Action=View&Tab=7&ExportId='.$ExportId.'" method="post"><input type="submit" name="Regenerate" value="Přegenerovat"/></form><br />'; 200 200 $Output .= 'U DBC souborů export textů funguje jinak, protože generování je náročné, jsou požadavky zařazovány do fronty a postupně zpracovávány.<br />DBC soubory je nutné zabalit do souboru patch-enGB-5.MPQ uvnitř složky "DBFilesClient" a hru spouštět přes upravený spouštěcí soubor. Zabalit je můžete pomocí programu <a href="../download/mpqediten32.zip">Ladik\'s MPQ Editor</a>. Stav vygenerování můžete sledovat na této stránce.<br /><br />'; 201 201 202 202 $DbResult = $System->Database->query('SELECT * FROM ExportTask WHERE Export = '.$ExportId); 203 203 if($DbResult->num_rows == 0) … … 206 206 $System->ModuleManager->Modules['Log']->WriteLog('Zadání úlohy pro vygenerování dbc souboru', LOG_TYPE_DOWNLOAD); 207 207 $System->Database->query('UPDATE `ExportTask` SET `Progress`=0 WHERE `Export`='.$Export->Id); 208 } 209 208 } 209 210 210 $DbResult = $System->Database->query('SELECT * FROM `ExportTask` WHERE `Export` = '.$ExportId); 211 211 $ExportTask = $DbResult->fetch_assoc(); … … 216 216 while($Group = $DbResult->fetch_assoc()) 217 217 { 218 if(file_exists($Export->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc')) 219 218 if(file_exists($Export->TempDir.'dbc/'.$Group['DBCFileName'].'.dbc')) 219 $Output .= '<a href="'.$System->Link('/'.$Export->TempDirRelative.'dbc/'.$Group['DBCFileName'].'.dbc').'">'.$Group['DBCFileName'].'.dbc</a><br/>'; 220 220 } 221 221 } else { 222 222 $Output .= ShowProgress($Export); 223 223 224 } 224 } 225 225 return($Output); 226 226 } … … 232 232 233 233 234 234 $Output .= '<script src="http://code.jquery.com/jquery-latest.js"></script>'. 235 235 '<script>'. 236 236 '$(document).ready(function() {'. … … 241 241 '</script>'; 242 242 243 243 244 244 $Output .= ' <strong><div id="progress"></div></strong><br />'; 245 245 … … 248 248 if($DbResult->num_rows > 0) { 249 249 $System->ModuleManager->Modules['Log']->WriteLog('ProcesTask nepracuje přes 2 hodiny, pravděpodobně nepracuje!', LOG_TYPE_ERROR); 250 250 251 251 } 252 252 return ($Output); … … 256 256 { 257 257 global $System; 258 258 259 259 $Export = new Export($System); 260 260 $Export->Id = $ExportId; … … 272 272 $Output .= '<form action="?Action=View&Tab=7&ExportId='.$ExportId.'" method="post"><input type="submit" name="Regenerate" value="Přegenerovat"/></form><br />'; 273 273 $Output .= 'U souhrné instalace češtiny funguje export textů jinak, protože generování je náročné, jsou požadavky zařazovány do fronty a postupně zpracovávány.<br /><br />'; 274 274 275 275 $DbResult = $System->Database->query('SELECT * FROM ExportTask WHERE Export = '.$ExportId); 276 276 if($DbResult->num_rows == 0) … … 278 278 $System->Database->query('INSERT INTO ExportTask (`Export` ,`TimeStart` ) VALUES ('.$ExportId.', NOW())'); 279 279 $System->ModuleManager->Modules['Log']->WriteLog('Zadání úlohy pro vygenerování dbc souboru', LOG_TYPE_DOWNLOAD); 280 } 281 280 } 281 282 282 $DbResult = $System->Database->query('SELECT * FROM `ExportTask` WHERE `Export` = '.$ExportId); 283 283 $ExportTask = $DbResult->fetch_assoc(); … … 287 287 288 288 } else { 289 289 290 290 $Output .= ShowProgress($Export); 291 291 } … … 296 296 { 297 297 global $System, $Config; 298 299 $Export = new Export($System); 300 $Export->Id = $ExportId; 301 $Export->Init(); 302 303 if(function_exists('gzcompress')) 298 299 $Export = new Export($System); 300 $Export->Id = $ExportId; 301 $Export->Init(); 302 303 if(function_exists('gzcompress')) 304 304 { 305 305 $Output = 'Generování lua souborů...<br />'; 306 306 $Export->ExportToLua(); 307 $SaveFilename = $Export->TempDir.'CzWoW_Lua.zip'; 307 $SaveFilename = $Export->TempDir.'CzWoW_Lua.zip'; 308 308 $ZipFile = new zipfile(); 309 309 CreateZipFromDir($ZipFile, $Export->TempDir.'lua/', ''); … … 315 315 // 'setTimeout("parent.location.href=\''.$SaveFilename.'\'", 3000)'. 316 316 // '</script>'; 317 318 $Output .= '<strong>Soubory:</strong><br/>'. 317 318 $Output .= '<strong>Soubory:</strong><br/>'. 319 319 'Souhrný archív <a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_Lua.zip').'">CzWoW_Lua.zip</a><br />'; 320 320 $DbResult = $System->Database->query('SELECT `Group`.* FROM `ExportGroup` JOIN `Group` ON `Group`.`Id` = `ExportGroup`.`Group` WHERE `ExportGroup`.`Export`='.$Export->Id.' AND `Group`.`LuaFileName` != ""'); -
trunk/Modules/Export/Page.php
r809 r816 14 14 class PageExport extends Page 15 15 { 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 16 function ExportList() 17 { 18 $Output = '<a href="?Action=ViewList">'.T('All').'</a>'; 19 if($this->System->User->Licence(LICENCE_USER)) 20 { 21 $Output .= ' <a href="?Action=ViewList&Filter=Others">Ostatních</a>'. 22 ' <a href="?Action=ViewList&Filter=My">'.T('Mine').'</a>'; 23 } 24 25 if($this->System->User->Licence(LICENCE_USER)) 26 $Output .= '<br/><div style="text-align: center;"><a href="?Action=Create">'.T('Create new export').'</a></div><br/>'; 27 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; 33 } 34 35 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` '.$Filter); 36 $DbRow = $DbResult->fetch_row(); 37 $PageList = GetPageList($DbRow[0]); 38 39 $Output .= '<h3>'.T('List of export').'</h3>'. 40 $PageList['Output']; 41 42 $TableColumns = array( 43 array('Name' => 'TimeCreate', 'Title' => T('Time made')), 44 array('Name' => 'UserName', 'Title' => T('Translator')), 45 array('Name' => 'Title', 'Title' => T('Name od export')), 46 // array('Name' => 'UserCount', 'Title' => 'Vybraných překladatelů'), 47 // array('Name' => 'GroupCount', 'Title' => 'Překladových skupin'), 48 array('Name' => 'OutputType', 'Title' => T('Type of output')), 49 array('Name' => 'ClientVersion', 'Title' => T('Client version')), 50 array('Name' => 'UsedCount', 'Title' => T('Viewed count')), 51 array('Name' => '', 'Title' => T('Action')), 52 ); 53 $Order = GetOrderTableHeader($TableColumns, 'TimeCreate', 1); 54 $Output .= '<table class="BaseTable">'. 55 $Order['Output']; 56 57 $DbResult = $this->System->Database->query('SELECT `User`.`Name` AS `UserName`, `Export`.`Id`, `Export`.`TimeCreate`, `Export`.`Title`, `Export`.`User`, `Export`.`UsedCount`, '. 58 58 '(SELECT Version FROM `ClientVersion` WHERE `ClientVersion`.`Id`=`Export`.`ClientVersion`) AS `ClientVersion`, '. 59 59 '(SELECT Id FROM `ClientVersion` WHERE `ClientVersion`.`Id`=`Export`.`ClientVersion`) AS `ClientVersionId`, '. … … 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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 64 while($Export = $DbResult->fetch_assoc()) 65 { 66 $Action = '<a href="?Action=View&ExportId='.$Export['Id'].'&Tab=0">'.T('View').'</a> '. 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>'; 70 $Output .= '<tr><td>'.HumanDate($Export['TimeCreate']).'</td>'. 71 '<td><a href="'.$this->System->Link('/user.php?user='.$Export['User']).'">'.$Export['UserName'].'</a></td>'. 72 '<td>'.$Export['Title'].'</td>'. 73 '<td>'.$Export['OutputType'].'</td>'. 74 '<td><a href="'.$this->System->Link('/client-version/?action=item&id='.$Export['ClientVersionId']).'">'.$Export['ClientVersion'].'</a></td>'. 75 '<td>'.$Export['UsedCount'].'</td>'. 76 '<td>'.$Action.'</td></tr>'; 77 } 78 $Output .= '</table>'. 79 $PageList['Output']; 80 81 return($Output); 82 } 83 84 function ExportCreate() 85 { 86 if($this->System->User->Licence(LICENCE_USER)) 87 { 88 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id); 89 $DbRow = $DbResult->fetch_row(); 90 if($DbRow[0] < $this->System->Config['MaxExportPerUser']) 91 { 92 $Output = '<form action="?Action=CreateFinish" method="post">'. 93 '<fieldset><legend>'.T('Creation of new export').'</legend>'. 94 '<table><tr><td>'.T('Identification').':</td><td><input type="text" name="Title" /></td></tr>'. 95 '<tr><td>'.T('Description').':</td><td><textarea name="Description" cols="54" rows="10"></textarea></td></tr>'. 96 '<tr><td colspan="2"><input type="submit" value="'.T('Create').'" /></td></tr>'. 97 '</table></fieldset></form>'; 98 } else $Output = ShowMessage(T('You can\'t create another export. Max for one user is').$this->System->Config['MaxExportPerUser'].'.', MESSAGE_CRITICAL); 99 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 100 return($Output); 101 } 102 103 function ExportCreateFinish() 104 { 105 if($this->System->User->Licence(LICENCE_USER)) 106 { 107 if(array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST)) 108 { 109 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id); 110 $DbRow = $DbResult->fetch_row(); 111 if($DbRow[0] < $this->System->Config['MaxExportPerUser']) 112 { 113 $this->System->Database->query('INSERT INTO `Export` (`Title`, `User`, `TimeCreate`, `WithDiacritic`, `Description`) VALUES ("'.$_POST['Title'].'", '.$this->System->User->Id.', NOW(), 1, "'.$_POST['Description'].'")'); 114 $ExportId = $this->System->Database->insert_id; 115 $Output = ShowMessage(T('New export created.<br />Direct link to export').': <a href="?Action=View&ExportId='.$ExportId.'">'.T('here').'</a>'); 116 $this->System->ModuleManager->Modules['Log']->WriteLog(T('New export created').' <a href="'.$this->System->Link('/export/?Action=View&ExportId='.$ExportId).'">'.$ExportId.'</a>.', LOG_TYPE_EXPORT); 117 $_GET['Filter'] = 'my'; 118 $this->ExportList(); 119 } else $Output = ShowMessage(T('You can\'t create another export. Max for one user is').' '.$this->System->Config['MaxExportPerUser'].'.', MESSAGE_CRITICAL); 120 } else $Output = ShowMessage(T('Missing data in form.'), MESSAGE_CRITICAL); 121 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 122 return($Output); 123 } 124 125 function ExportDelete() 126 { 127 if($this->System->User->Licence(LICENCE_USER)) 128 { 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) 131 { 132 $this->System->Database->query('DELETE FROM `ExportGroup` WHERE `Export`='.$_GET['ExportId']); 133 $this->System->Database->query('DELETE FROM `ExportGroupItem` WHERE `Export`='.$_GET['ExportId']); 134 $this->System->Database->query('DELETE FROM `ExportLanguage` WHERE `Export`='.$_GET['ExportId']); 135 $this->System->Database->query('DELETE FROM `ExportTask` WHERE `Export`='.$_GET['ExportId']); 136 $this->System->Database->query('DELETE FROM `ExportUser` WHERE `Export`='.$_GET['ExportId']); 137 $this->System->Database->query('DELETE FROM `Export` WHERE `Id`='.$_GET['ExportId']); 138 DeleteDirectory('../tmp/Export/'.$_GET['ExportId'].'/'); 139 $Output = ShowMessage(T('Export deleted.')); 140 $_GET['Filter'] = 'my'; 141 $this->System->ModuleManager->Modules['Log']->WriteLog('Smazán export '.$_GET['ExportId'], LOG_TYPE_EXPORT); 142 $Output .= $this->ExportList(); 143 } else $Output = ShowMessage(T('Export not found.'), MESSAGE_CRITICAL); 144 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 145 return($Output); 146 } 147 148 function SaveAllUsers() 149 { 150 global $System; 151 $Export = new Export($System); 152 152 $Export->Id = $_GET['ExportId']; 153 153 $Export->SaveAllUsers(); 154 155 } 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 if (array_key_exists('AllUsers', $_POST)) { 154 155 } 156 157 function ExportViewTranslators() 158 { 159 global $TranslationTree; 160 161 $Output = ''; 162 $DisabledInput = array(false => ' disabled="disabled"', true => ''); 163 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 164 $Export = $DbResult->fetch_assoc(); 165 if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true; 166 else $Editable = false; 167 168 if(array_key_exists('Operation', $_POST)) 169 { 170 if($_POST['Operation'] == 'Save') 171 { 172 //print_r($_POST); 173 // Update user selection page 174 foreach($_POST as $Index => $Value) 175 { 176 if(substr($Index, 0, 3) == 'seq') 177 { 178 $UserId = substr($Index, 3) * 1; 179 if(array_key_exists('sel'.$UserId, $_POST)) $Selected = true; 180 else $Selected = false; 181 $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `User`='.$UserId; 182 $DbResult = $this->System->Database->query('SELECT * FROM `ExportUser` '.$Condition); 183 if($DbResult->num_rows > 0) 184 { 185 if(!$Selected) $this->System->Database->query('DELETE FROM `ExportUser` '.$Condition); 186 else $this->System->Database->query('UPDATE `ExportUser` SET `Sequence`='.$Value.$Condition); 187 } else 188 { 189 if($Selected) $this->System->Database->query('INSERT INTO `ExportUser` (`Export`, `User`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$UserId.', '.$Value.')'); 190 } 191 } 192 } 193 194 if (array_key_exists('AllUsers', $_POST)) { 195 195 //add allusers to export 196 197 198 196 $this->System->Database->query('UPDATE `Export` SET `AllUsers`=1 WHERE `Id`='.$_GET['ExportId']); 197 198 //update export stat 199 199 $Export['AllUsers'] = 1; 200 200 $this->SaveAllUsers(); 201 201 } else { 202 202 //update export stat 203 203 $Export['AllUsers'] = 0; 204 204 $this->System->Database->query('UPDATE `Export` SET `AllUsers`=0 WHERE `Id`='.$_GET['ExportId']); 205 205 } 206 206 207 208 209 210 211 212 213 214 215 216 217 218 array('Name' => 'XP', 'Title' => T('Experience')), 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 207 // Recalculate sequence number 208 $this->System->Database->query('SET @I = 0'); 209 $this->System->Database->query('UPDATE `ExportUser` SET `Sequence` = (@I := @I + 1) WHERE `Export`='.$_GET['ExportId'].' ORDER BY `Sequence`;'); 210 $Output .= ShowMessage(T('Select saved.')); 211 } 212 } 213 214 $TableColumns = array( 215 array('Name' => 'Name', 'Title' => T('Name')), 216 array('Name' => 'TranslatedCount', 'Title' => T('Translated count')), 217 array('Name' => 'XP', 'Title' => T('Level')), 218 array('Name' => 'XP', 'Title' => T('Experience')), 219 array('Name' => '', 'Title' => T('Select')), 220 array('Name' => 'Sequence2', 'Title' => T('Order')), 221 ); 222 $Order = GetOrderTableHeader($TableColumns, 'TranslatedCount', 1); 223 if($Order['Column'] != 'Sequence2') $InitialOrder = ', '.substr($Order['SQL'], 10); 224 else $InitialOrder = ''; 225 226 $Query = 'SELECT (@I := @I + 1) AS `Sequence2`, `TT`.* FROM (SELECT `ExportUser`.`Sequence`, `T`.`ID`, `T`.`TranslatedCount`, `T`.`Name`, `T`.`XP` FROM (SELECT `User`.`ID`, `User`.`Name`, `User`.`XP`, `TranslatedCount` FROM `User`) AS T'; 227 $Query .=' LEFT JOIN `ExportUser` ON `ExportUser`.`Export` = '.$_GET['ExportId'].' AND `ExportUser`.`User`=`T`.`ID`'; 228 $Query .=' WHERE `T`.`TranslatedCount` > 0 ORDER BY COALESCE(`ExportUser`.`Sequence`, 100000000)'.$InitialOrder.') AS `TT`'; 229 230 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS `X`'); 231 $DbRow = $DbResult->fetch_row(); 232 $PageList = GetPageList($DbRow[0]); 233 234 $Output .= '<form name="Translators" action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'. 235 '<h3>'.T('Translators').'</h3>'; 236 if($Editable) 237 { 238 $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'. 239 '<input type="hidden" name="Operation" value="Save"/><br />'. 240 ' <span onclick="CheckAllCheckbox();">'.CheckBox('CheckAll', False, 'CheckAll').' '.T('Select all on page').'</span> <br />'. 241 ' <span>'.CheckBox('AllUsers', $Export['AllUsers']).' '.T('Export allways from all users').'</span> '. 242 '<br />'. 243 T('Select users from list which you want to export from. And edit their order.').'<br />'. 244 T('Order is done by numeric value which is can be edit to desirable order. Lines with same number will be renumbered in ascending order.'); 245 } 246 247 $Output .= $PageList['Output']. 248 '<table class="BaseTable">'. 249 $Order['Output']; 250 251 $Query = 'SELECT * FROM ('.$Query.') AS `TX` '.$Order['SQL'].$PageList['SQLLimit']; 252 $this->System->Database->query('SET @I = 0'); 253 $DbResult = $this->System->Database->query($Query); 254 while($UserLine = $DbResult->fetch_assoc()) 255 { 256 $XP = GetLevelMinMax($UserLine['XP']); 257 $Checked = $UserLine['Sequence'] != ''; 258 $Selection = CheckBox('sel'.$UserLine['ID'], $Checked, '', 'CheckBox', ((!$Editable) or ($Export['AllUsers']))); 259 $Sequence = '<input type="text" name="seq'.$UserLine['ID'].'" style="text-align: center; width: 40px;" value="'.$UserLine['Sequence2'].'"'.$DisabledInput[$Editable].'/>'; 260 $Output .= '<tr>'. 261 '<td><a href="'.$this->System->Link('/TranslationList.php?user='.$UserLine['ID'].'&state=2&group=0').'" title="Zobrazit všechny jeho přeložené texty">'.$UserLine['Name'].'</a></td>'. 262 '<td>'.$UserLine['TranslatedCount'].'</td>'. 263 '<td>'.$XP['Level'].'</td>'. 264 '<td>'.ProgressBar(150, round($XP['XP'] / $XP['MaxXP'] * 100, 2), $XP['XP'].' / '.$XP['MaxXP']).'</td>'. 265 '<td>'.$Selection.'</td><td>'.$Sequence.'</td></tr>'; 266 } 267 $Output .= '</table>'. 268 '</form>'. 269 $PageList['Output']; 270 return($Output); 271 } 272 273 function ExportViewGeneral() 274 { 275 $DisabledInput = array(false => ' disabled="disabled"', true => ''); 276 $DisabledTextArea = array(false => ' readonly="yes"', true => ''); 277 $Output = '<h3>Obecná nastavení</h3>'; 278 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 279 $Export = $DbRows->fetch_assoc(); 280 if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true; 281 else $Editable = false; 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; 287 else $WithDiacritic = 0; 288 if (array_key_exists('Featured', $_POST)) $Export['Featured'] = 1; 289 $this->System->Database->query('UPDATE `Export` SET `Title`="'.$_POST['Title'].'", `Featured`='.$Export['Featured'].', `Description`="'.$_POST['Description'].'", `WithDiacritic`='.$WithDiacritic.' WHERE Id='.$Export['Id']); 290 $Export['Title'] = $_POST['Title']; 291 $Export['Description'] = $_POST['Description']; 292 $Export['WithDiacritic'] = $WithDiacritic; 293 $Output .= ShowMessage('Nastavení uloženo.'); 294 } 295 296 if($Export['WithDiacritic'] == 1) $WithDiacritic = ' checked="checked"'; 297 else $WithDiacritic = ''; 298 $Output .= '<form action="?Action=View&Tab=0&ExportId='.$Export['Id'].'" method="post">'. 299 '<table>'; 300 if($this->System->User->Id != null) 301 { 302 $Output .= '<input type="hidden" name="Operation" value="Save"/>'. 303 '<tr><td colspan="2">'; 304 304 if($Editable) $Output .= ' <input type="submit" value="Uložit" '.$DisabledInput[$Editable].'/>'; 305 305 $Output .= ' <a href="?Action=Clone&ExportId='.$Export['Id'].'" onclick="return confirmAction(\''.T('Realy clone item?').'\');">'.T('Clone').'</a> '; 306 306 if($this->System->User->Licence(LICENCE_ADMIN)) 307 307 $Output .= CheckBox('Featured', $Export['Featured'], '', 'CheckBox', !$Editable). ' '.T('Recommended').' '; 308 308 $Output .= '</td></tr>'; 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 foreach($TranslationTree as $Group) 447 448 309 } 310 $Output .= '<tr><td>'.T('Identification').':</td><td><input type="text" style="width: 400px" name="Title" value="'.$Export['Title'].'"'.$DisabledInput[$Editable].'/></td></tr>'. 311 '<tr><td>Popis:</td><td><textarea name="Description" cols="54" rows="10"'.$DisabledTextArea[$Editable].'>'.$Export['Description'].'</textarea></td></tr>'. 312 '<tr><td>'.T('With diacritics').'</td><td><input type="checkbox" name="WithDiacritic" '.$WithDiacritic.''.$DisabledInput[$Editable].'/></td></tr>'. 313 '</table></form>'; 314 return($Output); 315 } 316 317 function ExportViewLanguages() 318 { 319 global $TranslationTree; 320 321 $Output = ''; 322 $DisabledInput = array(false => ' disabled="disabled"', true => ''); 323 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 324 $Export = $DbRows->fetch_assoc(); 325 if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true; 326 else $Editable = false; 327 328 if(array_key_exists('Operation', $_POST)) 329 { 330 if($_POST['Operation'] == 'Save') 331 { 332 //print_r($_POST); 333 // Update user selection page 334 foreach($_POST as $Index => $Value) 335 { 336 if(substr($Index, 0, 3) == 'seq') 337 { 338 $LanguageId = substr($Index, 3) * 1; 339 if(array_key_exists('sel'.$LanguageId, $_POST)) $Selected = true; 340 else $Selected = false; 341 $Condition = ' WHERE Export='.$_GET['ExportId'].' AND `Language`='.$LanguageId; 342 $DbResult = $this->System->Database->query('SELECT * FROM `ExportLanguage` '.$Condition); 343 if($DbResult->num_rows > 0) 344 { 345 if(!$Selected) $this->System->Database->query('DELETE FROM `ExportLanguage` '.$Condition); 346 else $this->System->Database->query('UPDATE `ExportLanguage` SET `Sequence`='.$Value.$Condition); 347 } else 348 { 349 if($Selected) $this->System->Database->query('INSERT INTO `ExportLanguage` (`Export`, `Language`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$LanguageId.', '.$Value.')'); 350 } 351 } 352 } 353 354 // Recalculate sequence number 355 $this->System->Database->query('SET @I = 0'); 356 $this->System->Database->query('UPDATE `ExportLanguage` SET `Sequence` = (@I := @I + 1) WHERE `Export`='.$_GET['ExportId'].' ORDER BY `Sequence`;'); 357 $Output .= ShowMessage('Výběr uložen.'); 358 } 359 } 360 361 $Query = 'SELECT (@I := @I + 1) AS `Sequence2`, `Sequence`, `Language`.`Id`, `Name` FROM `Language`'; 362 $Query .=' LEFT JOIN `ExportLanguage` ON `ExportLanguage`.`Export` = '.$_GET['ExportId'].' AND `ExportLanguage`.`Language`=`Language`.`Id`'; 363 $Query .=' WHERE `Language`.`Enabled` = 1 ORDER BY COALESCE(`Sequence`, 100)'; 364 365 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS X'); 366 $DbRow = $DbResult->fetch_row(); 367 $PageList = GetPageList($DbRow[0]); 368 369 $TableColumns = array( 370 array('Name' => 'Name', 'Title' => T('Name')), 371 array('Name' => '', 'Title' => T('Select')), 372 array('Name' => 'Sequence2', 'Title' => T('Order')), 373 ); 374 $Order = GetOrderTableHeader($TableColumns, 'Sequence2'); 375 $Output .= '<form action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'. 376 '<h3>'.T('Languages').'</h3>'; 377 if($Editable) 378 { 379 $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'. 380 '<input type="hidden" name="Operation" value="Save"/>'. 381 '<br />'. 382 T('Select languades from list witch you want to export from. And edit theirs order.').'<br />'. 383 T('Order is done by numeric value which is can be edit to desirable order. Lines with same number will be renumbered in ascending order.'); 384 } 385 386 $Output .= $PageList['Output']. 387 '<table class="BaseTable">'. 388 $Order['Output']; 389 390 $Query = 'SELECT * FROM ('.$Query.') AS TX '.$Order['SQL'].$PageList['SQLLimit']; 391 $this->System->Database->query('SET @I = 0'); 392 $DbResult = $this->System->Database->query($Query); 393 while($Langugage = $DbResult->fetch_assoc()) 394 { 395 $Checked = $Langugage['Sequence'] != ''; 396 $Selection = CheckBox('sel'.$Langugage['Id'], $Checked, '', 'CheckBox', !$Editable); 397 $Sequence = '<input type="text" name="seq'.$Langugage['Id'].'" style="text-align: center; width: 40px;" value="'.$Langugage['Sequence2'].'"'.$DisabledInput[$Editable].'/>'; 398 $Output .= '<tr> 399 <td>'.$Langugage['Name'].'</td> 400 <td>'.$Selection.'</td><td>'.$Sequence.'</td></tr>'; 401 } 402 $Output .= '</table>'. 403 '</form>'. 404 $PageList['Output']; 405 return($Output); 406 } 407 408 function ExportViewGroups() 409 { 410 global $TranslationTree; 411 412 $Output = ''; 413 $DisabledInput = array(false => ' disabled="disabled"', true => ''); 414 $DbRows = $this->System->Database->query('SELECT * FROM Export WHERE Id='.$_GET['ExportId']); 415 $Export = $DbRows->fetch_assoc(); 416 if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true; 417 else $Editable = false; 418 419 if(array_key_exists('Operation', $_POST)) 420 { 421 if($_POST['Operation'] == 'Save') 422 { 423 //print_r($_POST); 424 // Update user selection page 425 foreach($_POST as $Index => $Value) 426 { 427 if(substr($Index, 0, 3) == 'seq') 428 { 429 $GroupId = substr($Index, 3) * 1; 430 if(array_key_exists('sel'.$GroupId, $_POST)) $Selected = true; 431 else $Selected = false; 432 $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `Group`='.$GroupId; 433 $DbResult = $this->System->Database->query('SELECT * FROM `ExportGroup` '.$Condition); 434 if($DbResult->num_rows > 0) 435 { 436 if(!$Selected) $this->System->Database->query('DELETE FROM `ExportGroup` '.$Condition); 437 } else 438 { 439 if($Selected) $this->System->Database->query('INSERT INTO `ExportGroup` (`Export`, `Group`) VALUES ('.$_GET['ExportId'].', '.$GroupId.')'); 440 } 441 } 442 } 443 $Output .= ShowMessage(T('Select saved.')); 444 } 445 //items 446 foreach($TranslationTree as $Group) 447 { 448 // echo $Group['Id'].' '; 449 449 foreach($TranslationTree[$Group['Id']]['Items'] as $Column) { 450 450 if(array_key_exists('item'.$Column['Id'], $_POST)) $Selected = true; … … 452 452 //we will save only forbitten collums and need to be visible 453 453 $Selected = !$Selected; 454 if (!$Column['Visible']) $Selected = false; 455 456 457 458 459 460 461 462 463 464 454 if (!$Column['Visible']) $Selected = false; 455 456 $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `GroupItem`='.$Column['Id']; 457 $DbResult = $this->System->Database->query('SELECT * FROM `ExportGroupItem` '.$Condition); 458 if($DbResult->num_rows > 0) 459 { 460 if(!$Selected) $this->System->Database->query('DELETE FROM `ExportGroupItem` '.$Condition); 461 } else 462 { 463 if($Selected) $this->System->Database->query('INSERT INTO `ExportGroupItem` (`Export`, `GroupItem`) VALUES ('.$_GET['ExportId'].', '.$Column['Id'].')'); 464 } 465 465 466 466 } 467 467 } 468 469 470 471 472 473 474 475 476 477 478 479 480 //array('Name' => 'DBCFileName', 'Title' => 'DBC soubor'),481 //array('Name' => 'LuaFileName', 'Title' => 'Lua soubor'),482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 } 505 506 507 508 509 468 } 469 470 $Query = 'SELECT `Group`.*, `ExportGroup`.`Id` AS `ExportGroupId` FROM `Group` LEFT JOIN `ExportGroup` ON `ExportGroup`.`Export`='.$_GET['ExportId'].' AND `Group`=`Group`.`Id`'; 471 472 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS X'); 473 $DbRow = $DbResult->fetch_row(); 474 $PageList = GetPageList($DbRow[0]); 475 476 $TableColumns = array( 477 array('Name' => '', 'Title' => T('Select')), 478 array('Name' => 'Name', 'Title' => T('Name')), 479 array('Name' => 'MangosTable', 'Title' => 'Mangos/DBC/Lua'), 480 // array('Name' => 'DBCFileName', 'Title' => 'DBC soubor'), 481 // array('Name' => 'LuaFileName', 'Title' => 'Lua soubor'), 482 array('Name' => '', 'Title' => T('Items of tranlation')), 483 ); 484 $Order = GetOrderTableHeader($TableColumns, 'Name'); 485 $Output .= '<form action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'. 486 '<h3>Překladové skupiny</h3>'; 487 if($Editable) 488 { 489 $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'. 490 '<input type="hidden" name="Operation" value="Save"/>'. 491 ' <span onclick="CheckAllCheckbox();">'.CheckBox('CheckAll', False, 'CheckAll').' '.T('Select all').'</span> '. 492 '<br />'. 493 T('Select translation groups witch you want to export.').'<br />'; 494 } 495 496 $Output .= $PageList['Output']. 497 '<table class="BaseTable">'. 498 $Order['Output']; 499 500 $DbResultItem = $this->System->Database->query('SELECT * FROM `ExportGroupItem` WHERE `Export`='.$_GET['ExportId']); 501 while($GroupItem = $DbResultItem->fetch_assoc()) 502 { 503 $GroupItems[$GroupItem['GroupItem']] = 1; 504 } 505 506 $Query = 'SELECT * FROM ('.$Query.') AS TX '.$Order['SQL'].$PageList['SQLLimit']; 507 $DbResult = $this->System->Database->query($Query); 508 while($Group = $DbResult->fetch_assoc()) 509 { 510 510 $Columns = ''; 511 511 foreach($TranslationTree[$Group['Id']]['Items'] as $Column) { 512 512 if ($Column['Visible']) $Columns .= CheckBox('item'.$Column['Id'], !isset($GroupItems[$Column['Id']]), '', 'CheckBox', !$Editable).' '.$Column['Name'].' <br />'; 513 513 } 514 515 516 517 518 519 520 521 522 523 524 525 526 $Output .= 527 $Output .= $Columns.'</td>';514 $Checked = $Group['ExportGroupId'] != ''; 515 $Selection = CheckBox('sel'.$Group['Id'], $Checked, '', 'CheckBox', !$Editable); 516 $Output .= '<tr>'. 517 '<td>'.$Selection.'<input type="hidden" name="seq'.$Group['Id'].'"/></td>'. 518 '<td>'.$Group['Name'].'</td><td>'; 519 if ($Group['MangosTable'] <> '') 520 $Output .= $Group['MangosTable'].'.sql '; 521 if ($Group['LuaFileName'] <> '') 522 $Output .= $Group['LuaFileName'].'.lua '; 523 if ($Group['DBCFileName'] <> '') 524 $Output .= $Group['DBCFileName'].'.dbc '; 525 526 $Output .= '</td><td>'; 527 $Output .= $Columns. '</td>'; 528 528 $Output .= '</tr>'; 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 if (array_key_exists('Auto', $_GET) == false) 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 $DbRow['User'] = $this->System->User->Id; 788 789 529 } 530 $Output .= '</table>'. 531 '</form>'. 532 $PageList['Output']; 533 return($Output); 534 } 535 536 function ExportViewOutputFormat() 537 { 538 $Output = ''; 539 $DisabledInput = array(false => ' disabled="disabled"', true => ''); 540 if(array_key_exists('ExportId', $_GET)) 541 { 542 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 543 if($DbRows->num_rows > 0) 544 { 545 $Export = $DbRows->fetch_assoc(); 546 if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true; 547 else $Editable = false; 548 549 if(array_key_exists('Operation', $_POST)) 550 if($_POST['Operation'] == 'Save') 551 { 552 if(array_key_exists('OutputType', $_POST) and ($_POST['OutputType'] * 1 > 0)) 553 { 554 $this->System->Database->query('UPDATE Export SET OutputType='.$_POST['OutputType'].' WHERE Id='.$_GET['ExportId']); 555 $Output .= ShowMessage(T('Select saved.')); 556 } else $Output .= ShowMessage(T('Format wasn\'t selected'), MESSAGE_CRITICAL); 557 } 558 559 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 560 $Export = $DbResult->fetch_assoc(); 561 562 $Output .= '<h3>'.T('Format the generated output').'</h3>'. 563 '<form action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'; 564 if($Editable) 565 { 566 $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'. 567 '<input type="hidden" name="Operation" value="Save"/>'. 568 '<br />'; 569 } 570 $DbResult = $this->System->Database->query('SELECT * FROM `ExportOutputType` ORDER BY `Name`'); 571 while($ExportFormat = $DbResult->fetch_assoc()) 572 { 573 $Output .= RadioButton('OutputType', $ExportFormat['Id'], $Export['OutputType'] == $ExportFormat['Id'], '', !$Editable).' '.$ExportFormat['Name'].'<br/>'; 574 } 575 $Output .= '</form>'; 576 } else $Output .= ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 577 } else $Output .= ShowMessage(T('Is isn\'t select'), MESSAGE_CRITICAL); 578 return($Output); 579 } 580 581 function ExportViewVersion() 582 { 583 $Output = ''; 584 $DisabledInput = array(false => ' disabled="disabled"', true => ''); 585 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 586 $Export = $DbRows->fetch_assoc(); 587 if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true; 588 else $Editable = false; 589 590 if(array_key_exists('Operation', $_POST)) 591 if(($_POST['Operation'] == 'Save') and (array_key_exists('ClientVersion', $_POST))) 592 { 593 $this->System->Database->query('UPDATE `Export` SET `ClientVersion`='.$_POST['ClientVersion'].' WHERE `Id`='.$_GET['ExportId']); 594 $Output .= ShowMessage(T('Select saved.')); 595 } 596 597 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 598 $Export = $DbResult->fetch_assoc(); 599 600 if($Export['OutputType'] == '') $Output .= ShowMessage('Nevybrán typ exportu', MESSAGE_CRITICAL); 601 else { 602 $Query = 'SELECT `ClientVersion`.* FROM `ExportVersion` '. 603 'LEFT JOIN `ClientVersion` ON `ClientVersion`.`Id`=`ExportVersion`.`ClientVersion` WHERE `ExportType`='.$Export['OutputType']; 604 605 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS `X`'); 606 $DbRow = $DbResult->fetch_row(); 607 $PageList = GetPageList($DbRow[0]); 608 609 $TableColumns = array( 610 array('Name' => 'Version', 'Title' => T('Version')), 611 array('Name' => 'BuildNumber', 'Title' => T('Build')), 612 array('Name' => 'ReleaseDate', 'Title' => T('Release date')), 613 array('Name' => 'Title', 'Title' => T('Name2')), 614 array('Name' => '', 'Title' => T('Select')), 615 ); 616 $Order = GetOrderTableHeader($TableColumns, 'BuildNumber', 1); 617 $Output .= '<form action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'. 618 '<h3>'.T('Client version').'</h3>'; 619 620 if($Editable) 621 { 622 $Output .= '<input type="submit" value="'.T('Save').'" '.$DisabledInput[$Editable].'/>'. 623 '<input type="hidden" name="Operation" value="Save"/>'. 624 '<br />'. 625 T('Select version of game client witch you want to export.').'<br />'; 626 } 627 $Output .= $PageList['Output']. 628 '<table class="BaseTable">'. 629 $Order['Output']; 630 631 $Query = 'SELECT * FROM ('.$Query.') AS `TX` '.$Order['SQL'].$PageList['SQLLimit']; 632 $DbResult = $this->System->Database->query($Query); 633 while($Version = $DbResult->fetch_assoc()) 634 { 635 $Output .= '<tr><td><a href="'.$this->System->Link('/client-version/?action=item&id='.$Version['Id']).'">'. 636 $Version['Version'].'</a></td><td>'.$Version['BuildNumber'].'</td><td>'. 637 HumanDate($Version['ReleaseDate']).'</td><td>'.$Version['Title'].'</td><td>'. 638 RadioButton('ClientVersion', $Version['Id'], $Export['ClientVersion'] == $Version['Id'], '', !$Editable 639 ).'</td></tr>'; 640 641 } 642 $Output .= '</table>'. 643 '</form>'. 644 $PageList['Output']; 645 } 646 return($Output); 647 } 648 649 function ExportViewOutput() 650 { 651 $Output = ''; 652 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 653 $Export = $DbResult->fetch_assoc(); 654 if($Export['OutputType'] == '') $Output .= ShowMessage('Nevybrán typ exportu', MESSAGE_CRITICAL); 655 else if($Export['ClientVersion'] == '') $Output .= ShowMessage(T('Export don\'t have selected version of client'), MESSAGE_CRITICAL); 656 else { 657 $DbResult = $this->System->Database->query('SELECT * FROM `ExportOutputType` WHERE `Id`='.$Export['OutputType']); 658 if($DbResult->num_rows > 0) 659 { 660 $DbResult = $this->System->Database->query('SELECT * FROM `ExportVersion` WHERE (`ExportType`='.$Export['OutputType'].') AND (`ClientVersion`='.$Export['ClientVersion'].')'); 661 if($DbResult->num_rows > 0) 662 { 663 if (array_key_exists('Auto', $_GET) == false) 664 $this->System->Database->query('UPDATE `Export` SET `UsedCount` = `UsedCount` + 1 WHERE `Id`='.$Export['Id']); 665 $Output = ExportOutput($Export['Id'], $Export['OutputType']); 666 } else $Output = ShowMessage(T('Export don\'t have selected version of client'), MESSAGE_CRITICAL); 667 } else $Output = ShowMessage(T('Format output isn\'t select').'.', MESSAGE_CRITICAL); 668 } 669 return($Output); 670 } 671 672 function ExportViewStat($Where = '') 673 { 674 $Export = new Export($this->System); 675 $Export->Id = $_GET['ExportId']; 676 $Export->Init(); 677 $Export->LoadFilters(); 678 679 if(($Export->Export['ClientVersion'] == '') or ($Export->ClientVersion['BuildNumber'] == '')) 680 $Output = ShowMessage(T('Export don\'t have selected version of client'), MESSAGE_CRITICAL); 681 else { 682 $GroupListQuery = 'SELECT `Group`.* FROM `Group` '. 683 ' JOIN `ExportGroup` ON (`ExportGroup`.`Export`='.$Export->Id.') AND (`ExportGroup`.`Group`=`Group`.`Id`)'; 684 $Query = ''; 685 $UnionItems = array(); 686 $DbResult = $this->System->Database->query($GroupListQuery.$Where); 687 while($DbRow = $DbResult->fetch_assoc()) 688 { 689 $UnionItems[] = 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('. 690 ' SELECT `T`.* FROM `'.$DbRow['TablePrefix'].'` AS `T`'. 691 ' JOIN `ExportUser` ON (`ExportUser`.`User`=`T`.`User`) AND (`ExportUser`.`Export`='.$Export->Id.') '. 692 ' JOIN `ExportLanguage` ON (`ExportLanguage`.`Export`='.$Export->Id.')'. 693 ' WHERE (`Complete` = 1) AND (`VersionStart` <= '.$Export->ClientVersion['BuildNumber'].') AND (`VersionEnd` >= '.$Export->ClientVersion['BuildNumber'].')'. 694 ') AS `C1`) AS `Translated`, '. 695 '(SELECT COUNT(DISTINCT(`Entry`)) FROM ('. 696 ' SELECT `T`.* FROM `'.$DbRow['TablePrefix'].'` AS `T`'. 697 ' WHERE (`Language` = '.$this->System->Config['OriginalLanguage'].') AND (`VersionStart` <= '.$Export->ClientVersion['BuildNumber'].') AND (`VersionEnd` >= '.$Export->ClientVersion['BuildNumber'].')'. 698 ') AS `C2`) AS `Total`, "'.$DbRow['Name'].'" AS `Name`'; 699 } 700 $Query = substr($Query, 0, - 6); 701 702 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM ('.$GroupListQuery.') AS `T`'); 703 $DbRow = $DbResult->fetch_row(); 704 $PageList = GetPageList($DbRow[0]); 705 $Output = '<h3>'.T('Statistic of coplection selected groups').'</h3>'. 706 $PageList['Output']; 707 708 $Output .= '<table class="BaseTable">'; 709 $TableColumns = array( 710 array('Name' => 'Name', 'Title' => T('Name')), 711 array('Name' => 'Translated', 'Title' => T('Translated count')), 712 array('Name' => 'Total', 'Title' => T('English')), 713 array('Name' => 'Percent', 'Title' => T('Percent')), 714 ); 715 716 $Order = GetOrderTableHeader($TableColumns, 'Name', 0); 717 $Output .= $Order['Output']; 718 719 $Translated = 0; 720 $Total = 0; 721 if(count($UnionItems) > 0) 722 { 723 $ID = $this->System->Database->query('SELECT *, ROUND(`Translated` / `Total` * 100, 2) AS `Percent` FROM ('.implode(' UNION ALL ', $UnionItems).') AS `C3` '.$Order['SQL'].$PageList['SQLLimit']); 724 while($Group = $ID->fetch_assoc()) 725 { 726 $Output .= '<tr><td>'.$Group['Name'].'</td><td>'.$Group['Translated'].'</td><td>'.$Group['Total'].'</td><td>'.ProgressBar(150, $Group['Percent']).'</td></tr>'; 727 $Translated += $Group['Translated']; 728 $Total += $Group['Total']; 729 } 730 } 731 if($Total > 0) $Percent = $Translated / $Total * 100; 732 else $Percent = 100; 733 734 $Output .= '<tr><td><strong>'.T('Altogether').'</strong></td><td><strong>'.$Translated.'</strong></td><td><strong>'.$Total.'</strong></td><td><strong>'.ProgressBar(150, round($Percent, 2)).'</strong></td></tr>'; 735 $Output .= '</table>'; 736 } 737 return($Output); 738 } 739 740 function ExportView() 741 { 742 $Output = ''; 743 if(array_key_exists('ExportId', $_GET) and is_numeric($_GET['ExportId'])) 744 { 745 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 746 if($DbResult->num_rows > 0) 747 { 748 $Export = $DbResult->fetch_assoc(); 749 750 $DbResult = $this->System->Database->query('SELECT * FROM `User` WHERE `ID`='.$Export['User']); 751 $UserLine = $DbResult->fetch_assoc(); 752 $Output .= 'Export <strong><a href="?Action=View&Tab=6&ExportId='.$Export['Id'].'">'.$_GET['ExportId'].'</a></strong> překladatele <strong>'.$UserLine['Name'].'</strong> s označením <strong>'.$Export['Title'].'</strong>'; 753 $Output .= ShowTabs(array(T('General'), T('Translators'), 'Překlady', T('Languages'), T('Format'), T('Version'), T('Statistic'), T('Output'))); 754 $Output .= '<div id="content">'; 755 if($_SESSION['Tab'] == TAB_GENERAL) $Output .= $this->ExportViewGeneral(); 756 else if($_SESSION['Tab'] == TAB_TRANSLATORS) $Output .= $this->ExportViewTranslators(); 757 else if($_SESSION['Tab'] == TAB_GROUPS) $Output .= $this->ExportViewGroups(); 758 else if($_SESSION['Tab'] == TAB_LANGUAGES) $Output .= $this->ExportViewLanguages(); 759 else if($_SESSION['Tab'] == TAB_OUTPUT_FORMAT) $Output .= $this->ExportViewOutputFormat(); 760 else if($_SESSION['Tab'] == TAB_VERSION) $Output .= $this->ExportViewVersion(); 761 else if($_SESSION['Tab'] == TAB_STAT) $Output .= $this->ExportViewStat(); 762 else if($_SESSION['Tab'] == TAB_OUTPUT) $Output .= $this->ExportViewOutput(); 763 else $Output .= $this->ExportViewGeneral(); 764 765 $Output .= '</div>'; 766 } else $Output .= ShowMessage(T('Export not found.'), MESSAGE_CRITICAL); 767 } else $Output .= ShowMessage(T('Is isn\'t select'), MESSAGE_CRITICAL); 768 return($Output); 769 } 770 771 function ExportClone() 772 { 773 if($this->System->User->Licence(LICENCE_USER)) 774 { 775 if(array_key_exists('ExportId', $_GET) and is_numeric($_GET['ExportId'])) 776 { 777 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id); 778 $DbRow = $DbResult->fetch_row(); 779 if($DbRow[0] < $this->System->Config['MaxExportPerUser']) 780 { 781 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 782 if($DbResult->num_rows > 0) 783 { 784 $DbRow = $DbResult->fetch_assoc(); 785 unset($DbRow['Id']); 786 $DbRow['UsedCount'] = '0'; 787 $DbRow['User'] = $this->System->User->Id; 788 $DbRow['TimeCreate'] = 'NOW()'; 789 $DbRow['Title'] .= ' - '.T('clone'); 790 790 $DbRow['Featured'] = 0; 791 792 $ExportId = $this->System->Database->insert_id; 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 { 811 791 $this->System->Database->insert('Export', $DbRow); 792 $ExportId = $this->System->Database->insert_id; 793 $this->System->Database->query('INSERT INTO `ExportGroup` (SELECT NULL AS `Id`, '.$ExportId.' AS `Export`, `Group` FROM `ExportGroup` WHERE `Export`='.$_GET['ExportId'].')'); 794 $this->System->Database->query('INSERT INTO `ExportGroupItem` (SELECT NULL AS `Id`, '.$ExportId.' AS `Export`, `GroupItem` FROM `ExportGroupItem` WHERE `Export`='.$_GET['ExportId'].')'); 795 $this->System->Database->query('INSERT INTO `ExportLanguage` (SELECT NULL AS `Id`, '.$ExportId.' AS `Export`, `Language`, `Sequence` FROM `ExportLanguage` WHERE `Export`='.$_GET['ExportId'].')'); 796 $this->System->Database->query('INSERT INTO `ExportUser` (SELECT NULL AS `Id`, '.$ExportId.' AS `Export`, `User`, `Sequence` FROM `ExportUser` WHERE `Export`='.$_GET['ExportId'].')'); 797 $Output = ShowMessage(T('Clone export created.<br />Direct link to export').': <a href="?Action=View&ExportId='.$ExportId.'">zde</a>'); 798 $this->System->ModuleManager->Modules['Log']->WriteLog(T('Clone export created').' <a href="'.$this->System->Link('/export/?Action=View&ExportId='.$ExportId).'">'.$ExportId.'</a>.', LOG_TYPE_EXPORT); 799 $_GET['Filter'] = 'my'; 800 $this->ExportList(); 801 } else $Output = ShowMessage('Zdrojový export nenalezen', MESSAGE_CRITICAL); 802 } else $Output = ShowMessage('Nemůžete vytvářet další export. Max. počet na uživatele je '. 803 $this->System->Config['MaxExportPerUser'].'.', MESSAGE_CRITICAL); 804 } else $Output = ShowMessage(T('Export not found.'), MESSAGE_CRITICAL); 805 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 806 return($Output); 807 } 808 809 function Show() 810 { 811 $this->Title = T('Export'); 812 812 if(array_key_exists('Action', $_GET)) 813 813 { … … 820 820 } else $Output = $this->ExportList(); 821 821 return($Output); 822 } 822 } 823 823 } -
trunk/Modules/Export/ProcessAoWoWExport.php
r805 r816 5 5 include_once('../../includes/global.php'); 6 6 //include_once('../../includes/dbc.php'); 7 include_once('Export.php'); 8 include_once('Page.php'); 7 include_once('Export.php'); 8 include_once('Page.php'); 9 9 10 10 $System = new System(); 11 11 $System->DoNotShowPage = true; 12 12 $System->Run(); 13 13 14 14 $Output = ''; 15 15 16 if(defined('STDIN') == false) 16 if(defined('STDIN') == false) 17 17 { 18 18 $Output = T('Access denied'); 19 19 exit($Output); 20 } 20 } 21 21 22 22 foreach($_SERVER['argv'] as $parameter) … … 36 36 $Export->Id = $Config['AoWoWExportId']; 37 37 } else $Export->Id = 37; 38 $Output .= $Export->Init(); 38 $Output .= $Export->Init(); 39 39 $SQL = $Export->ExportToAoWoWSQL(); 40 40 echo 'Hotovo … … 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); -
trunk/Modules/Export/ProcessTask.php
r811 r816 12 12 $System = new System(); 13 13 $System->DoNotShowPage = true; 14 14 $System->Run(); 15 15 16 16 function SetProgress($Export,$per) { -
trunk/Modules/Export/Progress.php
r743 r816 2 2 3 3 include_once(dirname(__FILE__).'/../../includes/global.php'); 4 4 5 5 $System = new System(); 6 6 $System->DoNotShowPage = true; 7 7 $System->Run(); 8 8 9 9 10 10 $Output = ''; … … 12 12 ' LEFT JOIN `Export` ON `Export`.`Id` = `ExportTask`.`Export` WHERE (`Export`.`OutputType` = 9 OR `Export`.`OutputType` = 10 ) AND `TimeFinish` IS NULL OR `Export` ='.$_GET['RedirectId'].' ORDER BY `Progress` DESC');// `Export`='.$Export->Id 13 13 while($Task = $DbResult->fetch_assoc()) { 14 $Export = '<a href="'.$System->Link('/export/?Action=View&ExportId='.$Task['Export']).'">'.$Task['Export'].'</a>'; 14 $Export = '<a href="'.$System->Link('/export/?Action=View&ExportId='.$Task['Export']).'">'.$Task['Export'].'</a>'; 15 15 if ($_GET['RedirectId'] == $Task['Export']) 16 16 $Export = ''.$Export.' (tento)'; … … 19 19 'setTimeout("parent.location.href=\''.$System->Link('/export/?Action=View&Tab=7&ExportId='.$_GET['RedirectId']).'\'", 500)'. 20 20 '</script>'; 21 } 21 } 22 22 23 23 echo $Output; -
trunk/Modules/Export/cmdmpqexport.php
r805 r816 5 5 include_once(dirname(__FILE__).'/../../includes/global.php'); 6 6 //include_once('../../includes/dbc.php'); 7 include_once('Export.php'); 8 include_once('Page.php'); 7 include_once('Export.php'); 8 include_once('Page.php'); 9 9 10 10 $System = new System(); 11 11 $System->DoNotShowPage = true; 12 12 $System->Run(); 13 13 $PageExport = new PageExport($System); 14 14 … … 17 17 $Output = ''; 18 18 19 if(defined('STDIN') == false) 19 if(defined('STDIN') == false) 20 20 { 21 21 $Output = T('Access denied'); 22 22 exit($Output); 23 } 23 } 24 24 25 25 foreach($_SERVER['argv'] as $parameter) … … 37 37 $Output .= 'Usage ExportId=id_export - for write export info<br />'; 38 38 $Output .= 'Usage needgeneration=id_export - for write export info<br />'; 39 39 40 40 $Output .= 'type_export={lua,dbc,addon} <br />'; 41 41 $Output = str_replace('<br />',' … … 46 46 $Export = new Export($System); 47 47 $Export->Id = $_GET['lua']; 48 $Output .= $Export->Init(); 48 $Output .= $Export->Init(); 49 49 $Output .= $Export->ExportToLua(); 50 50 $Output = str_replace('<br/>',' … … 56 56 $Export = new Export($System); 57 57 $Export->Id = $_GET['version']; 58 $Export->LoadFilters(); 58 $Export->LoadFilters(); 59 59 $Output .= $Export->ClientVersion['Version']; 60 60 $Output = str_replace('<br/>',' … … 66 66 $Export = new Export($System); 67 67 $Export->Id = $_GET['dbc']; 68 $Output .= $Export->Init(); 68 $Output .= $Export->Init(); 69 69 $Output .= $Export->ExportToDbc(); 70 70 $Output = str_replace('<br/>',' … … 85 85 86 86 if(array_key_exists('needgeneration', $_GET)) { 87 87 $DbRows = $System->Database->query('SELECT `ClientVersion`.`Version` as Version, `Export`.`Id`,`Export`.`ClientVersion`,`Export`.`OutputType`,`Export`.`Title`,`Export`.`Description` FROM `Export` JOIN `ClientVersion` as `ClientVersion` ON `ClientVersion`.`Id`=`Export`.`ClientVersion` WHERE `Featured`=1 ORDER BY `ClientVersion`.`BuildNumber` DESC'); 88 88 while ($DbExport = $DbRows->fetch_assoc()) { 89 89 $Export = new Export($System); 90 90 $Export->Id = $DbExport['Id']; 91 $Output .= $Export->Init(); 91 $Output .= $Export->Init(); 92 92 if ($Export->NeedGeneration()) { 93 93 $DbResult = $System->Database->query('SELECT * FROM ExportTask WHERE Export = '.$Export->Id); … … 95 95 { 96 96 $System->Database->query('INSERT INTO ExportTask (`Export` ,`TimeStart` ) VALUES ('.$Export->Id.', NOW())'); 97 } else 97 } else 98 98 $System->Database->query('UPDATE ExportTask SET `TimeStart` = NOW(), `Progress` = 0, `TimeFinish` = NULL WHERE Export = '.$Export->Id); 99 99 … … 113 113 $Export = new Export($System); 114 114 $Export->Id = $_GET['ExportId']; 115 $Export->LoadFilters(); 116 115 $Export->LoadFilters(); 116 117 117 //generation readme 118 118 $Output .= '<?xml version="1.0" encoding="utf-8"?\>'. … … 129 129 '<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />'. 130 130 '<title>Čeština pro WoW</title>'. 131 '</head><body>'. 131 '</head><body>'. 132 132 '<h1>České WoW - čestina pro klienta hry World of Warcraft</h1>'. 133 133 134 134 '<table cellspacing="10"><tr><td valign="top">'. 135 135 136 136 '<p>Texty přebírány z projektu <a href="http://wowpreklad.zdechov.net/">wowpreklad.zdechov.net</a><br>'. 137 137 '<a href="http://wowpreklad.zdechov.net/export/?Action=View&ExportId='.$_GET['ExportId'].'&Tab=0">Export '.$_GET['ExportId'].'</a></p><br>'. 138 139 138 139 140 140 '<p><strong>Vlastnosti</strong>'. 141 141 '<ul>'. … … 148 148 '</p>'. 149 149 '<br>'. 150 150 151 151 '<h2>Nejčastější otázky</h2>'. 152 152 '<p><strong>Jak mám hru spustit?</strong><br>'. … … 155 155 '<p><strong>Mohu použít tuto češtinu na oficiálních serverech?</strong><br>'. 156 156 '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.</p>'. 157 157 158 158 '<p><strong>Mám nainstalovánu češtinu a nejde mi spustit Wow.exe.</strong><br>'. 159 159 '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.</p>'. 160 160 161 161 '<p><strong>Nedaří se mi provést aktualizaci klienta s nainstalovanou češtinou.</strong><br>'. 162 162 'Před aktualizací na novější verzi klienta musíte nejprve češtinu odinstalovat. Čeština totiž mění v rámci patch MPQ souboru některé soubory hry, což oficiální instalátory vyhodnotí jako poškození hry.</p>'. 163 163 164 164 '</td><td>'; 165 165 … … 167 167 168 168 $Output .= '</td></tr></table>'. 169 170 169 170 171 171 '</body></html>'; 172 172 173 173 } 174 174 //$_GET['ExportId']
Note:
See TracChangeset
for help on using the changeset viewer.