Setup -> Configuration
authorJan Schneider <jan@horde.org>
Thu, 9 Sep 2010 16:25:19 +0000 (18:25 +0200)
committerJan Schneider <jan@horde.org>
Thu, 9 Sep 2010 16:25:19 +0000 (18:25 +0200)
22 files changed:
ansel/docs/INSTALL
framework/Kolab_Filter/lib/Horde/Kolab/Test/Filter.php
framework/Kolab_Storage/test/Horde/Kolab/Storage/Scenario.php
horde/admin/config/config.php [new file with mode: 0644]
horde/admin/config/diff.php [new file with mode: 0644]
horde/admin/config/index.php [new file with mode: 0644]
horde/admin/config/scripts.php [new file with mode: 0644]
horde/admin/setup/config.php [deleted file]
horde/admin/setup/diff.php [deleted file]
horde/admin/setup/index.php [deleted file]
horde/admin/setup/scripts.php [deleted file]
horde/docs/INSTALL
horde/docs/SECURITY
horde/lib/Api.php
horde/templates/admin/config/config.html [new file with mode: 0644]
horde/templates/admin/config/diff.html [new file with mode: 0644]
horde/templates/admin/config/index.html [new file with mode: 0644]
horde/templates/admin/setup/config.html [deleted file]
horde/templates/admin/setup/diff.html [deleted file]
horde/templates/admin/setup/index.html [deleted file]
imp/docs/INSTALL
koward/lib/Koward/Test.php

index fd52ca6..c16602e 100644 (file)
@@ -121,10 +121,10 @@ To function properly, Ansel **requires** the following:
 6. The _`ImageMagick` software.
 
    If using the `ImageMagick software`_ you need to set the path to the
-   ``convert`` utility in Horde's setup screen
-   (``Administration/Setup/Horde/Image Manipulation``). You can alternatively
-   use the GD_ extension or the imagick_ extension, but one of these is
-   **required**.
+   ``convert`` utility in Horde's configuration screen
+   (``Administration/Configuration/Horde/Image Manipulation``). You can
+   alternatively use the GD_ extension or the imagick_ extension, but one of
+   these is **required**.
 
    .. _`ImageMagick software`: http://www.imagemagick.org/
 
index ca2be7e..637a34a 100644 (file)
@@ -136,7 +136,7 @@ class Horde_Kolab_Test_Filter
 \$conf['portal']['fixed_blocks'] = array();
 \$conf['imsp']['enabled'] = false;
 
-/** Additional config variables required for a clean Horde setup */
+/** Additional config variables required for a clean Horde configuration */
 \$conf['session']['use_only_cookies'] = false;
 \$conf['session']['timeout'] = 0;
 \$conf['cookie']['path'] = '/';
index 84c99f3..715b7df 100644 (file)
@@ -180,7 +180,7 @@ class Horde_Kolab_Storage_Scenario extends Horde_Kolab_Server_Integration_Scenar
 \$conf['portal']['fixed_blocks'] = array();
 \$conf['imsp']['enabled'] = false;
 
-/** Additional config variables required for a clean Horde setup */
+/** Additional config variables required for a clean Horde configuration */
 \$conf['session']['use_only_cookies'] = false;
 \$conf['session']['timeout'] = 0;
 \$conf['cookie']['path'] = '/';
