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

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

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

	function getindex($_filedirid)
	{
		$sqlq = new SQLSelect();
		$sqlq->setSelect($this->db_field['dirindex'],
			$this->db_table['dirindex']);
		$sqlq->setWhere($this->db_table['dirindex'].".fileid=".
			$_filedirid);
		$result = $sqlq->getRow($this->db, $sqlq->SQLReturn());
		return $result['dirindex'];
	}

	function getdirindex($_filedirid, $_ownerid, $_dirarray)
	{
		$sqlq = new SQLSelect();
		$sqlq->setSelect($this->db_field['dirindex'],
			$this->db_table['dirindex']);
		$sqlq->setSelect($this->db_field['filedirdb'],
			$this->db_table['filedirdb']);
		$sqlq->setWhere($this->db_table['filedirdb'].".ownerid=".$_ownerid);
		$sqlq->setWhere($this->db_table['dirindex'].".fileid=".
			$this->db_table['filedirdb'].".id");
		$tstr = "";
		for ($i=0; $i<count($_dirarray); $i++)
		{
			if ($tstr!="")
				$tstr.=", ";
			$tstr .= "'".$_dirarray[$i]."'";
		}
		$sqlq->setWhere($this->db_table['dirindex'].".dirname IN (".$tstr.")");
		$sqlq->setOrder($this->db_table['dirindex'].".fileid, ".$this->db_table['dirindex'].".id");

		
		$result = $sqlq->getRow($this->db, $sqlq->SQLReturn());
		if (isset($result['dirindex']))
			return $result['dirindex'];
		else
			return null;
	}
}

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