diff --git a/htdocs/index.php b/htdocs/index.php index 9ded9d9..0ece670 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -1,5 +1,5 @@ search(null,'','objectClass=*',array('+','*'),'b on RHEL 3. */ $attrs2 = array_pop($ldapserver->search(null,'','objectClass=*',$root_dse_attributes,'base')); -foreach ($attrs2 as $attr => $values) - if (! isset($attrs[$attr])) - $attrs[$attr] = $attrs2[$attr]; +if (is_array($attrs2)) + foreach ($attrs2 as $attr => $values) + if (! isset($attrs[$attr])) + $attrs[$attr] = $attrs2[$attr]; include './header.php'; diff --git a/htdocs/template_engine.php b/htdocs/template_engine.php index 0b01255..f72c6a2 100644 --- a/htdocs/template_engine.php +++ b/htdocs/template_engine.php @@ -1,5 +1,5 @@ ','hidden',$attr,$attr,$detail['value']); - continue; + if (isset($detail['value'])) { + printf('','hidden',$attr,$attr,$detail['value']); + continue; + + } else { + pla_error(sprintf(_('Attribute [%s] is a HIDDEN attribute, however, it is missing a VALUE in your template.'),$attr)); + } } # This is a displayed attribute. @@ -324,9 +328,13 @@ if (isset($template['empty_attrs'])) { # Display the label. if (isset($detail['description']) && (trim($detail['description']))) printf('%s:',$detail['description'],$detail['display']); - else + + elseif (isset($detail['display'])) printf('%s:',$detail['display']); + else + printf('%s:',_('No DISPLAY/DESCRIPTION attribute in template file')); + echo ''; # Calculate the events. @@ -490,7 +498,7 @@ if (isset($template['empty_attrs'])) { foreach ($_REQUEST['form'] as $attr => $value) { # Remove blank attributes. - if (! $_REQUEST['form'][$attr]) { + if (! is_array($_REQUEST['form'][$attr]) && trim($_REQUEST['form'][$attr]) == '') { unset($_REQUEST['form'][$attr]); continue; } @@ -521,12 +529,14 @@ if (isset($template['empty_attrs'])) { } - echo ''; - foreach (array_keys($_SESSION['submitform']) as $attr) { + if (isset($_SESSION['submitform'])) { + echo ''; + foreach (array_keys($_SESSION['submitform']) as $attr) { - printf('%s%s', - ($counter++%2==0?'even':'odd'),$attr,_('Binary value not displayed')); - printf('',$attr); + printf('%s%s', + ($counter++%2==0?'even':'odd'),$attr,_('Binary value not displayed')); + printf('',$attr); + } } } @@ -1007,7 +1017,8 @@ foreach ($template['attrs'] as $attr => $vals) { $schema_object = $ldapserver->getSchemaObjectClass($val); - if ($schema_object->getType() == 'structural') { + # This should be an object, but we'll test it anyway + if (is_object($schema_object) && $schema_object->getType() == 'structural') { printf(' %s (%s)
', $val,_('This is a structural ObjectClass and cannot be removed.'),_('structural')); printf('',$input_name,$input_id,htmlspecialchars($val)); diff --git a/lib/functions.php b/lib/functions.php index 92a4a61..fc4c78e 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -1,5 +1,5 @@ $element ) { $element = htmlspecialchars($element); diff --git a/lib/schema_functions.php b/lib/schema_functions.php index 95bc2bb..620d7da 100644 --- a/lib/schema_functions.php +++ b/lib/schema_functions.php @@ -1,5 +1,5 @@ %s"', - htmlspecialchars($attr),htmlspecialchars($friendly_attrs[strtolower($attr)])); + $attr_display = sprintf('%s', + _('Note'),htmlspecialchars($attr),_('is an alias for'), + htmlspecialchars($friendly_attrs[strtolower($attr)]), + htmlspecialchars($friendly_attrs[strtolower($attr)])); else $attr_display = htmlspecialchars($attr);