diff --git a/horde/admin/config/config.php b/horde/admin/config/config.php
new file mode 100644 (file)
index 0000000..dafcb81
--- /dev/null
@@ -0,0 +1,97 @@
+<?php
+/**
+ * Copyright 1999-2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ */
+
+require_once dirname(__FILE__) . '/../../lib/Application.php';
+Horde_Registry::appInit('horde', array('admin' => true));
+
+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.');
+}
+
+$app = Horde_Util::getFormData('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();
+}
+
+$vars = Horde_Variables::getDefaultVariables();
+
+$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 = '';
+if (Horde_Util::getFormData('submitbutton') == _("Revert Configuration")) {
+    $path = $registry->get('fileroot', $app) . '/config';
+    if (@copy($path . '/conf.bak.php', $path . '/conf.php')) {
+        $notification->push(_("Successfully reverted configuration. Reload to see changes."), 'horde.success');
+        @unlink($path . '/conf.bak.php');
+    } else {
+        $notification->push(_("Could not revert configuration."), 'horde.error');
+    }
+} elseif ($form->validate($vars)) {
+    $config = new Horde_Config($app);
+    $php = $config->generatePHPConfig($vars);
+    $path = $registry->get('fileroot', $app) . '/config';
+    if (file_exists($path . '/conf.php')) {
+        if (@copy($path . '/conf.php', $path . '/conf.bak.php')) {
+            $notification->push(sprintf(_("Successfully saved the backup configuration file %s."), Horde_Util::realPath($path . '/conf.bak.php')), 'horde.success');
+        } else {
+            $notification->push(sprintf(_("Could not save the backup configuration file %s."), Horde_Util::realPath($path . '/conf.bak.php')), 'horde.warning');
+        }
+    }
+    if ($fp = @fopen($path . '/conf.php', 'w')) {
+        /* Can write, so output to file. */
+        fwrite($fp, Horde_String::convertCharset($php, $GLOBALS['registry']->getCharset(), 'iso-8859-1'));
+        fclose($fp);
+        $notification->push(sprintf(_("Successfully wrote %s"), Horde_Util::realPath($path . '/conf.php')), 'horde.success');
+        $registry->clearCache();
+        Horde::url('admin/config/index.php', true)->redirect();
+    } else {
+        /* Cannot write. */
+        $notification->push(sprintf(_("Could not save the configuration file %s. You can either use one of the options to save the code back on %s or copy manually the code below to %s."), Horde_Util::realPath($path . '/conf.php'), Horde::link(Horde::url('admin/config/index.php') . '#update', _("Configuration")) . _("Configuration") . '</a>', Horde_Util::realPath($path . '/conf.php')), 'horde.warning', array('content.raw'));
+        /* Save to session. */
+        $_SESSION['_config'][$app] = $php;
+    }
+} elseif ($form->isSubmitted()) {
+    $notification->push(_("There was an error in the configuration form. Perhaps you left out a required field."), 'horde.error');
+}
+
+/* Set up the template. */
+$template = $injector->createInstance('Horde_Template');
+$template->set('php', htmlspecialchars($php), true);
+/* Create the link for the diff popup only if stored in session. */
+$diff_link = '';
+if (!empty($_SESSION['_config'][$app])) {
+    $url = Horde::url('admin/config/diff.php', true)->add('app', $app);
+    $diff_link = Horde::link('#', '', '', '', Horde::popupJs($url, array('height' => 480, 'width' => 640, 'urlencode' => true)) . 'return false;') . _("show differences") . '</a>';
+}
+$template->set('diff_popup', $diff_link, true);
+$template->setOption('gettext', true);
+
+require HORDE_TEMPLATES . '/common-header.inc';
+require HORDE_TEMPLATES . '/admin/menu.inc';
+
+/* Render the configuration form. */
+$renderer = $form->getRenderer();
+$renderer->setAttrColumnWidth('50%');
+
+Horde::startBuffer();
+$form->renderActive($renderer, $vars, 'config.php', 'post');
+$template->set('form', Horde::endBuffer());
+
+echo $template->fetch(HORDE_TEMPLATES . '/admin/config/config.html');
+require HORDE_TEMPLATES . '/common-footer.inc';
diff --git a/horde/admin/config/diff.php b/horde/admin/config/diff.php
new file mode 100644 (file)
index 0000000..20e001b
--- /dev/null
@@ -0,0 +1,83 @@
+<?php
+/**
+ * Script to show the differences between the currently saved and the newly
+ * generated configuration.
+ *
+ * Copyright 2004-2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ */
+
+require_once dirname(__FILE__) . '/../../lib/Application.php';
+Horde_Registry::appInit('horde', array('admin' => true));
+
+/* Set up the diff renderer. */
+$render_type = Horde_Util::getFormData('render', 'inline');
+$class = 'Text_Diff_Renderer_' . $render_type;
+$renderer = new $class();
+
+/**
+ * Private function to render the differences for a specific app.
+ */
+function _getDiff($app)
+{
+    global $renderer, $registry;
+
+    /* Read the existing configuration. */
+    $current_config = '';
+    $path = $registry->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::url('admin/config/diff.php')->add('render', ($render_type == 'inline') ? 'unified' : 'inline');
+
+    if ($app = Horde_Util::getFormData('app')) {
+        /* Handle a single app request. */
+        $toggle_renderer = Horde::link($url . '#' . $app) . (($render_type == 'inline') ? _("unified") : _("inline")) . '</a>';
+        $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")) . '</a>';
+            $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 = $injector->createInstance('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/config/diff.html');
+require HORDE_TEMPLATES . '/common-footer.inc';
diff --git a/horde/admin/config/index.php b/horde/admin/config/index.php
new file mode 100644 (file)
index 0000000..a92317f
--- /dev/null
@@ -0,0 +1,231 @@
+<?php
+/**
+ * Horde web configuration script.
+ *
+ * Copyright 1999-2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ */
+
+require_once dirname(__FILE__) . '/../../lib/Application.php';
+Horde_Registry::appInit('horde', array('admin' => true));
+
+/**
+ * Does an FTP upload to save the configuration.
+ */
+function _uploadFTP($params)
+{
+    global $registry, $notification;
+
+    $params['hostspec'] = 'localhost';
+    try {
+        $vfs = VFS::factory('ftp', $params);
+    } catch (VFS_Exception $e) {
+        $notification->push(sprintf(_("Could not connect to server \"%s\" using FTP: %s"), $params['hostspec'], $e->getMessage()), 'horde.error');
+        return false;
+    }
+
+    /* Loop through the config and write to FTP. */
+    $no_errors = true;
+    foreach ($_SESSION['_config'] as $app => $config) {
+        $path = $registry->get('fileroot', $app) . '/config';
+        /* Try to back up the current conf.php. */
+        if ($vfs->exists($path, 'conf.php')) {
+            try {
+                $vfs->rename($path, 'conf.php', $path, '/conf.bak.php');
+                $notification->push(_("Successfully saved backup configuration."), 'horde.success');
+            } catch (VFS_Exception $e) {
+                $notification->push(sprintf(_("Could not save a backup configuation: %s"), $e->getMessage()), 'horde.error');
+            }
+        }
+
+        try {
+            $vfs->writeData($path, 'conf.php', $config);
+            $notification->push(sprintf(_("Successfully wrote %s"), Horde_Util::realPath($path . '/conf.php')), 'horde.success');
+            unset($_SESSION['_config'][$app]);
+        } catch (VFS_Exception $e) {
+            $no_errors = false;
+            $notification->push(sprintf(_("Could not write configuration for \"%s\": %s"), $app, $e->getMessage()), 'horde.error');
+        }
+    }
+    $registry->clearCache();
+    return $no_errors;
+}
+
+$hconfig = new Horde_Config();
+
+/* Check for versions if requested. */
+$versions = array();
+if (Horde_Util::getFormData('check_versions')) {
+    try {
+        $versions = $hconfig->checkVersions();
+    } catch (Horde_Exception $e) {
+        $notification->push(_("Could not contact server. Try again later."), 'horde.error');
+    }
+}
+
+/* Set up some icons. */
+$success = Horde::img('alerts/success.png');
+$warning = Horde::img('alerts/warning.png');
+$error = Horde::img('alerts/error.png');
+
+$conf_url = Horde::url('admin/config/config.php');
+$a = $registry->listAllApps();
+$apps = array();
+$i = -1;
+if (file_exists(HORDE_BASE . '/lib/bundle.php')) {
+    include HORDE_BASE . '/lib/bundle.php';
+    $apps[0] = array('sort' => '00',
+                     'name' => '<strong>' . BUNDLE_FULLNAME . '</strong>',
+                     'icon' => Horde::img($registry->get('icon', 'horde'),
+                                          BUNDLE_FULLNAME, '', ''),
+                     'version' => '<strong>' . BUNDLE_VERSION . '</strong>');
+    if (!empty($versions)) {
+        if (!isset($versions[BUNDLE_NAME])) {
+            $apps[0]['load'] = $warning;
+            $apps[0]['vstatus'] = _("No stable version exists yet.");
+        } elseif (version_compare($versions[BUNDLE_NAME]['version'], BUNDLE_VERSION, '>')) {
+            $apps[0]['load'] = $error;
+            $apps[0]['vstatus'] = Horde::link($versions[BUNDLE_NAME]['url'], sprintf(_("Download %s"), BUNDLE_FULLNAME)) . sprintf(_("A newer version (%s) exists."), $versions[BUNDLE_NAME]['version']) . '</a> ';
+        } else {
+            $apps[0]['load'] = $success;
+            $apps[0]['vstatus'] = _("Application is up-to-date.");
+        }
+    }
+    $i++;
+}
+
+foreach ($a as $app) {
+    /* Skip app if no conf.xml file. */
+    $path = $registry->get('fileroot', $app) . '/config';
+    if (!file_exists($path . '/conf.xml')) {
+        continue;
+    }
+
+    $i++;
+    $path = $registry->get('fileroot', $app) . '/config';
+
+    $conf_link = Horde::link($conf_url->copy()->add('app', $app), sprintf(_("Configure %s"), $app));
+    $apps[$i]['sort'] = $registry->get('name', $app) . ' (' . $app . ')';
+    $apps[$i]['name'] = $conf_link . $apps[$i]['sort'] . '</a>';
+    $apps[$i]['icon'] = Horde::img($registry->get('icon', $app), $registry->get('name', $app), '', '');
+    $apps[$i]['version'] = '';
+    if ($version = $registry->getVersion($app, true)) {
+        $apps[$i]['version'] = $version;
+        if (!empty($versions)) {
+            if (!isset($versions[$app])) {
+                $apps[$i]['load'] = $warning;
+                $apps[$i]['vstatus'] = _("No stable version exists yet.");
+            } elseif (version_compare(preg_replace('/H\d \((.*)\)/', '$1', $versions[$app]['version']), $apps[$i]['version'], '>')) {
+                $apps[$i]['load'] = $error;
+                $apps[$i]['vstatus'] = Horde::link($versions[$app]['url'], sprintf(_("Download %s"), $app)) . sprintf(_("A newer version (%s) exists."), $versions[$app]['version']) . '</a> ';
+            } else {
+                $apps[$i]['load'] = $success;
+                $apps[$i]['vstatus'] = _("Application is up-to-date.");
+            }
+        }
+    }
+
+    if (!file_exists($path . '/conf.php')) {
+        /* No conf.php exists. */
+        $apps[$i]['conf'] = $conf_link . $error . '</a>';
+        $apps[$i]['status'] = _("Missing configuration. You must generate it before using this application.");
+    } else {
+        /* A conf.php exists, get the xml version. */
+        if (($xml_ver = $hconfig->getVersion(@file_get_contents($path . '/conf.xml'))) === false) {
+            $apps[$i]['conf'] = $conf_link . $warning . '</a>';
+            $apps[$i]['status'] = _("No version found in original configuration. Regenerate configuration.");
+            continue;
+        }
+        /* Get the generated php version. */
+        if (($php_ver = $hconfig->getVersion(@file_get_contents($path . '/conf.php'))) === false) {
+            /* No version found in generated php, suggest regenarating
+             * just in case. */
+            $apps[$i]['conf'] = $conf_link . $warning . '</a>';
+            $apps[$i]['status'] = _("No version found in your configuration. Regenerate configuration.");
+            continue;
+        }
+
+        if ($xml_ver != $php_ver) {
+            /* Versions are not the same, configuration is out of date. */
+            $apps[$i]['conf'] = $conf_link . $error . '</a>';
+            $apps[$i]['status'] = _("Configuration is out of date.");
+            continue;
+        } else {
+            /* Configuration is ok. */
+            $apps[$i]['conf'] = $conf_link . $success . '</a>';
+            $apps[$i]['status'] = _("Application is ready.");
+        }
+    }
+}
+
+/* Sort the apps by name. */
+Horde_Array::arraySort($apps, 'sort');
+
+/* Set up any actions that may be offered. */
+$actions = array();
+$ftpform = '';
+if (!empty($_SESSION['_config'])) {
+    $url = Horde::url('admin/config/diff.php');
+    $action = _("Show differences between currently saved and the newly generated configuration.");
+    $actions[] = array('icon' => Horde::img('search.png', '', 'align="middle"'),
+                       'link' => Horde::link('#', '', '', '', Horde::popupJs($url, array('height' => 480, 'width' => 640, 'urlencode' => true)) . 'return false;') . $action . '</a>');
+
+    /* Action to download the configuration upgrade PHP script. */
+    $url = Horde::url('admin/config/scripts.php')->add(array('setup' => 'conf', 'type' => 'php'));
+    $action = _("Download generated configuration as PHP script.");
+    $actions[] = array('icon' => Horde::img('download.png', '', 'align="middle"'),
+                       'link' => Horde::link($url) . $action . '</a>');
+    /* Action to save the configuration upgrade PHP script. */
+    $action = _("Save generated configuration as a PHP script to your server's temporary directory.");
+    $actions[] = array('icon' => Horde::img('save.png', '', 'align="middle"'),
+                       'link' => Horde::link($url->add('save', 'tmp')) . $action . '</a>');
+
+    /* Set up the form for FTP upload of scripts. */
+    $vars = Horde_Variables::getDefaultVariables();
+    $ftpform = new Horde_Form($vars);
+    $ftpform->setButtons(_("Upload"), true);
+    $ftpform->addVariable(_("Username"), 'username', 'text', true, false, null, array('', 20));
+    $ftpform->addVariable(_("Password"), 'password', 'password', false);
+
+    if ($ftpform->validate($vars)) {
+        $ftpform->getInfo($vars, $info);
+        $upload = _uploadFTP($info);
+        if ($upload) {
+            $notification->push(_("Uploaded all application configuration files to the server."), 'horde.success');
+            Horde::url('admin/config/index.php', true)->redirect();
+        }
+    }
+    /* Render the form. */
+    Horde::startBuffer();
+    $ftpform->renderActive(new Horde_Form_Renderer(), $vars, 'index.php', 'post');
+    $ftpform = Horde::endBuffer();
+}
+
+if (file_exists(Horde::getTempDir() . '/horde_configuration_upgrade.php')) {
+    /* Action to remove the configuration upgrade PHP script. */
+    $url = Horde::url('admin/config/scripts.php')->add('clean', 'tmp');
+    $action = _("Remove saved script from server's temporary directory.");
+    $actions[] = array('icon' => Horde::img('delete.png', '', 'align="middle"'),
+                       'link' => Horde::link($url) . $action . '</a>');
+}
+
+/* Set up the template. */
+$template = $injector->createInstance('Horde_Template');
+$template->setOption('gettext', true);
+$template->set('versions', !empty($versions), true);
+$template->set('version_action', Horde::url('admin/config/index.php'));
+$template->set('version_input', Horde_Util::formInput());
+$template->set('apps', $apps);
+$template->set('actions', $actions, true);
+$template->set('ftpform', $ftpform, true);
+
+$title = sprintf(_("%s Configuration"), $registry->get('name', 'horde'));
+Horde::addScriptFile('stripe.js', 'horde');
+require HORDE_TEMPLATES . '/common-header.inc';
+require HORDE_TEMPLATES . '/admin/menu.inc';
+echo $template->fetch(HORDE_TEMPLATES . '/admin/config/index.html');
+require HORDE_TEMPLATES . '/common-footer.inc';
diff --git a/horde/admin/config/scripts.php b/horde/admin/config/scripts.php
new file mode 100644 (file)
index 0000000..b09777f
--- /dev/null
@@ -0,0 +1,100 @@
+<?php
+/**
+ * Generates upgrade scripts for Horde's configuration.
+ *
+ * Currently allows the generation of PHP upgrade scripts for conf.php
+ * files either as download or saved to the server's temporary
+ * directory.
+ *
+ * Copyright 1999-2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @author Chuck Hagenbuch <chuck@horde.org>
+ */
+
+require_once dirname(__FILE__) . '/../../lib/Application.php';
+Horde_Registry::appInit('horde', array('admin' => true));
+
+/* Get form data. */
+$setup = Horde_Util::getFormData('setup');
+$type = Horde_Util::getFormData('type');
+$save = Horde_Util::getFormData('save');
+$clean = Horde_Util::getFormData('clean');
+
+$filename = 'horde_configuration_upgrade.php';
+
+/* Check if this is only a request to clean up. */
+if ($clean == 'tmp') {
+    $tmp_dir = Horde::getTempDir();
+    $path = Horde_Util::realPath($tmp_dir . '/' . $filename);
+    if (@unlink($tmp_dir . '/' . $filename)) {
+        $notification->push(sprintf(_("Deleted configuration upgrade script \"%s\"."), $path), 'horde.success');
+    } else {
+        $notification->push(sprintf(_("Could not delete configuration upgrade script \"%s\"."), Horde_Util::realPath($path)), 'horde.error');
+    }
+    $registry->clearCache();
+    Horde::url('admin/config/index.php', true)->redirect();
+}
+
+$data = '';
+if ($setup == 'conf' && $type == 'php') {
+    /* A bit ugly here, save PHP code into a string for creating the script
+     * to be run at the command prompt. */
+    $data = '#!/usr/bin/env php' . "\n";
+    $data .= '<?php' . "\n";
+    foreach ($_SESSION['_config'] as $app => $php) {
+        $path = $registry->get('fileroot', $app) . '/config';
+        /* Add code to save backup. */
+        $data .= 'if (file_exists(\'' . $path . '/conf.php\')) {' . "\n";
+        $data .= '    if (@copy(\'' . $path . '/conf.php\', \'' . $path . '/conf.bak.php\')) {' . "\n";
+        $data .= '        echo \'Successfully saved backup configuration.\' . "\n";' . "\n";
+        $data .= '    } else {' . "\n";
+        $data .= '        echo \'Could NOT save a backup configuation.\' . "\n";' . "\n";
+        $data .= '    }' . "\n";
+        $data .= '}' . "\n";
+
+        $data .= 'if ($fp = @fopen(\'' . $path . '/conf.php\', \'w\')) {' . "\n";
+        $data .= '    fwrite($fp, \'';
+        $data .= Horde_String::convertCharset(str_replace(array('\\', '\''),
+                                                    array('\\\\', '\\\''),
+                                                    $php),
+                                        $GLOBALS['registry']->getCharset(), 'iso-8859-1');
+        $data .= '\');' . "\n";
+        $data .= '    fclose($fp);' . "\n";
+        $data .= '    echo \'' . sprintf('Saved %s configuration.', $app) . '\' . "\n";' . "\n";
+        $data .= '} else {' . "\n";
+        $data .= '    echo \'' . sprintf('Could NOT save %s configuration.', $app) . '\' . "\n";' . "\n";
+        $data .= '    exit;' . "\n";
+        $data .= '}' . "\n\n";
+    }
+}
+
+if ($save != 'tmp') {
+    /* Output script to browser for download. */
+    $browser->downloadHeaders($filename, 'text/plain', false, strlen($data));
+    echo $data;
+    exit;
+}
+
+$tmp_dir = Horde::getTempDir();
+/* Add self-destruct code. */
+$data .= 'echo \'Self-destructing...\' . "\n";' . "\n";
+$data .= 'if (unlink(__FILE__)) {' . "\n";
+$data .= '    echo \'Upgrade script deleted.\' . "\n";' . "\n";
+$data .= '} else {' . "\n";
+$data .= '    echo \'WARNING!!! REMOVE SCRIPT MANUALLY FROM ' . $tmp_dir . '\' . "\n";' . "\n";
+$data .= '}' . "\n";
+/* The script should be saved to server's temporary directory. */
+$path = Horde_Util::realPath($tmp_dir . '/' . $filename);
+if ($fp = @fopen($tmp_dir . '/' . $filename, 'w')) {
+    fwrite($fp, $data);
+    fclose($fp);
+    chmod($tmp_dir . '/' . $filename, 0777);
+    $notification->push(sprintf(_("Saved configuration upgrade script to: \"%s\"."), $path), 'horde.success');
+} else {
+    $notification->push(sprintf(_("Could not save configuration upgrade script to: \"%s\"."), $path), 'horde.error');
+}
+
+Horde::url('admin/config/index.php', true)->redirect();
diff --git a/horde/admin/setup/config.php b/horde/admin/setup/config.php
deleted file mode 100644 (file)
index 91880ec..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-<?php
-/**
- * Copyright 1999-2010 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @author Chuck Hagenbuch <chuck@horde.org>
- */
-
-require_once dirname(__FILE__) . '/../../lib/Application.php';
-Horde_Registry::appInit('horde', array('admin' => true));
-
-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.');
-}
-
-$app = Horde_Util::getFormData('app');
-$appname = $registry->get('name', $app);
-$title = sprintf(_("%s Setup"), $appname);
-
-if (empty($app) || !in_array($app, $registry->listAllApps())) {
-    $notification->push(_("Invalid application."), 'horde.error');
-    Horde::url('admin/setup/index.php', true)->redirect();
-}
-
-$vars = Horde_Variables::getDefaultVariables();
-
-$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 = '';
-if (Horde_Util::getFormData('submitbutton') == _("Revert Configuration")) {
-    $path = $registry->get('fileroot', $app) . '/config';
-    if (@copy($path . '/conf.bak.php', $path . '/conf.php')) {
-        $notification->push(_("Successfully reverted configuration. Reload to see changes."), 'horde.success');
-        @unlink($path . '/conf.bak.php');
-    } else {
-        $notification->push(_("Could not revert configuration."), 'horde.error');
-    }
-} elseif ($form->validate($vars)) {
-    $config = new Horde_Config($app);
-    $php = $config->generatePHPConfig($vars);
-    $path = $registry->get('fileroot', $app) . '/config';
-    if (file_exists($path . '/conf.php')) {
-        if (@copy($path . '/conf.php', $path . '/conf.bak.php')) {
-            $notification->push(sprintf(_("Successfully saved the backup configuration file %s."), Horde_Util::realPath($path . '/conf.bak.php')), 'horde.success');
-        } else {
-            $notification->push(sprintf(_("Could not save the backup configuration file %s."), Horde_Util::realPath($path . '/conf.bak.php')), 'horde.warning');
-        }
-    }
-    if ($fp = @fopen($path . '/conf.php', 'w')) {
-        /* Can write, so output to file. */
-        fwrite($fp, Horde_String::convertCharset($php, $GLOBALS['registry']->getCharset(), 'iso-8859-1'));
-        fclose($fp);
-        $notification->push(sprintf(_("Successfully wrote %s"), Horde_Util::realPath($path . '/conf.php')), 'horde.success');
-        $registry->clearCache();
-        Horde::url('admin/setup/index.php', true)->redirect();
-    } else {
-        /* Cannot write. */
-        $notification->push(sprintf(_("Could not save the configuration file %s. You can either use one of the options to save the code back on %s or copy manually the code below to %s."), Horde_Util::realPath($path . '/conf.php'), Horde::link(Horde::url('index.php') . '#update', _("Setup")) . _("Setup") . '</a>', Horde_Util::realPath($path . '/conf.php')), 'horde.warning', array('content.raw'));
-        /* Save to session. */
-        $_SESSION['_config'][$app] = $php;
-    }
-} elseif ($form->isSubmitted()) {
-    $notification->push(_("There was an error in the configuration form. Perhaps you left out a required field."), 'horde.error');
-}
-
-/* Set up the template. */
-$template = $injector->createInstance('Horde_Template');
-$template->set('php', htmlspecialchars($php), true);
-/* Create the link for the diff popup only if stored in session. */
-$diff_link = '';
-if (!empty($_SESSION['_config'][$app])) {
-    $url = Horde::url('admin/setup/diff.php', true)->add('app', $app);
-    $diff_link = Horde::link('#', '', '', '', Horde::popupJs($url, array('height' => 480, 'width' => 640, 'urlencode' => true)) . 'return false;') . _("show differences") . '</a>';
-}
-$template->set('diff_popup', $diff_link, true);
-$template->setOption('gettext', true);
-
-require HORDE_TEMPLATES . '/common-header.inc';
-require HORDE_TEMPLATES . '/admin/menu.inc';
-
-/* Render the configuration form. */
-$renderer = $form->getRenderer();
-$renderer->setAttrColumnWidth('50%');
-
-Horde::startBuffer();
-$form->renderActive($renderer, $vars, 'config.php', 'post');
-$template->set('form', Horde::endBuffer());
-
-echo $template->fetch(HORDE_TEMPLATES . '/admin/setup/config.html');
-require HORDE_TEMPLATES . '/common-footer.inc';
diff --git a/horde/admin/setup/diff.php b/horde/admin/setup/diff.php
deleted file mode 100644 (file)
index cc99f09..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-<?php
-/**
- * Script to show the differences between the currently saved and the newly
- * generated configuration.
- *
- * Copyright 2004-2010 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- */
-
-require_once dirname(__FILE__) . '/../../lib/Application.php';
-Horde_Registry::appInit('horde', array('admin' => true));
-
-/* Set up the diff renderer. */
-$render_type = Horde_Util::getFormData('render', 'inline');
-$class = 'Text_Diff_Renderer_' . $render_type;
-$renderer = new $class();
-
-/**
- * Private function to render the differences for a specific app.
- */
-function _getDiff($app)
-{
-    global $renderer, $registry;
-
-    /* Read the existing configuration. */
-    $current_config = '';
-    $path = $registry->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::url('admin/setup/diff.php')->add('render', ($render_type == 'inline') ? 'unified' : 'inline');
-
-    if ($app = Horde_Util::getFormData('app')) {
-        /* Handle a single app request. */
-        $toggle_renderer = Horde::link($url . '#' . $app) . (($render_type == 'inline') ? _("unified") : _("inline")) . '</a>';
-        $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")) . '</a>';
-            $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 = $injector->createInstance('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';
diff --git a/horde/admin/setup/index.php b/horde/admin/setup/index.php
deleted file mode 100644 (file)
index 77f2c65..0000000
+++ /dev/null
@@ -1,231 +0,0 @@
-<?php
-/**
- * Horde web setup script.
- *
- * Copyright 1999-2010 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @author Chuck Hagenbuch <chuck@horde.org>
- */
-
-require_once dirname(__FILE__) . '/../../lib/Application.php';
-Horde_Registry::appInit('horde', array('admin' => true));
-
-/**
- * Does an FTP upload to save the configuration.
- */
-function _uploadFTP($params)
-{
-    global $registry, $notification;
-
-    $params['hostspec'] = 'localhost';
-    try {
-        $vfs = VFS::factory('ftp', $params);
-    } catch (VFS_Exception $e) {
-        $notification->push(sprintf(_("Could not connect to server \"%s\" using FTP: %s"), $params['hostspec'], $e->getMessage()), 'horde.error');
-        return false;
-    }
-
-    /* Loop through the config and write to FTP. */
-    $no_errors = true;
-    foreach ($_SESSION['_config'] as $app => $config) {
-        $path = $registry->get('fileroot', $app) . '/config';
-        /* Try to back up the current conf.php. */
-        if ($vfs->exists($path, 'conf.php')) {
-            try {
-                $vfs->rename($path, 'conf.php', $path, '/conf.bak.php');
-                $notification->push(_("Successfully saved backup configuration."), 'horde.success');
-            } catch (VFS_Exception $e) {
-                $notification->push(sprintf(_("Could not save a backup configuation: %s"), $e->getMessage()), 'horde.error');
-            }
-        }
-
-        try {
-            $vfs->writeData($path, 'conf.php', $config);
-            $notification->push(sprintf(_("Successfully wrote %s"), Horde_Util::realPath($path . '/conf.php')), 'horde.success');
-            unset($_SESSION['_config'][$app]);
-        } catch (VFS_Exception $e) {
-            $no_errors = false;
-            $notification->push(sprintf(_("Could not write configuration for \"%s\": %s"), $app, $e->getMessage()), 'horde.error');
-        }
-    }
-    $registry->clearCache();
-    return $no_errors;
-}
-
-$hconfig = new Horde_Config();
-
-/* Check for versions if requested. */
-$versions = array();
-if (Horde_Util::getFormData('check_versions')) {
-    try {
-        $versions = $hconfig->checkVersions();
-    } catch (Horde_Exception $e) {
-        $notification->push(_("Could not contact server. Try again later."), 'horde.error');
-    }
-}
-
-/* Set up some icons. */
-$success = Horde::img('alerts/success.png');
-$warning = Horde::img('alerts/warning.png');
-$error = Horde::img('alerts/error.png');
-
-$conf_url = Horde::url('admin/setup/config.php');
-$a = $registry->listAllApps();
-$apps = array();
-$i = -1;
-if (file_exists(HORDE_BASE . '/lib/bundle.php')) {
-    include HORDE_BASE . '/lib/bundle.php';
-    $apps[0] = array('sort' => '00',
-                     'name' => '<strong>' . BUNDLE_FULLNAME . '</strong>',
-                     'icon' => Horde::img($registry->get('icon', 'horde'),
-                                          BUNDLE_FULLNAME, '', ''),
-                     'version' => '<strong>' . BUNDLE_VERSION . '</strong>');
-    if (!empty($versions)) {
-        if (!isset($versions[BUNDLE_NAME])) {
-            $apps[0]['load'] = $warning;
-            $apps[0]['vstatus'] = _("No stable version exists yet.");
-        } elseif (version_compare($versions[BUNDLE_NAME]['version'], BUNDLE_VERSION, '>')) {
-            $apps[0]['load'] = $error;
-            $apps[0]['vstatus'] = Horde::link($versions[BUNDLE_NAME]['url'], sprintf(_("Download %s"), BUNDLE_FULLNAME)) . sprintf(_("A newer version (%s) exists."), $versions[BUNDLE_NAME]['version']) . '</a> ';
-        } else {
-            $apps[0]['load'] = $success;
-            $apps[0]['vstatus'] = _("Application is up-to-date.");
-        }
-    }
-    $i++;
-}
-
-foreach ($a as $app) {
-    /* Skip app if no conf.xml file. */
-    $path = $registry->get('fileroot', $app) . '/config';
-    if (!file_exists($path . '/conf.xml')) {
-        continue;
-    }
-
-    $i++;
-    $path = $registry->get('fileroot', $app) . '/config';
-
-    $conf_link = Horde::link($conf_url->copy()->add('app', $app), sprintf(_("Configure %s"), $app));
-    $apps[$i]['sort'] = $registry->get('name', $app) . ' (' . $app . ')';
-    $apps[$i]['name'] = $conf_link . $apps[$i]['sort'] . '</a>';
-    $apps[$i]['icon'] = Horde::img($registry->get('icon', $app), $registry->get('name', $app), '', '');
-    $apps[$i]['version'] = '';
-    if ($version = $registry->getVersion($app, true)) {
-        $apps[$i]['version'] = $version;
-        if (!empty($versions)) {
-            if (!isset($versions[$app])) {
-                $apps[$i]['load'] = $warning;
-                $apps[$i]['vstatus'] = _("No stable version exists yet.");
-            } elseif (version_compare(preg_replace('/H\d \((.*)\)/', '$1', $versions[$app]['version']), $apps[$i]['version'], '>')) {
-                $apps[$i]['load'] = $error;
-                $apps[$i]['vstatus'] = Horde::link($versions[$app]['url'], sprintf(_("Download %s"), $app)) . sprintf(_("A newer version (%s) exists."), $versions[$app]['version']) . '</a> ';
-            } else {
-                $apps[$i]['load'] = $success;
-                $apps[$i]['vstatus'] = _("Application is up-to-date.");
-            }
-        }
-    }
-
-    if (!file_exists($path . '/conf.php')) {
-        /* No conf.php exists. */
-        $apps[$i]['conf'] = $conf_link . $error . '</a>';
-        $apps[$i]['status'] = _("Missing configuration. You must generate it before using this application.");
-    } else {
-        /* A conf.php exists, get the xml version. */
-        if (($xml_ver = $hconfig->getVersion(@file_get_contents($path . '/conf.xml'))) === false) {
-            $apps[$i]['conf'] = $conf_link . $warning . '</a>';
-            $apps[$i]['status'] = _("No version found in original configuration. Regenerate configuration.");
-            continue;
-        }
-        /* Get the generated php version. */
-        if (($php_ver = $hconfig->getVersion(@file_get_contents($path . '/conf.php'))) === false) {
-            /* No version found in generated php, suggest regenarating
-             * just in case. */
-            $apps[$i]['conf'] = $conf_link . $warning . '</a>';
-            $apps[$i]['status'] = _("No version found in your configuration. Regenerate configuration.");
-            continue;
-        }
-
-        if ($xml_ver != $php_ver) {
-            /* Versions are not the same, configuration is out of date. */
-            $apps[$i]['conf'] = $conf_link . $error . '</a>';
-            $apps[$i]['status'] = _("Configuration is out of date.");
-            continue;
-        } else {
-            /* Configuration is ok. */
-            $apps[$i]['conf'] = $conf_link . $success . '</a>';
-            $apps[$i]['status'] = _("Application is ready.");
-        }
-    }
-}
-
-/* Sort the apps by name. */
-Horde_Array::arraySort($apps, 'sort');
-
-/* Set up any actions that may be offered. */
-$actions = array();
-$ftpform = '';
-if (!empty($_SESSION['_config'])) {
-    $url = Horde::url('admin/setup/diff.php');
-    $action = _("Show differences between currently saved and the newly generated configuration.");
-    $actions[] = array('icon' => Horde::img('search.png', '', 'align="middle"'),
-                       'link' => Horde::link('#', '', '', '', Horde::popupJs($url, array('height' => 480, 'width' => 640, 'urlencode' => true)) . 'return false;') . $action . '</a>');
-
-    /* Action to download the configuration upgrade PHP script. */
-    $url = Horde::url('admin/setup/scripts.php')->add(array('setup' => 'conf', 'type' => 'php'));
-    $action = _("Download generated configuration as PHP script.");
-    $actions[] = array('icon' => Horde::img('download.png', '', 'align="middle"'),
-                       'link' => Horde::link($url) . $action . '</a>');
-    /* Action to save the configuration upgrade PHP script. */
-    $action = _("Save generated configuration as a PHP script to your server's temporary directory.");
-    $actions[] = array('icon' => Horde::img('save.png', '', 'align="middle"'),
-                       'link' => Horde::link($url->add('save', 'tmp')) . $action . '</a>');
-
-    /* Set up the form for FTP upload of scripts. */
-    $vars = Horde_Variables::getDefaultVariables();
-    $ftpform = new Horde_Form($vars);
-    $ftpform->setButtons(_("Upload"), true);
-    $ftpform->addVariable(_("Username"), 'username', 'text', true, false, null, array('', 20));
-    $ftpform->addVariable(_("Password"), 'password', 'password', false);
-
-    if ($ftpform->validate($vars)) {
-        $ftpform->getInfo($vars, $info);
-        $upload = _uploadFTP($info);
-        if ($upload) {
-            $notification->push(_("Uploaded all application setup files to the server."), 'horde.success');
-            Horde::url('admin/setup/index.php', true)->redirect();
-        }
-    }
-    /* Render the form. */
-    Horde::startBuffer();
-    $ftpform->renderActive(new Horde_Form_Renderer(), $vars, 'index.php', 'post');
-    $ftpform = Horde::endBuffer();
-}
-
-if (file_exists(Horde::getTempDir() . '/horde_setup_upgrade.php')) {
-    /* Action to remove the configuration upgrade PHP script. */
-    $url = Horde::url('admin/setup/scripts.php')->add('clean', 'tmp');
-    $action = _("Remove saved script from server's temporary directory.");
-    $actions[] = array('icon' => Horde::img('delete.png', '', 'align="middle"'),
-                       'link' => Horde::link($url) . $action . '</a>');
-}
-
-/* Set up the template. */
-$template = $injector->createInstance('Horde_Template');
-$template->setOption('gettext', true);
-$template->set('versions', !empty($versions), true);
-$template->set('version_action', Horde::url('admin/setup/index.php'));
-$template->set('version_input', Horde_Util::formInput());
-$template->set('apps', $apps);
-$template->set('actions', $actions, true);
-$template->set('ftpform', $ftpform, true);
-
-$title = sprintf(_("%s Setup"), $registry->get('name', 'horde'));
-Horde::addScriptFile('stripe.js', 'horde');
-require HORDE_TEMPLATES . '/common-header.inc';
-require HORDE_TEMPLATES . '/admin/menu.inc';
-echo $template->fetch(HORDE_TEMPLATES . '/admin/setup/index.html');
-require HORDE_TEMPLATES . '/common-footer.inc';
diff --git a/horde/admin/setup/scripts.php b/horde/admin/setup/scripts.php
deleted file mode 100644 (file)
index ca7c7ab..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-<?php
-/**
- * Generates upgrade scripts for Horde's setup. Currently allows the generation
- * of PHP upgrade scripts for conf.php files either as download or saved to the
- * server's temporary directory.
- *
- * Copyright 1999-2010 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @author Chuck Hagenbuch <chuck@horde.org>
- */
-
-require_once dirname(__FILE__) . '/../../lib/Application.php';
-Horde_Registry::appInit('horde', array('admin' => true));
-
-/* Get form data. */
-$setup = Horde_Util::getFormData('setup');
-$type = Horde_Util::getFormData('type');
-$save = Horde_Util::getFormData('save');
-$clean = Horde_Util::getFormData('clean');
-
-$filename = 'horde_setup_upgrade.php';
-
-/* Check if this is only a request to clean up. */
-if ($clean == 'tmp') {
-    $tmp_dir = Horde::getTempDir();
-    $path = Horde_Util::realPath($tmp_dir . '/' . $filename);
-    if (@unlink($tmp_dir . '/' . $filename)) {
-        $notification->push(sprintf(_("Deleted setup upgrade script \"%s\"."), $path), 'horde.success');
-    } else {
-        $notification->push(sprintf(_("Could not delete setup upgrade script \"%s\"."), Horde_Util::realPath($path)), 'horde.error');
-    }
-    $registry->clearCache();
-    Horde::url('admin/setup/index.php', true)->redirect();
-}
-
-$data = '';
-if ($setup == 'conf' && $type == 'php') {
-    /* A bit ugly here, save PHP code into a string for creating the script
-     * to be run at the command prompt. */
-    $data = '#!/usr/bin/env php' . "\n";
-    $data .= '<?php' . "\n";
-    foreach ($_SESSION['_config'] as $app => $php) {
-        $path = $registry->get('fileroot', $app) . '/config';
-        /* Add code to save backup. */
-        $data .= 'if (file_exists(\'' . $path . '/conf.php\')) {' . "\n";
-        $data .= '    if (@copy(\'' . $path . '/conf.php\', \'' . $path . '/conf.bak.php\')) {' . "\n";
-        $data .= '        echo \'Successfully saved backup configuration.\' . "\n";' . "\n";
-        $data .= '    } else {' . "\n";
-        $data .= '        echo \'Could NOT save a backup configuation.\' . "\n";' . "\n";
-        $data .= '    }' . "\n";
-        $data .= '}' . "\n";
-
-        $data .= 'if ($fp = @fopen(\'' . $path . '/conf.php\', \'w\')) {' . "\n";
-        $data .= '    fwrite($fp, \'';
-        $data .= Horde_String::convertCharset(str_replace(array('\\', '\''),
-                                                    array('\\\\', '\\\''),
-                                                    $php),
-                                        $GLOBALS['registry']->getCharset(), 'iso-8859-1');
-        $data .= '\');' . "\n";
-        $data .= '    fclose($fp);' . "\n";
-        $data .= '    echo \'' . sprintf('Saved %s configuration.', $app) . '\' . "\n";' . "\n";
-        $data .= '} else {' . "\n";
-        $data .= '    echo \'' . sprintf('Could NOT save %s configuration.', $app) . '\' . "\n";' . "\n";
-        $data .= '    exit;' . "\n";
-        $data .= '}' . "\n\n";
-    }
-}
-
-if ($save != 'tmp') {
-    /* Output script to browser for download. */
-    $browser->downloadHeaders($filename, 'text/plain', false, strlen($data));
-    echo $data;
-    exit;
-}
-
-$tmp_dir = Horde::getTempDir();
-/* Add self-destruct code. */
-$data .= 'echo \'Self-destructing...\' . "\n";' . "\n";
-$data .= 'if (unlink(__FILE__)) {' . "\n";
-$data .= '    echo \'Upgrade script deleted.\' . "\n";' . "\n";
-$data .= '} else {' . "\n";
-$data .= '    echo \'WARNING!!! REMOVE SCRIPT MANUALLY FROM ' . $tmp_dir . '\' . "\n";' . "\n";
-$data .= '}' . "\n";
-/* The script should be saved to server's temporary directory. */
-$path = Horde_Util::realPath($tmp_dir . '/' . $filename);
-if ($fp = @fopen($tmp_dir . '/' . $filename, 'w')) {
-    fwrite($fp, $data);
-    fclose($fp);
-    chmod($tmp_dir . '/' . $filename, 0777);
-    $notification->push(sprintf(_("Saved setup upgrade script to: \"%s\"."), $path), 'horde.success');
-} else {
-    $notification->push(sprintf(_("Could not save setup upgrade script to: \"%s\"."), $path), 'horde.error');
-}
-
-Horde::url('admin/setup/index.php', true)->redirect();
index ff73745..b50cdd7 100644 (file)
@@ -117,8 +117,8 @@ below at Prerequisites_.
 
      http://your-server/horde/
 
-   Go to Adminstration => Setup => Horde
-   (Or navigate to http://your-server/horde/admin/setup)
+   Go to Administration => Configuration => Horde
+   (Or navigate to http://your-server/horde/admin/config)
 
 
 Prerequisites
@@ -257,8 +257,8 @@ The following prerequisites are **REQUIRED** for Horde to function properly.
       it needs to compile.
 
       You can also use the ImageMagick_ package to do these manipulations
-      instead.  See the ``Image Manipulation`` tab of the Horde setup for more
-      details.
+      instead.  See the ``Image Manipulation`` tab of the Horde configuration
+      for more details.
 
       .. _ImageMagick: http://www.imagemagick.org
 
@@ -642,7 +642,7 @@ Configuring Horde
                   backend will be administrator accounts.  Horde does
                   **NOT** have a default administrator account - all
                   users, including administrators, must exist in the
-                  actual authentication backend.  Click on ``Setup``
+                  actual authentication backend.  Click on ``Configuration``
                   in the ``Administration`` menu and configure Horde.
                   Start in the ``Authentication`` tab.
 
@@ -667,17 +667,17 @@ Configuring Horde
       - For a secure connection, select port 993.
       - Select the secure connection protocol to use, if desired.
 
-   Continue to configure Horde through all the tabs of the setup interface and
-   click on ``Generate Horde Configuration``. An important item that you
-   probably want to configure is the ``Database Settings``, which defines the
-   database configuration that is used, by default, for several different
-   Horde sub-systems.
+   Continue to configure Horde through all the tabs of the configuration
+   interface and click on ``Generate Horde Configuration``. An important item
+   that you probably want to configure is the ``Database Settings``, which
+   defines the database configuration that is used, by default, for several
+   different Horde sub-systems.
 
    Configuration of applications in ``registry.php`` is documented in the
    ``INSTALL`` file of each application.  Most applications require you to
    configure them with a "Horde administrator" account.  A Horde administrator
-   account is any normal Horde account that has been added to the
-   administrator list in the ``Authentication`` tab of the Horde setup.
+   account is any normal Horde account that has been added to the administrator
+   list in the ``Authentication`` tab of the Horde configuration.
 
    The other files in that directory need only be modified if you wish to
    customize Horde's appearance or behaviour -- the defaults will work at most
@@ -717,7 +717,7 @@ Configuring Horde
 
       Additionally, you can change the session handler of PHP to use any
       storage backend requested (e.g. SQL database) via the ``Custom Session
-      Handler`` tab in the Horde setup.
+      Handler`` tab in the Horde configuration.
 
    For more information about securing your webserver, PHP and Horde, see the
    `docs/SECURITY`_ file.
@@ -738,10 +738,10 @@ Temporary Files
 ===============
 
 Various Horde applications will generate temporary files in PHP's temporary
-directory (see the ``General`` tab in the Horde setup).  For various reasons,
-some of these files may not be removed when the user's session ends. To
-reclaim this disk space, it may be necessary to periodically delete these old
-temporary files.
+directory (see the ``General`` tab in the Horde configuration).  For various
+reasons, some of these files may not be removed when the user's session
+ends. To reclaim this disk space, it may be necessary to periodically delete
+these old temporary files.
 
 An example cron-based solution can be found at ``scripts/temp-cleanup.cron``.
 Another possible solution is to use Red Hat's ``tmpwatch`` utility or anything
index ad4693f..aac23b2 100644 (file)
@@ -32,8 +32,8 @@ secure your cookies. You should even force session cookie usage in the Horde
 configuration, which is the default setting in all Horde versions now.
 
 If you want to use HTTPS connections, consider forcing users to HTTPS in the
-Horde setup. This will force cookies to be sent over secure connections only
-and helps to prevent sidejacking.
+Horde configuration. This will force cookies to be sent over secure connections
+only and helps to prevent sidejacking.
 
 If PHP sessions are set to use the ``files`` save_handler, then these files
 should be secured properly. Sites can increase security by setting the PHP
index c04e713..b0c2741 100644 (file)
@@ -23,8 +23,8 @@ class Horde_Api extends Horde_Registry_Api
     {
         $admin = array(
             'configuration' => array(
-                'link' => '%application%/admin/setup/',
-                'name' => _("_Setup"),
+                'link' => '%application%/admin/config/',
+                'name' => _("_Configuration"),
                 'icon' => Horde_Themes::img('config.png')
             ),
             'users' => array(
diff --git a/horde/templates/admin/config/config.html b/horde/templates/admin/config/config.html
new file mode 100644 (file)
index 0000000..c52b5fe
--- /dev/null
@@ -0,0 +1,11 @@
+<tag:form />
+
+<if:php>
+<br />
+<h1 class="header">
+ <gettext>Generated Code</gettext>
+ <if:diff_popup><small>[ <tag:diff_popup /> ]</small></if:diff_popup>
+</h1>
+<label for="php_config" class="hidden"><gettext>Configuration</gettext></label>
+<textarea id="php_config" style="width:100%" rows="20"><tag:php /></textarea>
+</if:php>
diff --git a/horde/templates/admin/config/diff.html b/horde/templates/admin/config/diff.html
new file mode 100644 (file)
index 0000000..c471fab
--- /dev/null
@@ -0,0 +1,11 @@
+<if:diffs>
+<loop:diffs>
+<h1 class="header" id="<tag:diffs.app />">
+ <tag:diffs.app /> <small>[ <tag:diffs.toggle_renderer /> ]</small>
+</h1>
+<pre class="text"><tag:diffs.diff /></pre>
+</loop:diffs>
+<else:diffs>
+<p class="notice"><gettext>No available configuration data to show differences for.</gettext></p>
+</else:diffs>
+</if:diffs>
diff --git a/horde/templates/admin/config/index.html b/horde/templates/admin/config/index.html
new file mode 100644 (file)
index 0000000..8b9d76d
--- /dev/null
@@ -0,0 +1,81 @@
+<form action="<tag:version_action />" style="margin:8px">
+<tag:version_input />
+<input type="hidden" name="check_versions" value="1" />
+<input type="submit" value="<gettext>Check for newer versions</gettext>" class="button" />
+</form>
+
+<table class="striped" cellspacing="0" width="100%">
+ <thead>
+  <tr>
+    <th class="header leftAlign">
+      <gettext>Application</gettext>
+    </th>
+    <th class="header">
+      &nbsp;
+    </th>
+    <th class="header leftAlign">
+      <gettext>Status</gettext>
+    </th>
+    <if:versions>
+    <th class="header">
+      &nbsp;
+    </th>
+    <th class="header">
+      &nbsp;
+    </th>
+    </if:versions>
+  </tr>
+ </thead>
+ <tbody>
+  <loop:apps>
+  <tr>
+    <td>
+      <tag:apps.icon />
+      <tag:apps.name />
+      <tag:apps.version />
+    </td>
+    <td align="center">
+      <tag:apps.conf />
+    </td>
+    <td>
+      <tag:apps.status />
+    </td>
+    <if:versions>
+    <td align="center">
+      <tag:apps.load />
+    </td>
+    <td>
+      <tag:apps.vstatus />
+    </td>
+    </if:versions>
+  </tr>
+  </loop:apps>
+ </tbody>
+</table>
+
+<table id="update" cellspacing="10">
+ <tr valign="top">
+  <td width="50%">
+   <if:actions>
+    <h1 class="header">
+     <gettext>Configuration upgrade scripts available</gettext>
+    </h1>
+    <table class="striped headerbox" cellspacing="0" width="100%">
+    <loop:actions>
+     <tr>
+      <td><tag:actions.icon /></td><td><tag:actions.link /></td>
+     </tr>
+    </loop:actions>
+    </table>
+   </if:actions>
+  </td>
+  <td width="50%">
+   <if:ftpform>
+    <h1 class="header"><gettext>FTP upload of configuration</gettext></h1>
+    <div class="headerbox">
+     <tag:ftpform />
+    </div>
+   </if:ftpform>
+  </td>
+ </tr>
+</table>
diff --git a/horde/templates/admin/setup/config.html b/horde/templates/admin/setup/config.html
deleted file mode 100644 (file)
index c52b5fe..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<tag:form />
-
-<if:php>
-<br />
-<h1 class="header">
- <gettext>Generated Code</gettext>
- <if:diff_popup><small>[ <tag:diff_popup /> ]</small></if:diff_popup>
-</h1>
-<label for="php_config" class="hidden"><gettext>Configuration</gettext></label>
-<textarea id="php_config" style="width:100%" rows="20"><tag:php /></textarea>
-</if:php>
diff --git a/horde/templates/admin/setup/diff.html b/horde/templates/admin/setup/diff.html
deleted file mode 100644 (file)
index c471fab..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<if:diffs>
-<loop:diffs>
-<h1 class="header" id="<tag:diffs.app />">
- <tag:diffs.app /> <small>[ <tag:diffs.toggle_renderer /> ]</small>
-</h1>
-<pre class="text"><tag:diffs.diff /></pre>
-</loop:diffs>
-<else:diffs>
-<p class="notice"><gettext>No available configuration data to show differences for.</gettext></p>
-</else:diffs>
-</if:diffs>
diff --git a/horde/templates/admin/setup/index.html b/horde/templates/admin/setup/index.html
deleted file mode 100644 (file)
index 5419453..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-<form action="<tag:version_action />" style="margin:8px">
-<tag:version_input />
-<input type="hidden" name="check_versions" value="1" />
-<input type="submit" value="<gettext>Check for newer versions</gettext>" class="button" />
-</form>
-
-<table class="striped" cellspacing="0" width="100%">
- <thead>
-  <tr>
-    <th class="header leftAlign">
-      <gettext>Application</gettext>
-    </th>
-    <th class="header">
-      &nbsp;
-    </th>
-    <th class="header leftAlign">
-      <gettext>Status</gettext>
-    </th>
-    <if:versions>
-    <th class="header">
-      &nbsp;
-    </th>
-    <th class="header">
-      &nbsp;
-    </th>
-    </if:versions>
-  </tr>
- </thead>
- <tbody>
-  <loop:apps>
-  <tr>
-    <td>
-      <tag:apps.icon />
-      <tag:apps.name />
-      <tag:apps.version />
-    </td>
-    <td align="center">
-      <tag:apps.conf />
-    </td>
-    <td>
-      <tag:apps.status />
-    </td>
-    <if:versions>
-    <td align="center">
-      <tag:apps.load />
-    </td>
-    <td>
-      <tag:apps.vstatus />
-    </td>
-    </if:versions>
-  </tr>
-  </loop:apps>
- </tbody>
-</table>
-
-<table id="update" cellspacing="10">
- <tr valign="top">
-  <td width="50%">
-   <if:actions>
-    <h1 class="header">
-     <gettext>Setup upgrade scripts available</gettext>
-    </h1>
-    <table class="striped headerbox" cellspacing="0" width="100%">
-    <loop:actions>
-     <tr>
-      <td><tag:actions.icon /></td><td><tag:actions.link /></td>
-     </tr>
-    </loop:actions>
-    </table>
-   </if:actions>
-  </td>
-  <td width="50%">
-   <if:ftpform>
-    <h1 class="header"><gettext>FTP upload of setup</gettext></h1>
-    <div class="headerbox">
-     <tag:ftpform />
-    </div>
-   </if:ftpform>
-  </td>
- </tr>
-</table>
index 57fe3ca..0566972 100644 (file)
@@ -245,21 +245,21 @@ Configuring IMP
 
       If you would prefer that your users authenticate directly with IMP,
       without having to authenticate through Horde first, load the
-      ``Administration/Setup/Authentication`` page and from the ``What backend
-      should we use for authenticating users to Horde`` pulldown menu select
-      ``Let a Horde application handle authentication``.  (Please see the
-      second note below.) Select ``imp`` from the ``The application which is
-      providing authentication`` pulldown menu.
+      ``Administration/Configuration/Authentication`` page and from the ``What
+      backend should we use for authenticating users to Horde`` pulldown menu
+      select ``Let a Horde application handle authentication``.  (Please see
+      the second note below.) Select ``imp`` from the ``The application which
+      is providing authentication`` pulldown menu.
 
       .. Note:: **You will have to log in twice if you don't do this** -- Once
                 to Horde and a second time to IMP.
 
-      .. Note:: If this is a new install, you will not be able to configure
-                IMP using the Horde Administration/Setup page if you first
+      .. Note:: If this is a new install, you will not be able to configure IMP
+                using the Horde Administration/Configuration page if you first
                 enabled IMP authentication for Horde.  You must set Horde to
                 use another authentication method (refer to the
-                `horde/docs/INSTALL`_ file), configure IMP, then reset Horde
-                to use IMP authentication.  One way to reset Horde in order to
+                `horde/docs/INSTALL`_ file), configure IMP, then reset Horde to
+                use IMP authentication.  One way to reset Horde in order to
                 reach the Administration page is to replace the Horde
                 configuration file ``conf.php`` with the original in
                 ``horde/config/conf.php.dist``.  You should of course back up
@@ -297,16 +297,16 @@ Configuring IMP
       You must be sure to list your IMAP/POP3 server names and configuration
       information in ``backends.php``.
 
-   You must login to Horde as a Horde Administrator to finish the
-   configuration of IMP.  Use the Horde ``Administration`` menu item to get to
-   the administration page, and then click on the ``Setup`` icon to get the
+   You must login to Horde as a Horde Administrator to finish the configuration
+   of IMP.  Use the Horde ``Administration`` menu item to get to the
+   administration page, and then click on the ``Configuration`` icon to get the
    configuration page.  Select ``Mail`` from the selection list of
    applications.  Fill in or change any configuration values as needed.  When
    done click on ``Generate Mail Configuration`` to generate the ``conf.php``
    file.  If your web server doesn't have write permissions to the IMP
    configuration directory or file, it will not be able to write the file.  In
-   this case, go back to ``Setup`` and choose one of the other methods to
-   create the configuration file ``imp/config/conf.php``.
+   this case, go back to ``Configuration`` and choose one of the other methods
+   to create the configuration file ``imp/config/conf.php``.
 
    Note for international users: IMP uses GNU gettext to provide local
    translations of text displayed by applications; the translations are found
@@ -400,8 +400,9 @@ Configuring IMP
    using caching.
 
    To use this caching, you must have a ``Cache System`` configured in Horde's
-   ``Administration/Setup`` screen and have the relevant settings enabled in
-   IMP's setup screen (``Administration/Setup/Webmail/Mailbox``).
+   ``Administration/Configuration`` screen and have the relevant settings
+   enabled in IMP's configuration screen
+   (``Administration/Configuration/Webmail/Mailbox``).
 
 
 Dynamic View Troubleshooting
index 0c5861e..e725b74 100644 (file)
@@ -46,7 +46,7 @@ class Koward_Test extends Horde_Kolab_Test_Storage
 \$conf['portal']['fixed_blocks'] = array();
 \$conf['imsp']['enabled'] = false;
 
-/** Additional config variables required for a clean Horde setup */
+/** Additional config variables required for a clean Horde configuration */
 \$conf['session']['use_only_cookies'] = false;
 \$conf['session']['timeout'] = 0;
 \$conf['cookie']['path'] = '/';