Changeset 68
- Timestamp:
- Feb 6, 2009, 8:41:20 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/download.php
r67 r68 43 43 $ExportSetting = unserialize($_SESSION['ExportSetting']); 44 44 } 45 if(!isset($ExportSetting)) $ExportSetting = array('Diacritics' => 1, 'language-cz' => 1, 46 'language-sk' => 0, 'language-other' => 0, 'users-selection' => array(), 'users-order' => ''); 47 if(!array_key_exists('users-selection', $ExportSetting)) $ExportSetting['users-selection'] = array(); 45 if(!isset($ExportSetting['users-selection'])) $ExportSetting['users-selection'] = array(); 46 if(!isset($ExportSetting['Diacritics'])) $ExportSetting['Diacritics'] = 1; 47 if(!isset($ExportSetting['language-cz'])) $ExportSetting['language-cz'] = 1; 48 if(!isset($ExportSetting['language-sk'])) $ExportSetting['language-sk'] = 1; 49 if(!isset($ExportSetting['language-other'])) $ExportSetting['language-other'] = 1; 50 if(!isset($ExportSetting['users-order'])) $ExportSetting['users-order'] = ''; 51 if(!isset($ExportSetting['Export'])) $ExportSetting['Export'] = 'Addon'; 52 if(!isset($ExportSetting['groups'])) $ExportSetting['groups'] = array(); 48 53 49 54 function CreateZipFromDir(&$Zip, $Path, $ZipPath) … … 69 74 switch($ExportSetting['Export']) 70 75 { 71 case ' Zip':76 case 'MangosSQLCompressed': 72 77 if(function_exists('gzcompress')) 73 78 { … … 76 81 $SaveFilename = $TempDir.'CzWoW_SQL.zip'; 77 82 $SQLFilename = 'CzWoW_SQL.sql'; 78 $BufferZip = Export ($ExportSetting);83 $BufferZip = ExportToMangosSQL($ExportSetting); 79 84 $ZipFile = new zipfile(); 80 85 $ZipFile->addFile($BufferZip, $SQLFilename); … … 90 95 '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.'); 91 96 break; 92 case ' Display':97 case 'MangosSQLDirect': 93 98 echo('Vygenerovaný SQL kód: <br /><pre class="SQLCode">'); 94 echo(htmlspecialchars(Export($ExportSetting))); 99 echo(htmlspecialchars(ExportToMangosSQL($ExportSetting))); 100 echo('</pre>'); 101 break; 102 case 'XMLCompressed': 103 if(function_exists('gzcompress')) 104 { 105 $TempDir = 'tmp/'.$_SESSION['User'].'/'; 106 if(!file_exists($TempDir)) mkdir($TempDir, 0777, true); 107 $SaveFilename = $TempDir.'CzWoW_XML.zip'; 108 $SQLFilename = 'CzWoW_XML.sql'; 109 $BufferZip = ExportToXML($ExportSetting); 110 $ZipFile = new zipfile(); 111 $ZipFile->addFile($BufferZip, $SQLFilename); 112 $Buffer = $ZipFile->file(); 113 file_put_contents($SaveFilename, $Buffer); 114 } else echo('Funkce pro tvorbu Zip souboru není podporována!'); 115 echo('<script type="text/javascript" language="JavaScript" charset="utf-8">'. 116 'setTimeout("parent.location.href=\''.$SaveFilename.'\'", 1000)'. 117 '</script>'); 118 119 echo('Pokud nezačalo stahování, soubor by mělo jít stáhnout pomocí tohoto odkazu: '. 120 '<a href="'.$SaveFilename.'">CzWoW_SQL.zip</a><br />'. 121 '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.'); 122 break; 123 case 'XMLDirect': 124 echo('Vygenerované XML: <br /><pre class="SQLCode">'); 125 echo(htmlspecialchars(ExportToXML($ExportSetting))); 95 126 echo('</pre>'); 96 127 break; … … 98 129 if(Licence(LICENCE_ADMIN)) 99 130 { 100 $Buffer = Export ($ExportSetting);131 $Buffer = ExportToMangosSQL($ExportSetting); 101 132 $Database->SelectDatabase($Config['Database']['DatabaseMangos']); 102 133 $BufferArray = explode("\n", $Buffer); … … 139 170 '<a href="'.$SaveFilename.'">CzWoW_Addon.zip</a><br />'. 140 171 '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.'); 172 echo('<br /><strong>Použití ve hře</strong><br />Menu addonu ve hře vyvoléte povelem /czwow.'); 141 173 break; 142 174 } … … 153 185 '<table width="100%"><tr><td width="50%">'. 154 186 '<fieldset><legend>Forma výstupu</legend>'. 155 RadioButton('Export', 'Zip', $ExportSetting['Export'] == 'Zip').'ZIP soubor<br />'. 156 RadioButton('Export', 'Addon', $ExportSetting['Export'] == 'Addon').'WoW klient překládací addon<br />'. 157 RadioButton('Export', 'Display', $ExportSetting['Export'] == 'Display').'Přímo zobrazit<br />'); 187 RadioButton('Export', 'MangosSQLDirect', $ExportSetting['Export'] == 'MangosSQLDirect').'MaNGOS SQL - přímo zobrazit<br />'. 188 RadioButton('Export', 'MangosSQLCompressed', $ExportSetting['Export'] == 'MangosSQLCompressed').'MaNGOS SQL - komprimovaný soubor<br />'. 189 RadioButton('Export', 'XMLDirect', $ExportSetting['Export'] == 'XMLDirect').'XML - přímo zobrazit<br />'. 190 RadioButton('Export', 'XMLCompressed', $ExportSetting['Export'] == 'XMLCompressed').'XML - komprimovaný soubor<br />'. 191 RadioButton('Export', 'Addon', $ExportSetting['Export'] == 'Addon').'Addon - komprimovaný soubor<br />'); 158 192 if(Licence(LICENCE_ADMIN)) 159 193 echo(RadioButton('Export', 'Server', $ExportSetting['Export'] == 'Server').'Poslat přímo na server (pouze admin)<br />'); -
trunk/export.php
r66 r68 1 1 <?php 2 2 3 function Export ($Setting)3 function ExportToMangosSQL($Setting) 4 4 { 5 5 global $Database, $Config, $TranslationTree; … … 24 24 $SelectedUsers = substr($SelectedUsers, 1); 25 25 26 if($SelectedUsers == '') $Where = 0; 27 else $Where = 'ID IN ('.$SelectedUsers.')'; 28 26 29 $UserNames = ''; 27 $DbResult = $Database->SQLCommand( "SELECT user FROM `user` WHERE ID IN (".$SelectedUsers.')');30 $DbResult = $Database->SQLCommand('SELECT user FROM `user` WHERE '.$Where); 28 31 while($DbRow = mysql_fetch_assoc($DbResult)) 29 32 $UserNames .= ','.$DbRow['user']; … … 78 81 } 79 82 80 83 function ExportToXML($Setting) 84 { 85 global $Database, $Config, $TranslationTree; 86 87 $AnoNe = array('Ne', 'Ano'); 88 if($_SESSION['UserID'] != '') 89 { 90 $DbResult = $Database->SQLCommand("SELECT user FROM `user` WHERE ID=".$_SESSION['UserID']); 91 $User = mysql_fetch_assoc($DbResult); 92 } else $User = array('user' => 'Neznámý'); 93 94 $WhereLang = ''; 95 if($Setting['language-cz']) $WhereLang .= " OR (Language = 1)"; 96 if($Setting['language-sk']) $WhereLang .= " OR (Language = 2)"; 97 if($Setting['language-other']) $WhereLang .= " OR (Language = 3)"; 98 if($WhereLang == '') $WhereLang = 1; 99 else $WhereLang = '('.substr($WhereLang, 4).')'; 100 101 $SelectedUsers = ''; 102 foreach($Setting['users-selection'] as $Item) 103 $SelectedUsers .= ','.$Item; 104 $SelectedUsers = substr($SelectedUsers, 1); 105 106 if($SelectedUsers == '') $Where = 0; 107 else $Where = 'ID IN ('.$SelectedUsers.')'; 108 109 $UserNames = ''; 110 $DbResult = $Database->SQLCommand('SELECT user FROM `user` WHERE '.$Where); 111 while($DbRow = mysql_fetch_assoc($DbResult)) 112 $UserNames .= ','.$DbRow['user']; 113 $UserNames = substr($UserNames, 1); 114 115 if($SelectedUsers == '') $WhereUsers = 1; 116 else $WhereUsers = '(User IN ('.$SelectedUsers.'))'; 117 118 $Buffer = '<?xml version="1.0" encoding="utf-8"?>'."\n". 119 "<document>\n". 120 " <meta>\n". 121 " <projecturl>".$Config['Web']['BaseURL']."</projecturl>\n". 122 " <time>".date('r')."</time>\n". 123 " <diacritics mode=".'"'.$Setting['Diacritics'].'"'." />\n". 124 " <author>".$User['user']."</author>\n". 125 " <contributors>\n"; 126 foreach(explode(',', $UserNames) as $UserName) 127 $Buffer .= " <user>".$UserName."</user>\n"; 128 $Buffer .= 129 " </contributors>\n". 130 " </meta>\n". 131 " <translation>\n"; 132 133 foreach($TranslationTree as $Group) 134 if(in_array($Group['Id'], $Setting['groups'])) 135 { 136 if($Group['MangosTable'] == '') 137 { 138 $Group['MangosTable'] = $Group['TablePrefix']; 139 $Group['MangosTableIndex'] = 'entry'; 140 } 141 $Query = 'SELECT *,(SELECT user FROM user WHERE user.ID=T.User) as UserName FROM (SELECT * FROM '.$Group['TablePrefix'].' WHERE (Complete = 1) AND '.$WhereLang.' AND '.$WhereUsers.' ORDER BY FIELD(User, '.$SelectedUsers.')) AS T GROUP BY T.entry'; 142 //echo($Query); 143 $Buffer .= ' <group id="'.$Group['Id'].'" name="'.$Group['TablePrefix'].'">'."\n"; 144 $ID = $Database->SQLCommand($Query); 145 while($Line = mysql_fetch_array($ID)) 146 { 147 $Buffer .= ' <item id="'.$Line['entry'].'" user="'.$Line['UserName'].'">'."\n"; 148 $Values = ''; 149 foreach($Group['Items'] as $GroupItem) 150 { 151 if($GroupItem['MangosColumn'] == '') $GroupItem['MangosColumn'] = $GroupItem['Column']; 152 if($Line[$GroupItem['Column']] != '') 153 $Buffer .= ' <text index="'.$GroupItem['Id'].'" name="'.$GroupItem['Column'].'">'.addslashes($Line[$GroupItem['Column']]).'</text>'."\n"; 154 } 155 $Buffer .= " </item>\n"; 156 } 157 $Buffer .= " </group>\n"; 158 } 159 if($Setting['Diacritics'] != 1) $Buffer = utf2ascii($Buffer); 160 $Buffer .= " </translation>\n". 161 "</document>"; 162 return($Buffer); 163 } 81 164 ?> -
trunk/readme.txt
r43 r68 1 1) 1 1) Zobrazení bannerů 2 2 3 3 V podsložce banners je použit soubor .htaccess pro nastavení vykonání php skriptu pro generování obrázků a záznamu odkazovaných adres. … … 11 11 12 12 13 2) Práva pro zápis 14 15 U složky tmp je nutné nastavit práva pro web server pro zápis. V této složce se vytváří dočasné soubory především při generování exportů ke stažení. 16
Note:
See TracChangeset
for help on using the changeset viewer.