get('fileroot', $app) . '/config'; $current_config = @file_get_contents($path . '/conf.php'); /* Calculate the differences. */ $diff = &new Text_Diff(explode("\n", $current_config), explode("\n", $_SESSION['_config'][$app])); $diff = $renderer->render($diff); if (!empty($diff)) { return $diff; } else { return _("No change."); } } $diffs = array(); /* Only bother to do anything if there is any config. */ if (!empty($_SESSION['_config'])) { /* Set up the toggle button for inline/unified. */ $url = Horde::applicationUrl('admin/setup/diff.php'); $url = Util::addParameter($url, 'render', ($render_type == 'inline') ? 'unified' : 'inline'); if ($app = Util::getFormData('app')) { /* Handle a single app request. */ $toggle_renderer = Horde::link($url . '#' . $app) . (($render_type == 'inline') ? _("unified") : _("inline")) . ''; $diff = _getDiff($app); if ($render_type != 'inline') { $diff = htmlspecialchars($diff); } $diffs[] = array('app' => $app, 'diff' => $diff, 'toggle_renderer' => $toggle_renderer); } else { /* List all the apps with generated configuration. */ ksort($_SESSION['_config']); foreach ($_SESSION['_config'] as $app => $config) { $toggle_renderer = Horde::link($url . '#' . $app) . (($render_type == 'inline') ? _("unified") : _("inline")) . ''; $diff = _getDiff($app); if ($render_type != 'inline') { $diff = htmlspecialchars($diff); } $diffs[] = array('app' => $app, 'diff' => $diff, 'toggle_renderer' => $toggle_renderer); } } } /* Set up the template. */ $template = &new Horde_Template(); $template->setOption('gettext', true); $template->set('diffs', $diffs, true); $title = _("Configuration Differences"); require HORDE_TEMPLATES . '/common-header.inc'; echo $template->fetch(HORDE_TEMPLATES . '/admin/setup/diff.html'); require HORDE_TEMPLATES . '/common-footer.inc';