From 18df94de8ea9266aa108e334e4a73dbdd48b702a Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 7 Apr 2010 13:28:12 +0000 Subject: [PATCH] Fixed some undefined index and implode warnings git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17522 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_acl.inc | 103 +++++++++++++++++--------------- 1 file changed, 55 insertions(+), 48 deletions(-) diff --git a/gosa-core/include/class_acl.inc b/gosa-core/include/class_acl.inc index a3283dfa2..0658fea10 100644 --- a/gosa-core/include/class_acl.inc +++ b/gosa-core/include/class_acl.inc @@ -401,6 +401,9 @@ class acl extends plugin if(isset($_POST['selected_role']) && $_POST['aclType'] == 'role'){ $this->aclContents = ""; $this->aclContents = base64_decode($_POST['selected_role']); + }else{ + if(is_string($this->aclContents)) + $this->aclContents = array(); } } @@ -526,59 +529,63 @@ class acl extends plugin if ($this->dialogState == 'create'){ - // Create a map of all used sections, this allows us to simply hide the remove button - // if no acl is configured for the given section - // e.g. ';all;department/country;users/user; - $usedList = ";".implode(array_keys($this->aclContents),';').";"; - - /* Add settings for all categories to the (permanent) list */ - $data = $lData = array(); - foreach ($this->aclObjects as $section => $dsc){ - $summary= ""; - foreach($this->ocMapping[$section] as $oc){ - if (isset($this->aclContents[$oc]) && - count($this->aclContents[$oc]) && - isset($this->aclContents[$oc][0]) && - $this->aclContents[$oc][0] != ""){ - - $summary.= "$oc, "; - continue; - } - if (isset($this->aclContents["$section/$oc"]) && - count($this->aclContents["$section/$oc"])){ - $summary.= "$oc, "; - continue; - } - if (isset($this->aclContents[$oc]) && - !isset($this->aclContents[$oc][0]) && - count($this->aclContents[$oc])){ - $summary.= "$oc, "; + + if($this->aclType != 'role'){ + + // Create a map of all used sections, this allows us to simply hide the remove button + // if no acl is configured for the given section + // e.g. ';all;department/country;users/user; + $usedList = ";".implode(array_keys($this->aclContents),';').";"; + + /* Add settings for all categories to the (permanent) list */ + $data = $lData = array(); + foreach ($this->aclObjects as $section => $dsc){ + $summary= ""; + foreach($this->ocMapping[$section] as $oc){ + if (isset($this->aclContents[$oc]) && + count($this->aclContents[$oc]) && + isset($this->aclContents[$oc][0]) && + $this->aclContents[$oc][0] != ""){ + + $summary.= "$oc, "; + continue; + } + if (isset($this->aclContents["$section/$oc"]) && + count($this->aclContents["$section/$oc"])){ + $summary.= "$oc, "; + continue; + } + if (isset($this->aclContents[$oc]) && + !isset($this->aclContents[$oc][0]) && + count($this->aclContents[$oc])){ + $summary.= "$oc, "; + } } - } - /* Set summary... */ - if ($summary == ""){ - $summary= ''._("No ACL settings for this category!").''; - } else { - $summary= trim($summary,", "); - $summary= " ".sprintf(_("Contains ACLs for these objects: %s"), $summary); - } + /* Set summary... */ + if ($summary == ""){ + $summary= ''._("No ACL settings for this category!").''; + } else { + $summary= trim($summary,", "); + $summary= " ".sprintf(_("Contains ACLs for these objects: %s"), $summary); + } - $actions =""; - if($this->acl_is_readable("")){ - $actions.= image('images/lists/edit.png','cat_edit_'.$section, - msgPool::editButton(_("category ACL"))); + $actions =""; + if($this->acl_is_readable("")){ + $actions.= image('images/lists/edit.png','cat_edit_'.$section, + msgPool::editButton(_("category ACL"))); + } + if($this->acl_is_removeable() && preg_match("/;".$section."(;|\/)/", $usedList)){ + $actions.= image('images/lists/trash.png','cat_del_'.$section, + msgPool::delButton(_("category ACL"))); + } + $data[] = $section; + $lData[] = array('data'=>array($dsc, $summary, $actions)); } - if($this->acl_is_removeable() && preg_match("/;".$section."(;|\/)/", $usedList)){ - $actions.= image('images/lists/trash.png','cat_del_'.$section, - msgPool::delButton(_("category ACL"))); - } - $data[] = $section; - $lData[] = array('data'=>array($dsc, $summary, $actions)); + $this->sectionList->setListData($data,$lData); + $this->sectionList->update(); + $smarty->assign("aclList", $this->sectionList->render()); } - $this->sectionList->setListData($data,$lData); - $this->sectionList->update(); - $smarty->assign("aclList", $this->sectionList->render()); $smarty->assign("aclType", $this->aclType); $smarty->assign("aclFilter", $this->aclFilter); -- 2.30.2