Changeset 365 for trunk/admin.php


Ignore:
Timestamp:
Mar 9, 2010, 11:29:05 AM (15 years ago)
Author:
george
Message:
  • Upraveno: Jména tabulek v databází upraveny na stejná s prvními velkými písmeny.
  • Upraveno: Doplněny SQL uvozovky do mnoha SQL dotazů.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin.php

    r358 r365  
    4444  if(array_key_exists('text', $_POST))
    4545  {
    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'].'")';
    4747    $Database->SQLCommand($querty);
    4848    echo('Aktualita uložena!');
     
    5555  global $Database;
    5656 
    57   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `user`');
     57  $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `User`');
    5858  $DbRow2 = mysql_fetch_row($DbResult);
    5959
     
    6161    ' AND (`ID` != 128)'. // Skip user Neznámý
    6262    ' AND (`LastLogin` < DATE_SUB(NOW(), INTERVAL 3 MONTH))'. // Time limit
    63     ' 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
     63    ' 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
    6767    '';
    68   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `user`'.$Condition);
     68  $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `User`'.$Condition);
    6969  $DbRow = mysql_fetch_row($DbResult);
    70   $Database->SQLCommand('DELETE FROM `user`'.$Condition);
     70  $Database->SQLCommand('DELETE FROM `User`'.$Condition);
    7171  echo('Smazáno '.$DbRow[0].' účtů ze všech '.$DbRow2[0].'<br/>');
    7272
    7373  // Delete logs without user
    74   $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `log`');
     74  $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Log`');
    7575  $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)');
    7777  $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)');
    7979  echo('Smazáno '.$DbRow[0].' položek logu ze všech '.$DbRow2[0].'<br/>');     
    8080     
     
    8282  $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `ExportUser`');
    8383  $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`))');
    8585  $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`))');
    8787  echo('Smazáno '.$DbRow[0].' položek výběru překladatelů u exportů ze všech '.$DbRow2[0].'<br/>');     
    8888
     
    9090  $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Team`');
    9191  $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');
    9393  $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');
    9595  echo('Smazáno '.$DbRow[0].' týmů ze všech '.$DbRow2[0].'<br/>');     
    9696       
    9797  // 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`);');
    9999 
    100100  WriteLog('Smazány staré uživatelské účty', LOG_TYPE_ADMINISTRATION);
     
    105105  global $Database;
    106106 
    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);
    108108  $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);
    110110  WriteLog('Vymazány chybové záznamy', LOG_TYPE_ADMINISTRATION); 
    111111  echo('Smazáno všech '.$DbRow[0].' chybových záznamů.<br/>');     
Note: See TracChangeset for help on using the changeset viewer.