From b774c14fbe307972737813528a4ffcf963178f5d Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Mon, 18 Jul 2011 00:48:33 +0000
Subject: [PATCH] Fix: Delete with ftp module

---
 htdocs/ftp/index.php         | 7 ++-----
 htdocs/lib/functions.lib.php | 6 +++++-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/htdocs/ftp/index.php b/htdocs/ftp/index.php
index 8711c865d46..31570262d5c 100644
--- a/htdocs/ftp/index.php
+++ b/htdocs/ftp/index.php
@@ -21,7 +21,7 @@
  *	\file       htdocs/ftp/index.php
  *	\ingroup    ftp
  *	\brief      Main page for FTP section area
- *	\version    $Id: index.php,v 1.22 2011/07/18 00:03:18 eldy Exp $
+ *	\version    $Id: index.php,v 1.23 2011/07/18 00:49:19 eldy Exp $
  *	\author		Laurent Destailleur
  */
 
@@ -39,9 +39,6 @@ $langs->load("other");
 if ($user->societe_id) $socid=$user->societe_id;
 $result = restrictedArea($user, 'ftp','');
 
-// Load permissions
-$user->getrights('ftp');
-
 // Get parameters
 $action = isset($_GET["action"])?$_GET["action"]:$_POST['action'];
 $section=isset($_GET["section"])?$_GET["section"]:$_POST['section'];
@@ -628,7 +625,7 @@ if ($conn_id) ftp_close($conn_id);
 // End of page
 $db->close();
 
-llxFooter('$Date: 2011/07/18 00:03:18 $ - $Revision: 1.22 $');
+llxFooter('$Date: 2011/07/18 00:49:19 $ - $Revision: 1.23 $');
 
 
 /**
diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php
index c02064d9e0b..fbc9572e7b7 100644
--- a/htdocs/lib/functions.lib.php
+++ b/htdocs/lib/functions.lib.php
@@ -29,7 +29,7 @@
  *	\file			htdocs/lib/functions.lib.php
  *	\brief			A set of functions for Dolibarr
  *					This file contains all frequently used functions.
- *	\version		$Id: functions.lib.php,v 1.546 2011/07/09 11:24:32 eldy Exp $
+ *	\version		$Id: functions.lib.php,v 1.547 2011/07/18 00:48:33 eldy Exp $
  */
 
 // For compatibility during upgrade
@@ -2213,6 +2213,10 @@ function restrictedArea($user, $features='societe', $objectid=0, $dbtablename=''
             {
                 if (! $user->rights->ecm->upload) $deleteok=0;
             }
+            else if ($feature == 'ftp')
+            {
+                if (! $user->rights->ftp->write) $deleteok=0;
+            }
             else if (! empty($feature2))	// This should be used for future changes
             {
                 if (empty($user->rights->$feature->$feature2->supprimer)
-- 
GitLab