Changeset 286 for trunk/action.php
- Timestamp:
- Dec 22, 2009, 10:22:38 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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` )
Note:
See TracChangeset
for help on using the changeset viewer.