Changeset 365 for trunk/admin.php
- Timestamp:
- Mar 9, 2010, 11:29:05 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin.php
r358 r365 44 44 if(array_key_exists('text', $_POST)) 45 45 { 46 $querty = 'INSERT INTO ` news` ( `Time` ,`User` ,`Text`) VALUES ( NOW( ) , '.$_SESSION['UserID'].', "'.$_POST['text'].'")';46 $querty = 'INSERT INTO `News` ( `Time` ,`User` ,`Text`) VALUES ( NOW( ) , '.$_SESSION['UserID'].', "'.$_POST['text'].'")'; 47 47 $Database->SQLCommand($querty); 48 48 echo('Aktualita uložena!'); … … 55 55 global $Database; 56 56 57 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ` user`');57 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `User`'); 58 58 $DbRow2 = mysql_fetch_row($DbResult); 59 59 … … 61 61 ' AND (`ID` != 128)'. // Skip user Neznámý 62 62 ' AND (`LastLogin` < DATE_SUB(NOW(), INTERVAL 3 MONTH))'. // Time limit 63 ' AND (NOT EXISTS (SELECT `Id` FROM `Export` WHERE ` user`.`ID` = `Export`.`User`))'. // Without exports64 ' AND (NOT EXISTS (SELECT `ID` FROM ` dictionary` WHERE `user`.`ID` = `dictionary`.`user`))'. // Without dictionary words65 ' AND (NOT EXISTS (SELECT `Id` FROM ` news` WHERE `user`.`ID` = `news`.`user`))'. // Without news66 ' AND (NOT EXISTS (SELECT `ID` FROM ` shoutbox` WHERE `user`.`user` = `shoutbox`.`user`))'. // Without shoutbox messages63 ' AND (NOT EXISTS (SELECT `Id` FROM `Export` WHERE `User`.`ID` = `Export`.`User`))'. // Without exports 64 ' AND (NOT EXISTS (SELECT `ID` FROM `Dictionary` WHERE `User`.`ID` = `Dictionary`.`User`))'. // Without dictionary words 65 ' AND (NOT EXISTS (SELECT `Id` FROM `News` WHERE `User`.`ID` = `News`.`User`))'. // Without news 66 ' AND (NOT EXISTS (SELECT `ID` FROM `ShoutBox` WHERE `User`.`User` = `ShoutBox`.`User`))'. // Without shoutbox messages 67 67 ''; 68 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ` user`'.$Condition);68 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `User`'.$Condition); 69 69 $DbRow = mysql_fetch_row($DbResult); 70 $Database->SQLCommand('DELETE FROM ` user`'.$Condition);70 $Database->SQLCommand('DELETE FROM `User`'.$Condition); 71 71 echo('Smazáno '.$DbRow[0].' účtů ze všech '.$DbRow2[0].'<br/>'); 72 72 73 73 // Delete logs without user 74 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ` log`');74 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Log`'); 75 75 $DbRow2 = mysql_fetch_row($DbResult); 76 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ` log` WHERE (NOT EXISTS (SELECT `ID` FROM `user` WHERE `user`.`ID` = `log`.`user`)) AND (user!= 0)');76 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Log` WHERE (NOT EXISTS (SELECT `ID` FROM `User` WHERE `User`.`ID` = `Log`.`User`)) AND (`User` != 0)'); 77 77 $DbRow = mysql_fetch_row($DbResult); 78 $Database->SQLCommand('DELETE FROM ` log` WHERE (NOT EXISTS (SELECT `ID` FROM `user` WHERE `user`.`ID` = `log`.`user`)) AND (user!= 0)');78 $Database->SQLCommand('DELETE FROM `Log` WHERE (NOT EXISTS (SELECT `ID` FROM `User` WHERE `User`.`ID` = `Log`.`User`)) AND (`User` != 0)'); 79 79 echo('Smazáno '.$DbRow[0].' položek logu ze všech '.$DbRow2[0].'<br/>'); 80 80 … … 82 82 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `ExportUser`'); 83 83 $DbRow2 = mysql_fetch_row($DbResult); 84 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `ExportUser` WHERE (NOT EXISTS (SELECT `Id` FROM ` user` WHERE `user`.`ID` = `ExportUser`.`User`))');84 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `ExportUser` WHERE (NOT EXISTS (SELECT `Id` FROM `User` WHERE `User`.`ID` = `ExportUser`.`User`))'); 85 85 $DbRow = mysql_fetch_row($DbResult); 86 $Database->SQLCommand('DELETE FROM `ExportUser` WHERE (NOT EXISTS (SELECT `Id` FROM ` user` WHERE `user`.`ID` = `ExportUser`.`User`))');86 $Database->SQLCommand('DELETE FROM `ExportUser` WHERE (NOT EXISTS (SELECT `Id` FROM `User` WHERE `User`.`ID` = `ExportUser`.`User`))'); 87 87 echo('Smazáno '.$DbRow[0].' položek výběru překladatelů u exportů ze všech '.$DbRow2[0].'<br/>'); 88 88 … … 90 90 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Team`'); 91 91 $DbRow2 = mysql_fetch_row($DbResult); 92 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Team` WHERE (SELECT COUNT(*) FROM ` user` WHERE `user`.`Team` = `Team`.`Id`) = 0');92 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Team` WHERE (SELECT COUNT(*) FROM `User` WHERE `User`.`Team` = `Team`.`Id`) = 0'); 93 93 $DbRow = mysql_fetch_row($DbResult); 94 $Database->SQLCommand('DELETE FROM `Team` WHERE (SELECT COUNT(*) FROM ` user` WHERE `user`.`team` = `Team`.`Id`) = 0');94 $Database->SQLCommand('DELETE FROM `Team` WHERE (SELECT COUNT(*) FROM `User` WHERE `User`.`team` = `Team`.`Id`) = 0'); 95 95 echo('Smazáno '.$DbRow[0].' týmů ze všech '.$DbRow2[0].'<br/>'); 96 96 97 97 // Set new leader for teams where old leader went to other team 98 $Database->SQLCommand('UPDATE Team SET Leader=(SELECT Id FROM `user` WHERE user.Team=Team.Id ORDER BY user.RegistrationTime LIMIT 1) WHERE Leader NOT IN (SELECT ID FROM user WHERE user.Team=Team.Id);');98 $Database->SQLCommand('UPDATE `Team` SET `Leader`=(SELECT `Id` FROM `User` WHERE `User`.`Team`=`Team`.`Id` ORDER BY `User`.`RegistrationTime` LIMIT 1) WHERE `Leader` NOT IN (SELECT `ID` FROM `User` WHERE `User`.`Team`=`Team`.`Id`);'); 99 99 100 100 WriteLog('Smazány staré uživatelské účty', LOG_TYPE_ADMINISTRATION); … … 105 105 global $Database; 106 106 107 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ` log` WHERE `type`='.LOG_TYPE_ERROR);107 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Log` WHERE `Type`='.LOG_TYPE_ERROR); 108 108 $DbRow = mysql_fetch_row($DbResult); 109 $Database->SQLCommand('DELETE FROM ` log` WHERE `type`='.LOG_TYPE_ERROR);109 $Database->SQLCommand('DELETE FROM `Log` WHERE `Type`='.LOG_TYPE_ERROR); 110 110 WriteLog('Vymazány chybové záznamy', LOG_TYPE_ADMINISTRATION); 111 111 echo('Smazáno všech '.$DbRow[0].' chybových záznamů.<br/>');
Note:
See TracChangeset
for help on using the changeset viewer.