세션 폴더에 접근할수 문제 수정 및 세션 저장경로 수정#175
This commit is contained in:
@ -11,6 +11,7 @@ require_once realpath(dirname(__FILE__)) . "/StorageInterface.php";
|
||||
* HybridAuth storage manager
|
||||
*/
|
||||
class Hybrid_Storage implements Hybrid_Storage_Interface {
|
||||
public static $stores = array();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -37,11 +38,21 @@ class Hybrid_Storage implements Hybrid_Storage_Interface {
|
||||
$key = strtolower($key);
|
||||
|
||||
if ($value) {
|
||||
$_SESSION["HA::CONFIG"][$key] = serialize($value);
|
||||
$serialize_value = function_exists('get_string_encrypt') ? get_string_encrypt(serialize($value)) : serialize($value);
|
||||
|
||||
if( in_array($key, array('php_session_id', 'config')) ){
|
||||
$this->stores[$key] = $serialize_value;
|
||||
} else {
|
||||
$_SESSION["HA::CONFIG"][$key] = $serialize_value;
|
||||
}
|
||||
} elseif (isset($this->stores[$key])) {
|
||||
$unserialize_value = function_exists('get_string_decrypt') ? unserialize(get_string_decrypt($this->stores[$key])) : unserialize($this->stores[$key]);
|
||||
return $unserialize_value;
|
||||
} elseif (isset($_SESSION["HA::CONFIG"][$key])) {
|
||||
return unserialize($_SESSION["HA::CONFIG"][$key]);
|
||||
$unserialize_value = function_exists('get_string_decrypt') ? unserialize(get_string_decrypt($_SESSION["HA::CONFIG"][$key])) : unserialize($_SESSION["HA::CONFIG"][$key]);
|
||||
return $unserialize_value;
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -55,7 +66,8 @@ class Hybrid_Storage implements Hybrid_Storage_Interface {
|
||||
$key = strtolower($key);
|
||||
|
||||
if (isset($_SESSION["HA::STORE"], $_SESSION["HA::STORE"][$key])) {
|
||||
return unserialize($_SESSION["HA::STORE"][$key]);
|
||||
$unserialize_value = function_exists('get_string_decrypt') ? unserialize(get_string_decrypt($_SESSION["HA::STORE"][$key])) : unserialize($_SESSION["HA::STORE"][$key]);
|
||||
return $unserialize_value;
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -70,7 +82,8 @@ class Hybrid_Storage implements Hybrid_Storage_Interface {
|
||||
*/
|
||||
public function set($key, $value) {
|
||||
$key = strtolower($key);
|
||||
$_SESSION["HA::STORE"][$key] = serialize($value);
|
||||
$serialize_value = function_exists('get_string_encrypt') ? get_string_encrypt(serialize($value)) : serialize($value);
|
||||
$_SESSION["HA::STORE"][$key] = $serialize_value;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -138,4 +151,4 @@ class Hybrid_Storage implements Hybrid_Storage_Interface {
|
||||
$_SESSION["HA::STORE"] = unserialize($sessiondata);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -391,7 +391,8 @@ function social_session_exists_check(){
|
||||
}
|
||||
|
||||
if( $provider_name && isset($_SESSION['HA::STORE']['hauth_session.'.strtolower($provider_name).'.is_logged_in']) && !empty($_SESSION['sl_userprofile'][$provider_name]) ){
|
||||
return json_decode($_SESSION['sl_userprofile'][$provider_name]);
|
||||
$decode_value = function_exists('get_string_decrypt') ? json_decode(get_string_decrypt($_SESSION['sl_userprofile'][$provider_name])) : json_decode($_SESSION['sl_userprofile'][$provider_name]);
|
||||
return $decode_value;
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -485,8 +486,9 @@ function social_check_login_before($p_service=''){
|
||||
$_SESSION['sl_userprofile'] = array();
|
||||
}
|
||||
|
||||
if( ! $is_member ){
|
||||
$_SESSION['sl_userprofile'][$provider_name] = json_encode( $user_profile );
|
||||
if( ! $is_member ){
|
||||
$encode_value = function_exists('get_string_encrypt') ? get_string_encrypt(json_encode($user_profile)) : json_encode($user_profile);
|
||||
$_SESSION['sl_userprofile'][$provider_name] = $encode_value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,40 @@ if (!defined('_GNUBOARD_')) exit;
|
||||
|
||||
class G5_Hybrid_Endpoint extends Hybrid_Endpoint
|
||||
{
|
||||
protected function authInit() {
|
||||
if (!$this->initDone) {
|
||||
$this->initDone = true;
|
||||
|
||||
// Init Hybrid_Auth
|
||||
try {
|
||||
if (!class_exists("Hybrid_Storage", false)) {
|
||||
require_once realpath(dirname(dirname(__FILE__))). "/Hybrid/Storage.php";
|
||||
}
|
||||
if (!class_exists("Hybrid_Exception", false)) {
|
||||
require_once realpath(dirname(dirname(__FILE__))). "/Hybrid/Exception.php";
|
||||
}
|
||||
if (!class_exists("Hybrid_Logger", false)) {
|
||||
require_once realpath(dirname(dirname(__FILE__))). "/Hybrid/Logger.php";
|
||||
}
|
||||
|
||||
$storage = new Hybrid_Storage();
|
||||
$provider_id = ucfirst(trim(strip_tags($this->request["hauth_start"])));
|
||||
if(!$provider_id) $provider_id = ucfirst(trim(strip_tags($this->request["hauth_done"])));
|
||||
|
||||
$storage->config("CONFIG", social_build_provider_config($provider_id));
|
||||
// Check if Hybrid_Auth session already exist
|
||||
if (!$storage->config("CONFIG")) {
|
||||
$this->dieError("CONFIG FAILED: ", "Unable to get config", array());
|
||||
}
|
||||
|
||||
Hybrid_Auth::initialize($storage->config("CONFIG"));
|
||||
} catch (Exception $e) {
|
||||
Hybrid_Logger::error("Endpoint: Error while trying to init Hybrid_Auth: " . $e->getMessage());
|
||||
$this->dieError("Endpoint Error: ", $e->getMessage(), $e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function processAuthStart(){
|
||||
try {
|
||||
parent::processAuthStart();
|
||||
|
||||
Reference in New Issue
Block a user