This file provides basic functions used by the account lists. They
cover major parts of the HTML output.
@@ -24,8 +20,7 @@ They allow to have translated descriptions of the most common
attributes.
Status messages (status.inc)
-Status.inc provides the function StatusMessage()
+Status.inc provides the function StatusMessage()
which can be used to display error, warning and information messages.
The function uses preg_replace() to convert the special tags to HTML
tags. The message variables are included with printf().
@@ -36,8 +31,7 @@ The parameters of StatusMes
Tree view and schema browser
The files tree.inc and schema.inc contain functions which are needed by
the tree view and the schema browser.
-These functions were copied from phpLDAPadmin
+These functions were copied from phpLDAPadmin
(PLA).
@@ -47,5 +41,4 @@ These functions were copied from
-
-
+
\ No newline at end of file
diff --git a/lam/docs/manual-sources/howto.xml b/lam/docs/manual-sources/howto.xml
index 343becec..0f9971a1 100644
--- a/lam/docs/manual-sources/howto.xml
+++ b/lam/docs/manual-sources/howto.xml
@@ -933,10 +933,8 @@ Have fun!
of LDAP entries. If you would like to use it then enter the LDAP
suffix at "Tree suffix".
- Some LDAP queries are internally cached by LAM. You can
- specify how long LAM should use cached data. The search limit is
- used to reduce the number of search results which are returned by
- your LDAP server.
+ The search limit is used to reduce the number of search
+ results which are returned by your LDAP server.The access level specifies if LAM should allow to modify LDAP
entries. This feature is only available in LAM Pro. LAM non-Pro
diff --git a/lam/lib/cache.inc b/lam/lib/cache.inc
deleted file mode 100644
index abfbc658..00000000
--- a/lam/lib/cache.inc
+++ /dev/null
@@ -1,204 +0,0 @@
-time = 0;
- $this->attributes = array();
- }
-
- /**
- * This function adds attributes to the cache.
- *
- * @param array $attributes syntax: is array( scope1 => array ( attributes ), scope2 => array ( attributes ), ...)
- */
- private function add_cache($attributes) {
- if (!is_array($attributes)) trigger_error('Argument of add_cache must be : array ( scope => array(attribute1(string), attribute2(string), ..), scope => ... ).', E_USER_ERROR);
- foreach ($attributes as $attribute) {
- if (!is_array($attribute)) trigger_error('Argument of add_cache must be : array ( scope => array(attribute1(string), attribute2(string), ..), scope => ... ).', E_USER_ERROR);
- foreach ($attribute as $singleattribute) {
- if (!is_string($singleattribute)) trigger_error('Argument of add_cache must be : array ( scope => array(attribute1(string), attribute2(string), ..), scope => ... ).', E_USER_ERROR);
- }
- }
- $scopes = array_keys($attributes);
- foreach ($scopes as $scope) {
- for ($i=0; $iattributes[$scope])) $this->attributes[$scope][] = $attributes[$scope][$i];
- }
- }
- // Rebuild cache
- $this->refresh_cache(true);
- }
-
- /**
- * Queries the cache for a list of LDAP entries and their attributes.
- *
- * @param mixed $attributes One (string) or many (array) attribute names.
- * @param string $objectClass The resulting entries need to contain this object class.
- * @param mixed $scopelist the account type(s) as string or array, all scopes if NULL given
- * @return array The found LDAP entries.
- * Format: array(dn1 => array(uidnumber1), dn2 => array(uidnumber2), ... ) if $attributes is of type string
- * or array(dn1 => array(uid => array(myuid), uidNumber => array(1234)), ... ) if $attributes is an array
- *
- */
- public function get_cache($attributes, $objectClass, $scopelist) {
- $return = array();
- $this->refresh_cache();
- if (is_array($scopelist)) $scopes = $scopelist;
- elseif (is_string($scopelist)) $scopes = array($scopelist);
- else $scopes = getTypes();
- // Add cache entry dynamic
- if (!is_array($attributes)) $attributes = array($attributes);
- $add = array();
- foreach ($scopes as $scope) {
- for ($i = 0; $i < sizeof($attributes); $i++) {
- if (!@in_array($attributes[$i], $this->attributes[$scope])) $add[$scope][] = $attributes[$i];
- }
- }
- if (count($add)!=0) $this->add_cache($add);
-
- foreach ($scopes as $scope) {
- if (isset($this->ldapcache[$scope])) {
- $DNs = array_keys($this->ldapcache[$scope]);
- foreach ($DNs as $dn) {
- // skip entries which do not fit to search
- if (!in_array($objectClass, $this->ldapcache[$scope][$dn]['objectClass'])) continue;
- for ($i = 0; $i < sizeof($attributes); $i++) {
- if (isset($this->ldapcache[$scope][$dn][$attributes[$i]])) {
- if (sizeof($attributes) > 1) {
- $return[$dn][$attributes[$i]] = $this->ldapcache[$scope][$dn][$attributes[$i]];
- }
- else {
- $return[$dn] = $this->ldapcache[$scope][$dn][$attributes[$i]];
- }
- }
- }
- }
- }
- }
- return $return;
- }
-
- /**
- * This function refreshes the cache.
- *
- * @param boolean $rebuild forces a refresh if set to true
- */
- public function refresh_cache($rebuild=false) {
- if ($this->time + $_SESSION['config']->get_cacheTimeoutSec() < time() || $rebuild) {
- // unset old cache
- unset ($this->ldapcache);
- $scopes = array_keys($this->attributes);
- foreach ($scopes as $scope) {
- // Get suffix
- $suffix = $_SESSION['config']->get_Suffix($scope);
- // Get Data from ldap
- $search = $this->attributes[$scope];
- $search[] = 'objectClass';
- $result = @ldap_search($_SESSION['ldap']->server(), escapeDN($suffix), 'objectClass=*',
- $search, 0, $_SESSION['config']->get_searchLimit(), 0, LDAP_DEREF_NEVER);
- if ($result) {
- // Write search result in array
- $entry = @ldap_first_entry($_SESSION['ldap']->server(), $result);
- while ($entry) {
- $dn = (ldap_get_dn($_SESSION['ldap']->server(), $entry));
- $attr = ldap_get_attributes($_SESSION['ldap']->server(), $entry);
- // unset double entries
- for ($i=0; $ildapcache[$scope][$dn] = $attr;
- $entry = ldap_next_entry($_SESSION['ldap']->server(), $entry);
- }
- ldap_free_result($result);
- }
- }
- $this->time = time();
- }
- }
-
- /**
- * Encrypts LDAP cache before saving to session file.
- *
- * @return array list of variables to save
- */
- function __sleep() {
- $attrs = array("attributes", "time");
- if (isset($this->ldapcache)) {
- $this->ldapcache = $_SESSION['ldap']->encrypt(serialize($this->ldapcache));
- $attrs[] = 'ldapcache';
- }
- // define which attributes to save
- return $attrs;
- }
-
- /**
- * Decrypts LDAP cache after loading from session file.
- */
- function __wakeup() {
- $this->ldapcache = unserialize($_SESSION['ldap']->decrypt($this->ldapcache));
- }
-
-}
-
-?>
diff --git a/lam/lib/modules.inc b/lam/lib/modules.inc
index c20c8580..276f1d1a 100644
--- a/lam/lib/modules.inc
+++ b/lam/lib/modules.inc
@@ -31,8 +31,6 @@ $Id$
* @author Roland Gruber
*/
-/** LDAP caches */
-include_once("cache.inc");
/** some helper functions */
include_once("account.inc");
/** parent class of account modules */
@@ -2023,7 +2021,6 @@ class accountContainer {
$this->module[$singlemodule]->postModifyActions($this->isNewAccount, $currentAccountAttributes);
}
}
- $_SESSION['cache']->refresh_cache(true);
return $errors;
}
diff --git a/lam/templates/delete.php b/lam/templates/delete.php
index 33e410cc..cf98fad1 100644
--- a/lam/templates/delete.php
+++ b/lam/templates/delete.php
@@ -62,9 +62,6 @@ if (!isset($_SESSION['loggedIn']) || ($_SESSION['loggedIn'] !== true)) {
// Set correct language, codepages, ....
setlanguage();
-if (!isset($_SESSION['cache'])) {
- $_SESSION['cache'] = new cache();
-}
if (isset($_GET['type']) && isset($_SESSION['delete_dn'])) {
// Create account list
foreach ($_SESSION['delete_dn'] as $dn) {
@@ -233,7 +230,6 @@ if (isset($_POST['delete'])) {
echo " \n";
}
}
- $_SESSION['cache']->refresh_cache(true);
echo " \n";
echo " \n";
echo "
\n";
diff --git a/lam/templates/main.php b/lam/templates/main.php
index 940793f4..963b2744 100644
--- a/lam/templates/main.php
+++ b/lam/templates/main.php
@@ -28,8 +28,6 @@ $Id$
* @author Roland Gruber
*/
-/** LDAP attibute cache */
-include_once('../lib/cache.inc');
/** config object */
include_once('../lib/config.inc');
@@ -38,11 +36,6 @@ startSecureSession();
setlanguage();
-// create cache object
-if (!isset($_SESSION['cache'])) {
- $_SESSION['cache'] = new cache();
-}
-
// check if all suffixes in conf-file exist
$conf = $_SESSION['config'];
$new_suffs = array();
diff --git a/lam/templates/massDoUpload.php b/lam/templates/massDoUpload.php
index 5cbf4f0e..0fd6b912 100644
--- a/lam/templates/massDoUpload.php
+++ b/lam/templates/massDoUpload.php
@@ -38,8 +38,6 @@ include_once('../lib/ldap.inc');
include_once('../lib/status.inc');
/** account modules */
include_once('../lib/modules.inc');
-/** LAM cache */
-include_once('../lib/cache.inc');
// Start session
@@ -123,7 +121,6 @@ if (($_SESSION['mass_counter'] < sizeof($accounts)) || !isset($_SESSION['mass_po
}
// all accounts have been created
else {
- $_SESSION['cache']->refresh_cache(true);
echo "