source: trunk/rss.php@ 577

Last change on this file since 577 was 577, checked in by chronos, 12 years ago
  • Modified: Moved some code from global to system file. System class is now serving as main application class. Now old files which still use ShowPage function need system initialization with $InitSystem = true; before global.php inclusion.
  • Modified: Get rid of some global reference to $System, $Config and $User variables.
  • Modified: Search result functionality moved to application module from action.php file.
File size: 2.9 KB
Line 
1<?php
2
3$InitSystem = true;
4include_once('includes/global.php');
5
6 $Items = array();
7 if($_GET['channel'] == 'news')
8 {
9 $DbResult = $System->Database->query('SELECT UNIX_TIMESTAMP(`News`.`Time`) AS `UnixTime`, '.
10 '`News`.`Title`, `News`.`Time`, `User`.`Name`, `News`.`Text` '.
11 'FROM `News` JOIN `User` ON `User`.`ID` = `News`.`User` ORDER BY `Time` DESC LIMIT 10');
12 while($DbRow = $DbResult->fetch_assoc())
13 {
14 $Items[] = array
15 (
16 'Title' => $DbRow['Title'],
17 'Link' => 'http://'.$Config['Web']['Host'].$System->Link('/'),
18 'Description' => $DbRow['Text'].' ('.$DbRow['Name'].')',
19 'Time' => $DbRow['UnixTime'],
20 );
21 }
22 echo(GenerateRSS(array
23 (
24 'Title' => 'WoW překlad - Změny systému',
25 'Link' => 'http://'.$Config['Web']['Host'].$System->Link('/'),
26 'Description' => 'Překlad textů WoW',
27 'WebmasterEmail' => $Config['Web']['AdminEmail'],
28 'Items' => $Items,
29 )));
30 } else
31 if($_GET['channel'] == 'translation')
32 {
33 $DbResult = $System->Database->query('SELECT UNIX_TIMESTAMP(`Date`) AS `Date`, `User`.`Name` AS `UserName`, `Text` FROM `Log` JOIN `User` ON `User`.`ID` = `Log`.`User` WHERE `Type` = 1 ORDER BY `Date` DESC LIMIT 100');
34 while($DbRow = $DbResult->fetch_assoc())
35 {
36 $Items[] = array
37 (
38 'Title' => strip_tags($DbRow['Text'].' ('.$DbRow['UserName'].')'),
39 'Link' => 'http://'.$Config['Web']['Host'].$System->Link('/'),
40 'Description' => $DbRow['Text'],
41 'Time' => $DbRow['Date'],
42 );
43 }
44 echo(GenerateRSS(array
45 (
46 'Title' => 'WoW překlad - Poslední překlady',
47 'Link' => 'http://'.$Config['Web']['Host'].$System->Link('/'),
48 'Description' => 'Překlad textů WoW',
49 'WebmasterEmail' => $Config['Web']['AdminEmail'],
50 'Items' => $Items,
51 )));
52 } else
53 if($_GET['channel'] == 'shoutbox')
54 {
55 $TitleLength = 50;
56 mb_internal_encoding('utf-8');
57 $DbResult = $System->Database->query('SELECT UNIX_TIMESTAMP(`Date`) AS `UnixDate`, `User`, `UserName`, `Text` FROM `ShoutBox` ORDER BY `ID` DESC LIMIT 20');
58 while($DbRow = $DbResult->fetch_assoc())
59 {
60 $Title = mb_substr($DbRow['Text'], 0, $TitleLength);
61 if(mb_strlen($Title) == $TitleLength) $Title .= '...';
62 $Items[] = array
63 (
64 'Title' => $DbRow['UserName'].': '.$Title,
65 'Link' => 'http://'.$Config['Web']['Host'].$System->Link('/'),
66 'Description' => $DbRow['Text'],
67 'Time' => $DbRow['UnixDate'],
68 );
69 }
70 echo(GenerateRSS(array
71 (
72 'Title' => 'WoW překlad - Shoutbox',
73 'Link' => 'http://'.$Config['Web']['Host'].$System->Link('/'),
74 'Description' => 'Překlad textů WoW',
75 'WebmasterEmail' => $Config['Web']['AdminEmail'],
76 'Items' => $Items,
77 )));
78 } else echo('Nezadán žádný kanál');
Note: See TracBrowser for help on using the repository browser.