Changeset 558
- Timestamp:
- Jul 29, 2013, 11:48:14 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 8 deleted
- 3 edited
- 6 copied
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Export/CreateAddon.php
r553 r558 1 1 <?php 2 3 include_once('export.php');4 2 5 3 class ExportAddon extends Export -
trunk/Modules/Export/Export.php
r553 r558 1 1 <?php 2 2 3 include_once('../includes/system.php'); 3 include_once(dirname(__FILE__).'/Page.php'); 4 include_once(dirname(__FILE__).'/ExportOutput.php'); 5 6 class ModuleExport extends AppModule 7 { 8 function __construct($System) 9 { 10 parent::__construct($System); 11 $this->Name = 'Export'; 12 $this->Version = '1.0'; 13 $this->Creator = 'Chronos'; 14 $this->License = 'GNU/GPL'; 15 $this->Description = 'Allow parametric export translated texts to various supported output formats'; 16 $this->Dependencies = array(); 17 } 18 19 function Start() 20 { 21 $this->System->RegisterPage('export', 'PageExport'); 22 $this->System->RegisterMenuItem(array( 23 'Title' => 'Exporty', 24 'Hint' => 'Zde si můžete stáhnout přeložené texty', 25 'Link' => $this->System->Link('/export/'), 26 'Permission' => LICENCE_ANONYMOUS, 27 'Icon' => '', 28 ), 2); 29 } 30 } 4 31 5 32 class Export extends Module … … 16 43 function Init() 17 44 { 18 $this->TempDir = $this->Config['Web']['TempFolder'].'Export/'.$this->Id.'/'; 45 $this->TempDir = dirname(__FILE__).'/../../'.$this->Config['Web']['TempFolder'].'Export/'.$this->Id.'/'; 46 $this->TempDirRelative = $this->Config['Web']['TempFolder'].'Export/'.$this->Id.'/'; 19 47 if(!file_exists($this->TempDir)) mkdir($this->TempDir, 0777, true); 20 48 } -
trunk/Modules/Export/ExportOutput.php
r553 r558 1 1 <?php 2 2 3 //include_once('../includes/global.php'); 4 include_once('../includes/zip.lib.php'); 5 include_once('../includes/dbc.php'); 6 include_once('export.php'); 7 include_once('create_addon.php'); 3 include_once(dirname(__FILE__).'/../../includes/zip.lib.php'); 4 include_once(dirname(__FILE__).'/../../includes/dbc.php'); 5 include_once(dirname(__FILE__).'/CreateAddon.php'); 8 6 9 7 //ini_set('memory_limit', '100M'); … … 47 45 48 46 $Output .= 'Pokud nezačalo stahování, soubor by mělo jít stáhnout pomocí tohoto odkazu: '. 49 '<a href="'.$S aveFilename.'">'.$SQLFilename.'</a><br />'.47 '<a href="'.$System->Link('/'.$Export->TempDirRelative.'CzAoWoW_SQL.zip').'">'.$SQLFilename.'</a><br />'. 50 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.'; 51 49 return($Output); … … 88 86 89 87 $Output .= 'Pokud nezačalo stahování, soubor by mělo jít stáhnout pomocí tohoto odkazu: '. 90 '<a href="'.$S aveFilename.'">'.$SQLFilename.'</a><br />'.88 '<a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_SQL.zip').'">'.$SQLFilename.'</a><br />'. 91 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.'; 92 90 return($Output); … … 121 119 $Zip = new zipfile(); 122 120 CreateZipFromDir($Zip, $Addon->TempDir.'CzWoW/', 'CzWoW/'); 123 $Zip->addFile(file_get_contents( 'files/'.$Addon->ClientVersion['Version'].'/CzWoW/OptionsFrame.xml'), 'CzWoW/OptionsFrame.xml');124 $Zip->addFile(file_get_contents( 'files/'.$Addon->ClientVersion['Version'].'/CzWoW/CzWoW.xml'), 'CzWoW/CzWoW.xml');125 $Zip->addFile(file_get_contents( 'files/'.$Addon->ClientVersion['Version'].'/CzWoW/CzWoW.toc'), 'CzWoW/CzWoW.toc');126 $Zip->addFile(file_get_contents( 'files/'.$Addon->ClientVersion['Version'].'/CzWoW/CzWoW.lua'), 'CzWoW/CzWoW.lua');127 $Zip->addFile(file_get_contents( 'files/'.$Addon->ClientVersion['Version'].'/CzWoW/GameMenuFrame.xml'), 'CzWoW/GameMenuFrame.xml');128 $Zip->addFile(file_get_contents( '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'); 129 127 $Buffer = $Zip->file(); 130 128 file_put_contents($SaveFilename, $Buffer); … … 136 134 137 135 $Output .= 'Soubor ke stažení: '. 138 '<a href="'.$S aveFilename.'">CzWoW_Addon-'.$Addon->ClientVersion['Version'].'.zip</a><br />'.136 '<a href="'.$System->Link('/'.$Addon->TempDirRelative.'CzWoW_Addon-'.$Addon->ClientVersion['Version'].'.zip').'">CzWoW_Addon-'.$Addon->ClientVersion['Version'].'.zip</a><br />'. 139 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.'; 140 138 $Output .= '<br /><strong>Použití ve hře</strong><br />Menu addonu ve hře vyvoláte povelem /czwow.'; … … 165 163 166 164 $Output .= 'Pokud nezačalo stahování, soubor by mělo jít stáhnout pomocí tohoto odkazu: '. 167 '<a href="'.$S aveFilename.'">CzWoW_SQL.zip</a><br />'.165 '<a href="'.$System->Link('/'.$Export->TempDirRelative.'CzWoW_XML.zip').'">CzWoW_SQL.zip</a><br />'. 168 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.'; 169 167 return($Output); -
trunk/Modules/Export/Page.php
r554 r558 1 1 <?php 2 2 3 include_once('../includes/global.php'); 4 include_once('export_output.php'); 5 3 include_once('ExportOutput.php'); 4 5 class PageExport extends Page 6 { 6 7 function ExportList() 7 8 { 8 global $ System, $User;9 global $User; 9 10 10 11 $Output = '<a href="?Action=ViewList">Všechny</a>'; … … 22 23 } 23 24 24 $DbResult = $ System->Database->query('SELECT COUNT(*) FROM `Export` '.$Filter);25 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` '.$Filter); 25 26 $DbRow = $DbResult->fetch_row(); 26 27 $PageList = GetPageList($DbRow[0]); … … 44 45 $Order['Output']; 45 46 46 $DbResult = $ System->Database->query('SELECT `User`.`Name` AS `UserName`, `Export`.`Id`, `Export`.`TimeCreate`, `Export`.`Title`, `Export`.`User`, `Export`.`UsedCount`, (SELECT Version FROM `ClientVersion` WHERE `ClientVersion`.`Id`=`Export`.`ClientVersion`) AS `ClientVersion`,(SELECT Name FROM `ExportOutputType` WHERE `ExportOutputType`.`Id`=`Export`.`OutputType`) AS `OutputType`, (SELECT COUNT(*) FROM `ExportGroup` WHERE `ExportGroup`.`Export`=`Export`.`Id`) AS `GroupCount`, (SELECT COUNT(*) FROM `ExportUser` WHERE `ExportUser`.`Export`=`Export`.`Id`) AS `UserCount` FROM `Export` LEFT JOIN `User` ON `User`.`ID`=`Export`.`User` '.$Filter.$Order['SQL'].$PageList['SQLLimit']);47 $DbResult = $this->System->Database->query('SELECT `User`.`Name` AS `UserName`, `Export`.`Id`, `Export`.`TimeCreate`, `Export`.`Title`, `Export`.`User`, `Export`.`UsedCount`, (SELECT Version FROM `ClientVersion` WHERE `ClientVersion`.`Id`=`Export`.`ClientVersion`) AS `ClientVersion`,(SELECT Name FROM `ExportOutputType` WHERE `ExportOutputType`.`Id`=`Export`.`OutputType`) AS `OutputType`, (SELECT COUNT(*) FROM `ExportGroup` WHERE `ExportGroup`.`Export`=`Export`.`Id`) AS `GroupCount`, (SELECT COUNT(*) FROM `ExportUser` WHERE `ExportUser`.`Export`=`Export`.`Id`) AS `UserCount` FROM `Export` LEFT JOIN `User` ON `User`.`ID`=`Export`.`User` '.$Filter.$Order['SQL'].$PageList['SQLLimit']); 47 48 while($Export = $DbResult->fetch_assoc()) 48 49 { … … 50 51 if($Export['User'] == $User->Id) $Action .= ' <a href="?Action=Delete&ExportId='.$Export['Id'].'" onclick="return confirmAction(\'Opravdu smazat položku?\');">Smazat</a>'; 51 52 $Output .= '<tr><td>'.HumanDate($Export['TimeCreate']).'</td>'. 52 '<td><a href="'.$ System->Link('/user.php?user='.$Export['User']).'">'.$Export['UserName'].'</a></td>'.53 '<td><a href="'.$this->System->Link('/user.php?user='.$Export['User']).'">'.$Export['UserName'].'</a></td>'. 53 54 '<td>'.$Export['Title'].'</td>'. 54 55 '<td>'.$Export['OutputType'].'</td>'. … … 67 68 function ExportCreate() 68 69 { 69 global $ System, $User;70 global $User; 70 71 71 72 if($User->Licence(LICENCE_USER)) 72 73 { 73 $DbResult = $ System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$User->Id);74 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$User->Id); 74 75 $DbRow = $DbResult->fetch_row(); 75 if($DbRow[0] < $ System->Config['MaxExportPerUser'])76 if($DbRow[0] < $this->System->Config['MaxExportPerUser']) 76 77 { 77 78 $Output = '<form action="?Action=CreateFinish" method="post">'. … … 81 82 '<tr><td colspan="2"><input type="submit" value="Vytvořit" /></td></tr>'. 82 83 '</table></fieldset></form>'; 83 } else $Output = ShowMessage('Nemůžete vytvářet další export. Max. počet na uživatele je '.$ System->Config['MaxExportPerUser'].'.', MESSAGE_CRITICAL);84 } else $Output = ShowMessage('Nemůžete vytvářet další export. Max. počet na uživatele je '.$this->System->Config['MaxExportPerUser'].'.', MESSAGE_CRITICAL); 84 85 } else $Output = ShowMessage('Nemáte oprávnění.', MESSAGE_CRITICAL); 85 86 return($Output); … … 88 89 function ExportCreateFinish() 89 90 { 90 global $User , $System;91 global $User; 91 92 92 93 if($User->Licence(LICENCE_USER)) … … 94 95 if(array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST)) 95 96 { 96 $DbResult = $ System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$User->Id);97 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$User->Id); 97 98 $DbRow = $DbResult->fetch_row(); 98 if($DbRow[0] < $ System->Config['MaxExportPerUser'])99 if($DbRow[0] < $this->System->Config['MaxExportPerUser']) 99 100 { 100 $ System->Database->query('INSERT INTO `Export` (`Title`, `User`, `TimeCreate`, `WithDiacritic`, `Description`) VALUES ("'.$_POST['Title'].'", '.$User->Id.', NOW(), 1, "'.$_POST['Description'].'")');101 $ExportId = $ System->Database->insert_id;101 $this->System->Database->query('INSERT INTO `Export` (`Title`, `User`, `TimeCreate`, `WithDiacritic`, `Description`) VALUES ("'.$_POST['Title'].'", '.$User->Id.', NOW(), 1, "'.$_POST['Description'].'")'); 102 $ExportId = $this->System->Database->insert_id; 102 103 $Output = ShowMessage('Nový export vytvořen.<br/>Přímý odkaz na tento export: <a href="?Action=View&ExportId='.$ExportId.'">zde</a>'); 103 WriteLog('Vytvořen nový export <a href="'.$ System->Link('/export/?Action=View&ExportId='.$ExportId).'">'.$ExportId.'</a>.', LOG_TYPE_EXPORT);104 WriteLog('Vytvořen nový export <a href="'.$this->System->Link('/export/?Action=View&ExportId='.$ExportId).'">'.$ExportId.'</a>.', LOG_TYPE_EXPORT); 104 105 $_GET['Filter'] = 'my'; 105 106 ExportList(); 106 } else $Output = ShowMessage('Nemůžete vytvářet další export. Max. počet na uživatele je '.$ System->Config['MaxExportPerUser'].'.', MESSAGE_CRITICAL);107 } else $Output = ShowMessage('Nemůžete vytvářet další export. Max. počet na uživatele je '.$this->System->Config['MaxExportPerUser'].'.', MESSAGE_CRITICAL); 107 108 } else $Output = ShowMessage('Chybí údaje formuláře.', MESSAGE_CRITICAL); 108 109 } else $Output = ShowMessage('Nemáte oprávnění.', MESSAGE_CRITICAL); … … 112 113 function ExportDelete() 113 114 { 114 global $ System, $User;115 global $User; 115 116 116 117 if($User->Licence(LICENCE_USER)) 117 118 { 118 $DbResult = $ System->Database->query('SELECT * FROM `Export` WHERE (`Id`='.($_GET['ExportId'] * 1).') AND (`User`='.$User->Id.')');119 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE (`Id`='.($_GET['ExportId'] * 1).') AND (`User`='.$User->Id.')'); 119 120 if($DbResult->num_rows > 0) 120 121 { 121 $ System->Database->query('DELETE FROM `ExportGroup` WHERE `Export`='.$_GET['ExportId']);122 $ System->Database->query('DELETE FROM `ExportLanguage` WHERE `Export`='.$_GET['ExportId']);123 $ System->Database->query('DELETE FROM `ExportTask` WHERE `Export`='.$_GET['ExportId']);124 $ System->Database->query('DELETE FROM `ExportUser` WHERE `Export`='.$_GET['ExportId']);125 $ System->Database->query('DELETE FROM `Export` WHERE `Id`='.$_GET['ExportId']);122 $this->System->Database->query('DELETE FROM `ExportGroup` WHERE `Export`='.$_GET['ExportId']); 123 $this->System->Database->query('DELETE FROM `ExportLanguage` WHERE `Export`='.$_GET['ExportId']); 124 $this->System->Database->query('DELETE FROM `ExportTask` WHERE `Export`='.$_GET['ExportId']); 125 $this->System->Database->query('DELETE FROM `ExportUser` WHERE `Export`='.$_GET['ExportId']); 126 $this->System->Database->query('DELETE FROM `Export` WHERE `Id`='.$_GET['ExportId']); 126 127 DeleteDirectory('../tmp/Export/'.$_GET['ExportId'].'/'); 127 128 $Output = ShowMessage('Export smazán.'); … … 136 137 function ExportViewTranslators() 137 138 { 138 global $TranslationTree, $User , $System;139 global $TranslationTree, $User; 139 140 140 141 $Output = ''; 141 142 $DisabledInput = array(false => ' disabled="disabled"', true => ''); 142 $DbResult = $ System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);143 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 143 144 $Export = $DbResult->fetch_assoc(); 144 145 if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; … … 159 160 else $Selected = false; 160 161 $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `User`='.$UserId; 161 $DbResult = $ System->Database->query('SELECT * FROM `ExportUser` '.$Condition);162 $DbResult = $this->System->Database->query('SELECT * FROM `ExportUser` '.$Condition); 162 163 if($DbResult->num_rows > 0) 163 164 { 164 if(!$Selected) $ System->Database->query('DELETE FROM `ExportUser` '.$Condition);165 else $ System->Database->query('UPDATE `ExportUser` SET `Sequence`='.$Value.$Condition);165 if(!$Selected) $this->System->Database->query('DELETE FROM `ExportUser` '.$Condition); 166 else $this->System->Database->query('UPDATE `ExportUser` SET `Sequence`='.$Value.$Condition); 166 167 } else 167 168 { 168 if($Selected) $ System->Database->query('INSERT INTO `ExportUser` (`Export`, `User`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$UserId.', '.$Value.')');169 if($Selected) $this->System->Database->query('INSERT INTO `ExportUser` (`Export`, `User`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$UserId.', '.$Value.')'); 169 170 } 170 171 } … … 172 173 173 174 // Recalculate sequence number 174 $ System->Database->query('SET @I = 0');175 $ System->Database->query('UPDATE `ExportUser` SET `Sequence` = (@I := @I + 1) WHERE `Export`='.$_GET['ExportId'].' ORDER BY `Sequence`;');175 $this->System->Database->query('SET @I = 0'); 176 $this->System->Database->query('UPDATE `ExportUser` SET `Sequence` = (@I := @I + 1) WHERE `Export`='.$_GET['ExportId'].' ORDER BY `Sequence`;'); 176 177 $Output .= ShowMessage('Výběr uložen.'); 177 178 } … … 194 195 $Query .=' WHERE `T`.`TranslatedCount` > 0 ORDER BY COALESCE(`ExportUser`.`Sequence`, 100000000)'.$InitialOrder.') AS `TT`'; 195 196 196 $DbResult = $ System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS `X`');197 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS `X`'); 197 198 $DbRow = $DbResult->fetch_row(); 198 199 $PageList = GetPageList($DbRow[0]); … … 215 216 216 217 $Query = 'SELECT * FROM ('.$Query.') AS `TX` '.$Order['SQL'].$PageList['SQLLimit']; 217 $ System->Database->query('SET @I = 0');218 $DbResult = $ System->Database->query($Query);218 $this->System->Database->query('SET @I = 0'); 219 $DbResult = $this->System->Database->query($Query); 219 220 while($UserLine = $DbResult->fetch_assoc()) 220 221 { … … 224 225 $Sequence = '<input type="text" name="seq'.$UserLine['ID'].'" style="text-align: center; width: 40px;" value="'.$UserLine['Sequence2'].'"'.$DisabledInput[$Editable].'/>'; 225 226 $Output .= '<tr>'. 226 '<td><a href="'.$ System->Link('/TranslationList.php?user='.$UserLine['ID'].'&state=2&group=0').'" title="Zobrazit všechny jeho přeložené texty">'.$UserLine['Name'].'</a></td>'.227 '<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>'. 227 228 '<td>'.$UserLine['TranslatedCount'].'</td>'. 228 229 '<td>'.$XP['Level'].'</td>'. … … 238 239 function ExportViewGeneral() 239 240 { 240 global $ System, $User;241 global $User; 241 242 242 243 $DisabledInput = array(false => ' disabled="disabled"', true => ''); 243 244 $DisabledTextArea = array(false => ' readonly="yes"', true => ''); 244 245 $Output = '<h3>Obecná nastavení</h3>'; 245 $DbRows = $ System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);246 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 246 247 $Export = $DbRows->fetch_assoc(); 247 248 if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; … … 253 254 if(array_key_exists('WithDiacritic', $_POST)) $WithDiacritic = 1; 254 255 else $WithDiacritic = 0; 255 $ System->Database->query('UPDATE `Export` SET `Title`="'.$_POST['Title'].'", `Description`="'.$_POST['Description'].'", `WithDiacritic`='.$WithDiacritic.' WHERE Id='.$Export['Id']);256 $this->System->Database->query('UPDATE `Export` SET `Title`="'.$_POST['Title'].'", `Description`="'.$_POST['Description'].'", `WithDiacritic`='.$WithDiacritic.' WHERE Id='.$Export['Id']); 256 257 $Export['Title'] = $_POST['Title']; 257 258 $Export['Description'] = $_POST['Description']; … … 278 279 function ExportViewLanguages() 279 280 { 280 global $System, $TranslationTree, $User; 281 281 global $TranslationTree, $User; 282 283 $Output = ''; 282 284 $DisabledInput = array(false => ' disabled="disabled"', true => ''); 283 $DbRows = $ System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);285 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 284 286 $Export = $DbRows->fetch_assoc(); 285 287 if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; … … 300 302 else $Selected = false; 301 303 $Condition = ' WHERE Export='.$_GET['ExportId'].' AND `Language`='.$LanguageId; 302 $DbResult = $ System->Database->query('SELECT * FROM `ExportLanguage` '.$Condition);304 $DbResult = $this->System->Database->query('SELECT * FROM `ExportLanguage` '.$Condition); 303 305 if($DbResult->num_rows > 0) 304 306 { 305 if(!$Selected) $ System->Database->query('DELETE FROM `ExportLanguage` '.$Condition);306 else $ System->Database->query('UPDATE `ExportLanguage` SET `Sequence`='.$Value.$Condition);307 if(!$Selected) $this->System->Database->query('DELETE FROM `ExportLanguage` '.$Condition); 308 else $this->System->Database->query('UPDATE `ExportLanguage` SET `Sequence`='.$Value.$Condition); 307 309 } else 308 310 { 309 if($Selected) $ System->Database->query('INSERT INTO `ExportLanguage` (`Export`, `Language`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$LanguageId.', '.$Value.')');311 if($Selected) $this->System->Database->query('INSERT INTO `ExportLanguage` (`Export`, `Language`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$LanguageId.', '.$Value.')'); 310 312 } 311 313 } … … 313 315 314 316 // Recalculate sequence number 315 $ System->Database->query('SET @I = 0');316 $ System->Database->query('UPDATE `ExportLanguage` SET `Sequence` = (@I := @I + 1) WHERE `Export`='.$_GET['ExportId'].' ORDER BY `Sequence`;');317 ShowMessage('Výběr uložen.');317 $this->System->Database->query('SET @I = 0'); 318 $this->System->Database->query('UPDATE `ExportLanguage` SET `Sequence` = (@I := @I + 1) WHERE `Export`='.$_GET['ExportId'].' ORDER BY `Sequence`;'); 319 $Output .= ShowMessage('Výběr uložen.'); 318 320 } 319 321 } … … 323 325 $Query .=' WHERE `Language`.`Enabled` = 1 ORDER BY COALESCE(`Sequence`, 100)'; 324 326 325 $DbResult = $ System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS X');327 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS X'); 326 328 $DbRow = $DbResult->fetch_row(); 327 329 $PageList = GetPageList($DbRow[0]); … … 333 335 ); 334 336 $Order = GetOrderTableHeader($TableColumns, 'Sequence2'); 335 $Output = '<form action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'.337 $Output .= '<form action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'. 336 338 '<h3>Jazyky</h3>'; 337 339 if($Editable) … … 349 351 350 352 $Query = 'SELECT * FROM ('.$Query.') AS TX '.$Order['SQL'].$PageList['SQLLimit']; 351 $ System->Database->query('SET @I = 0');352 $DbResult = $ System->Database->query($Query);353 $this->System->Database->query('SET @I = 0'); 354 $DbResult = $this->System->Database->query($Query); 353 355 while($Langugage = $DbResult->fetch_assoc()) 354 356 { … … 368 370 function ExportViewGroups() 369 371 { 370 global $ System, $TranslationTree, $User;372 global $TranslationTree, $User; 371 373 372 374 $Output = ''; 373 375 $DisabledInput = array(false => ' disabled="disabled"', true => ''); 374 $DbRows = $ System->Database->query('SELECT * FROM Export WHERE Id='.$_GET['ExportId']);376 $DbRows = $this->System->Database->query('SELECT * FROM Export WHERE Id='.$_GET['ExportId']); 375 377 $Export = $DbRows->fetch_assoc(); 376 378 if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; … … 391 393 else $Selected = false; 392 394 $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `Group`='.$GroupId; 393 $DbResult = $ System->Database->query('SELECT * FROM `ExportGroup` '.$Condition);395 $DbResult = $this->System->Database->query('SELECT * FROM `ExportGroup` '.$Condition); 394 396 if($DbResult->num_rows > 0) 395 397 { 396 if(!$Selected) $ System->Database->query('DELETE FROM `ExportGroup` '.$Condition);398 if(!$Selected) $this->System->Database->query('DELETE FROM `ExportGroup` '.$Condition); 397 399 } else 398 400 { 399 if($Selected) $ System->Database->query('INSERT INTO `ExportGroup` (`Export`, `Group`) VALUES ('.$_GET['ExportId'].', '.$GroupId.')');401 if($Selected) $this->System->Database->query('INSERT INTO `ExportGroup` (`Export`, `Group`) VALUES ('.$_GET['ExportId'].', '.$GroupId.')'); 400 402 } 401 403 } … … 407 409 $Query = 'SELECT `Group`.*, `ExportGroup`.`Id` AS `ExportGroupId` FROM `Group` LEFT JOIN `ExportGroup` ON `ExportGroup`.`Export`='.$_GET['ExportId'].' AND `Group`=`Group`.`Id`'; 408 410 409 $DbResult = $ System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS X');411 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS X'); 410 412 $DbRow = $DbResult->fetch_row(); 411 413 $PageList = GetPageList($DbRow[0]); … … 435 437 436 438 $Query = 'SELECT * FROM ('.$Query.') AS TX '.$Order['SQL'].$PageList['SQLLimit']; 437 $DbResult = $ System->Database->query($Query);439 $DbResult = $this->System->Database->query($Query); 438 440 while($Group = $DbResult->fetch_assoc()) 439 441 { … … 455 457 function ExportViewOutputFormat() 456 458 { 457 global $ System, $User;459 global $User; 458 460 459 461 $Output = ''; … … 461 463 if(array_key_exists('ExportId', $_GET)) 462 464 { 463 $DbRows = $ System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);465 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 464 466 if($DbRows->num_rows > 0) 465 467 { … … 471 473 if($_POST['Operation'] == 'Save') 472 474 { 473 $ System->Database->query('UPDATE Export SET OutputType='.$_POST['OutputType'].' WHERE Id='.$_GET['ExportId']);475 $this->System->Database->query('UPDATE Export SET OutputType='.$_POST['OutputType'].' WHERE Id='.$_GET['ExportId']); 474 476 $Output .= ShowMessage('Výběr uložen.'); 475 477 } 476 478 477 $DbResult = $ System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);479 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 478 480 $Export = $DbResult->fetch_assoc(); 479 481 … … 486 488 '<br />'; 487 489 } 488 $DbResult = $ System->Database->query('SELECT * FROM `ExportOutputType` ORDER BY `Name`');490 $DbResult = $this->System->Database->query('SELECT * FROM `ExportOutputType` ORDER BY `Name`'); 489 491 while($ExportFormat = $DbResult->fetch_assoc()) 490 492 { … … 499 501 function ExportViewVersion() 500 502 { 501 global $ System, $User;503 global $User; 502 504 503 505 $Output = ''; 504 506 $DisabledInput = array(false => ' disabled="disabled"', true => ''); 505 $DbRows = $ System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);507 $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 506 508 $Export = $DbRows->fetch_assoc(); 507 509 if($User->Licence(LICENCE_USER) and ($User->Id == $Export['User'])) $Editable = true; … … 511 513 if(($_POST['Operation'] == 'Save') and (array_key_exists('ClientVersion', $_POST))) 512 514 { 513 $ System->Database->query('UPDATE `Export` SET `ClientVersion`='.$_POST['ClientVersion'].' WHERE `Id`='.$_GET['ExportId']);515 $this->System->Database->query('UPDATE `Export` SET `ClientVersion`='.$_POST['ClientVersion'].' WHERE `Id`='.$_GET['ExportId']); 514 516 $Output .= ShowMessage('Výběr uložen.'); 515 517 } 516 518 517 $DbResult = $ System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);519 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 518 520 $Export = $DbResult->fetch_assoc(); 519 521 … … 522 524 $Query = 'SELECT `ClientVersion`.* FROM `ExportVersion` LEFT JOIN `ClientVersion` ON `ClientVersion`.`Id`=`ExportVersion`.`ClientVersion` WHERE `ExportType`='.$Export['OutputType']; 523 525 524 $DbResult = $ System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS `X`');526 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS `X`'); 525 527 $DbRow = $DbResult->fetch_row(); 526 528 $PageList = GetPageList($DbRow[0]); … … 549 551 550 552 $Query = 'SELECT * FROM ('.$Query.') AS `TX` '.$Order['SQL'].$PageList['SQLLimit']; 551 $DbResult = $ System->Database->query($Query);553 $DbResult = $this->System->Database->query($Query); 552 554 while($Version = $DbResult->fetch_assoc()) 553 555 { 554 $Output .= '<tr><td><a href="http://www.wowwiki.com/Patch_'.$Version['Version'].'">'.$Version['Version'].'</a></td><td>'.$Version['BuildNumber'].'</td><td>'.HumanDate($Version['ReleaseDate']).'</td><td>'.$Version['Title'].'</td><td>'.RadioButton('ClientVersion', $Version['Id'], $Export['ClientVersion'] == $Version['Id'], '', !$Editable 556 $Output .= '<tr><td><a href="http://www.wowwiki.com/Patch_'.$Version['Version'].'">'. 557 $Version['Version'].'</a></td><td>'.$Version['BuildNumber'].'</td><td>'. 558 HumanDate($Version['ReleaseDate']).'</td><td>'.$Version['Title'].'</td><td>'. 559 RadioButton('ClientVersion', $Version['Id'], $Export['ClientVersion'] == $Version['Id'], '', !$Editable 555 560 ).'</td></tr>'; 556 561 … … 565 570 function ExportViewOutput() 566 571 { 567 global $System;568 569 572 $Output = ''; 570 $DbResult = $ System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);573 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 571 574 $Export = $DbResult->fetch_assoc(); 572 575 if($Export['OutputType'] == '') $Output .= ShowMessage('Nevybrán typ exportu', MESSAGE_CRITICAL); 573 576 else if($Export['ClientVersion'] == '') $Output .= ShowMessage('Export nemá vybránu verzi klienta', MESSAGE_CRITICAL); 574 577 else { 575 $DbResult = $ System->Database->query('SELECT * FROM `ExportOutputType` WHERE `Id`='.$Export['OutputType']);578 $DbResult = $this->System->Database->query('SELECT * FROM `ExportOutputType` WHERE `Id`='.$Export['OutputType']); 576 579 if($DbResult->num_rows > 0) 577 580 { 578 $DbResult = $ System->Database->query('SELECT * FROM `ExportVersion` WHERE (`ExportType`='.$Export['OutputType'].') AND (`ClientVersion`='.$Export['ClientVersion'].')');581 $DbResult = $this->System->Database->query('SELECT * FROM `ExportVersion` WHERE (`ExportType`='.$Export['OutputType'].') AND (`ClientVersion`='.$Export['ClientVersion'].')'); 579 582 if($DbResult->num_rows > 0) 580 583 { 581 $ System->Database->query('UPDATE `Export` SET `UsedCount` = `UsedCount` + 1 WHERE `Id`='.$Export['Id']);584 $this->System->Database->query('UPDATE `Export` SET `UsedCount` = `UsedCount` + 1 WHERE `Id`='.$Export['Id']); 582 585 $Output = ExportOutput($Export['Id'], $Export['OutputType']); 583 586 } else $Output = ShowMessage('Nebyla vybrána požadovaná verze klienta.', MESSAGE_CRITICAL); … … 589 592 function ExportViewStat() 590 593 { 591 global $ System, $Config;592 593 $Export = new Export($ System);594 global $Config; 595 596 $Export = new Export($this->System); 594 597 $Export->Id = $_GET['ExportId']; 595 598 $Export->Init(); … … 603 606 $Query = ''; 604 607 $UnionItems = array(); 605 $DbResult = $ System->Database->query($GroupListQuery);608 $DbResult = $this->System->Database->query($GroupListQuery); 606 609 while($DbRow = $DbResult->fetch_assoc()) 607 610 { … … 619 622 $Query = substr($Query, 0, - 6); 620 623 621 $DbResult = $ System->Database->query('SELECT COUNT(*) FROM ('.$GroupListQuery.') AS `T`');624 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM ('.$GroupListQuery.') AS `T`'); 622 625 $DbRow = $DbResult->fetch_row(); 623 626 $PageList = GetPageList($DbRow[0]); … … 640 643 if(count($UnionItems) > 0) 641 644 { 642 $ID = $ System->Database->query('SELECT *, ROUND(`Translated` / `Total` * 100, 2) AS `Percent` FROM ('.implode(' UNION ALL ', $UnionItems).') AS `C3` '.$Order['SQL'].$PageList['SQLLimit']);645 $ID = $this->System->Database->query('SELECT *, ROUND(`Translated` / `Total` * 100, 2) AS `Percent` FROM ('.implode(' UNION ALL ', $UnionItems).') AS `C3` '.$Order['SQL'].$PageList['SQLLimit']); 643 646 while($Group = $ID->fetch_assoc()) 644 647 { … … 659 662 function ExportView() 660 663 { 661 global $System;662 663 664 $Output = ''; 664 665 if(array_key_exists('ExportId', $_GET) and is_numeric($_GET['ExportId'])) 665 666 { 666 $DbResult = $ System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);667 $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']); 667 668 if($DbResult->num_rows > 0) 668 669 { 669 670 $Export = $DbResult->fetch_assoc(); 670 671 671 $DbResult = $ System->Database->query('SELECT * FROM `User` WHERE `ID`='.$Export['User']);672 $DbResult = $this->System->Database->query('SELECT * FROM `User` WHERE `ID`='.$Export['User']); 672 673 $UserLine = $DbResult->fetch_assoc(); 673 674 $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>'; 674 675 $Output .= ShowTabs(array('Obecné', 'Překladatelé', 'Překlady', 'Jazyky', 'Formát', 'Verze', 'Statistika', 'Výstup')); 675 676 $Output .= '<div id="content">'; 676 if($_SESSION['Tab'] == 0) $Output .= ExportViewGeneral();677 else if($_SESSION['Tab'] == 1) $Output .= ExportViewTranslators();678 else if($_SESSION['Tab'] == 2) $Output .= ExportViewGroups();679 else if($_SESSION['Tab'] == 3) $Output .= ExportViewLanguages();680 else if($_SESSION['Tab'] == 4) $Output .= ExportViewOutputFormat();681 else if($_SESSION['Tab'] == 5) $Output .= ExportViewVersion();682 else if($_SESSION['Tab'] == 6) $Output .= ExportViewStat();683 else if($_SESSION['Tab'] == 7) $Output .= ExportViewOutput();684 else $Output .= ExportViewGeneral();677 if($_SESSION['Tab'] == 0) $Output .= $this->ExportViewGeneral(); 678 else if($_SESSION['Tab'] == 1) $Output .= $this->ExportViewTranslators(); 679 else if($_SESSION['Tab'] == 2) $Output .= $this->ExportViewGroups(); 680 else if($_SESSION['Tab'] == 3) $Output .= $this->ExportViewLanguages(); 681 else if($_SESSION['Tab'] == 4) $Output .= $this->ExportViewOutputFormat(); 682 else if($_SESSION['Tab'] == 5) $Output .= $this->ExportViewVersion(); 683 else if($_SESSION['Tab'] == 6) $Output .= $this->ExportViewStat(); 684 else if($_SESSION['Tab'] == 7) $Output .= $this->ExportViewOutput(); 685 else $Output .= $this->ExportViewGeneral(); 685 686 686 687 $Output .= '</div>'; … … 690 691 } 691 692 692 if(array_key_exists('Action', $_GET)) 693 { 694 if($_GET['Action'] == 'Create') $Output = ExportCreate(); 695 else if($_GET['Action'] == 'CreateFinish') $Output = ExportCreateFinish(); 696 else if($_GET['Action'] == 'View') $Output = ExportView(); 697 else if($_GET['Action'] == 'Delete') $Output = ExportDelete(); 698 else $Output = ExportList(); 699 } else $Output = ExportList(); 700 701 ShowPage($Output); 693 function Show() 694 { 695 if(array_key_exists('Action', $_GET)) 696 { 697 if($_GET['Action'] == 'Create') $Output = $this->ExportCreate(); 698 else if($_GET['Action'] == 'CreateFinish') $Output = $this->ExportCreateFinish(); 699 else if($_GET['Action'] == 'View') $Output = $this->ExportView(); 700 else if($_GET['Action'] == 'Delete') $Output = $this->ExportDelete(); 701 else $Output = $this->ExportList(); 702 } else $Output = $this->ExportList(); 703 return($Output); 704 } 705 } 706 -
trunk/Modules/Export/ProcessAoWoWExport.php
r553 r558 4 4 5 5 include_once('../includes/global.php'); 6 include_once(' export.php');7 include_once(' export_output.php');6 include_once('Export.php'); 7 include_once('ExportOutput.php'); 8 8 9 9 LoadCommandLineParameters(); -
trunk/Modules/Export/ProcessTask.php
r553 r558 5 5 include_once('../includes/global.php'); 6 6 include_once('../includes/zip.lib.php'); 7 include_once(' export.php');8 include_once(' export_output.php');7 include_once('Export.php'); 8 include_once('ExportOutput.php'); 9 9 10 10 //LoadCommandLineParameters(); -
trunk/includes/Version.php
r557 r558 1 1 <?php 2 2 3 $Revision = 55 7; // Subversion revision3 $Revision = 558; // Subversion revision 4 4 $DatabaseRevision = 543; // Database structure revision 5 5 $ReleaseTime = '2013-07-29'; -
trunk/includes/global.php
r556 r558 21 21 include_once(dirname(__FILE__).'/../Modules/Dictionary/Dictionary.php'); 22 22 include_once(dirname(__FILE__).'/../Modules/Import/Import.php'); 23 include_once(dirname(__FILE__).'/../Modules/Export/Export.php'); 23 24 include_once(dirname(__FILE__).'/../Modules/Server/Server.php'); 24 25 include_once(dirname(__FILE__).'/../Modules/ClientVersion/ClientVersion.php'); … … 75 76 $System->ModuleManager->RegisterModule(new ModuleTranslation($System)); 76 77 $System->ModuleManager->RegisterModule(new ModuleImport($System)); 78 $System->ModuleManager->RegisterModule(new ModuleExport($System)); 77 79 $System->ModuleManager->RegisterModule(new ModuleServer($System)); 78 80 $System->ModuleManager->RegisterModule(new ModuleClientVersion($System)); -
trunk/includes/system.php
r556 r558 50 50 'Hint' => 'Stav dokončení překládů', 51 51 'Link' => $this->Link('/statistic.php'), 52 'Permission' => LICENCE_ANONYMOUS,53 'Icon' => '',54 ),55 array(56 'Title' => 'Exporty',57 'Hint' => 'Zde si můžete stáhnout přeložené texty',58 'Link' => $this->Link('/export/'),59 52 'Permission' => LICENCE_ANONYMOUS, 60 53 'Icon' => '',
Note:
See TracChangeset
for help on using the changeset viewer.