<?php

include_once('global.php');
include_once('style.php');
ShowHeader('Vítejte na <strong>Centrále!</strong> - serveru komunitní počítačové sítě <strong>ZdechovNET</strong>','Rozcestník');

$Database->select_db('share');

?>

<script type="text/javascript">
<!--
function openClient(client_type)
{
  if(client_type=="java")clientWindow = window.open("http://go.icq.com/icq2go/web.html","ICQ2Go","left=20,top=20,width=156,height=446,toolbar=0,resizable=0");
  else clientWindow = window.open("http://go.icq.com/icq2go/flicq.html","ICQ2Go","left=20,top=20,width=176,height=441,toolbar=0,resizable=0");
}

var predchozi = 'first'; 

function zobraz(idecko)
{
  skryj(predchozi);
  el=document.getElementById(idecko).style;
  el.display='block';
  predchozi = idecko;
}

function skryj(idecko)
{
  if(idecko != 'first')
  {
    el=document.getElementById(idecko).style;
    el.display='none';
  }
}
//-->
</script>

<table width="100%"><tr><td valign="top">
<?php
$Database->select_db('is');
?>

<table width="100%">
<tr><td width="20%" valign="top">
<strong>Důležité odkazy:</strong><br>
<img alt="" src="images/favicons/money.gif" width="16" height="16"> <a href="finance/">Finance</a><br>
<img alt="" src="images/favicons/chart.gif" width="16" height="16"> <a href="statistic/trafficview2.php">Statistika</a><br>
<img alt="" src="images/favicons/prohledavac_sdileni.gif" width="15" height="15"> <a href="share">Prohledat sdílení</a><br>
<img alt="" src="images/favicons/comp.gif" width="16" height="16"> <a href="userlist.php">Seznam uživatelů</a><br>
<img alt="" src="images/favicons/comp.gif" width="16" height="16"> <a href="hostlist.php">Seznam počítačů</a><br>
<img alt="" src="images/favicons/sunrisechat.gif" width="16" height="16"> <a href="sunrisechat/history.php">Historie SunriseChatu</a><br>
<img alt="" src="images/favicons/sunrisechat.gif" width="16" height="16"> <a href="sunrisechat/webchat.php">Webový SunriseChatu</a><br>
<img alt="" src="images/favicons/discus.gif" width="16" height="16"> <a href="forum">Diskusní fórum</a><br>
<img alt="" src="images/favicons/openwebmail.gif" width="16" height="16"> <a href="https://centrala.zdechov.net/cgi-bin/openwebmail/openwebmail.pl">WebMail</a><br>
<img alt="" src="images/favicons/apple.gif" width="16" height="16"> <a href="jidelna">Jídelníček</a><br>
<img alt="" src="images/favicons/clear.gif" width="16" height="16"> <a href="http://tv.zdechov.net/">Televize</a><br>
<img alt="" src="images/favicons/cube.gif" width="16" height="16"> <a href="http://game.zdechov.net/">Herní server</a><br>
<img alt="" src="images/favicons/cfix.gif" width="16" height="16"> <a href="farnost">Rozpis mší</a><br>
<img alt="" src="images/favicons/tel.gif" width="16" height="16"> <a href="telseznam.php">Telefonní seznam</a><br>
<img alt="" src="images/favicons/pripoj.gif" width="16" height="16"> <a href="nabidky_pripojeni.php">Nabídky připojení</a><br>
<img alt="" src="images/favicons/zapisy.gif" width="16" height="16"> <a href="docs/zapisy/zapisy.php">Zápisy ze schůzí</a><br>
<img alt="" src="images/favicons/clear.gif" width="16" height="16"> <a href="mapy/mapa.php">Mapa Zděchova</a><br>
<img alt="" src="images/favicons/otv_doby.gif" width="16" height="16"> <a href="otevreno.php">Otvírací doby</a><br>
<img alt="" src="images/favicons/topologie.gif" width="16" height="16"> <a href="is/topologie.php">Topologie sítě</a><br>
<img alt="" src="images/favicons/satellite.gif" width="16" height="16"> <a href="is/dostupnost.php">Dostupnost sítě</a><br>
<img alt="" src="images/favicons/tech.gif" width="16" height="16"> <a href="network.php">Technické informace</a><br>
<img alt="" src="images/favicons/socer.gif" width="16" height="16"> <a href="http://fotbal.zdechov.net/">Fotbal Sokol Zděchov</a><br>
<img alt="" src="images/favicons/clear.gif" width="16" height="16"> <a href="/webcam/">Web kamera</a><br>
<br>
<strong>Další odkazy:</strong><br>
<img alt="" src="images/favicons/tv.gif" width="16" height="16"> <a href="tkr.php">Kanály kabelovky</a><br>
<img alt="" src="images/favicons/clear.gif" width="16" height="16"> <a href="mapy/mapa_nabidka.php">Nabídka mapy</a><br>
<img alt="" src="images/favicons/clear.gif" width="16" height="16"> <a href="history.php">Historie sítě</a><br>
<img alt="" src="images/favicons/electric.gif" width="16" height="16"> <a href="merak.php">Měřič spotřeby</a><br>
<img alt="" src="images/favicons/clear.gif" width="16" height="16"> <a href="ukoly.php">Plány do budoucna</a><br>


