Changeset 611


Ignore:
Timestamp:
Aug 24, 2017 4:27:34 PM (7 years ago)
Author:
anonymous
Message:

Add additional clearings to logout service. Add logging to clear methods.

Location:
trunk
Files:
6 edited

Legend:

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

    r563 r611  
    135135    public function clear()
    136136    {
     137        $app =& App::getInstance();
     138
    137139        $_SESSION['_auth_file'][$this->_ns] = array('authenticated' => false);
     140
     141        $app->logMsg(sprintf('Cleared %s auth', $this->_ns), LOG_DEBUG, __FILE__, __LINE__);
    138142    }
    139143
  • trunk/lib/Auth_SQL.inc.php

    r601 r611  
    333333    public function clear()
    334334    {
     335        $app =& App::getInstance();
    335336        $db =& DB::getInstance();
    336337
     
    363364            'user_data'             => null,
    364365        );
     366
     367        $app->logMsg(sprintf('Cleared %s auth', $this->_ns), LOG_DEBUG, __FILE__, __LINE__);
    365368    }
    366369
  • trunk/lib/Cache.inc.php

    r558 r611  
    282282    public function clear()
    283283    {
     284        $app =& App::getInstance();
     285
    284286        $_SESSION['_cache'][$this->_ns] = array();
     287        $app->logMsg(sprintf('Cleared %s cache', $this->_ns), LOG_DEBUG, __FILE__, __LINE__);
    285288    }
    286289
  • trunk/lib/Cart.inc.php

    r502 r611  
    44 * For details visit the project site: <http://trac.strangecode.com/codebase/>
    55 * Copyright 2001-2012 Strangecode, LLC
    6  * 
     6 *
    77 * This file is part of The Strangecode Codebase.
    88 *
     
    1111 * Free Software Foundation, either version 3 of the License, or (at your option)
    1212 * any later version.
    13  * 
     13 *
    1414 * The Strangecode Codebase is distributed in the hope that it will be useful, but
    1515 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1616 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    1717 * details.
    18  * 
     18 *
    1919 * You should have received a copy of the GNU General Public License along with
    2020 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
     
    2828 * @author  Quinn Comendant <quinn@strangecode.com>
    2929 * @version 1.0
    30  * 
     30 *
    3131 * Example of use:
    3232---------------------------------------------------------------------
     
    8686
    8787        $this->_ns = $namespace;
    88        
     88
    8989        // Initialize.
    9090        if (!isset($_SESSION['_cart'][$this->_ns])) {
     
    116116    {
    117117        $app =& App::getInstance();
    118    
     118
    119119        if (array_key_exists($param, $this->_params)) {
    120120            return $this->_params[$param];
     
    141141    {
    142142        $app =& App::getInstance();
    143        
     143
    144144        // Include any previously added items in the total quantity.
    145145        $quantity += isset($_SESSION['_cart'][$this->_ns]['items'][$item_id]) ? $_SESSION['_cart'][$this->_ns]['items'][$item_id]['quantity'] : 0;
    146        
     146
    147147        // Add item with adjusted quantity and merge in additional specs.
    148148        $_SESSION['_cart'][$this->_ns]['items'][$item_id] = array_merge($specs, array(
     
    151151            'extended_price' => $quantity * $price,
    152152        ));
    153        
     153
    154154        $app->logMsg(sprintf('Added %s %s to cart (%s)', $quantity, $item_id, truncate(getDump($specs, true), 128, 'end')), LOG_DEBUG, __FILE__, __LINE__);
    155        
     155
    156156        return $quantity;
    157157    }
    158    
     158
    159159    /*
    160160    * Set the absolute quantity value of a specified item in a cart.
    161161    *
    162162    * @access   public
    163     * @param   
    164     * @return   
     163    * @param
     164    * @return
    165165    * @author   Quinn Comendant <quinn@strangecode.com>
    166166    * @version  1.0
     
    185185        }
    186186    }
    187    
     187
    188188    /*
    189189    * Set the absolute price value of a specified item in a cart.
    190190    *
    191191    * @access   public
    192     * @param   
    193     * @return   
     192    * @param
     193    * @return
    194194    * @author   Quinn Comendant <quinn@strangecode.com>
    195195    * @version  1.0
     
    209209        }
    210210    }
    211    
     211
    212212    /*
    213213    * Remove an item from the cart.
     
    222222    {
    223223        $app =& App::getInstance();
    224        
     224
    225225        if (isset($_SESSION['_cart'][$this->_ns]['items'][$item_id])) {
    226226            unset($_SESSION['_cart'][$this->_ns]['items'][$item_id]);
     
    231231        }
    232232    }
    233    
     233
    234234    /*
    235235    * Return the value matching key for a specified item.
     
    250250        return false;
    251251    }
    252    
     252
    253253    /*
    254254    * Return an array of the items in cart.
     
    264264        return $_SESSION['_cart'][$this->_ns]['items'];
    265265    }
    266    
     266
    267267    /*
    268268    * Return the sum of the numeric values stored under the specified key for cart items.
     
    299299            break;
    300300        }
    301        
     301
    302302        return $sum;
    303303    }
    304304
    305305    /**
    306      * Resets the $_SESSION cart array. This should be executed with the same consideration 
     306     * Resets the $_SESSION cart array. This should be executed with the same consideration
    307307     * as $auth->clear(), such as when logging out.
    308308     */
    309309    public function clear()
    310310    {
     311        $app =& App::getInstance();
     312
    311313        $_SESSION['_cart'][$this->_ns] = array(
    312314            'items' => array(),
    313315        );
     316
     317        $app->logMsg(sprintf('Cleared %s cart', $this->_ns), LOG_DEBUG, __FILE__, __LINE__);
    314318    }
    315319}
  • trunk/lib/Prefs.inc.php

    r579 r611  
    397397    public function clear($scope='all')
    398398    {
     399        $app =& App::getInstance();
     400
    399401        switch ($scope) {
    400402        case 'all' :
     
    428430            break;
    429431        }
     432
     433        $app->logMsg(sprintf('Cleared %s %s prefs', $scope, $this->_ns), LOG_DEBUG, __FILE__, __LINE__);
    430434    }
    431435
  • trunk/services/logout.php

    r468 r611  
    44 * For details visit the project site: <http://trac.strangecode.com/codebase/>
    55 * Copyright 2001-2012 Strangecode, LLC
    6  * 
     6 *
    77 * This file is part of The Strangecode Codebase.
    88 *
     
    1111 * Free Software Foundation, either version 3 of the License, or (at your option)
    1212 * any later version.
    13  * 
     13 *
    1414 * The Strangecode Codebase is distributed in the hope that it will be useful, but
    1515 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1616 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    1717 * details.
    18  * 
     18 *
    1919 * You should have received a copy of the GNU General Public License along with
    2020 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
     
    2525 */
    2626
    27 if (isset($auth) && method_exists($auth, 'get') && true === $app->getParam('enable_db')) {
    28     // Delete the current user's record locks.
    29     require_once 'codebase/lib/Lock.inc.php';
    30     $lock =& Lock::getInstance($auth);
    31     $lock->removeAll($auth->get('user_id'));
     27if (isset($prefs) && method_exists($prefs, 'clear')) {
     28    $prefs->clear();
    3229}
    33 
    34 // Logout.
    35 $auth->clear();
     30if (isset($tmp_prefs) && method_exists($tmp_prefs, 'clear')) {
     31    $tmp_prefs->clear();
     32}
     33if (isset($cache) && method_exists($cache, 'clear')) {
     34    $cache->clear();
     35}
     36if (isset($cart) && method_exists($cart, 'clear')) {
     37    $cart->clear();
     38}
     39if (isset($auth) && method_exists($auth, 'get')) {
     40    if (true === $app->getParam('enable_db')) {
     41        // Delete the current user's record locks.
     42        require_once 'codebase/lib/Lock.inc.php';
     43        $lock =& Lock::getInstance($auth);
     44        $lock->removeAll($auth->get('user_id'));
     45    }
     46}
     47if (isset($auth) && method_exists($auth, 'clear')) {
     48    $auth->clear();
     49}
    3650
    3751$app->raiseMsg(sprintf(_("Your session has been logged-out."), null), MSG_SUCCESS, __FILE__, __LINE__);
Note: See TracChangeset for help on using the changeset viewer.