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."));
}
}
}