<?php
  /**************************************************************************\
  * phpGroupWare                                                             *
  * http://www.phpgroupware.org                                              *
  * --------------------------------------------                             *
  *  This program is free software; you can redistribute it and/or modify it *
  *  under the terms of the GNU General Public License as published by the   *
  *  Free Software Foundation; either version 2 of the License, or (at your  *
  *  option) any later version.                                              *
  \**************************************************************************/
	/* $Id: hook_deleteaccount.inc.php,v 1.2.4.1 2004/07/17 23:16:40 skwashd Exp $ */
	
	/* Needs more work - skwashd
	$GLOBALS['phpgw']->vfs = createObject('phpgwapi.vfs');
	
	$GLOBALS['phpgw']->vfs->fakebase	= $GLOBALS['phpgw_info']['server']['files_dir'];
	$GLOBALS['phpgw']->vfs->working_id	= $_POST['account_id'];
	$GLOBALS['phpgw']->vfs->working_lid	= $GLOBALS['phpgw']->accounts->id2name($_POST['account_id']);

	
	if(false)// @isset($_POST['new_owner']) && intval($_POST['new_owner']) )
	{
		$ls_array = array();
		$ls_array = $GLOBALS['phpgw']->vfs->ls(
			array(
				'string'	=> '/',
				'checksubdirs'	=> True,
				'relatives'	=> array (RELATIVE_ROOT)
			)
		);

		if( count($ls_array) > 1 )//root dir is 1
		{
			foreach ($ls_array as $num => $entry)
			{
				if( $entry['owner_id'] == $GLOBALS['account_id'] )
				{
					echo "<pre>$num => "; print_r($entry); echo "</pre><br />\n";
					$ok = $GLOBALS['phpgw']->vfs->set_attributes(
						array(
							'string'	=> $entry['directory'] .'/'
										. $entry['name'],
							'attributes'	=> array('owner_id' => $_POST['new_owner']),
							'relatives'	=> array(RELATIVE_ROOT)
						)
					);
					if(!$ok)
					{
						echo 'NQR changing: ' . $entry['directory'] .'/'. $entry['name'] . "<br />\n";
					}
				}
			}
		}
	}
	else
	{
		//delete from journal but not from disk - too many risks - skwashd
		$GLOBALS['phpgw']->db->query('DELETE FROM phpgw_vfs'
					. ' WHERE owner_id = ' .  intval($_POST['account_id']), __LINE__, __FILE__);
	}
	*/
?>
