$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['horde:config/' . $app] = $php;
+ $session->set('horde', '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');
$template->set('php', htmlspecialchars($php), true);
/* Create the link for the diff popup only if stored in session. */
$diff_link = '';
-if (isset($session['horde:config/' . $app])) {
+if ($session->exists('horde', '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>';
}
/* Calculate the differences. */
$diff = new Text_Diff(explode("\n", $current_config),
- explode("\n", $session['horde:config/' . $app]));
+ explode("\n", $session->get('horde', 'config/' . $app)));
$diff = $renderer->render($diff);
return empty($diff)
$diffs = array();
/* Only bother to do anything if there is any config. */
-if ($config = $session['horde:config/']) {
+if ($config = $session->get('horde', 'config/')) {
/* Set up the toggle button for inline/unified. */
$url = Horde::url('admin/config/diff.php')->add('render', ($render_type == 'inline') ? 'unified' : 'inline');
/* Loop through the config and write to FTP. */
$no_errors = true;
- foreach ($session['horde:config/'] as $app => $config) {
+ foreach ($session->get('horde', '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->writeData($path, 'conf.php', $config);
$notification->push(sprintf(_("Successfully wrote %s"), Horde_Util::realPath($path . '/conf.php')), 'horde.success');
- unset($session['horde:config/' . $app]);
+ $session->remove('horde', 'config/' . $app);
} catch (VFS_Exception $e) {
$no_errors = false;
$notification->push(sprintf(_("Could not write configuration for \"%s\": %s"), $app, $e->getMessage()), 'horde.error');
/* Set up any actions that may be offered. */
$actions = array();
$ftpform = '';
-if ($session['horde:config/']) {
+if ($session->get('horde', '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"'),
* to be run at the command prompt. */
$data = '#!/usr/bin/env php' . "\n";
$data .= '<?php' . "\n";
- foreach ($session['horde:config/'] as $app => $php) {
+ foreach ($session->get('horde', 'config/') as $app => $php) {
$path = $registry->get('fileroot', $app) . '/config';
/* Add code to save backup. */
$data .= 'if (file_exists(\'' . $path . '/conf.php\')) {' . "\n";
// (!empty($cfgSources['imsp']['use_shares']))) {
// // Only do this once per session or when this session variable
// // is purposely unset.
-// if ($session['horde:imsp_synched']) {
+// if ($session->get('horde', 'imsp_synched')) {
// return;
// }
//
// $results = Net_IMSP_Utils::synchShares($share_obj, $cfgSources['imsp']);
// if (!$results instanceof PEAR_Error) {
-// $session['horde:imsp_synched'] = true;
+// $session->set('horde', 'imsp_synched') = true;
//
// // Now deal with adding or removing address books from prefs.
// // FIXME: Updating prefs seems to hang the server. Narrowed
// // We have to save the connection info for the imsp server
// // since the share_modify hook will not occur from within
// // turba's context.
-// $session['horde:imsp_config'] = $cfgSources['imsp']['params'];
+// $session->set('horde', 'imsp_config', $cfgSources['imsp']['params']);
// }
// }
// }
// if (is_array($params) &&
// !empty($params['source']) &&
// ($params['source'] == 'imsp') &&
-// $session['horde:imsp_config']) {
+// ($config = $session->get('horde', 'imsp_config'))) {
// // Ensure we don't try to change ownership.
// $params = @unserialize($share->get('params'));
// $bookName = $params['name'];
// $users = $injector->getInstance('Horde_Perms')->getUserPermissions();
// foreach ($users as $user => $perm) {
// $acl = Net_IMSP_Utils::permsToACL($perm);
-// $result = Net_IMSP_Utils::setACL($session['horde:imsp_config'], $bookName, $user, $acl);
+// $result = Net_IMSP_Utils::setACL($config, $bookName, $user, $acl);
// }
// }
// }
/* Build the <select> widget containing the available languages. */
if (!$is_auth && !$prefs->isLocked('language')) {
- $session['horde:language'] = $registry->preferredLang($vars->new_lang);
+ $session->set('horde', 'language', $registry->preferredLang($vars->new_lang));
$langs = array();
foreach ($registry->nlsconfig['languages'] as $key => $val) {
$langs[] = array(
- 'sel' => ($key == $session['horde:language']),
+ 'sel' => ($key == $session->get('horde', 'language')),
'val' => $key,
// Language names are already encoded.
'name' => $val
Horde_Registry::appInit('horde');
/* Set the language. */
-$session['horde:language'] = $registry->preferredLanguage(Horde_Util::getForm('new_lang'));
-$prefs->setValue('language', $sessoin['horde:language']);
+$session->set('horde', 'language', $registry->preferredLanguage(Horde_Util::getForm('new_lang')));
+$prefs->setValue('language', $session->get('horde', 'language'));
/* Update apps language */
foreach ($registry->listApps() as $app) {