Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New session manager and partial groups
This commit includes a new session manager, but there is also a lot of edits on adding member groups that I'm not sure is complete or not, but I found was already changed in my local copy and didn't want to discard.
- Loading branch information
Showing
11 changed files
with
141 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,6 @@ | |
* @subpackage Core | ||
*/ | ||
|
||
require("classes/TemplateEngine.php"); | ||
|
||
abstract class BaseController { | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
/** | ||
* The session manager manages all access to $_SESSION. This way | ||
* we can isolate the functions for testing, or if we want to | ||
* store session information in a different manner. | ||
* | ||
* It is implemented in a "singleton-like" pattern, where you can | ||
* only have one instance, but that is created automatically | ||
* when you call one of it's functions. | ||
* | ||
* This needs refactoring into a proper singleton, so we can allow | ||
* people ot instance it without actually using session cookies. | ||
* | ||
* @author Chris Worfolk <chris@societaspro.org> | ||
* @package SocietasPro | ||
* @subpackage Core | ||
*/ | ||
|
||
class SessionManager extends Singleton { | ||
|
||
private static $instance; | ||
|
||
/** | ||
* Get a session variable | ||
* | ||
* @param string $key Session variable key | ||
* @return mixed Value | ||
*/ | ||
public static function get ($key) { | ||
|
||
self::getInstance(); | ||
|
||
if (isset($_SESSION[$key])) { | ||
return $_SESSION[$key]; | ||
} else { | ||
return false; | ||
} | ||
|
||
} | ||
|
||
/** | ||
* Singleton | ||
* | ||
* @return boolean Success | ||
*/ | ||
private static function getInstance () { | ||
if (!isset(self::$instance)) { | ||
$className = __CLASS__; | ||
self::$instance = new $className; | ||
session_start(); | ||
} | ||
return true; | ||
} | ||
|
||
/** | ||
* Set a session variable | ||
* | ||
* @param string $key Variable key | ||
* @param mixed $value Value | ||
* @return boolean Success | ||
*/ | ||
public static function set ($key, $value) { | ||
|
||
self::getInstance(); | ||
|
||
$_SESSION[$key] = $value; | ||
return true; | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters