<?php 
include('global.php');
show_header();
	
   echo '<div id="contenu">';


	if (array_key_exists('spolco',$_GET)) {
		echo SPOLCO;
		show_article(1);

	} else if (array_key_exists('sbor',$_GET)) {
		echo SBOR;
		show_article(2);

  	} else if (array_key_exists('rozpis',$_GET)) {
		echo ROZPIS;
		show_mass();
		echo '<br><br>';
		$files = scandir('mass');
		for ($i=0;$i<count($files);++$i) {
		  $file = 'mass/'.$files[$i];
		  if (filetype($file) <> 'dir')	echo '<a href="?img='.$file.'"><img width="200" src='.$file.' title="'.FILE_SAVED . date ("m d Y H:i:s.", filemtime($file)).'"></a>';
		}
		show_article(3);

 	} else if (array_key_exists('Historie',$_GET)) {
		echo HISTORIE;
		show_article(4);


  	} else if (array_key_exists('admin',$_GET)) {
		echo ADMIN;
		if (array_key_exists('pass',$_POST) ) {
		  if ($_POST['pass'] == $Config['webpass'])  {
			$_SESSION['pass'] = $_POST['pass'];
		  } else {
			echo BAD_PASS;
		  }
		} 
		if (isset($_SESSION['pass'])) {
			if ($_SESSION['pass'] == $Config['webpass']) {
				//administrátorská část
				show_upload_mass();  //nahrání rozpisu
				save_file();
				show_article(5);
			}
		} else {
		  show_login();
		}


  	} else if (array_key_exists('img',$_GET)) {
		$file = $_GET['img'];
		echo '<img width="100%" src='.$file.' title="'."Soubor byl vložen " . date ("m d Y H:i:s.", filemtime($file)).'">';


	} else {
	echo HEADPAGE;
		show_article(0);

	}

   echo '</div>';

	show_footer();
?>