1 | <?php
|
---|
2 |
|
---|
3 | include('includes/global.php');
|
---|
4 |
|
---|
5 | ShowPage();
|
---|
6 |
|
---|
7 | if(array_key_exists('group', $_GET)) $GroupId = $_GET['group']; else $GroupId = 1;
|
---|
8 | $Table = $TranslationTree[$GroupId]['TablePrefix'];
|
---|
9 | if(array_key_exists('action', $_GET)) $Action = $_GET['action']; else $Action = '';
|
---|
10 |
|
---|
11 | if(($Action == 'search'))
|
---|
12 | {
|
---|
13 | if(array_key_exists('search', $_GET)) $Search = $_GET['search'];
|
---|
14 | else $Search = $_POST['search'];
|
---|
15 |
|
---|
16 | echo('<table class="BaseTable"><tr><th>Skupina</th><th>Výsledků</th></tr>');
|
---|
17 | foreach($TranslationTree as $Group) {
|
---|
18 | $Table = $Group['TablePrefix'];
|
---|
19 |
|
---|
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 | }
|
---|
30 |
|
---|
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 |
|
---|
39 | echo('</table>');
|
---|
40 | }
|
---|
41 |
|
---|
42 |
|
---|
43 | if(($Action == 'dbkit') and Licence(LICENCE_ADMIN))
|
---|
44 | {
|
---|
45 | echo ('<form action="?action=dbkit" method="post">');
|
---|
46 | echo('Najít: <input type="text" name="find" /><br />');
|
---|
47 | echo('Nahradit: <input type="text" name="replace" /><br />');
|
---|
48 | echo('<input type="submit" value="Najít/nahradit" /><br />');
|
---|
49 | echo('</form>');
|
---|
50 |
|
---|
51 | if (array_key_exists('find',$_POST)) {
|
---|
52 | echo ('Začínám nahrazovat: <br />');
|
---|
53 | $find = $_POST['find'];
|
---|
54 | $replace = $_POST['replace'];
|
---|
55 |
|
---|
56 | foreach($TranslationTree as $Group) {
|
---|
57 | $Table = $Group['TablePrefix'];
|
---|
58 | echo ($Table.' ');
|
---|
59 |
|
---|
60 | $sql = 'SELECT * FROM '.$Table.' WHERE (Language <> 0) AND (';
|
---|
61 | foreach($Group['Items'] as $Item) {
|
---|
62 | if($Item['Column'] != '') $sql .= '`'.$Item['Column'].'` LIKE "%'.$find.'%" OR ';
|
---|
63 | }
|
---|
64 | $sql = substr($sql,0,strlen($sql)-4);
|
---|
65 | $sql .= ')';
|
---|
66 |
|
---|
67 | $ID = $Database->SQLCommand($sql);
|
---|
68 | while ($Line = mysql_fetch_assoc($ID)) {
|
---|
69 | $sql = 'UPDATE '.$Table.' SET ';
|
---|
70 | foreach($Group['Items'] as $Item) {
|
---|
71 | $Column_text = addslashes(str_replace($find,$replace,$Line[$Item['Column']]));
|
---|
72 | $sql .= ' '.$Item['Column'].' = "'.$Column_text.'",';
|
---|
73 | }
|
---|
74 | $sql = substr($sql,0,strlen($sql)-1);
|
---|
75 | $sql .= ' WHERE ID = '.$Line['ID'];
|
---|
76 | $Database->SQLCommand($sql);
|
---|
77 | echo ('.');
|
---|
78 | }
|
---|
79 |
|
---|
80 | echo (' <strong>Hotovo</strong> <br />');
|
---|
81 | if (mysql_num_rows($ID) > 0) {
|
---|
82 | WriteLog('Použita oprava DB ovlivněno '.mysql_num_rows($ID).' řádků z tabulky '.$Table.', "'.$find.'" nahrazeno za "'.$replace.'"', 4);
|
---|
83 | echo (' Použita oprava DB ovlivněno '.mysql_num_rows($ID).' řádků z tabulky '.$Table.', "'.$find.'" nahrazeno za "'.$replace.'"<br />');
|
---|
84 | }
|
---|
85 | }
|
---|
86 | }
|
---|
87 | }
|
---|
88 |
|
---|
89 |
|
---|
90 | if(($Action == 'delete') and Licence(LICENCE_MODERATOR))
|
---|
91 | {
|
---|
92 | $TextID = $_GET['ID'];
|
---|
93 | $Database->SQLCommand('DELETE FROM '.$Table.' WHERE ID = '.$TextID.' AND Language <> 0');
|
---|
94 | echo('Překlad byl smazán!');
|
---|
95 | WriteLog('Překlad byl smazán! <a href="form.php?group='.$GroupID.'&ID='.$TextID.'">'.$TextID.'</a>', 4);
|
---|
96 | }
|
---|
97 |
|
---|
98 | if($Action == 'shoutbox')
|
---|
99 | {
|
---|
100 | if(array_key_exists('shoutbox', $_GET)) $shoutbox = $_GET['shoutbox'];
|
---|
101 | else $shoutbox = '';
|
---|
102 | if($shoutbox == '')
|
---|
103 | {
|
---|
104 | echo('<form action="action.php?action=shoutbox&shoutbox=1" method="post"><fieldset><legend>Nová zpráva shoutboxu</legend>
|
---|
105 | Uživatel: ');
|
---|
106 | if(Licence(LICENCE_USER)) echo('<b>'.$_SESSION['User'].'</b><br />');
|
---|
107 | else echo('<input type="text" name="user" /><br />');
|
---|
108 | echo('Text zprávy: <br>
|
---|
109 | <textarea name="text" cols="40"></textarea> <br />
|
---|
110 | <input type="submit" value="Uložit" /><br /></fieldset>
|
---|
111 | </form>');
|
---|
112 | } else
|
---|
113 | {
|
---|
114 | if(Licence(LICENCE_USER)) $user = $_SESSION['User'];
|
---|
115 | else die('Pro vkládaní musíte byt registrováni!');
|
---|
116 | $text = $_POST['text'];
|
---|
117 | $Database->SQLCommand("INSERT INTO `shoutbox` ( `user` , `text` , `date` , `IP` )
|
---|
118 | VALUES ( '$user', '$text', now(), '".$_SERVER['REMOTE_ADDR']."');");
|
---|
119 | echo('Zpráva vložena!<br>Budete přesměrováni...');
|
---|
120 | echo('
|
---|
121 | <script type="text/javascript" language="JavaScript" charset="utf-8">
|
---|
122 | setTimeout("parent.location.href=\'index.php\'",1000)
|
---|
123 | </script>');
|
---|
124 | }
|
---|
125 | }
|
---|
126 |
|
---|
127 | ShowFooter();
|
---|
128 |
|
---|
129 | ?>
|
---|
130 |
|
---|