Changeset 455 for trunk/admin.php
- Timestamp:
- Apr 13, 2010, 10:03:12 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin.php
r417 r455 41 41 function SaveNew() 42 42 { 43 global $ Database, $Config, $User;43 global $System, $Config, $User; 44 44 45 45 if(array_key_exists('text', $_POST)) 46 46 { 47 47 $querty = 'INSERT INTO `News` ( `Time` ,`User` ,`Text`) VALUES ( NOW( ) , '.$User->Id.', "'.$_POST['text'].'")'; 48 $ Database->SQLCommand($querty);48 $System->Database->query($querty); 49 49 echo('Aktualita uložena!'); 50 50 WriteLog('Vložena nová aktualita', LOG_TYPE_ADMINISTRATION); … … 54 54 function DeleteOldUsers() 55 55 { 56 global $ Database;56 global $System; 57 57 58 $DbResult = $ Database->SQLCommand('SELECT COUNT(*) FROM `User`');59 $DbRow2 = mysql_fetch_row($DbResult);58 $DbResult = $System->Database->query('SELECT COUNT(*) FROM `User`'); 59 $DbRow2 = $DbResult->fetch_row(); 60 60 61 61 $Condition = ' WHERE (`TranslatedCount`= 0)'. // Without translated texts … … 67 67 ' AND (NOT EXISTS (SELECT `ID` FROM `ShoutBox` WHERE `User`.`Name` = `ShoutBox`.`User`))'. // Without shoutbox messages 68 68 ''; 69 $DbResult = $ Database->SQLCommand('SELECT COUNT(*) FROM `User`'.$Condition);70 $DbRow = mysql_fetch_row($DbResult);71 $ Database->SQLCommand('DELETE FROM `User`'.$Condition);69 $DbResult = $System->Database->query('SELECT COUNT(*) FROM `User`'.$Condition); 70 $DbRow = $DbResult->fetch_row(); 71 $System->Database->query('DELETE FROM `User`'.$Condition); 72 72 echo('Smazáno '.$DbRow[0].' účtů ze všech '.$DbRow2[0].'<br/>'); 73 73 74 74 // Delete logs without user 75 $DbResult = $ Database->SQLCommand('SELECT COUNT(*) FROM `Log`');76 $DbRow2 = mysql_fetch_row($DbResult);77 $DbResult = $ Database->SQLCommand('SELECT COUNT(*) FROM `Log` WHERE (NOT EXISTS (SELECT `ID` FROM `User` WHERE `User`.`ID` = `Log`.`User`)) AND (`User` != 0)');78 $DbRow = mysql_fetch_row($DbResult);79 $ Database->SQLCommand('DELETE FROM `Log` WHERE (NOT EXISTS (SELECT `ID` FROM `User` WHERE `User`.`ID` = `Log`.`User`)) AND (`User` != 0)');75 $DbResult = $System->Database->query('SELECT COUNT(*) FROM `Log`'); 76 $DbRow2 = $DbResult->fetch_row(); 77 $DbResult = $System->Database->query('SELECT COUNT(*) FROM `Log` WHERE (NOT EXISTS (SELECT `ID` FROM `User` WHERE `User`.`ID` = `Log`.`User`)) AND (`User` != 0)'); 78 $DbRow = $DbResult->fetch_row(); 79 $System->Database->query('DELETE FROM `Log` WHERE (NOT EXISTS (SELECT `ID` FROM `User` WHERE `User`.`ID` = `Log`.`User`)) AND (`User` != 0)'); 80 80 echo('Smazáno '.$DbRow[0].' položek logu ze všech '.$DbRow2[0].'<br/>'); 81 81 82 82 // Delete invalid ExportUser 83 $DbResult = $ Database->SQLCommand('SELECT COUNT(*) FROM `ExportUser`');84 $DbRow2 = mysql_fetch_row($DbResult);85 $DbResult = $ Database->SQLCommand('SELECT COUNT(*) FROM `ExportUser` WHERE (NOT EXISTS (SELECT `Id` FROM `User` WHERE `User`.`ID` = `ExportUser`.`User`))');86 $DbRow = mysql_fetch_row($DbResult);87 $ Database->SQLCommand('DELETE FROM `ExportUser` WHERE (NOT EXISTS (SELECT `Id` FROM `User` WHERE `User`.`ID` = `ExportUser`.`User`))');83 $DbResult = $System->Database->query('SELECT COUNT(*) FROM `ExportUser`'); 84 $DbRow2 = $DbResult->fetch_row(); 85 $DbResult = $System->Database->query('SELECT COUNT(*) FROM `ExportUser` WHERE (NOT EXISTS (SELECT `Id` FROM `User` WHERE `User`.`ID` = `ExportUser`.`User`))'); 86 $DbRow = $DbResult->fetch_row(); 87 $System->Database->query('DELETE FROM `ExportUser` WHERE (NOT EXISTS (SELECT `Id` FROM `User` WHERE `User`.`ID` = `ExportUser`.`User`))'); 88 88 echo('Smazáno '.$DbRow[0].' položek výběru překladatelů u exportů ze všech '.$DbRow2[0].'<br/>'); 89 89 90 90 // Delete all teams without users 91 $DbResult = $ Database->SQLCommand('SELECT COUNT(*) FROM `Team`');92 $DbRow2 = mysql_fetch_row($DbResult);93 $DbResult = $ Database->SQLCommand('SELECT COUNT(*) FROM `Team` WHERE (SELECT COUNT(*) FROM `User` WHERE `User`.`Team` = `Team`.`Id`) = 0');94 $DbRow = mysql_fetch_row($DbResult);95 $ Database->SQLCommand('DELETE FROM `Team` WHERE (SELECT COUNT(*) FROM `User` WHERE `User`.`team` = `Team`.`Id`) = 0');91 $DbResult = $System->Database->query('SELECT COUNT(*) FROM `Team`'); 92 $DbRow2 = $DbResult->fetch_row(); 93 $DbResult = $System->Database->query('SELECT COUNT(*) FROM `Team` WHERE (SELECT COUNT(*) FROM `User` WHERE `User`.`Team` = `Team`.`Id`) = 0'); 94 $DbRow = $DbResult->fetch_row(); 95 $System->Database->query('DELETE FROM `Team` WHERE (SELECT COUNT(*) FROM `User` WHERE `User`.`team` = `Team`.`Id`) = 0'); 96 96 echo('Smazáno '.$DbRow[0].' týmů ze všech '.$DbRow2[0].'<br/>'); 97 97 98 98 // Set new leader for teams where old leader went to other team 99 $ 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 $System->Database->query('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`);'); 100 100 101 101 WriteLog('Smazány staré uživatelské účty', LOG_TYPE_ADMINISTRATION); … … 104 104 function DeleteErrorLog() 105 105 { 106 global $ Database;106 global $System; 107 107 108 $DbResult = $ Database->SQLCommand('SELECT COUNT(*) FROM `Log` WHERE `Type`='.LOG_TYPE_ERROR);109 $DbRow = mysql_fetch_row($DbResult);110 $ Database->SQLCommand('DELETE FROM `Log` WHERE `Type`='.LOG_TYPE_ERROR);108 $DbResult = $System->Database->query('SELECT COUNT(*) FROM `Log` WHERE `Type`='.LOG_TYPE_ERROR); 109 $DbRow = $DbResult->fetch_row(); 110 $System->Database->query('DELETE FROM `Log` WHERE `Type`='.LOG_TYPE_ERROR); 111 111 WriteLog('Vymazány chybové záznamy', LOG_TYPE_ADMINISTRATION); 112 112 echo('Smazáno všech '.$DbRow[0].' chybových záznamů.<br/>');
Note:
See TracChangeset
for help on using the changeset viewer.