Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
2d0c3c79
Commit
2d0c3c79
authored
May 10, 2007
by
Donal McMullan
Browse files
Change session object to be a singleton
parent
c6e39e4c
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/auth/session.php
View file @
2d0c3c79
...
...
@@ -79,13 +79,31 @@ class Session {
/**
* Resumes an existing session, only if there is one
*/
p
ublic
function
__construct
()
{
p
rivate
function
__construct
()
{
// Resume an existing session if required
if
(
isset
(
$_COOKIE
[
session_name
()]))
{
session_start
();
}
}
/**
* Singelton function keeps us from generating multiple instances of this
* class
*
* @return object The class instance
* @access public
*/
public
static
function
singleton
()
{
//single instance
static
$instance
;
//if we don't have the single instance, create one
if
(
!
isset
(
$instance
))
{
$instance
=
new
Session
();
}
return
(
$instance
);
}
/**
* Gets the session property keyed by $key.
*
...
...
@@ -201,6 +219,16 @@ class Session {
}
}
/**
* Find out if the session has been started yet
*/
public
function
is_live
()
{
if
(
""
==
session_id
())
{
return
false
;
}
return
true
;
}
/**
* Escape a message for HTML output
*
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment