From 3226ec1c17eec83ca5a1ea424f744891e6daee6a Mon Sep 17 00:00:00 2001
From: Rodolphe Quiedeville <rodolphe@quiedeville.org>
Date: Wed, 10 Sep 2003 16:50:53 +0000
Subject: [PATCH] =?UTF-8?q?Impl=E9mentation=20des=20d=E9pendances=20de=20m?=
 =?UTF-8?q?odules?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 htdocs/admin/modules.php | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php
index 774ace6307c..0ff50d3fd30 100644
--- a/htdocs/admin/modules.php
+++ b/htdocs/admin/modules.php
@@ -116,6 +116,15 @@ $modules["MAIN_MODULE_EXTERNAL_RSS"][4] = "modExternalRss";
 
 if ($action == 'set' && $user->admin)
 {
+  Activate($value);
+
+  Header("Location: modules.php");
+}
+
+function Activate($value)
+{
+  global $db, $modules;
+
   $sql = "REPLACE INTO llx_const SET name = '".$value."', value='1', visible = 0";
 
   if ($db->query($sql))
@@ -129,15 +138,19 @@ if ($action == 'set' && $user->admin)
 	  include("../includes/modules/$file");
 	  $objMod = new $modName($db);
 	  $objMod->init();
-
-	  Header("Location: modules.php");
 	}
     }
+
+  for ($i = 0; $i < sizeof($objMod->depends); $i++)
+    {
+      Activate($objMod->depends[$i]);
+    }
+    
 }
 
 if ($action == 'reset' && $user->admin)
 {
-  $sql = "REPLACE INTO llx_const SET name = '".$value."', value='0', visible = 0";
+  $sql = "DELETE FROM llx_const WHERE name = '".$value."'";
 
   if ($db->query($sql))
     {
@@ -150,10 +163,9 @@ if ($action == 'reset' && $user->admin)
 	  include("../includes/modules/$file");
 	  $objMod = new $modName($db);
 	  $objMod->remove();
-
-	  Header("Location: modules.php");
 	}
     }
+  Header("Location: modules.php");
 }
 
 $db->close();
-- 
GitLab