options: -html php
options: -default_index index.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>Album: <: print Path('album_name'); :></title>
  <: Meta() :>  <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1" />
<: if (!(Parent_Albums_Left() == 1)) { _:>  <link rel="home" href="<: $_ = Parent_Album(); s/^<a href='(.+)'>.*<\/a>$/$1/; print; :>" title="Album home" />
  <link rel="top" href="<: print; :>" title="Album home" /> <:_ } :>
  <link rel="up" href=<:=Back():> title="Up one folder" />
  <link rel="stylesheet" type="text/css" href="/screenstyle.css" />
</head>
<body>

<div class="container">

<div class="albumblock"><h1><: print Path('album_name') :></h1>
</div>

<div><ul class="navbar">
                 <li><a href="/" class="nav">Home</a></li>
                 <li><a href="/Album" class="nav">Photo Album</a></li>
                 <li><a href="/Forums" class="nav">Forums</a></li>
                 <li><a href="/Mail" class="nav">Web Mail</a></li>
</ul></div>

<?php
if ( isset($_POST["passphrase"]) ) {
  if ( strncmp($_POST["passphrase"], "somedumbpass", 25) == 0 ) {
    $_SESSION["passphrase"] = $_POST["passphrase"];
  }
}
if ( ! isset($_SESSION["passphrase"]) ) {
  if ( strncmp($_SESSION["passphrase"], "somedumbpass", 25) != 0 ) {
    echo "<div class=\"content\">\n";
    echo "\tWe are sorry for the inconvenience, but this section is protected.\n";
    echo "\tPlease enter the passphrase to continue.  If you don't have the passphrase,\n";
    echo "\tyou can request it from the\n";
    echo "\t<a href=\"mailto:webmaster@website.com\">Site Administrator</a><br><br>\n\n";

    echo "\t<form method=\"post\" action\"/index.php\">\n";
    echo "\t\tPassphrase: <input type=text name=\"passphrase\">\n";
    echo "\t</form>\n";
    echo "</div>\n";
    exit (0);
  }
}
?>

<div><ul class="menu">
<: while ( Parent_Albums()) { _:>
  <: if (Parent_Albums_Left() > 1) { _:>
  <li>
    <: pParent_Album() :> &raquo;
  </li>
  <: } else { _:>
  <li>
    <: pParent_Album() :>
  <: } _:>
  </li>
  <: Next_Parent_Album() :>
<: } _:>
  <li class="up">
    <a href=<:=Back():>>Go up</a>
  </li>
</ul></div>

<: if (isHeader()) { _:>
<h2>
  <:pHeader():>         
</h2>
<: } _:>

