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

class BSDelDir
{
	function BSDelDir()
	{
	}

	function deldir($_request, $_response)
	{

		// Get a list of affected files and dir

		$_response['idlist'] = array();
		$_response['fileidlist'] = array();
		$_response = $this->frequentdir($_request, $_response);

		$daogf = new DAOGetFileDirAttr();
		$filedirdb = $daogf->getDirById($_request['dirid']);

		$_response['idlist'][] = $filedirdb;

		$bsar = new BSGAuthRight();
		$rauth = $bsar->getBasicAuthWFileDirDb($filedirdb, $_request['user_id'], $_request['ownerid']);
		if ($rauth->getdeldir()!="Y")
			return $_response;


		// Send to the DAO and complete everything

		$dao = new DAODelDir();
		$_response['result'] = $dao->deldir($_request, $_response);

		for ($i=0; $i<count($_response['fileidlist']); $i++)
		{
			$tobj = $_response['fileidlist'][$i]->getobj();
			unlink($_request['filestorage']."/".$tobj->getlocation());
		}
		return $_response;
	}

	function frequentdir($_request, $_response)
	{
		$daoru = new DAORecursiveUpdate();
		$tdirlist = $daoru->getChildDir($_request['dirid']);
		$tfilelist = $daoru->getChildFile($_request['dirid']);

		for ($i=0; $i<count($tdirlist); $i++)
		{
			$_request['dirid'] = $tdirlist[$i]->getid();
			$_response['idlist'][] = $tdirlist[$i];
			$_response = $this->frequentdir($_request, $_response);

		}
		for ($i=0; $i<count($tfilelist); $i++)
		{
			$_response['idlist'][] = $tfilelist[$i];
			$_response['fileidlist'][] = $tfilelist[$i];
		}

		return $_response;
		
	}
}

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