Location: PHPKode > projects > RabbitBB - Online Web Storage Project > mywebdrive/PHP_CON/general/BSGBrowseDir.php
<?PHP

class BSGBrowseDir
{
	var $bsgar;
	var $filedirdb;

	function BSGBrowseDir()
	{
		$this->bsgar = new BSGAuthRight();
	}

	function browseDir($_dirname, $_ownerid, $_keypass, $_vartype=FILENAME)
	{
		if ($this->bsgar->checkDirRead($_dirname, NSession::getuid(),
			$_ownerid, $_keypass, $_vartype))
		{
			$filedirdb = $this->bsgar->getfiledirdb();
			$this->filedirdb = $filedirdb;


			if ($filedirdb!=null)
			{
				$daolsdir = new DAOlsDir();
				$daolsfile = new DAOlsFile();

				$lsdir = $daolsdir->lsDir($filedirdb);
				for ($i=0; $i<count($lsdir); $i++)
				{
					$tfiledir = $lsdir[$i];
					$tobj = $tfiledir->getobj();
					$tobj->setdirname(htmlspecialchars($tobj->getdirname()));
					$tobj->setfullpath(htmlspecialchars($tobj->getfullpath()));
					$tfiledir->setobj($tobj);
					$lsdir[$i] = $tfiledir;
				}
				$lsfile = $daolsfile->lsFile($filedirdb);
				for ($i=0; $i<count($lsfile); $i++)
				{
					$tfiledir = $lsfile[$i];
					$tobj = $tfiledir->getobj();
					$tobj->setfilename(htmlspecialchars($tobj->getfilename()));
					$tobj->setfullpath(htmlspecialchars($tobj->getfullpath()));
					$tfiledir->setobj($tobj);
					$lsfile[$i] = $tfiledir;
				}

				return array_merge($lsdir, $lsfile);
			}
			else
				return null;
		}
		else
		{
			// Return Error : Access Denied
			echo "BrowseDir: Access Denied";
			return null;
		}
	}

	function getFiledirdb()
	{
		return $this->filedirdb;
	}

}

?>
Return current item: RabbitBB - Online Web Storage Project