From: Michael M Slusarz Date: Wed, 3 Nov 2010 06:52:31 +0000 (-0600) Subject: Horde: Convert to new Horde_Session API X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=0931a3e087c7aae6aa102fe3849c2db8bf35c4fb;p=horde.git Horde: Convert to new Horde_Session API --- diff --git a/horde/admin/config/config.php b/horde/admin/config/config.php index 7bc95356a..382564e1b 100644 --- a/horde/admin/config/config.php +++ b/horde/admin/config/config.php @@ -65,7 +65,7 @@ if (Horde_Util::getFormData('submitbutton') == _("Revert Configuration")) { $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") . '', 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'); @@ -76,7 +76,7 @@ $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 (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") . ''; } diff --git a/horde/admin/config/diff.php b/horde/admin/config/diff.php index af54ed401..4cfd2d4ed 100644 --- a/horde/admin/config/diff.php +++ b/horde/admin/config/diff.php @@ -31,7 +31,7 @@ function _getDiff($app) /* 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) @@ -41,7 +41,7 @@ function _getDiff($app) $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'); diff --git a/horde/admin/config/index.php b/horde/admin/config/index.php index 0d1234e8e..01ac685a9 100644 --- a/horde/admin/config/index.php +++ b/horde/admin/config/index.php @@ -30,7 +30,7 @@ function _uploadFTP($params) /* 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')) { @@ -45,7 +45,7 @@ function _uploadFTP($params) 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'); @@ -168,7 +168,7 @@ Horde_Array::arraySort($apps, 'sort'); /* 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"'), diff --git a/horde/admin/config/scripts.php b/horde/admin/config/scripts.php index 2234f2e33..1cad990ef 100644 --- a/horde/admin/config/scripts.php +++ b/horde/admin/config/scripts.php @@ -44,7 +44,7 @@ if ($setup == 'conf' && $type == 'php') { * to be run at the command prompt. */ $data = '#!/usr/bin/env php' . "\n"; $data .= ' $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"; diff --git a/horde/config/hooks.php.dist b/horde/config/hooks.php.dist index 17f1c6795..fb6300682 100644 --- a/horde/config/hooks.php.dist +++ b/horde/config/hooks.php.dist @@ -685,13 +685,13 @@ class Horde_Hooks // (!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 @@ -730,7 +730,7 @@ class Horde_Hooks // // 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']); // } // } // } @@ -749,7 +749,7 @@ class Horde_Hooks // 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']; @@ -762,7 +762,7 @@ class Horde_Hooks // $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); // } // } // } diff --git a/horde/login.php b/horde/login.php index 5034cb504..4ad719ef2 100644 --- a/horde/login.php +++ b/horde/login.php @@ -245,12 +245,12 @@ if (!empty($conf['auth']['alternate_login'])) { /* Build the