Changeset 455 for trunk/action.php
- Timestamp:
- Apr 13, 2010, 10:03:12 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/action.php
r436 r455 5 5 function Search() 6 6 { 7 global $ Database, $TranslationTree;7 global $System, $TranslationTree; 8 8 9 9 if(array_key_exists('search', $_GET)) $Search = $_GET['search']; … … 22 22 if($Item['Column'] != '') $sql .= ' OR `'.$Item['Column'].'` LIKE "%'.$Search.'%"'; 23 23 } 24 $Line = mysql_fetch_row($Database->SQLCommand($sql)); 24 $DbResult = $System->Database->query($sql); 25 $Line = $DbResult->fetch_row(); 25 26 echo('<tr><td><a href="TranslationList.php?group='.$Group['Id'].'&user=0&state=0&text='.$Search.'&entry=">'.$Group['Name'].'</a></td><td>'.$Line[0].'</td></tr>'); 26 27 } 27 28 28 $Line = mysql_fetch_row($Database->SQLCommand('SELECT count(*) FROM `User` WHERE `Name` LIKE "%'.$Search.'%"')); 29 $DbResult = $System->Database->query('SELECT count(*) FROM `User` WHERE `Name` LIKE "%'.$Search.'%"'); 30 $Line = $DbResult->fetch_row(); 29 31 echo('<tr><td><a href="userlist.php?search='.$Search.'">Uživatelé</a></td><td>'.$Line[0].'</td></tr>'); 30 $Line = mysql_fetch_row($Database->SQLCommand('SELECT count(*) FROM `Team` WHERE `Name` LIKE "%'.$Search.'%" OR `Description` LIKE "%'.$Search.'%"')); 32 33 $DbResult = $System->Database->query('SELECT count(*) FROM `Team` WHERE `Name` LIKE "%'.$Search.'%" OR `Description` LIKE "%'.$Search.'%"'); 34 $Line = $DbResult->fetch_row(); 31 35 echo('<tr><td><a href="team.php?search='.$Search.'">Týmy</a></td><td>'.$Line[0].'</td></tr>'); 32 $Line = mysql_fetch_row($Database->SQLCommand('SELECT count(*) FROM `CzWoWPackageVersion` WHERE `Text` LIKE "%'.$Search.'%"')); 36 37 $DbResult = $System->Database->query('SELECT count(*) FROM `CzWoWPackageVersion` WHERE `Text` LIKE "%'.$Search.'%"'); 38 $Line = $DbResult->fetch_row(); 33 39 echo('<tr><td><a href="download.php?addon">Čeština pro klienta</a></td><td>'.$Line[0].'</td></tr>'); 34 40 echo('<tr><td><a href="aowow/?search='.$Search.'">Vyhledávací databáze AoWoW</a></td></tr>'); 35 $Line = mysql_fetch_row($Database->SQLCommand('SELECT count(*) FROM `Dictionary` WHERE (`Text` LIKE "%'.$Search.'%" OR `Description` LIKE "%'.$Search.'%") AND `Language` = 0')); 41 42 $DbResult = $System->Database->query('SELECT count(*) FROM `Dictionary` WHERE (`Text` LIKE "%'.$Search.'%" OR `Description` LIKE "%'.$Search.'%") AND `Language` = 0'); 43 $Line = $DbResult->fetch_row(); 36 44 echo('<tr><td><a href="dictionary.php?search='.$Search.'">Slovníček</a></td><td>'.$Line[0].'</td></tr>'); 37 45 … … 41 49 function DatabaseKit() 42 50 { 43 global $ Database, $TranslationTree, $User;51 global $System, $TranslationTree, $User; 44 52 45 53 if($User->Licence(LICENCE_ADMIN)) … … 61 69 { 62 70 $sql = 'DELETE FROM `Log` WHERE `Type` = '.$_POST['Type']; 63 $ Database->SQLCommand($sql);71 $System->Database->query($sql); 64 72 WriteLog('Vymazán log '.$_POST['Type'], LOG_TYPE_MODERATOR); 65 73 echo(' Vymazán log '.$_POST['Type']); … … 85 93 $sql .= ')'; 86 94 87 $ ID = $Database->SQLCommand($sql);88 while ($Line = mysql_fetch_assoc($ID))95 $DbResult = $System->Database->query($sql); 96 while ($Line = $DbResult->fetch_assoc()) 89 97 { 90 98 $sql = 'UPDATE '.$Table.' SET '; … … 96 104 $sql = substr($sql,0,strlen($sql)-1); 97 105 $sql .= ' WHERE `ID` = '.$Line['ID']; 98 $ Database->SQLCommand($sql);106 $System->Database->query($sql); 99 107 echo ('.'); 100 108 } … … 123 131 FROM `'.$Table.'` AS `Tran` WHERE (`Language` <> 0) AND ((`Take` = 0) OR (`ID` = `Take`) OR NOT EXISTS(SELECT 1 FROM `'.$Table.'` WHERE `ID` = `Tran`.`Take`))'; 124 132 125 $ ID = $Database->SQLCommand($sql);126 while($Line = mysql_fetch_assoc($ID))133 $DbResult = $System->Database->query($sql); 134 while($Line = $DbResult->fetch_assoc()) 127 135 { 128 136 $sql = 'UPDATE `'.$Table.'` SET `Take` = '.$Line['IDOrig'].' WHERE `ID` = '.$Line['ID']; 129 $ Database->SQLCommand($sql);137 $System->Database->query($sql); 130 138 echo('.'); 131 139 } … … 150 158 echo ($Table.' '); 151 159 $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`'; 152 $ ID = $Database->SQLCommand($sql);153 while ($Line = mysql_fetch_assoc($ID))160 $DbResult = $System->Database->query($sql); 161 while ($Line = $DbResult->fetch_assoc()) 154 162 { 155 163 $sql = 'UPDATE `'.$Table.'` SET `ShortCut` = '.$Line['ShortCut_orig'].' WHERE `ID` = '.$Line['ID']; 156 $ Database->SQLCommand($sql);164 $System->Database->query($sql); 157 165 echo ('.'); 158 166 } 159 167 160 168 echo (' <strong>Hotovo</strong> <br />'); 161 if( mysql_num_rows($ID)> 0)162 { 163 WriteLog('Použita oprava DB na sloupec ShortCut '. mysql_num_rows($ID).' řádků z tabulky '.$Table, LOG_TYPE_MODERATOR);164 echo (' Použita oprava DB na sloupec ShortCut '. mysql_num_rows($ID).' řádků z tabulky '.$Table.'<br />');169 if($DbResult->num_rows > 0) 170 { 171 WriteLog('Použita oprava DB na sloupec ShortCut '.$DbResult->num_rows.' řádků z tabulky '.$Table, LOG_TYPE_MODERATOR); 172 echo (' Použita oprava DB na sloupec ShortCut '.$DbResult->num_rows.' řádků z tabulky '.$Table.'<br />'); 165 173 } 166 174 } … … 171 179 function Delete() 172 180 { 173 global $ Database, $User;181 global $System, $User; 174 182 175 183 if($User->Licence(LICENCE_MODERATOR)) 176 184 { 177 185 $TextID = $_GET['ID']; 178 $ Database->SQLCommand('DELETE FROM `'.$Table.'` WHERE `ID` = '.$TextID.' AND `Language` <> 0');186 $System->Database->query('DELETE FROM `'.$Table.'` WHERE `ID` = '.$TextID.' AND `Language` <> 0'); 179 187 echo('Překlad byl smazán!'); 180 188 WriteLog('Překlad byl smazán! <a href="form.php?group='.$GroupID.'&ID='.$TextID.'">'.$TextID.'</a>', LOG_TYPE_MODERATOR); … … 184 192 function ShoutBox() 185 193 { 186 global $Database, $User; 187 188 if(array_key_exists('shoutbox', $_GET)) $shoutbox = $_GET['shoutbox']; 189 else $shoutbox = ''; 190 if($shoutbox == '') 191 { 192 echo('<form action="action.php?action=shoutbox&shoutbox=1" method="post"><fieldset><legend>Nová zpráva kecátka</legend> 193 Uživatel: '); 194 global $System, $User; 195 196 if(!array_key_exists('add', $_POST)) 197 { 198 echo('<form action="action.php?action=shoutbox" method="post">'. 199 '<fieldset><legend>Nová zpráva kecátka</legend> 200 Uživatel: '); 194 201 if($User->Licence(LICENCE_USER)) echo('<b>'.$User->Name.'</b><br />'); 195 else echo('<input type="text" name="user" /><br />');202 else echo('<input type="text" name="user" /><br />'); 196 203 echo('Text zprávy: <br> 197 204 <textarea onkeydown="ResizeTextArea(this)" name="text" cols="40"></textarea> <br /> 198 <input type="submit" value="Odeslat" /><br /></fieldset>205 <input type="submit" name="add" value="Odeslat" /><br /></fieldset> 199 206 </form>'); 200 207 } else … … 202 209 if($User->Licence(LICENCE_USER)) 203 210 { 204 $Text = $_POST['text']; 205 $Database->SQLCommand('INSERT INTO `ShoutBox` ( `User` , `Text` , `Date` , `IP` ) '. 211 if(array_key_exists('text', $_POST)) 212 { 213 $Text = $_POST['text']; 214 $System->Database->query('INSERT INTO `ShoutBox` ( `User` , `Text` , `Date` , `IP` ) '. 206 215 ' VALUES ("'.$User->Name.'", "'.$Text.'", NOW(), "'.$_SERVER['REMOTE_ADDR'].'")'); 207 echo('Zpráva vložena!<br>Budete přesměrováni...'); 208 echo(' 209 <script type="text/javascript" language="JavaScript" charset="utf-8"> 210 setTimeout("parent.location.href=\'index.php\'",1000) 211 </script>'); 212 } else echo('Pro vkládaní musíte byt registrováni!'); 213 } 216 echo('Zpráva vložena!<br/>'); 217 } else echo('Nezadán text pro novou zprávu!<br/>'); 218 } else echo('Pro vkládaní musíte byt registrováni!<br/>'); 219 } 220 echo('<br/>'); 221 ShoutBoxView(); 214 222 } 215 223 216 224 function ShoutBoxView() 217 225 { 218 global $ Database, $User;219 220 $DbResult = $ Database->SQLCommand('SELECT COUNT(*) FROM `ShoutBox`');221 $DbRow = mysql_fetch_row($DbResult);226 global $System, $User; 227 228 $DbResult = $System->Database->query('SELECT COUNT(*) FROM `ShoutBox`'); 229 $DbRow = $DbResult->fetch_row(); 222 230 $PageList = GetPageList($DbRow[0]); 223 231 … … 226 234 if($User->Licence(LICENCE_USER)) echo(' <a href="action.php?action=shoutbox">Vložit</a>'); 227 235 echo('<div class="shoutbox">'); 228 $ ID = $Database->SQLCommand('SELECT * FROM `ShoutBox` ORDER BY `ID` DESC '.$PageList['SQLLimit']);229 while($Line = mysql_fetch_assoc($ID))236 $DbResult = $System->Database->query('SELECT * FROM `ShoutBox` ORDER BY `ID` DESC '.$PageList['SQLLimit']); 237 while($Line = $DbResult->fetch_assoc()) 230 238 echo('<div><strong>'.$Line['User'].'</strong>: '.htmlspecialchars($Line['Text']).'</div>'); 231 239 echo('</div>'); … … 235 243 function ShowNewsHistory() 236 244 { 237 global $ Database, $User;238 239 $DbResult = $ Database->SQLCommand('SELECT COUNT(*) FROM `News`');240 $DbRow = mysql_fetch_row($DbResult);245 global $System, $User; 246 247 $DbResult = $System->Database->query('SELECT COUNT(*) FROM `News`'); 248 $DbRow = $DbResult->fetch_row(); 241 249 $PageList = GetPageList($DbRow[0]); 242 250 … … 245 253 if($User->Licence(LICENCE_USER)) echo(' <a href="admin.php?action=addnew">Vložit</a>'); 246 254 echo('<div class="shoutbox">'); 247 $ ID = $Database->SQLCommand('SELECT `News`.`Time`, `News`.`Text`, `User`.`Name` AS `User` FROM `News` JOIN `User` ON `User`.`ID`=`News`.`User` ORDER BY `News`.`Time` DESC '.$PageList['SQLLimit']);248 while($Line = mysql_fetch_assoc($ID))255 $dbResult = $System->Database->query('SELECT `News`.`Time`, `News`.`Text`, `User`.`Name` AS `User` FROM `News` JOIN `User` ON `User`.`ID`=`News`.`User` ORDER BY `News`.`Time` DESC '.$PageList['SQLLimit']); 256 while($Line = $DbResult->fetch_assoc()) 249 257 echo('<div><strong>'.HumanDate($Line['Time']).'</strong> '.$Line['Text'].' ('.$Line['User'].')</div>'); 250 258 echo('</div>');
Note:
See TracChangeset
for help on using the changeset viewer.