<?php
include "/web/www.coli.uni-saarland.de/html/navigation.php";

// gibt HTML-Code aus, der direkt vor dem Hauptteil stehen soll
function start_mainpage() {
  echo "<td align=\"left\" valign=\"top\">\n\n<!-- Main page -->\n\n";
  echo "	    <div class=\"main\">\n\n";
}

// gibt HTML-Code aus, der direkt hinter dem Hauptteil stehen soll
function end_mainpage() {
  echo "\n	    </div>\n\n";
  echo "</td>\n\n";
}

if( !isset($u) ) {
  $u = $_GET['u'];
}
if( !isset($i) ) {
  $i = $_GET['i'];
}

// Set the whoami variable. This can be passed in one of three ways:
// 1. set the $whoami variable from another PHP script and include page.php
// 2. have the browser get page.php?id=something
// 3. if the ID can't be obtained in either of these ways, default to "index" 
if( !isset($whoami) ) {
  $whoami = $_GET['id'];
}

if( !isset($whoami) ) {
  $whoami = "index";
}


$pt = readtree();

$pagetype = "content";
$pagetitle = $pt->title;

if (file_exists("contents/$whoami.html")){
    if ($whoami == "whatsnew"){
	$modtime = strftime("%Y-%m-%d", filemtime("contents/news.xml"));
	$pwuid_record = posix_getpwuid(fileowner("contents/news.xml"));
    }
    else{
	$modtime = strftime("%Y-%m-%d", filemtime("contents/$whoami.html"));
        $pwuid_record = posix_getpwuid(fileowner("contents/$whoami.html"));
    }
}

$modname = $pwuid_record["name"];
$contactmail = 'webmaster [at] coli.uni-sb.de';

if( $pt->hasattr("stylesheet") ) {
  $extra_stylesheet = $pt->getattr("stylesheet");
}


// output header
if ($whoami == "whatsnew") include "/web/www.coli.uni-saarland.de/html/common_start_utf8.html";
else include "/web/www.coli.uni-saarland.de/html/common_start.html";
echo "<tr>\n";

// output navbar
$thispage = navigation($pt, $whoami);

// output contents
start_mainpage();
contents($thispage);
end_mainpage();
// for use in footer
if (is_object($thispage))
    $responsible = $thispage->expandResponsible();

// output footer
include "/web/www.coli.uni-saarland.de/html/common_end.html";



?>