Location: PHPKode > projects > TVEz - Media Library > tvez-0.2.1/html/shows/index.php
<?php

# ------------------------------------------------------------------------------
#
# This is a file to generate show listings.
#
# ------------------------------------------------------------------------------
#
# Copyright (C) 2003 Christian Eheim and Alex Pachikov
#                                                                               
# This file is part of TVEz (tvez.sourceforge.net).
#                                                                               
# TVEz is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#                                                                               
# TVEz is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#                                                                               
# You should have received a copy of the GNU General Public License
# along with TVEz; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#                                                                               
# ------------------------------------------------------------------------------
#
# Created on 02/12/2003 by Alex Pachikov
#
# LAST MODIFIED:
# $Date: 2004/06/30 04:45:46 $
# $Revision: 1.6 $
# $Author: pachikov $
#
# ------------------------------------------------------------------------------

require "shows/include.php";

if(!isset($_REQUEST['page']) || $_REQUEST['page'] == "" ) {
  # 
  # List all shows
  # 
  print read_file('default',"head");
  print "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\">
    <tr>
       <td align=\"center\">
        ";
  asort($shows);
  foreach ($shows as $key => $show) {
#    if (is_file("shows/images/$show.gif")) $img = "$show.gif";
#    else if (is_file("shows/images/$show.jpg")) $img = "$show.jpg";
#    else $img = "";
    if ($img) {
      print "<a href=\"".$_SERVER['PHP_SELF']."?content=shows&page=$key\"><img src=\"shows/images/$img\" border=\"0\" hspace=\"8\" vspace=\"8\" alt=\"".$title{$key}."\"></a> \n";
    }else{
      print "<a href=\"".$_SERVER['PHP_SELF']."?content=shows&page=$key\"><font size=\"+10\">[</font><nobr>".$title{$key}."</nobr><font size=\"+10\">]</font></a>&nbsp; \n";
    }
  }
  print "</td>
     </tr>
    </table>
       ";
  print read_file('default',"foot");
}else{ 
  #
  # Give listing of the show
  #
  $num = $HTTP_GET_VARS['page'];
  print read_file($shows[$num],"head");
  print "
  <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\">
    <tr>
      <td align=\"center\">
  ";
  print "<h1>".ucwords($title[$num])."</h1>";
  $total = sizeof($seasons[$num]);
  if ($anchors{$num}) $anc = 1;
  if ($total) {
    foreach ($seasons[$num] as $key => $season) {
      $dir = $showpath[$num]."/$season";
      if (is_dir($dir)) print build_table($season,$dir,$key+1,$total,$scripturl[$num],$anc);
    }
  }else{
    $seasons[$num] =  read_dir($showpath[$num]);
	usort($seasons[$num], "strnatcmp");
    foreach ($seasons[$num] as $key => $season) {
      $dir = $showpath[$num]."/$season";
      if (is_dir($dir)) print build_table($season,$dir,$key+1,$total,$scripturl[$num],$anc);
      elseif (is_file($dir)) $hasfiles = 1;
    }
    if ($hasfiles) print build_table('',$showpath[$num],1,1,$scripturl[$num],$anc);
  }
  print "
      </td>
    </tr>
  </table>";
  print read_file($shows[$num],"foot");
}
?>
Return current item: TVEz - Media Library