Copyright 2002-2016 Horde LLC (http://www.horde.org/)
See the enclosed file COPYING for license information (LGPL). If you
did not receive this file, see http://www.horde.org/licenses/lgpl21.
* @package Horde */ require_once __DIR__ . '/../../lib/Application.php'; Horde_Registry::appInit('horde', array('permission' => array('horde:administration:configuration'))); if (!Horde_Util::extensionExists('domxml') && !Horde_Util::extensionExists('dom')) { throw new Horde_Exception('You need the domxml or dom PHP extension to use the configuration tool.'); } $vars = $injector->getInstance('Horde_Variables'); $app = $vars->app; $appname = $registry->get('name', $app); $title = sprintf(_("%s Configuration"), $appname); if (empty($app) || !in_array($app, $registry->listAllApps())) { $notification->push(_("Invalid application."), 'horde.error'); Horde::url('admin/config/index.php', true)->redirect(); } $form = new Horde_Config_Form($vars, $app); $form->setButtons(sprintf(_("Generate %s Configuration"), $appname)); if (file_exists($registry->get('fileroot', $app) . '/config/conf.bak.php')) { $form->appendButtons(_("Revert Configuration")); } $php = ''; $path = $registry->get('fileroot', $app) . '/config'; $configFile = $path . '/conf.php'; if (is_link($configFile)) { $configFile = readlink($configFile); } if ($vars->submitbutton == _("Revert Configuration")) { if (@copy($path . '/conf.bak.php', $configFile)) { $notification->push(_("Successfully reverted configuration. Reload to see changes."), 'horde.success'); @unlink($path . '/conf.bak.php'); } else {
} try { $versions = $hconfig->checkVersions(); } catch (Horde_Exception $e) { $notification->push(_("Could not contact server. Try again later."), 'horde.error'); } } /* Update configurations if requested. */ if ($vars->action == 'config') { foreach ($a as $app) { $path = $registry->get('fileroot', $app) . '/config'; if (!file_exists($path . '/conf.xml') || file_exists($path . '/conf.php') && ($xml_ver = $hconfig->getVersion(@file_get_contents($path . '/conf.xml'))) !== false && ($php_ver = $hconfig->getVersion(@file_get_contents($path . '/conf.php'))) !== false && $xml_ver == $php_ver) { continue; } $vars = new Horde_Variables(); $form = new Horde_Config_Form($vars, $app, true); $form->setSubmitted(true); if ($form->validate($vars)) { $config = new Horde_Config($app); if (!$config->writePHPConfig($vars)) { $notification->push(sprintf(_("Could not save the configuration file %s. Use one of the options below to save the code."), Horde_Util::realPath($config->configFile())), 'horde.warning', array('content.raw', 'sticky')); } } else { $notification->push(sprintf(_("The configuration for %s cannot be updated automatically. Please update the configuration manually."), $app), 'horde.error'); } } } /* Update schema if requested. */ if ($vars->action == 'schema') { $apps = isset($vars->app) ? array($vars->app) : $migration->apps; foreach ($apps as $app) {