From 803a4c821ab16c870569d54080813d83f24b7f03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Requiem?= Date: Mon, 17 Aug 2009 15:09:32 +1000 Subject: [PATCH] SF Feature #2827191 - warnings for missing objectClass could be disabled --- config/config.php.example | 3 +++ lib/Template.php | 11 ++++++----- lib/config_default.php | 4 ++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/config/config.php.example b/config/config.php.example index 55a5e3f..2ce0b22 100644 --- a/config/config.php.example +++ b/config/config.php.example @@ -145,6 +145,9 @@ $config->custom->commands['script'] = array( /* Disable the default template. */ // $config->custom->appearance['disable_default_template'] = false; +/* Hide the warnings for invalid objectClasses/attributes in templates. */ +// $config->custom->appearance['hide_template_warning'] = false; + /* Configure what objects are shown in left hand tree */ // $config->custom->appearance['tree_filter'] = '(objectclass=*)'; diff --git a/lib/Template.php b/lib/Template.php index 933be10..3b4f3a0 100644 --- a/lib/Template.php +++ b/lib/Template.php @@ -94,7 +94,7 @@ class Template extends xmlTemplate { if (is_object($soc) && ! in_array($soc->getName(),$objectclasses)) array_push($objectclasses,$soc->getName(false)); - elseif (! is_object($soc)) + elseif (! is_object($soc) && ! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning')) system_message(array( 'title'=>_('Automatically removed objectClass from template'), 'body'=>sprintf('%s: %s %s',$this->getTitle(),$details,_('removed from template as it is not defined in the schema')), @@ -1222,10 +1222,11 @@ class Template extends xmlTemplate { && (! in_array_ignore_case('extensibleobject',$this->getObjectClasses()))) { unset($this->attributes[$index]); - system_message(array( - 'title'=>_('Automatically removed attribute from template'), - 'body'=>sprintf('%s: %s %s',$this->getTitle(),$attribute->getName(false),_('removed from template as it is not defined by an ObjectClass')), - 'type'=>'warn')); + if (! $_SESSION[APPCONFIG]->getValue('appearance','hide_template_warning')) + system_message(array( + 'title'=>_('Automatically removed attribute from template'), + 'body'=>sprintf('%s: %s %s',$this->getTitle(),$attribute->getName(false),_('removed from template as it is not defined by an ObjectClass')), + 'type'=>'warn')); } } diff --git a/lib/config_default.php b/lib/config_default.php index c9f518b..a4df4a2 100644 --- a/lib/config_default.php +++ b/lib/config_default.php @@ -105,6 +105,10 @@ class Config { 'desc'=>'Hide the features that may provide sensitive debugging information to the browser', 'default'=>true); + $this->default->appearance['hide_template_warning'] = array( + 'desc'=>'Hide template errors from being displayed', + 'default'=>false); + /** Language * The language setting. If you set this to 'auto', phpLDAPadmin will * attempt to determine your language automatically. Otherwise, set