/** * @throws Vilma_Exception */ public function saveUser($info) { $create = empty($info['user_id']); $info['user_id'] = $this->_saveUser($info); if ($create) { try { Vilma_MailboxDriver::factory()->createMailbox(Vilma::stripUser($info['user_name']), Vilma::stripDomain($info['user_name'])); } catch (Exception $e) { $this->_deleteUser($info['user_id']); throw $e; } } if (isset($GLOBALS['conf']['mta']['auth_update_script']) && !empty($info['password'])) { $cmd = sprintf('%s set %s %s 2>&1', $GLOBALS['conf']['mta']['auth_update_script'], escapeshellarg($info['user_name']), escapeshellarg($info['password'])); $msg = system($cmd, $ec); if ($msg === false) { throw new Vilma_Exception(_("Error running authentication update script.")); } if ($ec != 0) { throw new Vilma_Exception(_("Unknown error running authentication update script.")); } } }
/** * Returns information for a virtual id. * * @param integer $virtual_id The virtual id for which to return * information. * * @return array The virtual email information. */ public function getVirtual($virtual_id) { $sql = 'SELECT ' . $this->_getTableFields('virtuals') . ' FROM ' . $this->_params['tables']['virtuals'] . ' WHERE ' . $this->_getTableField('virtuals', 'virtual_id') . ' = ?'; $virtual = $this->_db->selectOne($sql, array((int) $virtual_id)); $virtual['stripped_email'] = Vilma::stripUser($virtual['virtual_email']); return $virtual; }
$vars = Horde_Variables::getDefaultVariables(); $address = $vars->address; $section = $vars->get('section', 'all'); $domain = Vilma::stripDomain($address); /* Check if a form is being edited. */ if (!isset($vars->mode)) { if ($address) { try { $address = $vilma->driver->getAddressInfo($address, $section); } catch (Exception $e) { $notification->push(sprintf(_("Error reading address information from backend: %s"), $e->getMessage()), 'horde.error'); Horde::url('users/index.php', true)->redirect(); } $vars = new Horde_Variables($address); $user_name = $vars->get('user_name'); $vars->user_name = Vilma::stripUser($user_name); $domain = Vilma::stripDomain($user_name); $vars->domain = $domain; $vars->type = $address['type']; $vars->target = 'test'; //$address['target']); $vars->mode = 'edit'; } else { $vars->mode = 'new'; $domain_info = $session->get('vilma', 'domain'); $domain = $domain_info['domain_name']; $domain_id = $domain_info['domain_id']; $vars->domain = $domain; $vars->id = $domain_id; $vars->add('user_name', Horde_Util::getFormData('user_name', '')); }
/** * Returns information for a virtual id. * * @param integer $virtual_id The virtual id for which to return * information. * * @return array The virtual email information. */ public function getVirtual($virtual_id) { $sql = 'SELECT ' . $this->_getTableFields('virtuals') . ' FROM ' . $this->_params['tables']['virtuals'] . ' WHERE ' . $this->_getTableField('virtuals', 'virtual_id') . ' = ?'; Horde::log($sql, 'DEBUG'); $virtual = $this->_db->getRow($sql, array((int) $virtual_id), DB_FETCHMODE_ASSOC); $virtual['stripped_email'] = Vilma::stripUser($virtual['virtual_email']); return $virtual; }