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

class BSDelFile
{
	function BSDelFile()
	{
	}

	function delfile($_request, $_response)
	{
		$filedirdb = null;
		if (isset($_request['fileid']) && (is_numeric($_request['fileid'])))
		{

			$daogf = new DAOGetFileDirAttr();
			$filedirdb = $daogf->getFileById($_request['fileid']);
			unset($daogf);
		}

		if ($filedirdb == null)
		{
			$_response['result'] = false;
			return $_response;
		}

		$bsar = new BSGAuthRight();
		$rauth = $bsar->getBasicAuthWFileDirDb($filedirdb, $_request['user_id'], $_request['ownerid']);
		unset($bsar);

		if ($rauth->getwrite()=="Y")
		{
			$daorf = new DAODelFile();

			$_request['filedirdb'] = $filedirdb;
			
			if ($daorf->delfile($_request, $_response))
			{
				$tobj = $filedirdb->getobj();
				unlink($_request['filestorage']."/".$tobj->getlocation());
				$_response['result'] = true;
			}
			else
			{
				$_response['result'] = false;
			}
		}
		else
		{
			$_response['result'] = false;
		}

		return $_response;

	}

}

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