Ignore:
Timestamp:
Apr 4, 2007 4:54:25 AM (17 years ago)
Author:
quinn
Message:

Q - Fixed a few non-fatal but still annoying bugs.

File:
1 edited

Legend:

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

    r201 r241  
    204204        $app =& App::getInstance();
    205205        if (array_key_exists($key, $_SESSION['_prefs'][$this->_ns]['persistent'])) {
     206            $app->logMsg(sprintf('Found %s in persistent', $key), LOG_DEBUG, __FILE__, __LINE__);
    206207            return $_SESSION['_prefs'][$this->_ns]['persistent'][$key];
    207208        } else if (array_key_exists($key, $_SESSION['_prefs'][$this->_ns]['defaults'])) {
     209            $app->logMsg(sprintf('Found %s in defaults', $key), LOG_DEBUG, __FILE__, __LINE__);
    208210            return $_SESSION['_prefs'][$this->_ns]['defaults'][$key];
    209211        } else {
     
    238240     * as $auth->clear(), such as when logging out.
    239241     */
    240     function clear()
    241     {
    242         $_SESSION['_prefs'][$this->_ns] = array(
    243             'loaded' => false,
    244             'load_datetime' => '1970-01-01',
    245             'defaults' => array(),
    246             'persistent' => array(),
    247         );
     242    function clear($focus='all')
     243    {
     244        switch ($focus) {
     245        case 'all' :
     246            $_SESSION['_prefs'][$this->_ns] = array(
     247                'loaded' => false,
     248                'load_datetime' => '1970-01-01',
     249                'defaults' => array(),
     250                'persistent' => array(),
     251            );
     252            break;
     253
     254        case 'defaults' :
     255            $_SESSION['_prefs'][$this->_ns]['defaults'] = array();
     256            break;
     257
     258        case 'persistent' :
     259            $_SESSION['_prefs'][$this->_ns]['persistent'] = array();
     260            break;
     261        }
    248262    }
    249263   
     
    282296       
    283297        // Clear existing cache.
    284         $this->clear();
     298        $this->clear('persistent');
    285299       
    286300        // Retrieve all prefs for this user and namespace.
     
    296310        }
    297311       
    298         $app->logMsg(sprintf('Loaded %s prefs from database.', sizeof($_SESSION['_prefs'][$this->_ns]['persistent'])), LOG_DEBUG, __FILE__, __LINE__);
     312        $app->logMsg(sprintf('Loaded %s prefs from database.', mysql_num_rows($qid)), LOG_DEBUG, __FILE__, __LINE__);
    299313       
    300314        // Data loaded only once per session.
Note: See TracChangeset for help on using the changeset viewer.