$params = Horde_Util::getFormData('params');
$page->preDisplay(Wicked::MODE_DISPLAY, $params);
-if (!isset($_SESSION['wickedSession']['history'])) {
- $_SESSION['wickedSession']['history'] = array();
-}
-
if ($page->isLocked()) {
$notification->push(sprintf(_("This page is locked by %s for %d Minutes."), $page->getLockRequestor(), $page->getLockTime()), 'horde.message');
}
+$history = $session->get('wicked', 'history', Horde_Session::TYPE_ARRAY);
+
$title = $page->pageTitle();
require WICKED_TEMPLATES . '/common-header.inc';
require WICKED_TEMPLATES . '/menu.inc';
require $registry->get('templates', 'horde') . '/common-footer.inc';
if ($page instanceof Wicked_Page_StandardPage &&
- (!isset($_SESSION['wickedSession']['history'][0]) ||
- $_SESSION['wickedSession']['history'][0] != $page->pageName())) {
- array_unshift($_SESSION['wickedSession']['history'], $page->pageName());
+ (!isset($history[0]) ||
+ $history[0] != $page->pageName())) {
+ array_unshift($history, $page->pageName());
+ $session->set('wicked', 'history', $history);
}
-if (count($_SESSION['wickedSession']['history']) > 10) {
- array_pop($_SESSION['wickedSession']['history']);
+
+if (count($history) > 10) {
+ array_pop($history);
+ $session->set('wicked', 'history', $history);
}
*/
public function content()
{
- global $wicked;
+ global $session, $wicked;
// Used in all cases.
$form = $this->_syncForm();
// We have no data to check
- if (empty($_SESSION['wicked']['sync'])) {
+ if (!$session->get('wicked', 'sync')) {
ob_start();
require WICKED_TEMPLATES . '/sync/header.inc';
require WICKED_TEMPLATES . '/sync/footer.inc';
// New pages on remote server
$new_remote = array();
- foreach ($_SESSION['wicked']['sync']['pages'] as $pageName => $info) {
+ foreach ($session->get('wicked', 'sync_pages/') as $pageName => $info) {
if (!$wicked->pageExists($pageName)) {
$new_remote[$pageName] = array(
'page_majorversion' => $info['page_majorversion'],
$new_local = array();
$local_pages = $wicked->getPages(false);
foreach ($local_pages as $pageName) {
- if (isset($_SESSION['wicked']['sync']['pages'][$pageName])) {
+ if ($session->exists('wicked', 'sync_pages/' . $pageName)) {
continue;
}
$page = Wicked_Page::getPage($pageName);
// Compare checksum
$page = Wicked_Page::getPage($pageName);
- if (md5($page->getText()) == $_SESSION['wicked']['sync']['pages'][$pageName]['page_checksum']) {
+ $spage = $session->get('wicked', 'sync_pages/' . $pageName);
+ if (md5($page->getText()) == $spage['page_checksum']) {
continue;
}
if ($local) {
return '<a href="' . Wicked::url($pageName) . '" target="_blank">' . _("View local") . '</a>';
} else {
- return '<a href="' . $_SESSION['wicked']['sync']['display'] . $pageName . '" target="_blank">' . _("View remote") . '</a>';
+ return '<a href="' . $GLOBALS['session']->get('wicked', 'sync_display') . $pageName . '" target="_blank">' . _("View remote") . '</a>';
}
}
*/
protected function _syncForm()
{
+ global $session;
+
require_once 'Horde/Form.php';
$vars = Horde_Variables::getDefaultVariables();
// Prepare default values
$stored = @unserialize($GLOBALS['prefs']->getValue('sync_data'));
if (isset($_GET['__old_sync_select'])) {
- unset($_SESSION['wicked']['sync']);
+ $session->remove('wicked', 'sync');
}
if ($vars->get('sync_select') && isset($stored[$vars->get('sync_select')])) {
$defaults = $stored[$vars->get('sync_select')];
}
}
}
- if (!empty($_SESSION['wicked']['sync'])) {
- $defaults = $_SESSION['wicked']['sync'];
+
+ if ($session->exists('wicked', 'sync')) {
+ $defaults = $session->get('wicked', 'sync');
}
// Add stored info selection
switch (Horde_Util::getFormData('submitbutton')) {
case _("Fetch page list"):
// Load driver
- $_SESSION['wicked']['sync'] = $info;
+ $session->set('wicked', 'sync', $info);
$this->_loadSyncDriver();
// We submitted the form so we should fetch pages
$pages = $this->_sync->getMultiplePageInfo();
if (!empty($pages)) {
- $_SESSION['wicked']['sync']['pages'] = $pages;
+ foreach ($pages as $key => $val) {
+ $session->set('wicked', 'sync_pages/' . $key, $val);
+ }
}
break;
*/
public function getRemotePageInfo($pageName)
{
- if (!isset($_SESSION['wicked']['sync']['pages'][$pageName])) {
- $_SESSION['wicked']['sync']['pages'][$pageName] = $this->_sync->getPageInfo($pageName);
+ global $session;
+
+ if (!$session->exists('wicked', 'sync_pages/' . $pageName)) {
+ $session->set('wicked', 'sync_pages/' . $pageName, $this->_sync->getPageInfo($pageName));
}
- return $_SESSION['wicked']['sync']['pages'][$pageName];
+
+ return $session->get('wicked', 'sync_pages/' . $pageName);
}
/**
*/
protected function _loadSyncDriver()
{
+ global $session;
+
if ($this->_sync) {
return true;
- } elseif (empty($_SESSION['wicked']['sync']['driver'])) {
+ } elseif (!$session->get('wicked', 'sync_driver')) {
return false;
}
- $this->_sync = Wicked_Sync::factory($_SESSION['wicked']['sync']['driver'],
- $_SESSION['wicked']['sync']);
+ $this->_sync = Wicked_Sync::factory($session->get('wicked', 'sync_driver'),
+ $session->get('wicked', 'sync'));
}
}