From f236b85eddce2dc5ce293b48e7e8cf03146baeea Mon Sep 17 00:00:00 2001
From: Damien <damien.burel@maarch.org>
Date: Fri, 4 May 2018 14:18:40 +0200
Subject: [PATCH] FEAT #7710 Delete core/services

---
 core/Test/define.php                      |  68 --
 core/services/Abstract.php                | 337 ---------
 core/services/CoreConfig.php              | 865 ----------------------
 core/services/MaarchException.php         |  25 -
 core/services/MaarchExceptionAbstract.php |  38 -
 core/services/Session.php                 |  26 -
 core/services/SessionAbstract.php         | 310 --------
 7 files changed, 1669 deletions(-)
 delete mode 100755 core/services/Abstract.php
 delete mode 100755 core/services/CoreConfig.php
 delete mode 100755 core/services/MaarchException.php
 delete mode 100755 core/services/MaarchExceptionAbstract.php
 delete mode 100755 core/services/Session.php
 delete mode 100755 core/services/SessionAbstract.php

diff --git a/core/Test/define.php b/core/Test/define.php
index 89480709bf0..d24a431af8c 100755
--- a/core/Test/define.php
+++ b/core/Test/define.php
@@ -11,74 +11,6 @@ require_once 'vendor/autoload.php';
 
 $userId = 'superadmin';
 
-//require_once 'core/class/class_functions.php';
-//include_once('core/init.php');
-//require_once('core/class/class_portal.php');
-//require_once('core/class/class_db.php');
-//require_once('core/class/class_request.php');
-//require_once('core/class/class_core_tools.php');
-//require_once('core/class/web_service/class_web_service.php');
-//require_once('core/services/CoreConfig.php');
-//
-////for auth
-//$_SERVER['PHP_AUTH_USER'] = 'superadmin';
-//$_SERVER['PHP_AUTH_PW'] = 'superadmin';
-//
-////load Maarch session vars
-//$portal = new portal();
-//$portal->unset_session();
-//$portal->build_config();
-//$coreTools = new core_tools();
-//$_SESSION['custom_override_id'] = $coreTools->get_custom_id();
-//if (isset($_SESSION['custom_override_id'])
-//    && ! empty($_SESSION['custom_override_id'])
-//    && isset($_SESSION['config']['corepath'])
-//    && ! empty($_SESSION['config']['corepath'])
-//) {
-//    $path = $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR
-//        . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR;
-//    set_include_path(
-//        $path . PATH_SEPARATOR . $_SESSION['config']['corepath']
-//        . PATH_SEPARATOR . get_include_path()
-//    );
-//} else if (isset($_SESSION['config']['corepath'])
-//    && ! empty($_SESSION['config']['corepath'])
-//) {
-//    set_include_path(
-//        $_SESSION['config']['corepath'] . PATH_SEPARATOR . get_include_path()
-//    );
-//}
-//// Load configuration from xml into session
-//Core_CoreConfig_Service::buildCoreConfig('core' . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'config.xml');
-//$_SESSION['config']['app_id'] = $_SESSION['businessapps'][0]['appid'];
-//require_once 'apps/' .$_SESSION['businessapps'][0]['appid']. '/class/class_business_app_tools.php';
-//
-//Core_CoreConfig_Service::buildBusinessAppConfig();
-//
-//// Load Modules configuration from xml into session
-//Core_CoreConfig_Service::loadModulesConfig($_SESSION['modules']);
-//Core_CoreConfig_Service::loadAppServices();
-//Core_CoreConfig_Service::loadModulesServices($_SESSION['modules']);
-//
-//$folderRootName = str_replace("\\","/", dirname(__file__));
-//$folderRootName = str_replace('/core/Test', '', $folderRootName);
-//$folderRootName = substr($folderRootName, strrpos($folderRootName, "/")+1);
-//$_SESSION['config']['coreurl'] = 'http://localhost/' . $folderRootName . '/';
-//
-////login management
-//require_once('apps/maarch_entreprise/class/class_login.php');
-//$loginObj = new login();
-//$loginMethods = $loginObj->build_login_method();
-//require_once('core/services/Session.php');
-//$oSessionService = new \Core_Session_Service();
-//$loginObj->execute_login_script($loginMethods, true);
-//
-//if ($_SESSION['error']) {
-//    //TODO : return http bad authent error
-//    echo $_SESSION['error'];
-//    exit();
-//}
-
 $language = \SrcCore\models\CoreConfigModel::getLanguage();
 require_once("src/core/lang/lang-{$language}.php");
 
