summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 236bc49)
raw | patch | inline | side by side (parent: 236bc49)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 13 Sep 2007 08:40:28 +0000 (08:40 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 13 Sep 2007 08:40:28 +0000 (08:40 +0000) |
Removed some foreach / for objectClass ... and replaced them with array_functions
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7286 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7286 594d385d-05f5-0310-b6e9-bd551577e9d8
include/class_plugin.inc | patch | blob | history | |
include/functions.inc | patch | blob | history | |
plugins/personal/environment/class_environment.inc | patch | blob | history |
index 2966e8d44f93e1a1bd72b4122eac6ab58de2a44f..eb4d40a8fe4218e862e2a7088a4e8d0d14d3ba9f 100644 (file)
--- a/include/class_plugin.inc
+++ b/include/class_plugin.inc
/* Get current objectClasses in order to add the required ones */
$ldap->cat($this->dn);
$tmp= $ldap->fetch ();
+ $oc= array();
if (isset($tmp['objectClass'])){
$oc= $tmp['objectClass'];
- } else {
- $oc= array("count" => 0);
+ unset($oc['count']);
}
/* Remove objectClasses from entry */
$ldap->cd($this->dn);
$this->attrs= array();
- $this->attrs['objectClass']= array();
- for ($i= 0; $i<$oc["count"]; $i++){
- if (!in_array_ics($oc[$i], $this->objectclasses)){
- $this->attrs['objectClass'][]= $oc[$i];
- }
- }
+ $this->attrs['objectClass']= array_remove_entries($this->objectclasses,$oc);
/* Unset attributes from entry */
foreach ($this->attributes as $val){
diff --git a/include/functions.inc b/include/functions.inc
index 0d27f10b18a98374620ac515fc057a20b31a6d87..e6645288a2410105e3efd1fb2e1ba6408df7fa7b 100644 (file)
--- a/include/functions.inc
+++ b/include/functions.inc
}
+function gosa_array_merge($ar1,$ar2)
+{
+ if(!is_array($ar1) || !is_array($ar2)){
+ trigger_error("Specified parameter(s) are not valid arrays.");
+ }else{
+ return(array_values(array_unique(array_merge($ar1,$ar2))));
+ }
+}
+
+
+
function gosa_log ($message)
{
global $ui;
diff --git a/plugins/personal/environment/class_environment.inc b/plugins/personal/environment/class_environment.inc
index 36597d19b987b4efde492f321f83129c39f044f8..b1590af36b5e4e211f231c58a48a7af7964ba91a 100644 (file)
$ocs = $this->attrs['objectClass'];
unset($ocs['count']);
$this->attrs = array();
- $this->attrs['objectClass']= $ocs;
- foreach($this->objectclasses as $objc){
- if(!in_array($objc,$this->attrs['objectClass'])){
- $this->attrs['objectClass'][]=$objc;
- }
- }
+ $this->attrs['objectClass']= gosa_array_merge($ocs,$this->objectclasses);
/* 1. Search all printers that have our uid/cn as member
* 2. Delete this uid/cn from every single entry and save it again.