From 01bfb82e0ff7119ec0e10394c79326c4b96d0cf4 Mon Sep 17 00:00:00 2001 From: katagia Date: Tue, 10 Feb 2004 19:59:41 +0000 Subject: [PATCH] Modules are now included in modules.inc Changed edit-Page to single page --- lam/lib/include.inc | 8 ---- lam/lib/modules.inc | 18 ++++++++ .../account/{hostedit.php => edit.php} | 9 +++- lam/templates/account/groupedit.php | 40 ------------------ lam/templates/account/useredit.php | 41 ------------------- 5 files changed, 25 insertions(+), 91 deletions(-) rename lam/templates/account/{hostedit.php => edit.php} (73%) delete mode 100644 lam/templates/account/groupedit.php delete mode 100644 lam/templates/account/useredit.php diff --git a/lam/lib/include.inc b/lam/lib/include.inc index 31b90928..a25e8b90 100644 --- a/lam/lib/include.inc +++ b/lam/lib/include.inc @@ -36,20 +36,12 @@ include_once($lampath_include.'lib/modules.inc'); // LDAP-functions include_once($lampath_include.'lib/cache.inc'); include_once($lampath_include.'lib/account.inc'); -/* We have to include all modules -* before start session -*/ -$dir = opendir($lampath_include.'lib/modules'); -while ($entry = readdir($dir)) - if (is_file($lampath_include.'lib/modules/'.$entry)) include_once ($lampath_include.'lib/modules/'.$entry); - // Start session session_save_path($lampath_include.'sess'); @session_start(); // Redirect to startpage if user is not loged in if (!isset($_SESSION['loggedIn'])) { - // *** fixme ../../ metaRefresh("../../login.php"); exit; } diff --git a/lam/lib/modules.inc b/lam/lib/modules.inc index 78d0a29d..a66894f8 100644 --- a/lam/lib/modules.inc +++ b/lam/lib/modules.inc @@ -24,6 +24,24 @@ $Id$ */ +/* We have to include all modules +* before start session +*/ +// Get Lampath, needed 4 includes +$stay=0; +$relative=''; +while ($stay<7) { + if (is_dir($relative.'lib/modules')) { + $dir = opendir($relative.'lib/modules'); + while ($entry = readdir($dir)) + if (is_file($relative.'lib/modules/'.$entry)) include_once ($relative.'lib/modules/'.$entry); + $stay=10; + } + else { + $stay++; + $relative .= '../'; + } + } // returns the alias name of a module function getModuleAlias($name) { diff --git a/lam/templates/account/hostedit.php b/lam/templates/account/edit.php similarity index 73% rename from lam/templates/account/hostedit.php rename to lam/templates/account/edit.php index d69114c5..574695bb 100644 --- a/lam/templates/account/hostedit.php +++ b/lam/templates/account/edit.php @@ -27,12 +27,17 @@ include_once('../../lib/include.inc'); if ($_GET['DN']) { //load account + if ($_GET['DN'] == $DN) $DN = str_replace("'", '',$_GET['DN']); $DN = str_replace("\'", '', $_GET['DN']); - $_SESSION['account'] = new accountContainer('host', 'account'); + $type = str_replace("\'", '', $_GET['type']); + if ($_GET['type'] == $type) $type = str_replace("'", '',$_GET['type']); + $_SESSION['account'] = new accountContainer($type, 'account'); $_SESSION['account']->load_account($DN); } else if (count($_POST)==0) { - $_SESSION['account'] = new accountContainer('host', 'account'); + $type = str_replace("\'", '', $_GET['type']); + if ($_GET['type'] == $type) $type = str_replace("'", '',$_GET['type']); + $_SESSION['account'] = new accountContainer($type, 'account'); $_SESSION['account']->new_account(); } $_SESSION['account']->continue_main($_POST); diff --git a/lam/templates/account/groupedit.php b/lam/templates/account/groupedit.php deleted file mode 100644 index 8997a535..00000000 --- a/lam/templates/account/groupedit.php +++ /dev/null @@ -1,40 +0,0 @@ -load_account($DN); - } -else if (count($_POST)==0) { - $_SESSION['account'] = new accountContainer('group', 'account'); - $_SESSION['account']->new_account(); - } -$_SESSION['account']->continue_main($_POST); - -?> diff --git a/lam/templates/account/useredit.php b/lam/templates/account/useredit.php deleted file mode 100644 index d53c290c..00000000 --- a/lam/templates/account/useredit.php +++ /dev/null @@ -1,41 +0,0 @@ -load_account($DN); - } -else if (count($_POST)==0) { - $_SESSION['account'] = new accountContainer('user', 'account'); - $_SESSION['account']->new_account(); - } -$_SESSION['account']->continue_main($_POST); - - -?>