public function execute() { global $attributes, $notification; if (!$this->validate($this->_vars)) { throw new Turba_Exception('Invalid'); } /* Form valid, save data. */ $this->getInfo($this->_vars, $info); /* Update the contact. */ foreach ($info['object'] as $info_key => $info_val) { if ($info_key != '__key') { if ($attributes[$info_key]['type'] == 'image' && !empty($info_val['file'])) { $this->_contact->setValue($info_key, file_get_contents($info_val['file'])); if (isset($info_val['type'])) { $this->_contact->setValue($info_key . 'type', $info_val['type']); } } else { $this->_contact->setValue($info_key, $info_val); } } } try { $this->_contact->store(); } catch (Turba_Exception $e) { Horde::log($e, 'ERR'); $notification->push(_("There was an error saving the contact. Contact your system administrator for further help."), 'horde.error'); throw $e; } if (isset($info['vfs'])) { try { $this->_contact->addFile($info['vfs']); $notification->push(sprintf(_("\"%s\" updated."), $this->_contact->getValue('name')), 'horde.success'); } catch (Turba_Exception $e) { $notification->push(sprintf(_("\"%s\" updated, but saving the uploaded file failed: %s"), $this->_contact->getValue('name'), $e->getMessage()), 'horde.warning'); } } else { $notification->push(sprintf(_("\"%s\" updated."), $this->_contact->getValue('name')), 'horde.success'); } return true; }