Permalink
Browse files

BackwardsCompatibilityBreak - the first parameter of fSession::clear(…

…) was removed, fSession::delete() should now be used instead
  • Loading branch information...
wbond committed May 8, 2009
1 parent d6d9c90 commit a158d016108fadf3c83629d0463c97b2dfa2131a
Showing with 39 additions and 28 deletions.
  1. +7 −6 classes/fAuthorization.php
  2. +3 −2 classes/fCRUD.php
  3. +4 −3 classes/fMessaging.php
  4. +3 −2 classes/fRequest.php
  5. +22 −15 classes/fSession.php
View
@@ -9,7 +9,8 @@
* @package Flourish
* @link http://flourishlib.com/fAuthorization
*
* @version 1.0.0b2
* @version 1.0.0b3
* @changes 1.0.0b3 Updated class to use new fSession API [wb, 2009-05-08]
* @changes 1.0.0b2 Fixed a bug with using named IP ranges in ::checkIP() [wb, 2009-01-10]
* @changes 1.0.0b The initial implementation [wb, 2007-06-14]
*/
@@ -233,10 +234,10 @@ static public function checkLoggedIn()
*/
static public function destroyUserInfo()
{
fSession::clear('user_auth_level', __CLASS__ . '::');
fSession::clear('user_acls', __CLASS__ . '::');
fSession::clear('user_token', __CLASS__ . '::');
fSession::clear('requested_url', __CLASS__ . '::');
fSession::delete('user_auth_level', __CLASS__ . '::');
fSession::delete('user_acls', __CLASS__ . '::');
fSession::delete('user_token', __CLASS__ . '::');
fSession::delete('requested_url', __CLASS__ . '::');
}
@@ -251,7 +252,7 @@ static public function getRequestedURL($clear, $default_url=NULL)
{
$requested_url = fSession::get('requested_url', $default_url, __CLASS__ . '::');
if ($clear) {
fSession::clear('requested_url', __CLASS__ . '::');
fSession::delete('requested_url', __CLASS__ . '::');
}
return $requested_url;
}
View
@@ -9,7 +9,8 @@
* @package Flourish
* @link http://flourishlib.com/fCRUD
*
* @version 1.0.0b3
* @version 1.0.0b4
* @changes 1.0.0b4 Updated class to use new fSession API [wb, 2009-05-08]
* @changes 1.0.0b3 Backwards Compatiblity Break - moved ::printOption() to fHTML::printOption(), ::showChecked() to fHTML::showChecked(), ::removeListItems() and ::reorderListItems() to fException::splitMessage(), ::generateRequestToken() to fRequest::generateCSRFToken(), and ::validateRequestToken() to fRequest::validateCSRFToken() [wb, 2009-05-08]
* @changes 1.0.0b2 Fixed a bug preventing loaded search values from being included in redirects [wb, 2009-03-18]
* @changes 1.0.0b The initial implementation [wb, 2007-06-14]
@@ -311,7 +312,7 @@ static public function redirectWithLoadedValues()
*/
static public function reset()
{
fSession::clear(NULL, __CLASS__ . '::');
fSession::clear(__CLASS__ . '::');
self::$loaded_values = array();
self::$row_number = 1;
View
@@ -9,7 +9,8 @@
* @package Flourish
* @link http://flourishlib.com/fMessaging
*
* @version 1.0.0b2
* @version 1.0.0b3
* @changes 1.0.0b3 Updated class to use new fSession API [wb, 2009-05-08]
* @changes 1.0.0b2 Changed ::show() to accept more than one message name, or * for all messages [wb, 2009-01-12]
* @changes 1.0.0b The initial implementation [wb, 2008-03-05]
*/
@@ -59,7 +60,7 @@ static public function create($name, $recipient, $message)
*/
static public function reset()
{
fSession::clear(NULL, __CLASS__ . '::');
fSession::clear(__CLASS__ . '::');
}
@@ -74,7 +75,7 @@ static public function retrieve($name, $recipient)
{
$prefix = __CLASS__ . '::' . $recipient . '::';
$message = fSession::get($name, NULL, $prefix);
fSession::clear($name, $prefix);
fSession::delete($name, $prefix);
return $message;
}
View
@@ -15,7 +15,8 @@
* @package Flourish
* @link http://flourishlib.com/fRequest
*
* @version 1.0.0b2
* @version 1.0.0b3
* @changes 1.0.0b3 Updated class to use new fSession API [wb, 2009-05-08]
* @changes 1.0.0b2 Added ::generateCSRFToken() from fCRUD::generateRequestToken() and ::validateCSRFToken() from fCRUD::validateRequestToken() [wb, 2009-05-08]
* @changes 1.0.0b The initial implementation [wb, 2007-06-14]
*/
@@ -492,7 +493,7 @@ static private function processAcceptHeader($header)
*/
static public function reset()
{
fSession::clear(NULL, __CLASS__ . '::');
fSession::clear(__CLASS__ . '::');
self::$backup_files = NULL;
self::$backup_get = NULL;
View
@@ -14,7 +14,8 @@
* @package Flourish
* @link http://flourishlib.com/fSession
*
* @version 1.0.0b5
* @version 1.0.0b6
* @changes 1.0.0b6 Backwards Compatibility Break - the first parameter of ::clear() was removed, use ::delete() instead [wb, 2009-05-08]
* @changes 1.0.0b5 Added documentation about session cache limiter warnings [wb, 2009-05-04]
* @changes 1.0.0b4 The class now works with existing sessions [wb, 2009-05-04]
* @changes 1.0.0b3 Fixed ::clear() to properly handle when `$key` is `NULL` [wb, 2009-02-05]
@@ -26,6 +27,7 @@ class fSession
// The following constants allow for nice looking callbacks to static methods
const clear = 'fSession::clear';
const close = 'fSession::close';
const delete = 'fSession::delete';
const destroy = 'fSession::destroy';
const get = 'fSession::get';
const ignoreSubdomain = 'fSession::ignoreSubdomain';
@@ -45,31 +47,21 @@ class fSession
/**
* Unsets a key from the `$_SESSION` superglobal using the prefix provided
* Removes all session values with the provided prefix
*
* @param string $key The key to unset, if no key is specified all keys with the prefix will be removed
* @param string $prefix The prefix to stick before the key
* @param string $prefix The prefix to clear all session values for
* @return void
*/
static public function clear($key=NULL, $prefix='fSession::')
static public function clear($prefix='fSession::')
{
self::open();
if ($key !== NULL) {
unset($_SESSION[$prefix . $key]);
return;
}
$remove = array();
foreach ($_SESSION as $key => $value) {
if (strpos($key, $prefix) === 0) {
$remove[] = $key;
unset($_SESSION[$key]);
}
}
foreach ($remove as $key) {
unset($_SESSION[$key]);
}
}
@@ -87,6 +79,21 @@ static public function close()
}
/**
* Deletes a value from the session
*
* @param string $key The key of the value to delete
* @param string $prefix The prefix to use for the key
* @return void
*/
static public function delete($key, $prefix='fSession::')
{
self::open();
unset($_SESSION[$prefix . $key]);
}
/**
* Destroys the session, removing all values
*

0 comments on commit a158d01

Please sign in to comment.