#c  # Are there more albums below this one?
<:  if (my $dir = First('dirs')) { _:>

#c  # If there are more then 4 sub albums, print the latest updated
<:    if ( num('dirs') > 4 ) { _:>
<div class="content"><h2>Latest Updated Albums</h2><br></div>
#c
#c    # We print the top 4, or Total sub albums - 4, whichever is less
#c    #
<:      my $latest_num = num('dirs') - 4; :>
<:      $latest_num = 4 if $latest_num > 4; :>
#c
<:      my @top_dirs = (undef, undef, undef, undef); :>
<:      my @dirs_obj = (undef, undef, undef, undef); :>
<:      my $t_dir = Next($dir); :>
<:      while ( $t_dir ) { _:>
#c       # Check the date (mtime) re-order if current sub album is older then one stored
#c       #
<:        my $path_name = Path('dir') ."/". Get($t_dir,'name'); :>
<:        my $stat = ( stat( $path_name ) )[9] ; :>
<:        for (my $i=0; $i<$latest_num; $i++) { _:>
<:          if ( $stat >= (stat($top_dirs[$i]))[9] ) { _:>
#c           # Current sub album is older then $i'th top_dir, re-order arrays
#c           #
<:            for (my $j=$latest_num-1; $j>$i; $j--) { _:>
<:              $top_dirs[$j] = $top_dirs[$j-1]; :>
<:              $dirs_obj[$j] = $dirs_obj[$j-1]; :>
<:            } :>
#c
<:            $top_dirs[$i] = $path_name ; :>
<:            $dirs_obj[$i] = $t_dir; :>
<:            last; :>
#c
<:          } :>
<:        } :>
<:        $t_dir = Next($t_dir); :>
<:      } :>
<:      foreach my $dir_obj (@dirs_obj) { _:>
#c       # Print the oldest sub albums, ordered by date
#c       #
<:        next if ! $dir_obj ; :>
<div id="main">
	<div class="wrapname">
		<div class="wrap1">
		<div class="wrap2">
		<div class="wrap3">
		<div class="wrap4">
		<div class="wrap5">
<: if (Image($dir_obj,'thumb')) { _:>
			<: my $img = Image($dir_obj,'thumb'); :> <:= Get($dir_obj,'href','dir').$img."</a>" :>
<: } else { _:>
			<:= Get($dir_obj,'href','dir')."<img src='/album.jpg' style='border:0' alt='' width='133' height='100' /></a>" :>
<: } :>
		</div>
		</div>
		</div>
		</div>
		</div>
		<div class="infotext">
			<:= Get($dir_obj,'href','dir').Name($dir_obj) :> </a> 
		</div>   
	</div>   
</div>
<:      } :>
<div class="album_content">
<:    } :>

<div class="content"><h2>Albums</h2><br></div>
<div class="album_content">
#c    # Loop on all the albums
<:    while ($dir) { _:>
<div id="main">
	<div class="wrapname">
		<div class="wrap1">
		<div class="wrap2">
		<div class="wrap3">
		<div class="wrap4">
		<div class="wrap5">
<: if (Image($dir,'thumb')) { _:>
			<: my $img = Image($dir,'thumb'); :> <:= Get($dir,'href','dir').$img."</a>" :>
<: } else { _:>
			<:= Get($dir,'href','dir')."<img src='/album.jpg' style='border:0' alt='' width='133' height='100' /></a>" :>
<: } :>
		</div>
		</div>
		</div>
		</div>
		</div>
		<div class="infotext">
			<:= Get($dir,'href','dir').Name($dir) :> </a> 
		</div>   
	</div>   
</div>
<: if (New_Row($dir,4,0)) { _:>
</div>
<div class="album_content">
<:    } :>
#c    # End album loop
<:    $dir = Next($dir); :>
<:    } :>
</div>
#c  # End if albums
<:  } :>

<:  if (Images()) { _:>
<div class="content"><h2>Picures in <: print Path('album_name'); :></h2></div>

<div class="album_content">
<: my $img=First('pics'); :>
#c    # Loop on all the images
<: while($img) { _:>
<div id="main">
	<div class="wrapname">
		<div class="wrap1">
		<div class="wrap2">
		<div class="wrap3">
		<div class="wrap4">
		<div class="wrap5">
			<: print Get($img,'href','image'); :>
			<: print Image($img,'thumb') if Get($img,'thumb'); :> </a>
		</div>
		</div>
		</div>
		</div>
		</div>
	</div>
</div>
<:    if (New_Row($img,4,0)) { _:>
</div>
<div class="album_content">
<:    } :>
<: $img = Next($img);  :>
<: } _:>
#c  # End if images
</div>

<div class="spacer">&nbsp;</div>
<: } _:>

<div class="footer">

<: if (isFooter()) { _:>
<h2>
  <:pFooter():>         
</h2>
<: } _:>

<address>
<: Credit() :> on <:=scalar localtime:>
<br />&nbsp;<span class="helmar">Dropshadow CSS theme by Kurt Edelmann (based on CSS styles from Helmar Weiland & Pat Carr)</a></span>
</address>

#c  # End of content
</div>

</body>
</html>