<?php
//<a href="/cgi-bin/openwebmail/openwebmail.pl">Poątovní schránka</a><br>
//<a href="/download/addfile.php">Stahování souborů</a><br>
?>
<br>
</td><td width="13%" valign="top">
<strong>Vyhledávání:</strong><br>
<img alt="" src="images/favicons/www_google_com.gif" width="16" height="16"> <a href="http://www.google.cz/">Google</a><br>
<img alt="" src="images/favicons/morfeo.png" width="16" height="16"> <a href="http://morfeo.centrum.cz">Morfeo</a><br>
<img alt="" src="images/favicons/www_centrum_cz.gif" width="16" height="16"> <a href="http://www.centrum.cz">Centrum</a><br>
<img alt="" src="images/favicons/www_seznam_cz.gif" width="16" height="16"> <a href="http://www.seznam.cz">Seznam</a><br>
<img alt="" src="images/favicons/www_atlas_cz.gif" width="16" height="16"> <a href="http://www.atlas.cz">Atlas</a><br>
<img alt="" src="images/favicons/www_tiscali_cz.gif" width="16" height="16"> <a href="http://www.tiscali.cz">Tiscali</a><br>
<br>
<strong>Užitečné:</strong><br>
<img alt="" src="images/favicons/clear.gif" width="16" height="16"> <a href="http://www.zdechov.net">Stránky naší sítě</a><br>
<img alt="" src="images/favicons/www_tvinfo_cz.gif" width="16" height="16"> <a href="http://www.tvinfo.cz/live/televize/cz">Online TV</a><br>
<img alt="" src="images/favicons/www_idos_cz.gif" width="16" height="16"> <a href="http://www.idos.cz/ConnForm.asp?tt=c">Jízdní řády</a><br>
<img alt="" src="images/favicons/www_atlas_cz.gif" width="16" height="16"> <a href="http://tv.atlas.cz">TV programy</a><br>
<img alt="" src="images/favicons/www_icq_com.gif" width="16" height="16"> Web ICQ <a href="javascript:openClient('flash')">Flash</a>&nbsp;<a href="javascript:openClient('java')">Java</a><br>
<img alt="" src="images/favicons/www_centrum_cz.gif" width="16" height="16"> <a href="http://slovniky.centrum.cz">Slovníky</a><br>
<img alt="" src="images/favicons/pocasi.gif" width="16" height="16"> <a href="http://www.meteopress.cz/">Počasí</a><br>
<img alt="" src="images/favicons/www_tzones_cz.gif" width="16" height="16"> <a href="http://www.tzones.cz/">T-Mobile SMS</a><br>
<img alt="" src="images/favicons/www_mvk_cz.png" width="16" height="16"> <a href="http://www.mvk.cz/">Knihovna&nbsp;Vsetín</a><br>
<br>
<strong>Prodej počítačů:</strong><br>
<img alt="" src="images/favicons/www_computershop_cz.png" width="16" height="16"> <a href="http://www.softcom.cz/">SOFTCOM</a><br>
<img alt="" src="images/favicons/www_alfacomp_cz.gif" width="16" height="16"> <a href="http://www.alfacomp.cz/php/zbozi.php?akc=2">Alfacomp</a><br>
<img alt="" src="images/favicons/www_petracomp_cz.png" width="16" height="16"> <a href="http://www.petracomp.cz/">Petracomp</a><br>
<img alt="" src="images/favicons/www_tsbohemia_cz.png" width="16" height="16"> <a href="http://interlink.tsbohemia.cz/">TS Bohemia</a><br>
<br>
<?php
/*
<strong>Osobní stránky:</strong><br>
<img alt="" src="images/favicons/bomi.gif" width="16" height="16"> <a href="~mirek/">Miroslav Hajda</a><br>
<img alt="" src="images/favicons/clear.gif" width="16" height="16"> <a href="~george/">Jiří Hajda</a><br>
*/
?>
</td>
<td width="15%" valign="top">
<?php
// Zobrazení seznamu online počítačů
echo('<strong>Online počítače:</strong><br><span style="font-size: smaller;">');
$DbResult = $Database->select('hosts', '*', 'online=1 AND show_online=1 ORDER BY name');
while($Row = $DbResult->fetch_array())
{
  echo($Row['name'].'<br>');
}
echo('</span>');

echo('<br>');

// Zobrazení seznamu neplaticich uzivatelu
echo('<strong>Dlužníci:</strong><br><span style="font-size: smaller;">');
$DbResult = $Database->select('users', 'CONCAT(second_name, " ", first_name) as fullname', 'cash<0 ORDER BY cash');
while($Row = $DbResult->fetch_array())
{
  echo($Row['fullname'].'<br>');
}
echo('</span>');

