Prefix = $Config['Database']['Prefix']; $Database->charset($Config['Database']['Charset']); $Menu = array( array('index.php', 'Home', 'home'), array('jak_zacit.php', 'Jak začít', 'how'), array('registrace/', 'Registrace', 'registrace'), array('minimanager/', 'Správa účtu', 'account'), array('forum/', 'Diskusní fórum', 'forum'), array('server.php', 'Server', 'server'), array('finance/', 'Finance', 'donate'), array('databaze/', 'Online databáze', 'database'), array('download_soubory/', 'Soubory', 'download'), array('link.php', 'Odkazy', 'link'), array('mapa.php', 'Mapa', 'mapa'), array('guildy.php', 'Seznam guild', 'guilds'), array('online_player.php', 'Online hráči', 'online_player'), array('honor.php', 'Tabulka cti', 'honor'), array('events.php', 'Události', 'udalosti'), array('arena.php', 'Arény', 'areny'), //array('Death%20Dealers%20Hratelne%20Rasy.php', 'Rasy', 'rasy'), //array('Death%20Dealers%20Povolani.php', 'Povolání', 'povolani'), //array('Death%20Dealers%20Profese.php', 'Profese', 'profese'), ); $UnitNames = array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB'); function HumanSize($Value) { global $UnitNames; $UnitIndex = 0; while($Value > 1024) { $Value = round($Value / 1024, 3); $UnitIndex++; } return($Value.' '.$UnitNames[$UnitIndex]); } function HumanDate($DateTime) { $DateTimeParts = explode(' ', $DateTime); $Parts = explode('-', $DateTimeParts[0]); if($DateTimeParts[0] != '0000-00-00') return(($Parts[2]*1).'.'.($Parts[1]*1).'.'.$Parts[0]); else return(' '); } function OnlinePlayerCount() { global $Database, $Config; $Database->select_db($Config['Mangos']['DatabaseCharacters']); $Result = $Database->select('characters', 'COUNT(*)', 'online=1'); $Row = $Result->fetch_array(); return($Row[0]); } function CharacterCount() { global $Database, $Config; $Database->select_db($Config['Mangos']['DatabaseCharacters']); $Result = $Database->select('characters', 'COUNT(*)'); $Row = $Result->fetch_array(); return($Row[0]); } function AccountCount() { global $Database, $Config; $Database->select_db($Config['Mangos']['DatabaseRealmd']); $DbResult = $Database->query('SELECT COUNT(*) FROM account'); $Row = $DbResult->fetch_array(); return($Row[0]); } function MangosUptime() { global $Database, $Config; $Database->select_db($Config['Mangos']['DatabaseMangos']); $DbResult = $Database->query('SELECT `starttime`, `uptime` FROM `uptime` ORDER BY `starttime` DESC LIMIT 1'); $Row = $DbResult->fetch_array(); $Uptime = $Row['uptime']; //$Uptime = 0; $Days = floor($Uptime / 3600 / 24); if($Days == 0) $DaysText = ''; else if($Days == 1) $DaysText = $Days.' den'; else if(($Days > 1) and ($Days < 5)) $DaysText = $Days.' dny'; else if(($Days > 5)) $DaysText = $Days.' dnů'; $Seconds = $Uptime - 3600; return($DaysText.' '.date('G:i', $Seconds)); } function RunningEventCount() { global $Database, $Config; $Count = 0; $Database->select_db($Config['Mangos']['DatabaseMangos']); $DbResult = $Database->select('game_event', 'occurence, length, UNIX_TIMESTAMP(start_time) as start', 'end_time > NOW() AND start_time < NOW()'); while($Row = $DbResult->fetch_array()) { $Start = (floor((time() - $Row['start']) / ($Row['occurence'] * 60))) * $Row['occurence'] * 60 + $Row['start']; $End = $Start + $Row['length'] * 60; if((time() > $Start) and (time() < $End)) $Count++; } return($Count); } function ShowOnlinePlayerCount() { $PlayerCount = OnlinePlayerCount(); if($PlayerCount == 1) $P = 'hráč'; else if(($PlayerCount >= 2) and ($PlayerCount <= 4)) $P = 'hráči'; else $P = 'hráčů'; echo($PlayerCount.' '.$P); } function FormatOutput($s) { $out = ''; $nn = 0; $n = 0; while($s!='') { $start = strpos($s,'<'); $end = strpos($s,'>'); if($start != 0) { $end = $start-1; $start = 0; } $line = trim(substr($s,$start,$end+1)); if(strlen($line)>0) if($line[0] == '<') { if($s[$start+1] == '/') { $n = $n - 2; $nn = $n; } else { if(strpos($line,' ')) $cmd = substr($line,1,strpos($line,' ')-1); else $cmd = substr($line,1,strlen($line)-2); //echo('['.$cmd.']'); if(strpos($s,'')) $n = $n + 2; } }// else $line = '['.$line.']'; //if($line != '') echo(htmlspecialchars(str_repeat(' ',$nn).$line."\n")); if($line != '') $out .= (str_repeat(' ',$nn).$line."\n"); $s = substr($s,$end+1,strlen($s)); $nn = $n; } return($out); } function CheckPortStatus($Ip, $Port) { function ErrorHandler($errno,$errmsg,$filename,$linenum,$vars) { } set_error_handler('ErrorHandler'); //error_reporting(0); if($Fp1 = fsockopen($Ip, $Port, $ERROR_NO, $ERROR_STR,(float)0.5)) { fclose($Fp1); return true; } else { //echo($ERROR_NO.','.$ERROR_STR); //die(); return false; } restore_error_handler(); } function GenerateMenu() { global $Config, $Menu; $Result = ''; foreach($Menu as $Index => $MenuItem) { $Result .= "\"".$MenuItem[1]."\"
\n"; } return($Result); } function ShowHeader() { global $Config; echo(' WoW server Heroes of Fantasy
 
Heroes of Fantasy
'); ShowOnlinePlayerCount(); echo('
'); echo(GenerateMenu()); echo('pocitadlo
'); } function ShowFooter() { global $Config; echo('
# | Správce serveru: '.$Config['Web']['Admin'].' | Email: '.$Config['Web']['AdminEmail'].' | Počet přístupů: CNW:Counter | Provozováno na game.zdechov.net |'); // Použitá paměť:  '.HumanSize(memory_get_peak_usage(FALSE)).' | echo('
'); } // Zobrazení číselný seznamu stránek function PagesList($URL, $Page, $TotalCount, $CountPerPage, $Around = 10) { $Count = ceil($TotalCount / $CountPerPage); $Result = ''; if($Count > 1) { if($Page > 0) { $Result .= '<< '; $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 .= ''; $Result .= ''.($i + 1).' '; if($i == $Page) $Result .= ''; } if($PagesMax < ($Count - 1)) $Result .= ' .. '; if($Page < ($Count - 1)) { $Result .= '> '; $Result .= '>>'; } } return($Result); } ?>