Verified Commit 6b1217c2 authored by dockx thibault's avatar dockx thibault
Browse files

:sparkles: (CORE) - progression of un-seralization 3

Login success and ldap edit success
No related merge requests found
Showing with 28 additions and 11 deletions
+28 -11
......@@ -100,8 +100,6 @@ if (!is_readable(CONFIG_DIR.'/'.CONFIG_FILE)) {
$config = new config(CONFIG_DIR.'/'.CONFIG_FILE, $BASE_DIR);
session::set('config', $config);
print_r($_SESSION);
session::set('DEBUGLEVEL', $config->get_cfg_value('DEBUGLEVEL'));
logging::debug(DEBUG_CONFIG, __LINE__, __FUNCTION__, __FILE__, $config->data, 'config');
/* Configuration was reloaded, so plist needs to be as well */
......
......@@ -83,6 +83,33 @@ class config
}
}
public function __serialize (): array
{
return [
'config_found' => $this->config_found,
'tags' => $this->tags,
'level' => $this->level,
'currentLocation' => $this->currentLocation,
'current' => $this->current,
'referrals' => $this->referrals,
'data' => $this->data,
];
}
public function __unserialize(array $data): void
{
$this->config_found = $data['config_found'];
$this->tags = $data['tags'];
$this->level = $data['level'];
$this->currentLocation = $data['currentLocation'];
$this->current = $data['current'];
$this->referrals = $data['referrals'];
$this->data = $data['data'];
// Recreate the XML parser
$this->parser = xml_parser_create();
}
/*!
* \brief Check and reload the configuration
*
......
......@@ -56,9 +56,6 @@ class session
*/
public static function set ($name, $value)
{
if ($name === 'config') {
$value = pack('C',$value);
}
$_SESSION[$name] = $value;
}
......@@ -77,12 +74,7 @@ class session
*/
public static function get ($name)
{
if ($name === 'config') {
if (isset($_SESSION['config'])) {
return unpack('C', $_SESSION[$name]);
}
}
else if (isset($_SESSION[$name])) {
if (isset($_SESSION[$name])) {
return $_SESSION[$name];
} else {
return NULL;
......
Supports Markdown
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