*/
public function load($user = null, $preload = true)
{
- if (isset($_SESSION['horde']['alarm']['loaded']) &&
- (time() - $_SESSION['horde']['alarm']['loaded']) < $this->_params['ttl']) {
+ // TODO: This must be moved to horde/Core.
+ global $session;
+
+ if (isset($session['horde:alarm_loaded']) &&
+ (time() - $session['horde:alarm_loaded']) < $this->_params['ttl']) {
return;
}
/* Load current alarms if no preloading requested or if this
* is the first call in this session. */
- if (!$preload ||
- !isset($_SESSION['horde']['alarm']['loaded'])) {
+ if (!$preload || !$session['horde:alarm_loaded']) {
try {
$app_alarms = $GLOBALS['registry']->callByPackage($app, 'listAlarms', array(time(), $user), array('noperms' => true));
} catch (Horde_Exception $e) {
}
}
- $_SESSION['horde']['alarm']['loaded'] = time();
+ $session['horde:alarm_loaded'] = time();
}
/**
*/
public function __construct($apps = array())
{
+ global $session;
+
$signature = serialize($apps);
- if (isset($_SESSION['horde']['blocks'][$signature])) {
- $this->_blocks = &$_SESSION['horde']['blocks'][$signature];
+ if ($this->_blocks = $session['horde:blocks/' . $signature]) {
return;
}
}
uksort($this->_blocks, array($this, 'sortBlockCollection'));
- $_SESSION['horde']['blocks'][$signature] = &$this->_blocks;
+ $session['horde:blocks/' . $signature] = $this->_blocks;
}
/**
static public function getRequestToken($slug)
{
$token = Horde_Token::generateId($slug);
- $_SESSION['horde_form_secrets'][$token] = time();
+ $GLOBALS['session']['horde:form_secrets/' . $token] = time();
+
return $token;
}
*/
static public function checkRequestToken($slug, $token)
{
- if (empty($_SESSION['horde_form_secrets'][$token])) {
+ global $conf, $session;
+
+ if (!isset($session['horde:form_secrets/' . $token])) {
throw new Horde_Exception(_("We cannot verify that this request was really sent by you. It could be a malicious request. If you intended to perform this action, you can retry it now."));
}
- if (($_SESSION['horde_form_secrets'][$token] + $GLOBALS['conf']['urls']['token_lifetime'] * 60) < time()) {
+ if (($session['horde:form_secrets/' . $token] + $GLOBALS['conf']['urls']['token_lifetime'] * 60) < time()) {
throw new Horde_Exception(sprintf(_("This request cannot be completed because the link you followed or the form you submitted was only valid for %s minutes. Please try again now."), $GLOBALS['conf']['urls']['token_lifetime']));
}
}
if (!$GLOBALS['prefs']->isLocked($pref) &&
!in_array($pref, $this->suppress) &&
(empty($this->prefs[$pref]['advanced']) ||
- !empty($_SESSION['horde_prefs']['advanced'])) &&
+ $GLOBALS['session']['horde:prefs_advanced']) &&
((!empty($this->prefs[$pref]['type']) &&
($this->prefs[$pref]['type'] != 'implicit')))) {
$prefs[] = $pref;
/* Toggle Advanced/Basic mode. */
if (!empty($this->vars->show_advanced) ||
!empty($this->vars->show_basic)) {
- $_SESSION['horde_prefs']['advanced'] = !empty($this->vars->show_advanced);
+ $GLOBALS['session']['horde:prefs_advanced'] = !empty($this->vars->show_advanced);
}
if (!$this->group || !$this->groupIsEditable($this->group)) {
$t->set('apps', $tmp);
$t->set('header', htmlspecialchars(($this->app == 'horde') ? _("Global Preferences") : sprintf(_("Preferences for %s"), $registry->get('name', $this->app))));
- if (empty($_SESSION['horde_prefs']['advanced'])) {
+ if ($GLOBALS['session']['horde:prefs_advanced'])) {
$t->set('advanced', $this->selfUrl()->add('show_advanced', 1));
} else {
$t->set('basic', $this->selfUrl()->add('show_basic', 1));
if ($this->_useFormToken) {
$token = Horde_Token::generateId($this->_name);
- $_SESSION['horde_form_secrets'][$token] = true;
+ $GLOBALS['session']['horde:form_secrets/' . $token] = true;
$this->_preserveVarByPost($this->_name . '_formToken', $token);
}
if ($this->_useFormToken) {
$token = Horde_Token::generateId($this->_name);
- $_SESSION['horde_form_secrets'][$token] = true;
+ $GLOBALS['session']['horde:form_secrets/' . $token] = true;
$this->_preserveVarByPost($this->_name . '_formToken', $token);
}
{
if ($this->_useFormToken) {
$token = Horde_Token::generateId($this->_name);
- $_SESSION['horde_form_secrets'][$token] = true;
+ $GLOBALS['session']['horde:form_secrets/' . $token] = true;
$this->_preserveVarByPost($this->_name . '_formToken', $token);
}
if (!empty($passedToken) && !$tokenSource->verify($passedToken)) {
$this->_errors['_formToken'] = _("This form has already been processed.");
}
- if (empty($_SESSION['horde_form_secrets'][$passedToken])) {
+ if (!$GLOBALS['session']['horde:form_secrets/' . $passedToken]) {
$this->_errors['_formSecret'] = _("Required secret is invalid - potentially malicious request.");
}
}