Changeset 61 for trunk/download.php
- Timestamp:
- Feb 4, 2009, 9:51:34 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/download.php
r60 r61 10 10 include('includes/zip.lib.php'); 11 11 include('export.php'); 12 12 include('addon/make.php'); 13 13 14 14 function CheckBox($Name, $Checked = false) … … 42 42 } 43 43 44 switch(@$_GET['action']) 44 function CreateZipFromDir(&$Zip, $Path, $ZipPath) 45 { 46 //echo($Path.'<br />'); 47 $FileList = scandir($Path); 48 foreach($FileList as $FileName) 49 { 50 if(file_exists($Path.$FileName) and ($FileName != '.') and ($FileName != '..')) 51 { 52 //echo($Path.$FileName.'<br />'); 53 if(is_dir($Path.$FileName)) CreateZipFromDir($Zip, $Path.$FileName.'/', $ZipPath.$FileName.'/'); 54 else $Zip->addFile(file_get_contents($Path.$FileName), $ZipPath.$FileName); 55 } 56 } 57 } 58 59 if(!array_key_exists('action', $_GET)) $_GET['action'] = ''; 60 switch($_GET['action']) 45 61 { 46 62 case 'result': … … 51 67 if(function_exists('gzcompress')) 52 68 { 53 $SaveFilename = 'tmp/SqlTranslate.zip'; 54 $SQLFilename = 'tmp/SqlTranslate.sql'; 69 $TempDir = 'tmp/'.$_SESSION['User'].'/'; 70 if(!file_exists($TempDir)) mkdir($TempDir, 0777, true); 71 $SaveFilename = $TempDir.'CzWoW_SQL.zip'; 72 $SQLFilename = $TempDir.'CzWoW_SQL.sql'; 55 73 $BufferZip = Export($ExportSetting); 56 74 $ZipFile = new zipfile(); 57 75 $ZipFile->addFile($BufferZip, $SQLFilename); 58 76 $Buffer = $ZipFile->file(); 59 60 // echo $Buffer.'<br><br><br>'; 61 $FileHandle = fopen($SaveFilename, 'w'); 62 $WriteResult = fwrite($FileHandle, $Buffer); 63 fclose($FileHandle); 64 // header("Location: ".$save_filename); 77 file_put_contents($SaveFilename, $Buffer); 65 78 } else echo('Funkce pro tvorbu Zip souboru není podporována!'); 66 79 echo('<script type="text/javascript" language="JavaScript" charset="utf-8">'. … … 92 105 } else echo('Nemáte oprávnění.'); 93 106 break; 107 case 'Addon': 108 if(function_exists('gzcompress')) 109 { 110 $TempDir = 'tmp/'.$_SESSION['User'].'/CzWoW/'; 111 echo('Generování addonu...<br />'); 112 MakeAddon($ExportSetting); 113 $SaveFilename = 'tmp/'.$_SESSION['User'].'/CzWoW_Addon.zip'; 114 $Zip = new zipfile(); 115 CreateZipFromDir($Zip, $TempDir, 'CzWoW/'); 116 $Zip->addFile(file_get_contents('addon/CzWoW/OptionsFrame.xml'), 'CzWoW/OptionsFrame.xml'); 117 $Zip->addFile(file_get_contents('addon/CzWoW/CzWoW.xml'), 'CzWoW/CzWoW.xml'); 118 $Zip->addFile(file_get_contents('addon/CzWoW/CzWoW.toc'), 'CzWoW/CzWoW.toc'); 119 $Zip->addFile(file_get_contents('addon/CzWoW/CzWoW.lua'), 'CzWoW/CzWoW.lua'); 120 $Zip->addFile(file_get_contents('addon/CzWoW/GameMenuFrame.xml'), 'CzWoW/GameMenuFrame.xml'); 121 $Zip->addFile(file_get_contents('addon/CzWoW/Localization.lua'), 'CzWoW/Localization.lua'); 122 $Zip->addFile(file_get_contents('addon/ProffBot/ProffBot.toc'), 'ProffBot/ProffBot.toc'); 123 $Zip->addFile(file_get_contents('addon/ProffBot/ProffBot.xml'), 'ProffBot/ProffBot.xml'); 124 $Zip->addFile(file_get_contents('addon/ProffBot/ProffBot.lua'), 'ProffBot/ProffBot.lua'); 125 $Buffer = $Zip->file(); 126 file_put_contents($SaveFilename, $Buffer); 127 echo('Hotovo<br /><br />'); 128 } else echo('Funkce pro tvorbu Zip souboru není podporována!'); 129 echo('<script type="text/javascript" language="JavaScript" charset="utf-8">'. 130 'setTimeout("parent.location.href=\''.$SaveFilename.'\'", 1000)'. 131 '</script>'); 132 133 echo('Pokud nezačalo stahování, soubor by mělo jít stáhnout pomocí tohoto odkazu:'. 134 '<a href="'.$SaveFilename.'">CzWoW_Addon.zip</a><br />'. 135 'Pokud se vám zdá, že filtr na export nefunguje, vymažte si vyrovnávací paměť prohlížeče a zkuste stáhnout soubor znovu.'); 136 break; 94 137 } 95 138 WriteLog('Generování SQL výstupu: Typ exportu: <b>'.$ExportSetting['Export'].'</b>, Diakritika: <b>'.$ExportSetting['Diacritics'].'</b>', 2); … … 103 146 echo('<strong>Krok 3. - Typ výstupu</strong><br /><br />'); 104 147 echo('<form action="?action=result" method="post">'. 105 '<table width="100%"><tr><td >'.148 '<table width="100%"><tr><td width="50%">'. 106 149 '<fieldset><legend>Forma výstupu</legend>'. 107 150 RadioButton('Export', 'Zip', $ExportSetting['Export'] == 'Zip').'ZIP soubor<br />'. 108 //RadioButton('Export', 'Addon', $ExportSetting['Export'] == 'Addon').'WoW klientaddon<br />'.151 RadioButton('Export', 'Addon', $ExportSetting['Export'] == 'Addon').'WoW klient překládací addon<br />'. 109 152 RadioButton('Export', 'Display', $ExportSetting['Export'] == 'Display').'Přímo zobrazit<br />'); 110 153 if(Licence(LICENCE_ADMIN))
Note:
See TracChangeset
for help on using the changeset viewer.