Changeset 286
- Timestamp:
- Dec 22, 2009, 10:22:38 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/TranslationList.php
r280 r286 6 6 7 7 $TranslationItemPerPage = 200; 8 if(array_key_exists('group', $_GET)) $GroupId = $_GET['group'] * 1; else $GroupId = 1;8 $GroupId = LoadGroupIdParameter(); 9 9 if(array_key_exists('connexion_id', $_GET)) { 10 10 $_SESSION['connexion_id'] = $_GET['connexion_id']; 11 }12 $DbResult = $Database->SQLCommand('SELECT Id FROM `group` WHERE `Id`='.$GroupId);13 if(mysql_num_rows($DbResult) == 0)14 {15 echo('Neexistující id překladové skupiny.');16 ShowFooter();17 die();18 11 } 19 12 $Table = $TranslationTree[$GroupId]['TablePrefix']; … … 144 137 if($Action == 'connexion') 145 138 { //SELECT * FROM spell WHERE entry IN(SELECT entry FROM connexion_item WHERE connexion = 1) 146 139 $Line = mysql_fetch_assoc($Database->SQLCommand('SELECT Name FROM connexion WHERE `Id` = '.$_SESSION['connexion_id'])); 147 140 echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$GroupId.'&action=filter">Filtr textů</a> -> 148 141 <a title="Zde je seznam souvislostí" href="?group='.$GroupId.'&action=connexion">Souvislosti</a> - > … … 166 159 <td>'.$Line['Name'].'</td>'); 167 160 } 168 161 echo ('</table>'); 169 162 } else 170 163 if($Action == 'nocomplete') … … 196 189 echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$GroupId.'&action=filter">Filtr textů</a> -> 197 190 <a title="Přeložené questy přilášeného uživatele" href="?group='.$GroupId.'&action=my">Moje překlady</a><br /><br />'); 198 WriteQuests('SELECT *, (SELECT user.user FROM user WHERE user.id = '.$Table.'.user) as User FROM '.$Table.' Where user= '.$_SESSION['UserID'], '', 'my');191 WriteQuests('SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = '.$Table.'.`user`) AS `User` FROM `'.$Table.'` Where `user` = '.$_SESSION['UserID'], '', 'my'); 199 192 } else 200 193 if(($Action == 'mydevelop') and Licence(LICENCE_USER)) … … 202 195 echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$GroupId.'&action=filter">Filtr textů</a> -> 203 196 <a title="Nedokončené texty" href="?group='.$GroupId.'&action=mydevelop">Rozepsané překlady</a><br /><br />'); 204 WriteQuests('SELECT *, (SELECT user.user FROM user WHERE user.id = '.$Table.'.user) as User FROM '.$Table.' Where user = '.$_SESSION['UserID'].' AND Complete= 0', '', 'mydevelop');197 WriteQuests('SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `'.$Table.'`.`user`) AS `User` FROM `'.$Table.'` Where `user` = '.$_SESSION['UserID'].' AND `Complete` = 0', '', 'mydevelop'); 205 198 } else 206 199 if($Action == 'users') … … 208 201 echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$GroupId.'&action=filter">Filtr textů</a> -> 209 202 <strong>Vypsání textů od určitých uživatelů</strong><br /><br />'); 210 $users = @$_POST['users'];211 212 $WhereUsers = '';213 203 if(array_key_exists('users', $_POST)) $users = $_POST['users']; 204 else $users = array(); 205 206 $WhereUsers = ''; 214 207 for($i = 0; $i < Count($users); $i++) 215 208 { 216 if($WhereUsers <> '') $WhereUsers .= ' OR User = '.$users[$i]; 217 else $WhereUsers .= ' User = '.$users[$i]; 218 } 219 WriteQuests('SELECT *, (SELECT user.user FROM user WHERE user.id = '.$Table.'.user) as User FROM '.$Table.' Where '.$WhereUsers, '', 'users'); 209 if($WhereUsers <> '') $WhereUsers .= ' OR `User` = '.$users[$i]; 210 else $WhereUsers .= ' `User` = '.$users[$i]; 211 } 212 if($WhereUsers == '') $WhereUsers = '0'; 213 214 215 WriteQuests('SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `'.$Table.'`.`user`) AS `User` FROM `'.$Table.'` WHERE '.$WhereUsers, '', 'users'); 220 216 } else 221 217 if($Action == 'userall') 222 218 { 223 $ID = $Database->SQLCommand('SELECT user FROM user WHERE id= '.$_GET['user']);219 $ID = $Database->SQLCommand('SELECT `user` FROM `user` WHERE `id` = '.$_GET['user']); 224 220 $Line = mysql_fetch_row($ID); 225 221 echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$GroupId.'&action=filter">Filtr textů</a>'. … … 232 228 { 233 229 if(array_key_exists('not', $_GET)) { 234 $sql = 'SELECT COUNT(*) FROM '.$Group['TablePrefix'].' WHERE Complete = 0 AND user='.$_GET['user'];230 $sql = 'SELECT COUNT(*) FROM `'.$Group['TablePrefix'].'` WHERE `Complete` = 0 AND `user`='.$_GET['user']; 235 231 $ID = $Database->SQLCommand($sql); 236 232 $Line = mysql_fetch_row($ID); … … 239 235 $Total += $Line[0]; 240 236 } else { 241 $sql = 'SELECT COUNT(*) FROM '.$Group['TablePrefix'].' WHERE user='.$_GET['user'];237 $sql = 'SELECT COUNT(*) FROM `'.$Group['TablePrefix'].'` WHERE `user`='.$_GET['user']; 242 238 $ID = $Database->SQLCommand($sql); 243 239 $Line = mysql_fetch_row($ID); … … 289 285 if(array_key_exists('user', $_GET)) 290 286 { 291 $ID = $Database->SQLCommand('SELECT user FROM user WHERE id= '.($_GET['user'] * 1));287 $ID = $Database->SQLCommand('SELECT `user` FROM `user` WHERE `id` = '.($_GET['user'] * 1)); 292 288 if(mysql_num_rows($ID) > 0) 293 289 { … … 296 292 '<strong>Vypis překladů uživatele '.$Line[0].': </strong><br /><br />'); 297 293 if(array_key_exists('not', $_GET)) 298 WriteQuests('SELECT *, (SELECT user.user FROM user WHERE user.id = '.$Table.'.user) as User FROM '.$Table.' Where Complete = 0 AND user= '.$_GET['user'], '', 'userid');299 else WriteQuests('SELECT *, (SELECT user.user FROM user WHERE user.id = '.$Table.'.user) as User FROM '.$Table.' Where user= '.$_GET['user'], '', 'userid');294 WriteQuests('SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `'.$Table.'`.`user`) AS `User` FROM `'.$Table.'` Where `Complete` = 0 AND `user` = '.$_GET['user'], '', 'userid'); 295 else WriteQuests('SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `'.$Table.'`.`user`) AS `User` FROM `'.$Table.'` Where `user` = '.$_GET['user'], '', 'userid'); 300 296 } else echo('Nebyl nalezen uživatel se zadaným id'); 301 297 } else echo('Je nutno zadat id uživatele.'); … … 306 302 else $Search = $_POST['search']; 307 303 308 $sql = 'SELECT *, (SELECT user.user FROM user WHERE user.id = '.$Table.'.user) as UserFROM `'.$Table.'` WHERE `ID` LIKE "%'.$Search.'%"304 $sql = 'SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `'.$Table.'`.`user`) AS `User` FROM `'.$Table.'` WHERE `ID` LIKE "%'.$Search.'%" 309 305 OR `entry` LIKE "%'.$Search.'%" 310 306 OR `Language` LIKE "%'.$Search.'%" … … 323 319 else $Search = $_POST['ID']; 324 320 325 $sql = 'SELECT *, (SELECT user.user FROM user WHERE user.id = '.$Table.'.user) as UserFROM `'.$Table.'` WHERE `entry` LIKE "'.$Search.'"';321 $sql = 'SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `'.$Table.'`.`user`) AS `User` FROM `'.$Table.'` WHERE `entry` LIKE "'.$Search.'"'; 326 322 327 323 WriteQuests($sql, '', 'searchentry='.$Search); … … 333 329 <strong>Výpis všech textů s limitem na stránku</strong><br /><br />'); 334 330 335 WritePages('?group='.$GroupId.'&action=all', ' AS items WHERE (items.Language= 0)');336 337 WriteQuests('SELECT * FROM '.$Table.' AS items WHERE (items.Language= 0)', $_SESSION['limitx'].','.$_SESSION['limity'], 'all');331 WritePages('?group='.$GroupId.'&action=all', ' AS `items` WHERE (`items`.`Language` = 0)'); 332 333 WriteQuests('SELECT * FROM `'.$Table.'` AS `items` WHERE (`items`.`Language` = 0)', $_SESSION['limitx'].','.$_SESSION['limity'], 'all'); 338 334 } else 339 335 if($Action == 'filter') … … 359 355 360 356 echo('<tr><td><form action="?group='.$GroupId.'&action=users" method="post"><div>'. 361 '<select name="users[]" size="10" multiple="multiple" >');362 363 $ID = $Database->SQLCommand('SELECT user, IDFROM `user` WHERE364 EXISTS(SELECT 1 FROM '.$Table.' WHERE user = user.ID) ORDER BY user');357 '<select name="users[]" size="10" multiple="multiple" class="UserList">'); 358 359 $ID = $Database->SQLCommand('SELECT `user`, `ID` FROM `user` WHERE 360 EXISTS(SELECT 1 FROM `'.$Table.'` WHERE `user` = `user`.`ID`) ORDER BY `user`'); 365 361 if($ID) 366 362 while($Line = mysql_fetch_assoc($ID)) -
trunk/action.php
r244 r286 5 5 ShowPage(); 6 6 7 if(array_key_exists('group', $_GET)) $GroupId = $_GET['group']; else $GroupId = 1;7 $GroupId = LoadGroupIdParameter(); 8 8 $Table = $TranslationTree[$GroupId]['TablePrefix']; 9 9 if(array_key_exists('action', $_GET)) $Action = $_GET['action']; else $Action = ''; … … 16 16 echo('<table class="BaseTable"><tr><th>Skupina</th><th>Výsledků</th></tr>'); 17 17 foreach($TranslationTree as $Group) { 18 18 $Table = $Group['TablePrefix']; 19 19 20 21 22 23 24 25 26 27 28 20 $sql = 'SELECT count(*) FROM `'.$Table.'` WHERE `ID` LIKE "%'.$Search.'%" 21 OR `entry` LIKE "%'.$Search.'%" 22 OR `User` LIKE "%'.$Search.'%" 23 OR `Complete` LIKE "%'.$Search.'%"'; 24 foreach($Group['Items'] as $Item) { 25 if($Item['Column'] != '') $sql .= ' OR `'.$Item['Column'].'` LIKE "%'.$Search.'%"'; 26 } 27 $Line = mysql_fetch_row($Database->SQLCommand($sql)); 28 echo('<tr><td><a href="TranslationList.php?group='.$Group['Id'].'&action=search&search='.$Search.'">'.$Group['Name'].'</a></td><td>'.$Line[0].'</td></tr>'); 29 29 } 30 30 31 32 33 34 35 36 37 38 39 31 $Line = mysql_fetch_row($Database->SQLCommand('SELECT count(*) FROM `user` WHERE `user` LIKE "%'.$Search.'%"')); 32 echo('<tr><td><a href="userlist.php?search='.$Search.'">Uživatelé</a></td><td>'.$Line[0].'</td></tr>'); 33 $Line = mysql_fetch_row($Database->SQLCommand('SELECT count(*) FROM `team` WHERE `name` LIKE "%'.$Search.'%" OR `description` LIKE "%'.$Search.'%"')); 34 echo('<tr><td><a href="team.php?search='.$Search.'">Týmy</a></td><td>'.$Line[0].'</td></tr>'); 35 $Line = mysql_fetch_row($Database->SQLCommand('SELECT count(*) FROM `verseclient` WHERE `text` LIKE "%'.$Search.'%"')); 36 echo('<tr><td><a href="download.php?addon">Čeština pro klienta</a></td><td>'.$Line[0].'</td></tr>'); 37 echo('<tr><td><a href="aowow/?search='.$Search.'">Vyhledávací databáze AoWoW</a></td></tr>'); 38 $Line = mysql_fetch_row($Database->SQLCommand('SELECT count(*) FROM `dictionary` WHERE (`Text` LIKE "%'.$Search.'%" OR `Description` LIKE "%'.$Search.'%") AND Language = 0')); 39 echo('<tr><td><a href="dictionary.php?search='.$Search.'">Slovníček</a></td><td>'.$Line[0].'</td></tr>'); 40 40 41 41 echo('</table>'); … … 45 45 if(($Action == 'dbkit') and Licence(LICENCE_ADMIN)) 46 46 { 47 48 49 50 47 echo ('<form action="?action=dbkit" method="post">'); 48 echo('Najít: <input type="text" name="find" /><br />'); 49 echo('Nahradit: <input type="text" name="replace" /><br />'); 50 echo('<input type="submit" value="Najít/nahradit" /><br />'); 51 51 echo('</form><br />'); 52 53 54 55 56 57 52 echo ('<a href="?action=dbkit&Take">Opravit data v sloupci Take</a><br />'); 53 echo ('<a href="?action=dbkit&ShortCut">Opravit data v sloupci ShortCut</a><br />'); 54 55 echo ('<br /><form action="?action=dbkit" method="post">'); 56 echo('Vymazat log typ : <input type="text" name="Type" /> '); 57 echo('<input type="submit" value="Vymazat" /><br />'); 58 58 echo('</form><br />'); 59 59 60 60 if (array_key_exists('Type',$_POST)) { 61 62 63 64 61 $sql = 'DELETE FROM log WHERE Type = '.$_POST['Type']; 62 $Database->SQLCommand($sql); 63 WriteLog('Vymazán log '.$_POST['Type'], 4); 64 echo (' Vymazán log '.$_POST['Type']); 65 65 } 66 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 67 if (array_key_exists('find',$_POST)) { 68 echo ('Začínám nahrazovat: <br />'); 69 $find = $_POST['find']; 70 $replace = $_POST['replace']; 71 72 foreach($TranslationTree as $Group) { 73 $Table = $Group['TablePrefix']; 74 echo ($Table.' '); 75 76 $sql = 'SELECT * FROM '.$Table.' WHERE (Language <> 0) AND ('; 77 foreach($Group['Items'] as $Item) { 78 if($Item['Column'] != '') $sql .= '`'.$Item['Column'].'` LIKE "%'.$find.'%" OR '; 79 } 80 $sql = substr($sql,0,strlen($sql)-4); 81 $sql .= ')'; 82 83 $ID = $Database->SQLCommand($sql); 84 while ($Line = mysql_fetch_assoc($ID)) { 85 $sql = 'UPDATE '.$Table.' SET '; 86 foreach($Group['Items'] as $Item) { 87 $Column_text = addslashes(str_replace($find,$replace,$Line[$Item['Column']])); 88 $sql .= ' '.$Item['Column'].' = "'.$Column_text.'",'; 89 } 90 $sql = substr($sql,0,strlen($sql)-1); 91 $sql .= ' WHERE ID = '.$Line['ID']; 92 $Database->SQLCommand($sql); 93 echo ('.'); 94 } 95 96 echo (' <strong>Hotovo</strong> <br />'); 97 if (mysql_num_rows($ID) > 0) { 98 WriteLog('Použita oprava DB ovlivněno '.mysql_num_rows($ID).' řádků z tabulky '.$Table.', "'.$find.'" nahrazeno za "'.$replace.'"', 4); 99 echo (' Použita oprava DB ovlivněno '.mysql_num_rows($ID).' řádků z tabulky '.$Table.', "'.$find.'" nahrazeno za "'.$replace.'"<br />'); 100 } 101 } 102 } 103 104 //oprava dat v sloupci Take 105 105 if (array_key_exists('Take',$_GET)) { 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 106 echo ('Začínám opravovat Take: <br />'); 107 108 foreach($TranslationTree as $Group) { 109 $Table = $Group['TablePrefix']; 110 echo ($Table.' '); 111 112 $sql = 'SELECT ID,entry as entry_tran, Take, 113 (SELECT ID FROM '.$Table.' WHERE Language = 0 AND entry = entry_tran LIMIT 1) as ID_orig 114 FROM '.$Table.' as tran WHERE (Language <> 0) AND ((Take = 0) OR (ID = Take) OR NOT EXISTS(SELECT 1 FROM '.$Table.' WHERE ID = tran.Take))'; 115 116 $ID = $Database->SQLCommand($sql); 117 while ($Line = mysql_fetch_assoc($ID)) { 118 $sql = 'UPDATE '.$Table.' SET Take = '.$Line['ID_orig'].' WHERE ID = '.$Line['ID']; 119 $Database->SQLCommand($sql); 120 echo ('.'); 121 } 122 123 echo (' <strong>Hotovo</strong> <br />'); 124 if (mysql_num_rows($ID) > 0) { 125 WriteLog('Použita oprava DB na sloupec Take '.mysql_num_rows($ID).' řádků z tabulky '.$Table, 4); 126 echo (' Použita oprava DB na sloupec Take '.mysql_num_rows($ID).' řádků z tabulky '.$Table.'<br />'); 127 } 128 } 129 } 130 //oprava dat ShortCut 131 131 if (array_key_exists('ShortCut',$_GET)) { 132 133 134 135 $Tables = array ('global_strings','glue_strings'); 132 echo ('Začínám opravovat Take: <br />'); 133 134 135 $Tables = array ('global_strings','glue_strings'); 136 136 137 138 139 $sql = 'SELECT gs_orig.ID, gs_tran.entry, gs_tran.ShortCut as ShortCut_tran, gs_orig.ShortCut as ShortCut_orig FROM '.$Table.' as gs_tran JOIN '.$Table.' as gs_orig ON gs_orig.entry = gs_tran.entry WHERE gs_tran.Language <> 0 AND gs_tran.ShortCut <> gs_orig.ShortCut'; 140 141 142 143 144 145 146 147 148 149 150 151 152 153 } 137 foreach($Tables as $Table) { 138 echo ($Table.' '); 139 $sql = 'SELECT gs_orig.ID, gs_tran.entry, gs_tran.ShortCut as ShortCut_tran, gs_orig.ShortCut as ShortCut_orig FROM '.$Table.' as gs_tran JOIN '.$Table.' as gs_orig ON gs_orig.entry = gs_tran.entry WHERE gs_tran.Language <> 0 AND gs_tran.ShortCut <> gs_orig.ShortCut'; 140 $ID = $Database->SQLCommand($sql); 141 while ($Line = mysql_fetch_assoc($ID)) { 142 $sql = 'UPDATE '.$Table.' SET ShortCut = '.$Line['ShortCut_orig'].' WHERE ID = '.$Line['ID']; 143 $Database->SQLCommand($sql); 144 echo ('.'); 145 } 146 147 echo (' <strong>Hotovo</strong> <br />'); 148 if (mysql_num_rows($ID) > 0) { 149 WriteLog('Použita oprava DB na sloupec ShortCut '.mysql_num_rows($ID).' řádků z tabulky '.$Table, 4); 150 echo (' Použita oprava DB na sloupec ShortCut '.mysql_num_rows($ID).' řádků z tabulky '.$Table.'<br />'); 151 } 152 } 153 } 154 154 } 155 155 … … 172 172 Uživatel: '); 173 173 if(Licence(LICENCE_USER)) echo('<b>'.$_SESSION['User'].'</b><br />'); 174 174 else echo('<input type="text" name="user" /><br />'); 175 175 echo('Text zprávy: <br> 176 176 <textarea onkeydown="ResizeTextArea(this)" name="text" cols="40"></textarea> <br /> … … 180 180 { 181 181 if(Licence(LICENCE_USER)) $user = $_SESSION['User']; 182 182 else die('Pro vkládaní musíte byt registrováni!'); 183 183 $text = $_POST['text']; 184 184 $Database->SQLCommand("INSERT INTO `shoutbox` ( `user` , `text` , `date` , `IP` ) -
trunk/comparison.php
r243 r286 10 10 //TODO: barevné porovnání 11 11 //strcasecmp($String1, $String2) == 0 je totožné 12 // 12 // echo $String1.'<br /><br />'; 13 13 $ArrStr1 = explode(' ', $String1); 14 14 $ArrStr2 = explode(' ', $String2); 15 15 16 16 for($i = 0; $i < count($ArrStr1); $i++) 17 17 { 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 18 if(isset($ArrStr2[$i])) 19 { 20 if($ArrStr1[$i] == $ArrStr2[$i]) 21 { 22 echo($ArrStr1[$i].' '); 23 } else 24 { 25 $find = false; 26 for($j = 0; $j < count($ArrStr2); $j++) 27 { 28 if(($ArrStr1[$i] == $ArrStr2[$j]) and ($find == false)) 29 { 30 echo($ArrStr1[$i].' '); 31 $find = true; 32 } 33 } 34 if($find == false) 35 echo('<span class="edit">'.$ArrStr1[$i].' </span>'); 36 } 37 } else echo('<span class="edit">'.$ArrStr1[$i].' </span>'); 38 38 } 39 // 39 // echo $ArrStr1[0]; 40 40 } 41 41 42 if(array_key_exists('group', $_GET)) $GroupId = $_GET['group']; else $GroupId = 1;42 $GroupId = LoadGroupIdParameter(); 43 43 $Table = $TranslationTree[$GroupId]['TablePrefix']; 44 44 … … 48 48 if((array_key_exists('ID1', $_GET)) and ($_GET['ID1'] <> -1)) //porovnání pouze 2 textů 49 49 { 50 51 52 $WhereID = " AND (ID = $TextID1 OR ID = $TextID2 OR Language = 0)";50 $TextID1 = $_GET['ID1']; 51 $TextID2 = $_GET['ID2']; 52 $WhereID = ' AND (ID = '.$TextID1.' OR ID = '.$TextID2.' OR Language = 0)'; 53 53 } else $WhereID = ''; 54 54 … … 57 57 while($Line = mysql_fetch_assoc($DataID)) 58 58 { 59 60 $i = $i + 1; 59 $BuffLine[$i] = $Line; 60 $i = $i + 1; 61 61 } 62 62 // if(!$Line) die('Překlad nenalezen.'); … … 70 70 foreach($Line as $Index => $LineItem) 71 71 { 72 72 $LineUser = mysql_fetch_array($Database->SQLCommand('SELECT * FROM user WHERE id = '.$LineItem['User'])); 73 73 echo('<th>'.$LineUser['user'].'</th>'); 74 74 } … … 78 78 foreach($Line as $Index => $LineItem) 79 79 { 80 80 echo('<td><a href="form.php?group='.$GroupId.'&ID='.$LineItem['ID'].'">'.$LineItem['ID'].'</a></td>'); 81 81 } 82 82 echo('</tr>'); … … 84 84 foreach($Line as $Index => $LineItem) 85 85 { 86 86 echo('<td><a href="form.php?group='.$GroupId.'&ID='.$LineItem['Take'].'">'.$LineItem['Take'].'</a></td>'); 87 87 } 88 88 echo('</tr>'); … … 90 90 foreach($Line as $Index => $LineItem) 91 91 { 92 93 94 92 echo('<td>'); 93 WriteLanguagesWithoutSel($LineItem['Language']); 94 echo('</td>'); 95 95 } 96 96 echo('</tr>'); … … 98 98 foreach($Line as $Index => $LineItem) 99 99 { 100 101 102 100 echo('<td>'); 101 echo (GetVersionWOW($LineItem['VersionStart']).' - '.GetVersionWOW($LineItem['VersionEnd'])); 102 echo('</td>'); 103 103 } 104 104 echo('</tr>'); 105 105 foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 106 106 { 107 108 109 110 111 112 113 114 115 116 117 107 if($Line[0][$TextItem['Column']] <> '') 108 { 109 echo('<tr><th>'.$TextItem['Name'].'</th>'); 110 for($i = 0; $i < count($Line); $i++) 111 { 112 if($i > 0) 113 { 114 echo('<td>'); 115 CompareString($Line[$i][$TextItem['Column']],$Line[$i - 1][$TextItem['Column']]); 116 echo('</td>'); 117 } else echo('<td>'.$Line[$i][$TextItem['Column']].'</td>'); 118 118 } 119 echo ('</tr>');119 echo ('</tr>'); 120 120 } 121 121 } -
trunk/dictionary.php
r284 r286 41 41 foreach($TablesColumn as $Table => $Column) 42 42 { 43 $sql = 'SELECT ID,'.$Column.',(SELECT Name FROM '.$Table.' as T WHERE O.entry = T.entry AND Language <> 0 LIMIT 1) as tran FROM '.$Table.' as OWHERE ';44 $groupby = ' GROUP BY '.$Column;43 $sql = 'SELECT `ID`,'.$Column.',(SELECT `Name` FROM '.$Table.' AS `T` WHERE `O`.`entry` = `T`.`entry` AND `Language` <> 0 LIMIT 1) AS `tran` FROM `'.$Table.'` AS `O` WHERE '; 44 $groupby = ' GROUP BY `'.$Column.'`'; 45 45 46 46 $ArrStr = explode(' ', $Text); … … 87 87 } 88 88 89 if(array_key_exists('Page', $_GET)) $_SESSION['Page'] = $_GET['Page']; 90 else if(!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 1; 89 ShowPage(); 91 90 92 91 if(!isset($_SESSION['language'])) … … 94 93 if(Licence(LICENCE_USER)) 95 94 { 96 $DbResult = $Database->SQLCommand('SELECT Language FROM user WHERE ID='.$_SESSION['UserID']);95 $DbResult = $Database->SQLCommand('SELECT `Language` FROM `user` WHERE `ID`='.$_SESSION['UserID']); 97 96 $User = mysql_fetch_assoc($DbResult); 98 97 $_SESSION['language'] = $User['Language']; 99 98 } else $_SESSION['language'] = 1; 100 99 } 101 if(array_key_exists('language', $_GET)) $_SESSION['language'] = $_GET['language']; 102 103 ShowPage(); 100 if(array_key_exists('language', $_GET)) $_SESSION['language'] = LoadLanguageIdParameter(); 104 101 105 102 echo('<h3>Slovníček</h3>'); 106 103 107 104 if(array_key_exists('group', $_GET)) 108 105 { 109 if(array_key_exists('group', $_GET)) $GroupId = $_GET['group']; else $GroupId = 1;106 $GroupId = LoadGroupIdParameter(); 110 107 if(array_key_exists('mode', $_GET)) $mode = $_GET['mode']; else $mode = 0; //0 = přesné názvy, 1=všechny názvy, 2=nepřeložené 111 108 $Table = $TranslationTree[$GroupId]['TablePrefix']; … … 227 224 echo($PageList['Output']); 228 225 echo('<table width="98%" class="BaseTable"> 229 <tr><th> '.$LanguageList[0]['Name'].'</th>226 <tr><th>Angličtina</th> 230 227 <th>'.$LanguageList[$_SESSION['language']]['Name'].'</th> 231 228 <th>Popis</th><th>Překladatel</th>'); … … 233 230 echo('</tr>'); 234 231 $ID = $Database->SQLCommand($sql_page); 235 while 232 while($Line = mysql_fetch_assoc($ID)) 236 233 { 237 234 echo('<tr> -
trunk/export/index.php
r268 r286 7 7 //php index.php "action=result" 'ExportSetting=a:10:{s:11:"users-order";s:838:",459,1,2,499,304,462,407,379,58,400,392,119,281,590,277,159,192,588,503,586,131,195,288,208,537,426,337,146,30,122,598,399,596,28,8,319,174,33,165,188,269,18,84,331,578,591,147,579,592,289,303,567,243,502,144,285,161,568,351,163,547,262,256,141,536,301,318,214,486,172,154,466,446,335,127,563,76,293,173,325,580,290,153,543,23,196,509,552,237,389,317,177,52,594,416,539,473,573,17,5,139,452,148,362,210,346,35,553,71,68,394,143,369,515,448,140,445,32,171,211,347,226,152,403,245,217,27,7,268,549,86,81,348,370,476,132,562,307,575,583,291,555,548,16,474,182,556,535,320,252,359,264,338,533,405,577,250,221,582,197,230,72,242,213,409,472,186,554,523,492,378,413,512,581,352,518,485,602,601,604,603,606,607,595,609,617,614,618,616,613,622,624,638,641,643,626,627,648,639,652,642,650,26,156,640,633,635,653,637,654,636,284,531,585,629,651,647";s:15:"users-selection";a:44:{i:0;s:3:"459";i:1;s:1:"1";i:2;s:1:"2";i:3;s:3:"499";i:4;s:3:"304";i:5;s:3:"462";i:6;s:3:"407";i:7;s:3:"379";i:8;s:3:"400";i:9;s:3:"281";i:10;s:3:"277";i:11;s:3:"159";i:12;s:3:"588";i:13;s:3:"503";i:14;s:3:"586";i:15;s:3:"131";i:16;s:3:"195";i:17;s:3:"288";i:18;s:3:"208";i:19;s:3:"537";i:20;s:3:"426";i:21;s:3:"337";i:22;s:3:"122";i:23;s:3:"319";i:24;s:3:"174";i:25;s:3:"165";i:26;s:3:"188";i:27;s:3:"269";i:28;s:2:"18";i:29;s:3:"331";i:30;s:3:"578";i:31;s:3:"579";i:32;s:3:"592";i:33;s:3:"567";i:34;s:3:"568";i:35;s:3:"446";i:36;s:3:"580";i:37;s:3:"362";i:38;s:3:"549";i:39;s:3:"562";i:40;s:3:"556";i:41;s:3:"618";i:42;s:3:"613";i:43;s:3:"622";}s:6:"groups";a:18:{i:0;s:1:"1";i:1;s:1:"2";i:2;s:1:"3";i:3;s:1:"4";i:4;s:1:"5";i:5;s:1:"6";i:6;s:1:"7";i:7;s:1:"8";i:8;s:2:"10";i:9;s:2:"11";i:10;s:2:"12";i:11;s:2:"13";i:12;s:2:"14";i:13;s:2:"15";i:14;s:2:"16";i:15;s:2:"17";i:16;s:2:"18";i:17;s:2:"19";}s:10:"Diacritics";b:1;s:11:"language-cz";b:1;s:11:"language-sk";b:1;s:14:"language-other";b:0;s:6:"Export";s:11:"AoWoWImport";s:9:"language1";b:0;s:9:"language2";b:0;}' 8 8 9 if(!isset($_SERVER['REMOTE_ADDR'])) 9 // Load commandline parameters 10 if(!array_key_exists('REMOTE_ADDR', $_SERVER)) 10 11 { 11 12 foreach($_SERVER['argv'] as $parameter) … … 14 15 { 15 16 $index = substr($parameter,0,strpos($parameter, '=')); 16 17 17 $parameter = substr($parameter,strpos($parameter, '=')+1); 18 //echo ($index.' ---- '.$parameter); 18 19 $_GET[$index] = $parameter; 19 20 } 20 } 21 } 21 22 } 22 23 … … 24 25 if(array_key_exists('ExportSetting', $_COOKIE)) 25 26 $_SESSION['ExportSetting'] = $_COOKIE['ExportSetting']; 26 27 else $_SESSION['ExportSetting'] = ''; 27 28 28 29 setcookie('ExportSetting', $_SESSION['ExportSetting'], time() + 60 * 60 * 24 * 100); … … 69 70 unset($Addon_verses[count($Addon_verses) - 1]); 70 71 unset($Addon_verses[count($Addon_verses) - 1]); 71 72 73 74 } 75 76 77 72 $result = '['; 73 foreach($Addon_verses as $version) { 74 $result .= "'".$version."',"; 75 } 76 $result = substr($result,0,strlen($result)-1); 77 $result .= "]"; 78 break; 78 79 case 'sources': 79 80 $dirs = scandir('../source', 1); … … 81 82 unset($dirs[count($dirs) - 1]); 82 83 unset($dirs[count($dirs) - 1]); 83 84 85 86 } 87 88 89 84 $result = '['; 85 foreach($dirs as $dir) { 86 $result .= "'".$dir."',"; 87 } 88 $result = substr($result,0,strlen($result)-1); 89 $result .= "]"; 90 break; 90 91 case 'sql': 91 92 $dirs = scandir('../source', 1); … … 93 94 unset($dirs[count($dirs) - 1]); 94 95 unset($dirs[count($dirs) - 1]); 95 96 97 98 99 } 100 101 102 96 $result = '['; 97 foreach($dirs as $dir) { 98 if ($TranslationTree[1]['LastVersion'] >= GetBuildNumber($dir)) 99 $result .= "'".$dir."',"; 100 } 101 if ($result <> '[') $result = substr($result,0,strlen($result)-1); 102 $result .= "]"; 103 break; 103 104 case 'DBC': 104 105 $sql = 'SELECT Version FROM wow_client_version WHERE DBCColumns_GameTips <> "" AND DBCColumns_Spell <> "" ORDER BY BuildNumber DESC'; 105 106 $ID = $Database->SQLCommand($sql); 106 107 $result = '['; 107 108 while($Line = mysql_fetch_assoc($ID)) 108 109 { 109 110 } 111 112 113 110 $result .= "'".$Line['Version']."',"; 111 } 112 $result = substr($result,0,strlen($result)-1); 113 $result .= "]"; 114 break; 114 115 case 'Lua': 115 116 $dirs = scandir('../source', 1); 116 117 118 117 $result = '['; 118 foreach($dirs as $dir) { 119 $ok = true; 119 120 foreach($TranslationTree as $Group) 120 121 { 121 122 if(($Group['LuaFileName'] != '') and ($Group['TablePrefix'] != '')) 122 123 { 123 124 125 126 127 128 } 129 130 131 124 if ((file_exists('../source/'.$dir.'/lua/'.$Group['LuaFileName'].'.lua') == false)) 125 $ok = false; 126 } 127 } 128 if ($ok) $result .= "'".$dir."',"; 129 } 130 $result = substr($result,0,strlen($result)-1); 131 $result .= "]"; 132 break; 132 133 } 133 134 return($result); … … 138 139 if ($str <> 'null') 139 140 { 140 $str = substr($str, 2,strlen($str)-4);141 $versions = explode("','", $str);141 $str = substr($str, 2, strlen($str) - 4); 142 $versions = explode("','", $str); 142 143 foreach($versions as $version) 143 144 { 144 145 echo('<option value="'.$version.'"'); 145 if($Selected == $version) echo(' selected="selected"'); echo('>'.$version.'</option>'); 146 if($Selected == $version) echo(' selected="selected"'); 147 echo('>'.$version.'</option>'); 146 148 } 147 149 } … … 150 152 function WriteSetting($ExportSetting) 151 153 { 152 153 154 155 154 echo('<textarea rows="10" cols="100">'.serialize($ExportSetting).'</textarea><br />'. 155 'Odkaz ke stažení s vlastním nastavením: '. 156 '<a href="?action=output&ExportSetting='.htmlspecialchars(serialize($ExportSetting)).'">Odkaz vlastního exportu</a><br />'. 157 'I když se nastavení ukládá, pro jistotu si jej můžete uložit nebo poslat příteli.'); 156 158 } 157 159 158 160 if(array_key_exists('ExportSetting', $_GET)) 159 161 { 160 162 $ExportSetting = unserialize(stripcslashes(stripcslashes($_GET['ExportSetting']))); 161 163 } else 162 164 { 163 164 165 166 167 168 169 //print_r($_POST);170 165 if(array_key_exists('UserID', $_SESSION) and ($_SESSION['UserID'] != '')) 166 { 167 $DbResult = $Database->SQLCommand('SELECT ExportSetting FROM user WHERE ID='.$_SESSION['UserID']); 168 $DbRow = mysql_fetch_assoc($DbResult); 169 $ExportSetting = unserialize($DbRow['ExportSetting']); 170 171 //print_r($_POST); 172 } else $ExportSetting = unserialize($_SESSION['ExportSetting']); 171 173 } 172 174 if(!isset($ExportSetting['users-selection'])) $ExportSetting['users-selection'] = array(); … … 186 188 foreach($FileList as $FileName) 187 189 { 188 189 190 if(file_exists($Path.$FileName) and ($FileName != '.') and ($FileName != '..')) 191 { 190 192 //echo($Path.$FileName.'<br />'); 191 192 else $Zip->addFile(file_get_contents($Path.$FileName), $ZipPath.$FileName); 193 193 if(is_dir($Path.$FileName)) CreateZipFromDir($Zip, $Path.$FileName.'/', $ZipPath.$FileName.'/'); 194 else $Zip->addFile(file_get_contents($Path.$FileName), $ZipPath.$FileName); 195 } 194 196 } 195 197 } … … 201 203 if (array_key_exists('Version',$_POST)) $ExportSetting['Version'] = $_POST['Version']; 202 204 if (array_key_exists('Export',$_POST)) $ExportSetting['Export'] = $_POST['Export']; 203 204 205 205 switch($ExportSetting['Export']) 206 { 207 case 'MangosSQLCompressed': 206 208 if(function_exists('gzcompress')) 207 209 { 208 209 210 $TempDir = $Config['Web']['TempFolder'].$_SESSION['User'].'/'; 211 if(!file_exists($TempDir)) mkdir($TempDir, 0777, true); 210 212 $SaveFilename = $TempDir.'CzWoW_SQL.zip'; 211 213 $SQLFilename = 'CzWoW_SQL.sql'; … … 223 225 '<a href="'.$SaveFilename.'">'.$SQLFilename.'</a><br />'. 224 226 '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.'); 225 226 227 break; 228 case 'MangosSQLDirect': 227 229 echo('Vygenerovaný SQL kód: <br /><pre class="SQLCode">'); 228 230 echo(htmlspecialchars(ExportToMangosSQL($ExportSetting))); 229 231 echo('</pre>'); 230 231 232 break; 233 case 'AoWoWSQLCompressed': 232 234 if(function_exists('gzcompress')) 233 235 { 234 235 236 $TempDir = $Config['Web']['TempFolder'].$_SESSION['User'].'/'; 237 if(!file_exists($TempDir)) mkdir($TempDir, 0777, true); 236 238 $SaveFilename = $TempDir.'CzAoWoW_SQL.zip'; 237 239 $SQLFilename = 'CzAoWoW_SQL.sql'; … … 249 251 '<a href="'.$SaveFilename.'">'.$SQLFilename.'</a><br />'. 250 252 '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.'); 251 252 253 break; 254 case 'AoWoWSQLDirect': 253 255 echo('Vygenerovaný SQL kód: <br /><pre class="SQLCode">'); 254 256 echo(htmlspecialchars(ExportToAoWoWSQL($ExportSetting))); 255 257 echo('</pre>'); 256 257 258 259 258 break; 259 case 'AoWoWImport': 260 require_once('../aowow/configs/config.php'); 261 echo('<div style="font-size: xx-small;">'); 260 262 echo('Gewneruji SQL kód '); 261 263 $AoWoWSQL = ExportToAoWoWSQL($ExportSetting); 262 264 echo('<strong>Hotovo</strong><br />'); 263 265 264 265 266 $Database->SelectDatabase($AoWoWconf['mangos']['db']); 267 $Database->SQLCommand('SET NAMES '.$Config['Database']['Charset']); 266 268 267 268 269 echo('Aktualizuji aktuality '); 270 $Database->SQLCommand("UPDATE `aowow_news` SET `text_loc0` = 'Poslední aktualizace dat ".Date ("d. n. Y, H:i:s")." ', `text_loc8` = 'Poslední aktualizace dat ".Date ("d. n. Y, H:i:s")." ' WHERE `aowow_news`.`id` =3"); 269 271 echo('<strong>Hotovo</strong><br />'); 270 272 271 272 273 274 { 275 276 277 278 279 280 { 281 282 283 273 echo('Mažu dočasné soubory '); 274 $files = scandir('../aowow/cache/mangos'); 275 foreach($files as $file) 276 { 277 $end = substr($file, strlen($file) - 3); 278 if($end == 'aww') unlink('../aowow/cache/mangos/'.$file); 279 } 280 $files = scandir('../aowow/cache/templates/wowhead'); 281 foreach($files as $file) 282 { 283 $end = substr($file, strlen($file) - 3); 284 if ($end == 'php') unlink('../aowow/cache/templates/wowhead/'.$file); 285 } 284 286 echo ('<strong>Hotovo</strong><br />'); 285 287 … … 288 290 foreach($BufferArray as $Line) 289 291 { 290 291 292 }292 if($Line <> '') $Database->SQLCommand($Line); 293 echo('. '); 294 } 293 295 echo('<strong>Hotovo</strong><br />'); 294 295 296 297 298 299 296 297 // TODO aowow_itemenchantmet, aowow_char_titles, aowow_factions, aowow_itemset, aowow_spelldispeltype, aowow_spellmechanic, aowow_spellrange, aowow_zones 298 299 $Database->SelectDatabase($Config['Database']['Database']); 300 $Database->SQLCommand('SET NAMES '.$Config['Database']['Charset']); 301 echo('</div>'); 300 302 WriteLog('Plnění AoWoW databáze překladem', 4); 301 302 303 break; 304 case 'XMLCompressed': 303 305 if(function_exists('gzcompress')) 304 306 { 305 306 307 $TempDir = $Config['Web']['TempFolder'].$_SESSION['User'].'/'; 308 if(!file_exists($TempDir)) mkdir($TempDir, 0777, true); 307 309 $SaveFilename = $TempDir.'CzWoW_XML.zip'; 308 310 $SQLFilename = 'CzWoW_XML.sql'; … … 321 323 '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.'); 322 324 break; 323 325 case 'XMLDirect': 324 326 echo('Vygenerované XML: <br /><pre class="SQLCode">'); 325 327 echo(htmlspecialchars(ExportToXML($ExportSetting))); 326 328 echo('</pre>'); 327 328 329 330 331 329 break; 330 /*case 'Server': 331 if(Licence(LICENCE_ADMIN)) 332 { 333 $Buffer = ExportToMangosSQL($ExportSetting); 332 334 $Database->SelectDatabase($Config['Database']['DatabaseMangos']); 333 335 $BufferArray = explode("\n", $Buffer); 334 336 echo('Přenášení dat do serveru...<br />'); 335 337 foreach($BufferArray as $Line) 336 338 { 337 338 339 339 $Database->SQLCommand($Line); 340 echo('.'); 341 } 340 342 echo("<br />Hotovo<br />"); 341 342 343 344 345 346 347 348 349 350 351 $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/OptionsFrame.xml'), 'CzWoW/OptionsFrame.xml');352 $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/CzWoW.xml'), 'CzWoW/CzWoW.xml');353 $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/CzWoW.toc'), 'CzWoW/CzWoW.toc'); 354 $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/CzWoW.lua'), 'CzWoW/CzWoW.lua');355 $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/GameMenuFrame.xml'), 'CzWoW/GameMenuFrame.xml'); 356 $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/Localization.lua'), 'CzWoW/Localization.lua'); 357 358 359 360 361 362 363 364 365 366 367 368 369 370 343 } else echo('Nemáte oprávnění.'); 344 break;*/ 345 case 'Addon': 346 if(function_exists('gzcompress')) { 347 $TempDir = $Config['Web']['TempFolder'].$_SESSION['User'].'/CzWoW-'.$ExportSetting['Version'].'/'; 348 echo('Generování addonu...'.$ExportSetting['Export'].'<br />'); 349 MakeAddon($ExportSetting); 350 $SaveFilename = $Config['Web']['TempFolder'].$_SESSION['User'].'/CzWoW_Addon-'.$ExportSetting['Version'].'.zip'; 351 $Zip = new zipfile(); 352 CreateZipFromDir($Zip, $TempDir, 'CzWoW/'); 353 $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/OptionsFrame.xml'), 'CzWoW/OptionsFrame.xml'); 354 $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/CzWoW.xml'), 'CzWoW/CzWoW.xml'); 355 $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/CzWoW.toc'), 'CzWoW/CzWoW.toc'); 356 $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/CzWoW.lua'), 'CzWoW/CzWoW.lua'); 357 $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/GameMenuFrame.xml'), 'CzWoW/GameMenuFrame.xml'); 358 $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/Localization.lua'), 'CzWoW/Localization.lua'); 359 $Buffer = $Zip->file(); 360 file_put_contents($SaveFilename, $Buffer); 361 echo('Hotovo<br /><br />'); 362 } else echo('Funkce pro tvorbu Zip souboru není podporována!'); 363 echo('<script type="text/javascript" language="JavaScript" charset="utf-8">'. 364 'setTimeout("parent.location.href=\''.$SaveFilename.'\'", 3000)'. 365 '</script>'); 366 367 echo('Pokud nezačalo stahování, soubor by mělo jít stáhnout pomocí tohoto odkazu: '. 368 '<a href="'.$SaveFilename.'">CzWoW_Addon-'.$ExportSetting['Version'].'.zip</a><br />'. 369 '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.'); 370 echo('<br /><strong>Použití ve hře</strong><br />Menu addonu ve hře vyvoláte povelem /czwow.'); 371 break; 372 case 'VerseCZ': 371 373 if(function_exists('gzcompress')) 372 374 { 373 375 $Line = mysql_fetch_assoc($Database->SQLCommand('SELECT verse FROM verseclient ORDER BY DATE DESC LIMIT 1')); 374 376 $TempDir = $Config['Web']['TempFolder'].'Addon/CzWoW/'; 375 377 echo('Generování addonu...<br />'); 376 378 MakeAddon($ExportSetting); 377 379 MakeReadme($ExportSetting); … … 379 381 $SaveFilename = $Config['Web']['TempFolder'].'Addon/CzWoW_'.$Line['verse'].'.zip'; 380 382 $Zip = new zipfile(); 381 383 CreateZipFromDir($Zip, $TempDir, 'Interface/AddOns/CzWoW/'); 382 384 //addon 383 $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/OptionsFrame.xml'), 'Interface/AddOns/CzWoW/OptionsFrame.xml'); 384 $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/CzWoW.xml'), 'Interface/AddOns/CzWoW/CzWoW.xml'); 385 $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/CzWoW.toc'), 'Interface/AddOns/CzWoW/CzWoW.toc'); 386 $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/CzWoW.lua'), 'Interface/AddOns/CzWoW/CzWoW.lua'); 387 $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/GameMenuFrame.xml'), 'Interface/AddOns/CzWoW/GameMenuFrame.xml'); 388 $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/Localization.lua'), 'Interface/AddOns/CzWoW/Localization.lua'); 389 390 $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/Fonts/FRIZQT__.ttf'), 'Fonts/FRIZQT__.ttf'); 391 $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/Fonts/MORPHEUS.ttf'), 'Fonts/MORPHEUS.ttf'); 392 $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/Fonts/SKURRI.ttf'), 'Fonts/SKURRI.ttf'); 385 $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/OptionsFrame.xml'), 'Interface/AddOns/CzWoW/OptionsFrame.xml'); 386 $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/CzWoW.xml'), 'Interface/AddOns/CzWoW/CzWoW.xml'); 387 $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/CzWoW.toc'), 'Interface/AddOns/CzWoW/CzWoW.toc'); 388 $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/CzWoW.lua'), 'Interface/AddOns/CzWoW/CzWoW.lua'); 389 $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/GameMenuFrame.xml'), 'Interface/AddOns/CzWoW/GameMenuFrame.xml'); 390 $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/CzWoW/Localization.lua'), 'Interface/AddOns/CzWoW/Localization.lua'); 391 //fonty 392 $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/Fonts/FRIZQT__.ttf'), 'Fonts/FRIZQT__.ttf'); 393 $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/Fonts/MORPHEUS.ttf'), 'Fonts/MORPHEUS.ttf'); 394 $Zip->addFile(file_get_contents('files/'.$ExportSetting['Version'].'/Fonts/SKURRI.ttf'), 'Fonts/SKURRI.ttf'); 393 395 //readme 394 $Zip->addFile(file_get_contents($Config['Web']['TempFolder'].'Addon/CzWoW/CZWOW-Readme.txt'), 'CZWOW-Readme.txt'); 395 396 396 $Zip->addFile(file_get_contents($Config['Web']['TempFolder'].'Addon/CzWoW/CZWOW-Readme.txt'), 'CZWOW-Readme.txt'); 397 398 $Buffer = $Zip->file(); 397 399 file_put_contents($SaveFilename, $Buffer); 398 400 WriteLog('Vytvořena verze češtiny pro clienta '.$Line['verse'], 4); 399 401 400 402 echo('Hotovo<br /><br />'); 401 403 } else echo('Funkce pro tvorbu Zip souboru není podporována!'); 402 404 403 405 echo('Odkaz ke stažení: '. 404 406 '<a href="'.$SaveFilename.'">'.$SaveFilename.'</a><br />'); 405 406 407 408 409 407 break; 408 case 'DBC': 409 410 echo('<br /><br /><br />U dbc souborů export textů funguje jinak, protože generování je náročné na výpočet provádí se přes noc kdy je server nejmíň vytížen. Nyní jste zadali úlohu, která se provede v noci. Zítra si můžete stáhnout vygenerovaný soubor v sekci <a href="../download.php">Stahování</a>.<br /><br />Dbc soubory je nutné zabalit do souboru patch-enGB-5.MPQ uvnitř složky "DBFilesClient" a hru spouštět přes wowme.exe. Zabalit to můžete pomocí programu <a href="../download/mpqediten32.zip">Ladik\'s MPQ Editor</a>. Stav vygenerování můžete sledovat na stránce <a href="../download.php">Stahování</a>, kde si také můžete zítra stáhnout soubor.<br /><br />'); 411 410 412 //TODO: pouze jedna aktivní úloha na uživatele 411 413 $sql = 'SELECT * FROM tasks WHERE Active = 1 AND User = '.$_SESSION['UserID']; 412 414 $ID = $Database->SQLCommand($sql); 413 414 415 415 if (mysql_num_rows($ID) > 0) 416 { 417 echo ('Nemůžete zadat stejný požadavek dvakrát za den. Bylo pouze aktualizováno nastavení exportu!'); 416 418 $Database->SQLCommand('UPDATE `wowpreklad`.`tasks` SET `ExportSetting` = "'.addslashes(serialize($ExportSetting)).'" WHERE Active = 1 AND User = '.$_SESSION['UserID']); 417 419 } else { 418 420 $Database->SQLCommand('INSERT INTO `wowpreklad`.`tasks` (`User` ,`ExportSetting` ,`Date` ) VALUES ("'.$_SESSION['UserID'].'", "'.addslashes(serialize($ExportSetting)).'", NOW( ))'); 419 420 421 422 423 421 } 422 WriteLog('Zadání úlohy pro vygenerování dbc souboru', 2); 423 424 425 /* 424 426 if(function_exists('gzcompress')) 425 427 { 426 428 $TempDir = $Config['Web']['TempFolder'].$_SESSION['User'].'/dbc/'; 427 429 echo('Generování dbc souborů...<br />'); 428 430 ExportToDBC($ExportSetting); 429 431 $SaveFilename = $Config['Web']['TempFolder'].$_SESSION['User'].'/CzWoW_DBC.zip'; 430 432 $Zip = new zipfile(); 431 432 433 CreateZipFromDir($Zip, $TempDir, 'DBCClientFiles/'); 434 $Buffer = $Zip->file(); 433 435 file_put_contents($SaveFilename, $Buffer); 434 436 echo('Hotovo<br /><br />'); 435 437 } else echo('Funkce pro tvorbu Zip souboru není podporována!'); 436 438 echo('<script type="text/javascript" language="JavaScript" charset="utf-8">'. … … 441 443 '<a href="'.$SaveFilename.'">CzWoW_DBC.zip</a><br />'. 442 444 '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.'); 443 444 445 446 447 445 echo('<br /><br /><strong>Použití ve hře</strong><br />Ze souborů vytvořte MPQ archív a nahrajte ho do hry do podsložky Data/enUS jako patch-enUS-5.MPQ. Hru spusťte pomocí programu WoWMe.exe (WoW Model Editor Fix).'); 446 */ 447 448 break; 449 case 'Lua': 448 450 if(function_exists('gzcompress')) 449 451 { 450 452 $TempDir = $Config['Web']['TempFolder'].$_SESSION['User'].'/lua/'; 451 453 echo('Generování lua souborů...<br />'); 452 454 ExportToLUA($ExportSetting); 453 455 $SaveFilename = $Config['Web']['TempFolder'].$_SESSION['User'].'/CzWoW_Lua.zip'; 454 456 $Zip = new zipfile(); 455 456 457 CreateZipFromDir($Zip, $TempDir, ''); 458 $Buffer = $Zip->file(); 457 459 file_put_contents($SaveFilename, $Buffer); 458 460 echo('Hotovo<br /><br />'); 459 461 } else echo('Funkce pro tvorbu Zip souboru není podporována!'); 460 462 echo('<script type="text/javascript" language="JavaScript" charset="utf-8">'. … … 465 467 '<a href="'.$SaveFilename.'">CzWoW_Lua.zip</a><br />'. 466 468 '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.'); 467 468 469 } 470 471 472 469 echo('<br /><br /><strong>Použití ve hře</strong><br />Ze souborů vytvořte MPQ archív a nahrajte ho do hry do podsložky Data/enUS jako patch-enUS-5.MPQ. Hru spusťte pomocí programu WoWMe.exe (WoW Model Editor Fix).'); 470 break; 471 } 472 //statistika výstupu 473 if ($ExportSetting['Export'] <> 'AoWoWSQLDirect' and $ExportSetting['Export'] <> 'XMLDirect' and $ExportSetting['Export'] <> 'AoWoWImport' and $ExportSetting['Export'] <> 'MangosSQLDirect') { 474 echo '<br /><br />'; 473 475 foreach($TranslationTree as $Group) 474 476 if($Group['TablePrefix'] != '' and (in_array($Group['Id'], $ExportSetting['groups']))) 475 477 echo('<div class="state-image"><img alt="'.$Group['TablePrefix'].'" src="../img_statistic.php?group='.$Group['Id'].'&user='.$_SESSION['UserID'].'" title="statistika překladů '.$Group['Name'].'"/></div>'); 476 478 } 477 478 479 480 WriteLog('Generování SQL výstupu: Typ exportu: <strong>'.$ExportSetting['Export'].'</strong>, Diakritika: <strong>'.$ExportSetting['Diacritics'].'</strong>', 2); 479 481 break; 480 482 case 'output': … … 486 488 487 489 if(array_key_exists('ExportSetting', $_GET)) 488 490 $ExportSetting = unserialize(stripcslashes(stripcslashes($_GET['ExportSetting']))); 489 491 490 492 echo('<strong>Krok 3. - Typ výstupu</strong><br /><br />'); 491 493 echo('<form action="?action=result" method="post"><div>'. 492 494 '<table><tr><td>'. 493 495 '<fieldset><legend>Forma výstupu</legend>'. 494 496 RadioButton('Export', 'MangosSQLDirect', $ExportSetting['Export'] == 'MangosSQLDirect', 'UpdateVersion('.GetVersions('MangosSQLDirect').',\''.$ExportSetting['Version'].'\')').'MaNGOS SQL - přímo zobrazit<br />'. 495 496 497 497 RadioButton('Export', 'MangosSQLCompressed', $ExportSetting['Export'] == 'MangosSQLCompressed', 'UpdateVersion('.GetVersions('MangosSQLCompressed').',\''.$ExportSetting['Version'].'\')').'MaNGOS SQL - komprimovaný soubor<br />'. 498 RadioButton('Export', 'AoWoWSQLDirect', $ExportSetting['Export'] == 'AoWoWSQLDirect', 'UpdateVersion('.GetVersions('AoWoWSQLDirect').',\''.$ExportSetting['Version'].'\')').'AoWoW SQL - přímo zobrazit<br />'. 499 RadioButton('Export', 'AoWoWSQLCompressed', $ExportSetting['Export'] == 'AoWoWSQLCompressed', 'UpdateVersion('.GetVersions('AoWoWSQLCompressed').',\''.$ExportSetting['Version'].'\')').'AoWoW SQL - komprimovaný soubor<br />'. 498 500 RadioButton('Export', 'XMLDirect', $ExportSetting['Export'] == 'XMLDirect', 'UpdateVersion('.GetVersions('XMLDirect').',\''.$ExportSetting['Version'].'\')').'XML - přímo zobrazit<br />'. 499 500 501 501 RadioButton('Export', 'XMLCompressed', $ExportSetting['Export'] == 'XMLCompressed', 'UpdateVersion('.GetVersions('XMLCompressed').',\''.$ExportSetting['Version'].'\')').'XML - komprimovaný soubor<br />'. 502 RadioButton('Export', 'Addon', $ExportSetting['Export'] == 'Addon', 'UpdateVersion('.GetVersions('Addon').',\''.$ExportSetting['Version'].'\')').'Addon - komprimovaný soubor<br />'. 503 RadioButton('Export', 'Lua', $ExportSetting['Export'] == 'Lua', 'UpdateVersion('.GetVersions('Lua').',\''.$ExportSetting['Version'].'\')').'Lua skripty - komprimovaný soubor<br />'); 502 504 if(Licence(LICENCE_USER)) { 503 505 echo(RadioButton('Export', 'DBC', $ExportSetting['Export'] == 'DBC', 'UpdateVersion('.GetVersions('DBC').',\''.$ExportSetting['Version'].'\')').'DBC - komprimovaný soubor (pouze přihlášení)<br />'); 504 505 506 506 } else { 507 echo (' <span style="padding: 20px"> Pro export do souborů dbc musíte být přihlášen</span>'); 508 } 507 509 if(Licence(LICENCE_ADMIN)) { 508 510 // echo(RadioButton('Export', 'DBC', $ExportSetting['Export'] == 'DBC', 'UpdateVersion('.GetVersions('DBC').',\''.$ExportSetting['Version'].'\')').'DBC - komprimovaný soubor (pouze admin)<br />'); 509 511 echo(RadioButton('Export', 'AoWoWImport', $ExportSetting['Export'] == 'AoWoWImport', 'UpdateVersion('.GetVersions('AoWoWImport').',\''.$ExportSetting['Version'].'\')').'Importovat do AoWoW (pouze admin)<br />'); 510 511 } 512 512 echo(RadioButton('Export', 'VerseCZ', $ExportSetting['Export'] == 'VerseCZ', 'UpdateVersion('.GetVersions('VerseCZ').',\''.$ExportSetting['Version'].'\')').'Vytvoření verze češtiny <a href="../download.php?createverse" Title="Před konečným exportováním napište popis k verzi" Target="_NEW">Popis k verzi</a> (pouze admin)<br />'); 513 } 514 //echo(' 513 515 echo('</fieldset>'); 514 516 echo('<fieldset><legend>Dostupné verze výstupu</legend>'); 515 516 517 echo('<select id="Version" size="5" name="Version">'); 518 WriteOption(GetVersions($ExportSetting['Export']),$ExportSetting['Version']); 517 519 echo('</select></fieldset>'); 518 519 520 521 522 523 524 525 526 520 echo('</td>'); 521 echo('<td class="Description">Zvolte způsob, jakým mají být získána výstupní data. V případě přímého zobrazení může být do vašeho prohlížeče přenášeno vysoké množství dat, což může vést k jeho přetížení.<br /><br />Poté zvolte pro kterou verzi hry mají být data získána. Pokud verze není přesná zvolte nejbližší.<br /><br />Addon je potřeba nakopírovat do složky klienta Interface/AddOns a ve hře lze zpřístupnit jeho možnosti pomocí příkazu /czwow.<br />'); 522 echo('</td></tr></table>'); 523 echo('<br /><input type="submit" value="Dokončit" />'); 524 echo('</div></form><br />'); 525 echo('<fieldset><legend>Nastavení exportu pro zálohování</legend>'); 526 WriteSetting($ExportSetting); 527 echo ('</fieldset>'); 528 break; 527 529 case 'parameters': 528 530 $ExportSetting['users-order'] = $_POST['users-order']; 529 531 $ExportSetting['users-selection'] = array(); 530 532 $UsersList = explode(',', $_POST['users-order']); 531 532 533 534 535 533 foreach($UsersList as $Index => $Item) 534 { 535 if(array_key_exists('user_'.$Item, $_POST)) $ExportSetting['users-selection'][] = $Item; 536 } 537 //if(array_key_exists('users', $_POST)) $ExportSetting['users'] = $_POST['users']; 536 538 echo('<strong>Krok 2. - Volba parametrů</strong><br /><br />'); 537 539 echo('<form action="?action=output" method="post"><div>'); 538 540 echo('<table><tr><td>'); 539 541 echo('<fieldset><legend>Jazyk</legend>'. 540 542 CheckBox('Diacritics', $ExportSetting['Diacritics'] == 'checked').'Včetně diakritiky<br /><br />'); … … 551 553 echo(SelectOption($Group['Id'], $Group['Name'].' ('.$Group['TablePrefix'].')', in_array($Group['Id'], $ExportSetting['groups']))); 552 554 553 554 555 echo('</select></fieldset><br /></td><td class="Description">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" />'); 556 echo('</div></form>'); 555 557 break; 556 558 default: 557 559 echo('<strong>Krok 1. - Výběr překladatelů</strong><br /><br />'); 558 560 echo('<script type="text/javascript" src="'.$Config['Web']['BaseURL'].'style/jquery.js"></script> 559 561 <script type="text/javascript" src="'.$Config['Web']['BaseURL'].'style/jquery-ui.js"></script> 560 562 <script type="text/javascript"> 561 563 $(document).ready(function() 562 564 { 563 $("#users-table").sortable({ items: "tr", sort: SortComplete }); 564 565 $("#users-table").sortable({ items: "tr", sort: SortComplete }); 566 $("#users-order").val($("#users-table").sortable(\'toArray\')); 565 567 }); 566 568 567 569 function SortComplete() 568 570 { 569 $("#users-order").val($("#users-table").sortable(\'toArray\')); 571 $("#users-order").val($("#users-table").sortable(\'toArray\')); 570 572 } 571 573 </script>'); … … 575 577 $Joins = ''; 576 578 577 578 579 580 581 582 583 579 //řezení podle odkazu 580 if(array_key_exists('Order', $_GET)) $order = $_GET['Order']; 581 else $order = 'T.TranslatedCount'; 582 if(array_key_exists('Desc', $_GET)) $desc = $_GET['Desc']; 583 else $desc = ''; 584 if($desc == '') $desc = 'DESC'; else $desc = ''; 585 584 586 foreach($TranslationTree as $Group) 585 587 if($Group['TablePrefix'] != '') 586 588 { 587 589 $Columns .= 'COALESCE(T'.$Group['Id'].'.Count, 0) + '; 588 590 $Joins .= ' LEFT JOIN (SELECT User, COUNT(User) as Count FROM `'.$Group['TablePrefix'].'` WHERE (Complete = 1) AND (Language <> 0) GROUP BY User) as T'.$Group['Id'].' ON user.ID=T'.$Group['Id'].'.User'; 589 591 } … … 591 593 $ID = $Database->SQLCommand($Query); 592 594 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 595 // Rebuild user order list 596 $Users = array(); 597 while($Line = mysql_fetch_assoc($ID)) { 598 $Users[$Line['ID']] = $Line; 599 $UsersOrder[] = $Line['ID']; 600 } 601 //řazení podle posledního použitého 602 if(!array_key_exists('Order', $_GET)) { 603 $UsersOrder = explode(',', $ExportSetting['users-order']); 604 foreach($Users as $User) 605 if(!in_array($User['ID'], $UsersOrder)) $UsersOrder[] = $User['ID']; 606 foreach($UsersOrder as $Index => $UserId) 607 if(!array_key_exists($UserId, $Users)) unset($UsersOrder[$Index]); 608 } 609 $ExportSetting['users-order'] = implode(',', $UsersOrder); 610 611 if(array_key_exists('team', $_GET)) { 612 $ExportSetting['users-selection'] = array(); 613 $Query = 'SELECT ID FROM user WHERE team = '.$_GET['team']; 612 614 $ID = $Database->SQLCommand($Query); 613 615 while($LineTeam = mysql_fetch_assoc($ID)) 614 615 616 617 618 echo(' <input type="submit" value="Pokračovat" /> <span onclick="CheckAll()">'.CheckBox('CheckAll', False, 'CheckAll').' Zatrhnout vše</span> '); 619 620 621 622 623 616 $ExportSetting['users-selection'][] = $LineTeam['ID']; 617 } 618 619 620 echo(' <input type="submit" value="Pokračovat" /> <span onclick="CheckAll()">'.CheckBox('CheckAll', False, 'CheckAll').' Zatrhnout vše</span> '); 621 622 echo('<table><tr><td>'. 623 '<table class="BaseTable" id="users-table"><tr> 624 <th><a href="?Order=user&Desc='.$desc.'">Jméno</a></th> 625 <th><a href="?Order=T.TranslatedCount&Desc='.$desc.'" title="Počet přeložených textů">Překladů</a></th> 624 626 <th><a href="?Order=XP&Desc='.$desc.'">Úroveň</a></th> 625 626 627 627 <th></th></tr>'); 628 //print_r($UsersOrder); 629 // Show ordered user list 628 630 foreach($UsersOrder as $UserId) 629 630 631 631 echo('<tr id="'.$UserId.'"> 632 <td><a href="'.$Config['Web']['BaseURL'].'/TranslationList.php?user='.$UserId.'&action=userall" title="Zobrazit všechny jeho přeložené texty">'.$Users[$UserId]['user'].'</a></td> 633 <td>'.$Users[$UserId]['TranslatedCount'].'</td> 632 634 <td><img src="'.$Config['Web']['TempFolder'].$Users[$UserId]['user'].'/level.png" alt="Úroveň uživatele" /></td> 633 635 <td>'.CheckBox('user_'.$UserId, in_array($UserId, $ExportSetting['users-selection']), '', 'CheckBox').'</td></tr>'); 634 636 echo('</table></td><td class="Description">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 />'. 635 637 'Řádky v tabulce můžete přesouvat metodou uchop a táhni.'. 636 638 '</td></tr></table>'. 637 638 639 639 '<div><input name="users-order" id="users-order" size="100" type="hidden" /><br />'); 640 echo('<input type="submit" value="Pokračovat" /></div>'); 641 echo('</div></form>'); 640 642 break; 641 643 } -
trunk/form.php
r243 r286 5 5 ShowPage(); 6 6 7 if(array_key_exists('group', $_GET)) $GroupId = $_GET['group']; else $GroupId = 1;7 $GroupId = LoadGroupIdParameter(); 8 8 $Table = $TranslationTree[$GroupId]['TablePrefix']; 9 9 if(array_key_exists('action', $_GET)) $Action = $_GET['action']; else $Action = ''; … … 11 11 if(array_key_exists('ID', $_GET)) 12 12 { 13 $TextID = $_GET['ID'] ;13 $TextID = $_GET['ID'] * 1; 14 14 15 15 $Line = mysql_fetch_assoc($Database->SQLCommand('SELECT * FROM '.$Table.' Where ID = '.$TextID)); … … 42 42 echo(' <b>Anglická, původní verze</b> '); 43 43 } 44 45 46 44 echo('<br />'); 45 echo ('Verze: <b>'.GetVersionWOW($Line['VersionStart']).' - '.GetVersionWOW($Line['VersionEnd'].'</b>')); 46 echo('<br />'); 47 47 48 48 $version = mysql_fetch_array($Database->SQLCommand('SELECT count(*) FROM '.$Table.' Where entry = '.$Line['entry'].' AND Language <> 0')); … … 50 50 { 51 51 echo('<form action="comparison.php" method="get"><a href="TranslationList.php?group='.$GroupId.'&action=searchentry&ID='.$Line['entry'].'">Počet verzí: <strong>'.$version['count(*)'].'</strong></a> 52 53 54 55 56 57 58 59 60 61 62 63 64 65 52 <input type="hidden" name="group" value="'.$GroupId.'" /> 53 <input type="hidden" name="entry" value="'.$Line['entry'].'" /> 54 <input type="hidden" name="ID2" value="'.$TextID.'" /> 55 <select onchange="this.form.submit();" name="ID1"> 56 <option value="-1">Vyberte text k porovnání</option> 57 <option value="-1">Zobrazit/porovnat všechny</option>'); 58 $DataID = $Database->SQLCommand('SELECT *, (SELECT user.user FROM user WHERE user.id = '.$Table.'.user) as User FROM '.$Table.' WHERE (entry = '.$Line['entry'].') AND (ID <> '.$Line['ID'].')'); 59 while($version = mysql_fetch_array($DataID)) 60 { 61 if ($version['ID'] == $Line['Take']) echo('<option value="'.$version['ID'].'">'.$version['ID'].' - '.$version['User'].' (převzato)</option>'); 62 else { 63 if (0 == $version['Language']) $version['User'] = 'Předloha'; 64 echo('<option value="'.$version['ID'].'">'.$version['ID'].' - '.$version['User'].' ('.GetVersionWOW($version['VersionStart']).' - '.GetVersionWOW($version['VersionEnd']).')</option>'); 65 } 66 66 } 67 echo('</select></form>'); 67 echo('</select></form>'); 68 68 } else 69 69 { 70 70 echo('<a href="TranslationList.php?group='.$GroupId.'&action=searchentry&ID='.$Line['entry'].'">Počet verzí: <strong>'.$version['count(*)'].'</strong></a>'); 71 71 } 72 72 … … 75 75 if(Licence(LICENCE_USER)) 76 76 { 77 77 if(($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11)) echo ('<a href="dictionary.php?group='.$GroupId.'&ID='.$LineAJ['ID'].'" target="_blank" title="Zobrazit přeložené názvy věci, postav, a herních objektů k tomuto překladu">Vyhledat v názvech</a>'); 78 78 echo(' <input type="submit" value="Uložit do rozepsaných" name="save" title="Klikněte na uložit pro pozdější dokončení překladu" /> 79 79 <input type="submit" value="Dokončeno" name="End" title="Klikněte na Dokončeno jesli jsou všechny texty hotové a chcete již publikovat" /> '); … … 113 113 { 114 114 if(($LineAJ[$TextItem['Column']] <> '') or ($Line[$TextItem['Column']] <> '')) { 115 116 117 118 119 115 if ($TextItem['Name'] == 'Text' AND (($Table == 'global_strings') OR ($Table == 'glue_strings'))) 116 echo('<tr><th>'.$LineAJ['ShortCut'].'</th>'); 117 else 118 echo('<tr><th>'.$TextItem['Name'].'</th>'); 119 echo ('<td>'.htmlspecialchars($LineAJ[$TextItem['Column']]).'</td> 120 120 <td><textarea rows="8" cols="40" onkeydown="ResizeTextArea(this)" class="textedit" id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'">'.htmlspecialchars($Line[$TextItem['Column']]).'</textarea></td></tr>'); 121 121 } 122 122 } else 123 123 { 124 124 echo('<input id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'" type="hidden" value="'.htmlspecialchars($Line[$TextItem['Column']]).'" />'); 125 125 } 126 126 echo('</table></div></form>'); -
trunk/img_statistic.php
r256 r286 6 6 $FontFile = 'images/FRIZQT__.ttf'; 7 7 $TranslationTree = GetTranslationTree(); 8 $Group = $TranslationTree[$_GET['group']]; 9 if (array_key_exists('team', $_GET)) { 10 $team = ' AND User IN (SELECT ID FROM user WHERE team = '.$_GET['team'].')'; 8 $GroupId = LoadGroupIdParameter(); 9 $Group = $TranslationTree[$GroupId]; 10 if(array_key_exists('team', $_GET)) 11 { 12 $team = ' AND `User` IN (SELECT `ID` FROM `user` WHERE `team` = '.$_GET['team'].')'; 11 13 } else $team = ''; 12 if (array_key_exists('language', $_GET)) { 13 $language = ' AND Language = '.$_GET['language'].''; 14 if(array_key_exists('language', $_GET)) 15 { 16 $language = ' AND `Language` = '.$_GET['language'].''; 14 17 } else $language = ''; 15 if (array_key_exists('user', $_GET)) { 16 $DbResult = $Database->SQLCommand('SELECT user,ExportSetting FROM `user` WHERE ID='.$_GET['user']); 17 $User = mysql_fetch_assoc($DbResult); 18 $ExportSetting = unserialize($User['ExportSetting']); 19 $SelectedUsers = ''; 20 foreach($ExportSetting['users-selection'] as $Item) 21 $SelectedUsers .= ','.$Item; 22 $SelectedUsers = substr($SelectedUsers, 1); 23 $user_sql = ' AND User IN ('.$SelectedUsers.')'; 18 if(array_key_exists('user', $_GET)) 19 { 20 $DbResult = $Database->SQLCommand('SELECT `user`,`ExportSetting` FROM `user` WHERE ID='.$_GET['user']); 21 $User = mysql_fetch_assoc($DbResult); 22 $ExportSetting = unserialize($User['ExportSetting']); 23 $SelectedUsers = ''; 24 foreach($ExportSetting['users-selection'] as $Item) 25 $SelectedUsers .= ','.$Item; 26 $SelectedUsers = substr($SelectedUsers, 1); 27 $user_sql = ' AND `User` IN ('.$SelectedUsers.')'; 24 28 } else $user_sql = ''; 25 29 26 $ID = mysql_fetch_row($Database->SQLCommand('SELECT max(VersionEnd) FROM '.$Group['TablePrefix']));30 $ID = mysql_fetch_row($Database->SQLCommand('SELECT MAX(`VersionEnd`) FROM '.$Group['TablePrefix'])); 27 31 $BuildNumber_max = $ID[0]; 28 32 29 $where = 'VersionEnd = '.$BuildNumber_max.' AND ( Language <> 0) AND (Complete= 1) '.$team.$language.$user_sql;30 $ID = mysql_fetch_row($Database->SQLCommand('SELECT count(distinct( entry)) FROM '.$Group['TablePrefix'].' WHERE '.$where));33 $where = 'VersionEnd = '.$BuildNumber_max.' AND (`Language` <> 0) AND (`Complete` = 1) '.$team.$language.$user_sql; 34 $ID = mysql_fetch_row($Database->SQLCommand('SELECT count(distinct(`entry`)) FROM '.$Group['TablePrefix'].' WHERE '.$where)); 31 35 $NumberTranslate = $ID[0]; 32 36 33 $ID = mysql_fetch_row($Database->SQLCommand('SELECT count(distinct( entry)) FROM '.$Group['TablePrefix'].' WHERE VersionEnd = '.$BuildNumber_max.' AND (Language= 0)'));37 $ID = mysql_fetch_row($Database->SQLCommand('SELECT count(distinct(`entry`)) FROM '.$Group['TablePrefix'].' WHERE `VersionEnd` = '.$BuildNumber_max.' AND (`Language` = 0)')); 34 38 $NumberAJ = $ID[0]; 35 39 36 $ID = mysql_fetch_row($Database->SQLCommand('SELECT count(*) FROM log WHERE Type = 1 AND date>= CURRENT_DATE - INTERVAL '.$Days.' DAY37 AND textLIKE "%'.$Group['Name'].'%"'));40 $ID = mysql_fetch_row($Database->SQLCommand('SELECT count(*) FROM `log` WHERE `Type` = 1 AND `date` >= CURRENT_DATE - INTERVAL '.$Days.' DAY 41 AND `text` LIKE "%'.$Group['Name'].'%"')); 38 42 $NumberPerDay = $ID[0]; //date ("Y-m-d H:i:s") 39 43 40 if($NumberAJ > 0) $Percent = ($NumberTranslate / $NumberAJ) * 100; else $Percent = 0; 44 if($NumberAJ > 0) $Percent = ($NumberTranslate / $NumberAJ) * 100; 45 else $Percent = 0; 41 46 $Percent = substr($Percent, 0, 5); 42 47 … … 51 56 imagefilledrectangle($Image, 0, 0, $PercentBar, 59, $Color2); 52 57 $FontSize = 10; 53 if (($NumberPerDay > 0) and ($team == '') and ($language == '') and ($user_sql == '') and ($NotTran>0)) { 54 $TimeToTranslate = ($NotTran / $NumberPerDay)* $Days; 55 ImageTTFText($Image, $FontSize, 0, 5, 13, $Color3, $FontFile, 'Čas do dokončení'); 56 ImageTTFText($Image, $FontSize, 0, 5, 29, $Color3, $FontFile, getmonthyears($TimeToTranslate) ); 58 if(($NumberPerDay > 0) and ($team == '') and ($language == '') and ($user_sql == '') and ($NotTran > 0)) 59 { 60 $TimeToTranslate = ($NotTran / $NumberPerDay) * $Days; 61 ImageTTFText($Image, $FontSize, 0, 5, 13, $Color3, $FontFile, 'Čas do dokončení'); 62 ImageTTFText($Image, $FontSize, 0, 5, 29, $Color3, $FontFile, getmonthyears($TimeToTranslate)); 57 63 } 58 if ($user_sql <> '') { 59 ImageTTFText($Image, $FontSize, 0, 5, 13, $Color3, $FontFile, 'Statistika výběru'); 60 ImageTTFText($Image, $FontSize, 0, 5, 29, $Color3, $FontFile, 'uživatele: '.$User['user'] ); 64 if($user_sql <> '') 65 { 66 ImageTTFText($Image, $FontSize, 0, 5, 13, $Color3, $FontFile, 'Statistika výběru'); 67 ImageTTFText($Image, $FontSize, 0, 5, 29, $Color3, $FontFile, 'uživatele: '.$User['user'] ); 61 68 } 62 69 ImageTTFText($Image, $FontSize, 0, 140, 13, $Color3, $FontFile, $NumberTranslate.'/'.$NumberAJ); … … 64 71 ImageTTFText($Image, $FontSize, 0, 140, 29, $Color3, $FontFile, $Percent.'%'); 65 72 $FontSize = 6; 66 ImageTTFText($Image, $FontSize, 0, 240, 28, $Color3, $FontFile, 'Aktualizace: '.date( "m.d.y H:i"));73 ImageTTFText($Image, $FontSize, 0, 240, 28, $Color3, $FontFile, 'Aktualizace: '.date('m.d.y H:i')); 67 74 68 Header( "Content-type: image/png");75 Header('Content-type: image/png'); 69 76 ImagePNG($Image); 70 77 ImageDestroy($Image); -
trunk/includes/global.php
r284 r286 183 183 function ShowPage() 184 184 { 185 global $Config, $Database, $RSSChannels ;185 global $Config, $Database, $RSSChannels, $PageFooterRequested; 186 186 187 187 echo('<?xml version="1.0" encoding="'.$Config['Web']['Charset'].'"?> … … 208 208 </table>'); 209 209 210 if(!array_key_exists('UserID', $_SESSION)) $_SESSION['UserID'] = '';211 if(!array_key_exists('User', $_SESSION)) $_SESSION['User'] = 'NotRegistred';212 if(!array_key_exists('Pass', $_SESSION)) $_SESSION['Pass'] = '';213 214 215 //odhlášení216 if(array_key_exists('Logout', $_GET))217 {218 WriteLog('Odhlášení', 3);219 if(is_numeric($_SESSION['UserID']))220 $Database->SQLCommand('UPDATE user SET LastLogout = NOW() WHERE ID = '.$_SESSION['UserID']);221 $_SESSION['User'] = '';222 $_SESSION['Pass'] = '';223 $_SESSION['UserID'] = '';224 }225 226 // Přihlášení227 if(array_key_exists('LoginUser', $_POST))228 {229 $_SESSION['User'] = $_POST['LoginUser'];230 $_SESSION['Pass'] = $_POST['LoginPass'];231 232 $Line = mysql_fetch_array($Database->SQLCommand('SELECT * FROM user WHERE LOWER(user) = LOWER("'.$_SESSION['User'].'") AND pass = sha1("'.$_SESSION['Pass'].'")'));233 if(!$Line)234 {235 echo('<script> alert("Jméno nebo heslo bylo zadáno špatně!"); </script>');236 $_SESSION['UserID'] = '';237 $_SESSION['User'] = '';238 $_SESSION['Pass'] = '';239 } else240 {241 $_SESSION['UserID'] = $Line['ID'];242 $_SESSION['User'] = $Line['user'];243 WriteLog('Login: '.$_SESSION['User'], 3);244 }245 }210 if(!array_key_exists('UserID', $_SESSION)) $_SESSION['UserID'] = ''; 211 if(!array_key_exists('User', $_SESSION)) $_SESSION['User'] = 'NotRegistred'; 212 if(!array_key_exists('Pass', $_SESSION)) $_SESSION['Pass'] = ''; 213 214 215 // Odhlášení 216 if(array_key_exists('Logout', $_GET)) 217 { 218 WriteLog('Odhlášení', 3); 219 if(is_numeric($_SESSION['UserID'])) 220 $Database->SQLCommand('UPDATE user SET LastLogout = NOW() WHERE ID = '.$_SESSION['UserID']); 221 $_SESSION['User'] = ''; 222 $_SESSION['Pass'] = ''; 223 $_SESSION['UserID'] = ''; 224 } 225 226 // Přihlášení 227 if(array_key_exists('LoginUser', $_POST)) 228 { 229 $_SESSION['User'] = $_POST['LoginUser']; 230 $_SESSION['Pass'] = $_POST['LoginPass']; 231 232 $Line = mysql_fetch_array($Database->SQLCommand('SELECT * FROM user WHERE LOWER(user) = LOWER("'.$_SESSION['User'].'") AND pass = sha1("'.$_SESSION['Pass'].'")')); 233 if(!$Line) 234 { 235 echo('<script> alert("Jméno nebo heslo bylo zadáno špatně!"); </script>'); 236 $_SESSION['UserID'] = ''; 237 $_SESSION['User'] = ''; 238 $_SESSION['Pass'] = ''; 239 } else 240 { 241 $_SESSION['UserID'] = $Line['ID']; 242 $_SESSION['User'] = $Line['user']; 243 WriteLog('Login: '.$_SESSION['User'], 3); 244 } 245 } 246 246 247 247 //záznam o aktivitě … … 258 258 ShowSearchBox(); 259 259 echo('</td><td id="border-left"></td><td class="content">'); 260 $PageFooterRequested = true; 260 261 } 261 262 … … 277 278 function ShowFooter() 278 279 { 279 global $Database, $Config, $ScriptStartTime; 280 281 $ScriptGenerateDuration = round(GetMicrotime() - $ScriptStartTime, 2); 282 283 echo('</td>'); 284 echo('<td class="menu2">'); 285 ShowTranslatedMenu(); 286 echo('<br />'); 287 ShowShoutBox(); 288 echo('</td>'. 280 global $Database, $Config, $ScriptStartTime, $PageFooterRequested; 281 282 if(isset($PageFooterRequested)) 283 { 284 $ScriptGenerateDuration = round(GetMicrotime() - $ScriptStartTime, 2); 285 286 echo('</td>'); 287 echo('<td class="menu2">'); 288 ShowTranslatedMenu(); 289 echo('<br />'); 290 ShowShoutBox(); 291 echo('</td>'. 289 292 '</tr><tr>'. 290 293 '<td colspan="4" class="page-bottom">Autoři: maron, chronos <a href="http://wowpreklad.zdechov.net/trac/wowpreklad/browser/trunk">Zdrojové soubory</a> '. … … 297 300 </script>'); 298 301 299 echo('</td></tr>'); 300 if($Config['Web']['ShowRuntimeInfo'] == true) echo('<tr><td colspan="3" style="text-align: center;">Doba generování: '.$ScriptGenerateDuration.' s / '.ini_get('max_execution_time').' s Použitá paměť: '.HumanSize(memory_get_peak_usage(FALSE)).' / '.ini_get('memory_limit').'B</td></tr>'); 301 echo('</table>'. 302 '</body>'. 303 '</html>'); 304 $Database->Disconnect(); 302 echo('</td></tr>'); 303 if($Config['Web']['ShowRuntimeInfo'] == true) echo('<tr><td colspan="3" style="text-align: center;">Doba generování: '.$ScriptGenerateDuration.' s / '.ini_get('max_execution_time').' s Použitá paměť: '.HumanSize(memory_get_peak_usage(FALSE)).' / '.ini_get('memory_limit').'B</td></tr>'); 304 echo('</table>'. 305 '</body>'. 306 '</html>'); 307 $Database->Disconnect(); 308 } 305 309 } 306 310 … … 313 317 if($Part != '') 314 318 { 319 if(!strpos($Part, '=')) $Part .= '='; 315 320 $Item = explode('=', $Part); 316 321 $Result[$Item[0]] = $Item[1]; -
trunk/includes/global_function.php
r285 r286 36 36 $Around = round($Config['Web']['VisiblePagingItems'] / 2); 37 37 $Result = ''; 38 $PageCount = ceil($TotalCount / $ItemPerPage);38 $PageCount = floor($TotalCount / $ItemPerPage) + 1; 39 39 40 40 if(!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0; … … 43 43 if($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1; 44 44 $CurrentPage = $_SESSION['Page']; 45 45 46 46 47 $Result .= 'Počet položek: <strong>'.$TotalCount.'</strong> Stránky: '; … … 184 185 185 186 $Result = array(); 186 $DbResult = $Database->SQLCommand('SELECT * FROM `language` ');187 $DbResult = $Database->SQLCommand('SELECT * FROM `language` WHERE `Enabled` = 1'); 187 188 while($DbRow = mysql_fetch_assoc($DbResult)) 188 189 $Result[$DbRow['Id']] = $DbRow; … … 278 279 if($Prev) echo('<a href="form.php?group='.$GroupId.'&ID='.$Next['ID'].'">Předcházející '.$Next['ID'].'</a> '); 279 280 else echo('<a href="form.php?group='.$GroupId.'&ID='.$Next['ID'].'">Následující '.$Next['ID'].'</a> '); 280 return 'form.php?group='.$GroupId.'&ID='.$Next['ID']; 281 } 282 } 283 281 return 'form.php?group='.$GroupId.'&ID='.$Next['ID']; 282 } 283 } 284 284 285 285 function HaveSameText($Group, $DbRow2, $Value) … … 334 334 function GetBuildNumber($Version) 335 335 { 336 global $Database, $BuildNumbers;337 338 if 339 { 340 $sql = 'SELECT BuildNumber FROM `wow_client_version` WHERE Version= "'.$Version.'"';336 global $Database, $BuildNumbers; 337 338 if(isset($BuildNumbers[$Version]) == false) 339 { 340 $sql = 'SELECT `BuildNumber` FROM `wow_client_version` WHERE `Version` = "'.$Version.'"'; 341 341 $DbRow = mysql_fetch_assoc($Database->SQLCommand($sql)); 342 342 $BuildNumbers[$Version] = $DbRow['BuildNumber']; … … 347 347 function GetVersionWOW($BuildNumber) 348 348 { 349 global $Database,$VersionsWOW; 350 if (isset($VersionsWOW[$BuildNumber]) == false) 351 { 352 $sql = 'SELECT Version FROM `wow_client_version` WHERE BuildNumber = "'.$BuildNumber.'"'; 349 global $Database, $VersionsWOW; 350 351 if(isset($VersionsWOW[$BuildNumber]) == false) 352 { 353 $sql = 'SELECT `Version` FROM `wow_client_version` WHERE `BuildNumber` = "'.$BuildNumber.'"'; 353 354 $Version = mysql_fetch_assoc($Database->SQLCommand($sql)); 354 355 $VersionsWOW[$BuildNumber] = $Version['Version']; 355 356 } 356 return($VersionsWOW[$BuildNumber]); 357 } 358 359 function GetDBCColumns($Version,$DBCFileName) 360 { 361 global $Database,$DBCColumns; 362 if (isset($DBCColumns[$Version][$DBCFileName]) == false) 363 { 364 $sql = 'SELECT DBCColumns_'.$DBCFileName.' as DBCColumns FROM `wow_client_version` WHERE Version = "'.$Version.'"'; 357 return($VersionsWOW[$BuildNumber]); 358 } 359 360 function GetDBCColumns($Version, $DBCFileName) 361 { 362 global $Database, $DBCColumns; 363 364 if(isset($DBCColumns[$Version][$DBCFileName]) == false) 365 { 366 $sql = 'SELECT `DBCColumns_'.$DBCFileName.'` AS `DBCColumns` FROM `wow_client_version` WHERE `Version` = "'.$Version.'"'; 365 367 $DbRow = mysql_fetch_assoc($Database->SQLCommand($sql)); 366 368 $DBCColumns[$Version][$DBCFileName] = $DbRow['DBCColumns']; 367 369 } 368 return($DBCColumns[$Version][$DBCFileName]); 369 } 370 371 function GetDBCColumnIndex($Version,$DBCFileName,$Column) 372 { 373 global $Database,$DBCColumnIndex; 374 if (isset($DBCColumnIndex[$Version][$DBCFileName][$Column]) == false) 375 { 376 $sql = 'SELECT '.$DBCFileName.'_'.$Column.' as DBCColumns FROM `wow_client_version` WHERE Version = "'.$Version.'"'; 370 return($DBCColumns[$Version][$DBCFileName]); 371 } 372 373 function GetDBCColumnIndex($Version, $DBCFileName, $Column) 374 { 375 global $Database, $DBCColumnIndex; 376 377 if(isset($DBCColumnIndex[$Version][$DBCFileName][$Column]) == false) 378 { 379 $sql = 'SELECT `'.$DBCFileName.'_'.$Column.'` AS `DBCColumns` FROM `wow_client_version` WHERE `Version` = "'.$Version.'"'; 377 380 $DbRow = mysql_fetch_assoc($Database->SQLCommand($sql)); 378 381 $DBCColumnIndex[$Version][$DBCFileName][$Column] = $DbRow['DBCColumns']; 379 382 } 380 return($DBCColumnIndex[$Version][$DBCFileName][$Column]); 383 return($DBCColumnIndex[$Version][$DBCFileName][$Column]); 384 } 385 386 function LoadGroupIdParameter() 387 { 388 global $TranslationTree; 389 390 if(array_key_exists('group', $_GET)) $GroupId = $_GET['group'] * 1; 391 else $GroupId = 1; 392 393 if(isset($TranslationTree[$GroupId]) == false) 394 { 395 echo('Překladová skupina dle zadaného Id neexistuje.'); 396 ShowFooter(); 397 die(); 398 } 399 return($GroupId); 400 } 401 402 function LoadLanguageIdParameter() 403 { 404 global $LanguageList; 405 406 if(array_key_exists('language', $_GET)) $LanguageId = $_GET['language'] * 1; 407 else $LanguageId = 1; 408 409 if(isset($LanguageList[$LanguageId]) == false) 410 { 411 echo('Jazyk dle zadaného Id neexistuje.'); 412 ShowFooter(); 413 die(); 414 } 415 return($LanguageId); 381 416 } 382 417 -
trunk/save.php
r285 r286 8 8 //if(Licence(LICENCE_USER) == false) die('Nemáte přístup do této sekce! Je nutné se přihásit.'); 9 9 10 if(array_key_exists('group', $_GET)) $GroupId = $_GET['group']; else $GroupId = 1; 11 if(isset($TranslationTree[$GroupId]) == false) 12 { 13 echo('Neexistující id překladové skupiny.'); 14 ShowFooter(); 15 die(); 16 } 10 $GroupId = LoadGroupIdParameter(); 17 11 $Table = $TranslationTree[$GroupId]['TablePrefix']; 18 12 if(array_key_exists('entry', $_POST) and Licence(LICENCE_USER)) -
trunk/statistic.php
r253 r286 5 5 ShowPage(); 6 6 7 if (array_key_exists('language', $_GET)) 8 { 9 $language = '&language='.$_GET['language']; 10 } else $language = ''; 11 if (array_key_exists('user', $_GET)) 12 { 13 $user_stat = '&user='.$_SESSION['UserID']; 14 } else $user_stat = ''; 15 7 $LanguageId = LoadLanguageIdParameter(); 8 if($LanguageId > 0) $language = '&language='.$LanguageId; 9 else $language = ''; 10 if(array_key_exists('user', $_GET)) $user_stat = '&user='.$_SESSION['UserID']; 11 else $user_stat = ''; 16 12 17 13 echo('<strong>Statistika:</strong> <a href="statistic.php">Všechny</a>'); … … 27 23 foreach($TranslationTree as $Group) 28 24 if($Group['TablePrefix'] != '') 29 30 25 echo('<div class="state-image"> 26 <img alt="'.$Group['TablePrefix'].'" src="img_statistic.php?group='.$Group['Id'].$language.$user_stat.'" title="statistika překladů '.$Group['Name'].'"/></div>'); 31 27 32 28 echo('<p><strong>Celková statistika v závislosti na čase: </strong><a href="http://stat.zdechov.net/game/?Measure=18">Počet přeložených textů</a></p> -
trunk/style/style.css
r198 r286 339 339 width: 50%; 340 340 } 341 342 .UserList 343 { 344 width: 100%; 345 text-align: center; 346 }
Note:
See TracChangeset
for help on using the changeset viewer.