function &execute($attributes = array()) { $this->getInfo($this->_vars, $info); if (isset($info['object'])) { $search_criteria = array(); foreach ($info['object'] as $key => $value) { if ($value != '' && $value !== null) { $search_criteria[] = array('field' => $key, 'op' => 'contains', 'test' => $value); } } if (empty($search_criteria)) { throw new Koward_Exception('Provide at least a single search parameter!'); } $search_criteria = array('AND' => $search_criteria); $criteria = array('AND' => array($search_criteria, $this->koward->search['criteria'])); $params = array('scope' => 'sub', 'attributes' => array_merge(array('dn'), $attributes)); if (!empty($this->koward->conf['koward']['search']['sizelimit'])) { $params['sizelimit'] = $this->koward->conf['koward']['search']['sizelimit']; } $server =& $this->koward->getServer(); $result = $server->find($criteria, $params); if (!empty($server->lastSearch) && method_exists($server->lastSearch, 'sizeLimitExceeded') && $server->lastSearch->sizeLimitExceeded()) { $this->koward->notification->push(sprintf(_("More than the maximal allowed amount of %s elements were found. The list of results has been shortened."), $this->koward->conf['koward']['search']['sizelimit'], 'horde.message')); } return $result; } }
function &execute() { $this->getInfo($this->_vars, $info); if (isset($info['object'])) { if (empty($this->object)) { if (isset($info['type'])) { if (isset($this->koward->objects[$info['type']]['class'])) { $class = $this->koward->objects[$info['type']]['class']; } else { throw new Koward_Exception(sprintf('Invalid type \\"%s\\" specified!', $info['type'])); } $object = $this->koward->getServer()->add(array_merge(array('type' => $class), $info['object'])); $this->koward->notification->push(_("Successfully added the object."), 'horde.message'); return $object; } } else { $this->object->save($info['object']); $this->koward->notification->push(_("Successfully updated the object."), 'horde.message'); return $this->object; } } }