Location: PHPKode > projects > PHPix2 Photo Album > phpix/index.php
<?php if (0) { ?> 
  <HTML><HEAD><TITLE>No PHP</TITLE></HEAD><BODY>
You haven't got a working PHP yet!  Go fix that before you do anything else.
  </BODY></HTML>
  <!-- 
<?php } ?>
<?
  /* PHPix photo album
   * Copyright (C) 2001 Neale Pickett <hide@address.com>
   * Copyright (C) 2000 Robert A. Holak <hide@address.com>
   *
   * This program 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.
   *
   * This program 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 this program; if not, write to the Free Software
   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   * 02111-1307  USA
   */

	
  include("common.inc");

  if (!defined('CONFIG')) {

    print "<html><head><title>Almost there...</title></head><body>\n";
    print "<p>All you have to do now is type \"make\" in the phpix directory.\n";
    print "Read the <a href=\"INSTALL\">INSTALL</a> file for more information.</p>\n";
    exit();
  }

  if (! $album) {
    $albumname = "Albums";
  } else {
    $albumname = $album;
  }
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <title><? print "${titleprefix}${albumname}"; ?></title>
<?
    if ($stylesheet) {
      print "<link rel=\"stylesheet\" href=\"$stylesheet\">\n";
    } else {
      print "<link rel=\"stylesheet\" href=\"".$htmlbase."style.css\">\n";
    }
    StandardLinks("album",$album,$start);
?>
  </head>
  <body>
<?
    $IE = eregi("MSIE",$HTTP_USER_AGENT) == 1;
    if ($IE) {
      print "<div class=\"contentIE\">\n";
    } else {
      print "<div class=\"content\">\n";
    }
?>
      <table width="100%" cellpadding="2" cellspacing="0" border="0" class="navbar">
        <tr class="navbar">
          <td class="navbar">
            <? NavBar("album", $album, $start); ?>
          </td>
	  <td class="location">
<?
    
    if ($start > 0) {
      print MakeLink($albumpath, "&lt;--", MakeQueryString(AlbumArray(max(0, $start - $items_per_page))), 'navbar', 'prev');
    }
  if ($totalfiles) {
    print "Images " .($start + 1) . "-" . min($totalfiles, $start + $items_per_page) . " of " . $totalfiles . "\n";
  } else {
    print "No images";
  }

    # XXX: Gah, hack, bleh.
    for ($x = $start; $x < $start + $items_per_page and $filelist[$x]; $x++);
    if ($totalfiles > $x) {
      print MakeLink($albumpath, "--&gt;", MakeQueryString(AlbumArray($x)), "navbar", "next");
    }
?>
          </td>
        </tr>
      </table>

<?
        $descfile = $realdescbase.$album."__desc.txt";
        if (!file_exists($descfile)) {
          $descfile = $realdescbase.$album."/__desc.txt";
        }

        if (file_exists($descfile)) {
                print "<div class='description'>\n";
                $fd = fopen($descfile, "r");
                while (! feof($fd)) {
                        $buffer = fgets($fd, 4096);
                        print $buffer;
                }
                fclose($fd);
                print "</div>\n";
        }
?>

      <table class="body" width="100%">
<?
  if (($start == 0) and is_array($dirlist)) {
    print "<tr class='album'>\n";
    $thisdir = $album;
    if ($thisdir) {
      $thisdir .= "/";
    }
    reset($dirlist);
    $arr = AlbumArray(0);
    while (list(, $dirname) = each($dirlist)) {
      # XXX: Look for a user-provided thumbnail in the cache
      $arr['album'] = $thisdir.$dirname;
       DisplayImg2($htmlbase.$albumpath.$userstring."?".MakeQueryString($arr), "##NONE##", $album_img, "Original", $dirname, 'album');
    }
    unset($arr);
    PadTable("album");
  }

  if (is_array($filelist)) {
    print "<tr class='body'>\n";

    $unknown_url_size = GetImageSize($unknown_url);
    $arr = AlbumArray($start);
    
    for ($x = $start; $x < $start + $items_per_page and $filelist[$x]; $x++) {
      $file = $filelist[$x];
      $arr['pic'] = $file;
      $arr['picindex'] = $x;

      DisplayImg2($htmlbase.$viewpath.$userstring."?".MakeQueryString($arr), $album, $file, $thumb_size, $file);
    }
    unset($arr);
    PadTable();
  }
?>

      </table>
<? 
if ($admin_mode) {
?>
  <table class="admin" align="center">
  <tr class="admin">
  <td class="admin">
<? 
  print DescEditor($htmlbase.$albumpath.$userstring, $descfile);
?>
  </td>
  </tr>
  </table>
<?
}
?>
<? if ($totalfiles > $items_per_page) {
?>
      <!-- XXX: Take out the align tag if Netscape'll letcha  -->
      <table class="footer" align="center">
	<tr class="footer">
          <td class='footer-pagedesc'>Album page:</td>
<?
    # XXX: arrow icons, like google
    if ($start > 0) {
      print "<td class='footer-back'>";
      print MakeLink($albumpath, "&lt;--", MakeQueryString(AlbumArray(max(0, $start - $items_per_page))), 'footer-back');
      print "</td>\n";
    }
    for ($i = max(0, $start - 10 * $items_per_page); $i < min($totalfiles,$start + 10 * $items_per_page); $i += $items_per_page) {
      if (($start >= $i) and ($start < $i + $items_per_page)) {
        print "<td class='footer-this'>";
        print ($i/$items_per_page) + 1;
        print "</td>\n";
      } else {
        print "<td class='footer-jump'>";
        print MakeLink($albumpath, (($i/$items_per_page) + 1), MakeQueryString(AlbumArray($i)), "footer-jump");
        print "</td>\n";
      }
    }

    if ($totalfiles > $x) {
      print "<td class='footer-next'>";
      print MakeLink($albumpath, "--&gt;", MakeQueryString(AlbumArray($x)), "footer-next");
      print "</td>\n";
    }
?>
	</tr>
      </table>
<?
  }
?>
      <div class="generated">
	Generated by <a href="http://phpix2.sourceforge.net/"><? print "$productname $version"; ?></a>&nbsp;&nbsp;
        <? print insert_modify_link($realdescbase.$album); ?>

      </div>
    </div>
  </body>
</html>

<?php if (0) { ?>
  -->
<?php } ?>
Return current item: PHPix2 Photo Album