diff --git a/html/class_passwordRecovery.inc b/html/class_passwordRecovery.inc index 667bf46aba5411ebcf3fe30743544620acf608bf..24d820d089356b5c505b449f863141696837c6ac 100644 --- a/html/class_passwordRecovery.inc +++ b/html/class_passwordRecovery.inc @@ -25,7 +25,6 @@ require_once("functions.inc"); require_once("variables.inc"); class passwordRecovery { - var $config; var $uid; var $message = array(); var $email_address; @@ -72,15 +71,13 @@ class passwordRecovery { exit; } - $this->config = $config; - $this->setupSmarty(); $smarty = get_smarty(); /* Generate server list */ $servers = array(); - foreach ($this->config->data['LOCATIONS'] as $key => $ignored) { + foreach ($config->data['LOCATIONS'] as $key => $ignored) { $servers[$key] = $key; } @@ -91,7 +88,7 @@ class passwordRecovery { } elseif (isset($_GET['directory']) && isset($servers[$_GET['directory']])) { $this->directory = validate($_GET['directory']); } else { - $this->directory = $this->config->data['MAIN']['DEFAULT']; + $this->directory = $config->data['MAIN']['DEFAULT']; if (!isset($servers[$this->directory])) { $this->directory = key($servers); @@ -105,9 +102,8 @@ class passwordRecovery { } /* Set config to selected one */ - $this->config->set_current($this->directory); - session::global_set('config', $this->config); - $config = $this->config; + $config->set_current($this->directory); + session::global_set('config', $config); $this->activated = $this->readLdapConfig(); if (!$this->activated) { /* Password recovery has been disabled */ @@ -231,28 +227,30 @@ class passwordRecovery { */ function readLdapConfig() { - $this->salt = $this->config->get_cfg_value('passwordRecoverySalt'); - $this->delay_allowed = $this->config->get_cfg_value('passwordRecoveryValidity'); + global $config; + $this->salt = $config->get_cfg_value('passwordRecoverySalt'); + $this->delay_allowed = $config->get_cfg_value('passwordRecoveryValidity'); - $this->mail_subject = $this->config->get_cfg_value('passwordRecoveryMailSubject'); - $this->mail_body = $this->config->get_cfg_value('passwordRecoveryMailBody'); - $this->mail2_subject = $this->config->get_cfg_value('passwordRecoveryMail2Subject'); - $this->mail2_body = $this->config->get_cfg_value('passwordRecoveryMail2Body'); + $this->mail_subject = $config->get_cfg_value('passwordRecoveryMailSubject'); + $this->mail_body = $config->get_cfg_value('passwordRecoveryMailBody'); + $this->mail2_subject = $config->get_cfg_value('passwordRecoveryMail2Subject'); + $this->mail2_body = $config->get_cfg_value('passwordRecoveryMail2Body'); - $this->from_mail = $this->config->get_cfg_value('passwordRecoveryEmail'); + $this->from_mail = $config->get_cfg_value('passwordRecoveryEmail'); - $this->usealternates = $this->config->get_cfg_value('passwordRecoveryUseAlternate'); + $this->usealternates = $config->get_cfg_value('passwordRecoveryUseAlternate'); - @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->config->get_cfg_value('passwordRecoveryActivated'), "passwordRecoveryActivated"); - return ($this->config->get_cfg_value('passwordRecoveryActivated') == "TRUE"); + @DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $config->get_cfg_value('passwordRecoveryActivated'), "passwordRecoveryActivated"); + return ($config->get_cfg_value('passwordRecoveryActivated') == "TRUE"); } function setupSmarty() { + global $config; $smarty = get_smarty(); /* Set template compile directory */ - $smarty->compile_dir = $this->config->get_cfg_value("templateCompileDirectory", SPOOL_DIR); + $smarty->compile_dir = $config->get_cfg_value("templateCompileDirectory", SPOOL_DIR); /* Check for compile directory */ if (!(is_dir($smarty->compile_dir) && is_writable($smarty->compile_dir))) { @@ -289,18 +287,19 @@ class passwordRecovery { function storeToken($temp_password) { + global $config; /* Store it in ldap with the salt */ $salt_temp_password = $this->salt.$temp_password.$this->salt; $sha1_temp_password = "{SHA}".base64_encode(pack("H*", sha1($salt_temp_password))); - $ldap = $this->config->get_ldap_link(); + $ldap = $config->get_ldap_link(); // Check if token branch is here - $token = get_ou('tokenRDN').get_ou('fusiondirectoryRDN').$this->config->current['BASE']; + $token = get_ou('tokenRDN').get_ou('fusiondirectoryRDN').$config->current['BASE']; $ldap->cat($token, array('dn')); if (!$ldap->count()) { /* It's not, let's create it */ - $ldap->cd ($this->config->current['BASE']); + $ldap->cd ($config->current['BASE']); $ldap->create_missing_trees($token); if (!$ldap->success()) { return msgPool::ldaperror($ldap->get_error(), @@ -336,13 +335,14 @@ class passwordRecovery { function checkToken($token) { + global $config; $salt_token = $this->salt.$token.$this->salt; $sha1_token = "{SHA}".base64_encode(pack("H*", sha1($salt_token))); /* Retrieve hash from the ldap */ - $ldap = $this->config->get_ldap_link(); + $ldap = $config->get_ldap_link(); - $token = get_ou('tokenRDN').get_ou('fusiondirectoryRDN').$this->config->current['BASE']; + $token = get_ou('tokenRDN').get_ou('fusiondirectoryRDN').$config->current['BASE']; $dn = "ou=".$this->uid.",$token"; $ldap->cat($dn); $attrs = $ldap->fetch(); @@ -357,6 +357,7 @@ class passwordRecovery { function checkForSSL() { + global $config; $smarty = get_smarty(); /* Check for SSL connection */ @@ -370,10 +371,10 @@ class passwordRecovery { } /* If SSL is forced, just forward to the SSL enabled site */ - if ($this->config->get_cfg_value("forcessl") == 'TRUE') { + if ($config->get_cfg_value("forcessl") == 'TRUE') { header("Location: $ssl"); exit; - } elseif ($this->config->get_cfg_value("warnssl") == 'TRUE') { + } elseif ($config->get_cfg_value("warnssl") == 'TRUE') { /* Display SSL mode warning? */ $smarty->assign("ssl", "<b>"._("Warning").":</b> ". _("Session will not be encrypted."). @@ -412,18 +413,19 @@ class passwordRecovery { function getUserDn() { + global $config; /* Retrieve dn from the ldap */ - $ldap = $this->config->get_ldap_link(); + $ldap = $config->get_ldap_link(); $objectClasses = array('gosaMailAccount'); - if (class_available('personalInfo') && ($this->config->get_cfg_value('privateEmailPasswordRecovery', 'FALSE') == 'TRUE')) { + if (class_available('personalInfo') && ($config->get_cfg_value('privateEmailPasswordRecovery', 'FALSE') == 'TRUE')) { $objectClasses[] = 'fdPersonalInfo'; } - if (class_available('supannAccount') && ($this->config->get_cfg_value('supannPasswordRecovery', 'TRUE') == 'TRUE')) { + if (class_available('supannAccount') && ($config->get_cfg_value('supannPasswordRecovery', 'TRUE') == 'TRUE')) { $objectClasses[] = 'supannPerson'; } $filter = '(&(|(objectClass='.join(')(objectClass=', $objectClasses).'))(uid='.$this->uid.'))'; - $ldap->cd($this->config->current['BASE']); + $ldap->cd($config->current['BASE']); $ldap->search($filter, array('dn')); if ($ldap->count() < 1) { @@ -442,6 +444,7 @@ class passwordRecovery { /* find the uid of for the given email address */ function step2() { + global $config; if ($_POST['email_address'] == "") { $this->message[] = msgPool::required(_("Email address")); return; @@ -454,14 +457,14 @@ class passwordRecovery { } else { $filter = "(&(objectClass=gosaMailAccount)(mail=".$this->email_address."))"; } - if (class_available('personalInfo') && ($this->config->get_cfg_value('privateEmailPasswordRecovery', 'FALSE') == 'TRUE')) { + if (class_available('personalInfo') && ($config->get_cfg_value('privateEmailPasswordRecovery', 'FALSE') == 'TRUE')) { $filter = '(|'.$filter.'(&(objectClass=fdPersonalInfo)(fdPrivateMail='.$this->email_address.')))'; } - if (class_available('supannAccount') && ($this->config->get_cfg_value('supannPasswordRecovery', 'TRUE') == 'TRUE')) { + if (class_available('supannAccount') && ($config->get_cfg_value('supannPasswordRecovery', 'TRUE') == 'TRUE')) { $filter = '(|'.$filter.'(&(objectClass=supannPerson)(supannMailPerso='.$this->email_address.')))'; } $uids = get_list( $filter, "", - $this->config->current['BASE'], array("uid"), + $config->current['BASE'], array("uid"), GL_SUBSEARCH | GL_NO_ACL_CHECK); /* Only one uid should be found */ diff --git a/include/class_CopyPasteHandler.inc b/include/class_CopyPasteHandler.inc index 4f9af7168bdf15a89bd2e6038a8ad38c8ff014d8..c685e8778728d426395efb9f0032fceb01cb71fd 100644 --- a/include/class_CopyPasteHandler.inc +++ b/include/class_CopyPasteHandler.inc @@ -30,7 +30,6 @@ */ class CopyPasteHandler { - var $config; var $current; /*! @@ -52,16 +51,13 @@ class CopyPasteHandler var $clean_objects = array(); var $require_update = FALSE; - - /*! * \brief Create CP handler * * \param string $config */ - function __construct(&$config) + function __construct() { - $this->config = &$config; $this->current = NULL; $this->queue = array(); } @@ -90,6 +86,7 @@ class CopyPasteHandler */ function add_to_queue() { + global $config; $dn = func_get_arg(0); @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, "add_to_queue"); $action = func_get_arg(1); @@ -125,7 +122,7 @@ class CopyPasteHandler return FALSE; } - if (!isset($this->config->data['TABS'][$tab_object])) { + if (!isset($config->data['TABS'][$tab_object])) { trigger_error(sprintf("Specified tab object '%s' does not exists.", $tab_object)); return FALSE; } @@ -181,6 +178,7 @@ class CopyPasteHandler */ protected function load_entry_from_ldap($entry, $base) { + global $config; @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $entry['dn'], 'load_entry_from_ldap'); if (!isset($entry['tab_class']) && !isset($entry['type'])) { return array(); @@ -196,7 +194,7 @@ class CopyPasteHandler $tab_a = $entry['tab_acl_category']; // Deprecated - $entry['object'] = new $tab_c($this->config, $this->config->data['TABS'][$tab_o], $entry['dn'], $tab_a); + $entry['object'] = new $tab_c(NULL, $config->data['TABS'][$tab_o], $entry['dn'], $tab_a); } $entry['object']->set_acl_base($base); diff --git a/include/class_SnapshotDialogs.inc b/include/class_SnapshotDialogs.inc index 838478f8a0a3298aed2021939775ccdb28142372..47e142f742a06ac9184226e0fa5fa9325ceb863f 100644 --- a/include/class_SnapshotDialogs.inc +++ b/include/class_SnapshotDialogs.inc @@ -46,9 +46,9 @@ class SnapshotCreateDialog extends simplePlugin ); } - function __construct (&$config, $dn, $parent, $aclCategory) + function __construct ($unused, $dn, $parent, $aclCategory) { - parent::__construct($config); + parent::__construct(); $this->attributesAccess['description']->setInLdap(FALSE); $this->object_dn = $dn; $this->parent = $parent; @@ -191,9 +191,9 @@ class SnapshotRestoreDialog extends simplePlugin ); } - function __construct (&$config, $dn, $parent, $global, $aclCategory) + function __construct ($unused, $dn, $parent, $global, $aclCategory) { - parent::__construct($config); + parent::__construct(); $this->object_dn = $dn; $this->parent = $parent; $this->global = $global; diff --git a/include/class_SnapshotHandler.inc b/include/class_SnapshotHandler.inc index 6a037488a048b8bf7b4903f7b800350ba7161bc7..9bf318d5664a4c8506d2732afce7d320a86c1c5a 100644 --- a/include/class_SnapshotHandler.inc +++ b/include/class_SnapshotHandler.inc @@ -29,7 +29,6 @@ * the snapshot functionality */ class SnapshotHandler { - var $config; var $snapshotBases = array(); /*! @@ -37,14 +36,13 @@ class SnapshotHandler { * * \param config $config */ - function __construct(&$config) + function __construct() { - $this->config = $config; - + global $config; /* Prepare base */ - $this->snapshotRDN = $this->config->get_cfg_value("snapshotBase"); - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); + $this->snapshotRDN = $config->get_cfg_value("snapshotBase"); + $ldap = $config->get_ldap_link(); + $ldap->cd($config->current['BASE']); $ldap->create_missing_trees($this->snapshotRDN); if (!$ldap->success()) { msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->snapshotRDN, "", get_class()), LDAP_ERROR); @@ -58,7 +56,8 @@ class SnapshotHandler { */ function enabled() { - return $this->config->snapshotEnabled(); + global $config; + return $config->snapshotEnabled(); } /*! @@ -85,7 +84,8 @@ class SnapshotHandler { */ protected function snapshot_dn($dn) { - return preg_replace("/".preg_quote($this->config->current['BASE'], '/')."$/", "", $dn) + global $config; + return preg_replace("/".preg_quote($config->current['BASE'], '/')."$/", "", $dn) .$this->snapshotRDN; } @@ -98,11 +98,12 @@ class SnapshotHandler { */ function getDeletedSnapshots($objectBase, $raw = FALSE) { + global $config; if (!$this->enabled()) { return array(); } - $ldap = $this->config->get_ldap_link(); + $ldap = $config->get_ldap_link(); // Initialize base $base = $this->snapshot_dn($objectBase); @@ -163,11 +164,12 @@ class SnapshotHandler { */ function getSnapshots($dn, $raw = FALSE) { + global $config; if (!$this->enabled()) { return array(); } - $ldap = $this->config->get_ldap_link(); + $ldap = $config->get_ldap_link(); $objectBase = preg_replace("/^[^,]*./", "", $dn); @@ -210,6 +212,7 @@ class SnapshotHandler { */ function createSnapshot($dn, $description = array()) { + global $config; if (!$this->enabled()) { @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Snaptshot are disabled but tried to create snapshot'); return; @@ -222,7 +225,7 @@ class SnapshotHandler { $dns = array($dn); } - $ldap = $this->config->get_ldap_link(); + $ldap = $config->get_ldap_link(); /* check if the dn exists */ if (!$ldap->dn_exists($dn)) { @@ -285,8 +288,9 @@ class SnapshotHandler { */ function removeSnapshot($dn) { - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); + global $config; + $ldap = $config->get_ldap_link(); + $ldap->cd($config->current['BASE']); $ldap->rmdir_recursive($dn); if (!$ldap->success()) { msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $dn), LDAP_ERROR); @@ -300,11 +304,12 @@ class SnapshotHandler { */ function getAvailableSnapsShots($dn, $raw = FALSE) { + global $config; if (!$this->enabled()) { return array(); } - $ldap = $this->config->get_ldap_link(); + $ldap = $config->get_ldap_link(); /* Prepare bases and some other infos */ $base_of_object = preg_replace ('/^[^,]+,/i', '', $dn); @@ -345,11 +350,12 @@ class SnapshotHandler { */ function getAllDeletedSnapshots($base_of_object, $raw = FALSE) { + global $config; if (!$this->enabled()) { return array(); } - $ldap = $this->config->get_ldap_link(); + $ldap = $config->get_ldap_link(); /* Prepare bases */ $new_base = $this->snapshot_dn($base_of_object); @@ -398,12 +404,13 @@ class SnapshotHandler { */ function restoreSnapshot($dn) { + global $config; if (!$this->enabled()) { @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, 'Snaptshot are disabled but tried to restore snapshot'); return array(); } - $ldap = $this->config->get_ldap_link(); + $ldap = $config->get_ldap_link(); /* Get the snapshot */ $ldap->cat($dn); diff --git a/include/class_config.inc b/include/class_config.inc index b7a6a7baf4ea6ac62ccac43eceba1429e57ba967..c7d8bf6fa59a65fa1771de8bf59010958c018ad4 100644 --- a/include/class_config.inc +++ b/include/class_config.inc @@ -316,7 +316,7 @@ class config { * * Example usage: * \code - * $ldap = $this->config->get_ldap_link(); + * $ldap = $config->get_ldap_link(); * \endcode * * \param boolean $sizelimit Weither to impose a sizelimit on the LDAP object or not. @@ -780,7 +780,7 @@ class config { * * Example usage: * \code - * if ($this->config->boolValueIsTrue("main", "copyPaste")) { + * if ($config->boolValueIsTrue("main", "copyPaste")) { * echo "Copy Paste Handling is enabled"; * } * \endcode @@ -812,7 +812,7 @@ class config { * * Example usage: * \code - * $postcmd = $this->config->search(get_class($this), 'POSTMODIFY'); + * $postcmd = $config->search(get_class($this), 'POSTMODIFY'); * \endcode * * \param string $class The class name diff --git a/include/class_filter.inc b/include/class_filter.inc index aac3ec5e8c7e7ab098f3ea0a867526571c5040a9..0b1322440381d09fcfc2396df54534d58459a5a5 100644 --- a/include/class_filter.inc +++ b/include/class_filter.inc @@ -542,20 +542,20 @@ class filter * * \param string $value */ - function getCompletitionList($config, $tag, $value = "*") + function getCompletitionList($cfg, $tag, $value = "*") { global $class_mapping; $res = array(); // Is backend available? - $backend = "filter".$config['backend']; + $backend = "filter".$cfg['backend']; if (!isset($class_mapping["$backend"])) { die("Invalid backend specified in search config."); } // Load filter and attributes - $filter = $config['filter']; - $attributes = $config['attribute']; + $filter = $cfg['filter']; + $attributes = $cfg['attribute']; if (!is_array($attributes)) { $attributes = array($attributes); } @@ -567,9 +567,9 @@ class filter // Make filter $filter = preg_replace("/\\$$tag/", ldap_escape_f($value), $filter); - if (isset($config['base']) && isset($config['scope']) && isset($config['category'])) { - $result = call_user_func(array($backend, 'query'), $this, $config['base'], $config['scope'], $filter, $attributes, - $config["category"], $config["objectStorage"]); + if (isset($cfg['base']) && isset($cfg['scope']) && isset($cfg['category'])) { + $result = call_user_func(array($backend, 'query'), $this, $cfg['base'], $cfg['scope'], $filter, $attributes, + $cfg["category"], $cfg["objectStorage"]); } else { $result = call_user_func(array($backend, 'query'), $this, $this->base, $this->scope, $filter, $attributes, $this->category, $this->objectStorage); @@ -602,9 +602,9 @@ class filter // Introduce maximum number of entries $max = 25; - foreach ($this->autocompleters as $tag => $config) { + foreach ($this->autocompleters as $tag => $cfg) { if (isset($_POST[$tag])) { - $result = $this->getCompletitionList($config, $tag, $_POST[$tag]); + $result = $this->getCompletitionList($cfg, $tag, $_POST[$tag]); $result = array_unique($result); asort($result); diff --git a/include/class_listing.inc b/include/class_listing.inc index dbe48de99dbed9c1e17b7834c261df655f82b5f1..04abbf2b612a0dfc91c94812e128554004e42bd6 100644 --- a/include/class_listing.inc +++ b/include/class_listing.inc @@ -258,8 +258,8 @@ class listing { // Evaluate columns to be exported if (isset($this->xmlData['table']['column'])) { - foreach ($this->xmlData['table']['column'] as $index => $config) { - if (isset($config['export']) && $config['export'] == "true") { + foreach ($this->xmlData['table']['column'] as $index => $cfg) { + if (isset($cfg['export']) && $cfg['export'] == "true") { $this->exportColumns[] = $index; } } @@ -292,29 +292,29 @@ class listing { } if (isset($this->xmlData['table']['column'])) { - foreach ($this->xmlData['table']['column'] as $index => $config) { + foreach ($this->xmlData['table']['column'] as $index => $cfg) { // Initialize everything to one direction if ($sortInit) { $this->sortDirection[$index] = FALSE; } $sorter = ""; - if ($index == $this->sortColumn && isset($config['sortAttribute']) && - isset($config['sortType'])) { - $this->sortAttribute = $config['sortAttribute']; - $this->sortType = $config['sortType']; + if ($index == $this->sortColumn && isset($cfg['sortAttribute']) && + isset($cfg['sortType'])) { + $this->sortAttribute = $cfg['sortAttribute']; + $this->sortType = $cfg['sortType']; $sorter = " <img class='center' title='".($this->sortDirection[$index]?_("Up"):_("Down"))."' src='geticon.php?context=actions&size=16&icon=view-sort-".($this->sortDirection[$index]?"descending":"ascending")."' alt='".($this->sortDirection[$index]?_('Sort up'):_('Sort down'))."'>"; } - $sortable = (isset($config['sortAttribute'])); + $sortable = (isset($cfg['sortAttribute'])); $link = "href='?plug=".$_GET['plug']."&PID=".$this->pid."&act=SORT_$index'"; - if (isset($config['label'])) { + if (isset($cfg['label'])) { if ($sortable) { - $this->header[$index] = "<th ".$this->colprops[$index]."><a $link>"._($config['label'])."$sorter</a></th>"; + $this->header[$index] = "<th ".$this->colprops[$index]."><a $link>"._($cfg['label'])."$sorter</a></th>"; } else { - $this->header[$index] = "<th ".$this->colprops[$index].">"._($config['label'])."</th>"; + $this->header[$index] = "<th ".$this->colprops[$index].">"._($cfg['label'])."</th>"; } - $this->plainHeader[] = _($config['label']); + $this->plainHeader[] = _($cfg['label']); } else { if ($sortable) { $this->header[$index] = "<th ".$this->colprops[$index]."><a $link> $sorter</a></th>"; @@ -398,13 +398,13 @@ class listing { // Render defined department columns, fill the rest with some stuff $rest = $this->numColumns - 1; - foreach ($this->xmlData['table']['department'] as $index => $config) { + foreach ($this->xmlData['table']['department'] as $index => $cfg) { $colspan = 1; - if (isset($config['span'])) { - $colspan = $config['span']; + if (isset($cfg['span'])) { + $colspan = $cfg['span']; $this->useSpan = TRUE; } - $result .= "<td colspan='$colspan' ".$this->colprops[$index].">".$this->renderCell($config['value'], $entry, $row)."</td>"; + $result .= "<td colspan='$colspan' ".$this->colprops[$index].">".$this->renderCell($cfg['value'], $entry, $row)."</td>"; $rest -= $colspan; } @@ -429,8 +429,8 @@ class listing { $trow .= "<td style='text-align:center;width:20px;'><input type='checkbox' id='listing_selected_$row' name='listing_selected_$row'></td>\n"; } - foreach ($this->xmlData['table']['column'] as $index => $config) { - $renderedCell = $this->renderCell($config['value'], $entry, $row); + foreach ($this->xmlData['table']['column'] as $index => $cfg) { + $renderedCell = $this->renderCell($cfg['value'], $entry, $row); $trow .= "<td ".$this->colprops[$index].">".$renderedCell."</td>\n"; // Save rendered column @@ -689,11 +689,11 @@ class listing { $layout = preg_replace("/\|$/", "", $layout); $cols = explode("|", $layout); - foreach ($cols as $index => $config) { - if ($config != "") { + foreach ($cols as $index => $cfg) { + if ($cfg != "") { $res = ""; $classes = ""; - $components = explode(';', $config); + $components = explode(';', $cfg); foreach ($components as $part) { if (preg_match("/^r$/", $part)) { $res .= "text-align:right;"; @@ -740,22 +740,22 @@ class listing { } - function renderCell($data, $config, $row) + function renderCell($data, $cfg, $row) { // Replace flat attributes in data string - for ($i = 0; $i < $config['count']; $i++) { - $attr = $config[$i]; + for ($i = 0; $i < $cfg['count']; $i++) { + $attr = $cfg[$i]; $value = ""; - if (is_array($config[$attr])) { - $value = $config[$attr][0]; + if (is_array($cfg[$attr])) { + $value = $cfg[$attr][0]; } else { - $value = $config[$attr]; + $value = $cfg[$attr]; } $data = preg_replace("/%\{$attr\}/", htmlentities($value, ENT_COMPAT, 'UTF-8'), $data); } // Watch out for filters and prepare to execute them - $data = $this->processElementFilter($data, $config, $row); + $data = $this->processElementFilter($data, $cfg, $row); // Replace all non replaced %{...} instances because they // are non resolved attributes or filters @@ -775,7 +775,7 @@ class listing { } - function processElementFilter($data, $config, $row) + function processElementFilter($data, $cfg, $row) { preg_match_all("/%\{filter:([^(]+)\((.*)\)\}/", $data, $matches, PREG_SET_ORDER); @@ -824,14 +824,14 @@ class listing { // Move dn if needed if ($param == "dn") { - $params[] = LDAP::fix($config["dn"]); + $params[] = LDAP::fix($cfg["dn"]); continue; } // LDAP variables get replaced by their objects - for ($i = 0; $i < $config['count']; $i++) { - if ($param == $config[$i]) { - $values = $config[$config[$i]]; + for ($i = 0; $i < $cfg['count']; $i++) { + if ($param == $cfg[$i]) { + $values = $cfg[$cfg[$i]]; if (is_array($values)) { unset($values['count']); } diff --git a/include/class_log.inc b/include/class_log.inc index 2bd5af57c22af10fc88f715467cbad42d8b6b805..b42d2fc625e196d12df0dd62411549f6c55e5ffb 100644 --- a/include/class_log.inc +++ b/include/class_log.inc @@ -34,9 +34,6 @@ * \date 11.04.2007 */ class log { - - var $config; - /*! * \brief logging constructor * @@ -63,7 +60,6 @@ class log { if (!session::global_is_set('config')) { $entry['user'] = "unkown"; } else { - $this->config = session::global_get('config'); $ui = get_userinfo(); $entry['user'] = @$ui->dn; } @@ -83,12 +79,12 @@ class log { $entry['changes'] = $changes; $entry['result'] = $result; - if (!isset($this->config) && empty($entry['user'])) { + global $config; + if (!isset($config) && empty($entry['user'])) { $entry['user'] = "unknown"; } /* Check if all given values are valid */ - global $config; $msgs = @log::check($entry); if (count($msgs)) { foreach ($msgs as $msg) { diff --git a/include/class_management.inc b/include/class_management.inc index f77657cf839d25548feabc65336d7301c3a138dc..7d10d0766a68d9053cc69e2d6c2359da08c009c0 100644 --- a/include/class_management.inc +++ b/include/class_management.inc @@ -31,7 +31,6 @@ class management { // Public - public $config = NULL; public $ui = NULL; // The plugin description @@ -100,20 +99,20 @@ class management // Some management classes are used in tab groups and needs this set to FALSE. var $is_template = FALSE; - function __construct(&$config, $ui, $plugname, $headpage) + function __construct($unused, $ui, $plugname, $headpage) { + global $config; $this->plugname = $plugname; $this->headpage = $headpage; $this->ui = $ui; - $this->config = $config; // Add copy&paste and snapshot handler. if (!$this->skipCpHandler) { - $this->cpHandler = new CopyPasteHandler($this->config); + $this->cpHandler = new CopyPasteHandler(); $this->headpage->setCopyPasteHandler($this->cpHandler); } - if (!$this->skipSnapHandler && ($this->config->get_cfg_value("enableSnapshots") == "TRUE")) { - $this->snapHandler = new SnapshotHandler($this->config); + if (!$this->skipSnapHandler && ($config->get_cfg_value("enableSnapshots") == "TRUE")) { + $this->snapHandler = new SnapshotHandler(); $this->headpage->setSnapshotHandler($this->snapHandler); } @@ -133,7 +132,7 @@ class management $this->registerAction("cut", "copyPasteHandler"); $this->registerAction("paste", "copyPasteHandler"); - if ($this->config->get_cfg_value('enableSnapshots') == 'TRUE') { + if ($config->get_cfg_value('enableSnapshots') == 'TRUE') { $this->registerAction('snapshot', 'createSnapshotDialog'); $this->registerAction('restore', 'restoreSnapshotDialog'); } @@ -403,7 +402,7 @@ class management // Delete the object $this->dn = $dn; $this->openTabObject( - new $tabClass($this->config, $this->config->data['TABS'][$tabType], $this->dn, $aclCategory), + new $tabClass(NULL, $config->data['TABS'][$tabType], $this->dn, $aclCategory), $this->dn ); $this->tabObject->delete (); @@ -484,7 +483,7 @@ class management } $aclCategory = $this->aclCategory; if ($this->ui->allow_snapshot_create($this->dn, $aclCategory)) { - $this->dialogObject = new SnapshotCreateDialog($this->config, $this->dn, $this, $aclCategory); + $this->dialogObject = new SnapshotCreateDialog(NULL, $this->dn, $this, $aclCategory); $this->dialogObject->set_acl_base($this->dn); } else { msg_dialog::display(_('Permission'), sprintf(_('You are not allowed to create a snapshot for %s.'), $this->dn), @@ -567,7 +566,7 @@ class management if ($this->ui->allow_snapshot_restore($this->dn, $aclCategory)) { @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dn, 'Snaptshot restoring initiated!'); $this->snapHandler->setSnapshotBases($bases); - $this->dialogObject = new SnapshotRestoreDialog($this->config, $this->dn, $this, !count($target), $aclCategory); + $this->dialogObject = new SnapshotRestoreDialog(NULL, $this->dn, $this, !count($target), $aclCategory); $this->dialogObject->set_acl_base($this->dn); } else { msg_dialog::display(_('Permission'), sprintf(_('You are not allowed to restore a snapshot for %s.'), $this->dn), @@ -635,6 +634,7 @@ class management */ function newEntry($action = "", $target = array(), $all = array(), $altTabClass = "", $altTabType = "", $altAclCategory = "") { + global $config; /* To handle mutliple object types overload this method. * ... * registerAction('newUser', 'newEntry'); @@ -671,9 +671,9 @@ class management if (empty($tabClass) || empty($tabType)) { // No tab type defined } else { - if (isset($this->config->data['TABS'][$tabType])) { + if (isset($config->data['TABS'][$tabType])) { $this->openTabObject( - new $tabClass($this->config,$this->config->data['TABS'][$tabType], $this->dn, $aclCategory), + new $tabClass(NULL, $config->data['TABS'][$tabType], $this->dn, $aclCategory), $this->headpage->getBase() ); @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dn, "Create new entry initiated!"); @@ -701,6 +701,7 @@ class management */ function editEntry($action = "", $target = array(), $all = array(), $altTabClass = "", $altTabType = "", $altAclCategory = "") { + global $config; /* To handle mutliple object types overload this method. * ... * registerAction('editUser', 'editEntry'); @@ -754,7 +755,7 @@ class management } else { $tab = $tabClass; $this->openTabObject( - new $tab($this->config, $this->config->data['TABS'][$tabType], $this->dn, $aclCategory), + new $tab(NULL, $config->data['TABS'][$tabType], $this->dn, $aclCategory), $this->dn ); @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dn, "Edit entry initiated!"); diff --git a/include/class_plugin.inc b/include/class_plugin.inc index e675129dd05fd2f7b6a42b9cb9897da7c8804733..7529bf5d90947cac08272dccde6b3a88c813a4b7 100644 --- a/include/class_plugin.inc +++ b/include/class_plugin.inc @@ -37,13 +37,6 @@ class plugin */ var $parent = NULL; - /*! - \brief Configuration container - - Access to global configuration - */ - var $config = NULL; - /*! \brief Mark plugin as account @@ -120,10 +113,10 @@ class plugin * * \sa plugin() */ - function __construct (&$config, $dn = NULL, $object = NULL) + function __construct ($unused, $dn = NULL, $object = NULL) { + global $config; /* Configuration is fine, allways */ - $this->config = &$config; $this->dn = $dn; // Ensure that we've a valid acl_category set. @@ -163,7 +156,7 @@ class plugin $this->setTemplate($object->is_template); } } else { - $ldap = $this->config->get_ldap_link(); + $ldap = $config->get_ldap_link(); $ldap->cat($this->dn); $this->attrs = $ldap->fetch(); } @@ -247,7 +240,8 @@ class plugin protected function templateSaveAttrs() { - $ldap = $this->config->get_ldap_link(); + global $config; + $ldap = $config->get_ldap_link(); $ldap->cat($this->dn); $template_attrs = $ldap->fetch(); if (!$template_attrs) { @@ -317,8 +311,9 @@ class plugin */ function save() { + global $config; /* include global link_info */ - $ldap = $this->config->get_ldap_link(); + $ldap = $config->get_ldap_link(); $this->entryCSN = ''; @@ -413,11 +408,6 @@ class plugin { $message = array(); - /* Skip if we've no config object */ - if (!isset($this->config) || !is_object($this->config)) { - return $message; - } - $this->callHook('CHECK', array(), $returnOutput); if (!empty($returnOutput)) { $message[] = join("\n", $returnOutput); @@ -858,7 +848,8 @@ class plugin */ function create_unique_dn($attribute, $base) { - $ldap = $this->config->get_ldap_link(); + global $config; + $ldap = $config->get_ldap_link(); $base = preg_replace('/^,*/', '', $base); /* Try to use plain entry first */ @@ -905,9 +896,10 @@ class plugin */ private function rename($src_dn, $dst_dn) { + global $config; /* Try to move the source entry to the destination position */ - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); + $ldap = $config->get_ldap_link(); + $ldap->cd($config->current['BASE']); $ldap->create_missing_trees(preg_replace("/^[^,]+,/", '', $dst_dn)); if (!$ldap->rename_dn($src_dn, $dst_dn)) { new log('debug', 'Ldap Protocol v3 implementation error, ldap_rename failed.', @@ -930,6 +922,7 @@ class plugin */ function move($src_dn, $dst_dn) { + global $config; /* Do not move if only upper- lowercase has changed */ if (strtolower($src_dn) == strtolower($dst_dn)) { return TRUE; @@ -959,9 +952,9 @@ class plugin array("dn","objectClass"), GL_SUBSEARCH | GL_NO_ACL_CHECK); if (count($leaf_deps)) { - $this->config->get_departments(); - $this->config->make_idepartments(); - session::global_set("config", $this->config); + $config->get_departments(); + $config->make_idepartments(); + session::global_set("config", $config); $ui = get_userinfo(); $ui->reset_acl_cache(); } @@ -1444,6 +1437,7 @@ class plugin */ function get_allowed_bases() { + global $config; $deps = array(); /* Is this a new object ? Or just an edited existing object */ @@ -1453,7 +1447,7 @@ class plugin $new = FALSE; } - foreach ($this->config->idepartments as $dn => $name) { + foreach ($config->idepartments as $dn => $name) { if ($new && $this->acl_is_createable($dn)) { $deps[$dn] = $name; } elseif (!$new && $this->acl_is_moveable($dn)) { @@ -1462,9 +1456,9 @@ class plugin } /* Add current base */ - if (isset($this->base) && isset($this->config->idepartments[$this->base])) { - $deps[$this->base] = $this->config->idepartments[$this->base]; - } elseif (strtolower($this->dn) != strtolower($this->config->current['BASE'])) { + if (isset($this->base) && isset($config->idepartments[$this->base])) { + $deps[$this->base] = $config->idepartments[$this->base]; + } elseif (strtolower($this->dn) != strtolower($config->current['BASE'])) { trigger_error("Cannot return list of departments, no default base found in class ".get_class($this).". (base is '".$this->base."')"); } return $deps; diff --git a/include/class_pluglist.inc b/include/class_pluglist.inc index cfe8c90ff9d639c351676f769d3c918f2f3ba33f..7e69153f308ecfd99df7cc2f08c36cd2684bf086 100644 --- a/include/class_pluglist.inc +++ b/include/class_pluglist.inc @@ -34,11 +34,9 @@ class pluglist { var $menu = ""; var $iconmenu = ""; - var $config = NULL; var $ui = NULL; var $current = ""; - /*! * \brief The plInfo result for all plugin, using class as key. * Contains the plugin index in 'INDEX' and the path in 'PATH' @@ -63,12 +61,11 @@ class pluglist { * * \param $ui UI */ - function __construct(&$config, &$ui) + function __construct($unused, &$ui) { - global $class_mapping; + global $class_mapping, $config; $this->ui = &$ui; - $this->config = &$config; /* Fill info part of pluglist */ $classes = get_declared_classes(); @@ -302,14 +299,15 @@ class pluglist { */ function gen_menu() { + global $config; if ($this->menu == "") { $this->menu = '<ul class="menu">'."\n"; /* Parse headlines */ - foreach ($this->config->data['SECTIONS'] as $section => $section_infos) { + foreach ($config->data['SECTIONS'] as $section => $section_infos) { $entries = ''; /* Parse sub-plugins */ - foreach ($this->config->data['MENU'][$section] as $info) { + foreach ($config->data['MENU'][$section] as $info) { if (isset($info['CLASS']) && plugin_available($info['CLASS'])) { if (!$this->check_access($info['ACL'])) { continue; @@ -371,17 +369,17 @@ class pluglist { */ function show_iconmenu() { - global $class_mapping; + global $class_mapping, $config; if ($this->iconmenu == "") { /* Parse headlines */ - foreach ($this->config->data['SECTIONS'] as $section => $section_infos) { + foreach ($config->data['SECTIONS'] as $section => $section_infos) { $entries = ''; $menu = ''; $menu = '<div class="iconmenu_section"><h1 class="menuheader">'; $menu .= $section_infos['NAME']."</h1>\n"; - foreach ($this->config->data['MENU'][$section] as $info) { + foreach ($config->data['MENU'][$section] as $info) { if (isset($info['CLASS']) && plugin_available($info['CLASS'])) { if (!$this->check_access($info['ACL'])) { continue; diff --git a/include/class_userinfo.inc b/include/class_userinfo.inc index 7c35f5744b192140047736188c25d19aa9d3251e..a489b3e9e882f9d3782a46a5352ccdfc3622c960 100644 --- a/include/class_userinfo.inc +++ b/include/class_userinfo.inc @@ -38,7 +38,6 @@ class userinfo var $uid; var $gidNumber = -1; var $language = ""; - var $config; var $subtreeACL = array(); var $ACL = array(); var $groups = array(); @@ -51,10 +50,10 @@ class userinfo /* get acl's an put them into the userinfo object attr subtreeACL (userdn:components, userdn:component1#sub1#sub2,component2,...) */ - function __construct(&$config, $userdn) + function __construct($unused, $userdn) { - $this->config = &$config; - $ldap = $this->config->get_ldap_link(); + global $config; + $ldap = $config->get_ldap_link(); $ldap->cat($userdn, array('cn', 'sn', 'givenName', 'uid', 'gidNumber', 'preferredLanguage')); $attrs = $ldap->fetch(); @@ -78,7 +77,7 @@ class userinfo $this->uid = $attrs['uid'][0]; $this->ip = $_SERVER['REMOTE_ADDR']; - $this->ignoreACL = ($this->config->get_cfg_value("ignoreAcl") == $this->dn); + $this->ignoreACL = ($config->get_cfg_value("ignoreAcl") == $this->dn); /* Initialize ACL_CACHE */ $this->reset_acl_cache(); @@ -98,13 +97,14 @@ class userinfo */ function loadACL() { + global $config; $this->ACL = array(); $this->groups = array(); $this->roles = array(); $this->result_cache = array(); $this->reset_acl_cache(); - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); + $ldap = $config->get_ldap_link(); + $ldap->cd($config->current['BASE']); /* Get member groups... */ $ldap->search('(&(objectClass=groupOfNames)(member='.ldap_escape_f($this->dn).'))', array('dn')); @@ -399,6 +399,7 @@ class userinfo */ function get_permissions($dn, $object, $attribute = "", $skip_write = FALSE) { + global $config; /* If we are forced to skip ACLs checks for the current user then return all permissions. */ @@ -452,7 +453,7 @@ class userinfo /* Get ldap object, for later filter checks */ - $ldap = $this->config->get_ldap_link(); + $ldap = $config->get_ldap_link(); $acl = array("r" => "", "w" => "", "c" => "", "d" => "", "m" => "", "a" => ""); @@ -465,7 +466,7 @@ class userinfo foreach ($path as $element) { /* Clean potential ACLs for each level */ - if (isset($this->config->idepartments[$cpath])) { + if (isset($config->idepartments[$cpath])) { $acl = $this->cleanACL($acl); } @@ -534,13 +535,13 @@ class userinfo */ if (strstr($object, "/0")) { $ocs = preg_replace("/\/0$/", "", $object); - if (isset($this->config->data['CATEGORIES'][$ocs])) { + if (isset($config->data['CATEGORIES'][$ocs])) { /* if $attribute is "", then check every single attribute for this object. if it is 0, then just check the object category ACL. */ if ($attribute == "") { - foreach ($this->config->data['CATEGORIES'][$ocs]['classes'] as $oc) { + foreach ($config->data['CATEGORIES'][$ocs]['classes'] as $oc) { if (isset($subacl['acl'][$ocs.'/'.$oc])) { // Skip ACLs wich are defined for ourselfs only - if not checking against ($ui->dn) if (isset($subacl['acl'][$ocs.'/'.$oc][0]) && @@ -573,7 +574,7 @@ class userinfo /* If the requested ACL is for a container object, then alter ACLs by applying cleanACL a last time. */ - if (isset($this->config->idepartments[$dn])) { + if (isset($config->idepartments[$dn])) { $acl = $this->cleanACL($acl); } @@ -609,11 +610,12 @@ class userinfo */ function get_module_departments($module, $skip_self_acls = FALSE ) { + global $config; /* If we are forced to skip ACLs checks for the current user then return all departments as valid. */ if ($this->ignore_acl_for_current_user()) { - return array_keys($this->config->idepartments); + return array_keys($config->idepartments); } /* Use cached results if possilbe */ @@ -647,11 +649,11 @@ class userinfo } } - if ($found && !isset($this->config->idepartments[$dn])) { - while (!isset($this->config->idepartments[$dn]) && strpos($dn, ",")) { + if ($found && !isset($config->idepartments[$dn])) { + while (!isset($config->idepartments[$dn]) && strpos($dn, ",")) { $dn = preg_replace("/^[^,]+,/", "", $dn); } - if (isset($this->config->idepartments[$dn])) { + if (isset($config->idepartments[$dn])) { $deps[$dn] = $dn; } } @@ -659,7 +661,7 @@ class userinfo } /* For all gosaDepartments */ - foreach ($this->config->departments as $dn) { + foreach ($config->departments as $dn) { if (isset($deps[$dn])) continue; $acl = ""; if (strpos($mod, '/')) { @@ -775,6 +777,7 @@ class userinfo */ function has_complete_category_acls($dn, $category) { + global $config; $acl = "rwcdm"; $types = "rwcdm"; @@ -783,8 +786,8 @@ class userinfo $acl = ""; } else { if (!isset($this->result_cache['has_complete_category_acls'][$dn][$category])) { - if (isset($this->config->data['CATEGORIES'][$category])) { - foreach ($this->config->data['CATEGORIES'][$category]['classes'] as $oc) { + if (isset($config->data['CATEGORIES'][$category])) { + foreach ($config->data['CATEGORIES'][$category]['classes'] as $oc) { /* Skip objectClass '0' (e.g. user/0) get_permissions will ever return '' ?? */ if ($oc == "0") continue; $tmp = $this->get_permissions($dn, $category."/".$oc); @@ -842,13 +845,14 @@ class userinfo */ function expired_status () { + global $config; // Skip this for the admin account, we do not want to lock him out. if ($this->is_user_admin()) { return 0; } - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); + $ldap = $config->get_ldap_link(); + $ldap->cd($config->current['BASE']); $ldap->cat($this->dn); $attrs = $ldap->fetch(); $current = floor(date("U") / 60 / 60 / 24); @@ -947,10 +951,11 @@ class userinfo */ function is_user_admin() { + global $config; if (empty($this->ACLperPath)) { $this->loadACL(); } - return ($this->get_permissions($this->config->current['BASE'], 'user/user') == 'rwcdm'); + return ($this->get_permissions($config->current['BASE'], 'user/user') == 'rwcdm'); } } ?> diff --git a/include/functions.inc b/include/functions.inc index 6caf93cb1fc0b26b4a49f53cab4bf8966159ecd5..d97c2ce9adc96791c1d2163267fa7fd60e76802e 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -1236,7 +1236,7 @@ function &get_smarty() * * \param string $dn the subject for the conversion * - * \param string $base the base dn, default: $this->config->current['BASE'] + * \param string $base the base dn, default: $config->current['BASE'] * * \return a string in the form as described above */ @@ -1273,7 +1273,7 @@ function convert_department_dn($dn, $base = NULL) * Example: * \code * # Determine LDAP base where systems are stored - * $base = get_ou('systemRDN') . $this->config->current['BASE']; + * $base = get_ou('systemRDN') . $config->current['BASE']; * $ldap->cd($base); * \endcode * diff --git a/include/password-methods/class_password-methods-clear.inc b/include/password-methods/class_password-methods-clear.inc index a08e960b6551654cf396b96ee178e5feb7a8c3ef..d3d1ef3e3814ce1224a211f69764132e0f14275c 100644 --- a/include/password-methods/class_password-methods-clear.inc +++ b/include/password-methods/class_password-methods-clear.inc @@ -35,10 +35,8 @@ class passwordMethodClear extends passwordMethod /*! * \brief passwordMethodClear Constructor - * - * \param string $config */ - function __construct($config) + function __construct() { } diff --git a/include/password-methods/class_password-methods-crypt.inc b/include/password-methods/class_password-methods-crypt.inc index de2172672bb609c134ca746821c9b7b06ab28c57..46664dc083543e702db37e3a867011e376cc7af1 100644 --- a/include/password-methods/class_password-methods-crypt.inc +++ b/include/password-methods/class_password-methods-crypt.inc @@ -34,10 +34,8 @@ class passwordMethodCrypt extends passwordMethod /*! * \brief passwordMethodCrypt Constructor - * - * \param string $config */ - function __construct($config) + function __construct() { } diff --git a/include/password-methods/class_password-methods-md5.inc b/include/password-methods/class_password-methods-md5.inc index 684aeb4b837c55652e8620d28302793103b34d08..2cfb254ce2048685e92a0434207a1d03b0886b32 100644 --- a/include/password-methods/class_password-methods-md5.inc +++ b/include/password-methods/class_password-methods-md5.inc @@ -34,10 +34,8 @@ class passwordMethodMd5 extends passwordMethod /*! * \brief passwordMethodMd5 Constructor - * - * \param string $config */ - function __construct($config) + function __construct() { } diff --git a/include/password-methods/class_password-methods-sasl.inc b/include/password-methods/class_password-methods-sasl.inc index 3f9cdd8e80f8d0e30aa281abf866f76725e056c1..aa9285a24d13c234c8f86419cd61767dfdccc599 100644 --- a/include/password-methods/class_password-methods-sasl.inc +++ b/include/password-methods/class_password-methods-sasl.inc @@ -35,12 +35,11 @@ class passwordMethodsasl extends passwordMethod { /*! * \brief passwordMethodsasl Constructor * - * \param string $config - * * \param string $dn The DN */ - function __construct($config, $dn = "") + function __construct($dn = "") { + global $config; $this->realm = trim($config->get_cfg_value('saslRealm', '')); $this->exop = trim($config->get_cfg_value('saslExop', '')); diff --git a/include/password-methods/class_password-methods-sha.inc b/include/password-methods/class_password-methods-sha.inc index f93dc3c646b0e8710b37fbf2249c089c71b5045e..ef46e5b3dd7b8ccf51dd6cbaffe03dc0e250bd01 100644 --- a/include/password-methods/class_password-methods-sha.inc +++ b/include/password-methods/class_password-methods-sha.inc @@ -33,10 +33,8 @@ class passwordMethodsha extends passwordMethod { /*! * \brief passwordMethodsha Constructor - * - * \param string $config */ - function __construct($config) + function __construct() { } diff --git a/include/password-methods/class_password-methods-smd5.inc b/include/password-methods/class_password-methods-smd5.inc index d7dc2d6652ee6893841d86babd28a1b780918280..64e2612bfbeedce3617493fbbacbb2e2d010c1e4 100644 --- a/include/password-methods/class_password-methods-smd5.inc +++ b/include/password-methods/class_password-methods-smd5.inc @@ -33,10 +33,8 @@ class passwordMethodsmd5 extends passwordMethod { /*! * \brief passwordMethodsmd5 Constructor - * - * \param string $config */ - function __construct($config) + function __construct() { } diff --git a/include/password-methods/class_password-methods-ssha.inc b/include/password-methods/class_password-methods-ssha.inc index 1e35de1e6bc3dd5bece96467b93399de53caf82d..0108c9d1a4f562c7e123acbddddcefefbec0fd28 100644 --- a/include/password-methods/class_password-methods-ssha.inc +++ b/include/password-methods/class_password-methods-ssha.inc @@ -33,10 +33,8 @@ class passwordMethodssha extends passwordMethod { /*! * \brief passwordMethodssha Constructor - * - * \param string $config */ - function __construct($config) + function __construct() { } diff --git a/include/password-methods/class_password-methods.inc b/include/password-methods/class_password-methods.inc index f7a394e88e58ef5c922763226757b936fadeb5c4..1531a89be75c089ad8b682ad64f67fa3b42887ff 100644 --- a/include/password-methods/class_password-methods.inc +++ b/include/password-methods/class_password-methods.inc @@ -30,7 +30,6 @@ */ class passwordMethod { - var $config = FALSE; var $attrs = array(); var $display = FALSE; var $hash = ""; @@ -39,11 +38,9 @@ class passwordMethod /*! * \brief Password method contructor * - * \param string $config - * * \param string $dn The DN */ - function __construct($config, $dn = "") + function __construct($dn = "") { } @@ -82,12 +79,11 @@ class passwordMethod /*! * \brief Is locked * - * \param string $config - * * \param string $dn The DN */ - function is_locked($config, $dn = "") + function is_locked($dn = "") { + global $config; if (!$this->lockable) { return FALSE; } @@ -114,30 +110,29 @@ class passwordMethod * sambaLMPassword: !EBD223B61F8C259AD3B435B51404EE * sambaNTPassword: !98BB35737013AAF181D0FE9FDA09E * - * \param string $config - * * \param string $dn */ - function lock_account($config, $dn = "") + function lock_account($dn = "") { - return $this->generic_modify_account($config, $dn, 'LOCK'); + return $this->generic_modify_account($dn, 'LOCK'); } /*! * \brief Unlocks an account which was locked by 'lock_account()'. * For details about the locking mechanism see 'lock_account()'. */ - function unlock_account($config, $dn = "") + function unlock_account($dn = "") { - return $this->generic_modify_account($config, $dn, 'UNLOCK'); + return $this->generic_modify_account($dn, 'UNLOCK'); } /*! * \brief Unlocks an account which was locked by 'lock_account()'. * For details about the locking mechanism see 'lock_account()'. */ - private function generic_modify_account($config, $dn, $mode) + private function generic_modify_account($dn, $mode) { + global $config; if (!$this->lockable) { return FALSE; } @@ -178,7 +173,7 @@ class passwordMethod lock_ssh_account($mode, $attrs, $modify); // (Un)lock the account by modifying the password hash. - $pwdClass = new user($config, $dn); + $pwdClass = new user(NULL, $dn); $pwdClass->callHook('PRE'.$mode, array(), $ret); if ($mode == 'LOCK') { @@ -217,7 +212,7 @@ class passwordMethod if (!session::is_set("passwordMethod::get_available_methods")) { foreach (array_keys($class_mapping) as $class) { if (preg_match('/passwordMethod/i', $class) && !preg_match("/^passwordMethod$/i", $class)) { - $test = new $class($config, ""); + $test = new $class(""); if ($test->is_available()) { $plugs = $test->get_hash_name(); if (!is_array($plugs)) { @@ -326,13 +321,13 @@ class passwordMethod foreach ($methods['class'] as $class) { $method = $class::_extract_method($class, $password_hash); if ($method != "") { - $test = new $class($config, $dn); + $test = new $class($dn); $test->set_hash($method); return $test; } } - $method = new passwordMethodClear($config, $dn); + $method = new passwordMethodClear($dn); $method->set_hash('clear'); return $method; } @@ -361,10 +356,8 @@ class passwordMethod */ static function make_hash($password, $hash) { - global $config; - $methods = passwordMethod::get_available_methods(); - $tmp = new $methods[$hash]($config); + $tmp = new $methods[$hash](); $tmp->set_hash($hash); return $tmp->generate_hash($password); } @@ -407,8 +400,6 @@ class passwordMethod */ static function is_harmless($password) { - global $config; - if ($config->get_cfg_value("strictPasswordRules") == "TRUE") { // Do we have UTF8 characters in the password? return ($password == utf8_decode($password)); @@ -419,11 +410,10 @@ class passwordMethod /*! * \brief Get the password proposal - * - * \param string $config */ - static function getPasswordProposal($config) + static function getPasswordProposal() { + global $config; if ($config->get_cfg_value('passwordProposalHook', '') != '') { $command = $config->get_cfg_value('passwordProposalHook', ''); if (check_command($command)) { diff --git a/include/select/groupSelect/class_groupSelect.inc b/include/select/groupSelect/class_groupSelect.inc index 6a45ca64063f8349004c39b3dfb094cda3a802cd..9821566ed1040d220b90b4be09db809dcffef0c0 100644 --- a/include/select/groupSelect/class_groupSelect.inc +++ b/include/select/groupSelect/class_groupSelect.inc @@ -23,11 +23,11 @@ class groupSelect extends simpleSelectManagement protected $objectTypes = array('group'); protected $autoFilter = FALSE; - function __construct($config, $ui) + function __construct($unused, $ui) { $this->filterXMLPath = get_template_path('group-filter.xml', TRUE, dirname(__FILE__)); - parent::__construct($config, $ui); + parent::__construct($unused, $ui); } } ?> diff --git a/include/simpleplugin/class_attribute.inc b/include/simpleplugin/class_attribute.inc index 9fb40ed45ae59e2ea9b437cb18bc9d5b66463e6c..80f25b74b003e73d1f497d1224fc8189c35283ca 100644 --- a/include/simpleplugin/class_attribute.inc +++ b/include/simpleplugin/class_attribute.inc @@ -421,6 +421,7 @@ class Attribute */ function check () { + global $config; $value = $this->getValue(); if ($this->isRequired() && !$this->disabled && (($value === "") || ($value === array()))) { return msgPool::required($this->getLabel()); @@ -429,8 +430,8 @@ class Attribute if (($value === "") || ($value === array())) { return; } - $ldap = $this->plugin->config->get_ldap_link(); - $base = $this->plugin->config->current['BASE']; + $ldap = $config->get_ldap_link(); + $base = $config->current['BASE']; if ($this->unique !== 'whole') { if (isset($this->plugin->base) && !empty($this->plugin->base)) { $base = $this->plugin->base; @@ -507,7 +508,7 @@ class Attribute break; } } - if (!in_array($dn_base, $this->plugin->config->departments)) { + if (!in_array($dn_base, $config->departments)) { continue; } } @@ -2882,9 +2883,10 @@ class SubNodesAttribute extends OrderedArrayAttribute protected function loadAttrValue ($attrs) { + global $config; /* Should we take dn from attrs or plugin? */ if (isset($attrs['dn'])) { - $ldap = $this->plugin->config->get_ldap_link(); + $ldap = $config->get_ldap_link(); $ldap->ls('objectClass='.$this->objectClass, $attrs['dn']); $this->value = array(); while ($subattrs = $ldap->fetch()) { diff --git a/include/simpleplugin/class_dialogAttributes.inc b/include/simpleplugin/class_dialogAttributes.inc index eedfeeb43aa4b1358980153c676d3b02809be5eb..194c165439acffa0c1da5e9b7001761229206b73 100644 --- a/include/simpleplugin/class_dialogAttributes.inc +++ b/include/simpleplugin/class_dialogAttributes.inc @@ -30,7 +30,7 @@ class GenericDialog function __construct($simplePlugin, &$attribute) { $this->attribute = $attribute; - $this->dialog = new $this->dialogClass($simplePlugin->config, get_userinfo()); + $this->dialog = new $this->dialogClass(NULL, get_userinfo()); } function execute () @@ -348,13 +348,14 @@ class GenericDialogAttribute extends DialogAttribute protected function fillDisplayValue ($i) { - $ldap = $this->plugin->config->get_ldap_link(); + global $config; + $ldap = $config->get_ldap_link(); $value = $this->value[$i]; if ($this->store_attr == 'dn') { $ldap->cat($value, $this->ldapAttributesToGet()); } else { - $ldap->cd($this->plugin->config->current['BASE']); + $ldap->cd($config->current['BASE']); $ldap->search('('.$this->store_attr.'='.ldap_escape_f($value).')', $this->ldapAttributesToGet()); } $this->fillDisplayValueFrom($i, $ldap->fetch()); @@ -671,10 +672,11 @@ class UserAttribute extends DialogButtonAttribute protected function loadAttrValue ($attrs) { + global $config; parent::loadAttrValue($attrs); $dn = $this->getValue(); if ($dn != '') { - $ldap = $this->plugin->config->get_ldap_link(); + $ldap = $config->get_ldap_link(); $ldap->cat($dn); if ($attrs = $ldap->fetch()) { $this->handleDialogResult($dn, $attrs); @@ -701,7 +703,7 @@ class GenericSimplePluginDialog extends GenericDialog function __construct($simplePlugin, &$attribute, $value = array()) { $this->attribute = $attribute; - $this->dialog = new $this->dialogClass($simplePlugin->config, 'new'); + $this->dialog = new $this->dialogClass(NULL, 'new'); $base = $simplePlugin->dn; if ($base == 'new') { diff --git a/include/simpleplugin/class_multiPlugin.inc b/include/simpleplugin/class_multiPlugin.inc index f119a188f1556c35fdb6cc07add9b70a9efcff5c..db93dbd18369fef2fa43b1b8291cf9de2d6c446c 100644 --- a/include/simpleplugin/class_multiPlugin.inc +++ b/include/simpleplugin/class_multiPlugin.inc @@ -37,9 +37,10 @@ class multiPlugin extends simplePlugin return array(); } - function __construct (&$config, $dn = NULL, $parent = NULL) + function __construct ($unused = NULL, $dn = NULL, $parent = NULL) { - parent::__construct($config, $dn, $parent); + global $config; + parent::__construct($unused, $dn, $parent); $plInfos = pluglist::pluginInfos(get_class($this)); @@ -49,7 +50,7 @@ class multiPlugin extends simplePlugin continue; } $name = $plug['CLASS']; - $this->plugin[$name] = new $name($config, $dn, $parent); + $this->plugin[$name] = new $name($unused, $dn, $parent); /* Acl base && category configuration, these settings will be overloaded in main.inc, diff --git a/include/simpleplugin/class_simpleManagement.inc b/include/simpleplugin/class_simpleManagement.inc index 638ae57aac7bd6bb47609cd96fd131db3dcff23c..c242b01f1f38a3947f08920ffcc301005323e848 100644 --- a/include/simpleplugin/class_simpleManagement.inc +++ b/include/simpleplugin/class_simpleManagement.inc @@ -140,9 +140,9 @@ class simpleManagement extends management protected $skipTemplates = TRUE; - function __construct($config, $ui) + function __construct($unused, $ui) { - $this->config = $config; + global $config; $this->ui = $ui; if ($this->filterXMLPath === NULL) { @@ -188,12 +188,12 @@ class simpleManagement extends management $headpage = new $this->headpageClass($this->parseXML($this->listXMLPath)); $headpage->setFilter($filter); - parent::__construct($config, $ui, 'unused', $headpage); + parent::__construct(NULL, $ui, 'unused', $headpage); $this->configureHeadpage(); $this->configureFilter(); if ($this->baseMode === FALSE) { - $this->headpage->setBase($this->config->current['BASE']); + $this->headpage->setBase($config->current['BASE']); } } @@ -393,12 +393,13 @@ class simpleManagement extends management function renderList() { + global $config; $smarty = get_smarty(); $filters = array(); foreach ($this->objectTypes as $object) { $filters[] = array( 'id' => 'FILTER'.$object, - 'label' => sprintf(_('Show %s'), $this->config->data['OBJECTS'][$object]['name']) + 'label' => sprintf(_('Show %s'), $config->data['OBJECTS'][$object]['name']) ); } if (!$this->skipTemplates) { @@ -734,6 +735,7 @@ class simpleManagement extends management */ function createSnapshotDialog($action = '', $target = array(), $all = array()) { + global $config; @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $target, 'Snaptshot creation initiated!'); if (count($target) == 1) { @@ -741,9 +743,9 @@ class simpleManagement extends management if (empty($this->dn)) { return; } - $aclCategory = $this->config->data['OBJECTS'][$this->getType($this->dn)]['aclCategory']; + $aclCategory = $config->data['OBJECTS'][$this->getType($this->dn)]['aclCategory']; if ($this->ui->allow_snapshot_create($this->dn, $aclCategory)) { - $this->dialogObject = new SnapshotCreateDialog($this->config, $this->dn, $this, $aclCategory); + $this->dialogObject = new SnapshotCreateDialog(NULL, $this->dn, $this, $aclCategory); $this->dialogObject->set_acl_base($this->dn); } else { msg_dialog::display(_('Permission'), sprintf(_('You are not allowed to create a snapshot for %s.'), $this->dn), @@ -764,6 +766,7 @@ class simpleManagement extends management */ function restoreSnapshotDialog($action = '', $target = array(), $all = array()) { + global $config; // Set current restore base for snapshot handling. if (is_object($this->snapHandler)) { $bases = array(); @@ -787,13 +790,13 @@ class simpleManagement extends management if (empty($this->dn)) { return; } - $aclCategory = $this->config->data['OBJECTS'][$this->getType($this->dn)]['aclCategory']; + $aclCategory = $config->data['OBJECTS'][$this->getType($this->dn)]['aclCategory']; } if ($this->ui->allow_snapshot_restore($this->dn, $aclCategory)) { @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->dn, 'Snaptshot restoring initiated!'); $this->snapHandler->setSnapshotBases($bases); - $this->dialogObject = new SnapshotRestoreDialog($this->config, $this->dn, $this, !count($target), $aclCategory); + $this->dialogObject = new SnapshotRestoreDialog(NULL, $this->dn, $this, !count($target), $aclCategory); $this->dialogObject->set_acl_base($this->dn); } else { msg_dialog::display(_('Permission'), sprintf(_('You are not allowed to restore a snapshot for %s.'), $this->dn), @@ -893,7 +896,7 @@ class simpleManagement extends management } else { if (!session::is_set($classname) || (isset($_GET['reset']) && $_GET['reset'] == 1)) { /* Create the object if missing or reset requested */ - $managementObject = new $classname($config, $ui); + $managementObject = new $classname(NULL, $ui); } else { /* Retrieve the object from session */ $managementObject = session::get($classname); diff --git a/include/simpleplugin/class_simplePlugin.inc b/include/simpleplugin/class_simplePlugin.inc index 4c69df18b0132761ac996f4372d83e362e09e656..b395ae34ef58bb60bd9ac4805dd2860958451993 100644 --- a/include/simpleplugin/class_simplePlugin.inc +++ b/include/simpleplugin/class_simplePlugin.inc @@ -73,14 +73,14 @@ class simplePlugin extends plugin /*! \brief constructor * - * \param mixed $config The config object * \param string $dn The dn of this instance * \param Object $object An object to copy values from * \param array $attributesInfo An attributesInfo array, if NULL, getAttributesInfo will be used. * */ - function __construct (&$config, $dn = NULL, $object = NULL, $attributesInfo = NULL) + function __construct ($unused = NULL, $dn = NULL, $object = NULL, $attributesInfo = NULL) { + global $config; if ($attributesInfo === NULL) { $attributesInfo = $this->getAttributesInfo(); } @@ -115,7 +115,7 @@ class simplePlugin extends plugin } // We call plugin constructor - parent::__construct($config, $dn, $object); + parent::__construct($unused, $dn, $object); $this->setTemplate($this->is_template); @@ -133,8 +133,8 @@ class simplePlugin extends plugin if (is_array($this->inheritance)) { /* Check group membership */ - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); + $ldap = $config->get_ldap_link(); + $ldap->cd($config->current['BASE']); foreach ($this->inheritance as $oc => $at) { if ($this->mainTab) { $filter = '(&(objectClass='.$oc.')('.$at.'='.ldap_escape_f($this->dn).'))'; @@ -469,7 +469,7 @@ class simplePlugin extends plugin $class = get_class($this); $attrsWrapper = new stdClass(); $attrsWrapper->attrs = $this->group_attrs; - $group = new $class($this->config, $this->group_attrs['dn'], $attrsWrapper); + $group = new $class(NULL, $this->group_attrs['dn'], $attrsWrapper); $smarty = get_smarty(); $group->renderAttributes(TRUE); @@ -524,11 +524,12 @@ class simplePlugin extends plugin /* Remove FusionDirectory attributes */ protected function prepare_remove () { + global $config; $this->attrs = array(); if (!$this->mainTab) { /* include global link_info */ - $ldap = $this->config->get_ldap_link(); + $ldap = $config->get_ldap_link(); /* Get current objectClasses in order to add the required ones */ $ldap->cat($this->dn); @@ -565,7 +566,8 @@ class simplePlugin extends plugin protected function ldap_remove () { - $ldap = $this->config->get_ldap_link(); + global $config; + $ldap = $config->get_ldap_link(); if ($this->mainTab) { $ldap->rmdir_recursive($this->dn); } else { @@ -666,15 +668,16 @@ class simplePlugin extends plugin protected function ldap_save ($cleanup = TRUE) { + global $config; /* Check if this is a new entry ... add/modify */ - $ldap = $this->config->get_ldap_link(); + $ldap = $config->get_ldap_link(); $ldap->cat($this->dn, array("objectClass")); if ($this->mainTab && !$this->initially_was_account) { if ($ldap->count()) { msg_dialog::display(_("Error when saving"), sprintf(_('There is already an entry with the same dn : %s'), $this->dn), ERROR_DIALOG); return; } - $ldap->cd($this->config->current['BASE']); + $ldap->cd($config->current['BASE']); $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn)); $action = "add"; } else { @@ -837,7 +840,7 @@ class simplePlugin extends plugin unset($obj); } } else { - $account = new $classname($config, $entry_dn); + $account = new $classname(NULL, $entry_dn); $account->set_acl_category($plCategory); if ($edit_mode) { $account->setNeedEditMode(TRUE); diff --git a/include/simpleplugin/class_simpleSelectManagement.inc b/include/simpleplugin/class_simpleSelectManagement.inc index 1d415fefeef3bfcf4ae209e7f4989b5cf813e798..1e21108712bae7d04e19eeff9f823b8085c77d1d 100644 --- a/include/simpleplugin/class_simpleSelectManagement.inc +++ b/include/simpleplugin/class_simpleSelectManagement.inc @@ -29,13 +29,13 @@ class simpleSelectManagement extends simpleManagement protected $departmentRootVisible = FALSE; - function __construct($config, $ui) + function __construct($unused, $ui) { if ($this->listXMLPath === NULL) { $this->listXMLPath = get_template_path('simple-select-list.xml', TRUE, dirname(__FILE__)); } - parent::__construct($config, $ui); + parent::__construct($unused, $ui); } /* Build the action menu, fill the object definition, etc, based on objectTypes info */ diff --git a/include/simpleplugin/class_simpleService.inc b/include/simpleplugin/class_simpleService.inc index 32d80f551411b8d0fdc4ca5c14fadc7ef8c60e31..044325e0f0a4c9024232146c1124040c22a8a1ab 100644 --- a/include/simpleplugin/class_simpleService.inc +++ b/include/simpleplugin/class_simpleService.inc @@ -35,15 +35,14 @@ class simpleService extends simplePlugin { /*! \brief constructor * - * \param mixed $config The config object * \param string $dn The dn of this instance * \param Object $object An object to copy values from * \param array $attributesInfo An attributesInfo array, if NULL, getAttributesInfo will be used. * */ - function __construct(&$config, $dn, $object = NULL, $attributesInfo = NULL) + function __construct($unused, $dn, $object = NULL, $attributesInfo = NULL) { - parent::__construct($config, $dn, $object, $attributesInfo); + parent::__construct($unused, $dn, $object, $attributesInfo); $plInfos = pluglist::pluginInfos(get_class($this)); $this->DisplayName = $plInfos['plShortName']; $this->parent = $object; /* $object is the instance of serverService in this case */ diff --git a/include/simpleplugin/class_simpleTabs.inc b/include/simpleplugin/class_simpleTabs.inc index d63b441dbb19570a0be0c610c0b8f9c8b9baca6f..7cde64cbcc9ae9d334ff3e5ca2646636193b9a79 100644 --- a/include/simpleplugin/class_simpleTabs.inc +++ b/include/simpleplugin/class_simpleTabs.inc @@ -30,7 +30,6 @@ class simpleTabs { var $dn; - var $config; var $acl; var $is_template; @@ -53,7 +52,7 @@ class simpleTabs /*! * \brief Tabs classes constructor * - * You should either call __construct($type, $dn, [$copied_object]) or (deprecated) __construct($config, $data, $dn, $category, [$copied_object]) + * You should either call __construct($type, $dn, [$copied_object]) or (deprecated) __construct(NULL, $data, $dn, $category, [$copied_object]) * */ function __construct() { @@ -83,7 +82,6 @@ class simpleTabs /* Save dn */ $this->dn = $dn; - $this->config = &$config; if (!count($data)) { $data[] = array("CLASS" => 'plugin',"NAME" => 'Error'); @@ -102,11 +100,11 @@ class simpleTabs $this->by_name[$tab['CLASS']] = $tab['NAME']; if ($baseobject === NULL) { - $baseobject = new $tab['CLASS']($this->config, $this->dn, $attrs_object); + $baseobject = new $tab['CLASS'](NULL, $this->dn, $attrs_object); $this->by_object[$tab['CLASS']] = $baseobject; $this->baseclass = $tab['CLASS']; } else { - $this->by_object[$tab['CLASS']] = new $tab['CLASS']($this->config, $this->dn, $baseobject); + $this->by_object[$tab['CLASS']] = new $tab['CLASS'](NULL, $this->dn, $baseobject); } $this->read_only |= $this->by_object[$tab['CLASS']]->read_only; @@ -147,10 +145,10 @@ class simpleTabs continue; } if ($baseobject === NULL) { - $baseobject = new $class($this->config, $this->dn); + $baseobject = new $class(NULL, $this->dn); $this->by_object[$name] = $baseobject; } else { - $this->by_object[$name] = new $class($this->config, $this->dn, $baseobject); + $this->by_object[$name] = new $class(NULL, $this->dn, $baseobject); } $this->by_object[$name]->parent = &$this; $this->by_object[$name]->set_acl_category($this->acl_category); @@ -453,19 +451,18 @@ class simpleTabs */ function addSpecialTabs() { - $data = $this->config->data['TABS']['SPECIALTABS']; + global $config; $baseobject = $this->getBaseObject(); - foreach ($data as &$tab) { + foreach ($config->data['TABS']['SPECIALTABS'] as $tab) { if (!plugin_available($tab['CLASS'])) { continue; } $this->by_name[$tab['CLASS']] = $tab['NAME']; - $this->by_object[$tab['CLASS']] = new $tab['CLASS']($this->config, $this->dn, $baseobject); + $this->by_object[$tab['CLASS']] = new $tab['CLASS'](NULL, $this->dn, $baseobject); $this->by_object[$tab['CLASS']]->parent = &$this; $this->by_object[$tab['CLASS']]->set_acl_category($this->acl_category); } - unset($tab); } /*! diff --git a/plugins/addons/dashboard/class_dashBoard.inc b/plugins/addons/dashboard/class_dashBoard.inc index 65e380ededc83504e8f1b04e78fd71f7b2e36eb5..28e4b6e2d052e5d4b8d41fe2b25ba2b2699d696a 100644 --- a/plugins/addons/dashboard/class_dashBoard.inc +++ b/plugins/addons/dashboard/class_dashBoard.inc @@ -3,17 +3,17 @@ This code is part of FusionDirectory (http://www.fusiondirectory.org) Copyright (C) 2010 Antoine Gallavardin Copyright (C) 2011-2016 FusionDirectory project - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. @@ -52,9 +52,9 @@ class dashboard extends simplePlugin ); } - function __construct(&$config, $dn = NULL, $object = NULL) + function __construct($unused, $dn = NULL, $object = NULL) { - parent::__construct($config, $dn, $object); + parent::__construct($unused, $dn, $object); $this->stats = $this->overview_stats(); } @@ -62,8 +62,9 @@ class dashboard extends simplePlugin /* Compute some statistics */ function overview_stats() { + global $config; $stats = array(); - foreach ($this->config->data['OBJECTS'] as $type => $infos) { + foreach ($config->data['OBJECTS'] as $type => $infos) { try { $nb = objects::count($type); } catch (Exception $e) { @@ -89,7 +90,7 @@ class dashboard extends simplePlugin if (is_array($section)) { $section = key($section); } - $node['priority'] = $this->config->data['SECTIONS'][$section]['PRIORITY'] * 100 + $pInfos['plPriority']; + $node['priority'] = $config->data['SECTIONS'][$section]['PRIORITY'] * 100 + $pInfos['plPriority']; } else { $node['priority'] = 10000; } diff --git a/plugins/addons/dashboard/class_dashBoardUsers.inc b/plugins/addons/dashboard/class_dashBoardUsers.inc index b659948500a63c7087f466b6c43d22f339c12746..c8e6c2b2f628600a5f04949e7f53c6ba613da4a7 100644 --- a/plugins/addons/dashboard/class_dashBoardUsers.inc +++ b/plugins/addons/dashboard/class_dashBoardUsers.inc @@ -53,9 +53,9 @@ class dashboardUsers extends simplePlugin ); } - function __construct(&$config, $dn = NULL, $object = NULL) + function __construct($unused, $dn = NULL, $object = NULL) { - parent::__construct($config, $dn, $object); + parent::__construct($unused, $dn, $object); $this->users_stats = $this->computeUsersStats(); $this->groups_stats = $this->computeGroupsStats(); @@ -64,9 +64,10 @@ class dashboardUsers extends simplePlugin function computeUsersStats () { + global $config; /* User statistics */ - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); + $ldap = $config->get_ldap_link(); + $ldap->cd($config->current['BASE']); $ldap->search('(objectClass=inetOrgPerson)', array('userPassword')); $nb_accounts = $ldap->count(); $nb_locked_accounts = 0; @@ -98,9 +99,10 @@ class dashboardUsers extends simplePlugin function computeGroupsStats () { + global $config; /* Group statistics */ - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); + $ldap = $config->get_ldap_link(); + $ldap->cd($config->current['BASE']); $ldap->search('(objectClass=posixGroup)', array('cn')); $nb = $ldap->count(); $ldap->search('(&(objectClass=posixGroup)(objectClass=fdGroupMail))', array('cn')); @@ -120,6 +122,7 @@ class dashboardUsers extends simplePlugin function expired_accounts_info () { + global $config; /* * Begin of code for selecting expired account */ @@ -128,12 +131,12 @@ class dashboardUsers extends simplePlugin $today = floor(time() / 86400); // 24 * 60 * 60 /* Fetch global value from fusiondirectory.conf */ - $next_expired_days = $this->config->get_cfg_value('dashboardExpiredAccountsDays', 15); + $next_expired_days = $config->get_cfg_value('dashboardExpiredAccountsDays', 15); $next_expired_date = ($today + $next_expired_days); /* search all account with all date, mail, telephone */ - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); + $ldap = $config->get_ldap_link(); + $ldap->cd($config->current['BASE']); $ldap->search( '(shadowExpire=*)', array('uid','shadowExpire','mail','telephoneNumber','cn','manager') diff --git a/plugins/admin/acl/class_aclAssignment.inc b/plugins/admin/acl/class_aclAssignment.inc index c8db81f287f0044cd5968e5175bad7914965b4d7..033c27ada6c24b661d543ad0d918bd47bafccb63 100644 --- a/plugins/admin/acl/class_aclAssignment.inc +++ b/plugins/admin/acl/class_aclAssignment.inc @@ -63,9 +63,9 @@ class aclAssignmentDialogWindow extends simplePlugin ); } - function __construct (&$config, $value, $isContainer = FALSE) + function __construct ($unused, $value, $isContainer = FALSE) { - parent::__construct($config); + parent::__construct($unused); if ($isContainer) { $this->attributesAccess['aclMode']->setDefaultValue('subtree'); } else { @@ -144,7 +144,7 @@ class ACLsAssignmentDialog extends GenericDialog $isContainer = TRUE; } $this->attribute = $attribute; - $this->dialog = new $this->dialogClass($simplePlugin->config, $acl, $isContainer); + $this->dialog = new $this->dialogClass(NULL, $acl, $isContainer); $this->dialog->set_acl_base($simplePlugin->acl_base); $this->initialAclValue = $acl; } @@ -292,9 +292,9 @@ class aclAssignment extends simplePlugin ); } - function __construct (&$config, $dn = NULL, $object = NULL, $attributesInfo = NULL) + function __construct ($unused, $dn = NULL, $object = NULL, $attributesInfo = NULL) { - parent::__construct ($config, $dn, $object); + parent::__construct ($unused, $dn, $object); $this->attributesInfo['main']['name'] = sprintf(_('Assignments on object or subtree %s'), $this->dn); } diff --git a/plugins/admin/acl/class_aclManagement.inc b/plugins/admin/acl/class_aclManagement.inc index 6fde38069ed1c0ac5503bec6dad289059f2872e5..dcab284e87a6042412ec64e4d9ce2568d78307ab 100644 --- a/plugins/admin/acl/class_aclManagement.inc +++ b/plugins/admin/acl/class_aclManagement.inc @@ -63,7 +63,7 @@ class aclAssignmentCreationDialog extends simplePlugin $this->simpleManagement = $parent; - parent::__construct($config, $config->current['BASE']); + parent::__construct(NULL, $config->current['BASE']); $this->attributesAccess['baseDn']->setInLdap(FALSE); } diff --git a/plugins/admin/aclrole/class_aclRole.inc b/plugins/admin/aclrole/class_aclRole.inc index 87dcd338005ac6cd644dfb0c606e33ea392790d8..eeaa46d86f5579816c277835c39126e705df71fc 100644 --- a/plugins/admin/aclrole/class_aclRole.inc +++ b/plugins/admin/aclrole/class_aclRole.inc @@ -120,9 +120,9 @@ class aclRole extends simplePlugin ); } - function __construct (&$config, $dn = NULL, $object = NULL) + function __construct ($unused, $dn = NULL, $object = NULL) { - parent::__construct($config, $dn, $object); + parent::__construct($unused, $dn, $object); $this->attributesAccess['cn']->setUnique(TRUE); } diff --git a/plugins/admin/departments/class_department.inc b/plugins/admin/departments/class_department.inc index 5eb0aa8fe9e6622e3f9ecdfe904b7f57cc1e1528..e391d218cd8603bb5569906efae0342d29d535d1 100644 --- a/plugins/admin/departments/class_department.inc +++ b/plugins/admin/departments/class_department.inc @@ -120,8 +120,9 @@ class department extends simplePlugin return $attributesInfo; } - function __construct (&$config, $dn = NULL, $object = NULL) + function __construct ($unused, $dn = NULL, $object = NULL) { + global $config; /* Add the default structural object class if this is a new entry */ $ldap = $config->get_ldap_link(); $ldap->cd($config->current['BASE']); @@ -142,9 +143,9 @@ class department extends simplePlugin } $this->objectclasses = array_unique($this->objectclasses); - parent::__construct($config, $dn, $object); + parent::__construct($unused, $dn, $object); - $categoriesList = $this->config->get_cfg_value('DepartmentCategories', array()); + $categoriesList = $config->get_cfg_value('DepartmentCategories', array()); /* Insert current value to possibilities */ if (isset($this->attributesAccess['businessCategory'])) { @@ -204,7 +205,7 @@ class department extends simplePlugin /* Hide base selector, if this object represents the base itself $smarty->assign("is_root_dse", FALSE); - if ($this->dn == $this->config->current['BASE']) { + if ($this->dn == $config->current['BASE']) { $smarty->assign("is_root_dse", TRUE); $nA = $this->namingAttr."ACL"; $smarty->assign($nA, $this->getacl($this->namingAttr, TRUE)); diff --git a/plugins/admin/departments/class_departmentManagement.inc b/plugins/admin/departments/class_departmentManagement.inc index 0f2bb926ff97a151dfe3882553eda0a1ca5cb868..df895e3f7886435d6f8aff285702dde2503a4c14 100644 --- a/plugins/admin/departments/class_departmentManagement.inc +++ b/plugins/admin/departments/class_departmentManagement.inc @@ -43,11 +43,11 @@ class departmentManagement extends simpleManagement ); } - function __construct($config, $ui) + function __construct($unused, $ui) { $this->objectTypes = self::getDepartmentTypes(); $this->listXMLPath = get_template_path('dep-list.xml', TRUE, dirname(__FILE__)); - parent::__construct($config, $ui); + parent::__construct($unused, $ui); $this->headpage->registerElementFilter("depLabel", "departmentManagement::filterDepLabel"); $this->registerAction("open", "openEntry"); } @@ -68,7 +68,6 @@ class departmentManagement extends simpleManagement global $config, $ui; $config->get_departments(); $config->make_idepartments(); - $this->config = $config; $ui->reset_acl_cache(); $headpage = $this->getHeadpage(); $headpage->refreshBasesList(); @@ -84,7 +83,8 @@ class departmentManagement extends simpleManagement // Overridden remove request method - Avoid removal of the ldap base. protected function removeEntryRequested($action = "", $target = array(), $all = array()) { - $target = array_remove_entries(array($this->config->current['BASE']), $target); + global $config; + $target = array_remove_entries(array($config->current['BASE']), $target); return parent::removeEntryRequested($action, $target, $all); } diff --git a/plugins/admin/departments/main.inc b/plugins/admin/departments/main.inc index d295808bb8aaaed91998423d8431711ed14d085c..0ea863940f748cb41004dd0812f374ad991fa543 100644 --- a/plugins/admin/departments/main.inc +++ b/plugins/admin/departments/main.inc @@ -40,7 +40,7 @@ if ( $cleanup ){ /* Create usermanagement object on demand */ if (!session::is_set('departmentManagement')){ - $departmentManagement= new departmentManagement ($config, $ui); + $departmentManagement = new departmentManagement (NULL, $ui); session::set('departmentManagement',$departmentManagement); } $departmentManagement = session::get('departmentManagement'); diff --git a/plugins/admin/groups/class_group.inc b/plugins/admin/groups/class_group.inc index f3ff0a625d1618181b27cc73eed3ba0878818dbf..c2a7aa21a12668691e30764883a440d8de954639 100644 --- a/plugins/admin/groups/class_group.inc +++ b/plugins/admin/groups/class_group.inc @@ -107,9 +107,9 @@ class group extends simplePlugin ); } - function __construct (&$config, $dn = NULL, $object = NULL) + function __construct ($unused, $dn = NULL, $object = NULL) { - parent::__construct($config, $dn, $object); + parent::__construct($unused, $dn, $object); $this->attributesAccess['trustMode']->setInLdap(FALSE); $this->attributesAccess['trustMode']->setManagedAttributes( @@ -141,12 +141,13 @@ class group extends simplePlugin function check() { + global $config; $message = parent::check(); /* Check ID's if they are forced by user */ if ($this->force_id) { - if ($this->gidNumber < $this->config->get_cfg_value("minId")) { - $message[] = msgPool::toosmall(_("GID"), $this->config->get_cfg_value("minId")); + if ($this->gidNumber < $config->get_cfg_value("minId")) { + $message[] = msgPool::toosmall(_("GID"), $config->get_cfg_value("minId")); } } diff --git a/plugins/admin/groups/class_groupManagement.inc b/plugins/admin/groups/class_groupManagement.inc index f6efd98fab46c204ae6f8140af1e94c39bc8181c..db31ef92b6ffbb584e099e5e7ab5b9df997276ce 100644 --- a/plugins/admin/groups/class_groupManagement.inc +++ b/plugins/admin/groups/class_groupManagement.inc @@ -40,12 +40,12 @@ class groupManagement extends simpleManagement ); } - function __construct($config, $ui) + function __construct($unused, $ui) { $this->filterXMLPath = get_template_path('group-filter.xml', TRUE, dirname(__FILE__)); $this->listXMLPath = get_template_path('group-list.xml', TRUE, dirname(__FILE__)); - parent::__construct($config, $ui); + parent::__construct($unused, $ui); $this->headpage->registerElementFilter('filterProperties', 'groupManagement::filterProperties'); } @@ -79,7 +79,7 @@ class groupManagement extends simpleManagement if (class_available($plug['CLASS'])) { $name = $plug['CLASS']; - $grouptabs[$name] = new $name($config, $dn); + $grouptabs[$name] = new $name(NULL, $dn); } } } diff --git a/plugins/admin/groups/class_ogroup.inc b/plugins/admin/groups/class_ogroup.inc index 04c633e94f4582d5f29fe62977a7c5ef681980a9..ec73193979cfcf485abbe96f2cd194bcf9e7a2b1 100644 --- a/plugins/admin/groups/class_ogroup.inc +++ b/plugins/admin/groups/class_ogroup.inc @@ -229,9 +229,10 @@ class ogroup extends simplePlugin ); } - function __construct (&$config, $dn = NULL, $object = NULL) + function __construct ($unused, $dn = NULL, $object = NULL) { - parent::__construct($config, $dn, $object); + global $config; + parent::__construct($unused, $dn, $object); $this->attributesAccess['trustMode']->setInLdap(FALSE); $this->attributesAccess['trustMode']->setManagedAttributes( @@ -251,7 +252,7 @@ class ogroup extends simplePlugin /* Detect all workstations, which are already assigned to an object group - Those objects will be hidden in the add object dialog. - Check() will complain if such a system is assigned to this object group.*/ - $base = $this->config->current['BASE']; + $base = $config->current['BASE']; $res = get_list("(|(objectClass=gotoWorkstation)(objectClass=gotoTerminal))", "none", $base, array("dn"), GL_NO_ACL_CHECK | GL_SUBSEARCH); $ws_dns = array(); diff --git a/plugins/admin/groups/class_roleGeneric.inc b/plugins/admin/groups/class_roleGeneric.inc index e559de0b76aa86f07c3c1f0bd6a528938298395b..ebf8189a05fd1328e1271d7161ca40cff1a0053b 100644 --- a/plugins/admin/groups/class_roleGeneric.inc +++ b/plugins/admin/groups/class_roleGeneric.inc @@ -113,9 +113,9 @@ class roleGeneric extends simplePlugin /*! * \brief Constructor */ - function __construct(&$config, $dn = NULL, $object = NULL) + function __construct($unused, $dn = NULL, $object = NULL) { - parent::__construct($config, $dn, $object); + parent::__construct($unused, $dn, $object); $this->attributesAccess['cn']->setUnique(TRUE); } } diff --git a/plugins/admin/groups/tabs_ogroups.inc b/plugins/admin/groups/tabs_ogroups.inc index af5f24f52f773e5529d7ceeb598bbe592939d28e..91481464f05b77972f2a4cd16a80ba8bde61a7a1 100644 --- a/plugins/admin/groups/tabs_ogroups.inc +++ b/plugins/admin/groups/tabs_ogroups.inc @@ -41,8 +41,8 @@ class ogrouptabs extends simpleTabs_noSpecial $tabs = array(); if (strlen($objects)) { - if (isset($this->config->data['TABS']['OGROUP-DYNAMICTABS'])) { - $dtabs = $this->config->data['TABS']['OGROUP-DYNAMICTABS']; + if (isset($config->data['TABS']['OGROUP-DYNAMICTABS'])) { + $dtabs = $config->data['TABS']['OGROUP-DYNAMICTABS']; } else { $dtabs = array(); } @@ -53,20 +53,20 @@ class ogrouptabs extends simpleTabs_noSpecial } $otype = ogroup::$objectTypes[$objects[$i]]; $otabs = array(); - if (isset($this->config->data['TABS'][strtoupper($otype).'TABS'])) { + if (isset($config->data['TABS'][strtoupper($otype).'TABS'])) { $otabs = array_uintersect( $dtabs, - $this->config->data['TABS'][strtoupper($otype).'TABS'], + $config->data['TABS'][strtoupper($otype).'TABS'], function ($a, $b) { return strcmp($a['CLASS'], $b['CLASS']); } ); } - if (isset($this->config->data['TABS']['OGROUP-'.strtoupper($otype).'TABS'])) { + if (isset($config->data['TABS']['OGROUP-'.strtoupper($otype).'TABS'])) { $otabs = array_merge( $otabs, - $this->config->data['TABS']['OGROUP-'.strtoupper($otype).'TABS'] + $config->data['TABS']['OGROUP-'.strtoupper($otype).'TABS'] ); } if ($tabs === FALSE) { @@ -83,7 +83,7 @@ class ogrouptabs extends simpleTabs_noSpecial } } } - $tabs = array_merge($this->config->data['TABS']['OGROUPTABS'], (array)$tabs); + $tabs = array_merge($config->data['TABS']['OGROUPTABS'], (array)$tabs); $tabs = array_map( function ($a) { @@ -114,7 +114,7 @@ class ogrouptabs extends simpleTabs_noSpecial $this->by_object["$class"] = $this->removed_tabs["$class"]; unset($this->removed_tabs["$class"]); } else { - $this->by_object["$class"] = new $class($this->config, $this->dn, $this->getBaseObject()); + $this->by_object["$class"] = new $class(NULL, $this->dn, $this->getBaseObject()); $this->by_object["$class"]->parent = &$this; $this->by_object["$class"]->set_acl_category($this->acl_category); } diff --git a/plugins/admin/users/class_userManagement.inc b/plugins/admin/users/class_userManagement.inc index ab6a47d0c69b273b342bb52eaf8bcc7e8f6dfd2c..2b7952677ce88b6d449286f88c1a59e7754698d9 100644 --- a/plugins/admin/users/class_userManagement.inc +++ b/plugins/admin/users/class_userManagement.inc @@ -51,12 +51,12 @@ class userManagement extends simpleManagement ); } - function __construct($config, $ui) + function __construct($unused, $ui) { $this->filterXMLPath = get_template_path('user-filter.xml', TRUE, dirname(__FILE__)); $this->listXMLPath = get_template_path('user-list.xml', TRUE, dirname(__FILE__)); - parent::__construct($config, $ui); + parent::__construct($unused, $ui); } function configureHeadpage () @@ -126,6 +126,7 @@ class userManagement extends simpleManagement */ function lockEntry($action, $entry, $all, $type = 'toggle') { + global $config; // Filter out entries we are not allowed to modify $disallowed = array(); $dns = array(); @@ -141,7 +142,7 @@ class userManagement extends simpleManagement } // Try to lock/unlock the rest of the entries. - $ldap = $this->config->get_ldap_link(); + $ldap = $config->get_ldap_link(); foreach ($allowed as $dn) { $ldap->cat($dn, array('userPassword')); if ($ldap->count() == 1) { @@ -158,15 +159,15 @@ class userManagement extends simpleManagement $success = TRUE; if ($method instanceOf passwordMethod) { if ($type == 'toggle') { - if ($method->is_locked($this->config, $val['dn'])) { - $success = $method->unlock_account($this->config, $val['dn']); + if ($method->is_locked($val['dn'])) { + $success = $method->unlock_account($val['dn']); } else { - $success = $method->lock_account($this->config, $val['dn']); + $success = $method->lock_account($val['dn']); } - } elseif ($type == 'lock' && !$method->is_locked($this->config, $val['dn'])) { - $success = $method->lock_account($this->config, $val['dn']); - } elseif ($type == 'unlock' && $method->is_locked($this->config, $val['dn'])) { - $success = $method->unlock_account($this->config, $val['dn']); + } elseif ($type == 'lock' && !$method->is_locked($val['dn'])) { + $success = $method->lock_account($val['dn']); + } elseif ($type == 'unlock' && $method->is_locked($val['dn'])) { + $success = $method->unlock_account($val['dn']); } // Check if everything went fine. diff --git a/plugins/admin/users/main.inc b/plugins/admin/users/main.inc index 2ca24d7a1e1c9b98a3a6634e21f2a7ea9493b42f..42ca2119f7fab2515e12d4140c1b19407c19660b 100644 --- a/plugins/admin/users/main.inc +++ b/plugins/admin/users/main.inc @@ -40,7 +40,7 @@ if ( $cleanup ){ /* Create usermanagement object on demand */ if (!session::is_set('userManagement')){ - $userManagement= new userManagement ($config, $ui); + $userManagement = new userManagement (NULL, $ui); session::set('userManagement',$userManagement); } $userManagement = session::get('userManagement'); diff --git a/plugins/config/class_configInLdap.inc b/plugins/config/class_configInLdap.inc index 60155f40705068affbfb1a7bd57fd70e248eb2fe..f2c45f023988c5af592689ca7e57acec7b8fe61f 100644 --- a/plugins/config/class_configInLdap.inc +++ b/plugins/config/class_configInLdap.inc @@ -465,8 +465,9 @@ class configInLdap extends simplePlugin ); } - function __construct(&$config, $dn = NULL, $object = NULL) + function __construct($unused, $dn = NULL, $object = NULL) { + global $config; $attributesInfo = self::getAttributesInfo(); /* Languages */ $languages = get_languages(TRUE); @@ -480,7 +481,7 @@ class configInLdap extends simplePlugin $methods = $methods['name']; $attributesInfo['password']['attrs'][0]->setChoices($methods); - parent::__construct($config, $dn, $object, $attributesInfo); + parent::__construct($unused, $dn, $object, $attributesInfo); $this->fusionConfigMd5 = md5_file(CACHE_DIR."/".CLASS_CACHE); diff --git a/plugins/config/class_mainPluginsConfig.inc b/plugins/config/class_mainPluginsConfig.inc index 7b6ddad90031809ba4a377534ec203617bb830f9..4234effd38b5ce8f13f2d5a159aa70f4e4ad13f9 100644 --- a/plugins/config/class_mainPluginsConfig.inc +++ b/plugins/config/class_mainPluginsConfig.inc @@ -61,9 +61,9 @@ class mainPluginsConfig extends simplePlugin ); } - function __construct(&$config, $dn = NULL, $object = NULL) + function __construct($unused, $dn = NULL, $object = NULL) { - parent::__construct($config, $dn, $object); + parent::__construct($unused, $dn, $object); } } ?> diff --git a/plugins/config/class_recoveryConfig.inc b/plugins/config/class_recoveryConfig.inc index 0f80f412110f94275c9a437a66078fefbe354d37..319c30288500c8545c2c533a89935bc0653debac 100644 --- a/plugins/config/class_recoveryConfig.inc +++ b/plugins/config/class_recoveryConfig.inc @@ -117,8 +117,9 @@ class recoveryConfig extends simplePlugin ); } - function __construct(&$config, $dn = NULL, $object = NULL) + function __construct($unused, $dn = NULL, $object = NULL) { + global $config; // Check if token branch is here $ldap = $config->get_ldap_link(); $tokenBranch = get_ou('tokenRDN').get_ou('fusiondirectoryRDN').$config->current['BASE']; @@ -133,7 +134,7 @@ class recoveryConfig extends simplePlugin fusiondirectory_log("Created token branch ".$tokenBranch); } - parent::__construct($config, $dn, $object); + parent::__construct($unused, $dn, $object); $this->attributesAccess['fdPasswordRecoveryActivated']->setManagedAttributes( array( diff --git a/plugins/generic/references/class_reference.inc b/plugins/generic/references/class_reference.inc index e5c4c31ea9eb2c3881c503c07eb04d0847654dfd..0a5ef4ad779e909d0136bbb653084e7ffd15a96b 100644 --- a/plugins/generic/references/class_reference.inc +++ b/plugins/generic/references/class_reference.inc @@ -51,9 +51,9 @@ class reference extends simplePlugin ); } - function __construct(&$config, $dn = NULL, $object = NULL) + function __construct($unused, $dn = NULL, $object = NULL) { - parent::__construct($config, $dn, $object); + parent::__construct($unused, $dn, $object); $this->refs = NULL; } diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index 0adff9e7b61b41ee2439bb99c1cdf05fdda79a74..bda235e41fabd3fd9d12797d29465961b4b02de3 100644 --- a/plugins/personal/generic/class_user.inc +++ b/plugins/personal/generic/class_user.inc @@ -70,11 +70,12 @@ class UserPasswordAttribute extends CompositeAttribute public function setParent(&$plugin) { + global $config; parent::setParent($plugin); if (is_object($this->plugin)) { - $hash = $this->plugin->config->get_cfg_value('passwordDefaultHash', 'ssha'); + $hash = $config->get_cfg_value('passwordDefaultHash', 'ssha'); $this->attributes[0]->setDefaultValue($hash); - if ($this->plugin->config->get_cfg_value('forcePasswordDefaultHash', 'FALSE') == 'TRUE') { + if ($config->get_cfg_value('forcePasswordDefaultHash', 'FALSE') == 'TRUE') { $this->attributes[0]->setValue($hash); $this->attributes[0]->setDisabled(TRUE); } @@ -159,7 +160,8 @@ class UserPasswordAttribute extends CompositeAttribute function readValues($value) { - $pw_storage = $this->plugin->config->get_cfg_value('passwordDefaultHash', 'ssha'); + global $config; + $pw_storage = $config->get_cfg_value('passwordDefaultHash', 'ssha'); $locked = FALSE; $password = ''; if ($this->plugin->is_template) { @@ -169,7 +171,7 @@ class UserPasswordAttribute extends CompositeAttribute $tmp = passwordMethod::get_method($value); if (is_object($tmp)) { $pw_storage = $tmp->get_hash(); - $locked = $tmp->is_locked($this->plugin->config, $this->plugin->dn); + $locked = $tmp->is_locked($this->plugin->dn); if ($this->plugin->is_template) { $value = $tmp->generate_hash($password); } @@ -196,7 +198,7 @@ class UserPasswordAttribute extends CompositeAttribute trigger_error('Unknown password method '.$values[0]); return $values[3]; } - $test = new $temp[$values[0]]($this->plugin->config, $this->plugin->dn); + $test = new $temp[$values[0]]($this->plugin->dn); $test->set_hash($values[0]); if ($this->plugin->is_template) { return $test->generate_hash($values[1]).'|'.$values[1]; @@ -444,9 +446,9 @@ class user extends simplePlugin ); } - function __construct (&$config, $dn = NULL, $object = NULL) + function __construct ($unused, $dn = NULL, $object = NULL) { - parent::__construct($config, $dn, $object); + parent::__construct($unused, $dn, $object); $this->attributesAccess['uid']->setUnique('whole'); $this->attributesAccess['uid']->setDisabled($this->initially_was_account && !$this->is_template); @@ -471,7 +473,8 @@ class user extends simplePlugin private function update_cn () { - $pattern = $this->config->get_cfg_value('CnPattern', '%givenName% %sn%'); + global $config; + $pattern = $config->get_cfg_value('CnPattern', '%givenName% %sn%'); $fields = plugin::tpl_list_fields($pattern); $attrs = array(); foreach ($fields as $field) { @@ -495,13 +498,14 @@ class user extends simplePlugin function compute_dn() { + global $config; if ($this->is_template) { $dn = 'cn='.ldap_escape_dn($this->_template_cn).',ou=templates,'.get_ou('userRDN').$this->base; return $dn; } $this->update_cn(); - $attribute = $this->config->get_cfg_value('accountPrimaryAttribute', 'uid'); + $attribute = $config->get_cfg_value('accountPrimaryAttribute', 'uid'); return $this->create_unique_dn($attribute, get_ou('userRDN').$this->base); } @@ -519,8 +523,8 @@ class user extends simplePlugin if (!$this->is_template && $this->was_locked && $this->attributesAccess['userPassword']->hasChanged()) { $methods = passwordMethod::get_available_methods(); - $pmethod = new $methods[$this->attributesAccess['userPassword']->getMethod()]($this->config, $this->dn); - $pmethod->lock_account($this->config, $this->dn); + $pmethod = new $methods[$this->attributesAccess['userPassword']->getMethod()]($this->dn); + $pmethod->lock_account($this->dn); } } diff --git a/plugins/personal/posix/class_posixAccount.inc b/plugins/personal/posix/class_posixAccount.inc index 4641e3ee7cedcadafc2a1601bb9cd4c840833968..6aa78a430f68b85f2934936a9ec45b6e296dd40c 100644 --- a/plugins/personal/posix/class_posixAccount.inc +++ b/plugins/personal/posix/class_posixAccount.inc @@ -204,9 +204,10 @@ class posixAccount extends simplePlugin ); } - function __construct (&$config, $dn = NULL, $object = NULL) + function __construct ($unused, $dn = NULL, $object = NULL) { - parent::__construct($config, $dn, $object); + global $config; + parent::__construct($unused, $dn, $object); $this->attributesAccess['gecos']->setVisible(FALSE); @@ -276,7 +277,7 @@ class posixAccount extends simplePlugin } /* Generate shell list from config */ - $loginShellList = $this->config->get_cfg_value('Shells', array(_('unconfigured'))); + $loginShellList = $config->get_cfg_value('Shells', array(_('unconfigured'))); /* Insert possibly missing loginShell */ $loginShell = $this->attributesAccess['loginShell']->getValue(); @@ -289,8 +290,8 @@ class posixAccount extends simplePlugin $secondaryGroups = array(); $secondaryGroups[''] = "- "._("automatic")." -"; - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); + $ldap = $config->get_ldap_link(); + $ldap->cd($config->current['BASE']); $ldap->search("(objectClass=posixGroup)", array("cn", "gidNumber")); while ($attrs = $ldap->fetch()) { $secondaryGroups[$attrs['gidNumber'][0]] = $attrs['cn'][0]; @@ -333,7 +334,7 @@ class posixAccount extends simplePlugin } } else { /* Groups handling */ - $ldap->cd($this->config->current['BASE']); + $ldap->cd($config->current['BASE']); $ldap->search('(&(objectClass=posixGroup)(memberUid='.ldap_escape_f($this->getUid()).'))', array('cn', 'description')); $groupMembership = array(); while ($attrs = $ldap->fetch()) { @@ -371,12 +372,13 @@ class posixAccount extends simplePlugin function resetCopyInfos() { + global $config; parent::resetCopyInfos(); $this->savedGroupMembership = array(); - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); + $ldap = $config->get_ldap_link(); + $ldap->cd($config->current['BASE']); $ldap->search('(&(objectClass=posixGroup)(gidNumber='.ldap_escape_f($this->gidNumber).')(cn='.ldap_escape_f($this->getUid()).'))', array('cn','gidNumber')); if ($ldap->count() > 0) { @@ -393,6 +395,7 @@ class posixAccount extends simplePlugin function check() { + global $config; if (isset($this->parent) && isset($this->parent->getBaseObject()->is_template) && $this->parent->getBaseObject()->is_template) { @@ -403,11 +406,11 @@ class posixAccount extends simplePlugin /* Check ID's if they are forced by user */ if ($this->force_ids) { - if ($this->uidNumber < $this->config->get_cfg_value("minId")) { - $message[] = msgPool::toosmall(_("UID"), $this->config->get_cfg_value("minId")); + if ($this->uidNumber < $config->get_cfg_value("minId")) { + $message[] = msgPool::toosmall(_("UID"), $config->get_cfg_value("minId")); } - if ($this->gidNumber < $this->config->get_cfg_value("minId")) { - $message[] = msgPool::toosmall(_("GID"), $this->config->get_cfg_value("minId")); + if ($this->gidNumber < $config->get_cfg_value("minId")) { + $message[] = msgPool::toosmall(_("GID"), $config->get_cfg_value("minId")); } } @@ -437,6 +440,7 @@ class posixAccount extends simplePlugin function prepare_save() { + global $config; /* Fill gecos */ if (isset($this->parent) && $this->parent !== NULL) { $this->gecos = rewrite($this->parent->getBaseObject()->cn); @@ -483,8 +487,8 @@ class posixAccount extends simplePlugin $this->gidNumber = 2147483647; } elseif (($this->primaryGroup == 0) || $this->force_ids) { /* Search for existing group */ - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); + $ldap = $config->get_ldap_link(); + $ldap->cd($config->current['BASE']); /* Are we forced to use a special gidNumber? */ if ($this->force_ids) { @@ -626,6 +630,7 @@ class posixAccount extends simplePlugin /* remove object from parent */ function remove_from_parent() { + global $config; /* Cancel if there's nothing to do here */ if ((!$this->initially_was_account) || (!$this->acl_is_removeable())) { return; @@ -635,8 +640,8 @@ class posixAccount extends simplePlugin parent::remove_from_parent(); /* Delete group only if cn is uid and there are no other members inside */ - $ldap = $this->config->get_ldap_link(); - $ldap->cd ($this->config->current['BASE']); + $ldap = $config->get_ldap_link(); + $ldap->cd ($config->current['BASE']); $ldap->search ('(&(objectClass=posixGroup)(gidNumber='.ldap_escape_f($this->gidNumber).')(cn='.ldap_escape_f($this->getUid()).'))', array('cn', 'memberUid')); if ($ldap->count() != 0) { $attrs = $ldap->fetch(); diff --git a/plugins/personal/roles/class_userRoles.inc b/plugins/personal/roles/class_userRoles.inc index 5554f4b3e571034333a1b5e1ae7e6698212caa57..6bbb869c5c94c3ee13480521a2228fdc4536ed8b 100644 --- a/plugins/personal/roles/class_userRoles.inc +++ b/plugins/personal/roles/class_userRoles.inc @@ -68,9 +68,9 @@ class userRoles extends simplePlugin ); } - function __construct (&$config, $dn = NULL, $object = NULL) + function __construct ($unused, $dn = NULL, $object = NULL) { - parent::__construct($config, $dn, $object); + parent::__construct($unused, $dn, $object); $this->ignore_account = FALSE; /* Groups handling */ diff --git a/setup/class_setup.inc b/setup/class_setup.inc index fc61e0003227085f34b38847792eab00e5b59e7c..7e222483f41f96128f84a964ee545538299fc3d9 100644 --- a/setup/class_setup.inc +++ b/setup/class_setup.inc @@ -25,9 +25,6 @@ class fake_userinfo extends userinfo { function __construct() { - global $config; - $this->config = &$config; - $this->cn = 'fake_cn'; $this->dn = 'fake_dn'; $this->uid = 'fake_uid'; diff --git a/setup/class_setupStep.inc b/setup/class_setupStep.inc index bb1649a3a5895a5c0e30970e72f4eec9778c5733..f9625f24fa9b870edaa43f53cf11a42ff9b75548 100644 --- a/setup/class_setupStep.inc +++ b/setup/class_setupStep.inc @@ -37,8 +37,7 @@ class setupStep extends simplePlugin function __construct() { - global $config; - parent::__construct($config); + parent::__construct(); $this->update_strings(); }