echo('</td></tr></table>');

// Zobrazení času běhu počítače
$Data = explode(' ',exec('uptime'));
$Data = array_slice($Data,3,-8);
$Uptime = '';
foreach($Data as $Item)
{
  if(strpos($Item,':')) $Uptime .= substr($Item,0,-1).' hodin';
  else $Uptime .= $Item.' ';
}
$Uptime = str_replace('2 days,','2 dny a',$Uptime);
$Uptime = str_replace('3 days,','3 dny a',$Uptime);
$Uptime = str_replace('4 days,','4 dny a',$Uptime);
$Uptime = str_replace('days,','dní a',$Uptime);
$Uptime = str_replace('day,','den a',$Uptime);
$Uptime = str_replace('min,','minut',$Uptime);
echo('Server běží '.$Uptime);

echo('</td><td width="50%" valign="top" style="font-size: smaller;">');

/*
$File = fopen('/tmp/temperature2','r');
$Teplota = fgets($File);
$Teplota = round($Teplota*10)/10;
fclose($File);
*/
$Teplota = 0;

echo('<table width="100%"><tr><td><strong>Aktuálně:</strong></td><td align="right">
<img alt="Teplomer" width="10" height="18" src="images/teplomer3.png"><a href="statistic/trafficview2.php?type=temp">'.$Teplota
.'°C (mimo provoz)</a></td></tr></table>');

$NewsCountPerCategory = 3;
$UploadedFilesFolder = 'aktuality/uploads/';

echo('<div onmouseout="skryj(predchozi)">');

function ShowNews($Category)
{
  global $Database, $NewsCategoryNames, $NewsCountPerCategory, $UploadedFilesFolder;

  $DbResult = $Database->select('news_category', '*', 'id='.$Category);
  $Row = $DbResult->fetch_array();
  echo('<table cellspacing="0" cellpadding="0" border="0" width="100%" style="font-size: small; padding-bottom: 5px;"><tr>');
  echo('<td width="40%">'.$Row['caption'].'</td><td width="80%" align="right">');
  echo('<a href="aktuality/index.php?category='.$Category.'">Zobrazit všechny aktuality</a>&nbsp;');
  if($Row['permission'] == 1) echo('<a href="aktuality/index.php?action=add&amp;category='.$Category.'">Přidat aktualitu</a>&nbsp;');
  echo('</td></tr><tr><td colspan="2">');
  echo('<table cellspacing="0" width="100%" style="padding: 2px 2px 2px 2px; font-size: small; border-style: solid; border-color: red; border-width: 1; background-color: #FFF0F0;">');
  $DbResult = $Database->select('news', '*', 'category='.$Category.' ORDER BY date DESC LIMIT 0,'.$NewsCountPerCategory);
//echo('<table cellpadding="0" cellspacing="0" width="100%"><tr><td>');
  $Index = 0;
  $FontSize = 12;
  while($Row = $DbResult->fetch_array())
  {
    echo('<tr><td onmouseover="zobraz('."'new".$Category.$Index."'".')" style="cursor: pointer; margin: 0px;"><table cellspacing="0" cellpadding="0" style="padding: 0px; margin: 0px; font-size: small; color: red;" width="100%">
<tr><td style="font-size: '.$FontSize.'pt"><strong>'.$Row['title'].'</strong></td>
<td align="right" style="font-size: '.$FontSize.'pt">'.$Row['author'].' ('.HumanDate($Row['date']).')</td></tr></table>');
    echo('<div id="new'.$Category.$Index.'" class="skryty" style="display: none; border-width: 1; border-style: solid; border-color: blue; padding: 3px; font-size: 9pt;">'.$Row['content']);

      if($Row['enclosure'] != '')
      { 
        echo('<br>Přílohy: ');
        $Enclosures = explode(';', $Row['enclosure']);
 	 foreach($Enclosures as $Enclosure)
	 {
	  if(file_exists($UploadedFilesFolder.$Enclosure)) echo(' <a href="'.$UploadedFilesFolder.$Enclosure.'">'.$Enclosure.'</a>');
	 }
      }

    echo('</div></td></tr>');
    $Index = $Index + 1;    
    $FontSize = $FontSize - 2;
  }
  echo('</table></td></tr></table>'."\n\n");
}

ShowNews(5);
ShowNews(3);
ShowNews(1);
ShowNews(2);
ShowNews(4);
ShowNews(6);
ShowNews(8);
ShowNews(9);
ShowNews(10);

echo('<a href="aktuality/subscription.php"><img style="margin: 0px 0px 0px 0px;" border="0" src="images/rss20.png" alt="Aktuality přes RSS"></a>  <a href="aktuality/subscription.php">Automatické sledování novinek</a>');

//echo('</td></tr></table>'
echo('</div></td></tr></table>');
//if(IsInternetAddr()) echo('Internet'); else echo('LAN');

ShowFooter();

?>
