Ignore:
Timestamp:
May 4, 2014 12:29:05 AM (10 years ago)
Author:
anonymous
Message:

Removed some legacy files. Improved use of array_key_exists.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Prefs.inc.php

    r479 r480  
    275275            // - or the new value is different than the default
    276276            // - or there is a previously existing saved key.
    277             if (!array_key_exists($key, $_SESSION['_prefs'][$this->_ns]['defaults'])
     277            if (!(isset($_SESSION['_prefs'][$this->_ns]['defaults']) && array_key_exists($key, $_SESSION['_prefs'][$this->_ns]['defaults']))
    278278            || $_SESSION['_prefs'][$this->_ns]['defaults'][$key] != $val
    279             || array_key_exists($key, $_SESSION['_prefs'][$this->_ns]['saved'])) {
     279            || (isset($_SESSION['_prefs'][$this->_ns]['saved']) && array_key_exists($key, $_SESSION['_prefs'][$this->_ns]['saved']))) {
    280280                $_SESSION['_prefs'][$this->_ns]['saved'][$key] = $val;
    281281                $app->logMsg(sprintf('Setting session preference %s => %s', $key, getDump($val, true)), LOG_DEBUG, __FILE__, __LINE__);
     
    348348        case 'session':
    349349        case 'database':
    350             return array_key_exists($key, $_SESSION['_prefs'][$this->_ns]['saved']);
     350            return (isset($_SESSION['_prefs'][$this->_ns]['saved']) && array_key_exists($key, $_SESSION['_prefs'][$this->_ns]['saved']));
    351351
    352352        case 'cookie':
    353353            $name = $this->_getCookieName($key);
    354             return array_key_exists($name, $_COOKIE);
     354            return (isset($_COOKIE) && array_key_exists($name, $_COOKIE));
    355355        }
    356356
Note: See TracChangeset for help on using the changeset viewer.