Changeset 59
- Timestamp:
- Feb 3, 2009, 9:48:32 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 2 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/download.php
r49 r59 1 1 <?php 2 2 3 session_start(); 4 5 if(!array_key_exists('ExportSetting', $_SESSION)) 6 $_SESSION['ExportSetting'] = $_COOKIE['ExportSetting']; 7 8 setcookie('ExportSetting', $_SESSION['ExportSetting']); 3 9 include('includes/global.php'); 4 5 if(array_key_exists('Type', $_POST)) 6 { 7 include('includes/zip.lib.php'); 8 include('export.php'); 10 include('includes/zip.lib.php'); 11 include('export.php'); 12 13 14 function CheckBox($Name, $Checked = false) 15 { 16 if($Checked) $Checked = ' checked="1"'; else $Checked = ''; 17 return('<input type="checkbox" value="1" name="'.$Name.'"'.$Checked.' />'); 18 } 19 20 function RadioButton($Name, $Value, $Checked = false) 21 { 22 if($Checked) $Checked = ' checked="1"'; else $Checked = ''; 23 return('<input type="radio" name="'.$Name.'" value="'.$Value.'"'.$Checked.' />'); 24 } 25 26 function SelectOption($Name, $Text, $Selected = false) 27 { 28 if($Selected) $Selected = ' selected="1"'; else $Selected = ''; 29 return('<option type="checkbox" value="'.$Name.'"'.$Selected.'/>'.$Text.'</option>'); 30 } 31 32 if(array_key_exists('UserID', $_SESSION) and ($_SESSION['UserID'] != '')) 33 { 34 $DbResult = $Database->SQLCommand('SELECT ExportSetting FROM user WHERE ID='.$_SESSION['UserID']); 35 $DbRow = mysql_fetch_assoc($DbResult); 36 $ExportSetting = unserialize($DbRow['ExportSetting']); 37 38 //print_r($_POST); 9 39 } else 40 { 41 $ExportSetting = unserialize($_SESSION['ExportSetting']); 42 } 43 44 switch(@$_GET['action']) 45 { 46 case 'result': 47 $ExportSetting['Export'] = @$_POST['Export']; 48 switch($ExportSetting['Export']) 49 { 50 case 'Zip': 51 if(function_exists('gzcompress')) 52 { 53 $SaveFilename = 'tmp/SqlTranslate.zip'; 54 $SQLFilename = 'tmp/SqlTranslate.sql'; 55 $BufferZip = Export($ExportSetting); 56 $ZipFile = new zipfile(); 57 $ZipFile->addFile($BufferZip, $SQLFilename); 58 $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); 65 } else echo('Funkce pro tvorbu Zip souboru není podporována!'); 66 echo('<script type="text/javascript" language="JavaScript" charset="utf-8">'. 67 'setTimeout("parent.location.href=\''.$SaveFilename.'\'", 1000)'. 68 '</script>'); 69 70 echo('Pokud nezačalo stahování, soubor by mělo jít stáhnout pomocí tohoto odkazu:'. 71 '<a href="'.$SaveFilename.'">'.$SaveFilename.'</a><br />'. 72 '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.'); 73 break; 74 case 'Display': 75 echo('Vygenerovaný SQL kód: <br /><pre class="SQLCode">'); 76 echo(htmlspecialchars(Export($ExportSetting))); 77 echo('</pre>'); 78 break; 79 case 'Server': 80 if(Licence(LICENCE_ADMIN)) 81 { 82 $Buffer = Export($ExportSetting); 83 $Database->SelectDatabase($Config['Database']['DatabaseMangos']); 84 $BufferArray = explode("\n", $Buffer); 85 echo('Přenášení dat do serveru...<br />'); 86 foreach($BufferArray as $Line) 87 { 88 $Database->SQLCommand($Line); 89 echo('.'); 90 } 91 echo("<br />Hotovo<br />"); 92 } else echo('Nemáte oprávnění.'); 93 break; 94 } 95 WriteLog('Generování SQL výstupu: Typ exportu: <b>'.$ExportSetting['Export'].'</b>, Diakritika: <b>'.$ExportSetting['Diacritics'].'</b>', 2); 96 break; 97 case 'output': 98 if(array_key_exists('groups', $_POST)) $ExportSetting['groups'] = $_POST['groups']; 99 $ExportSetting['Diacritics'] = array_key_exists('Diacritics', $_POST); 100 $ExportSetting['language-cz'] = array_key_exists('language-cz', $_POST); 101 $ExportSetting['language-sk'] = array_key_exists('language-sk', $_POST); 102 $ExportSetting['language-other'] = array_key_exists('language-other', $_POST); 103 echo('<strong>Krok 3. - Typ výstupu</strong><br /><br />'); 104 echo('<form action="?action=result" method="post">'. 105 '<table width="100%"><tr><td>'. 106 '<fieldset><legend>Forma výstupu</legend>'. 107 RadioButton('Export', 'Zip', $ExportSetting['Export'] == 'Zip').'ZIP soubor<br />'. 108 //RadioButton('Export', 'Addon', $ExportSetting['Export'] == 'Addon').'WoW klient addon<br />'. 109 RadioButton('Export', 'Display', $ExportSetting['Export'] == 'Display').'Přímo zobrazit<br />'); 110 if(Licence(LICENCE_ADMIN)) 111 echo(RadioButton('Export', 'Server', $ExportSetting['Export'] == 'Server').'Poslat přímo na server (pouze admin)<br />'); 112 //echo(' 113 echo('</fieldset><br /></td><td>Zvolte způsob, jakým mají být získána výstupní SQL data. V případě přímého zobrazení může být do vašeho prohlížeče přenášeno vysoké množství data což může vést k jeho přetížení.</td></tr></table>'); 114 echo('<br /><input type="submit" value="Dokončit" />'); 115 echo('</form>'); 116 break; 117 case 'parameters': 118 $ExportSetting['users-order'] = $_POST['users-order']; 119 $ExportSetting['users-selection'] = array(); 120 $UsersList = explode(',', $_POST['users-order']); 121 foreach($UsersList as $Index => $Item) 122 { 123 if(array_key_exists('user_'.$Item, $_POST)) $ExportSetting['users-selection'][] = $Item; 124 } 125 //if(array_key_exists('users', $_POST)) $ExportSetting['users'] = $_POST['users']; 126 echo('<strong>Krok 2. - Volba parametrů</strong><br /><br />'); 127 echo('<form action="?action=output" method="post">'); 128 echo('<table width="100%"><tr><td>'); 129 echo('<fieldset><legend>Jazyk</legend>'. 130 CheckBox('Diacritics', $ExportSetting['Diacritics'] == 1).'Včetně diakritiky<br /><br />'); 131 //echo('<input type="checkbox" name="Use" checked="true">Přidat výchovýběr databáze.<br />'); 132 133 echo(CheckBox('language-cz', $ExportSetting['language-cz'] == 1).'Český překlad<br />'. 134 CheckBox('language-sk', $ExportSetting['language-sk'] == 1).'Slovenský překlad<br />'. 135 CheckBox('language-other', $ExportSetting['language-other'] == 1).'Jiné jazyky<br />'); 136 echo('</fieldset><br /></td><td>Vyberte jaké jazyky se mají uvažovat při exportu.</td></tr><tr><td><fieldset><legend>Skupiny textů</legend>'); 137 echo('<select name="groups[]" size="15" style="width: 400px;" multiple="1">'); 138 foreach($TranslationTree as $Group) 139 if($Group['TablePrefix'] != '') 140 echo(SelectOption($Group['Id'], $Group['Name'].' ('.$Group['TablePrefix'].')', in_array($Group['Id'], $ExportSetting['groups']))); 141 142 echo('</select></fieldset><br /></td><td>Vyberte skupiny textů, z kterých bude sestaven export. Přidržením CTRL nebo SHIFT můžete provádět výběr více položek.</td></tr></table><input type="submit" value="Pokračovat" />'); 143 echo('</form>'); 144 break; 145 default: 146 echo('<strong>Krok 1. - Výběr překladatelů</strong><br /><br />'); 147 echo('<script type="text/javascript" src="style/jquery.js"></script> 148 <script type="text/javascript" src="style/jquery-ui.js"></script> 149 <script type="text/javascript"> 150 $(document).ready(function() 151 { 152 $("#users-table").sortable({ items: "tr", sort: SortComplete }); 153 $("#users-order").val($("#users-table").sortable(\'toArray\')); 154 }); 155 156 function SortComplete() 157 { 158 $("#users-order").val($("#users-table").sortable(\'toArray\')); 159 } 160 </script>'); 161 echo('<form action="?action=parameters" method="post">'); 162 echo('<table><tr><td>'. 163 '<table class="BaseTable" id="users-table" width="100%"><tr><th>Jméno</th><th>Překladů</th><th></th></tr>'); 164 $Query = 'SELECT T.user, T.ID, T.TranslatedCount FROM (SELECT user, ID, ('; 165 foreach($TranslationTree as $Group) 166 if($Group['TablePrefix'] != '') 167 $Query .= '(SELECT COUNT(*) FROM '.$Group['TablePrefix'].' WHERE (user = user.ID) AND (Complete = 1) AND (Language <> 0)) + '; 168 $Query .= ' 0) AS TranslatedCount FROM `user` ORDER BY user) AS T WHERE T.TranslatedCount > 0 ORDER BY T.TranslatedCount DESC'; 169 //echo($Query); 170 $ID = $Database->SQLCommand($Query); 171 172 // Rebuild user order list 173 $Users = array(); 174 while($Line = mysql_fetch_array($ID)) $Users[$Line['ID']] = $Line; 175 $UsersOrder = explode(',', $ExportSetting['users-order']); 176 foreach($Users as $User) 177 if(!in_array($User['ID'], $UsersOrder)) $UsersOrder[] = $User['ID']; 178 foreach($UsersOrder as $Index => $UserId) 179 if(!array_key_exists($UserId, $Users)) unset($UsersOrder[$Index]); 180 $ExportSetting['users-order'] = implode(',', $UsersOrder); 181 182 //print_r($UsersOrder); 183 // Show ordered user list 184 foreach($UsersOrder as $UserId) 185 echo('<tr id="'.$UserId.'"><td>'.$Users[$UserId]['user'].'</td><td>'.$Users[$UserId]['TranslatedCount']. 186 '</td><td>'.CheckBox('user_'.$UserId, in_array($UserId, $ExportSetting['users-selection'])).'</td></tr>'); 187 echo('</table></td><td valign="top">Zvolte ze seznamu uživatele, od kterých chcete načítat překlady a upravte jejich pořadí, takže od uživatelů výše budou brány překlady přednostně.<br />'. 188 'Řádky v tabulce můžete přesouvat metodou uchop a táhni.'. 189 '</td></tr></table>'. 190 '<div><input name="users-order" id="users-order" size="100" type="hidden" /><br />'); 191 echo('<input type="submit" value="Pokračovat" /></div>'); 192 echo('</form>'); 193 break; 194 } 195 196 /* 10 197 { 11 198 echo('<div style="border: 1px dotted black; padding: 0px 5px 5px 5px;"> … … 30 217 <form action="download.php" method="POST"> 31 218 <table border="1" cellpadding="1" cellspacing="0"> 32 <tr><th>Sql</th><th>Filtr</th><th>Jazyk</th><th>Texty</th></tr> 33 <tr><td> 34 <input type="radio" name="Export" value="Zip" checked="true"> Exportovat do zip<br /> 35 <input type="radio" name="Export" value="Display"> Export zobrazit<br />'); 36 if(Licence(LICENCE_ADMIN)) 37 { 38 echo('<input type="radio" name="Export" value="Mangos" /> Import na server (pouze admin)<br />'); 39 } 40 echo('<br /> 41 <input type="radio" name="Type" value="Insert" /> Insert (zatím nefunguje)<br /> 42 <input type="radio" name="Type" value="Update" checked="true" /> Update <br /> 43 <br /> 44 <input type="checkbox" name="Use" checked="true"> Přidat Use mangos <br /> 45 <br />'); 46 echo('</td><td> 47 <input type="text" name="NumberVote" value="3" size="1" /> Počet nutných hlasů <br /> 48 <input type="text" name="Vote" value="4" size="1" /> Známka lepší nebo stejná jak <br /> 49 <br /> 50 <select name="users[]" size="10" multiple>'); 51 52 // multiple="multiple" 53 $Query = 'SELECT user,ID FROM `user` WHERE '; 54 foreach($TranslationTree as $Group) 55 if($Group['TablePrefix'] != '') 56 $Query .= 'EXISTS(SELECT 1 FROM '.$Group['TablePrefix'].' WHERE user = user.ID) OR '; 57 $Query .= ' 0 ORDER BY user'; 58 $ID = $Database->SQLCommand($Query); 59 while ($Line = mysql_fetch_array($ID)) 60 echo('<option value="'.$Line['ID'].'">'.$Line['user'].'</option>'); 61 62 echo('</select><br /> Exportovat pouze od těchto uživatalů<br /> 63 Vybrat více uživatelů můžete pomocí CTRL+click 64 65 </td><td> 66 <input type="checkbox" name="Diacritical" checked="true" /> Včetně diakritiky <br> 67 <br /> 68 <input type="checkbox" name="CZ" checked="true" /> Český překlad <br /> 69 <input type="checkbox" name="SK" checked="true" /> Slovenský překlad <br /> 70 <input type="checkbox" name="OtherLanguage" /> Jiné jazyky <br /> 71 </td><td>'); 72 foreach($TranslationTree as $Group) 73 if($Group['TablePrefix'] != '') 74 echo('<input type="checkbox" name="'.$Group['TablePrefix'].'" checked="true" /> '.$Group['Name'].'<br />'); 75 76 echo('</td></tr> 77 </table> 78 <br /><input type="submit" value="Generovat SQL soubor překladu (Stažení)" /> 79 </form><br /> 219 80 220 <b>Český překlad MaNGOS Minimanageru:</b><br /> 81 221 - Stránky projektu: <a href="http://sourceforge.net/projects/mmfpm/">http://sourceforge.net/projects/mmfpm/</a><br /> … … 86 226 <br />'); 87 227 } 228 */ 229 230 if(array_key_exists('UserID', $_SESSION) and ($_SESSION['UserID'] != '')) 231 $Database->SQLCommand('UPDATE user SET ExportSetting = "'.addslashes(serialize($ExportSetting)).'" WHERE ID='.$_SESSION['UserID']); 232 else $_SESSION['ExportSetting'] = serialize($ExportSetting); 88 233 234 //print_r($ExportSetting); 235 89 236 ShowFooter(); 90 237 ?> -
trunk/export.php
r49 r59 1 1 <?php 2 2 3 function WithOutDiacritical($teststring)3 function utf2ascii($text) 4 4 { 5 $teststring = StrTr($teststring, "áäčďéěëíňóöřšťúůüýžÁÄČĎÉĚËÍŇÓÖŘŠŤÚŮÜÝŽ", "aacdeeeinoorstuuuyzAACDEEEINOORSTUUUYZ"); 6 return $teststring; 5 $return = Str_Replace( 6 Array("á","č","ď","é","ě","í","ľ","ň","ó","ř","š","ť","ú","ů","ý","ž","Á","Č","Ď","É","Ě","Í","Ľ","Ň","Ó","Ř","Š","Ť","Ú","Ů","Ý","Ž") , 7 Array("a","c","d","e","e","i","l","n","o","r","s","t","u","u","y","z","A","C","D","E","E","I","L","N","O","R","S","T","U","U","Y","Z") , 8 $text); 9 //$return = Str_Replace(Array(" ", "_"), "-", $return); //nahradí mezery a podtržítka pomlčkami 10 //$return = Str_Replace(Array("(",")",".","!",",","\"","'"), "", $return); //odstraní ().!,"' 11 //$return = StrToLower($return); // velká písmena nahradí malými. 12 return($return); 7 13 } 8 14 9 $Diacritical = @$_POST['Diacritical']; 10 if(array_key_exists('CZ', $_POST)) $CZ = $_POST['CZ']; 11 if(array_key_exists('SK', $_POST)) $SK = $_POST['SK']; 12 if(array_key_exists('OtherLanguage', $_POST)) $OtherLanguage = $_POST['OtherLanguage']; 13 if(array_key_exists('Use', $_POST)) $Use = $_POST['Use'];14 $Type = $_POST['Type']; 15 $Export = $_POST['Export']; 16 $NumberVote = $_POST['NumberVote'];17 $Vote = $_POST['Vote'];18 $users = @$_REQUEST['users'];15 function Export($Setting) 16 { 17 global $Database, $Config, $TranslationTree; 18 19 $AnoNe = array('Ne', 'Ano'); 20 if($_SESSION['UserID'] != '') 21 { 22 $DbResult = $Database->SQLCommand("SELECT user FROM `user` WHERE ID=".$_SESSION['UserID']); 23 $User = mysql_fetch_assoc($DbResult); 24 } else $User = array('user' => 'Neznámý'); 19 25 20 $Buffer = ''; 21 $BufferHeader = ' 22 -- Generováno projektem wowpreklad.zdechov.net 23 -- =========================================== 24 -- 25 -- Web projektu: '.$Config['Web']['BaseURL'].' 26 -- E-mail: '.$Config['Web']['AdminEmail'].' 27 -- Datum exportu: '.date("m.d.y H:i").' 28 -- Znaková sada: '.$Config['Database']['Charset'].' / '.$Config['Web']['Charset'].' 29 -- Diakritika: '.$Diacritical.' 30 -- Počet nutných hlasů: '.$NumberVote.' 31 -- Známka vyšší jak: '.$Vote.' 32 -- Tabulky:'."\n"; 33 foreach($TranslationTree as $Group) 34 if($Group['TablePrefix'] != '') 35 $BufferHeader .= '-- '.$Group['Name'].': '.@$_POST[$Group['TablePrefix']]."\n"; 36 $BufferHeader .= "\n"; 37 38 if(isset($Use)) $BufferHeader .= "\nUSE `mangos`;\n\n"; 26 $WhereLang = ''; 27 if($Setting['language-cz']) $WhereLang .= " OR (Language = 1)"; 28 if($Setting['language-sk']) $WhereLang .= " OR (Language = 2)"; 29 if($Setting['language-other']) $WhereLang .= " OR (Language = 3)"; 30 if($WhereLang == '') $WhereLang = 1; 31 else $WhereLang = '('.substr($WhereLang, 4).')'; 39 32 40 $WhereLang = ''; 41 if(isset($CZ)) $WhereLang .= " Language = '1'"; 42 if(isset($SK)) 43 { 44 if($WhereLang <> '') 45 $WhereLang .= " OR Language = '2'"; 46 else 47 $WhereLang .= "Language = '2'"; 33 $SelectedUsers = ''; 34 foreach($Setting['users-selection'] as $Item) 35 $SelectedUsers .= ','.$Item; 36 $SelectedUsers = substr($SelectedUsers, 1); 37 38 $DbResult = $Database->SQLCommand("SELECT user FROM `user` WHERE ID IN (".$SelectedUsers.')'); 39 while($DbRow = mysql_fetch_assoc($DbResult)) 40 $UserNames .= ','.$DbRow['user']; 41 $UserNames = substr($UserNames, 1); 42 43 if($SelectedUsers == '') $WhereUsers = 1; 44 else $WhereUsers = '(User IN ('.$SelectedUsers.'))'; 45 46 $Buffer = 47 "-- Generováno projektem wowpreklad.zdechov.net\n". 48 "-- ===========================================\n". 49 "--\n". 50 "-- Web projektu: ".$Config['Web']['BaseURL']."\n". 51 "-- Datum exportu: ".date("j.n.Y H:i:s")."\n". 52 "-- Znaková sada: ".$Config['Database']['Charset']." / ".$Config['Web']['Charset']."\n". 53 "-- Diakritika: ".$AnoNe[$Setting['Diacritics']]."\n". 54 "-- Vygeneroval uživatel: ".$User['user']."\n". 55 "-- Vzato od uživatelů: ".$UserNames."\n". 56 "-- Generované tabulky: "; 57 foreach($TranslationTree as $Group) 58 if($Group['MangosTable'] != '') 59 if(in_array($Group['Id'], $Setting['groups'])) 60 $Buffer .= $Group['MangosTable'].', '; 61 $Buffer .= "\n\n"; 62 63 foreach($TranslationTree as $Group) 64 if(($Group['TablePrefix'] != '') and (in_array($Group['Id'], $Setting['groups']))) 65 { 66 $Query = 'SELECT * FROM (SELECT * FROM '.$Group['TablePrefix'].' WHERE (Complete = 1) AND '.$WhereLang.' AND '.$WhereUsers.' ORDER BY FIELD(User, '.$SelectedUsers.')) AS T GROUP BY T.entry'; 67 //echo($Query); 68 $Buffer .= "\n\n-- ".$Group['Name']."\n\n"; 69 $ID = $Database->SQLCommand($Query); 70 while($Line = mysql_fetch_array($ID)) 71 { 72 $Values = ''; 73 foreach($Group['Items'] as $GroupItem) 74 if($GroupItem['MangosColumn'] != '') 75 $Values .= ', `'.$GroupItem['MangosColumn'].'`="'.addslashes($Line[$GroupItem['Column']]).'"'; 76 $Values = substr($Values, 2); 77 $Buffer .= 'UPDATE `'.$Group['MangosTable'].'` SET '.$Values.' WHERE `'.$Group['MangosTableIndex'].'` = '.$Line['entry'].';'."\n"; 78 } 79 } 80 if($Setting['Diacritics'] != 1) $Buffer = utf2ascii($Buffer); 81 return($Buffer); 48 82 } 49 if(isset($OtherLanguage))50 {51 if($WhereLang <> '')52 $WhereLang .= " OR Language = '3'";53 else54 $WhereLang .= "Language = '3'";55 }56 57 $WhereUsers = '';58 for($i = 0; $i < Count($users); $i++)59 {60 if($WhereUsers <> '')61 $WhereUsers .= " OR (User = ".addslashes($users[$i]).')';62 else63 $WhereUsers .= " (User = ".addslashes($users[$i]).')';64 }65 66 foreach($TranslationTree as $Group)67 if(array_key_exists($Group['TablePrefix'], $_POST))68 {69 if(($Export == 'Mangos') and (Licence(LICENCE_ADMIN) == False)) die('Nemáte oprávnění');70 83 71 $sql = 'SELECT * FROM '.$Group['TablePrefix'].' WHERE Complete = 1 AND CountVote >= '.$NumberVote.' AND Vote >= '.$Vote;72 73 if($WhereLang <> '') $sql .= ' AND ('.$WhereLang.')';74 if($WhereUsers <> '') $sql .= ' AND ('.$WhereUsers.')';75 76 $i = 0;77 //echo($sql);78 $Buffer .= "\n\n-- ".$Group['Name']."\n\n";79 $ID = $Database->SQLCommand($sql.' ORDER BY vote');80 while($Line = mysql_fetch_array($ID))81 {82 $Values = '';83 foreach($Group['Items'] as $GroupItem)84 if($GroupItem['MangosColumn'] != '')85 $Values .= ', `'.$GroupItem['MangosColumn'].'`="'.addslashes($Line[$GroupItem['Column']]).'"';86 $Values = substr($Values, 2);87 $sql = 'UPDATE `'.$Group['MangosTable'].'` SET '.$Values.' WHERE `'.$Group['MangosTableIndex'].'` = '.$Line['entry'].';';88 if(!$Diacritical) $sql = WithOutDiacritical($sql);89 90 $Buffer .= $sql."\n";91 ++$i;92 }93 }94 95 if($Export == 'Display')96 {97 echo('Vygenerovaný SQL kód: <br /><textarea rows="30" cols="100">');98 echo($BufferHeader);99 echo($Buffer);100 echo('</textarea>');101 }102 103 if($Export == 'Mangos')104 {105 $Database->SelectDatabase($Config['Database']['DatabaseMangos']);106 $BufferArray = explode("\n", $Buffer);107 foreach($BufferArray as $Line)108 $Database->SQLCommand($Line);109 echo('Hotovo!');110 }111 112 if($Export == 'Zip')113 {114 if(function_exists('gzcompress'))115 {116 $save_filename = 'SqlTranslate.zip';117 $SQL_filename = 'SqlTranslate.sql';118 119 $BufferZip = $BufferHeader.$Buffer;120 121 $zipfile = new zipfile();122 $zipfile->addFile($BufferZip, $SQL_filename);123 $Buffer = $zipfile->file();124 125 // echo $Buffer.'<br><br><br>';126 $file_handle = fopen($save_filename, 'w');127 $write_result = fwrite($file_handle, $Buffer);128 fclose($file_handle);129 // header("Location: ".$save_filename);130 131 } else echo('Vyskytla se chyba!');132 echo('<script type="text/javascript" language="JavaScript" charset="utf-8">133 setTimeout("parent.location.href=\''.$save_filename.'\'",1000)134 </script>');135 136 echo('Pokud nezačalo stahování soubor by mělo jít stáhnout pomocí tohoto odkazu:137 <a href="'.$save_filename.'">'.$save_filename.'</a><br />138 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.');139 }140 141 WriteLog('Stažení SQL souboru: Typ Exportu: <b>'.$Export.'</b> Diakritika: <b>'.$Diacritical.'</b> Počet nutných hlasů: <b>'.$NumberVote.'</b> Známka vyšší jak: <b>'.$Vote.'</b>', 2);142 84 143 85 ?> -
trunk/includes/global.php
r57 r59 1 1 <?php 2 2 3 session_start();3 if(!isset($_SESSION)) session_start(); 4 4 5 5 // SQL injection hack protection … … 76 76 'index.php?Logout' => array(LICENCE_USER, 'Odhlášení ze systému', 'Odhlásit'), 77 77 'log.php' => array(LICENCE_MODERATOR, 'Log dění (Pouze moderátor)', 'Záznamy'), 78 'fill_database.php' => array(LICENCE_ADMIN, 'Načtení questů do database (pouze admin)', 'Import textů z MaNGOSu'),78 'fill_database.php' => array(LICENCE_ADMIN, 'Načtení překladů do database (pouze admin)', 'Import textů z MaNGOSu'), 79 79 //'client_files/generate_SQL.php' => array(LICENCE_ADMIN, 'Generování clientských souborů (pouze admin)', 'Generování C.S.'), 80 80 'https://wow.zdechov.net/mysql/' => array(LICENCE_ADMIN, 'phpMyAdmin(pouze admin)', 'Správa databáze'), … … 140 140 <head> 141 141 <meta http-equiv="content-type" content="text/html; charset=utf-8" /> 142 <link rel="stylesheet" href="'.$Config['Web']['BaseURL'].'style .css" type="text/css" media="all" />143 <script type="text/javascript" src="'.$Config['Web']['BaseURL'].' global.js"></script>142 <link rel="stylesheet" href="'.$Config['Web']['BaseURL'].'style/style.css" type="text/css" media="all" /> 143 <script type="text/javascript" src="'.$Config['Web']['BaseURL'].'style/global.js"></script> 144 144 <link rel="SHORTCUT ICON" href="'.$Config['Web']['BaseURL'].'images/favicon.ico" /> 145 145 <title>Projekt překládání textů WoW</title> … … 147 147 <body>'); 148 148 149 // přihlášení 149 if(!array_key_exists('UserID', $_SESSION)) $_SESSION['UserID'] = ''; 150 // Přihlášení 150 151 if(array_key_exists('LoginUser', $_POST)) 151 152 { -
trunk/includes/global_function.php
r57 r59 113 113 114 114 $user = @$_SESSION['UserID']; 115 if($user == '') $user = 0; 115 116 $Database->SelectDatabase($Config['Database']['Database']); 116 117 $Query = 'INSERT INTO `log` ( `user` , `type` , `text` , `date` , `IP` ) -
trunk/registrace.php
r49 r59 16 16 if(!$Line) 17 17 { 18 $Addres = $_SERVER['REMOTE_ADDR'];18 $Address = $_SERVER['REMOTE_ADDR']; 19 19 $Database->SQLCommand("INSERT INTO `user` (`user` , `pass` , `LastIP` , `LastLogin` , `Email` , `Language` ) 20 VALUES ('$User','$Pass','$Addres ',now(),'$Email','$Language')");20 VALUES ('$User','$Pass','$Address',now(),'$Email','$Language')"); 21 21 // $Database->SQLCommand("INSERT INTO user () VALUES('$User','$Pass','0','$Addres',now(),'0','$Email')"); 22 echo('Registrace proběhla úspěšně<br />)'); 23 WriteLog('Uživatel se zaregistroval: '.$User, 3); 22 echo('Registrace proběhla úspěšně.<br />'); 24 23 25 24 $_SESSION['User'] = $User; … … 28 27 $Line = mysql_fetch_array($Database->SQLCommand("SELECT ID FROM user WHERE user = '".$_SESSION['User']."'")); 29 28 $_SESSION['UserID'] = $Line['ID']; 29 WriteLog('Uživatel se zaregistroval: '.$User, 3); 30 30 31 31 // echo $Database->id_connection; 32 32 } else 33 33 { 34 echo('Uživatel s touto přezdívkou již existuje. <a href=" registrace.php">Zpět</a>');34 echo('Uživatel s touto přezdívkou již existuje. <a href="?">Zpět</a>'); 35 35 } 36 36 } else 37 37 { 38 echo('Hesla se neshodují. <a href=" registrace.php">Zpět</a>');38 echo('Hesla se neshodují. <a href="?">Zpět</a>'); 39 39 } 40 40 } else 41 41 { 42 echo('<form action=" registrace.php" method="post">42 echo('<form action="?" method="post"> 43 43 <table> 44 44 <tr>
Note:
See TracChangeset
for help on using the changeset viewer.