Location: PHPKode > projects > iF.SVNAdmin > svnadmin/ifphplib/globals.php
<?php
/**
 * Converst a MySQL datetime return value into a unix timestamp.
 *
 * @param string $strSqlDate (Example: 2007-12-24 13:23:54
 * 
 * @return int
 */
function SQLDateTimeToUnixTimestamp( $strSqlDate )
{
	if( !empty( $strSqlDate ) )
	{
		// Split date from time.
		$arrDateTime = explode( " " , $strSqlDate );
		
		// Date and time is given in mysl 
		if( count( $arrDateTime ) == 2 )
		{
			// Split the date into year, month and day.
			$arrDate = explode( "-" , $arrDateTime[0] );
			
			$year = $arrDate[0];
			$month = $arrDate[1];
			$day = $arrDate[2];
			
			// Split time into hours, minutes and seconds.
			$arrTime = explode( ":" , $arrDateTime[1] );
			
			$hour = $arrTime[0];
			$minute = $arrTime[1];
			$second = $arrTime[2];
			
			// Create timestamp from fetched values.
			return mktime( $hour, $minute , $second , $month , $day , $year );
		}
	}
	else
	{
		return 0;
	}
}

function if_rmdir( $path, $bRecursive = false )
{
  if( is_dir( $path ) )
  {
  	$fileList = scandir( $path );
    for( $i=0; $i<count( $fileList ); $i++ )
    {
    	$file = $fileList[$i];
    	$absFile = $path.DIRECTORY_SEPARATOR.$file;

    	if( $file != "." && $file != ".." )
    	{
    		if( !$bRecursive )
    		{
    		  return false; // The directory is not empty.
    		}

    		if( is_dir( $absFile ) )
    		{
    			if_rmdir( $absFile, $bRecursive ); // Delete directory.
    		}
    		else
    		{
    			unlink( $absFile ); // Delete file.
    		}
    	}
    }
    return rmdir( $path );
  }
  return false; // The given $path is not a directory.
}
?>
Return current item: iF.SVNAdmin