Commit acf76cc8 authored by Denis S. Valdenaire's avatar Denis S. Valdenaire

ajout sessions sur saas

parent 0460d0e0
...@@ -29,12 +29,14 @@ class session_saas { ...@@ -29,12 +29,14 @@ class session_saas {
session_set_cookie_params($this->life_time); session_set_cookie_params($this->life_time);
} }
session_start(); session_start();
return true;
} }
public function __destruct() { public function __destruct() {
if($this->debug) { if($this->debug) {
trigger_error('session_saas::__destruct called', E_USER_NOTICE); trigger_error('session_saas::__destruct called', E_USER_NOTICE);
} }
return true;
} }
public function open() { public function open() {
...@@ -60,9 +62,11 @@ class session_saas { ...@@ -60,9 +62,11 @@ class session_saas {
if($this->debug) { if($this->debug) {
trigger_error('session_saas::read called', E_USER_NOTICE); trigger_error('session_saas::read called', E_USER_NOTICE);
} }
if($session = json_decode(file_get_contents($GLOBALS["saas_auth_url"]. if($session = json_decode(file_get_contents($GLOBALS["saas_sessions_url"].
"?o=saas_sessions&a=read&i=".$id))) { "?a=read&i=".$id))) {
return base64_decode($session->data); if(isset($session->data)) {
return base64_decode($session->data);
}
} }
return ''; return '';
} }
...@@ -74,7 +78,6 @@ class session_saas { ...@@ -74,7 +78,6 @@ class session_saas {
$postdata = http_build_query( $postdata = http_build_query(
array( array(
'o' => 'saas_sessions',
'a' => 'write', 'a' => 'write',
'i' => $id, 'i' => $id,
'data' => base64_encode($data) 'data' => base64_encode($data)
...@@ -90,7 +93,10 @@ class session_saas { ...@@ -90,7 +93,10 @@ class session_saas {
); );
$context = stream_context_create($opts); $context = stream_context_create($opts);
return json_decode(file_get_contents($GLOBALS["saas_auth_url"], false, $context)); if(file_get_contents($GLOBALS["saas_sessions_url"], false, $context)) {
return false;
}
return true;
} }
public function destroy($id, $key_only = FALSE) { public function destroy($id, $key_only = FALSE) {
...@@ -99,7 +105,6 @@ class session_saas { ...@@ -99,7 +105,6 @@ class session_saas {
} }
$postdata = http_build_query( $postdata = http_build_query(
array( array(
'o' => 'saas_sessions',
'a' => 'destroy', 'a' => 'destroy',
'i' => $id 'i' => $id
) )
...@@ -114,14 +119,21 @@ class session_saas { ...@@ -114,14 +119,21 @@ class session_saas {
); );
$context = stream_context_create($opts); $context = stream_context_create($opts);
return json_decode(file_get_contents($GLOBALS["saas_auth_url"], false, $context)); if(!file_get_contents($GLOBALS["saas_sessions_url"], false, $context)) {
return false;
}
return true;
} }
public function gc($max) { public function gc($max) {
/*
if($this->debug) { if($this->debug) {
trigger_error('session_saas::gc called', E_USER_NOTICE); trigger_error('session_saas::gc called', E_USER_NOTICE);
} }
return json_decode(file_get_contents($GLOBALS["saas_auth_url"]. if(!file_get_contents($GLOBALS["saas_sessions_url"]."?a=gc")) {
"?o=saas_sessions&a=gc")); return false;
}
*/
return true;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment