phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] filemanager/inc/hook_deleteaccount.inc.php, 1.2.4.1


From: nomail
Subject: [Phpgroupware-cvs] filemanager/inc/hook_deleteaccount.inc.php, 1.2.4.1
Date: Sun, 18 Jul 2004 01:16:40 +0200

Update of /filemanager/inc
Modified Files:
        Branch: Version-0_9_16-branch
          hook_deleteaccount.inc.php

date: 2004/07/17 23:16:40;  author: skwashd;  state: Exp;  lines: +48 -14

Log Message:
code to be tested more
=====================================================================
Index: filemanager/inc/hook_deleteaccount.inc.php
diff -u filemanager/inc/hook_deleteaccount.inc.php:1.2 
filemanager/inc/hook_deleteaccount.inc.php:1.2.4.1
--- filemanager/inc/hook_deleteaccount.inc.php:1.2      Tue Sep  4 04:58:12 2001
+++ filemanager/inc/hook_deleteaccount.inc.php  Sat Jul 17 23:16:40 2004
@@ -9,20 +9,54 @@
   *  option) any later version.                                              *
   \**************************************************************************/
        /* $Id$ */
-       /*
-       global $phpgw;
-       global $account_id;
-       */
-       /* NOTE: This is untested */
-       /* WIP: it should get all files owned by $account_id, not just in 
/home/account_id */
-       /* Should also be capable of transfering files to another user */
+       
+       /* 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']);
 
-/*
-       $phpgw->vfs->working_id = $account_id;
-       $ls_array = $phpgw->vfs->ls ($phpgw->vfs->fakebase . "/" . $account_id, 
array (RELATIVE_NONE));
-       while (list ($num, $entry) = each ($ls_array))
+       
+       if(false)// @isset($_POST['new_owner']) && intval($_POST['new_owner']) )
        {
-               $phpgw->vfs->rm ($entry["dir"] . "/" . $entry["name"], array 
(RELATIVE_NONE));
+               $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__);
+       }
+       */
 ?>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]