Location: PHPKode > projects > Nfg > nfg/code/home.php
<?php
/*
home.php
User's homepage
-should list files, backup link.
*/
include("header.php");
	
if(!isset($userpath)){
	die(include("footer.php"));
}

$userfilepath=$userpath."/files/";

function readDirectory($dir,$parentid){
	global $user;	
	if(is_dir($dir)){
		$insdir=basename($dir);
		$newitem=$user->newItem('dir',$insdir);
		$newitem->addData('parent',"".$parentid."");
		if($handle = opendir($dir) ){
			while (false !== ($file = readdir($handle))) { 
	       if ($file != "." && $file != "..") { 
	           readDirectory($dir."/".$file,$newitem->getID()); 
	       } 
			}
		}
	}
	else if(is_file($dir)){
		$insfile=basename($dir);
		$newitem=$user->newItem('file',$insfile);
		$newitem->addData('parent',$parentid);
	}
	else{
		echo "wtf$dir";
	}
}
/*
if($handle = opendir($userfilepath) ){
	while (false !== ($file = readdir($handle))) { 
      if ($file != "." && $file != "..") { 
          readDirectory($userfilepath."/".$file,0); 
      } 
	}
}
*/
$itemid=0;
if(isset($_REQUEST['i']))
	$itemid=$_REQUEST['i'];

$item=new Item($itemid);

include('footer.php');
?>
Return current item: Nfg