Updates all over. Redid some of the doc blocks cause they weren't to scale of a vim session with lline numbers on (still may not be... ugh). Also changed around some of the model level variables and stuff.

git-svn-id: http://svn.cleancode.org/svn/pickles@58 4d10bc64-7434-11dc-a737-d2d0f8310089
This commit is contained in:
Josh Sherman 2008-09-24 03:37:09 +00:00
parent 3d4b9f63b8
commit e02ded351d
12 changed files with 206 additions and 221 deletions

View file

@ -29,8 +29,7 @@ class Security extends Object {
* the configuration as well.
*/
static function authenticate() {
$db = DB::getInstance();
$session = Session::getInstance();
$db = DB::getInstance();
if (isset($_SERVER['PHP_AUTH_USER'])) {
$from = '
@ -43,14 +42,14 @@ class Security extends Object {
$db->execute('SELECT COUNT(id) ' . $from);
if ($db->getField() != 0) {
$db->execute('SELECT id ' . $from);
$session->user_id = $db->getField();
$_SESSION['user_id'] = $db->getField();
}
else {
$session->user_id = null;
$_SESSION['user_id'] = null;
}
}
if (!isset($session->user_id)) {
if (!isset($_SESSION['user_id'])) {
header('WWW-Authenticate: Basic realm="Site Admin"');
header('HTTP/1.0 401 Unauthorized');
exit('No shirt, no shoes, no salvation. Access denied.');