diff --git a/core/services/Abstract.php b/core/services/Abstract.php
deleted file mode 100755
index 8f7a8270bd9..00000000000
--- a/core/services/Abstract.php
+++ /dev/null
@@ -1,337 +0,0 @@
-<?php
-
-/**
-*   @copyright 2017 Maarch
-*
-*   This file is part of Maarch Framework.
-*
-*   Maarch Framework is free software: you can redistribute it and/or modify
-*   it under the terms of the GNU General Public License as published by
-*   the Free Software Foundation, either version 3 of the License, or
-*   (at your option) any later version.
-*
-*   Maarch Framework is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*   along with Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-require_once 'core/class/class_core_tools.php';
-require_once 'core/services/MaarchException.php';
-
-/**
- * 
- */
-abstract class Core_Abstract_Service {
-	/**
-	 * Récupération de la liste des méthodes disponibles via api
-	 * 
-	 * @return string[] La liste des méthodes
-	 */
-	public static function getApiMethod() {
-		return [
-			'getApiMethod' => 'getApiMethod',
-		];
-	}
-
-	/**
-	 * Vérifie que l'user est bien les droits requis
-	 * @param array $aRequired
-	 * @return boolean true
-	 * @throws Exception denied
-	**/
-	protected static function checkAllow(array $aRequired) {
-		$core = new core_tools();
-		foreach ($aRequired as $permission) {
-			if ( ! $core->test_service($permission, 'apps', false) ) {
-				throw new Core_MaarchException_Service('missing permission required : '.$permission);
-			}
-		}
-		return true;
-	}
-
-	/**
-	 * Vérifie que l'argument est bien existant
-	 * @param array $aArgs
-	 * @param array $aRequired
-	 * @param string $sErrorTxt
-	**/
-	protected static function checkIsset(array $aArgs, $aRequired, $sErrorTxt='$required is not set') {
-		if ( is_string($aRequired) ) {
-			$aRequired = [$aRequired];
-		}
-		if ( ! is_array($aRequired) ) {
-			throw new Core_MaarchException_Service("aRequired is not a array", 1);
-		}
-		foreach ($aRequired as $required) {
-			if ( !isset($aArgs[$required]) ) {
-				throw new Core_MaarchException_Service(str_replace('$required', $required, $sErrorTxt));
-			}
-		}
-		return true;
-	}
-
-	/**
-	 * Vérifie que l'argument est bien rempli
-	 * @param array $aArgs
-	 * @param array $aRequired
-	 * @param string $sErrorTxt
-	**/
-	protected static function checkRequired(array $aArgs, $aRequired, $sErrorTxt='$required is required') {
-		if ( is_string($aRequired) ) {
-			$aRequired = [$aRequired];
-		}
-		if ( ! is_array($aRequired) ) {
-			throw new Core_MaarchException_Service("aRequired is not a array", 1);
-		}
-		foreach ($aRequired as $required) {
-			if ( !isset($aArgs[$required]) ) {
-				throw new Core_MaarchException_Service(str_replace('$required', $required, $sErrorTxt));
-			}
-			if ( empty($aArgs[$required]) ) {
-				throw new Core_MaarchException_Service(str_replace('$required', $required, $sErrorTxt));
-			}
-		}
-		return true;
-	}
-
-	/**
-	 * Vérifie que l'argument est bien inexistant ou un string
-	 * @param array $aArgs
-	 * @param array $aTry
-	 * @param string $sErrorTxt
-	**/
-	protected static function checkString(array $aArgs, $aTry, $sErrorTxt='$try must be a string') {
-		if ( is_string($aTry) ) {
-			$aTry = [$aTry];
-		}
-		if ( ! is_array($aTry) ) {
-			throw new Core_MaarchException_Service("aTry is not a array", 1);
-		}
-		foreach ($aTry as $try) {
-			if ( !isset($aArgs[$try]) ) {
-				continue;
-			}
-			if ( empty($aArgs[$try]) ) {
-				continue;
-			}
-			if ( ! is_string($aArgs[$try]) ) {
-				throw new Core_MaarchException_Service(str_replace('$try', $try, $sErrorTxt));
-			}
-		}
-		return true;
-	}
-
-	/**
-	 * Vérifie que l'argument est bien inexistant ou un nombre
-	 * @param array $aArgs
-	 * @param array $aTry
-	 * @param string $sErrorTxt
-	**/
-	protected static function checkNumeric(array $aArgs, $aTry, $sErrorTxt='$try must be a number') {
-		if ( is_string($aTry) ) {
-			$aTry = [$aTry];
-		}
-		if ( ! is_array($aTry) ) {
-			throw new Core_MaarchException_Service("aTry is not a array", 1);
-		}
-		foreach ($aTry as $try) {
-			if ( !isset($aArgs[$try]) ) {
-				continue;
-			}
-			if ( empty($aArgs[$try]) ) {
-				continue;
-			}
-			if ( ! is_numeric($aArgs[$try]) ) {
-				throw new Core_MaarchException_Service(str_replace('$try', $try, $sErrorTxt));
-			}
-		}
-		return true;
-	}
-
-	/**
-	 * Vérifie que l'argument est bien inexistant ou un tableau
-	 * @param array $aArgs
-	 * @param array $aTry
-	 * @param string $sErrorTxt
-	**/
-	protected static function checkArray(array $aArgs, $aTry, $sErrorTxt='$try must be a array') {
-		if ( is_string($aTry) ) {
-			$aTry = [$aTry];
-		}
-		if ( ! is_array($aTry) ) {
-			throw new Core_MaarchException_Service("aTry is not a array", 1);
-		}
-		foreach ($aTry as $try) {
-			if ( !isset($aArgs[$try]) ) {
-				continue;
-			}
-			if ( empty($aArgs[$try]) ) {
-				continue;
-			}
-			if ( ! is_array($aArgs[$try]) ) {
-				throw new Core_MaarchException_Service(str_replace('$try', $try, $sErrorTxt));
-			}
-		}
-		return true;
-	}
-
-	/**
-	 * Vérifie que l'argument est bien inexistant ou une instance
-	 * @param array $aArgs
-	 * @param array $aTry
-	 * @param string $sErrorTxt
-	**/
-	protected static function checkObject(array $aArgs, $aTry, $sErrorTxt='$try must be an instance') {
-		if ( is_string($aTry) ) {
-			$aTry = [$aTry];
-		}
-		if ( ! is_array($aTry) ) {
-			throw new Core_MaarchException_Service("aTry is not a array", 1);
-		}
-		foreach ($aTry as $try) {
-			if ( !isset($aArgs[$try]) ) {
-				continue;
-			}
-			if ( empty($aArgs[$try]) ) {
-				continue;
-			}
-			if ( ! is_object($aArgs[$try]) ) {
-				throw new Core_MaarchException_Service(str_replace('$try', $try, $sErrorTxt));
-			}
-		}
-		return true;
-	}
-	protected static function formatDatestring($sDate) {
-		$sDate = trim($sDate);
-		$sDate = preg_replace('#^(\w{2})/(\w{2})/(\w{4})\s(\d{2}):(\d{2})#', '$3-$2-$1 $4:$5:00', $sDate);
-		$sDate = preg_replace('#^(\w{2})/(\w{2})/(\w{4})$#', '$3-$2-$1', $sDate);
-		return $sDate;
-	}
-
-	/**
-	 * Vérifie que l'argument est bien inexistant ou un string representant une date
-	 * @param array $aArgs
-	 * @param array $aTry
-	 * @param string $sErrorTxt
-	**/
-	protected static function checkDatestring(array $aArgs, $aTry, $sErrorTxt='$try must be a date (string) : $value') {
-		if ( is_string($aTry) ) {
-			$aTry = [$aTry];
-		}
-		if ( ! is_array($aTry) ) {
-			throw new Core_MaarchException_Service("aTry is not a array", 1);
-		}
-		self::checkString($aArgs, $aTry, $sErrorTxt);
-		foreach ($aTry as $try) {
-			if ( !isset($aArgs[$try]) ) {
-				continue;
-			}
-			$aArgs[$try] = trim($aArgs[$try]);
-			if ( empty($aArgs[$try]) ) {
-				continue;
-			}
-			if ( ! strtotime($aArgs[$try]) ) {
-				throw new Core_MaarchException_Service(str_replace(['$try','$value',], [$try,$aArgs[$try],], $sErrorTxt));
-			}
-		}
-		return true;
-	}
-
-	/**
-	 * Vérifie que l'argument est bien inexistant ou un objet Date
-	 * @param array $aArgs
-	 * @param array $aTry
-	 * @param string $sErrorTxt
-	**/
-	protected static function checkDateobject(array $aArgs, $aTry, $sErrorTxt='$try must be a date (instance)') {
-		if ( is_string($aTry) ) {
-			$aTry = [$aTry];
-		}
-		if ( ! is_array($aTry) ) {
-			throw new Core_MaarchException_Service("aTry is not a array", 1);
-		}
-		self::checkObject($aArgs, $aTry, $sErrorTxt);
-		foreach ($aTry as $try) {
-			if ( !isset($aArgs[$try]) ) {
-				continue;
-			}
-			if ( empty($aArgs[$try]) ) {
-				continue;
-			}
-			if ( $aArgs[$try] instanceof \Date || $aArgs[$try] instanceof \DateTime ) {
-				throw new Core_MaarchException_Service(str_replace('$try', $try, $sErrorTxt));
-			}
-		}
-		return true;
-	}
-
-	/**
-	 * Vérifie que l'argument est bien inexistant ou un tableau de string
-	 * @param array $aArgs
-	 * @param array $aTry
-	 * @param string $sErrorTxt
-	**/
-	protected static function checkArrayString(array $aArgs, $aTry, $sErrorTxt='$try must be a array of string') {
-		self::checkArray($aArgs, $aTry, $sErrorTxt); // Je testerai que la sous partie des tableaux, et je délégue la vérification du typage tableau
-		if ( is_string($aTry) ) {
-			$aTry = [$aTry];
-		}
-		if ( ! is_array($aTry) ) {
-			throw new Core_MaarchException_Service("aTry is not a array", 1);
-		}
-		foreach ($aTry as $array) {
-			if ( empty($aArgs[$array]) ) {
-				continue;
-			}
-			foreach ($aArgs[$array] as $try) {
-				if ( !isset($aArgs[$try]) ) {
-					continue;
-				}
-				if ( empty($aArgs[$try]) ) {
-					continue;
-				}
-				if ( ! is_string($aArgs[$try]) ) {
-					throw new Core_MaarchException_Service(str_replace('$try', $try, $sErrorTxt));
-				}
-			}
-		}
-		return true;
-	}
-
-	/**
-	 * Vérifie que l'argument est bien inexistant ou un tableau de numeric
-	 * @param array $aArgs
-	 * @param array $aTry
-	 * @param string $sErrorTxt
-	**/
-	protected static function checkArrayNumeric(array $aArgs, $aTry, $sErrorTxt='$try must be a array of numeric') {
-		self::checkArray($aArgs, $aTry, $sErrorTxt); // Je testerai que la sous partie des tableaux, et je délégue la vérification du typage tableau
-		if ( is_string($aTry) ) {
-			$aTry = [$aTry];
-		}
-		if ( ! is_array($aTry) ) {
-			throw new Core_MaarchException_Service("aTry is not a array", 1);
-		}
-		foreach ($aTry as $array) {
-			if ( empty($aArgs[$array]) ) {
-				continue;
-			}
-			foreach ($aArgs[$array] as $try) {
-				if ( !isset($aArgs[$try]) ) {
-					continue;
-				}
-				if ( empty($aArgs[$try]) ) {
-					continue;
-				}
-				if ( ! is_numeric($aArgs[$try]) ) {
-					throw new Core_MaarchException_Service(str_replace('$try', $try, $sErrorTxt));
-				}
-			}
-		}
-		return true;
-	}
-}
diff --git a/core/services/CoreConfig.php b/core/services/CoreConfig.php
deleted file mode 100755
index a05910adec4..00000000000
--- a/core/services/CoreConfig.php
+++ /dev/null
@@ -1,865 +0,0 @@
-<?php
-
-/**
- *   @copyright 2017 Maarch
- *
- *   This file is part of Maarch Framework.
- *
- *   Maarch Framework is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation, either version 3 of the License, or
- *   (at your option) any later version.
- *
- *   Maarch Framework is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-require_once 'core' . DIRECTORY_SEPARATOR . 'class' . DIRECTORY_SEPARATOR . 'class_core_tools.php';
-
-/**
- * Service de configuration du core
- */
-class Core_CoreConfig_Service {
-    /**
-     * Get TableName from the core/xml/config.xml file to load Maarch core configuration into session
-     * @param  string $pathtoxmlcore path to the xml core config file
-     * @return array the list of TableName
-     */
-    private static function getTableName($pathtoxmlcore)
-    {
-        $xmlconfig = simplexml_load_file($pathtoxmlcore);
-        $TABLENAME = $xmlconfig->TABLENAME ;
-        return $TABLENAME;
-    }
-
-    /**
-     * Load Maarch core configuration into sessions vars from the core/xml/config.xml file
-     * @param  string $pathtoxmlcore path to the xml core config file
-     */
-    public static function buildCoreConfig($pathtoxmlcore)
-    {
-        // Get TableName from xml file
-        $TABLENAME = SELF::getTableName($pathtoxmlcore);
-
-        // Loads  core tables into session ($_SESSION['tablename'] array)
-        $_SESSION['tablename']['actions']            = (string) $TABLENAME->actions;
-        $_SESSION['tablename']['authors']            = (string) $TABLENAME->authors;
-        $_SESSION['tablename']['docservers']         = (string) $TABLENAME->docservers;
-        $_SESSION['tablename']['doctypes']           = (string) $TABLENAME->doctypes;
-        $_SESSION['tablename']['history']            = (string) $TABLENAME->history;
-        $_SESSION['tablename']['history_batch']      = (string) $TABLENAME->history_batch;
-        $_SESSION['tablename']['param']              = (string) $TABLENAME->param;
-        $_SESSION['tablename']['security']           = (string) $TABLENAME->security;
-        $_SESSION['tablename']['status']             = (string) $TABLENAME->status;
-        $_SESSION['tablename']['usergroups']         = (string) $TABLENAME->usergroups;
-        $_SESSION['tablename']['usergroup_content']  = (string) $TABLENAME->usergroupcontent;
-        $_SESSION['tablename']['usergroup_services'] = (string) $TABLENAME->usergroups_services;
-        $_SESSION['tablename']['users']              = (string) $TABLENAME->users;
-    }
-
-    /**
-     * Build Maarch business app configuration into sessions vars with a xml
-     * configuration file
-     */
-    public static function buildBusinessAppConfig()
-    {
-        // build Maarch business app configuration into sessions vars
-
-        $core = new core_tools();
-
-        // $_SESSION['config']['app_id']='maarch_entreprise';
-        require_once 'apps' . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id'] . DIRECTORY_SEPARATOR  . 'class' . DIRECTORY_SEPARATOR . 'class_business_app_tools.php';
-        $businessAppTools = new business_app_tools();
-
-        if (file_exists(
-            $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR
-            . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'apps'
-            . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id']
-            . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'config.xml'
-        )
-        ) {
-            $path = $_SESSION['config']['corepath'] . 'custom'
-                . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id']
-                . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR
-                . $_SESSION['config']['app_id'] . DIRECTORY_SEPARATOR . 'xml'
-                . DIRECTORY_SEPARATOR . 'config.xml';
-        } else {
-            $path = 'apps' . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id']
-                . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR
-                . 'config.xml';
-        }
-        $xmlconfig = @simplexml_load_file($path);
-        if ( ! $xmlconfig ) {
-            throw new \Exception('conf not-found : '.$path);
-        }
-        if ($xmlconfig <> false) {
-            $config = $xmlconfig->CONFIG;
-            $uriBeginning = strpos($_SERVER['SCRIPT_NAME'], 'apps');
-            if (empty($uriBeginning)) {
-                $_SESSION['config']['businessappurl'] = $_SESSION['config']['coreurl']
-                    . 'apps/maarch_entreprise/';
-            } else {
-                $url = $_SESSION['config']['coreurl']
-                    .substr($_SERVER['SCRIPT_NAME'], $uriBeginning);
-                $_SESSION['config']['businessappurl'] = str_replace(
-                    'index.php', '', $url
-                );
-            }
-
-            //echo $_SESSION['config']['businessappurl'];exit;
-
-            $_SESSION['config']['databaseserver'] =
-                (string) $config->databaseserver;
-            $_SESSION['config']['databaseserverport'] =
-                (string) $config->databaseserverport;
-            $_SESSION['config']['databasetype'] =
-                (string) $config->databasetype;
-            $_SESSION['config']['databasename'] =
-                (string) $config->databasename;
-            $_SESSION['config']['databaseschema'] =
-                (string) $config->databaseschema;
-            $_SESSION['config']['databaseuser'] =
-                (string) $config->databaseuser;
-            $_SESSION['config']['databasepassword'] =
-                (string) $config->databasepassword;
-            $_SESSION['config']['databasesearchlimit'] =
-                (string) $config->databasesearchlimit;
-            $_SESSION['config']['nblinetoshow'] =
-                (string) $config->nblinetoshow;
-            $_SESSION['config']['limitcharsearch'] =
-                (string) $config->limitcharsearch;
-            $_SESSION['config']['lang']                = (string) $config->lang;
-            $_SESSION['config']['adminmail']           = (string) $config->adminmail;
-            $_SESSION['config']['adminname']           = (string) $config->adminname;
-            $_SESSION['config']['debug']               = (string) $config->debug;
-            $_SESSION['config']['applicationname']     = (string) $config->applicationname;
-            $_SESSION['config']['defaultPage']         = (string) $config->defaultPage;
-            $_SESSION['config']['exportdirectory']     = (string) $config->exportdirectory;
-            $_SESSION['config']['cookietime']          = (string) $config->CookieTime;
-            $_SESSION['config']['ldap']                = (string) $config->ldap;
-            $_SESSION['config']['userdefaultpassword'] = (string) $config->userdefaultpassword;
-            $_SESSION['config']['usePHPIDS']           = (string) $config->usePHPIDS;
-            if (isset($config->showfooter)) {
-                $_SESSION['config']['showfooter'] = (string) $config->showfooter;
-            } else {
-                $_SESSION['config']['showfooter'] = 'true';
-            }
-            //$_SESSION['config']['databaseworkspace'] = (string) $config->databaseworkspace;
-
-            $tablename = $xmlconfig->TABLENAME;
-            $_SESSION['tablename']['doctypes_first_level']  = (string) $tablename->doctypes_first_level;
-            $_SESSION['tablename']['doctypes_second_level'] = (string) $tablename->doctypes_second_level;
-            $_SESSION['tablename']['mlb_doctype_ext']       = (string) $tablename->mlb_doctype_ext;
-            $_SESSION['tablename']['doctypes_indexes']      = (string) $tablename->doctypes_indexes;
-            $_SESSION['tablename']['saved_queries']         = (string) $tablename->saved_queries;
-            $_SESSION['tablename']['contacts_v2']           = (string) $tablename->contacts_v2;
-            $_SESSION['tablename']['contact_types']         = (string) $tablename->contact_types;
-            $_SESSION['tablename']['contact_purposes']      = (string) $tablename->contact_purposes;
-            $_SESSION['tablename']['contact_addresses']     = (string) $tablename->contact_addresses;
-            $_SESSION['tablename']['tags']                  = (string) $tablename->tags;
-
-            $i = 0;
-
-            if ( isset($_SESSION['custom_override_id']) && file_exists(
-                    'custom/' . $_SESSION['custom_override_id'] . '/'
-                    . $_SESSION['config']['lang'] . '.php'
-                )
-            ) {
-                include_once 'custom/' . $_SESSION['custom_override_id'] . '/'
-                    . $_SESSION['config']['lang'] . '.php';
-            }
-            include_once 'apps' . DIRECTORY_SEPARATOR
-                . $_SESSION['config']['app_id'] . DIRECTORY_SEPARATOR
-                . 'lang' . DIRECTORY_SEPARATOR . $_SESSION['config']['lang']
-                . '.php';
-            $_SESSION['collections'] = array();
-            $_SESSION['coll_categories'] = array();
-            foreach ($xmlconfig->COLLECTION as $col) {
-                $tmp = (string) $col->label;
-                if (!empty($tmp) && defined($tmp) && constant($tmp) <> NULL) {
-                    $tmp = constant($tmp);
-                }
-                $extensions = $col->extensions;
-                $collId = (string) $col->id;
-                $tab = array();
-
-                if ($extensions->count()) {
-                    $extensionTables = $extensions->table;
-                    if ($extensionTables->count() > 0) {
-                        foreach ($extensions->table as $table) {
-                            if (strlen($extensionTables) > 0) {
-                                array_push($tab, (string) $table);
-                            }
-                        }
-                    }
-                }
-                if (isset($col->table) && ! empty($col->table)) {
-                    $_SESSION['collections'][$i] = array(
-                        'id'                   => (string) $col->id,
-                        'label'                => (string) $tmp,
-                        'table'                => (string) $col->table,
-                        'version_table'        => (string) $col->version_table,
-                        'view'                 => (string) $col->view,
-                        'adr'                  => (string) $col->adr,
-                        'index_file'           => (string) $col->index_file,
-                        'script_add'           => (string) $col->script_add,
-                        'script_search'        => (string) $col->script_search,
-                        'script_search_result' => (string) $col->script_search_result,
-                        'script_details'       => (string) $col->script_details,
-                        'path_to_lucene_index' => (string) $col->path_to_lucene_index,
-                        'extensions'           => $tab,
-                    );
-
-                    $categories = $col->categories;
-
-                    if (count($categories) > 0) {
-                        foreach ($categories->category as $cat) {
-                            $label = (string) $cat->label;
-                            if (!empty($label) && defined($label)
-                                && constant($label) <> NULL
-                            ) {
-                                $label = constant($label);
-                            }
-                            $_SESSION['coll_categories'][$collId][(string) $cat->id] = $label;
-                        }
-                        $_SESSION['coll_categories'][$collId]['default_category'] = (string) $categories->default_category;
-                    }
-                    $i++;
-                } else {
-                    $_SESSION['collections'][$i] = array(
-                        'id'                   => (string) $col->id,
-                        'label'                => (string) $tmp,
-                        'view'                 => (string) $col->view,
-                        'adr'                  => (string) $col->adr,
-                        'index_file'           => (string) $col->index_file,
-                        'script_add'           => (string) $col->script_add,
-                        'script_search'        => (string) $col->script_search,
-                        'script_search_result' => (string) $col->script_search_result,
-                        'script_details'       => (string) $col->script_details,
-                        'path_to_lucene_index' => (string) $col->path_to_lucene_index,
-                        'extensions'           => $tab,
-                    );
-                }
-            }
-            $history = $xmlconfig->HISTORY;
-            $_SESSION['history']['usersdel']        = (string) $history->usersdel;
-            $_SESSION['history']['usersban']        = (string) $history->usersban;
-            $_SESSION['history']['usersadd']        = (string) $history->usersadd;
-            $_SESSION['history']['usersup']         = (string) $history->usersup;
-            $_SESSION['history']['usersval']        = (string) $history->usersval;
-            $_SESSION['history']['doctypesdel']     = (string) $history->doctypesdel;
-            $_SESSION['history']['doctypesadd']     = (string) $history->doctypesadd;
-            $_SESSION['history']['doctypesup']      = (string) $history->doctypesup;
-            $_SESSION['history']['doctypesval']     = (string) $history->doctypesval;
-            $_SESSION['history']['doctypesprop']    = (string) $history->doctypesprop;
-            $_SESSION['history']['usergroupsdel']   = (string) $history->usergroupsdel;
-            $_SESSION['history']['usergroupsban']   = (string) $history->usergroupsban;
-            $_SESSION['history']['usergroupsadd']   = (string) $history->usergroupsadd;
-            $_SESSION['history']['usergroupsup']    = (string) $history->usergroupsup;
-            $_SESSION['history']['usergroupsval']   = (string) $history->usergroupsval;
-            $_SESSION['history']['structuredel']    = (string) $history->structuredel;
-            $_SESSION['history']['structureadd']    = (string) $history->structureadd;
-            $_SESSION['history']['structureup']     = (string) $history->structureup;
-            $_SESSION['history']['subfolderdel']    = (string) $history->subfolderdel;
-            $_SESSION['history']['subfolderadd']    = (string) $history->subfolderadd;
-            $_SESSION['history']['subfolderup']     = (string) $history->subfolderup;
-            $_SESSION['history']['resadd']          = (string) $history->resadd;
-            $_SESSION['history']['resup']           = (string) $history->resup;
-            $_SESSION['history']['resdel']          = (string) $history->resdel;
-            $_SESSION['history']['resview']         = (string) $history->resview;
-            $_SESSION['history']['userlogin']       = (string) $history->userlogin;
-            $_SESSION['history']['userlogout']      = (string) $history->userlogout;
-            $_SESSION['history']['actionadd']       = (string) $history->actionadd;
-            $_SESSION['history']['actionup']        = (string) $history->actionup;
-            $_SESSION['history']['actiondel']       = (string) $history->actiondel;
-            $_SESSION['history']['contactadd']      = (string) $history->contactadd;
-            $_SESSION['history']['contactup']       = (string) $history->contactup;
-            $_SESSION['history']['contactdel']      = (string) $history->contactdel;
-            $_SESSION['history']['statusadd']       = (string) $history->statusadd;
-            $_SESSION['history']['statusup']        = (string) $history->statusup;
-            $_SESSION['history']['statusdel']       = (string) $history->statusdel;
-            $_SESSION['history']['docserversadd']   = (string) $history->docserversadd;
-            $_SESSION['history']['docserversdel']   = (string) $history->docserversdel;
-            $_SESSION['history']['docserversallow'] = (string) $history->docserversallow;
-            $_SESSION['history']['docserversban']   = (string) $history->docserversban;
-            //$_SESSION['history']['docserversclose']        = (string) $history->docserversclose;
-            $_SESSION['history']['docserverslocationsadd']   = (string) $history->docserverslocationsadd;
-            $_SESSION['history']['docserverslocationsdel']   = (string) $history->docserverslocationsdel;
-            $_SESSION['history']['docserverslocationsallow'] = (string) $history->docserverslocationsallow;
-            $_SESSION['history']['docserverslocationsban']   = (string) $history->docserverslocationsban;
-            $_SESSION['history']['docserverstypesadd']       = (string) $history->docserverstypesadd;
-            $_SESSION['history']['docserverstypesdel']       = (string) $history->docserverstypesdel;
-            $_SESSION['history']['docserverstypesallow']     = (string) $history->docserverstypesallow;
-            $_SESSION['history']['docserverstypesban']       = (string) $history->docserverstypesban;
-            $_SESSION['history']['contact_types_del']        = (string) $history->contact_types_del;
-            $_SESSION['history']['contact_types_add']        = (string) $history->contact_types_add;
-            $_SESSION['history']['contact_types_up']         = (string) $history->contact_types_up;
-            $_SESSION['history']['contact_purposes_del']     = (string) $history->contact_purposes_del;
-            $_SESSION['history']['contact_purposes_add']     = (string) $history->contact_purposes_add;
-            $_SESSION['history']['contact_purposes_up']      = (string) $history->contact_purposes_up;
-            $_SESSION['history']['contact_addresses_del']    = (string) $history->contact_addresses_del;
-            $_SESSION['history']['contact_addresses_add']    = (string) $history->contact_addresses_add;
-            $_SESSION['history']['contact_addresses_up']     = (string) $history->contact_addresses_up;
-
-            $i = 0;
-            foreach ($xmlconfig->MODULES as $modules) {
-
-                $_SESSION['modules'][$i] = array(
-                    'moduleid' => (string) $modules->moduleid,
-                    //,"comment" => (string) $MODULES->comment
-                );
-                $i ++;
-            }
-            $businessAppTools->_loadActionsPages();
-        }
-
-        if ($_SESSION['config']['usePHPIDS'] == 'true') {
-            $businessAppTools->_loadPHPIDSExludes();
-        }
-    }
-
-    /**
-     * Load Maarch modules configuration into sessions vars from modules/module_name/xml/config.xml files
-     * @param  array  $modules    Enabled modules of the application
-     * @param  boolean $mode_batch [description]
-     */
-    public static function loadModulesConfig($modules, $mode_batch=false)
-    {
-        require_once "core/class/class_request.php";
-        $coreTools = new core_tools();
-
-        // Browses enabled modules
-        for ($i = 0; $i < count($modules); $i ++) {
-            if (file_exists(
-                $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR
-                . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR
-                . 'modules' . DIRECTORY_SEPARATOR . $modules[$i]['moduleid']
-                . DIRECTORY_SEPARATOR . "xml" . DIRECTORY_SEPARATOR
-                . "config.xml"
-            )
-            ) {
-                $configPath = $_SESSION['config']['corepath'] . 'custom'
-                    . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id']
-                    . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR
-                    . $modules[$i]['moduleid'] . DIRECTORY_SEPARATOR . "xml"
-                    . DIRECTORY_SEPARATOR . "config.xml";
-            } else {
-                $configPath = 'modules' . DIRECTORY_SEPARATOR
-                    . $modules[$i]['moduleid'] . DIRECTORY_SEPARATOR . "xml"
-                    . DIRECTORY_SEPARATOR . "config.xml";
-            }
-
-            if (file_exists('modules'.DIRECTORY_SEPARATOR.$modules[$i]['moduleid'].DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.$_SESSION['config']['lang'].'.php')) {
-                include_once 'modules'.DIRECTORY_SEPARATOR.$modules[$i]['moduleid'].DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.$_SESSION['config']['lang'].'.php';
-            }
-
-            // Reads the config.xml file of the current module
-            if ( ! file_exists($configPath) ) {
-                throw new \Exception($configPath.' not-found');
-            }
-
-            $xmlconfig = simplexml_load_file($configPath);
-            // Loads into $_SESSION['modules_loaded'] module's informations
-            foreach ($xmlconfig->CONFIG as $CONFIG) {
-                $_SESSION['modules_loaded'][$modules[$i]['moduleid']]['name'] =
-                    (string) $CONFIG->name;
-                $_SESSION['modules_loaded'][$modules[$i]['moduleid']]['path'] =
-                    'modules' . DIRECTORY_SEPARATOR . $modules[$i]['moduleid']
-                    . DIRECTORY_SEPARATOR;
-                $comment = (string) $CONFIG->comment;
-                if ( !empty($comment) && defined($comment)
-                    && constant($comment) <> NULL
-                ) {
-                    $comment = constant($comment);
-                }
-                $_SESSION['modules_loaded'][$modules[$i]['moduleid']]['comment'] =
-                    $comment;
-
-                $_SESSION['modules_loaded'][$modules[$i]['moduleid']]['fileprefix'] = (string) $CONFIG->fileprefix;
-                $_SESSION['modules_loaded'][$modules[$i]['moduleid']]['loaded'] = (string) $CONFIG->loaded;
-            }
-
-            if (file_exists(
-                $_SESSION['config']['corepath'] . 'custom'
-                . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id']
-                . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR
-                . $modules[$i]['moduleid'] . DIRECTORY_SEPARATOR . "class"
-                . DIRECTORY_SEPARATOR . "class_modules_tools.php"
-            )
-            ) {
-                $path_module_tools = $_SESSION['config']['corepath'] . 'custom'
-                    . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id']
-                    . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR
-                    . $modules[$i]['moduleid'] . DIRECTORY_SEPARATOR . "class"
-                    . DIRECTORY_SEPARATOR . "class_modules_tools.php";
-            } else {
-                $path_module_tools = 'modules' . DIRECTORY_SEPARATOR
-                    . $modules[$i]['moduleid'] . DIRECTORY_SEPARATOR . "class"
-                    . DIRECTORY_SEPARATOR . "class_modules_tools.php";
-            }
-
-            if (file_exists($path_module_tools)) {
-                require_once($path_module_tools);
-                $modules_tools = new $modules[$i]['moduleid'];
-                //Loads the tables of the module into session
-                $modules_tools->build_modules_tables();
-                //Loads log keywords of the module
-            }
-
-        }
-
-//        if (!$mode_batch) {
-//            //Loads logs keywords of the actions
-//            $db = new Database();
-//            $stmt = $db->query(
-//                "select id, label_action from "
-//                . $_SESSION['tablename']['actions']
-//                . " where enabled = 'Y' and history = 'Y'"
-//            );
-//            while ($res = $stmt->fetchObject()) {
-//                array_push(
-//                    $_SESSION['history_keywords'],
-//                    array(
-//                        'id' =>'ACTION#' . $res->id,
-//                        'label' => $coreTools->show_string($res->label_action)
-//                    )
-//                );
-//            }
-//        }
-    }
-
-    /**
-     * Loads the modules specific vars into session
-     * @param  array $modules  Enabled modules of the application
-     * @param  array $userData [description]
-     */
-    public static function loadVarSession($modules, $userData)
-    {
-        for ($i = 0; $i < count($modules); $i ++) {
-            if (file_exists(
-                $_SESSION['config']['corepath'] . 'custom'
-                . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id']
-                . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR
-                . $modules[$i]['moduleid'] . DIRECTORY_SEPARATOR . "class"
-                . DIRECTORY_SEPARATOR . "class_modules_tools.php"
-            )
-            ) {
-                $path_module_tools = $_SESSION['config']['corepath'] . 'custom'
-                    . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id']
-                    . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR
-                    . $modules[$i]['moduleid'] . DIRECTORY_SEPARATOR . "class"
-                    . DIRECTORY_SEPARATOR . "class_modules_tools.php";
-            } else {
-                $path_module_tools = 'modules' . DIRECTORY_SEPARATOR
-                    . $modules[$i]['moduleid'] . DIRECTORY_SEPARATOR . "class"
-                    . DIRECTORY_SEPARATOR . "class_modules_tools.php";
-            }
-            if (file_exists($path_module_tools)) {
-                require_once $path_module_tools;
-                $modules_tools = new $modules[$i]['moduleid'];
-                if (method_exists(
-                    $modules[$i]['moduleid'], 'load_module_var_session'
-                )
-                ) {
-                    $modules_tools->load_module_var_session($userData);
-                }
-            }
-            //$coreTools = new core_tools();
-            //$coreTools->show_array($_SESSION['user']['baskets']);
-        }
-    }
-
-    /**
-     * Loads menu items of each module and the application into session from menu.xml files
-     * @param  array $modules Enabled modules of the application
-     * @return string          [description]
-     */
-    public static  function loadMenu($modules)
-    {
-        $k = 0;
-        if (file_exists(
-            $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR
-            . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'apps'
-            . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id']
-            . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'menu.xml'
-        )
-        ) {
-            $path = $_SESSION['config']['corepath'] . 'custom'
-                . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id']
-                . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR
-                . $_SESSION['config']['app_id'] . DIRECTORY_SEPARATOR . 'xml'
-                . DIRECTORY_SEPARATOR . 'menu.xml';
-        } else {
-            $path = 'apps' . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id']
-                . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'menu.xml';
-        }
-        // Reads the apps/apps_name/xml/menu.xml file  and loads into session
-        $xmlconfig = simplexml_load_file($path);
-        foreach ($xmlconfig->MENU as $MENU2) {
-            $_SESSION['menu'][$k]['id'] = (string) $MENU2->id;
-            if (isset($_SESSION['menu'][$k]['id'])
-                && isset($_SESSION['user']['services'][$_SESSION['menu'][$k]['id']])
-                && $_SESSION['user']['services'][$_SESSION['menu'][$k]['id']] == true
-            ) { // Menu Identifier must be equal to the Service identifier
-                $libmenu = (string) $MENU2->libconst;
-                if ( !empty($libmenu) && defined($libmenu)
-                    && constant($libmenu) <> NULL
-                ) {
-                    $libmenu  = constant($libmenu);
-                }
-                $_SESSION['menu'][$k]['libconst'] = $libmenu;
-                $_SESSION['menu'][$k]['url'] = $_SESSION['config']['businessappurl']
-                    . (string) $MENU2->url;
-                if (trim((string) $MENU2->target) <> "") {
-                    $tmp = preg_replace(
-                        '/\/core\/$/', '/', $_SESSION['urltocore']
-                    );
-                    $_SESSION['menu'][$k]['url'] = $tmp. (string) $MENU2->url;
-                    $_SESSION['menu'][$k]['target'] = (string) $MENU2->target;
-                }
-                $_SESSION['menu'][$k]['style'] = (string) $MENU2->style;
-                $_SESSION['menu'][$k]['show'] = true;
-            } else {
-                $_SESSION['menu'][$k]['libconst'] ='';
-                $_SESSION['menu'][$k]['url'] ='';
-                $_SESSION['menu'][$k]['style'] = '';
-                $_SESSION['menu'][$k]['show'] = false;
-            }
-            $k ++;
-        }
-        // Browses the enabled modules array
-        for ($i = 0; $i < count($modules); $i ++) {
-            if (file_exists(
-                $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR
-                . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR
-                . 'modules' . DIRECTORY_SEPARATOR . $modules[$i]['moduleid']
-                . DIRECTORY_SEPARATOR . "xml" . DIRECTORY_SEPARATOR . "menu.xml"
-            )
-            ) {
-                $menuPath = $_SESSION['config']['corepath'] . 'custom'
-                    . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id']
-                    . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR
-                    . $modules[$i]['moduleid'] . DIRECTORY_SEPARATOR . "xml"
-                    . DIRECTORY_SEPARATOR . "menu.xml";
-            } else {
-                $menuPath = 'modules' . DIRECTORY_SEPARATOR
-                    . $modules[$i]['moduleid'] . DIRECTORY_SEPARATOR . "xml"
-                    . DIRECTORY_SEPARATOR . "menu.xml";
-            }
-
-            if (file_exists(
-                    $_SESSION['config']['corepath'] . 'modules'
-                    . DIRECTORY_SEPARATOR . $modules[$i]['moduleid']
-                    . DIRECTORY_SEPARATOR . "xml" . DIRECTORY_SEPARATOR . "menu.xml"
-                ) || file_exists(
-                    $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR
-                    . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR
-                    . 'modules' . DIRECTORY_SEPARATOR . $modules[$i]['moduleid']
-                    . DIRECTORY_SEPARATOR . "xml" . DIRECTORY_SEPARATOR . "menu.xml"
-                )
-            ) {
-                $xmlconfig = simplexml_load_file($menuPath);
-                foreach ($xmlconfig->MENU as $MENU) {
-                    $_SESSION['menu'][$k]['id'] = (string) $MENU->id;
-                    if (isset(
-                            $_SESSION['user']['services'][$_SESSION['menu'][$k]['id']]
-                        )
-                        && $_SESSION['user']['services'][$_SESSION['menu'][$k]['id']] == true
-                    ) {
-                        $libmenu = (string) $MENU->libconst;
-                        if ( !empty($libmenu) && defined($libmenu)
-                            && constant($libmenu) <> NULL
-                        ) {
-                            $libmenu  = constant($libmenu);
-                        }
-                        $_SESSION['menu'][$k]['libconst'] = $libmenu;
-                        $_SESSION['menu'][$k]['url'] = $_SESSION['config']['businessappurl']
-                            . (string) $MENU->url;
-                        if (trim((string) $MENU->target) <> "") {
-                            $tmp = preg_replace(
-                                '/\/core\/$/', '/', $_SESSION['urltocore']
-                            );
-                            $_SESSION['menu'][$k]['url'] = $tmp
-                                . (string) $MENU->url;
-                            $_SESSION['menu'][$k]['target'] = (string) $MENU->target;
-                        }
-                        $_SESSION['menu'][$k]['style'] = (string) $MENU->style;
-                        $_SESSION['menu'][$k]['show'] = true;
-                    } else {
-                        $_SESSION['menu'][$k]['libconst'] = '';
-                        $_SESSION['menu'][$k]['url'] = '';
-                        $_SESSION['menu'][$k]['style'] = '';
-                        $_SESSION['menu'][$k]['show'] = false;
-                    }
-                    $k ++;
-                }
-            }
-        }
-
-        $coreTools = new core_tools();
-        $coreTools->load_quicklaunch($modules);
-    }
-
-    /**
-     * Loads application services into session
-     */
-    public static  function loadAppServices()
-    {
-        // Reads the application config.xml file
-        if (file_exists(
-            $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR
-            . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'apps'
-            . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id']
-            . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'services.xml'
-        )
-        ) {
-            $path = $_SESSION['config']['corepath'] . 'custom'
-                . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id']
-                . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR
-                . $_SESSION['config']['app_id'] . DIRECTORY_SEPARATOR . 'xml'
-                . DIRECTORY_SEPARATOR . 'services.xml';
-        } else {
-            $path = 'apps' . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id']
-                . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR
-                . 'services.xml';
-        }
-        $xmlconfig = simplexml_load_file($path);
-        $k = 0;
-        $m = 0;
-        include_once 'apps/' .$_SESSION['config']['app_id']. '/lang/' . $_SESSION['config']['lang'].'.php' ;
-        // Browses the services in that file and loads $_SESSION['app_services']
-        foreach ($xmlconfig->SERVICE as $service) {
-            $_SESSION['app_services'][$k] = array();
-            $_SESSION['app_services'][$k]['id'] = (string) $service->id;
-            $name = (string) $service->name;
-            if ( !empty($name) && defined($name) && constant($name) <> NULL ) {
-                $name  = constant($name);
-            }
-            $_SESSION['app_services'][$k]['name'] = $name;
-            $comment = (string) $service->comment;
-            if ( !empty($comment) && defined($comment)
-                && constant($comment) <> NULL
-            ) {
-                $comment  = constant($comment);
-            }
-            $_SESSION['app_services'][$k]['comment'] = $comment;
-            if (isset($service->servicepage)) {
-                $_SESSION['app_services'][$k]['servicepage'] = (string) $service->servicepage;
-                $_SESSION['app_services'][$k]['servicepage'] = preg_replace(
-                    '/&admin/', '&amp;admin',
-                    $_SESSION['app_services'][$k]['servicepage']
-                );
-                $_SESSION['app_services'][$k]['servicepage'] = preg_replace(
-                    '/&module/', '&amp;module',
-                    $_SESSION['app_services'][$k]['servicepage']
-                );
-            }
-            $_SESSION['app_services'][$k]['servicetype'] = (string) $service->servicetype;
-
-            if (isset($service->style)) {
-                $_SESSION['app_services'][$k]['style'] = (string) $service->style;
-            }
-
-            $systemService = (string) $service->system_service;
-            if ($systemService == "false") {
-                $_SESSION['app_services'][$k]['system_service'] = false;
-            } else {
-                $_SESSION['app_services'][$k]['system_service'] = true;
-            }
-            $_SESSION['app_services'][$k]['enabled'] = (string) $service->enabled;
-            $l = 0;
-            foreach ($service->WHEREAMIUSED as $whereAmIUsed) {
-                if (isset($whereAmIUsed)) {
-                    $_SESSION['app_services'][$k]['whereamiused'][$l]['page'] = (string) $whereAmIUsed->page;
-                    $_SESSION['app_services'][$k]['whereamiused'][$l]['nature'] = (string) $whereAmIUsed->nature;
-                    if (isset($whereAmIUsed->button_label)) {
-                        $_SESSION['app_services'][$k]['whereamiused'][$l]['button_label'] = (string) $whereAmIUsed->button_label;
-                    }
-                    if (isset($whereAmIUsed->tab_label)) {
-                        $label = (string) $whereAmIUsed->tab_label;
-                        if ( !empty($label) && defined($label)
-                            && constant($label) <> NULL
-                        ) {
-                            $label  = constant($label);
-                        }
-                        $_SESSION['app_services'][$k]['whereamiused'][$l]['tab_label'] = $label;
-                    }
-                    if (isset($whereAmIUsed->tab_order)) {
-                        $_SESSION['app_services'][$k]['whereamiused'][$l]['tab_order'] = (string) $whereAmIUsed->tab_order;
-                    }
-                    if (isset($whereAmIUsed->width)) {
-                        $_SESSION['app_services'][$k]['whereamiused'][$l]['width'] = (string) $whereAmIUsed->width;
-                    }
-                    if (isset($whereAmIUsed->frame_id)) {
-                        $_SESSION['app_services'][$k]['whereamiused'][$l]['frame_id'] = (string) $whereAmIUsed->frame_id;
-                    }
-                    if (isset($whereAmIUsed->height)) {
-                        $_SESSION['app_services'][$k]['whereamiused'][$l]['height'] = (string) $whereAmIUsed->height;
-                    }
-                    if (isset($whereAmIUsed->scrolling)){
-                        $_SESSION['app_services'][$k]['whereamiused'][$l]['scrolling'] = (string) $whereAmIUsed->scrolling;
-                    }
-                    if (isset($whereAmIUsed->style)) {
-                        $_SESSION['app_services'][$k]['whereamiused'][$l]['style'] = (string) $whereAmIUsed->style;
-                    }
-                    if (isset($whereAmIUsed->border)) {
-                        $_SESSION['app_services'][$k]['whereamiused'][$l]['border'] = (string) $whereAmIUsed->border;
-                    }
-                    $l ++;
-                }
-            }
-            $m = 0;
-            // Loads preprocess and postprocess
-            foreach ($service->PROCESSINBACKGROUND as $processInBackground) {
-                $_SESSION['app_services'][$k]['processinbackground'][$m]['page'] = (string) $processInBackground->page;
-                if ((string) $processInBackground->preprocess <> "") {
-                    $_SESSION['app_services'][$k]['processinbackground'][$m]['preprocess'] = (string) $processInBackground->preprocess;
-                }
-                if ((string) $processInBackground->postprocess <> "") {
-                    $_SESSION['app_services'][$k]['processinbackground'][$m]['postprocess'] = (string) $processInBackground->postprocess;
-                }
-                $_SESSION['app_services'][$k]['processinbackground'][$m]['processorder'] = (string) $processInBackground->processorder;
-                $m++;
-            }
-            $k ++;
-        }
-    }
-
-    /**
-     * Loads the services of each module into session
-     *
-     * @param array $modules Enabled modules of the application
-     */
-    public static  function loadModulesServices($modules)
-    {
-        // Browses the enabled modules array
-        for ($i = 0; $i < count($modules); $i ++) {
-            // Reads the module config.xml file
-            if (file_exists(
-                $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR
-                . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR
-                . 'modules' . DIRECTORY_SEPARATOR . $modules[$i]['moduleid']
-                . DIRECTORY_SEPARATOR . "xml" . DIRECTORY_SEPARATOR
-                . "services.xml"
-            )
-            ) {
-                $path = $_SESSION['config']['corepath'] . 'custom'
-                    . DIRECTORY_SEPARATOR  . $_SESSION['custom_override_id']
-                    . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR
-                    . $modules[$i]['moduleid'] . DIRECTORY_SEPARATOR . "xml"
-                    . DIRECTORY_SEPARATOR . "services.xml";
-            } else {
-                $path = 'modules' . DIRECTORY_SEPARATOR
-                    . $modules[$i]['moduleid'] . DIRECTORY_SEPARATOR . "xml"
-                    . DIRECTORY_SEPARATOR . "services.xml";
-            }
-            $xmlconfig = simplexml_load_file($path);
-            $k = 0;
-            $m = 0;
-            foreach ($xmlconfig->SERVICE as $service) {
-                if ((string) $service->enabled == "true") {
-                    $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['id'] = (string) $service->id;
-                    $name = (string) $service->name;
-                    if ( !empty($name) && defined($name)
-                        && constant($name) <> NULL
-                    ) {
-                        $name  = constant($name);
-                    }
-                    $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['name'] =
-                        $name;
-
-                    $comment = (string) $service->comment;
-                    if ( !empty($comment) && defined($comment)
-                        && constant($comment) <> NULL
-                    ) {
-                        $comment  = constant($comment);
-                    }
-                    $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['comment'] =
-                        $comment;
-
-                    if (isset($service->servicepage)) {
-                        $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['servicepage'] = (string) $service->servicepage;
-                    }
-                    $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['servicetype'] = (string) $service->servicetype;
-
-                    if (isset($service->style)) {
-                        $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['style'] = (string) $service->style;
-                    }
-                    $systemService =  (string) $service->system_service;
-                    if ($systemService == "false") {
-                        $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['system_service'] = false;
-                    } else {
-                        $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['system_service'] = true;
-                    }
-                    $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['enabled'] = (string) $service->enabled;
-
-                    $l = 0;
-                    foreach ($service->WHEREAMIUSED as $whereAmIUsed) {
-                        $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['whereamiused'][$l]['page'] = (string) $whereAmIUsed->page;
-                        $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['whereamiused'][$l]['nature'] = (string) $whereAmIUsed->nature;
-                        if (isset($whereAmIUsed->button_label)) {
-                            $label = (string) $whereAmIUsed->button_label;
-                            if ( !empty($label) && defined($label)
-                                && constant($label) <> NULL
-                            ) {
-                                $label  = constant($label);
-                            }
-                            $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['whereamiused'][$l]['button_label'] =
-                                $label;
-                        }
-                        if (isset($whereAmIUsed->tab_label)) {
-                            $label = (string) $whereAmIUsed->tab_label;
-                            if ( !empty($label) && defined($label)
-                                && constant($label) <> NULL
-                            ) {
-                                $label  = constant($label);
-                            }
-                            $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['whereamiused'][$l]['tab_label'] =
-                                $label;
-                        }
-                        if (isset($whereAmIUsed->tab_order)) {
-                            $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['whereamiused'][$l]['tab_order'] = (string) $whereAmIUsed->tab_order;
-                        }
-                        if (isset($whereAmIUsed->frame_id)) {
-                            $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['whereamiused'][$l]['frame_id'] = (string) $whereAmIUsed->frame_id;
-                        }
-                        if (isset($whereAmIUsed->width)) {
-                            $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['whereamiused'][$l]['width'] = (string) $whereAmIUsed->width;
-                        }
-                        if (isset($whereAmIUsed->height)) {
-                            $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['whereamiused'][$l]['height'] = (string) $whereAmIUsed->height;
-                        }
-                        if (isset($whereAmIUsed->scrolling)) {
-                            $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['whereamiused'][$l]['scrolling'] = (string) $whereAmIUsed->scrolling;
-                        }
-                        if (isset($whereAmIUsed->style)) {
-                            $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['whereamiused'][$l]['style'] = (string) $whereAmIUsed->style;
-                        }
-                        if (isset($whereAmIUsed->border)) {
-                            $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['whereamiused'][$l]['border'] = (string) $whereAmIUsed->border;
-                        }
-                        $l ++;
-                    }
-                    $m = 0;
-                    foreach ($service->PROCESSINBACKGROUND as $processInBackground) {
-                        $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['processinbackground'][$m]['page'] = (string) $processInBackground->page;
-                        if ((string) $processInBackground->preprocess <> "") {
-                            $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['processinbackground'][$m]['preprocess'] = (string) $processInBackground->preprocess;
-                        }
-                        if ((string) $processInBackground->postprocess <> "") {
-                            $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['processinbackground'][$m]['postprocess'] = (string) $processInBackground->postprocess;
-                        }
-                        $_SESSION['modules_services'][$modules[$i]['moduleid']][$k]['processinbackground'][$m]['processorder'] = (string) $processInBackground->processorder;
-                        $m ++;
-                    }
-                    $k ++;
-                }
-            }
-        }
-    }
-}
\ No newline at end of file
diff --git a/core/services/MaarchException.php b/core/services/MaarchException.php
deleted file mode 100755
index 04f2e57fd2a..00000000000
--- a/core/services/MaarchException.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-
-/**
-*   @copyright 2016 capgemini
-*
-*   This file is part of Maarch Framework.
-*
-*   Maarch Framework is free software: you can redistribute it and/or modify
-*   it under the terms of the GNU General Public License as published by
-*   the Free Software Foundation, either version 3 of the License, or
-*   (at your option) any later version.
-*
-*   Maarch Framework is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*   along with Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-require_once 'core/services/MaarchExceptionAbstract.php';
-
-class Core_MaarchException_Service extends Core_MaarchExceptionAbstract_Service{
-}
diff --git a/core/services/MaarchExceptionAbstract.php b/core/services/MaarchExceptionAbstract.php
deleted file mode 100755
index c030fa1c93a..00000000000
--- a/core/services/MaarchExceptionAbstract.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-/**
-*   @copyright 2016 capgemini
-*
-*   This file is part of Maarch Framework.
-*
-*   Maarch Framework is free software: you can redistribute it and/or modify
-*   it under the terms of the GNU General Public License as published by
-*   the Free Software Foundation, either version 3 of the License, or
-*   (at your option) any later version.
-*
-*   Maarch Framework is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*   along with Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * Service de gestion des données en session
- */
-class Core_MaarchExceptionAbstract_Service extends Exception {
-
-    // Redéfinissez l'exception ainsi le message n'est pas facultatif
-    public function __construct($message, $code = 0, Exception $previous = null) {
-
-        // assurez-vous que tout a été assigné proprement
-        parent::__construct($message, $code, $previous);
-    }
-
-    // chaîne personnalisée représentant l'objet
-    public function __toString() {
-        return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
-    }
-}
diff --git a/core/services/Session.php b/core/services/Session.php
deleted file mode 100755
index b8f6c7d638c..00000000000
--- a/core/services/Session.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-/**
-*   @copyright 2017 Maarch
-*
-*   This file is part of Maarch Framework.
-*
-*   Maarch Framework is free software: you can redistribute it and/or modify
-*   it under the terms of the GNU General Public License as published by
-*   the Free Software Foundation, either version 3 of the License, or
-*   (at your option) any later version.
-*
-*   Maarch Framework is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*   along with Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-require_once 'core/services/SessionAbstract.php';
-
-class Core_Session_Service extends Core_SessionAbstract_Service{
-	// Do your stuff
-}
diff --git a/core/services/SessionAbstract.php b/core/services/SessionAbstract.php
deleted file mode 100755
index 1cd99e60d98..00000000000
--- a/core/services/SessionAbstract.php
+++ /dev/null
@@ -1,310 +0,0 @@
-<?php
-
-/**
-*   @copyright 2017 Maarch
-*
-*   This file is part of Maarch Framework.
-*
-*   Maarch Framework is free software: you can redistribute it and/or modify
-*   it under the terms of the GNU General Public License as published by
-*   the Free Software Foundation, either version 3 of the License, or
-*   (at your option) any later version.
-*
-*   Maarch Framework is distributed in the hope that it will be useful,
-*   but WITHOUT ANY WARRANTY; without even the implied warranty of
-*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*   GNU General Public License for more details.
-*
-*   You should have received a copy of the GNU General Public License
-*   along with Maarch Framework.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-require_once 'core/services/Abstract.php';
-require_once 'core/class/class_functions.php';
-require_once 'core/class/class_security.php';
-
-/**
- * Service de gestion des données en session
- */
-class Core_SessionAbstract_Service extends Core_Abstract_Service {
-    
-    /**
-     * Récupération de la liste des méthodes disponibles via api
-     * 
-     * @return string[] La liste des méthodes
-     */
-    public static function getApiMethod() {
-        $aApiMethod = parent::getApiMethod();
-        $aApiMethod['getUserId']          = 'getUserId';
-        $aApiMethod['getUserEntitiesLst'] = 'getUserEntitiesLst';
-        $aApiMethod['InitializeAntiXss']  = 'InitializeAntiXss';
-        return $aApiMethod;
-    }
-    
-    /**
-     * Renvoie les informations de l'utilisateur courant dans la session
-     * @api rest.php?module=core&service=Core_Session_Service&method=getUser
-     * @throw \Exception $e
-     * @param array $args
-     * @return array $aUser
-     **/
-    public static function getUser(array $args = []) {
-        return empty($_SESSION['user'])?null:$_SESSION['user'];
-    }
-
-    /**
-     * Renvoie la valeur de la session anti_xss. on la définie si elle n'existe pas
-     * @api rest.php?module=core&service=Core_Session_Service&method=InitializeAntiXss
-     * @throw \Exception $e
-     * @param array $args
-     * @return array $aUser
-     **/
-    public static function InitializeAntiXss(array $args = []){
-        if(empty($_SESSION['anti_xss'])){
-            $_SESSION['anti_xss'] = uniqid();
-        }
-        return $_SESSION['anti_xss'];
-    }
-    
-    /**
-     * Renvoie le userid courant dans la session
-     * @throw \Exception $e
-     * @param array $args
-     *  - none
-     * @return string $sUserId
-     **/
-    public static function getUserId(array $args = []) {
-        $aUser = self::getUser();
-        if ( !empty($aUser['UserId']) ){
-            return $aUser['UserId'];
-        }
-
-        $userSSOHeader = '';
-        if (!empty($_SERVER['HTTP_'.HEADER_USER_UID])) {
-            $userSSOHeader = $_SERVER['HTTP_' .HEADER_USER_UID];
-        } else if (!empty($_SERVER['HTTP_' .HEADER_USER_NIGEND])) {
-            $userSSOHeader = $_SERVER['HTTP_' .HEADER_USER_NIGEND];
-        }
-        return $userSSOHeader;
-    }
-
-    /**
-     * Renvoie les entité de l'utilisateur en session
-     * @throw \Exception $e
-     * @param array $args
-     * @return array $aEntities [aEntitie]
-     **/
-    public static function getUserEntities(array $args = []) {
-        return $_SESSION['user']['entities'];
-    }
-
-    /**
-     * Renvoie la liste des entités de l'utilisateur en session (juste leur name)
-     * @throw \Exception $e
-     * @param array $args
-     * @return array $aEntities [string ENTITY_ID,string ENTITY_ID,...]
-     **/
-    public static function getUserEntitiesLst(array $args = []) {
-        $aUserEntities = self::getUserEntities();
-        $aLst = [];
-        foreach ($aUserEntities as $aEntitie) {
-            $aLst[] = $aEntitie['ENTITY_ID'];
-        }
-        return $aLst;
-    }
-
-    /**
-     * Renvoie les entité de l'utilisateur en session
-     * @throw \Exception $e
-     * @param array $args
-     * @return string $sEntities
-     **/
-    public static function getUserPrimaryentity(array $args = []) {
-        return $_SESSION['user']['primaryentity'];
-    }
-
-    /**
-     * Authentification d'un utilisateur
-     * - Vérifie que l'utilisateur existe (pas son code)
-     * - Charge l'utilisateur en session (le connecte)
-     * @param string $userId identifiant de l'utilisateur
-     * @return false|array false en cas d'echec, un tableau avec l'utilisateur sinon
-     */
-    public function authentication($userId) {
-        if ( empty($userId) ) {
-            return false;
-        }
-        if ( ! is_string($userId) ) {
-            return false;
-        }
-        $authenticated = false;
-        $func = new functions();
-
-        $connexion = new Database();
-
-        $_SESSION['user']['UserId'] = $userId;
-        $userID = str_replace('\'', '', $_SESSION['user']['UserId']);
-        $userID = str_replace('=', '', $userID);
-        $userID = str_replace('"', '', $userID);
-        $userID = str_replace('*', '', $userID);
-        $userID = str_replace(';', '', $userID);
-        $userID = str_replace('--', '', $userID);
-        $userID = str_replace(',', '', $userID);
-        $userID = str_replace('$', '', $userID);
-        $userID = str_replace('>', '', $userID);
-        $userID = str_replace('<', '', $userID);
-
-        $sec = new security();
-        $query = "SELECT * FROM users WHERE user_id = ? AND STATUS <> 'DEL'";
-
-        $stmt = $connexion->query(
-            $query, 
-            [$userID]
-        );
-
-        if ($stmt->rowCount() <= 0) {
-            return false;
-        }
-        $array = array();
-        $error = '';
-        $uc = new users_controler();
-
-        $database = new Database();
-        $comp = " and STATUS <>:status";
-        $params = array('status' => 'DEL');
-        $s_login = $userId;
-        $user = $uc->getWithComp($s_login, $comp, $params);
-        if (empty($user)) {
-            return false;
-        }
-        if ($user->__get('enabled') != 'Y') {
-            return false;
-        }
-        $ugc = new usergroups_controler();
-        $sec_controler = new SecurityControler();
-        $serv_controler = new ServiceControler();
-        if (isset($_SESSION['modules_loaded']['visa'])) {
-            if ($user->__get('signature_path') <> '' 
-                && $user->__get('signature_file_name') <> '' 
-            ) {
-                $_SESSION['user']['signature_path'] = $user->__get('signature_path');
-                $_SESSION['user']['signature_file_name'] = $user->__get('signature_file_name');
-                $db = new Database();
-                $query = "select path_template from " 
-                    . _DOCSERVERS_TABLE_NAME 
-                    . " where docserver_id = 'TEMPLATES'";
-                $stmt = $db->query($query);
-                $resDs = $stmt->fetchObject();
-                $pathToDs = $resDs->path_template;
-                $_SESSION['user']['pathToSignature'] = $pathToDs . str_replace(
-                        "#", 
-                        DIRECTORY_SEPARATOR, 
-                        $_SESSION['user']['signature_path']
-                    )
-                    . $_SESSION['user']['signature_file_name'];
-            }
-        }
-
-        $array = array(
-            'change_pass'         => $user->__get('change_password'),
-            'UserId'              => $user->__get('user_id'),
-            'FirstName'           => $user->__get('firstname'),
-            'LastName'            => $user->__get('lastname'),
-            'Phone'               => $user->__get('phone'),
-            'Mail'                => $user->__get('mail'),
-            'department'          => $user->__get('department'),
-            'thumbprint'          => $user->__get('thumbprint'),
-            'signature_path'      => $user->__get('signature_path'),
-            'signature_file_name' => $user->__get('signature_file_name'),
-            'pathToSignature'     => empty($_SESSION['user']['pathToSignature'])?'':$_SESSION['user']['pathToSignature'],
-            'Status'              => $user->__get('status'),
-            'cookie_date'         => $user->__get('cookie_date'),
-        );
-
-        $array['primarygroup'] = $ugc ->getPrimaryGroup(
-            $array['UserId']
-        );
-        $tmp = $sec_controler->load_security(
-            $array['UserId']
-        );
-        $array['collections'] = $tmp['collections'];
-        $array['security'] = $tmp['security'];
-        $serv_controler->loadEnabledServices();
-        $business_app_tools = new business_app_tools();
-        $core_tools = new core_tools();
-        $business_app_tools->load_app_var_session($array);
-        Core_CoreConfig_Service::loadVarSession($_SESSION['modules'], $array);
-        
-        /************Temporary fix*************/ 
-        if (isset($_SESSION['user']['baskets'])) {
-            $array['baskets'] = $_SESSION['user']['baskets'];
-        }
-        if (isset($_SESSION['user']['entities'])) {
-            $array['entities'] = $_SESSION['user']['entities'];
-        }
-        if (isset($_SESSION['user']['primaryentity'])) {
-            $array['primaryentity'] = $_SESSION['user']['primaryentity'];
-        }
-
-        if (isset($_SESSION['user']['redirect_groupbasket'])) {
-            $array['redirect_groupbasket'] = $_SESSION['user']['redirect_groupbasket'];
-        }
-        /*************************************/
-        $array['services'] = $serv_controler->loadUserServices(
-            $array['UserId']
-        );
-        
-        if ($_SESSION['history']['userlogin'] == 'true') {
-            //add new instance in history table for the user's connexion
-            $hist = new history();
-            if(!isset($_SERVER['REMOTE_ADDR'])){
-                $ip = 'testU';
-            } else {
-				$ip = $_SERVER['REMOTE_ADDR'];
-			}
-
-            $_SESSION['user']['UserId']       = $s_login;
-            $_SESSION['user']['department']   = $array['department'];
-            $_SESSION['user']['thumbprint']   = $array['thumbprint'];
-            $_SESSION['user']['primarygroup'] = $array['primarygroup'];
-            $hist->add(
-                $_SESSION['tablename']['users'],
-                $s_login,
-                'LOGIN','userlogin',
-                _LOGIN_HISTORY . ' '. $s_login . ' IP : ' . $ip,
-                $_SESSION['config']['databasetype']
-            );
-        }
-
-        return array(
-            'user'  => $array/*,
-            'error' => $error,
-            'url'   => 'index.php?' . $_SESSION['requestUri']*/
-        );
-
-/*
-        if ($array['change_pass'] == 'Y') {
-            return array(
-                'user'  => $array,
-                'error' => $error,
-                'url'   => 'index.php?display=true&page=change_pass'
-            );
-        }else if (isset($_SESSION['requestUri'])
-            && trim($_SESSION['requestUri']) <> ''
-            && ! preg_match('/page=login/', $_SESSION['requestUri'])) {
-            return array(
-                'user'  => $array,
-                'error' => $error,
-                'url'   => 'index.php?' . $_SESSION['requestUri']
-            );
-        } else {
-            return array(
-                'user'  => $array,
-                'error' => $error,
-                'url'   => 'index.php'
-            );
-        }
-*/
-        return true;
-    }
-}
\ No newline at end of file
-- 
GitLab