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

class DAODelDir
{
	var $db;
	var $db_table;
	var $db_field;

	function DAODelDir()
	{
		global $db, $db_table, $db_field;
		$this->db = $db;
		$this->db_table = $db_table;
		$this->db_field = $db_field;
	}

	function deldir($_request, $_response)
	{
		
		$this->db->sql_query("", BEGIN_TRANSACTION);
		$passed = true;
		for ($i=0; $i<count($_response['idlist']); $i++)
		{
			if ($passed)
			{
				$sqlq = "DELETE FROM ".$this->db_table['filedirdb'].
					" WHERE id=".$_response['idlist'][$i]->getid();
				if (!$this->db->sql_query($sqlq))
				{
					$passed = false;
				}
			}
			if ($passed)
			{
				if ($_response['idlist'][$i]->gettype()==DIRECTORY)
				{
					$sqlq = "DELETE FROM ".$this->db_table['dirattr'].
						" WHERE id=".$_response['idlist'][$i]->getlinkid();
					if (!$this->db->sql_query($sqlq))
					{
						$passed = false;
					}
				}
				elseif ($_response['idlist'][$i]->gettype()==SFILE)
				{
					$sqlq = "DELETE FROM ".$this->db_table['fileattr'].
						" WHERE id=".$_response['idlist'][$i]->getlinkid();
					if (!$this->db->sql_query($sqlq))
					{
						$passed = false;
					}
				}
			}
			if ($passed)
			{
				$sqlq = "DELETE FROM ".$this->db_table['dirindex'].
					" WHERE fileid=".$_response['idlist'][$i]->getid();
				if (!$this->db->sql_query($sqlq))
				{
					$passed = false;
				}
			}
			if ($passed)
			{
				if ($_response['idlist'][$i]->gettype()==DIRECTORY)
				{
					$sqlq = "DELETE FROM ".$this->db_table['userdirparamattr'].
						" WHERE dirdb_id=".$_response['idlist'][$i]->getid();
					if (!$this->db->sql_query($sqlq))
					{
						$passed = false;
					}
				}
				elseif ($_response['idlist'][$i]->gettype()==SFILE)
				{
					$sqlq = "DELETE FROM ".$this->db_table['userfileparamattr'].
						" WHERE filedb_id=".$_response['idlist'][$i]->getid();
					if (!$this->db->sql_query($sqlq))
					{
						$passed = false;
					}
				}
			}
		}
		if ($passed == true)
			$this->db->sql_query("", END_TRANSACTION);
		else
			$this->db->sql_query("", ROLLBACK);
		return $passed;
	}
}

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