- Timestamp:
- Sep 14, 2009, 11:13:42 AM (15 years ago)
- Location:
- trunk/inc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/inc/html.php
r634 r635 49 49 50 50 $code = '<?xml version="1.0" encoding="utf-8"?>'. 51 '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1. 0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'.52 '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">'.51 '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'. 52 '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs">'. 53 53 '<head>'. 54 54 '<meta http-equiv="content-type" content="application/xhtml+xml; charset='.$Config['Web']['Charset'].'" />'. … … 193 193 } 194 194 195 public function ShowNews($kategorie) 196 { 197 global $Config; 198 199 echo('<table class="NewsCategoryTable">'. 200 '<tr>'. 201 '<td><a href="?page=servernews">Server novinky</a></td>'. 202 '<td><a href="?page=gmnews">GM novinky</a></td>'. 203 '<td><a href="?page=gamenews">In-game novinky</a></td>'. 204 '<td><a href="?page=articles">Články</a></td>'. 205 '<td><a href="?page=main">Vše</a></td>'. 206 '</tr></table><br />'); 207 $this->QuickNew(); 208 209 if($kategorie == 'all') 210 { 211 $where = ''; 212 } else 213 { 214 $where = 'WHERE `category` = "'.$kategorie.'"'; 215 } 195 function HumanDate($Time) 196 { 197 $Date = explode(' ', $Time); 198 $Parts = explode('-', $Date[0]); 199 if($Date != '0000-00-00') return(($Parts[2]*1).'.'.($Parts[1]*1).'.'.$Parts[0]); 200 else return(' '); 201 } 202 203 function ShowNews() 204 { 205 global $Config, $db; 206 207 $db->select_db($Config['Database']['Database']); 208 209 $Output = '<table class="NewsCategoryTable">'. 210 '<tr>'; 211 $DbResult = $db->query('SELECT * FROM ArticleCategory'); 212 while($Category = $DbResult->fetch_assoc()) 213 { 214 $Output .= '<td><a href="?category='.$Category['Id'].'">'.$Category['Name'].'</a></td>'; 215 } 216 $Output .= '<td><a href="?">Vše</a></td>'. 217 '</tr></table><br />'; 218 //$this->QuickNew(); 219 220 $db->select_db($Config['Database']['Database']); 221 222 if(array_key_exists('category', $_GET)) $Filter = ' WHERE `category` = '.$_GET['category']; 223 else $Filter = ''; 216 224 217 225 $this->db->select_db($Config['Database']['Database']); 218 226 $limit = 5; 219 227 220 $DbResult = $this->db->query('SELECT id FROM `articles` '.$where.' ORDER BY `date` DESC;'); 221 $pocet = $DbResult->num_rows; 222 $offset = (isset($_GET['offset']) ? $_GET['offset'] : $pocet); 223 224 if($pocet != 0) 225 { 226 $result = $this->db->query('SELECT * FROM articles '.$where.' ORDER BY date DESC, id DESC LIMIT '.$limit.' OFFSET '.($pocet - $offset)); 227 while($row = $result->fetch_array()) 228 { 229 $row['text'] = str_replace('<br>', '<br />', $row['text']); 230 switch($row['category']) 231 { 232 case 1: 233 $cat = 'Server novinky'; 234 $link = 'servernews'; 235 break; 236 case 2: 237 $cat = 'GM novinky'; 238 $link = 'gmnews'; 239 break; 240 case 3: 241 $cat = 'In-game novinky'; 242 $link = 'gamenews'; 243 break; 244 case 4: 245 $cat = 'Články'; 246 $link = 'articles'; 247 break; 248 } 249 $date_arr = explode(' ', $row['date']); 250 $date = explode('-', $date_arr[0]); 251 $time = mktime(0, 0, 0, $date[1], $date[2], $date[0]); 252 $human_date = date('d.m.Y', $time); 253 echo('<table class="NewsQuickInfoTable">'. 228 if(array_key_exists('page_index', $_GET)) $Page = $_GET['page_index']; 229 else $Page = 0; 230 231 $DbResult = $db->query('SELECT COUNT(*) FROM `Article`'.$Filter); 232 $DbRow = $DbResult->fetch_row(); 233 $TotalCount = $DbRow[0]; 234 235 $DbResult = $db->query('SELECT Article.*, ArticleCategory.Name AS CategoryName FROM Article LEFT JOIN ArticleCategory ON ArticleCategory.Id = Article.Category '.$Filter.' ORDER BY Time DESC LIMIT '.($Page * $Config['Web']['TableRowPerPage']).', '.$Config['Web']['TableRowPerPage']); 236 while($Article = $DbResult->fetch_assoc()) 237 { 238 $Content = str_replace('&', '&', $Article['Content']); 239 $Content = str_replace('<br>', '<br/>', $Content); 240 $Content = str_replace('</br>', '<br/>', $Content); 241 $Content = str_replace('</ br>', '<br/>', $Content); 242 $Output .= '<table class="NewsQuickInfoTable">'. 254 243 '<tr>'. 255 '<td><strong>'.$ row['title'].'</strong></td>'.256 '<td style="width: 100px">'.$ human_date.'</td>'.244 '<td><strong>'.$Article['Title'].'</strong></td>'. 245 '<td style="width: 100px">'.$this->HumanDate($Article['Time']).'</td>'. 257 246 '</tr>'. 258 247 '<tr>'. 259 '<td colspan="2">'.$ row['text'].'</td>'.248 '<td colspan="2">'.$Content.'</td>'. 260 249 '</tr>'. 261 250 '<tr>'. 262 '<td>Sekce : <a href=" ?page='.$link.'">'.$cat.'</a></td>'.263 '<td>'.$ row['autor'].'</td>'.251 '<td>Sekce : <a href="category='.$Article['Category'].'">'.$Article['CategoryName'].'</a></td>'. 252 '<td>'.$Article['Author'].'</td>'. 264 253 '</tr>'. 265 254 '</table>'. 266 '<br />'); 267 } 268 echo('<p style="text-align: center">'); 269 if($offset < $pocet) 270 { 271 echo('<a href="'.$_SERVER['PHP_SELF'].($offset + $limit < $pocet ? '?offset='.($offset + $limit) : '').'"><-- novější</a> '); 272 } 273 if($offset > $limit) 274 { 275 echo(' <a href="'.$_SERVER['PHP_SELF'].'?offset='.($offset - $limit).'">starší --></a>'); 276 } 277 echo('</p>'); 278 } else 279 { 280 echo('<h3 style="text-align: center">Žádný článek v této kategorii !</h3>'); 281 } 255 '<br />'; 256 } 257 $Output .= '<div class="Center">'.$this->PageList('page_index', $Page, $TotalCount, $Config['Web']['TableRowPerPage'], 10).'</div>'; 258 259 return($Output); 282 260 } 283 261 -
trunk/inc/server.php
r634 r635 238 238 if(array_key_exists('page', $_GET)) $Target = '?page='.$_GET['page']; 239 239 else $Target = ''; 240 $Output .= '<div style="text-align: center;"><form name="RealmSelection'.$FormNameSufix.'" action="'.$Target.'" method="post">'.241 '<div>Výběr světa <select name="RealmIndex" onchange="document. RealmSelection'.$FormNameSufix.'.submit()">';240 $Output .= '<div style="text-align: center;"><form id="RealmSelection'.$FormNameSufix.'" action="'.$Target.'" method="post">'. 241 '<div>Výběr světa <select name="RealmIndex" onchange="document.getElementById(\'RealmSelection'.$FormNameSufix.'\').submit()">'; 242 242 foreach($this->Config['Mangos']['RealmList'] as $Index => $Realm) 243 243 {
Note:
See TracChangeset
for help on using the changeset viewer.