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/
<?
  //same thing as index.php - except this takes an argument
  include_once( dirname(__FILE__)."/include/config.php");

 if( empty( $_GET["id"] ) )
 {
	echo "Missing category id";
	exit;
 }

 preg_match("#(\d+)#", $_GET["id"] , $match);
 $cat_id = $match[1];

 if( !file_exists( $database_dir."/$cat_id".".xml" ) )
 {
	echo "Can't locate: $cat_id.xml";
 	exit;
 }

 //start at our first directory: concatenate required trailers
 $url  = $database_url;
 $url .= "/$cat_id";
 $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>";
?>