Changeset 42 for trunk/lib/Prefs.inc.php


Ignore:
Timestamp:
Dec 18, 2005 12:16:03 AM (18 years ago)
Author:
scdev
Message:

detabbed all files ;P

File:
1 edited

Legend:

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

    r41 r42  
    3030     */
    3131    var $params = array();
    32    
    33    
     32
     33
    3434    /**
    3535     * Prefs constructor.
     
    4343    /**
    4444     * Sets the default value of a preference. The pref will be set only if
    45      * is not set already. 
     45     * is not set already.
    4646     *
    4747     * @param  string $pref      The name of the preference to modify.
     
    5656            $scope =& $this->scope;
    5757        }
    58        
     58
    5959        // No empty values allowed.
    6060        if ('' == $pref || '' == $val || '' == $scope) {
    6161            return false;
    6262        }
    63        
     63
    6464        // Initialized the prefs array.
    6565        if (!isset($_SESSION['_prefs'])) {
    6666            $_SESSION['_prefs'] = array();
    6767        }
    68        
     68
    6969        // In case boolean or null values are passed as a string.
    7070        if ($val == 'true') {
     
    8484
    8585    /**
    86      * Sets the given preferences to the specific value, 
     86     * Sets the given preferences to the specific value,
    8787     *
    8888     * @param  string $pref      The name of the preference to modify.
     
    9797            $scope =& $this->scope;
    9898        }
    99        
     99
    100100        // No empty values allowed.
    101101        if ('' == $pref || '' == $val || '' == $scope) {
    102102            return false;
    103103        }
    104        
     104
    105105        // Initialized the prefs array.
    106106        if (!isset($_SESSION['_prefs'])) {
    107107            $_SESSION['_prefs'] = array();
    108108        }
    109        
     109
    110110        // In case boolean or null values are passed as a string.
    111111        if ($val == 'true') {
     
    120120        return true;
    121121    }
    122    
     122
    123123    /**
    124124     * Returns the value of the requested preference.
     
    134134            $scope =& $this->scope;
    135135        }
    136        
     136
    137137        return (isset($_SESSION['_prefs'][$scope][$pref])) ? $_SESSION['_prefs'][$scope][$pref] : null;
    138138    }
    139    
     139
    140140    /**
    141141     * To see if a preference has been set.
     
    152152            $scope =& $this->scope;
    153153        }
    154        
     154
    155155        return isset($_SESSION['_prefs'][$scope][$pref]);
    156156    }
    157    
     157
    158158    /**
    159159     * Clear a set preference value.
     
    167167            $scope =& $this->scope;
    168168        }
    169        
     169
    170170        if (isset($_SESSION['_prefs'][$scope][$pref])) {
    171171            unset($_SESSION['_prefs'][$scope][$pref]);
     
    181181     *                     preferences listed in the $prefs hash.
    182182     *
    183      * @return mixed       True on success or a PEAR_Error object on failure. 
     183     * @return mixed       True on success or a PEAR_Error object on failure.
    184184     */
    185185    function retrieve()
     
    192192        // FIXME: Database query goes here....
    193193        return false;
    194        
     194
    195195        $_SESSION['_prefs']['loaded'] = true;
    196196    }
     
    211211            return true;
    212212        }
    213        
     213
    214214        /*
    215215         * If a list of preferences to store hasn't been provided in
     
    221221            $prefs = array_merge($_SESSION['_prefs'], $prefs);
    222222        }
    223        
     223
    224224        if (!is_array($prefs) || empty($prefs)) {
    225225            App::raiseMsg(_("No preferences are available."), MSG_ERR, __FILE__, __LINE__);
    226226            App::dieBoomerangURL();
    227227        }
    228        
     228
    229229        // FIXME: Database query goes here....
    230230        return false;
Note: See TracChangeset for help on using the changeset viewer.