<?php

//-----------------------------------------------------------------------------------------
// the variables you have to set
//-----------------------------------------------------------------------------------------

// width of the video
$width = 320;

// height of the video
$height = 240;

//-----------------------------------------------------------------------------------------
// rest of the php part 
//-----------------------------------------------------------------------------------------

// autoscanning the flv directory
@$d = dir("flv");
if ($d) { 
	while($entry=$d->read()) {  
		$entry = preg_replace("/ /","%20",$entry);
		$pos = strpos(strtolower($entry), ".flv");
		if (!($pos === false)) {  
			$files[] = "flv/".$entry; 
		} 
	}
	$d->close();
}

// getting the file from the url
if ($_GET['file']) { $file = $_GET['file']; } else { $file = 1; }

// extracting the name of the video
$p1 = strrpos($files[$file-1],"/") + 1;
$p2 = strpos($files[$file-1],".flv");
$name = substr($files[$file-1],$p1,($p2-$p1));

//-----------------------------------------------------------------------------------------
// displaying the html page
//-----------------------------------------------------------------------------------------
?>

<!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" lang="en">
<head>
<title>media.xFamily.org - Video Archive - Testimony</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />


<!-- Stye Sheet -->
<style type="text/css">
  body { background-color: #eeeeee; font:10px/16px verdana; color: black; } 
  a { color: black; }
  a:hover { color: #cc0000; }
  div { margin:20px; }
  h1 { margin-left:30px; }
</style>


</head> <body> <div style="margin: 10px; padding: 5px; border: 2px solid green;"> <b>To find these videos in other formats and for more
information, please visit <a href="http://www.xfamily.org/index.php/Category:Video_Archives">xFamily.org Video Archives</a> </b> </div>

<!-- the flv movie name -->
<div id="name">
	<h1><?=$name?></h1>
</div>


<!-- the flvplayer -->
<div id="player">
	<object type="application/x-shockwave-flash" data="flvplayer.swf?file=<?=$files[$file-1]?>&autoStart=false" 
		width="<?=$width?>" height="<?=$height?>" wmode="transparent">
  		<param name="movie" value="flvplayer.swf?file=<?=$files[$file-1]?>&autoStart=false" />
  		<param name="wmode" value="transparent" />
	</object>
</div>


<!-- the navigation -->
<div id="nav">
	<ul>
	<? // php loop for printing all the links
	for ($i=0; $i<=sizeof($files)-1; $i++) {
		$p1 = strrpos($files[$i],"/") + 1;
		$p2 = strpos($files[$i],".flv");
		$name = substr($files[$i],$p1,($p2-$p1));
		echo "		<li><a href=\"flvplayer.php?file=".($i+1)."\">".$name."</a></li>\n";
	} ?>
	</ul>
</div>


</body>
</html>
