Changeset 505 for trunk/index.php
- Timestamp:
- Feb 14, 2013, 8:24:52 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/index.php
r504 r505 54 54 } 55 55 56 function ShowRSSChannel()57 {58 global $System, $Config;59 60 $Items = array();61 if($_GET['rss'] == 'news')62 {63 $DbResult = $System->Database->query('SELECT UNIX_TIMESTAMP(`News`.`Time`) AS `UnixTime`, `News`.`Time`, `User`.`Name`, `News`.`Text` FROM `News` JOIN `User` ON `User`.`ID` = `News`.`User` ORDER BY `Time` DESC LIMIT 10');64 while($DbRow = $DbResult->fetch_assoc())65 {66 $Items[] = array67 (68 'Title' => $DbRow['Name'].'('.date('d.m.Y', MysqlDateTimeToTime($DbRow['Time'])).')',69 'Link' => 'http://'.$Config['Web']['Host'].$System->Link('/'),70 'Description' => $DbRow['Text'],71 'Time' => $DbRow['UnixTime'],72 );73 }74 echo(GenerateRSS(array75 (76 'Title' => 'WoW překlad - Změny systému',77 'Link' => 'http://'.$Config['Web']['Host'].$System->Link('/'),78 'Description' => 'Překlad textů WoW',79 'WebmasterEmail' => $Config['Web']['AdminEmail'],80 'Items' => $Items,81 )));82 } else83 if($_GET['rss'] == 'translation')84 {85 $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');86 while($DbRow = $DbResult->fetch_assoc())87 {88 $Items[] = array89 (90 'Title' => strip_tags($DbRow['Text'].' ('.$DbRow['UserName'].')'),91 'Link' => 'http://'.$Config['Web']['Host'].$System->Link('/'),92 'Description' => $DbRow['Text'],93 'Time' => $DbRow['Date'],94 );95 }96 echo(GenerateRSS(array97 (98 'Title' => 'WoW překlad - Poslední překlady',99 'Link' => 'http://'.$Config['Web']['Host'].$System->Link('/'),100 'Description' => 'Překlad textů WoW',101 'WebmasterEmail' => $Config['Web']['AdminEmail'],102 'Items' => $Items,103 )));104 } else105 if($_GET['rss'] == 'shoutbox')106 {107 $TitleLength = 50;108 mb_internal_encoding('utf-8');109 $DbResult = $System->Database->query('SELECT UNIX_TIMESTAMP(`Date`) AS `UnixDate`, `User`, `UserName`, `Text` FROM `ShoutBox` ORDER BY `ID` DESC LIMIT 20');110 while($DbRow = $DbResult->fetch_assoc())111 {112 $Title = mb_substr($DbRow['Text'], 0, $TitleLength);113 if(mb_strlen($Title) == $TitleLength) $Title .= '...';114 $Items[] = array115 (116 'Title' => $DbRow['UserName'].': '.$Title,117 'Link' => 'http://'.$Config['Web']['Host'].$System->Link('/'),118 'Description' => $DbRow['Text'],119 'Time' => $DbRow['UnixDate'],120 );121 }122 echo(GenerateRSS(array123 (124 'Title' => 'WoW překlad - Shoutbox',125 'Link' => 'http://'.$Config['Web']['Host'].$System->Link('/'),126 'Description' => 'Překlad textů WoW',127 'WebmasterEmail' => $Config['Web']['AdminEmail'],128 'Items' => $Items,129 )));130 } else echo('Žádný kanál');131 }132 133 56 function ShowWelcome() 134 57 { … … 168 91 } 169 92 170 if(array_key_exists(' rss', $_GET))93 if(array_key_exists('action', $_GET)) 171 94 { 172 ShowRSSChannel(); 173 } else 174 { 175 $RSSChannels = array( 176 array('Title' => 'Změny systému', 'URL' => '?rss=news'), 177 array('Title' => 'Poslední překlady', 'URL' => '?rss=translation'), 178 array('Title' => 'Shoutbox', 'URL' => '?rss=shoutbox'), 179 ); 180 181 $Output = '<br />'. 182 '<table class="Home"><tr><td colspan="3">'.ShowWelcome(). 183 '</td></tr>'. 184 '<tr><td>'.ShowLastTranslated().'</td>'. 185 '<td class="news-box">'.ShowNews().'</td>'. 186 '<td>'.ShowShoutBox().'</td>'. 187 '</tr></table>'; 188 189 ShowPage($Output); 95 if($_GET['action'] == 'login') 96 { 97 if(array_key_exists('LoginUser', $_POST) and array_key_exists('LoginPass', $_POST)) 98 { 99 $User->Login($_POST['LoginUser'], $_POST['LoginPass']); 100 if($User->Role == LICENCE_ANONYMOUS) 101 { 102 $Message = 'Jméno nebo heslo bylo zadáno špatně.'; 103 $MessageType = MESSAGE_CRITICAL; 104 } else 105 { 106 $Message = 'Přihlášení proběhlo úspěšně. Vítej <strong>'.$User->Name.'</strong>!'; 107 $MessageType = MESSAGE_INFORMATION; 108 } 109 } else 110 { 111 $Message = 'Nebylo zadáno jméno a heslo.'; 112 $MessageType = MESSAGE_CRITICAL; 113 } 114 } else 115 if($_GET['action'] == 'logout') 116 { 117 if($User->Role != LICENCE_ANONYMOUS) 118 { 119 WriteLog('Odhlášení', LOG_TYPE_USER); 120 $User->Logout(); 121 $Message = 'Byl jsi odhlášen.'; 122 $MessageType = MESSAGE_INFORMATION; 123 } 124 } 190 125 } 191 126 127 $Output = '<br />'. 128 '<table class="Home"><tr><td colspan="3">'.ShowWelcome(). 129 '</td></tr>'. 130 '<tr><td>'.ShowLastTranslated().'</td>'. 131 '<td class="news-box">'.ShowNews().'</td>'. 132 '<td>'.ShowShoutBox().'</td>'. 133 '</tr></table>'; 134 135 ShowPage($Output); 136 192 137 ?>
Note:
See TracChangeset
for help on using the changeset viewer.