repository/include/
repository/include/magpie/
repository/include/magpie/extlib/
repository/include/magpie/htdocs/
repository/include/magpie/scripts/
repository/include/magpie/scripts/smarty_plugin/
repository/include/magpie/scripts/templates/
<?
  include_once( dirname(__FILE__)."/include/config.php");

 //start at our first directory: concatenate required trailers
 $url  = $database_url;
 $url .= "/$first_catid";
 $url .= ".xml";

 $rss = fetch_rss( $url );
 $page_title = $rss->channel["title"];
 $location   = location_lookup( $rss->channel["link"] );

 $code_list = $cat_list = "";
 //we now have our first page, go through it and make our subcategories
 //and list any files in this directory
 foreach ( $rss->items as $item ) 
 {
	if( empty( $item["subcatid"] ) )
	{
		//its not a directory - therefore its a downloadable file
		$name = $item["title"];

		//we will output our own description - we'll use
		//MudMagic's download handler, but not their website
		$mudmagic_download_url  = "http://www.mudmagic.com/codes/dl/";
		$mudmagic_download_url .= $item["code_id"];

		$date_added    =    date("D M j h:i a", $item["date"]);
		$description   = $item["description"];

		$code_list .= "<tr><td><a href='$mudmagic_download_url'>$name</a></td>
				   <td>$date_added</td>
			       </tr>
			       <tr><td colspan=2>$description</td></tr>";
	}
	else
	{
		//this is a subcategory
		$subcat_name   = $item["title"];
		$total_entries = $item["subcatentries"];
		$cat_id	       = $item["subcatid"];
		$cat_family    = $item["subcatfamily"]; //no used -but contains: diku/merc/blaat
	
		$cat_list .= "<div style='line-height: 20px; display: inline;'>
			      <img src='folder.gif'> 
				<a href='catlist.php?id=$cat_id'>$subcat_name</a> [$total_entries]
			      </div>";
	}
 }

echo "<HTML>
      <HEAD><TITLE>$page_title</TITLE></HEAD>
      <body bgcolor='white' text=black>";

echo "<table width='60%'>
	<tr><td>$location</td></tr>
	<tr><td>
		$cat_list
	</td></tr>
      </table>";

echo "<table width='100%'>
	$code_list
      </table>";
?>