db = &$db; // default config $this->html_cfg = array ( /* "charset" => "utf-8", "author" => "Zork", "copyright" => "(C) 2008 Heroes of Fantasy, All rights reserved.", "favicon" => "imgs/fav", "title" => "Heroes of Fantasy", "description" => "Heroes of Fantasy free WoW server běžící na programu MaNGOS", "keywords" => "wowserver, world of warcraft, free, wow, server, hof, heroes of fantasy, zdechov, mangos" */ ); if((count($values) > 1) or ($values[0] != 0) and ($values[0] != 0)) { $result_cfg = array_merge ($this->html_cfg, $values); foreach($result_cfg as $name => $value) $this->{$name} = $value; } else { foreach($this->html_cfg as $name => $value) $this->{$name} = $value; } } function Link($Path) { global $Config; if(substr($Path, 0, 1) == '/') return($Config['Web']['BaseURL'].$Path); return($Path); } private function CfgChck($value) { if(isset($this->{$value})) { return($this->{$value}); } else { return('Undefined'); } } public function Start() { global $Config; $code = ''. ''. ''. ''. ''. ''. ''. ''. ''. ''.$Config['Web']['Title'].''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''; $this->TimerStart(); echo($code); } private function TimerStart() { $time_start = microtime(); $time_start = explode(' ', $time_start); $time_start = $time_start[1] + $time_start[0]; $this->time_start = $time_start; } private function TimerStop() { $round = 100000; $time_start = $this->time_start; $time_stop = microtime(); $time_stop = explode(' ', $time_stop); $time_stop = $time_stop[1] + $time_stop[0]; $deltatime = $time_stop - $time_start; $deltatime = (round(($deltatime * $round))) / $round; return($deltatime); } public function Stop() { $time = $this->TimerStop(); $code = ''. ''; echo($code); } public function PrgStart() { global $html; echo('

Správa účtu

'); } public function PrgStop() { echo('
'); } function HumanDate($Time) { $Date = explode(' ', $Time); $Parts = explode('-', $Date[0]); if($Date != '0000-00-00') return(($Parts[2]*1).'.'.($Parts[1]*1).'.'.$Parts[0]); else return(' '); } function ShowNews() { global $Config, $db; $db->select_db($Config['Database']['Database']); $Output = ''; /*$Output = ''. ''; $DbResult = $db->query('SELECT * FROM ArticleCategory'); while($Category = $DbResult->fetch_assoc()) { $Output .= ''; } $Output .= ''. '
'.$Category['Name'].'Vše

'; */ $this->QuickNew(); $db->select_db($Config['Database']['Database']); if(array_key_exists('category', $_GET)) $Filter = ' WHERE `category` = '.$_GET['category']; else $Filter = ''; $this->db->select_db($Config['Database']['Database']); $limit = 5; if(array_key_exists('page_index', $_GET)) $Page = $_GET['page_index']; else $Page = 0; $DbResult = $db->query('SELECT COUNT(*) FROM `Article`'.$Filter); $DbRow = $DbResult->fetch_row(); $TotalCount = $DbRow[0]; $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']); while($Article = $DbResult->fetch_assoc()) { $Content = str_replace('&', '&', $Article['Content']); $Content = str_replace('
', '
', $Content); $Content = str_replace('
', '
', $Content); $Content = str_replace('', '
', $Content); $Output .= ''. ''. ''. ''. ''. ''. ''. ''. /*''. ''. ''. ''.*/ '
'.$Article['Title'].''.$this->HumanDate($Article['Time']).'
'.$Content.'
Sekce : '.$Article['CategoryName'].''.$Article['Author'].'
'. '
'; } $Output .= '
'.$this->PageList('page_index', $Page, $TotalCount, $Config['Web']['TableRowPerPage'], 10).'
'; return($Output); } function QuickNew() { global $server, $Config, $System, $html; // Check servers online state. $DbResult = $System->Database->query('SELECT COUNT(*) FROM Logon WHERE Online = 1 AND Enabled=1'); $DbRow = $DbResult->fetch_row(); $OnlineState = $DbRow[0] > 0; // Report online state if one of all servers is online. if(isset($_COOKIE['hof-quick']) AND $_COOKIE['hof-quick'] == 'no') { } else { echo(''. ''. ''. ''. ''. ''. '
Rychlý přehled'.date('d.m.Y', time()).'
'. 'Server : '.$server->OnlineStateImage($OnlineState).' ('.$server->OnlineCharactersCount().' hráčů celkem) | Patch '.$Config['Mangos']['ClientVersion'].' | Realmlist | ServerSvěty'. '

'); } } function GetQueryStringArray() { $Result = array(); $Parts = explode('&', $_SERVER['QUERY_STRING']); foreach($Parts as $Part) { if($Part != '') { $Item = explode('=', $Part); if(count($Item) > 1) $Result[$Item[0]] = $Item[1]; else $Result[$Item[0]] = ''; } } return($Result); } function SetQueryStringArray($QueryStringArray) { $Parts = array(); foreach($QueryStringArray as $Index => $Item) { $Parts[] = $Index.'='.$Item; } return(implode('&', $Parts)); } // Zobrazení číselný seznamu stránek function PageList($QueryStringVar, $Page, $TotalCount, $CountPerPage, $Around = 10) { $QueryStringArray = $this->GetQueryStringArray(); $Count = ceil($TotalCount / $CountPerPage); $Result = ''; if($Count > 1) { if($Page > 0) { $QueryStringArray[$QueryStringVar] = 0; $Result .= '<< '; $QueryStringArray[$QueryStringVar] = $Page - 1; $Result .= '< '; } $PagesMax = $Count - 1; $PagesMin = 0; if($PagesMax > ($Page + $Around)) $PagesMax = $Page + $Around; if($PagesMin < ($Page - $Around)) { $Result .= ' .. '; $PagesMin = $Page - $Around; } for($i = $PagesMin; $i <= $PagesMax; $i++) { if($i == $Page) $Result .= ''; $QueryStringArray[$QueryStringVar] = $i; $Result .= ''.($i + 1).' '; if($i == $Page) $Result .= ''; } if($PagesMax < ($Count - 1)) $Result .= ' .. '; if($Page < ($Count - 1)) { $QueryStringArray[$QueryStringVar] = $Page + 1; $Result .= '> '; $QueryStringArray[$QueryStringVar] = $Count - 1; $Result .= '>>'; } } return($Result); } } ?>