var $alt_person;
var $alt_auth;
- function PLCSession($name = NULL, $pass = NULL)
+ function __construct($name = NULL, $pass = NULL)
{
$name= strtolower( $name );
// User API access
'AuthString' => $pass));
// Authenticate user and get session key
- $session = $api->GetSession();
+ $seconds_to_expire = (24 * 60 * 60 * 14);
+ $session = $api->GetSession($seconds_to_expire);
if (!$session) {
- return NULL;
+ return NULL;
}
// Change GetSession() at some point to return expires as well
- $expires = time() + (24 * 60 * 60);
+ $expires = time() + $seconds_to_expire;
// Change to session authentication
$api->auth = array('AuthMethod' => "session", 'session' => $session);
$_SESSION['plc'] = array('auth' => $api->auth,
'person' => $person,
'expires' => $expires);
- }
+ }
}
function BecomePerson($person_id)
list($person) = $this->api->GetPersons(array($person_id));
if ($person)
{
- //Get this users session if one exists, create
+ //Get this users session if one exists, create
//one otherwise
list($session) = $this->api->GetSessions(array('person_id' => $person['person_id']));
if (!$session)
{
- $session = $this->api->AddSession($person['person_id']);
+ $session = $this->api->AddSession($person['person_id']);
}
else
{
$_SESSION['plc']['person'] = $this->person;
$_SESSION['plc']['alt_person'] = $this->alt_person;
$_SESSION['plc']['alt_auth'] = $this->alt_auth;
-
- }
+
+ }
}
function BecomeSelf()
- {
+ {
if($this->alt_auth && $this->alt_person )
{
$this->person = $this->alt_person;
$_SESSION['plc']['person'] = $_SESSION['plc']['alt_person'];
unset($_SESSION['plc']['alt_auth']);
unset($_SESSION['plc']['alt_person']);
- }
+ }
}
-
+
function logout()
{