// Check for a deferred attachment upload.
if (!empty($info['deferred_attachment']) &&
- !empty($_SESSION['whups']['deferred_attachment'][$info['deferred_attachment']])) {
+ ($a_name = $GLOBALS['session']->get('whups', 'deferred_attachment/' . $info['deferred_attachment']))) {
$ticket->change(
'attachment',
array('name' => $info['deferred_attachment'],
- 'tmp_name' => $_SESSION['whups']['deferred_attachment'][$info['deferred_attachment']]));
+ 'tmp_name' => $a_name));
- unlink($_SESSION['whups']['deferred_attachment'][$info['deferred_attachment']]);
+ unlink($a_name);
}
// Send email notifications.
{
Horde::addScriptFile('tables.js', 'horde', true);
- global $prefs, $registry;
+ global $prefs, $registry, $session;
$sortby = $prefs->getValue('sortby');
$sortdir = $prefs->getValue('sortdir');
foreach ($this->_params['results'] as $info) {
$ids[] = $info['id'];
}
- $_SESSION['whups']['tickets'] = $ids;
+ $session->set('whups', 'tickets', $ids);
include WHUPS_TEMPLATES . '/view/results.inc';
}
*/
function getCAPTCHA($new = false)
{
- if ($new || empty($_SESSION['whups']['CAPTCHA'])) {
- $_SESSION['whups']['CAPTCHA'] = '';
- for ($i = 0; $i < 5; $i++) {
- $_SESSION['whups']['CAPTCHA'] .= chr(rand(65, 90));
+ global $session;
+
+ if ($new || !$session->get('whups', 'captcha')) {
+ $captcha = '';
+ for ($i = 0; $i < 5; ++$i) {
+ $captcha .= chr(rand(65, 90));
}
+ $session->set('whups', 'captcha', $captcha);
}
- return $_SESSION['whups']['CAPTCHA'];
+
+ return $session->get('whups', 'captcha');
}
/**
$showExtraForm = null;
// Find our current query.
-if (isset($_SESSION['whups']['query'])) {
- $whups_query = unserialize($_SESSION['whups']['query']);
+if ($whups_query = $session->get('whups', 'query')) {
if (!$whups_query->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) {
$notification->push(_("Permission denied."), 'horde.error');
Horde::url($prefs->getValue('whups_default_view') . '.php', true)
// Find the current criteria form, and default to the user form if not
// present.
-if (!isset($_SESSION['whups']['query_form'])) {
- $_SESSION['whups']['query_form'] = 'props';
+if (!$session->exists('whups', 'query_form')) {
+ $session->set('whups', 'query_form', 'props');
}
-$vars->set('whups_query_form', $_SESSION['whups']['query_form']);
+$vars->set('whups_query_form', $session->get('whups', 'query_form'));
// What now? First check the result of the query edit action dropdown, as this
// action overrides the form it sits within.
break;
case 'edit':
- $_SESSION['whups']['query_form'] = $whups_query->pathToForm($vars);
- if (is_a($_SESSION['whups']['query_form'], 'PEAR_Error')) {
- $notification->push($_SESSION['whups']['query_form']);
- $_SESSION['whups']['query_form'] = 'props';
+ $qf = $whups_query->pathToForm($vars);
+ if (is_a($qf, 'PEAR_Error')) {
+ $notification->push($qf);
+ $qf = 'props';
}
+ $session->set('whups', 'query_form', 'props');
$vars->set('edit', true);
break;
}
case 'date':
case 'text':
case 'attribs':
- $_SESSION['whups']['query_form'] = $action;
+ $session->set('whups', 'query_form', $action);
break;
// Global query options
// Criterion form types.
$queryurl = Horde::url('query/index.php');
-$vars->set('action', $_SESSION['whups']['query_form']);
+$vars->set('action', $session->get('whups', 'query_form'));
$criteriaTabs = new Horde_Core_Ui_Tabs('action', $vars);
$criteriaTabs->preserve('path', $vars->get('path'));
$criteriaTabs->addTab(_("_Property Criteria"), $queryurl, 'props');
if ($showEditQuery) {
// Get our current form.
- switch ($_SESSION['whups']['query_form']) {
+ switch ($session->get('whups', 'query_form')) {
default:
printf(_("Error: Unknown query form \"%s\", defaulting to properties"),
- $_SESSION['whups']['query_form']);
+ $session->get('whups', 'query_form'));
// Fall through.
case 'props':
require $registry->get('templates', 'horde') . '/common-footer.inc';
-$_SESSION['whups']['query'] = serialize($whups_query);
+$session->set('whups', 'query', $whups_query);
$whups_query = $qManager->getQueryBySlug($vars->get('slug'));
} elseif ($vars->exists('query')) {
$whups_query = $qManager->getQuery($vars->get('query'));
-} elseif (isset($_SESSION['whups']['query'])) {
- $whups_query = unserialize($_SESSION['whups']['query']);
+} else {
+ $whups_query = $session->get('whups', 'query');
}
// If we have an error, or if we still don't have a query, or if we don't have
if ($isvalid) {
$tickets = $whups_driver->executeQuery($whups_query, $vars);
- $_SESSION['whups']['last_search'] = Horde::url('query/run.php');
+ $session->set('whups', 'last_search', Horde::url('query/run.php'));
}
$title = $whups_query->name ? $whups_query->name : _("Query Results");
require $registry->get('templates', 'horde') . '/common-footer.inc';
-$_SESSION['whups']['query'] = serialize($whups_query);
+$session->set('whups', 'query', $whups_query);
'results' => $tickets,
'values' => $values,
'url' => $self));
- $_SESSION['whups']['last_search'] = $self;
+ $session->set('whups', 'last_search', $self);
$results->html();
}
OPERATOR_EQUAL, $state);
}
}
- $_SESSION['whups']['query'] = serialize($whups_query);
+ $session->set('whups', 'query', $whups_query);
Horde::url('query/index.php', true)
->add('action', 'save')
->redirect();
} else {
Whups::sortTickets($tickets);
- $_SESSION['whups']['last_search'] = Horde::url('search.php?' . _getSearchUrl($vars));
+ $session->set('whups', 'last_search', Horde::url('search.php?' . _getSearchUrl($vars)));
$results = Whups_View::factory(
'Results',
array('title' => _("Search Results"),
'results' => $tickets,
'values' => Whups::getSearchResultColumns(),
- 'url' => $_SESSION['whups']['last_search']));
+ 'url' => $session->get('whups', 'last_search')));
$beendone = true;
}
}
<?php
// If we have a saved list of ticket ids in the session, display the prev/next
// navigation.
-if (!isset($_SESSION['whups']['tickets']) ||
- !is_array($_SESSION['whups']['tickets']) ||
- ($list_length = count($_SESSION['whups']['tickets'])) <= 1 ||
- ($this_ticket = array_search($ticket->getId(), $_SESSION['whups']['tickets'])) === false) {
+$whups_tickets = $GLOBALS['session']->get('whups', 'tickets', Horde_Session::TYPE_ARRAY);
+
+if (($list_length = count($whups_tickets)) <= 1 ||
+ ($this_ticket = array_search($ticket->getId(), $whups_tickets)) === false) {
return;
}
$prevnext_links = array();
if ($this_ticket != 0) {
$prevnext_links[] = Horde::link(
- Whups::urlFor('ticket',
- $_SESSION['whups']['tickets'][0]))
+ Whups::urlFor('ticket', $whups_tickets[0]))
. htmlspecialchars(_("<<First")) . '</a>';
$prevnext_links[] = Horde::link(
- Whups::urlFor('ticket',
- $_SESSION['whups']['tickets'][$this_ticket - 1]))
+ Whups::urlFor('ticket', $whups_tickets[$this_ticket - 1]))
. htmlspecialchars(_("<Prev")) . '</a>';
}
if ($this_ticket + 1 != $list_length) {
$prevnext_links[] = Horde::link(
- Whups::urlFor('ticket',
- $_SESSION['whups']['tickets'][$this_ticket + 1]))
+ Whups::urlFor('ticket', $whups_tickets[$this_ticket + 1]))
. htmlspecialchars(_("Next>")) . '</a>';
$prevnext_links[] = Horde::link(
- Whups::urlFor('ticket',
- $_SESSION['whups']['tickets'][$list_length - 1]))
+ Whups::urlFor('ticket', $whups_tickets[$list_length - 1]))
. htmlspecialchars(_("Last>>")) . '</a>';
}
$label = _("Re_turn to Search Results");
?>
<div id="searchnav">
<p>
- <strong><?php printf(_("Search Results: %s of %s"), $this_ticket + 1, count($_SESSION['whups']['tickets'])) ?></strong>
+ <strong><?php printf(_("Search Results: %s of %s"), $this_ticket + 1, $list_length) ?></strong>
<small>
[ <?php echo implode(' ', $prevnext_links) ?> ]
- <?php if (!empty($_SESSION['whups']['last_search'])): ?>
- [ <?php echo Horde::link(Horde_Util::addParameter($_SESSION['whups']['last_search'], 'haveSearch', true), '', '', '', '', '', $ak) . $label ?></a> ]
+ <?php if ($ls = $GLOBALS['session']->get('whups', 'last_search')): ?>
+ [ <?php echo Horde::link(Horde_Util::addParameter($ls, 'haveSearch', true), '', '', '', '', '', $ak) . $label ?></a> ]
<?php endif; ?>
</small>
</p>
function doResort(column, sortDown)
{
- baseurl = '<?php echo addslashes(html_entity_decode($_SESSION['whups']['last_search'])) ?>';
+ baseurl = '<?php echo addslashes(html_entity_decode($GLOBALS['session']->get('whups', 'last_search'))) ?>';
try {
new Ajax.Request(baseurl, { parameters: { 'sortby': encodeURIComponent(column), sortdir: encodeURIComponent(sortDown) } });
} catch (e) {}
</table>
<?php endif; endif; ?>
<!-- Results End -->
-<br class="spacer" />
\ No newline at end of file
+<br class="spacer" />
$tmp_file_path = tempnam(Horde::getTempDir(), 'att');
if (move_uploaded_file($info['newattachment']['tmp_name'],
$tmp_file_path)) {
- $_SESSION['whups']['deferred_attachment'][$file_name] =
- $tmp_file_path;
+ $session->set('whups', 'deferred_attachment/' . $file_name, $tmp_file_path);
$vars->set('deferred_attachment', $file_name);
$form3->preserveVarByPost($vars, 'deferred_attachment');
}