diff --git a/htdocs/update_confirm.php b/htdocs/update_confirm.php
index d969ed1..28842c5 100644
--- a/htdocs/update_confirm.php
+++ b/htdocs/update_confirm.php
@@ -71,15 +71,16 @@ if (count($request['template']->getLDAPmodify(true))) {
if (! $attribute->getOldValues())
printf('[%s]',_('attribute doesnt exist'));
+ $dv = $attribute->getRemovedValues();
foreach ($attribute->getOldValues() as $key => $value) {
# For multiple values, we'll highlight the changed ones
- if ((count($attribute->getOldValues()) > 5) && in_array($value,$attribute->getRemovedValues()) && count($attribute->getValues()))
+ if ($x = ((count($attribute->getOldValues()) > 5) && count($attribute->getValues()) && in_array($value,$dv)))
echo '';
$request['page']->draw('OldValue',$attribute,$key);
# For multiple values, close the highlighting
- if ((count($attribute->getOldValues()) > 5) && in_array($value,$attribute->getRemovedValues()) && count($attribute->getValues()))
+ if ($x)
echo '';
echo '
';
@@ -93,15 +94,16 @@ if (count($request['template']->getLDAPmodify(true))) {
if (! $attribute->getValueCount() || $attribute->isForceDelete())
printf('[%s]',_('attribute deleted'));
+ $dv = $attribute->getAddedValues();
foreach ($attribute->getValues() as $key => $value) {
# For multiple values, we'll highlight the changed ones
- if ((count($attribute->getValues()) > 5) && in_array($value,$attribute->getAddedValues()))
+ if ($x = ((count($attribute->getValues()) > 5) && count($attribute->getOldValues()) && in_array($value,$dv)))
echo '';
$request['page']->draw('CurrentValue',$attribute,$key);
# For multiple values, close the highlighting
- if ((count($attribute->getValues()) > 5) && in_array($value,$attribute->getAddedValues()))
+ if ($x)
echo '';
echo '
';
diff --git a/lib/Attribute.php b/lib/Attribute.php
index d355aa8..92f441c 100644
--- a/lib/Attribute.php
+++ b/lib/Attribute.php
@@ -838,13 +838,7 @@ class Attribute {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
- $return = array();
-
- foreach ($this->getOldValues() as $value)
- if (! in_array($value,$this->getValues()))
- array_push($return,$value);
-
- return $return;
+ return array_diff($this->getOldValues(),$this->getValues());
}
/**
@@ -854,13 +848,7 @@ class Attribute {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
- $return = array();
-
- foreach ($this->getValues() as $value)
- if (! in_array($value,$this->getOldValues()))
- array_push($return,$value);
-
- return $return;
+ return array_diff($this->getValues(),$this->getOldValues());
}
/**