- Timestamp:
- Feb 14, 2013, 8:24:52 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/action.php
r504 r505 280 280 $GroupId = LoadGroupIdParameter(); 281 281 $Table = $TranslationTree[$GroupId]['TablePrefix']; 282 if(array_key_exists('action', $_GET)) $Action = $_GET['action']; 283 else $Action = '';282 $Action = ''; 283 if(array_key_exists('action', $_GET)) $Action = $_GET['action']; 284 284 285 285 if($Action == 'shoutbox') $Output = ShoutBox(); -
trunk/includes/global.php
r504 r505 35 35 LogReferrer(); 36 36 37 $RSSChannels = array( 38 array('Title' => 'Změny systému', 'Channel' => 'news'), 39 array('Title' => 'Poslední překlady', 'Channel' => 'translation'), 40 array('Title' => 'Shoutbox', 'Channel' => 'shoutbox'), 41 ); 42 37 43 function GetMicrotime() 38 44 { … … 74 80 } else 75 81 { 76 $Output .= '<span class="MenuItem2"><form action=" ?action=login" method="post"> Jméno: <input type="text" name="LoginUser" size="8 " /> Heslo: <td><input type="password" name="LoginPass" size="8" /> <input type="submit" value="Přihlásit" /></form> <a href="'.$System->Link('/registrace.php').'">Registrace</a></span>';82 $Output .= '<span class="MenuItem2"><form action="'.$System->Link('/?action=login').'" method="post"> Jméno: <input type="text" name="LoginUser" size="8 " /> Heslo: <td><input type="password" name="LoginPass" size="8" /> <input type="submit" value="Přihlásit" /></form> <a href="'.$System->Link('/registrace.php').'">Registrace</a></span>'; 77 83 } 78 84 $Output .= '</div>'; … … 207 213 function ShowHeader() 208 214 { 209 global $User, $RSSChannels, $ PageFooterRequested, $System;215 global $User, $RSSChannels, $System; 210 216 211 217 $Output = '<?xml version="1.0" encoding="'.$System->Config['Web']['Charset'].'"?> … … 222 228 if(isset($RSSChannels)) 223 229 foreach($RSSChannels as $Channel) 224 $Output .= ' <link rel="alternate" title="'.$Channel['Title'].'" href="'.$Channel['URL'].'" type="application/rss+xml" />'; 230 $Output .= ' <link rel="alternate" title="'.$Channel['Title'].'" href="'. 231 $System->Link('/rss.php?channel='.$Channel['Channel']).'" type="application/rss+xml" />'; 225 232 $Output .= '<title>'.$System->Config['Web']['Title'].'</title> 226 233 </head> 227 234 <body>'; 228 235 229 if(array_key_exists('action', $_GET))230 {231 if($_GET['action'] == 'login')232 {233 if(array_key_exists('LoginUser', $_POST) and array_key_exists('LoginPass', $_POST))234 {235 $User->Login($_POST['LoginUser'], $_POST['LoginPass']);236 if($User->Role == LICENCE_ANONYMOUS)237 {238 $Message = 'Jméno nebo heslo bylo zadáno špatně.';239 $MessageType = MESSAGE_CRITICAL;240 } else241 {242 $Message = 'Přihlášení proběhlo úspěšně. Vítej <strong>'.$User->Name.'</strong>!';243 $MessageType = MESSAGE_INFORMATION;244 }245 } else246 {247 $Message = 'Nebylo zadáno jméno a heslo.';248 $MessageType = MESSAGE_CRITICAL;249 }250 } else251 if($_GET['action'] == 'logout')252 {253 if($User->Role != LICENCE_ANONYMOUS)254 {255 WriteLog('Odhlášení', LOG_TYPE_USER);256 $User->Logout();257 $Message = 'Byl jsi odhlášen.';258 $MessageType = MESSAGE_INFORMATION;259 }260 }261 }262 236 $Output .= ShowTopBar(); 263 264 237 $Output .= '<table class="page"><tr><td class="menu">'; 265 238 $Output .= ShowMainMenu(); … … 268 241 $Output .= ShowSearchBox(); 269 242 $Output .= '</td><td id="border-left"></td><td class="content">'; 270 $PageFooterRequested = true;271 243 if(isset($Message)) $Output .= ShowMessage($Message, $MessageType); 272 244 return($Output); … … 275 247 function ShowFooter() 276 248 { 277 global $System, $ScriptStartTime, $PageFooterRequested, $User; 278 279 if(isset($PageFooterRequested)) 280 { 249 global $System, $ScriptStartTime, $User; 250 281 251 $ScriptGenerateDuration = round(GetMicrotime() - $ScriptStartTime, 2); 282 252 … … 299 269 $User->Store(); 300 270 return($Output); 301 } else return('');302 271 } 303 272 … … 325 294 return($Value.' '.$UnitNames[$UnitIndex]); 326 295 } 327 328 296 329 297 function GetQueryStringArray($QueryString) -
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.