From 9cb27e3a70f01677fc79f8a6ec4387946b2c05b7 Mon Sep 17 00:00:00 2001 From: Deon George Date: Fri, 28 Aug 2009 20:07:56 +1000 Subject: [PATCH] Miscellaneous minor updates --- config/config.php.example | 13 ++++++++----- htdocs/js/ajax_functions.js | 8 ++++---- htdocs/refresh.php | 2 +- htdocs/update_confirm.php | 2 +- lib/Template.php | 2 +- lib/config_default.php | 2 +- lib/ds.php | 2 +- lib/ds_ldap.php | 5 ++--- lib/functions.php | 5 +++-- lib/schema_functions.php | 2 +- 10 files changed, 23 insertions(+), 20 deletions(-) diff --git a/config/config.php.example b/config/config.php.example index f809a0b..6de6b18 100644 --- a/config/config.php.example +++ b/config/config.php.example @@ -39,7 +39,7 @@ /* Useful important configuration overrides */ /*********************************************/ -/* If you are asked to put pla in debug mode, this is how you do it: */ +/* If you are asked to put PLA in debug mode, this is how you do it: */ # $config->custom->debug['level'] = 255; # $config->custom->debug['syslog'] = true; # $config->custom->debug['file'] = '/tmp/pla_debug.log'; @@ -92,7 +92,7 @@ $config->custom->commands['cmd'] = array( 'entry_refresh' => true, 'oslinks' => true, 'switch_template' => true - ); +); $config->custom->commands['script'] = array( 'add_attr_form' => true, @@ -258,6 +258,9 @@ $config->custom->appearance['friendly_attrs'] = array( /*********************************************/ $servers = new Datastore(); + +/* $servers->NewServer('ldap_pla') must be called before each new LDAP server + declaration. */ $servers->newServer('ldap_pla'); /* A convenient name that will appear in the tree viewer and throughout @@ -297,12 +300,12 @@ $servers->setValue('server','name','My LDAP Server'); /* The DN of the user for phpLDAPadmin to bind with. For anonymous binds or 'cookie' or 'session' auth_types, LEAVE THE LOGIN_DN AND LOGIN_PASS BLANK. If you specify a login_attr in conjunction with a cookie or session auth_type, - then you can also specify the bind_dn/bind_pass here for searching the + then you can also specify the bind_id/bind_pass here for searching the directory for users (ie, if your LDAP server does not allow anonymous binds. */ // $servers->setValue('login','bind_id',''); # $servers->setValue('login','bind_id','cn=Manager,dc=example,dc=com'); -/* Your LDAP password. If you specified an empty bind_dn above, this MUST also +/* Your LDAP password. If you specified an empty bind_id above, this MUST also be blank. */ // $servers->setValue('login','bind_pass',''); # $servers->setValue('login','bind_pass','secret'); @@ -363,7 +366,7 @@ $servers->setValue('server','name','My LDAP Server'); and log in as that user. Leave blank or specify 'dn' to use full DN for logging in. Note also that if your LDAP server requires you to login to perform searches, you can enter the - DN to use when searching in 'bind_dn' and 'bind_pass' above. + DN to use when searching in 'bind_id' and 'bind_pass' above. // $servers->setValue('login','attr','dn'); /* Base DNs to used for logins. If this value is not set, then the LDAP server diff --git a/htdocs/js/ajax_functions.js b/htdocs/js/ajax_functions.js index 10ea71a..ab88a8b 100644 --- a/htdocs/js/ajax_functions.js +++ b/htdocs/js/ajax_functions.js @@ -112,10 +112,10 @@ function includeHTML(component,html) { if (scripts[i].attributes.length > 0) { for (var j in scripts[i].attributes) { if (typeof(scripts[i].attributes[j]) != 'undefined' - && typeof(scripts[i].attributes[j].nodeName) != 'undefined' - && scripts[i].attributes[j].nodeValue != null - && scripts[i].attributes[j].nodeValue != '') { - scriptclone.setAttribute(scripts[i].attributes[j].nodeName,scripts[i].attributes[j].nodeValue); + && typeof(scripts[i].attributes[j].nodeName) != 'undefined' + && scripts[i].attributes[j].nodeValue != null + && scripts[i].attributes[j].nodeValue != '') { + scriptclone.setAttribute(scripts[i].attributes[j].nodeName,scripts[i].attributes[j].nodeValue); } } } diff --git a/htdocs/refresh.php b/htdocs/refresh.php index ac5976b..385c4c6 100644 --- a/htdocs/refresh.php +++ b/htdocs/refresh.php @@ -30,7 +30,7 @@ if (get_request('purge','REQUEST')) { $entry = $tree->getEntry($value); } - $tree->readChildren($value); + $tree->readChildren($value,true); $entry->open(); } diff --git a/htdocs/update_confirm.php b/htdocs/update_confirm.php index d15c92f..cfeac09 100644 --- a/htdocs/update_confirm.php +++ b/htdocs/update_confirm.php @@ -110,7 +110,7 @@ if (count($request['template']->getLDAPmodify(true))) { $input_disabled = ''; $input_onclick = ''; - if ($attribute->isForceDelete() || in_array($attribute->getName(),$mustattrs)) + if ($attribute->isForceDelete() || (in_array($attribute->getName(),$mustattrs)) && $request['template']->getAttribute('objectclass')->justModified()) $input_disabled = 'disabled="disabled"'; if ($attribute->getName() == 'objectclass') { diff --git a/lib/Template.php b/lib/Template.php index 1d44dd0..f040e4d 100644 --- a/lib/Template.php +++ b/lib/Template.php @@ -1113,7 +1113,7 @@ class Template extends xmlTemplate { $sattr = $this->getServer()->getSchemaAttribute($checkattr); # If the attribute is the same as in the XML file, then dont need to do anything. - if (! strcasecmp($sattr->getName(),$checkattr)) + if (! $sattr || ! strcasecmp($sattr->getName(),$checkattr)) continue; $formula = preg_replace("/$checkattr/",$sattr->getName(),$formula); diff --git a/lib/config_default.php b/lib/config_default.php index 8880c1f..8e6bf81 100644 --- a/lib/config_default.php +++ b/lib/config_default.php @@ -683,7 +683,7 @@ class Config { } public function configDefinition($key,$index,$config) { - if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) + if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) debug_log('Entered (%%)',3,0,__FILE__,__LINE__,__METHOD__,$fargs); if (! is_array($config) || ! array_key_exists('desc',$config) || ! array_key_exists('default',$config)) diff --git a/lib/ds.php b/lib/ds.php index 43807d2..70e3c1a 100644 --- a/lib/ds.php +++ b/lib/ds.php @@ -427,7 +427,7 @@ abstract class DS { */ public function isSessionValid() { if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) - debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs,true); + debug_log('Entered (%%)',17,1,__FILE__,__LINE__,__METHOD__,$fargs,true); return true; } diff --git a/lib/ds_ldap.php b/lib/ds_ldap.php index f2abc16..05356b1 100644 --- a/lib/ds_ldap.php +++ b/lib/ds_ldap.php @@ -7,7 +7,7 @@ */ /** - * This abstract class provides the basic variables and methods for LDAP datastores:wq + * This abstract class provides the basic variables and methods for LDAP datastores * * @package phpLDAPadmin * @subpackage DataStore @@ -243,7 +243,6 @@ class ldap extends DS { * Login to the database with the application user/password * * @return boolean true|false for successful login. - * @todo isLoginStringEnabled() based logins */ public function login($user=null,$pass=null,$method=null,$new=false) { if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) @@ -487,7 +486,7 @@ class ldap extends DS { return null; $detail = array_shift($result); - + if (! isset($detail['dn'])) die('ERROR: DN missing?'); else diff --git a/lib/functions.php b/lib/functions.php index 05ff9b7..4696998 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -486,8 +486,8 @@ function debug_log($msg,$level,$indent) { static $debug_file; # In case we are called before we are fully initialised or if debugging is not set. - if (! isset($_SESSION[APPCONFIG]) || - ! ($_SESSION[APPCONFIG]->getValue('debug','file') || $_SESSION[APPCONFIG]->getValue('debug','syslog'))) + if (! isset($_SESSION[APPCONFIG]) + || ! ($_SESSION[APPCONFIG]->getValue('debug','file') || $_SESSION[APPCONFIG]->getValue('debug','syslog'))) return; $debug_level = $_SESSION[APPCONFIG]->getValue('debug','level'); @@ -2860,6 +2860,7 @@ function binSIDtoText($binsid) { * or true to have the returned array sorted by DN (uses ksort) * or an array of attribute names to sort by attribute values * @return array Array of values keyed by $key. + * @todo sort is not being performed */ function return_ldap_hash($base,$filter,$key,$attrs,$sort=true) { if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) diff --git a/lib/schema_functions.php b/lib/schema_functions.php index 7b8d4a6..efa0cbc 100644 --- a/lib/schema_functions.php +++ b/lib/schema_functions.php @@ -42,7 +42,7 @@ abstract class SchemaItem { public function getOID() { if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) - debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs); + debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->oid); return $this->oid; }