<?php
 #############################################################################
 # IMDBPHP                              (c) Giorgos Giagas & Itzchak Rehberg #
 # written by Giorgos Giagas                                                 #
 # extended & maintained by Itzchak Rehberg <izzysoft AT qumran DOT org>     #
 # http://www.izzysoft.de/                                                   #
 # ------------------------------------------------------------------------- #
 # This program is free software; you can redistribute and/or modify it      #
 # under the terms of the GNU General Public License (see doc/LICENSE)       #
 # ------------------------------------------------------------------------- #
 # Show what we have in the Cache                                            #
 #############################################################################
 # $Id: cache.php 253 2009-10-11 21:54:15Z izzy $

require_once("imdb.class.php");

$conf = new imdb_config;
echo "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>\n";
echo "<HTML><HEAD>\n <TITLE>IMDBPHP Cache Contents</TITLE>\n";
echo " <STYLE TYPE='text/css'>body,td,th { font-size:12px; }</STYLE>\n";
echo "</HEAD><BODY>\n";
$movie = new imdb ("0");
if ($d = opendir ($conf->cachedir)) {
  echo "<TABLE ALIGN='center' BORDER='1' STYLE='border-collapse:collapse;margin-top:20px;'>\n"
     . " <TR><TH STYLE='background-color:#ffb000'>Movie Details</TH><TH STYLE='background-color:#ffb000'>IMDB page</TH></TR>\n";
  while (false !== ($entry = readdir ($d))) {
    if (strstr ($entry, "Title")) {
       $imdbid = substr ($entry, 0, 7);
       $movie->setid ($imdbid);
       echo " <TR><TD><a href='imdb.php?mid=${imdbid}'>".$movie->title()."</a></TD>"
            .    "<TD><a href=\"http://us.imdb.com/title/tt${imdbid}\">imdb page</a></TD></TR>\n";
    }
  }
  echo "</TABLE>\n";
}
echo "</BODY></HTML>";
?>
