<?
/*
*  flyr - search photos for geotagged data
*
*  build a Google Maps application:
*  http://www.google.com/apis/maps/
*
*  $Header: /usr/local/cvsrep/flyr/photo.php,v 1.5 2005/09/21 22:22:34 pauldowney Exp $
*
*  written by Paul Downey (paul.downey@whatfettle.com)
*  released under GNU General Public License (http://www.gnu.org/copyleft/gpl.html)
*/

/*
*  search flickr
*/
require_once("flyr.php");

$f = new flyr();
$f->parseForm($_GET);
$photos = $f->search();
$name = htmlentities($f->folder);

/*
*  HTTP headers
*/
header("Content-type: " . "text/html;charset=utf-8");
header("Last-Modified: " . $f->date);

/*
*  generate Google maps application
*/
print <<<EOF
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
EOF;

$f->printComment();

print <<<EOF
<html>
    <head>
        <title>Flyr - Flickr Geotagged Photos</title>
        <link rel="stylesheet" type="text/css" href="style.css" />
        <link rel="shortcut icon" href="/favicon.ico" />
        <link rel="icon" href="/favicon.ico" />
    </head>
<body>

EOF;

$f->printTitle();

$n = 0;

print <<<EOF

<table border="0" width='100%'>

EOF;

$sep = "<tr>\n";

foreach (
$photos as $photo)
{
    
$title = $photo['title'];
    
$desc = $photo['desc'];
    
$glink = $photo['glink'];
    
$from = $photo['from'];

    {
        print
$sep;
        
$sep = "";
        
$end = "\n</tr>\n";
    }

    print <<<EOF
        <td align='center' valign='top' width='23%'>
        <p class="photo">
            <br/>$desc
            <br/>$from
            <br/>$glink
        </p>
        </td>
EOF;

    if (
0 == ++$n % 4)
    {
        print
$end;
        
$sep = "\n<tr>\n";
        
$end = "";
    }
}

print <<<EOF
    $end
   </table>
EOF;

$f->printNav('photos');
$f->printFooter();

echo <<<EOF
    </body>
</html>
EOF;

exit();
?>