Changeset 357 for trunk/log.php
- Timestamp:
- Mar 5, 2010, 7:42:00 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/log.php
r298 r357 6 6 { 7 7 $Items = array(); 8 if(array_key_exists('type', $_GET)) $Where = ' WHERE type= "'.($_GET['type'] * 1).'"';8 if(array_key_exists('type', $_GET)) $Where = ' WHERE `type` = "'.($_GET['type'] * 1).'"'; 9 9 else $Where = ''; 10 $sql = 'SELECT *,UNIX_TIMESTAMP( date), (SELECT user.user FROM user WHERE user.id = log.user) as user FROM log'.$Where.' ORDER BY dateDESC LIMIT 100';10 $sql = 'SELECT *,UNIX_TIMESTAMP(`date`), (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `log`.`user`) AS `user` FROM `log`'.$Where.' ORDER BY `date` DESC LIMIT 100'; 11 11 $ID = $Database->SQLCommand($sql); 12 12 while($Line = mysql_fetch_assoc($ID)) 13 13 { 14 if(array_key_exists($Line['type'], $LogTypes)) $TypeName = $LogTypes[$Line['type']]['Name']; 15 else $TypeName = ''; 14 $DbResult = $Database->SQLCommand('SELECT * FROM `LogType` WHERE `Id`='.$Line['type']); 15 $LogType = mysql_fetch_assoc($DbResult); 16 16 17 $Items[] = array 17 18 ( 18 'Title' => strip_tags($ TypeName.': '.$Line['text'].' ('.$Line['user'].', '.$Line['IP'].')'),19 'Title' => strip_tags($LogType['Name'].': '.$Line['text'].' ('.$Line['user'].', '.$Line['IP'].')'), 19 20 'Link' => $Config['Web']['BaseURL'].'log.php', 20 'Description' => $ TypeName.': '.$Line['text'].' ('.$Line['user'].', '.$Line['IP'].')',21 'Description' => $LogType['Name'].': '.$Line['text'].' ('.$Line['user'].', '.$Line['IP'].')', 21 22 'Time' => $Line['UNIX_TIMESTAMP(date)'], 22 23 ); … … 48 49 echo('<strong>Filtr: </strong>'); 49 50 echo('<span style="color:black"><a href="log.php?type=" title="Bez filtrování">Všechny</a></span> '); 50 foreach($LogTypes as $Index => $LogItem) 51 $DbResult = $Database->SQLCommand('SELECT * FROM `LogType`'); 52 while($LogType = mysql_fetch_assoc($DbResult)) 51 53 { 52 echo('<a href="log.php?type='.$ Index.'" style="color:'.$LogItem['Color'].'" title="'.$LogItem['Name'].'">'.$LogItem['Name'].'</a> ');54 echo('<a href="log.php?type='.$LogType['Id'].'" style="color:'.$LogType['Color'].'" title="'.$LogType['Name'].'">'.$LogType['Name'].'</a> '); 53 55 } 54 56 } … … 59 61 else 60 62 { 61 if(array_key_exists('group', $_SESSION)) $Where = ' WHERE textLIKE "%'.$TranslationTree[$_SESSION['group']]['Name'].'%"';63 if(array_key_exists('group', $_SESSION)) $Where = ' WHERE `text` LIKE "%'.$TranslationTree[$_SESSION['group']]['Name'].'%"'; 62 64 else $Where = ''; 63 65 } … … 80 82 echo($Order['Output']); 81 83 82 $sql = 'SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `log`.`user`) AS `user` FROM `log` '.$Where.$Order['SQL'].$PageList['SQLLimit'];84 $sql = 'SELECT *, `LogType`.`Color` AS `LogColor`, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `log`.`user`) AS `user` FROM `log` LEFT JOIN `LogType` ON `LogType`.`Id`=`log`.`type` '.$Where.$Order['SQL'].$PageList['SQLLimit']; 83 85 //echo($sql); 84 86 $ID = $Database->SQLCommand($sql); 85 87 while($Line = mysql_fetch_assoc($ID)) 86 88 { 87 echo('<tr><td>'.$Line['date'].'</td><td><span style="color: '.$LogTypes[$Line['type']]['Color'].'">'.$Line['text'].'</span></td><td>'.$Line['user'].'</td><td>'.$Line['IP'].'</td></tr>');89 echo('<tr><td>'.$Line['date'].'</td><td><span style="color: '.$Line['LogColor'].'">'.$Line['text'].'</span></td><td>'.$Line['user'].'</td><td>'.$Line['IP'].'</td></tr>'); 88 90 } 89 91 echo('</table>');
Note:
See TracChangeset
for help on using the changeset viewer.