* The Vilma script to add/edit aliases. * * Copyright 2003-2015 Horde LLC (http://www.horde.org/) * * See the enclosed file LICENSE for license information (BSD). If you did * did not receive this file, see http://cvs.horde.org/co.php/vilma/LICENSE. * * @author Daniel Collins <*****@*****.**> */ require_once __DIR__ . '/../lib/Application.php'; $vilma = Horde_Registry::appInit('vilma'); /* Only admin should be using this. */ if (!Vilma::hasPermission($domain)) { throw new Horde_Exception_AuthenticationFailure(); } $vars = Variables::getDefaultVariables(); /* If the form is submitted, $vars['mode'] will be set. Catch this and process * the submission so that the displayed form accurately indicates the result of * the transaction. */ if (isset($vars->mode)) { $form = new Vilma_Form_EditAlias($vars); if ($form->validate($vars)) { $form->getInfo($vars, $info); try { $alias_id = $vilma->driver->saveAlias($info); $notification->push(_("Alias saved."), 'horde.success'); Horde::url('users/index.php', true)->add('domain_id', $domain['id'])->redirect(); } catch (Exception $e) { Horde::log($e); $notification->push(sprintf(_("Error saving alias. %s"), $e->getMessage()), 'horde.error'); // Remove the mode, and rearrange the alias information to clean
function appConfig($is_config_ok) { if ($is_config_ok) { $run_config = $this->cli->prompt(_("All the installed applications seem to be configured, reconfigure any app?"), array('y' => _("Yes"), 'n' => _("No"))); if ($run_config == 'n') { return true; } } global $registry; $applist = $registry->listApps(array('hidden', 'notoolbar', 'active')); sort($applist); $apps = array(0 => _("All applications")); foreach ($applist as $app) { if (@file_exists($registry->getParam('fileroot', $app) . '/config/conf.xml')) { array_push($apps, $app); } } $apps = $apps + array('x' => 'exit'); $app_choice = $this->cli->prompt(_("Which app do you wish to reconfigure?"), $apps); if ($app_choice == 'x') { return true; } if ($app_choice > 0) { $apps = array($apps[$app_choice]); } else { $apps = array_slice($apps, 1, count($apps) - 2); } $vars = Variables::getDefaultVariables(); foreach ($apps as $app) { $config =& new Horde_Config($app); $php = $config->generatePHPConfig($vars); $fp = @fopen($registry->getParam('fileroot', $app) . '/config/conf.php', 'w'); if ($fp) { fwrite($fp, String::convertCharset($php, NLS::getCharset(), 'iso-8859-1')); fclose($fp); $this->log(sprintf(_("Wrote configuration file '%s'."), $registry->getParam('fileroot', $app) . '/config/conf.php'), 'success'); } else { $this->log(sprintf(_("Can not write configuration file '%s'."), $registry->getParam('fileroot', $app) . '/config/conf.php'), 'error'); } } }