<%

function transform($root, $file) {
    $sxml = escapeshellarg("${root}/data/pictures/${file}.sxml");
    $html = escapeshellarg("${root}/pictures/${file}/index.php");
    $output = `${root}/data/pictures/pictures.scm $sxml $html 2>&1`;
    if ($output) {
%>
<!--
ERROR: <%= $output %> -->
<%
    }
}

$sxml = "${DOCUMENT_ROOT}/data/pictures/${QUERY_STRING}.sxml";
$html = "${DOCUMENT_ROOT}/pictures/${QUERY_STRING}/index.php";
$scm  = "${DOCUMENT_ROOT}/data/pictures/pictures.scm";

if (($QUERY_STRING) && (file_exists($sxml))) {
    if ((filemtime($sxml) > filemtime($html)) || (filemtime($scm) > filemtime($html))) {
        transform($DOCUMENT_ROOT, $QUERY_STRING);
    }
    include($html);
}
else {
%>
<%= $xmlHeader %>
<%= $xhtmlDoctype %>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>timshel.org - pictures</title>
<meta http-equiv="Content-type"
      content='text/html; charset="ISO-8859-1"'/>
<link rel="stylesheet" type="text/css" href="general.css"/>
<link rel="stylesheet" type="text/css" href="header.css"/>
<link rel="stylesheet" type="text/css" href="pictures.css"/>
</head>

<body>

<!-- Header -->
<% readHeader(); %>

<!-- Contents -->
<div class="contents">
<div class="padded">

    <!-- Title -->
    <div class="title"><img src="senegal.jpg" alt="" title="Me, Mara, and Khadim" id="dave" width="300" height="200"/>pictures</div>

    <p>
    I can&rsquo;t whine about not having a digital camera anymore, although my older pictures were scanned from
    photographs. But from now on, I&rsquo;ll be taking them all digitally. Yay!
    </p>

    <p>
    <img src="star.gif" alt="*" title="" width="12" height="12"/> <a href="<%= $_SERVER['SCRIPT_NAME'] %>?senegal">Senegal</a> (1999)<br />
    <img src="star.gif" alt="*" title="" width="12" height="12"/> <a href="<%= $_SERVER['SCRIPT_NAME'] %>?boulder">Boulder</a> (2001)<br />
    <img src="star.gif" alt="*" title="" width="12" height="12"/> <a href="<%= $_SERVER['SCRIPT_NAME'] %>?mbells">Maroon Bells</a> (2001)<br />
    <img src="star.gif" alt="*" title="" width="12" height="12"/> <a href="<%= $_SERVER['SCRIPT_NAME'] %>?rothenburg">Rothenburg</a> (2001)<br />
    <img src="star.gif" alt="*" title="" width="12" height="12"/> <a href="<%= $_SERVER['SCRIPT_NAME'] %>?paris">Paris</a> (2002)<br />
    <img src="star.gif" alt="*" title="" width="12" height="12"/> <a href="<%= $_SERVER['SCRIPT_NAME'] %>?normandy">Normandy</a> (2002)<br />
    <img src="star.gif" alt="*" title="" width="12" height="12"/> <a href="<%= $_SERVER['SCRIPT_NAME'] %>?loire">Loire Valley</a> (2002)<br />
    <img src="star.gif" alt="*" title="" width="12" height="12"/> <a href="<%= $_SERVER['SCRIPT_NAME'] %>?burgundy">Burgundy</a> (2002)<br />
    <img src="star.gif" alt="*" title="" width="12" height="12"/> <a href="<%= $_SERVER['SCRIPT_NAME'] %>?heidelberg">Heidelberg</a> (2002)<br />
    <img src="star.gif" alt="*" title="" width="12" height="12"/> <a href="<%= $_SERVER['SCRIPT_NAME'] %>?italy">Italy</a> (2002)<br />
    <img src="star.gif" alt="*" title="" width="12" height="12"/> <a href="<%= $_SERVER['SCRIPT_NAME'] %>?salamanca">Salamanca</a> (2002)<br />
    <img src="star.gif" alt="*" title="" width="12" height="12"/> <a href="<%= $_SERVER['SCRIPT_NAME'] %>?cambridge">Cambridge</a> (2003)<br />
    <img src="star.gif" alt="*" title="" width="12" height="12"/> <a href="<%= $_SERVER['SCRIPT_NAME'] %>?maine">Maine</a> (2003)
    <br class="separator"/>
    </p>

    <!-- Footer -->
    <hr/>

    <p>
    <a href="http://validator.w3.org/check/referer"><img
       src="valid-xhtml10.png" height="31" width="88"
       id="validatorImage" alt="Valid XHTML 1.0" title=""/></a>
    created January 19, 2002<br />
    last modified <%= lastModified() %><br />
    <span class="source">
    <a href="/source.php?<%= $_SERVER['SCRIPT_NAME'] %>">view source</a>
    </span>
    </p>

</div>
</div>

</body>
</html><%
}
%>