<?php

function Show()
{
  global $Database, $Config;
  
  echo('<h3>Správa serveru</h3>');
  echo('<table witdh="100%"><tr><td valign="top">');
  echo('<a href="https://wow.zdechov.net/mysql/">Správa databáze PhpMyAdmin</a><br>');
  echo('<a href="https://wow.zdechov.net/trac/wow/">Zdrojové kody webu</a><br>');
  echo('<a href="gm_rules.php">Pravidla pro GM</a><br>');
  echo('</td><td valign="top">');
  echo('<a href="http://stat.zdechov.net/game/">Statistiky provozu</a><br>');
  echo('<a href="../navody/">Návody</a><br>');
  echo('<a href="../db/index.php?id=bugreport">Bug report</a>');
  echo('</td><td valign="top">');
  echo('<a href="rss.php">RSS GM zpráv</a><br>');
  echo('<a href="rss_tickets.php">RSS herních žádanek</a><br>');
  echo('</td></table><br>');  
  
  echo('<form action="?op=AddMessage" method="post">
  Uživatel: '.$_SESSION['UserName'].' <a href="?op=Logout">Odhlásit</a><br>
  <input name="text" size="80"> <input type="submit" value="Přidat">');
  echo('</form>'); 
  
  $PerPage = 15;
  if(array_key_exists('page', $_GET)) $Page = addslashes($_GET['page']); else $Page = 0;


  echo('<table class="TableAdmin" cellspacing="0" width="100%" style="color: white;" border="1">');
  $DbResult = $Database->query('SELECT wow.gm_news.text as text, '.$Config['Mangos']['DatabaseRealmd'].'.account.username as username FROM wow.gm_news JOIN '.$Config['Mangos']['DatabaseRealmd'].'.account ON wow.gm_news.author = '.$Config['Mangos']['DatabaseRealmd'].'.account.Id ORDER BY wow.gm_news.time DESC LIMIT '.$Page*$PerPage.', '.$PerPage);
  while($Row = $DbResult->fetch_array())
  {
    echo('<tr><td><strong>'.$Row['username'].':</strong> '.$Row['text'].'</td></tr>');
  }
  echo('</table>');
  
  $DbResult = $Database->query('SELECT COUNT(*) FROM wow.gm_news');
  $Row = $DbResult->fetch_array();
  echo(PagesList('?page=', $Page, $Row[0], $PerPage));
  //echo(phpinfo());
}

?>
